本文整理汇总了PHP中postcalendar_getDate函数的典型用法代码示例。如果您正苦于以下问题:PHP postcalendar_getDate函数的具体用法?PHP postcalendar_getDate怎么用?PHP postcalendar_getDate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了postcalendar_getDate函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_pc_form_nav_close
/**
* $Id$
*
* PostCalendar::PostNuke Events Calendar Module
* Copyright (C) 2002 The PostCalendar Team
* http://postcalendar.tv
*
* 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
*
* To read the license please read the docs/license.txt or visit
* http://www.gnu.org/copyleft/gpl.html
*
*/
function smarty_function_pc_form_nav_close($args = array())
{
extract($args);
unset($args);
if (_SETTING_OPEN_NEW_WINDOW || isset($print)) {
$target = 'target="csCalendar"';
} else {
$target = '';
}
if (!defined('_PC_FORM_DATE')) {
$Date = postcalendar_getDate();
echo '<input type="hidden" name="Date" value="' . $Date . '" />';
}
if (!defined('_PC_FORM_VIEW_TYPE')) {
echo '<input type="hidden" name="viewtype" value="' . pnVarCleanFromInput('viewtype') . '" />';
}
if (!defined('_PC_FORM_TEMPLATE')) {
echo '<input type="hidden" name="tplview" value="' . pnVarCleanFromInput('tplview') . '" />';
}
if (!defined('_PC_FORM_USERNAME')) {
echo '<input type="hidden" name="pc_username" value="' . pnVarCleanFromInput('pc_username') . '" />';
}
if (!defined('_PC_FORM_CATEGORY')) {
echo '<input type="hidden" name="pc_category" value="' . pnVarCleanFromInput('pc_category') . '" />';
}
if (!defined('_PC_FORM_TOPIC')) {
echo '<input type="hidden" name="pc_topic" value="' . pnVarCleanFromInput('pc_topic') . '" />';
}
echo '</form>';
}
示例2: smarty_function_pc_view_select
/**
* $Id$
*
* PostCalendar::PostNuke Events Calendar Module
* Copyright (C) 2002 The PostCalendar Team
* http://postcalendar.tv
*
* 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
*
* To read the license please read the docs/license.txt or visit
* http://www.gnu.org/copyleft/gpl.html
*
*/
function smarty_function_pc_view_select($args)
{
@define('_PC_FORM_TEMPLATE', true);
$Date = postcalendar_getDate();
if (!isset($y)) {
$y = substr($Date, 0, 4);
}
if (!isset($m)) {
$m = substr($Date, 4, 2);
}
if (!isset($d)) {
$d = substr($Date, 6, 2);
}
$tplview = pnVarCleanFromInput('tplview');
$viewtype = pnVarCleanFromInput('viewtype');
if (!isset($viewtype)) {
$viewtype = _SETTING_DEFAULT_VIEW;
}
$modinfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__));
$mdir = pnVarPrepForOS($modinfo['directory']);
unset($modinfo);
$pcTemplate = pnVarPrepForOS(_SETTING_TEMPLATE);
if (empty($pcTemplate)) {
$pcTemplate = 'default';
}
$viewlist = array();
$handle = opendir("modules/{$mdir}/pntemplates/{$pcTemplate}/views/{$viewtype}");
$hide_list = array('.', '..', 'CVS', 'index.html');
while ($f = readdir($handle)) {
if (!in_array($f, $hide_list)) {
$viewlist[] = $f;
}
}
closedir($handle);
unset($no_list);
sort($viewlist);
$tcount = count($viewlist);
//$options = "<select id=\"tplview\" name=\"tplview\" class=\"$args[class]\">"; - pennfirm
$options = "<select id=\"tplview\" name=\"viewtype\" class=\"{$args['class']}\">";
$selected = $tplview;
for ($t = 0; $t < $tcount; $t++) {
$id = str_replace('.html', '', $viewlist[$t]);
$sel = $selected == $id ? 'selected' : '';
$options .= "<option value=\"{$id}\" {$sel} class=\"{$args['class']}\">{$id}</option>";
}
$options .= '</select>';
if (!isset($args['label'])) {
$args['label'] = _PC_TPL_VIEW_SUBMIT;
}
$submit = '<input type="submit" valign="middle" name="submit" value="' . $args['label'] . '" class="' . $args['class'] . '" />';
// build the form
if ($t > 1) {
echo $options, $submit;
}
}
示例3: smarty_function_pc_week_range
/**
* $Id$
*
* PostCalendar::PostNuke Events Calendar Module
* Copyright (C) 2002 The PostCalendar Team
* http://postcalendar.tv
*
* 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
*
* To read the license please read the docs/license.txt or visit
* http://www.gnu.org/copyleft/gpl.html
*
*/
function smarty_function_pc_week_range($args)
{
// $args['date'] date to use for range building
// $args['sep'] seperate the dates by this string
// $args['format'] format all dates like this
// $args['format1'] format date 1 like this
// $args['format2'] format date 1 like this
setlocale(LC_TIME, _PC_LOCALE);
if (!isset($args['date'])) {
$args['date'] = postcalendar_getDate();
}
$y = substr($args['date'], 0, 4);
$m = substr($args['date'], 4, 2);
$d = substr($args['date'], 6, 2);
if (!isset($args['sep'])) {
$args['sep'] = ' - ';
}
if (!isset($args['format'])) {
if (!isset($args['format1'])) {
$args['format1'] = _SETTING_DATE_FORMAT;
}
if (!isset($args['format2'])) {
$args['format2'] = _SETTING_DATE_FORMAT;
}
} else {
$args['format1'] = $args['format'];
$args['format2'] = $args['format'];
}
// get the week date range for the supplied $date
$dow = date('w', mktime(0, 0, 0, $m, $d, $y));
if (_SETTING_FIRST_DAY_WEEK == 0) {
$firstDay = strftime($args['format1'], mktime(0, 0, 0, $m, $d - $dow, $y));
$lastDay = strftime($args['format2'], mktime(0, 0, 0, $m, $d + (6 - $dow), $y));
} elseif (_SETTING_FIRST_DAY_WEEK == 1) {
if ($dow == 0) {
$sub = 6;
} else {
$sub = $dow - 1;
}
$firstDay = strftime($args['format1'], mktime(0, 0, 0, $m, $d - $sub, $y));
$lastDay = strftime($args['format2'], mktime(0, 0, 0, $m, $d + (6 - $sub), $y));
} elseif (_SETTING_FIRST_DAY_WEEK == 6) {
if ($dow == 6) {
$sub = 0;
} else {
$sub = $dow + 1;
}
$firstDay = strftime($args['format1'], mktime(0, 0, 0, $m, $d - $sub, $y));
$lastDay = strftime($args['format2'], mktime(0, 0, 0, $m, $d + (6 - $sub), $y));
}
// return the formated range
echo $firstDay . $args['sep'] . $lastDay;
}
示例4: postcalendar_getDate
$A_CATEGORY =& $this->_tpl_vars['A_CATEGORY'];
// [-if $PRINT_VIEW != 1-]
// [-**-]
// [-include file="$TPL_NAME/views/global/navigation.html"-]
// [-/if-]
$A_EVENTS =& $this->_tpl_vars['A_EVENTS'];
// $S_EVENTS =& $this->_tpl_vars['S_EVENTS']; // Deleted by Rod
$providers =& $this->_tpl_vars['providers'];
$times =& $this->_tpl_vars['times'];
$interval = $this->_tpl_vars['interval'];
$viewtype = $this->_tpl_vars['VIEW_TYPE'];
$PREV_WEEK_URL = $this->_tpl_vars['PREV_WEEK_URL'];
$NEXT_WEEK_URL = $this->_tpl_vars['NEXT_WEEK_URL'];
$PREV_DAY_URL = $this->_tpl_vars['PREV_DAY_URL'];
$NEXT_DAY_URL = $this->_tpl_vars['NEXT_DAY_URL'];
$Date = postcalendar_getDate();
if (!isset($y)) {
$y = substr($Date, 0, 4);
}
if (!isset($m)) {
$m = substr($Date, 4, 2);
}
if (!isset($d)) {
$d = substr($Date, 6, 2);
}
// echo "<!-- There are " . count($A_EVENTS) . " A_EVENTS days -->\n";
$MULTIDAY = count($A_EVENTS) > 1;
//==================================
//FACILITY FILTERING (CHEMED)
$facilities = getUserFacilities($_SESSION['authId']);
// from users_facility
示例5: postcalendar_user_submit
function postcalendar_user_submit($args)
{
// We need at least ADD permission to submit an event
if (!(bool) PC_ACCESS_ADD) {
return _POSTCALENDARNOAUTH;
}
$output = new pnHTML();
$output->SetInputMode(_PNH_VERBATIMINPUT);
// get the theme globals :: is there a better way to do this?
pnThemeLoad(pnUserGetTheme());
global $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $bgcolor5, $textcolor1, $textcolor2;
// $category = pnVarCleanFromInput('event_category');
$category = pnVarCleanFromInput('category');
if (!empty($category)) {
$category = unserialize(base64_decode($category));
//print_r($category);
} else {
//print_r($_POST);
$cat = $_POST['category'];
$category = unserialize(base64_decode($cat));
//print_r($category);
}
//print_r($category);
// echo("<!-- Here is the argument array: -->\n");
// foreach ($args as $tmpkey => $tmpval) { // debugging
// echo("<!-- $tmpkey => '$tmpval' -->\n");
// }
extract($args);
$Date =& postcalendar_getDate();
$year = substr($Date, 0, 4);
$month = substr($Date, 4, 2);
$day = substr($Date, 6, 2);
// basic event information
$event_desc = pnVarCleanFromInput('event_desc');
$event_category = pnVarCleanFromInput('event_category');
$event_subject = pnVarCleanFromInput('event_subject');
$event_sharing = pnVarCleanFromInput('event_sharing');
$event_topic = pnVarCleanFromInput('event_topic');
//id of the user the event is for
$event_userid = pnVarCleanFromInput('event_userid');
if (!is_numeric($event_userid)) {
$event_userid = 0;
}
$event_pid = pnVarCleanFromInput('event_pid');
if (!is_numeric($event_pid)) {
$event_pid = "";
}
// event start information
$event_startmonth = pnVarCleanFromInput('event_startmonth');
$event_startday = pnVarCleanFromInput('event_startday');
$event_startyear = pnVarCleanFromInput('event_startyear');
$event_starttimeh = pnVarCleanFromInput('event_starttimeh');
$event_starttimem = pnVarCleanFromInput('event_starttimem');
$event_startampm = pnVarCleanFromInput('event_startampm');
// location data
$event_location = pnVarCleanFromInput('event_location');
$event_street1 = pnVarCleanFromInput('event_street1');
$event_street2 = pnVarCleanFromInput('event_street2');
$event_city = pnVarCleanFromInput('event_city');
$event_state = pnVarCleanFromInput('event_state');
$event_postal = pnVarCleanFromInput('event_postal');
$event_location_info = serialize(compact('event_location', 'event_street1', 'event_street2', 'event_city', 'event_state', 'event_postal'));
// contact data
$event_contname = pnVarCleanFromInput('event_contname');
$event_conttel = pnVarCleanFromInput('event_conttel');
$event_contemail = pnVarCleanFromInput('event_contemail');
$event_website = pnVarCleanFromInput('event_website');
$event_fee = pnVarCleanFromInput('event_fee');
$event_patient_name = pnVarCleanFromInput('patient_name');
// event repeating data
if (is_array($category)) {
//$event_subject =
$event_desc = $category['desc'];
$event_category = $category['id'];
$event_duration = $category['event_duration'];
//seconds of the event
$event_dur_hours = $event_duration / (60 * 60);
//seconds divided by 60 seconds * 60 minutes
$event_dur_minutes = $event_duration % (60 * 60) / 60;
$event_repeat = $category['event_repeat'];
$event_repeat_freq = $category['event_repeat_freq'];
$event_repeat_freq_type = $category['event_repeat_freq_type'];
$event_repeat_on_num = $category['event_repeat_on_num'];
$event_repeat_on_day = $category['event_repeat_on_day'];
$event_repeat_on_freq = $category['event_repeat_on_freq'];
$event_recurrspec = serialize(compact('event_repeat_freq', 'event_repeat_freq_type', 'event_repeat_on_num', 'event_repeat_on_day', 'event_repeat_on_freq'));
// event end information
$multiple = $category['end_date_freq'] . " ";
switch ($category['end_date_type']) {
case REPEAT_EVERY_DAY:
case REPEAT_EVERY_WORK_DAY:
//end date is in days
$multiple .= "days";
break;
case REPEAT_EVERY_WEEK:
//end date is in weeks
$multiple .= "weeks";
break;
case REPEAT_EVERY_MONTH:
//end date is in months
//.........这里部分代码省略.........
示例6: postcalendar_userapi_eventDetail
function postcalendar_userapi_eventDetail($args, $admin = false)
{
if (!(bool) PC_ACCESS_READ) {
return _POSTCALENDARNOAUTH;
}
// get the theme globals :: is there a better way to do this?
pnThemeLoad(pnUserGetTheme());
global $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $bgcolor5;
global $textcolor1, $textcolor2;
$popup = pnVarCleanFromInput('popup');
extract($args);
unset($args);
if (!isset($cacheid)) {
$cacheid = null;
}
if (!isset($eid)) {
return false;
}
if (!isset($nopop)) {
$nopop = false;
}
$uid = pnUserGetVar('uid');
//=================================================================
// Find out what Template we're using
//=================================================================
$template_name = _SETTING_TEMPLATE;
if (!isset($template_name)) {
$template_name = 'default';
}
//=================================================================
// Setup Smarty Template Engine
//=================================================================
$tpl = new pcSmarty();
if ($admin) {
$template = $template_name . '/admin/details.html';
$args['cacheid'] = '';
$print = 0;
$Date =& postcalendar_getDate();
$tpl->caching = false;
} else {
$template = $template_name . '/user/details.html';
}
if (!$tpl->is_cached($template, $cacheid)) {
// let's get the DB information
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
// get the event's information
$event =& postcalendar_userapi_pcGetEventDetails($eid);
// if the above is false, it's a private event for another user
// we should not diplay this - so we just exit gracefully
if ($event === false) {
return false;
}
//=================================================================
// get event's topic information
//=================================================================
$topics_table = $pntable['topics'];
$topics_column = $pntable['topics_column'];
$topicsql = "SELECT {$topics_column['topictext']},{$topics_column['topicimage']}\n FROM {$topics_table}\n WHERE {$topics_column['topicid']} = {$event['topic']}\n LIMIT 1";
$topic_result = $dbconn->Execute($topicsql);
list($event['topictext'], $event['topicimg']) = $topic_result->fields;
$location = unserialize($event['location']);
$event['location'] = $location['event_location'];
$event['street1'] = $location['event_street1'];
$event['street2'] = $location['event_street2'];
$event['city'] = $location['event_city'];
$event['state'] = $location['event_state'];
$event['postal'] = $location['event_postal'];
$event['date'] = str_replace('-', '', $Date);
//=================================================================
// populate the template
//=================================================================
if (!empty($event['location']) || !empty($event['street1']) || !empty($event['street2']) || !empty($event['city']) || !empty($event['state']) || !empty($event['postal'])) {
$tpl->assign('LOCATION_INFO', true);
} else {
$tpl->assign('LOCATION_INFO', false);
}
if (!empty($event['contname']) || !empty($event['contemail']) || !empty($event['conttel']) || !empty($event['website'])) {
$tpl->assign('CONTACT_INFO', true);
} else {
$tpl->assign('CONTACT_INFO', false);
}
$display_type = substr($event['hometext'], 0, 6);
if ($display_type == ':text:') {
$prepFunction = 'pcVarPrepForDisplay';
$event['hometext'] = substr($event['hometext'], 6);
} elseif ($display_type == ':html:') {
$prepFunction = 'pcVarPrepHTMLDisplay';
$event['hometext'] = substr($event['hometext'], 6);
} else {
$prepFunction = 'pcVarPrepHTMLDisplay';
}
unset($display_type);
// prep the vars for output
$event['title'] =& $prepFunction($event['title']);
$event['hometext'] =& $prepFunction($event['hometext']);
$event['desc'] =& $event['hometext'];
$event['conttel'] =& $prepFunction($event['conttel']);
$event['contname'] =& $prepFunction($event['contname']);
$event['contemail'] =& $prepFunction($event['contemail']);
//.........这里部分代码省略.........
示例7: postcalendar_admin_submit
function postcalendar_admin_submit($args)
{
if (!PC_ACCESS_ADMIN) {
return _POSTCALENDAR_NOAUTH;
}
pnModAPILoad(__POSTCALENDAR__, 'user');
$output = postcalendar_adminmenu();
// get the theme globals :: is there a better way to do this?
pnThemeLoad(pnUserGetTheme());
global $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $bgcolor5, $textcolor1, $textcolor2;
extract($args);
$Date = postcalendar_getDate();
$year = substr($Date, 0, 4);
$month = substr($Date, 4, 2);
$day = substr($Date, 6, 2);
// basic event information
$event_subject = pnVarCleanFromInput('event_subject');
$event_desc = pnVarCleanFromInput('event_desc');
$event_sharing = pnVarCleanFromInput('event_sharing');
$event_category = pnVarCleanFromInput('event_category');
$event_topic = pnVarCleanFromInput('event_topic');
// event start information
$event_startmonth = pnVarCleanFromInput('event_startmonth');
$event_startday = pnVarCleanFromInput('event_startday');
$event_startyear = pnVarCleanFromInput('event_startyear');
$event_starttimeh = pnVarCleanFromInput('event_starttimeh');
$event_starttimem = pnVarCleanFromInput('event_starttimem');
$event_startampm = pnVarCleanFromInput('event_startampm');
// event end information
$event_endmonth = pnVarCleanFromInput('event_endmonth');
$event_endday = pnVarCleanFromInput('event_endday');
$event_endyear = pnVarCleanFromInput('event_endyear');
$event_endtype = pnVarCleanFromInput('event_endtype');
$event_dur_hours = pnVarCleanFromInput('event_dur_hours');
$event_dur_minutes = pnVarCleanFromInput('event_dur_minutes');
$event_duration = 60 * 60 * $event_dur_hours + 60 * $event_dur_minutes;
$event_allday = pnVarCleanFromInput('event_allday');
// location data
$event_location = pnVarCleanFromInput('event_location');
$event_street1 = pnVarCleanFromInput('event_street1');
$event_street2 = pnVarCleanFromInput('event_street2');
$event_city = pnVarCleanFromInput('event_city');
$event_state = pnVarCleanFromInput('event_state');
$event_postal = pnVarCleanFromInput('event_postal');
$event_location_info = serialize(compact('event_location', 'event_street1', 'event_street2', 'event_city', 'event_state', 'event_postal'));
// contact data
$event_contname = pnVarCleanFromInput('event_contname');
$event_conttel = pnVarCleanFromInput('event_conttel');
$event_contemail = pnVarCleanFromInput('event_contemail');
$event_website = pnVarCleanFromInput('event_website');
$event_fee = pnVarCleanFromInput('event_fee');
// event repeating data
$event_repeat = pnVarCleanFromInput('event_repeat');
$event_repeat_freq = pnVarCleanFromInput('event_repeat_freq');
$event_repeat_freq_type = pnVarCleanFromInput('event_repeat_freq_type');
$event_repeat_on_num = pnVarCleanFromInput('event_repeat_on_num');
$event_repeat_on_day = pnVarCleanFromInput('event_repeat_on_day');
$event_repeat_on_freq = pnVarCleanFromInput('event_repeat_on_freq');
$event_recurrspec = serialize(compact('event_repeat_freq', 'event_repeat_freq_type', 'event_repeat_on_num', 'event_repeat_on_day', 'event_repeat_on_freq'));
$pc_html_or_text = pnVarCleanFromInput('pc_html_or_text');
$form_action = pnVarCleanFromInput('form_action');
$pc_event_id = pnVarCleanFromInput('pc_event_id');
$data_loaded = pnVarCleanFromInput('data_loaded');
$is_update = pnVarCleanFromInput('is_update');
$authid = pnVarCleanFromInput('authid');
if (pnUserLoggedIn()) {
$uname = pnUserGetVar('uname');
} else {
$uname = pnConfigGetVar('anonymous');
}
if (!isset($event_repeat)) {
$event_repeat = 0;
}
// lets wrap all the data into array for passing to submit and preview functions
if (!isset($pc_event_id) || empty($pc_event_id) || $data_loaded) {
$eventdata = compact('event_subject', 'event_desc', 'event_sharing', 'event_category', 'event_topic', 'event_startmonth', 'event_startday', 'event_startyear', 'event_starttimeh', 'event_starttimem', 'event_startampm', 'event_endmonth', 'event_endday', 'event_endyear', 'event_endtype', 'event_dur_hours', 'event_dur_minutes', 'event_duration', 'event_allday', 'event_location', 'event_street1', 'event_street2', 'event_city', 'event_state', 'event_postal', 'event_location_info', 'event_contname', 'event_conttel', 'event_contemail', 'event_website', 'event_fee', 'event_repeat', 'event_repeat_freq', 'event_repeat_freq_type', 'event_repeat_on_num', 'event_repeat_on_day', 'event_repeat_on_freq', 'event_recurrspec', 'uname', 'Date', 'year', 'month', 'day', 'pc_html_or_text');
$eventdata['is_update'] = $is_update;
$eventdata['pc_event_id'] = $pc_event_id;
$eventdata['data_loaded'] = true;
} else {
$event = postcalendar_userapi_pcGetEventDetails($pc_event_id);
$eventdata['event_subject'] = $event['title'];
$eventdata['event_desc'] = $event['hometext'];
$eventdata['event_sharing'] = $event['sharing'];
$eventdata['event_category'] = $event['catid'];
$eventdata['event_topic'] = $event['topic'];
$eventdata['event_startmonth'] = substr($event['eventDate'], 5, 2);
$eventdata['event_startday'] = substr($event['eventDate'], 8, 2);
$eventdata['event_startyear'] = substr($event['eventDate'], 0, 4);
$eventdata['event_starttimeh'] = substr($event['startTime'], 0, 2);
$eventdata['event_starttimem'] = substr($event['startTime'], 3, 2);
$eventdata['event_startampm'] = $eventdata['event_starttimeh'] < 12 ? _PC_AM : _PC_PM;
$eventdata['event_endmonth'] = substr($event['endDate'], 5, 2);
$eventdata['event_endday'] = substr($event['endDate'], 8, 2);
$eventdata['event_endyear'] = substr($event['endDate'], 0, 4);
$eventdata['event_endtype'] = $event['endDate'] == '0000-00-00' ? '0' : '1';
$eventdata['event_dur_hours'] = $event['duration_hours'];
$eventdata['event_dur_minutes'] = $event['duration_minutes'];
$eventdata['event_duration'] = $event['duration'];
$eventdata['event_allday'] = $event['alldayevent'];
//.........这里部分代码省略.........
示例8: postcalendar_calendarblock_display
/**
* display block
*/
function postcalendar_calendarblock_display($blockinfo)
{
// You supposed to be here?
if (!pnSecAuthAction(0, 'PostCalendar:calendarblock:', "{$blockinfo['title']}::", ACCESS_OVERVIEW)) {
return false;
}
// find out what view we're using
$template_view = pnVarCleanFromInput('tplview');
if (!isset($template_view)) {
$template_view = 'default';
}
// find out what template we're using
$template_name = _SETTING_TEMPLATE;
if (!isset($template_name) || empty($template_name)) {
$template_name = 'default';
}
// What is today's correct date
$Date =& postcalendar_getDate();
// Get variables from content block
$vars = unserialize($blockinfo['content']);
$showcalendar = $vars['pcbshowcalendar'];
$showevents = $vars['pcbeventoverview'];
$eventslimit = $vars['pcbeventslimit'];
$nextevents = $vars['pcbnextevents'];
$pcbshowsslinks = $vars['pcbshowsslinks'];
$pcbeventsrange = $vars['pcbeventsrange'];
// Let's setup the info to build this sucka!
$the_year = substr($Date, 0, 4);
$the_month = substr($Date, 4, 2);
$the_day = substr($Date, 6, 2);
$uid = pnUserGetVar('uid');
$cacheid1 = $cacheid2 = $cacheid3 = '';
$theme = pnUserGetTheme();
pnThemeLoad($theme);
global $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $bgcolor5;
global $textcolor1, $textcolor2;
// 20021125 - rraymond :: we have to do this to make it work with envolution
$pcModInfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__));
$pcDir = pnVarPrepForOS($pcModInfo['directory']);
require_once "modules/{$pcDir}/pnincludes/Smarty/Config_File.class.php";
unset($pcModInfo);
// set up Smarty
$tpl =& new pcSmarty();
// setup the Smarty cache id
$templates_cached = true;
if ($showcalendar) {
$cacheid1 = md5($Date . 'M' . $template_view . $template_name . $showcalendar . $showevents . $nextevents . $uid . $theme);
if (!$tpl->is_cached($template_name . '/views/calendarblock/month_view.html', $cacheid1)) {
$templates_cached = false;
}
}
if ($showevents) {
$cacheid2 = md5($Date . 'T' . $template_view . $template_name . $showcalendar . $showevents . $nextevents . $uid . $theme);
if (!$tpl->is_cached($template_name . '/views/calendarblock/todays_events.html', $cacheid2)) {
$templates_cached = false;
}
}
if ($nextevents) {
$cacheid3 = md5($Date . 'U' . $template_view . $template_name . $showcalendar . $showevents . $nextevents . $uid . $theme);
if (!$tpl->is_cached($template_name . '/views/calendarblock/upcoming_events.html', $cacheid3)) {
$templates_cached = false;
}
}
// start the output container
$output = pnModAPIFunc(__POSTCALENDAR__, 'user', 'pageSetup');
// if one of the templates is not cached, we need to run the following
if (!$templates_cached) {
// set up the next and previous months to move to
$prev_month = Date_Calc::beginOfPrevMonth(1, $the_month, $the_year, '%Y%m%d');
$next_month = Date_Calc::beginOfNextMonth(1, $the_month, $the_year, '%Y%m%d');
$last_day = Date_Calc::daysInMonth($the_month, $the_year);
$pc_prev = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'month', 'Date' => $prev_month));
$pc_next = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'month', 'Date' => $next_month));
$pc_month_name = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getmonthname', array('Date' => mktime(0, 0, 0, $the_month, $the_day, $the_year)));
$month_link_url = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'month', 'Date' => date('Ymd', mktime(0, 0, 0, $the_month, 1, $the_year))));
$month_link_text = $pc_month_name . ' ' . $the_year;
//*******************************************************************
// Here we get the events for the current month view
//*******************************************************************
$day_of_week = 1;
$pc_month_names = array(_CALJAN, _CALFEB, _CALMAR, _CALAPR, _CALMAY, _CALJUN, _CALJUL, _CALAUG, _CALSEP, _CALOCT, _CALNOV, _CALDEC);
$pc_short_day_names = array(_CALSUNDAYSHORT, _CALMONDAYSHORT, _CALTUESDAYSHORT, _CALWEDNESDAYSHORT, _CALTHURSDAYSHORT, _CALFRIDAYSHORT, _CALSATURDAYSHORT);
$pc_long_day_names = array(_CALSUNDAY, _CALMONDAY, _CALTUESDAY, _CALWEDNESDAY, _CALTHURSDAY, _CALFRIDAY, _CALSATURDAY);
switch (_SETTING_FIRST_DAY_WEEK) {
case _IS_MONDAY:
$pc_array_pos = 1;
$first_day = date('w', mktime(0, 0, 0, $the_month, 0, $the_year));
$end_dow = date('w', mktime(0, 0, 0, $the_month, $last_day, $the_year));
if ($end_dow != 0) {
$the_last_day = $last_day + (7 - $end_dow);
} else {
$the_last_day = $last_day;
}
break;
case _IS_SATURDAY:
$pc_array_pos = 6;
$first_day = date('w', mktime(0, 0, 0, $the_month, 2, $the_year));
//.........这里部分代码省略.........
示例9: calculateEvents
function calculateEvents($days, $events, $viewtype)
{
$date = postcalendar_getDate();
$cy = substr($date, 0, 4);
$cm = substr($date, 4, 2);
$cd = substr($date, 6, 2);
foreach ($events as $event) {
// get the name of the topic
$topicname = pcGetTopicName($event['topic']);
// parse the event start date
list($esY, $esM, $esD) = explode('-', $event['eventDate']);
// grab the recurring specs for the event
$event_recurrspec = @unserialize($event['recurrspec']);
// determine the stop date for this event
if ($event['endDate'] == '0000-00-00') {
$stop = $end_date;
// <--- this isn't previously defined !!
} else {
$stop = $event['endDate'];
}
// here the start_date value is set to whatever comes in
// on postcalendar_getDate() which is not always the first
// date of the days array -- JRM
$start_date = "{$cy}-{$cm}-{$cd}";
// here we've made the start_date equal to the first date
// of the days array, makes sense, right? -- JRM
$days_keys = array_keys($days);
$start_date = $days_keys[0];
// Optimization of the stop date to not be much later than required.
$tmpsecs = strtotime($start_date);
if ($viewtype == 'day') {
$tmpsecs += 3 * 24 * 3600;
} else {
if ($viewtype == 'week') {
$tmpsecs += 9 * 24 * 3600;
} else {
if ($viewtype == 'month') {
$tmpsecs += 34 * 24 * 3600;
} else {
$tmpsecs += 367 * 24 * 3600;
}
}
}
$tmp = date('Y-m-d', $tmpsecs);
if ($stop > $tmp) {
$stop = $tmp;
}
$eventD = $event['eventDate'];
$eventS = $event['startTime'];
switch ($event['recurrtype']) {
//==============================================================
// Events that do not repeat only have a startday
//==============================================================
case NO_REPEAT:
if (isset($days[$event['eventDate']])) {
array_push($days[$event['eventDate']], $event);
if ($viewtype == "week") {
//echo "non repeating date eventdate: $eventD startime:$eventS block #: " . getBlockTime($eventS) ."<br />";
fillBlocks($eventD, $days);
//echo "for $eventD loading " . getBlockTime($eventS) . "<br /><br />";
$gbt = getBlockTime($eventS);
$days[$eventD]['blocks'][$gbt][$eventD][] = $event;
//echo "event is: " . print_r($days[$eventD]['blocks'][$gbt],true) . " <br />";
//echo "begin printing blocks for $eventD<br />";
//print_r($days[$eventD]['blocks']);
//echo "end printing blocks<br />";
}
}
break;
//==============================================================
// Find events that repeat at a certain frequency
// Every,Every Other,Every Third,Every Fourth
// Day,Week,Month,Year,MWF,TR,M-F,SS
//==============================================================
//==============================================================
// Find events that repeat at a certain frequency
// Every,Every Other,Every Third,Every Fourth
// Day,Week,Month,Year,MWF,TR,M-F,SS
//==============================================================
case REPEAT:
$rfreq = $event_recurrspec['event_repeat_freq'];
$rtype = $event_recurrspec['event_repeat_freq_type'];
$exdate = $event_recurrspec['exdate'];
// this attribute follows the iCalendar spec http://www.ietf.org/rfc/rfc2445.txt
// we should bring the event up to date to make this a tad bit faster
// any ideas on how to do that, exactly??? dateToDays probably.
$nm = $esM;
$ny = $esY;
$nd = $esD;
$occurance = Date_Calc::dateFormat($nd, $nm, $ny, '%Y-%m-%d');
while ($occurance < $start_date) {
$occurance =& __increment($nd, $nm, $ny, $rfreq, $rtype);
list($ny, $nm, $nd) = explode('-', $occurance);
}
while ($occurance <= $stop) {
if (isset($days[$occurance])) {
// check for date exceptions before pushing the event into the days array -- JRM
$excluded = false;
if (isset($exdate)) {
foreach (explode(",", $exdate) as $exception) {
//.........这里部分代码省略.........
示例10: smarty_function_pc_filter
/**
* $Id$
*
* PostCalendar::PostNuke Events Calendar Module
* Copyright (C) 2002 The PostCalendar Team
* http://postcalendar.tv
*
* 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
*
* To read the license please read the docs/license.txt or visit
* http://www.gnu.org/copyleft/gpl.html
*
*/
function smarty_function_pc_filter($args, &$smarty)
{
extract($args);
unset($args);
if (empty($type)) {
$smarty->trigger_error("pc_filter: missing 'type' parameter");
return;
}
$Date = postcalendar_getDate();
if (!isset($y)) {
$y = substr($Date, 0, 4);
}
if (!isset($m)) {
$m = substr($Date, 4, 2);
}
if (!isset($d)) {
$d = substr($Date, 6, 2);
}
$tplview = pnVarCleanFromInput('tplview');
$viewtype = pnVarCleanFromInput('viewtype');
$pc_username = pnVarCleanFromInput('pc_username');
if (!isset($viewtype)) {
$viewtype = _SETTING_DEFAULT_VIEW;
}
$types = explode(',', $type);
$output = new pnHTML();
$output->SetOutputMode(_PNH_RETURNOUTPUT);
$modinfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__));
$mdir = pnVarPrepForOS($modinfo['directory']);
unset($modinfo);
$pcTemplate = pnVarPrepForOS(_SETTING_TEMPLATE);
if (empty($pcTemplate)) {
$pcTemplate = 'default';
}
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
//================================================================
// build the username filter pulldown
//================================================================
if (in_array('user', $types)) {
@define('_PC_FORM_USERNAME', true);
$sql = "SELECT DISTINCT users.username, users.lname, users.fname\n\t \t\t\tFROM {$pntable['postcalendar_events']}, users where users.id=pc_aid\n\t\t\t\tORDER BY pc_aid";
$result = $dbconn->Execute($sql);
if ($result !== false) {
$useroptions = "<select multiple='multiple' size='3' name=\"pc_username[]\" class=\"{$class}\">";
$useroptions .= "<option value=\"\" class=\"{$class}\">" . _PC_FILTER_USERS . "</option>";
$selected = $pc_username == '__PC_ALL__' ? 'selected="selected"' : '';
$useroptions .= "<option value=\"__PC_ALL__\" class=\"{$class}\" {$selected}>" . _PC_FILTER_USERS_ALL . "</option>";
for (; !$result->EOF; $result->MoveNext()) {
$sel = $pc_username == $result->fields[0] ? 'selected="selected"' : '';
$useroptions .= "<option value=\"" . $result->fields[0] . "\" {$sel} class=\"{$class}\">" . $result->fields[1] . ", " . $result->fields[2] . "</option>";
}
$useroptions .= '</select>';
$result->Close();
}
}
//================================================================
// build the category filter pulldown
//================================================================
if (in_array('category', $types)) {
@define('_PC_FORM_CATEGORY', true);
$category = pnVarCleanFromInput('pc_category');
$categories = pnModAPIFunc(__POSTCALENDAR__, 'user', 'getCategories');
$catoptions = "<select name=\"pc_category\" class=\"{$class}\">";
$catoptions .= "<option value=\"\" class=\"{$class}\">" . _PC_FILTER_CATEGORY . "</option>";
foreach ($categories as $c) {
$sel = $category == $c['id'] ? 'selected="selected"' : '';
$catoptions .= "<option value=\"{$c['id']}\" {$sel} class=\"{$class}\">" . xl_appt_category($c[name]) . "</option>";
}
$catoptions .= '</select>';
}
//================================================================
// build the topic filter pulldown
//================================================================
if (in_array('topic', $types) && _SETTING_DISPLAY_TOPICS) {
//.........这里部分代码省略.........
示例11: smarty_function_pc_url
/**
* $Id$
*
* PostCalendar::PostNuke Events Calendar Module
* Copyright (C) 2002 The PostCalendar Team
* http://postcalendar.tv
*
* 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
*
* To read the license please read the docs/license.txt or visit
* http://www.gnu.org/copyleft/gpl.html
*
*/
function smarty_function_pc_url($args)
{
//print "<br />args<br />";
//print_r($args);
//print "<br />args<br />";
extract($args);
unset($args);
if (!isset($action)) {
$action = _SETTING_DEFAULT_VIEW;
}
if (empty($print)) {
$print = false;
} else {
$print = true;
}
$starth = "";
if ($setdeftime == 1) {
$starth = date("H");
}
$ampm = 1;
if ($starth >= 12) {
$ampm = 2;
}
$template_view = pnVarCleanFromInput('tplview');
$viewtype = strtolower(pnVarCleanFromInput('viewtype'));
// pnVarCleanFromInput('pc_username'); //(CHEMED) replaced by the code below
//(CHEMED) Facility filtering
$pc_username = $_SESSION['pc_username'];
$pc_facility = $_SESSION['pc_facility'];
//END (CHEMED)
$category = pnVarCleanFromInput('pc_category');
$topic = pnVarCleanFromInput('pc_topic');
$popup = pnVarCleanFromInput('popup');
if (!isset($date)) {
$Date = postcalendar_getDate();
} else {
$Date = $date;
}
// some extra cleanup if necessary
$Date = str_replace('-', '', $Date);
$pcModInfo = pnModGetInfo(pnModGetIDFromName(__POSTCALENDAR__));
$pcDir = pnVarPrepForOS($pcModInfo['directory']);
switch ($action) {
case 'submit':
if (!empty($starth)) {
$link = pnModURL(__POSTCALENDAR__, 'user', 'submit', array('tplview' => $template_view, 'Date' => $Date, 'event_starttimeh' => $starth, 'event_startampm' => $ampm));
} else {
$link = pnModURL(__POSTCALENDAR__, 'user', 'submit', array('tplview' => $template_view, 'Date' => $Date));
}
break;
case 'submit-admin':
$link = pnModURL(__POSTCALENDAR__, 'admin', 'submit', array('tplview' => $template_view, 'Date' => $Date));
break;
case 'search':
$link = pnModURL(__POSTCALENDAR__, 'user', 'search');
break;
case 'day':
$link = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'day', 'Date' => $Date, 'pc_facility' => $pc_facility, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic, 'print' => $print), $localpath);
break;
case 'week':
$link = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'week', 'Date' => $Date, 'pc_facility' => $pc_facility, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic, 'print' => $print));
break;
case 'month':
$link = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'month', 'Date' => $Date, 'pc_facility' => $pc_facility, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic, 'print' => $print));
break;
case 'year':
$link = pnModURL(__POSTCALENDAR__, 'user', 'view', array('tplview' => $template_view, 'viewtype' => 'year', 'Date' => $Date, 'pc_facility' => $pc_facility, 'pc_username' => $pc_username, 'pc_category' => $category, 'pc_topic' => $topic, 'print' => $print));
break;
case 'detail':
if (isset($eid)) {
if (_SETTING_OPEN_NEW_WINDOW && !$popup) {
$link = "javascript:opencal({$eid},'{$Date}');";
} else {
$link = pnModURL(__POSTCALENDAR__, 'user', 'view', array('Date' => $Date, 'tplview' => $template_view, 'viewtype' => 'details', 'eid' => $eid, 'print' => $print), $localpath);
}
//.........这里部分代码省略.........
示例12: smarty_function_pc_date_select
/**
* $Id$
*
* PostCalendar::PostNuke Events Calendar Module
* Copyright (C) 2002 The PostCalendar Team
* http://postcalendar.tv
*
* 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
*
* To read the license please read the docs/license.txt or visit
* http://www.gnu.org/copyleft/gpl.html
*
*/
function smarty_function_pc_date_select($args)
{
$print = pnVarCleanFromInput('print');
$tplview = pnVarCleanFromInput('tplview');
$viewtype = pnVarCleanFromInput('viewtype');
if (!isset($viewtype)) {
$viewtype = _SETTING_DEFAULT_VIEW;
}
$Date = postcalendar_getDate();
if (!isset($y)) {
$y = substr($Date, 0, 4);
}
if (!isset($m)) {
$m = substr($Date, 4, 2);
}
if (!isset($d)) {
$d = substr($Date, 6, 2);
}
if (!isset($args['day']) || strtolower($args['day']) == 'on') {
$args['day'] = true;
@define('_PC_FORM_DATE', true);
} else {
$args['day'] = false;
}
if (!isset($args['month']) || strtolower($args['month']) == 'on') {
$args['month'] = true;
@define('_PC_FORM_DATE', true);
} else {
$args['month'] = false;
}
if (!isset($args['year']) || strtolower($args['year']) == 'on') {
$args['year'] = true;
@define('_PC_FORM_DATE', true);
} else {
$args['year'] = false;
}
if (!isset($args['view']) || strtolower($args['view']) == 'on') {
$args['view'] = true;
@define('_PC_FORM_VIEW_TYPE', true);
} else {
$args['view'] = false;
}
$dayselect = $monthselect = $yearselect = $viewselect = '';
$output = new pnHTML();
$output->SetOutputMode(_PNH_RETURNOUTPUT);
if ($args['day'] === true) {
$sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildDaySelect', array('pc_day' => $d));
$dayselect = $output->FormSelectMultiple('jumpday', $sel_data);
}
if ($args['month'] === true) {
$sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildMonthSelect', array('pc_month' => $m));
$monthselect = $output->FormSelectMultiple('jumpmonth', $sel_data);
}
if ($args['year'] === true) {
$sel_data = pnModAPIFunc(__POSTCALENDAR__, 'user', 'buildYearSelect', array('pc_year' => $y));
$yearselect = $output->FormSelectMultiple('jumpyear', $sel_data);
}
if ($args['view'] === true) {
$sel_data = array();
$sel_data[0]['id'] = 'day';
$sel_data[0]['selected'] = $viewtype == 'day';
$sel_data[0]['name'] = _CAL_DAYVIEW;
$sel_data[1]['id'] = 'week';
$sel_data[1]['selected'] = $viewtype == 'week';
$sel_data[1]['name'] = _CAL_WEEKVIEW;
$sel_data[2]['id'] = 'month';
$sel_data[2]['selected'] = $viewtype == 'month';
$sel_data[2]['name'] = _CAL_MONTHVIEW;
$sel_data[3]['id'] = 'year';
$sel_data[3]['selected'] = $viewtype == 'year';
$sel_data[3]['name'] = _CAL_YEARVIEW;
$viewselect = $output->FormSelectMultiple('viewtype', $sel_data);
}
if (!isset($args['label'])) {
$args['label'] = _PC_JUMP_MENU_SUBMIT;
//.........这里部分代码省略.........