public function __construct($id = 0) { if (empty($id)) { $this->start_time = PHPWS_Time::getUserTime(); $this->end_time = PHPWS_Time::getUserTime(); return; } else { $this->id = (int) $id; $result = $this->init(); if (PHPWS_Error::isError($result)) { PHPWS_Error::log($result); $this->id = 0; } elseif (!$result) { $this->id = 0; } } }
/** * Returns a time in iCal format */ public static function getDTTime($time = 0, $mode = 'utc') { if (!$time) { $time = time(); } switch ($mode) { case 'user': $new_time = PHPWS_Time::getUserTime($time); $tz = PHPWS_Time::getUserTZ(); break; case 'server': $new_time = PHPWS_Time::getServerTime($time); $tz = PHPWS_Time::getServerTZ(); break; case 'all_day': case 'utc': $new_time =& $time; $tz = 0; break; } if ($mode == 'all_day') { return gmstrftime('%Y%m%dT000000', $new_time); } $dttime = gmstrftime('%Y%m%dT%H%M00', $new_time); if ($tz != 0) { if ($tz > 0) { $sign = '+'; } else { $sign = '-'; } $tz = sqrt($tz * $tz) * 1000; if ($tz < 10) { $tz = '0' . $tz; } $tzadd = $sign . $tz; } else { $tzadd = 'Z'; } $dttime .= $tzadd; return $dttime; }
function getUpdated($format = WIKI_DATE_FORMAT) { return strftime($format, PHPWS_Time::getUserTime($this->updated)); }
public function addSuggestLink($default_date = NULL) { if (!isset($default_date)) { $default_date = PHPWS_Time::getUserTime(); } $suggest_label = dgettext('calendar', 'Suggest event'); if (javascriptEnabled()) { $vars['address'] = sprintf('index.php?module=calendar&uop=suggest_event&js=1&sch_id=%s&date=%s', $this->id, $default_date); $vars['link_title'] = $vars['label'] = $suggest_label; $vars['width'] = CALENDAR_SUGGEST_WIDTH; $vars['height'] = CALENDAR_SUGGEST_HEIGHT; return javascript('open_window', $vars); } else { return PHPWS_Text::moduleLink($suggest_label, 'calendar', array('uop' => 'suggest_event', 'sch_id' => $this->id, 'date' => $default_date)); } }
public function getStartTime($format = '%c', $mode = null) { $time =& $this->start_time; if ($mode == 'user') { $time = PHPWS_Time::getUserTime($time); } elseif ($mode == 'server') { $time = PHPWS_Time::getUserTime($time); } return strftime($format, $time); }
public function getLocalDate($type = BLOG_VIEW_DATE_FORMAT) { return strftime($type, PHPWS_Time::getUserTime($this->create_date)); }