Phpblock mycal()
提供: GeeklogJpWiki
[3]管理方法 > 管理者が導入後すぐ試せる簡単カスタマイズ > PHPブロックでブロックをカスタマイズする > サイトカレンダPHPブロック
- 開発サイト:http://www.portalparts.com
- ダウンロード:*ダウンロード:日本語版標準パッケージ(20061121版)に組み込み済み
目次 |
サイトカレンダPHPブロック phpblock_mycal()
ブロックにミニカレンダを表示します。各日付からイベントや記事など、その日に書かれたコンテンツ検索結果にリンクします。
利用方法
- 管理者ログインしてブロック管理画面を表示します。
- ブロックを新規作成します
- ブロックのモードを「PHPブロック」にします。
- 「関数」のフォームに、phpblock_mycalを指定します。
インストール方法
この機能は日本語版標準パッケージ(20061121版)で組み込み済みですが、それ以前のバージョンの場合には、以下のように/system/custom/phpblock_mycal.phpを/system/lib-custom.phpに組み込みます。
READMEファイルのとおり、インストールします。
/system/lib-custom.php
以下の行を追加してプログラムを組み込みます。
// カレンダー表示PHPブロック関数を組み込む require_once( 'custom/phpblock_mycal.php' );
/system/custom/phpblock_mycal.php
<?php
/**
* Blaine Lang July 19/03 www.portalparts.com
* This Geeklog PHP function displays a formated monthly calendar in a block
* It is integrated into the site search feature to allow users to click on a date and
* retrieve all postings and updates for that date.
* Also hightlights dates with calendar events.
* Creates tool-tip title when user has cursor over date with a highlighted calendar event - displays event description
* Jun 16/2006: Komma Tetsuko www.ivysoho.co.jp (for japanese)
**/
function phpblock_mycal() {
global $_CONF;
define ("_mycal_ClickonDate", "日付をクリック");
include_once($_CONF['path_html'] . "/mycal/main.php");
return display_calendar();
}
?>
/public_html/mycal/main.php
<?php
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// | Geeklog SiteCalendar Block version 2.3 |
// | Only Supported with Geeklog 1.3.8 and new Search Class |
// +---------------------------------------------------------------------------+
// | main.php |
// | Main program to view site calendar that displays GL Calendar |
// | events and hooks into the GL search to show any site updates |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2000,2001 by the following authors: |
// | Geeklog Author: Tony Bibbs - tony@tonybibbs.com |
// | Block Author: Blaine Lang - geeklog@langfamily.ca |
// | Original PHP Calendar by Scott Richardson - srichardson@scanonline.com |
// +---------------------------------------------------------------------------+
// | |
// | This program is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public License |
// | as published by the Free Software Foundation; either version 2 |
// | of the License, or (at your option) any later version. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
// Release History
/********************************************************************************
* June 12/2002: Blaine Lang *
* Modified to work with Geeklog - structured as functions *
* and building HTML output to be called as a phpblock and *
* *
* Sept 2/02: Fixed a bug where today was not being higlighted in the next month *
* Changed all occurances of $InThisMonth to $GLOBALS['InThisMonth'] *
* *
* Sept 15/02: Version 2.0 *
* ALmost a complete re-write, code restructured *
* Integrated vesion with Site Search and Events Calendar *
* Displayed dates are now active hyperlinks to search results for that day *
* Added ability to view next/prev months *
* Now using Template classes for fonts *
* Fixed bug with extra week showing up occasionally *
* *
* Sept 16/02: Fixed bug where I was not checking access to events that were *
* displayed on the calendar - added access checks. *
* Note: Currently only checking system calendar for events - not personal *
* Nov 08/02: Gorka Olaizola <gorka@escomposlinux.org> *
* Fixed dates when week starts in previous month *
* Fixed dates when switching years *
* Added setlocale and strftime for printing the month in local language *
* *
* Dec 03/02: Replaced a couple HTML fixes that had been made since the version *
* used by Gorka when he did his changes *
* *
* January 25/2003: Stephen Magyari *
* Removed the height=100% attribute from the first and last tables in *
* $BlockDisplay to address a display anomaly in IE 5.2 on Mac OS X, added a *
* missing </tr> after the month header, and added class="mycallink" attribute *
* to the 3 occurrences of $event_url *
* *
* Feb 01/2003: Blaine Lang *
* Fixed sellocale() error displayed that occured under PHP 4.3 *
* *
* *
* Jul 19/2003: Blaine Lang *
* Modified for Geeklog 1.3.8 - Core GL Search completely replaced *
* New Search Class is now being used. No longer need to modify GL Files *
* Rename SiteCalendar - and is now self contained - no modifications requried *
* *
* Apr 13/2004: Niels Leenheer *
* Large rewrite to ensure the calender only uses one query to fetch all events *
* instead of one query for each day. This reduces the number of queries by *
* 27 or 34. Also, multiple bugs are fixed such as: *
* - Multiple events on the same say are now properly shown *
* - If there were multiple events on the same day and the first event was *
* off limits for the current user, the other events were not taken into *
* acount, and as a result that day was not marked as a day with an event *
* - Weekday abbreviations are now displayed according to the current locale *
* - Removed <html> and <body> tags from the output, because the output is used *
* in an already existing html document. *
* *
* Mar 29/2006: Blaine Lang ( mycal version 1.5 ) *
* Updated for Geeklog Version 1.4 *
* *
* Jun 16/2006: Komma Tetsuko (for japanese) *
* Oct 22/2006: mystral-kk - a minor bug fix *
*********************************************************************************/
define ("_MYCAL_DAY_", 60 * 60 * 24);
function display_calendar()
{
global $_TABLES, $_CONF;
//@@@@@ setlocale(LC_TIME, "");
setlocale(LC_TIME,$_CONF['locale']);
if( !isset($_POST['month']) )
{
$WorkDate = date("Y/m/d");
}
else
{
$WorkDate = $_POST['month'];
$GLOBALS['WorkDate'] = $WorkDate;
}
// Determine the first and last day to display
$base = strtotime($WorkDate) + 60 * 60 * 12;
$firstdayofmonth = $base - ((date("d", $base) - 1) * _MYCAL_DAY_);
$daysinmonth = date("t", $firstdayofmonth);
$lastdayofmonth = $firstdayofmonth + (($daysinmonth - 1) * _MYCAL_DAY_);
$firstdaytodisplay = $firstdayofmonth - (strftime ('%w', $firstdayofmonth) * _MYCAL_DAY_);
$lastdaytodisplay = $lastdayofmonth + ((6 - strftime ('%w', $lastdayofmonth)) * _MYCAL_DAY_);
$totaldays = ((($lastdaytodisplay - $firstdaytodisplay) / _MYCAL_DAY_) + 1);
$totalweeks = $totaldays / 7;
$firststr = date("Y-m-d", $firstdaytodisplay);
$laststr = date("Y-m-d", $lastdaytodisplay);
// Get the events
$events = array();
$eventSql = "SELECT eid, title,url,datestart,dateend,group_id,owner_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['events']} WHERE datestart >= '$firststr' AND datestart <= '$laststr' ";
$eventRes = DB_query($eventSql);
while ($event = DB_fetchArray($eventRes))
$events[$event['datestart']][$event['eid']] = $event;
// Header with Month Title and Next/Prev buttons
$BlockDisplay .= "<table style='margin-top:3px'class='mycalTitle' width='100%' border='0' ><tr>"
. "<td colspan='7' height='8%' align='center' >"
. "<table height='100%' width='100%' border='0'><tr>"
. "<td class='mycalTopTitle' align='center'>"
. "<font size='2'><b>".ucfirst(strftime("%Y年 %m月", $base))."</b></font></td>"
. "</tr></table>";
// Main Calendar
$BlockDisplay .= "</td></tr><tr>";
// @@@@ 2006/10/22 mystral-kk changed -->
// for ($i = 0; $i < 7; $i++)
// {
// $BlockDisplay .= "<td align='center' valign='top' width='14%' class='mycalTitle'><font size='1'><b>"
// . ucfirst(strftime("%a", $firstdaytodisplay + ($i * _MYCAL_DAY_)))
// . "</b></font></td>";
// }
$wdays = array('日', '月', '火', '水', '木', '金', '土');
for ($i = 0; $i < 7; $i++)
{
$BlockDisplay .= "<td align='center' valign='top' width='14%' class='mycalTitle'><font size='1'><b>"
. $wdays[$i]
. "</b></font></td>";
}
// @@@@ 2006/10/22 mystral-kk changed <--
$BlockDisplay .= "</tr>";
for ($w = 0; $w < $totalweeks; $w++)
{
$BlockDisplay .= "<tr>";
for ($d = 0; $d < 7; $d++)
{
$BlockDisplay .= "<td align='left' valign='top' height='14%' "
. mycal_eventurl($events, $firstdaytodisplay + (_MYCAL_DAY_ * ($d + ($w * 7))), $base)
. "</center></td>";
}
$BlockDisplay .= "</tr>";
}
$PrevMonth = date("Y/m/d", strtotime($WorkDate . "-1 month")); // komma
$NextMonth = date("Y/m/d", strtotime($WorkDate . "+1 month")); // komma
$BlockDisplay .= "</table>"
. "<table width='100%' border='0'><tr>"
. "<td>"
. "<form method='post' action='".$_CONF['site_url'] . "/index.php' >"
. "<input type='submit' value=' < '>"
. "<input type='hidden' name='month' value='".$PrevMonth."'>"
. "</form></td>"
. "<td align='center'><font size='-2'>"._mycal_ClickonDate."</font></td>"
. "<td>"
. "<form align='right' method='post' action='".$_CONF['site_url'] . "/index.php' >"
. "<input type='submit' value=' > '>"
. "<input type='hidden' name='month' value='".$NextMonth."'>"
. "</form></td>"
. "</table>";
return $BlockDisplay;
}
function mycal_eventurl(&$events, $timestamp, $base)
{
global $_TABLES, $_CONF;
$HighlightToday = false;
if (date("Y/m/d") == date("Y/m/d", $timestamp))
{
$HighlightToday = true;
}
$day = date("j", $timestamp);
$key = date("Y-m-d", $timestamp);
$date = date("Y/m/d", $timestamp);
$eventsfound = '';
if (count($events[$key]))
{
while (list($k,$v) = each($events[$key]))
{
if (SEC_hasAccess($v['owner_id'],$v['group_id'],$v['perm_owner'],$v['perm_group'],$v['perm_members'],$v['perm_anon']) > 0)
{
if ($eventsfound != '') $eventsfound .= ', ';
$eventsfound .= $v['title'];
}
}
}
if ($eventsfound)
{
if ($HighlightToday)
$class = "mycalEventHighlight mycalTodayHighlight";
else
$class = "mycalEventHighlight";
$event_url .= 'class="' . $class . '"><center><a class="mycallink" href="'
. $_CONF["site_url"] . '/mycal/calsearch.php?datestart=' . $key
. '&dateend=' . $key . '&type=all&mode=search&topic=0"&author=0 TITLE="'
. $eventsfound . '"><b>' . $day . '</b></a>';
}
else
{
if (date("m", $base) != date("m", $timestamp))
{
$event_url = 'class="mycalNextMonth"><center><a class="mycallink" href="'
. $_CONF["site_url"] . '/mycal/calsearch.php?datestart=' . $key
. '&dateend=' . $key . '&type=all&mode=search&topic=0&author=0">'
. $day . '</a>';
}
else
{
if ($HighlightToday)
$class = "mycalTodayHighlight";
else
$class = "mycalDateField";
$event_url .= 'class="' . $class . '"><center><a class="mycallink" href="'
. $_CONF["site_url"] . '/mycal/calsearch.php?datestart=' . $key
. '&dateend=' . $key . '&type=all&mode=search&topic=0&author=0"><b>'
. $day . '</b></a>';
}
}
return $event_url;
}
?>
情報のある日だけリンクを張る場合は,上記ソースの変わりに,次のソースにします.
<?php
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// | Geeklog SiteCalendar Block version 2.3 |
// | Only Supported with Geeklog 1.4.0 and new Search Class |
// +---------------------------------------------------------------------------+
// | main.php |
// | Main program to view site calendar that displays GL Calendar |
// | events and hooks into the GL search to show any site updates |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2000,2001 by the following authors: |
// | Geeklog Author: Tony Bibbs - tony@tonybibbs.com |
// | Block Author: Blaine Lang - geeklog@langfamily.ca |
// | Block Modified: Yoshinori Tahara |
// | Original PHP Calendar by Scott Richardson - srichardson@scanonline.com |
// +---------------------------------------------------------------------------+
// | |
// | This program is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public License |
// | as published by the Free Software Foundation; either version 2 |
// | of the License, or (at your option) any later version. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +---------------------------------------------------------------------------+
// Release History
/*******************************************************************************
* 2007.1.3 : Yoshinori Tahara as dengen *
* Geeklog SiteCalendar Block "mycal" version 2.5 をベースにして開発しました。 *
* 変更点:検索結果のない日にちにはリンク処理をおこないません。 *
********************************************************************************/
define ("_MYCAL_DAY_", 60 * 60 * 24);
function display_calendar()
{
global $_TABLES, $_CONF;
global $_PLUGINS;
//@@@@@ setlocale(LC_TIME, "");
setlocale(LC_TIME,$_CONF['locale']);
if( !isset($_GET['month']) )
{
$WorkDate = date("Y-m-d");
}
else
{
$WorkDate = $_GET['month'];
$GLOBALS['WorkDate'] = $WorkDate;
}
// Determine the first and last day to display
$base = strtotime($WorkDate) + 60 * 60 * 12;
$firstdayofmonth = $base - ((date("d", $base) - 1) * _MYCAL_DAY_);
$daysinmonth = date("t", $firstdayofmonth);
$lastdayofmonth = $firstdayofmonth + (($daysinmonth - 1) * _MYCAL_DAY_);
$firstdaytodisplay = $firstdayofmonth - (strftime ('%w', $firstdayofmonth) * _MYCAL_DAY_);
$lastdaytodisplay = $lastdayofmonth + ((6 - strftime ('%w', $lastdayofmonth)) * _MYCAL_DAY_);
$totaldays = ((($lastdaytodisplay - $firstdaytodisplay) / _MYCAL_DAY_) + 1);
$totalweeks = $totaldays / 7;
$firststr = date("Y-m-d", $firstdaytodisplay);
$laststr = date("Y-m-d", $lastdaytodisplay);
$ds = explode("-", $firststr);
$de = explode("-", $laststr);
$startdate = mktime( 0, 0, 0,$ds[1],$ds[2],$ds[0]);
$enddate = mktime(23,59,59,$de[1],$de[2],$de[0]);
$prevmonth = date("Y-m-d", strtotime($WorkDate . "-1 month")); // komma
$nextmonth = date("Y-m-d", strtotime($WorkDate . "+1 month")); // komma
$title = ucfirst( strftime( ( substr($_CONF['locale'],0,2) == "ja" ) ? "%Y年 %m月" : "%B %Y", $base ) );
// Get the events
$events = array();
$sql = "SELECT eid, title,url,datestart,dateend,group_id,owner_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['events']} WHERE datestart >= '$firststr' AND datestart <= '$laststr' ";
$result = DB_query($sql);
while ( $o = DB_fetchArray($result) )
$events[ $o['datestart'] ][ $o['eid'] ] = $o;
// Check stories
$days = array();
$sql = "SELECT UNIX_TIMESTAMP(date) AS day "
. "FROM {$_TABLES['stories']} "
. "WHERE (draft_flag = 0) AND (date <= NOW()) "
. "AND (UNIX_TIMESTAMP(date) BETWEEN '$startdate' AND '$enddate') ";
$result = DB_query ($sql);
while ( $o = DB_fetchArray($result) )
$days[ date( "Y-m-d", $o['day'] ) ] = 1;
// Check comments
$sql = "SELECT UNIX_TIMESTAMP(date) AS day "
. "FROM {$_TABLES['comments']} "
. "WHERE (date <= NOW()) AND (UNIX_TIMESTAMP(date) BETWEEN '$startdate' AND '$enddate') ";
$result = DB_query ($sql);
while ( $o = DB_fetchArray($result) )
$days[ date( "Y-m-d", $o['day'] ) ] = 1;
// Check forum
if ( function_exists( 'plugin_dopluginsearch_forum' ) )
{
$sql = "SELECT date AS day "
. "FROM {$_TABLES['gf_topic']} "
. "WHERE (date <= NOW()) AND (date BETWEEN '$startdate' AND '$enddate') ";
$result = DB_query ($sql);
while ( $o = DB_fetchArray($result) )
$days[ date( "Y-m-d", $o['day'] ) ] = 1;
}
// Check staticpages
if ( function_exists( 'plugin_dopluginsearch_staticpage' ) )
{
$sql = "SELECT UNIX_TIMESTAMP(sp_date) AS day "
. "FROM {$_TABLES['staticpage']} "
. "WHERE (sp_date <= NOW()) AND (UNIX_TIMESTAMP(sp_date) BETWEEN '$startdate' AND '$enddate') ";
$result = DB_query ($sql);
while ( $o = DB_fetchArray($result) )
$days[ date( "Y-m-d", $o['day'] ) ] = 1;
}
// Check links
if ( function_exists( 'plugin_dopluginsearch_links' ) )
{
$sql = "SELECT UNIX_TIMESTAMP(date) AS day "
. "FROM {$_TABLES['links']} "
. "WHERE (date <= NOW()) AND (UNIX_TIMESTAMP(date) BETWEEN '$startdate' AND '$enddate') ";
$result = DB_query ($sql);
while ( $o = DB_fetchArray($result) )
$days[ date( "Y-m-d", $o['day'] ) ] = 1;
}
// Header with Month Title and Next/Prev buttons
$BlockDisplay .= "<!-- SiteCalendar Block -->\r<table class='mycalTitle' summary='Site Calendar'>\r"
. "<tr><td colspan='7' class='mycalTitle'>\r"
. "<a href='" . $_CONF['site_url'] . "/index.php?month=" . $prevmonth . "' >«</a>"
. " " . $title . " "
. "<a href='" . $_CONF['site_url'] . "/index.php?month=" . $nextmonth . "' >»</a>\r"
. "</td></tr>\r";
// Main Calendar
$BlockDisplay .= "<tr>";
// @@@@ 2006/10/22 mystral-kk changed | 2007/01/06 dengen, ivy changed -->
// for ($i = 0; $i < 7; $i++)
// {
// $BlockDisplay .= "<td align='center' valign='top' width='14%' class='mycalTitle'><font size='1'><b>"
// . ucfirst(strftime("%a", $firstdaytodisplay + ($i * _MYCAL_DAY_)))
// . "</b></font></td>";
// }
$wdays = array('日', '月', '火', '水', '木', '金', '土');
for ($i = 0; $i < 7; $i++)
{
$BlockDisplay .= "<th>"
. $wdays[$i]
. "</th>";
}
// @@@@ 2007/01/06 dengen, ivy changed <--
$BlockDisplay .= "</tr>\r";
for ($w = 0; $w < $totalweeks; $w++)
{
$BlockDisplay .= "<tr class='day'>\r";
for ($d = 0; $d < 7; $d++)
{
$BlockDisplay .= mycal_eventurl($events, $firstdaytodisplay + (_MYCAL_DAY_ * ($d + ($w * 7))), $base, $days);
}
$BlockDisplay .= "</tr>\r";
}
$BlockDisplay .= "</table>\r";
return $BlockDisplay;
}
function mycal_eventurl(&$events, $timestamp, $base, $days)
{
global $_TABLES, $_CONF;
$day = date( "j", $timestamp );
$key = date( "Y-m-d", $timestamp );
$today = ( date("Y-m-d") == $key );
$active = ( $days[ $key ] == 1 );
$event = '';
if ( count( $events[$key] ) )
{
while ( list($k,$v) = each($events[$key]) )
{
if (SEC_hasAccess($v['owner_id'],$v['group_id'],$v['perm_owner'],$v['perm_group'],$v['perm_members'],$v['perm_anon']) > 0)
{
if ($event != '') $event .= ', ';
$event .= $v['title'];
}
}
}
if ( $event || $active )
{
$anchor = '<a href="' . $_CONF["site_url"] . '/mycal/calsearch.php?datestart=' . $key
. '&dateend=' . $key . '&type=all&mode=search&topic=0&author=0';
$anchor .= $event ? '" title="'. $event : '';
$anchor .= '">' . $day . '</a>';
}
if ( $event )
{
$event_url = '<td class="' . ( $today ? "mycalTodayEventHighlight" : "mycalEventHighlight" ) . '">' . $anchor;
}
else
{
if ( date("m", $base) != date("m", $timestamp) )
{
$event_url = '<td class="mycalNextMonth">';
}
else
{
if ( $today )
{
$event_url = '<td class="mycalTodayHighlight">' . $day;
if ( $active )
{
$event_url = '<td class="mycalTodayActiveHighlight">' . $anchor;
}
}
else
{
$event_url = '<td>' . $day;
if ( $active )
{
$event_url = '<td class="mycalActiveHighlight">' . $anchor;
}
}
}
}
$event_url .= "</td>\r";
return $event_url;
}
?>
さらに,この場合には,CSSファイルを次のように指定して,style.cssにインクルードしてください.
/layout/<theme>/css/plugin/sitecalendar.css
@charset "utf-8";
/*==============================================================================
タイトル: サイトカレンダスタイル(プラグイン)
著者 : Fumito Arakawa as Phize (http://phize.net/)
説明 : サイトカレンダのスタイルです。
適用先 : phpblock_mycal関数
==============================================================================*/
/*--------------------------------------
サイトカレンダ
--------------------------------------*/
table.mycalTitle {
/* width: auto; komma */
margin: 0 auto;
padding: 0;
border-collapse: collapse;
background-color: #B0C4DE; /* 基本色と罫線色 */
text-align: center; /* mycal dengen版追加分 */
width: 95%; /* mycal dengen版追加分 */
}
table.mycalTitle a {
text-decoration: none; /* mycal dengen版追加分 */
}
/* 日付(情報なし) */
table.mycalTitle tr td {
margin: 0;
padding: 0;
border: 1px solid #B0C4DE;
background-color: #E8E8E8;
font-size: 90%;
font-weight: normal;
text-align: center;
color:#888;
}
table.mycalTitle tr td,
table.mycalTitle tr th {
height: 1.5em; /* mycal dengen版追加分 */
line-height: 1.5em; /* mycal dengen版追加分 */
}
/* 曜日 */
table.mycalTitle tr th {
margin: 0;
padding: 0;
border: 1px solid #B0C4DE;
background-color: #CAD8EB;
font-size: 90%;
text-align: center;
}
/* 年月 */
table.mycalTitle tr td.mycalTitle {
font-weight: bold;
background-color: #B0C4DE; /* 基本色と罫線色 */
color:#000;
}
/* 日付(予定日) */
table.mycalTitle tr td.mycalEventHighlight {
background-color: #8FBC8F;
}
/* 日付(今日) */
table.mycalTitle tr td.mycalTodayHighlight {
background-color: #EEDD82;
}
/* 日付(来月) */
table.mycalTitle tr td.mycalNextMonth {
background-color: #DCDCD1;
}
table.mycalTitle tr td a b {
background-color: #DCDCD2;
font-weight: normal;
}
/* 年月 */
table.mycalTitle tr td table {
margin: 0;
padding: 0;
border-collapse: collapse;
}
/* */
table.mycalTitle tr td table tr td {
background-color: #DCDCD3;
}
table.mycalTitle tr td table tr td.mycalTopTitle {
margin: 0;
padding: 0;
font-weight: bold;
text-align: center;
}
/* ナビゲーション */
table.mycalTitle + table tr td {
text-align: center;
}
/*--------------------------------------
/* mycal dengen版追加分 */
--------------------------------------*/
/* 日付(アクティブ) */
table.mycalTitle tr td.mycalActiveHighlight {
background-color: #EDEDED;
}
/* 日付(今日&アクティブ) */
table.mycalTitle tr td.mycalTodayActiveHighlight {
background-color: #EEDD82;
}
/* 日付(今日&予定日) */
table.mycalTitle tr td.mycalTodayEventHighlight {
background-color: #EEDD82;
}
/public_html/mycal/calsearch.php
<?php
/* Reminder: always indent with 4 spaces (no tabs). */
// +-------------------------------------------------------------------------+
// | Site Calendar Block for Geeklog- The Ultimate OSS Portal |
// | Date: August 10, 2004 |
// +-------------------------------------------------------------------------+
// | Program calsearch.php |
// +-------------------------------------------------------------------------+
// | Copyright (C) 2003 by the following authors: |
// | |
// | Author: |
// | Blaine Lang - blaine@portalparts.com |
// +-------------------------------------------------------------------------+
// | |
// | This program is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU General Public License |
// | as published by the Free Software Foundation; either version 2 |
// | of the License, or (at your option) any later version. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
// | See the GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +-------------------------------------------------------------------------+
//
require_once('../lib-common.php');
require_once($_CONF['path_system'] . 'classes/search.class.php');
Class sitesearch extends Search {
function sitecalSearch() {
// Do searches
$this->story_results = $this->_searchStories();
$this->comment_results = $this->_searchComments();
$this->event_results = $this->_searchEvents();
// Have plugins do their searches
list($nrows_plugins, $total_plugins, $result_plugins) = PLG_doSearch($this->_query, $this->_dateStart, $this->_dateEnd, $this->_topic, $this->_type, $this->_author);
// Add the core GL object search results to plugin results
$nrows_plugins = $nrows_plugins + $this->story_results->num_searchresults;
$nrows_plugins = $nrows_plugins + $this->comment_results->num_searchresults;
$nrows_plugins = $nrows_plugins + $this->link_results->num_searchresults;
$nrows_plugins = $nrows_plugins + $this->event_results->num_searchresults;
$total_plugins = $total_plugins + $this->story_results->num_itemssearched;
$total_plugins = $total_plugins + $this->comment_results->num_itemssearched;
$total_plugins = $total_plugins + $this->link_results->num_itemssearched;
$total_plugins = $total_plugins + $this->event_results->num_itemssearched;
// Move GL core objects to front of array
array_unshift($result_plugins, $this->story_results, $this->comment_results, $this->link_results, $this->event_results);
// Format results
if ($nrows_plugins == 0) {
redirect_header("../index.php","この日の記事・コメント・リンクがありません。");
exit;
} else {
$retval = $this->_formatResults($nrows_plugins, $total_plugins, $result_plugins, $searchtime);
}
return $retval;
}
}
function redirect_header($url, $message=""){
define("_IFNOTRELOAD","もし自動的にリロードされなければ <a href=%s>クリック</a>してください。");
$time=4;
$display = COM_siteHeader();
$display .= "<html><head>\n";
$display .= "<meta http-equiv='Content-Type' content='text/html;' />\n";
$display .= "<meta http-equiv='Refresh' content='$time; url=$url' />\n";
$display .= "</head><body><div id='content'>\n";
$display .= COM_startBlock();
$display .= "<center>";
if ( $message!="" ) {
$display .= "<br><p><h4>".$message."</h4>\n";
}
$display .= "<br /><b>\n";
$display .= sprintf(_IFNOTRELOAD,$url);
$display .= "\n";
$display .= "<p></center></div>\n";
$display .= COM_endBlock();
$display .= COM_siteFooter(false);
echo $display;
}
$display = COM_siteHeader();
$calSearchObj = new sitesearch;
$calSearchObj->Search();
$display .= $calSearchObj->sitecalSearch();
$display .= COM_siteFooter();
echo $display;
?>

