本文整理汇总了PHP中Kronolith::viewShowTime方法的典型用法代码示例。如果您正苦于以下问题:PHP Kronolith::viewShowTime方法的具体用法?PHP Kronolith::viewShowTime怎么用?PHP Kronolith::viewShowTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kronolith
的用法示例。
在下文中一共展示了Kronolith::viewShowTime方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _addBaseVars
/**
* Add base javascript variables to the page.
*/
protected function _addBaseVars()
{
global $conf, $injector, $prefs, $registry;
$auth_name = $registry->getAuth();
$has_tasks = Kronolith::hasApiPermission('tasks');
$identity = $injector->getInstance('Horde_Core_Factory_Identity')->create();
$app_urls = $js_vars = array();
if (isset($conf['menu']['apps']) && is_array($conf['menu']['apps'])) {
foreach ($conf['menu']['apps'] as $app) {
$app_urls[$app] = strval(Horde::url($registry->getInitialPage($app), true));
}
}
/* Variables used in core javascript files. */
$js_vars['conf'] = array_filter(array('URI_CALENDAR_EXPORT' => str_replace(array('%23', '%2523', '%7B', '%257B', '%7D', '%257D'), array('#', '#', '{', '{', '}', '}'), strval($registry->downloadUrl('#{calendar}.ics', array('actionID' => 'export', 'all_events' => 1, 'exportID' => Horde_Data::EXPORT_ICALENDAR, 'exportCal' => 'internal_#{calendar}'))->setRaw(true))), 'URI_RESOURCE_EXPORT' => str_replace(array('%23', '%2523', '%7B', '%257B', '%7D', '%257D'), array('#', '#', '{', '{', '}', '}'), strval($registry->downloadUrl('#{calendar}.ics', array('actionID' => 'export', 'all_events' => 1, 'exportID' => Horde_Data::EXPORT_ICALENDAR, 'exportCal' => 'resource_#{calendar}'))->setRaw(true))), 'URI_EVENT_EXPORT' => str_replace(array('%23', '%7B', '%7D'), array('#', '{', '}'), Horde::url('event.php', true)->add(array('view' => 'ExportEvent', 'eventID' => '#{id}', 'calendar' => '#{calendar}', 'type' => '#{type}'))), 'images' => array('alarm' => strval(Horde_Themes::img('alarm-fff.png')), 'attendees' => strval(Horde_Themes::img('attendees-fff.png')), 'exception' => strval(Horde_Themes::img('exception-fff.png')), 'new_event' => strval(Horde_Themes::img('new.png')), 'new_task' => strval(Horde_Themes::img('new_task.png')), 'recur' => strval(Horde_Themes::img('recur-fff.png'))), 'new_event' => $injector->getInstance('Kronolith_View_Sidebar')->newLink . $injector->getInstance('Kronolith_View_Sidebar')->newText . '</a>', 'new_task' => $injector->getInstance('Kronolith_View_SidebarTasks')->newLink . $injector->getInstance('Kronolith_View_SidebarTasks')->newText . '</a>', 'user' => $registry->convertUsername($auth_name, false), 'name' => $identity->getName(), 'email' => strval($identity->getDefaultFromAddress()), 'prefs_url' => strval($registry->getServiceLink('prefs', 'kronolith')->setRaw(true)), 'app_urls' => $app_urls, 'name' => $registry->get('name'), 'has_tasks' => intval($has_tasks), 'has_resources' => intval(!empty($conf['resource']['driver'])), 'login_view' => $prefs->getValue('defaultview') == 'workweek' ? 'week' : $prefs->getValue('defaultview'), 'default_calendar' => 'internal|' . Kronolith::getDefaultCalendar(Horde_Perms::EDIT), 'max_events' => intval($prefs->getValue('max_events')), 'date_format' => Horde_Core_Script_Package_Datejs::translateFormat(Horde_Nls::getLangInfo(D_FMT)), 'time_format' => $prefs->getValue('twentyFour') ? 'HH:mm' : 'hh:mm tt', 'import_file' => Horde_Data::IMPORT_FILE, 'import_url' => Horde_Data::IMPORT_URL, 'show_time' => Kronolith::viewShowTime(), 'default_alarm' => intval($prefs->getValue('default_alarm')), 'status' => array('cancelled' => Kronolith::STATUS_CANCELLED, 'confirmed' => Kronolith::STATUS_CONFIRMED, 'free' => Kronolith::STATUS_FREE, 'tentative' => Kronolith::STATUS_TENTATIVE), 'recur' => array(Horde_Date_Recurrence::RECUR_NONE => 'None', Horde_Date_Recurrence::RECUR_DAILY => 'Daily', Horde_Date_Recurrence::RECUR_WEEKLY => 'Weekly', Horde_Date_Recurrence::RECUR_MONTHLY_DATE => 'Monthly', Horde_Date_Recurrence::RECUR_MONTHLY_WEEKDAY => 'Monthly', Horde_Date_Recurrence::RECUR_YEARLY_DATE => 'Yearly', Horde_Date_Recurrence::RECUR_YEARLY_DAY => 'Yearly', Horde_Date_Recurrence::RECUR_YEARLY_WEEKDAY => 'Yearly'), 'perms' => array('all' => Horde_Perms::ALL, 'show' => Horde_Perms::SHOW, 'read' => Horde_Perms::READ, 'edit' => Horde_Perms::EDIT, 'delete' => Horde_Perms::DELETE, 'delegate' => Kronolith::PERMS_DELEGATE), 'tasks' => $has_tasks ? $registry->tasks->ajaxDefaults() : null));
/* Make sure this value is not optimized out by array_filter(). */
$js_vars['conf']['week_start'] = intval($prefs->getValue('week_start_monday'));
/* Gettext strings. */
$js_vars['text'] = array('alarm' => _("Alarm:"), 'alerts' => _("Notifications"), 'allday' => _("All day"), 'delete_calendar' => _("Are you sure you want to delete this calendar and all the events in it?"), 'delete_tasklist' => _("Are you sure you want to delete this task list and all the tasks in it?"), 'external_category' => _("Other events"), 'fix_form_values' => _("Please enter correct values in the form first."), 'geocode_error' => _("Unable to locate requested address"), 'hidelog' => _("Hide Notifications"), 'import_warning' => _("Importing calendar data. This may take a while..."), 'more' => _("more..."), 'no_assignee' => _("None"), 'no_calendar_title' => _("The calendar title must not be empty."), 'no_parent' => _("No parent task"), 'no_tasklist_title' => _("The task list title must not be empty."), 'no_url' => _("You must specify a URL."), 'prefs' => _("Preferences"), 'searching' => sprintf(_("Events matching \"%s\""), '#{term}'), 'shared' => _("Shared"), 'tasks' => _("Tasks"), 'unknown_resource' => _("Unknown resource."), 'wrong_auth' => _("The authentication information you specified wasn't accepted."), 'wrong_date_format' => sprintf(_("You used an unknown date format \"%s\". Please try something like \"%s\"."), '#{wrong}', '#{right}'), 'wrong_time_format' => sprintf(_("You used an unknown time format \"%s\". Please try something like \"%s\"."), '#{wrong}', '#{right}'));
for ($i = 1; $i <= 12; ++$i) {
$js_vars['text']['month'][$i - 1] = Horde_Nls::getLangInfo(constant('MON_' . $i));
}
for ($i = 1; $i <= 7; ++$i) {
$js_vars['text']['weekday'][$i] = Horde_Nls::getLangInfo(constant('DAY_' . $i));
}
foreach (array_diff(array_keys($js_vars['conf']['recur']), array(Horde_Date_Recurrence::RECUR_NONE)) as $recurType) {
$js_vars['text']['recur'][$recurType] = Kronolith::recurToString($recurType);
}
$js_vars['text']['recur']['exception'] = _("Exception");
// Maps
$js_vars['conf']['maps'] = $conf['maps'];
return $js_vars;
}
示例2: html
public function html()
{
global $prefs;
$more_timeslots = $prefs->getValue('time_between_days');
$include_all_events = !$prefs->getValue('show_shared_side_by_side');
$showLocation = Kronolith::viewShowLocation();
$showTime = Kronolith::viewShowTime();
if (!$this->parsed) {
$this->parse();
}
$slots = $this->days[$this->startDay]->slots;
$cid = 0;
require KRONOLITH_TEMPLATES . '/week/head.inc';
if ($this->sidebyside) {
require KRONOLITH_TEMPLATES . '/week/head_side_by_side.inc';
}
echo '</thead><tbody>';
$event_count = 0;
for ($j = $this->startDay; $j <= $this->endDay; ++$j) {
foreach (array_keys($this->_currentCalendars) as $cid) {
$event_count = max($event_count, count($this->days[$j]->all_day_events[$cid]));
reset($this->days[$j]->all_day_events[$cid]);
}
}
$row = '';
for ($j = $this->startDay; $j <= $this->endDay; ++$j) {
if ($more_timeslots) {
$row .= '<td class="kronolith-first-col"><span>' . _("All day") . '</span></td>';
}
$row .= '<td colspan="' . $this->days[$j]->totalspan . '" valign="top"';
if ($this->days[$j]->isToday()) {
$row .= ' class="kronolith-today"';
} elseif ($this->days[$j]->dayOfWeek() == 0 || $this->days[$j]->dayOfWeek() == 6) {
$row .= ' class="kronolith-weekend"';
}
$row .= '>';
foreach (array_keys($this->days[$j]->currentCalendars) as $cid) {
foreach ($this->days[$j]->all_day_events[$cid] as $event) {
$row .= '<div class="kronolith-event"' . $event->getCSSColors() . $event->getLink($this->days[$j], true, $this->link(0, true));
if (!$event->isPrivate() && $showLocation) {
$row .= '<span class="kronolith-location">' . htmlspecialchars($event->getLocation()) . '</span>';
}
$row .= '</div>';
}
}
$row .= '</td>';
}
$first_row = !$more_timeslots;
$newEventUrl = _("All day");
require KRONOLITH_TEMPLATES . '/day/all_day.inc';
$day_hour_force = $prefs->getValue('day_hour_force');
$day_hour_start = $prefs->getValue('day_hour_start') / 2 * $this->slotsPerHour;
$day_hour_end = $prefs->getValue('day_hour_end') / 2 * $this->slotsPerHour;
$rows = array();
$covered = array();
for ($i = 0; $i < $this->slotsPerDay; ++$i) {
if ($i >= $day_hour_end && $i > $this->last) {
break;
}
if ($i < $this->first && $i < $day_hour_start) {
continue;
}
$time = Kronolith_View_Day::prefHourFormat($slots[$i]['hour'], $i % $this->slotsPerHour * $this->slotLength);
$row = '';
for ($j = $this->startDay; $j <= $this->endDay; ++$j) {
// Add spacer between days, or timeslots.
if ($more_timeslots && $j != $this->startDay) {
$row .= '<td class="kronolith-first-col"><span>' . $time . '</span></td>';
}
if (!count($this->_currentCalendars)) {
$row .= '<td> </td>';
}
foreach (array_keys($this->_currentCalendars) as $cid) {
// Width (sum of colspans) of events for the current time
// slot.
$hspan = 0;
// $hspan + count of empty TDs in the current timeslot.
$current_indent = 0;
// $current_indent is initialized to the position of the
// first available cell of the day.
for (; isset($covered[$j][$i][$current_indent]); ++$current_indent) {
}
foreach ($this->days[$j]->event_matrix[$cid][$i] as $key) {
$event =& $this->days[$j]->events[$key];
if ($include_all_events || $event->calendar == $cid) {
// Since we've made sure that this event's
// overlap is a factor of the total span,
// we get this event's individual span by
// dividing the total span by this event's
// overlap.
$span = $this->days[$j]->span[$cid] / $event->overlap;
// Store the indent we're starting this event at
// for future use.
if (!isset($event->indent)) {
$event->indent = $current_indent;
}
// If $event->span is set this mean than we
// already calculated the width of the event.
if (!isset($event->span)) {
// If the first node that we would cover is
//.........这里部分代码省略.........
示例3: html
public function html()
{
global $prefs;
if (!$this->_parsed) {
$this->parse();
}
$started = false;
$first_row = true;
$addLinks = Kronolith::getDefaultCalendar(Horde_Perms::EDIT) && ($GLOBALS['injector']->getInstance('Horde_Core_Perms')->hasAppPermission('max_events') === true || $GLOBALS['injector']->getInstance('Horde_Core_Perms')->hasAppPermission('max_events') > Kronolith::countEvents());
$showLocation = Kronolith::viewShowLocation();
$showTime = Kronolith::viewShowTime();
require KRONOLITH_TEMPLATES . '/day/head.inc';
if ($this->sidebyside) {
require KRONOLITH_TEMPLATES . '/day/head_side_by_side.inc';
}
echo '<tbody>';
if ($addLinks) {
$newEventUrl = Horde::url('new.php')->add(array('datetime' => sprintf($this->dateString() . '%02d%02d00', $this->slots[0]['hour'], $this->slots[0]['min']), 'allday' => 1, 'url' => $this->link(0, true)))->link(array('title' => _("Create a New Event"))) . _("All day") . '</a>';
} else {
$newEventUrl = _("All day");
}
$row = '<td colspan="' . $this->totalspan . '">';
foreach (array_keys($this->_currentCalendars) as $cid) {
foreach ($this->all_day_events[$cid] as $event) {
$row .= '<div class="kronolith-event"' . $event->getCSSColors() . '>' . $event->getLink($this, true, $this->link(0, true));
if (!$event->isPrivate() && $showLocation) {
$row .= '<span class="event-location">' . htmlspecialchars($event->getLocation()) . '</span>';
}
$row .= '</div>';
}
}
$row .= '</td>';
require KRONOLITH_TEMPLATES . '/day/all_day.inc';
$day_hour_force = $prefs->getValue('day_hour_force');
$day_hour_start = $prefs->getValue('day_hour_start') / 2 * $this->slotsPerHour;
$day_hour_end = $prefs->getValue('day_hour_end') / 2 * $this->slotsPerHour;
$rows = array();
$covered = array();
for ($i = 0; $i < $this->slotsPerDay; ++$i) {
if ($i >= $day_hour_end && $i > $this->_last) {
break;
}
if ($i < $this->_first && $i < $day_hour_start) {
continue;
}
$row = '';
if (!count($this->_currentCalendars)) {
$row .= '<td> </td>';
}
foreach (array_keys($this->_currentCalendars) as $cid) {
$hspan = 0;
foreach ($this->_event_matrix[$cid][$i] as $key) {
$event =& $this->events[$key];
// Since we've made sure that this event's overlap is a
// factor of the total span, we get this event's
// individual span by dividing the total span by this
// event's overlap.
$span = $this->span[$cid] / $event->overlap;
// Store the indent we're starting this event at
// for future use.
if (!isset($event->indent)) {
$event->indent = $hspan;
}
// If the first node that we would cover is
// already covered, we can assume that table
// rendering will take care of pushing the event
// over. However, if the first node _isn't_
// covered but any others that we would cover
// _are_, we only cover the available nodes.
if (!isset($covered[$i][$event->indent])) {
$collision = false;
$available = 0;
for ($y = $event->indent; $y < $span + $event->indent; ++$y) {
if (isset($covered[$i][$y])) {
$collision = true;
break;
}
$available++;
}
if ($collision) {
$span = $available;
}
}
$hspan += $span;
$start = new Horde_Date(array('hour' => floor($i / $this->slotsPerHour), 'min' => $i % $this->slotsPerHour * $this->slotLength, 'month' => $this->month, 'mday' => $this->mday, 'year' => $this->year));
$end_slot = new Horde_Date($start);
$end_slot->min += $this->slotLength;
if ((!$day_hour_force || $i >= $day_hour_start) && $event->start->compareDateTime($start) >= 0 && $event->start->compareDateTime($end_slot) < 0 || $start->compareDateTime($this) == 0 || $day_hour_force && $i == $day_hour_start && $event->start->compareDateTime($start) < 0) {
// Store the nodes that we're covering for
// this event in the coverage graph.
for ($x = $i; $x < $i + $event->rowspan; ++$x) {
for ($y = $event->indent; $y < $hspan; ++$y) {
$covered[$x][$y] = true;
}
}
$row .= '<td class="kronolith-event"' . $event->getCSSColors() . 'width="' . round(90 / count($this->_currentCalendars) * ($span / $this->span[$cid])) . '%" ' . 'valign="top" colspan="' . $span . '" rowspan="' . $event->rowspan . '">' . '<div class="kronolith-event-info">';
if ($showTime) {
$row .= '<span class="kronolith-time">' . htmlspecialchars($event->getTimeRange()) . '</span>';
}
$row .= $event->getLink($this, true, $this->link(0, true));
//.........这里部分代码省略.........
示例4: html
public function html()
{
global $prefs;
$sidebyside = $prefs->getValue('show_shared_side_by_side');
$twentyFour = $prefs->getValue('twentyFour');
$addLinks = Kronolith::getDefaultCalendar(Horde_Perms::EDIT) && ($GLOBALS['injector']->getInstance('Horde_Core_Perms')->hasAppPermission('max_events') === true || $GLOBALS['injector']->getInstance('Horde_Core_Perms')->hasAppPermission('max_events') > Kronolith::countEvents());
if ($sidebyside) {
require KRONOLITH_TEMPLATES . '/month/head_side_by_side.inc';
} else {
require KRONOLITH_TEMPLATES . '/month/head.inc';
}
$html = '';
if (!$sidebyside && count($this->_currentCalendars)) {
$html .= '<tr>';
}
$showLocation = Kronolith::viewShowLocation();
$showTime = Kronolith::viewShowTime();
$day_url = Horde::url('day.php');
$this_link = $this->link(0, true);
$new_url = Horde::url('new.php')->add('url', $this_link);
$new_img = Horde::img('new_small.png', '+');
foreach ($this->_currentCalendars as $id => $cal) {
if ($sidebyside) {
$html .= '<tr>';
}
$cell = 0;
for ($day = $this->_startOfView; $day < $this->_startOfView + $this->_daysInView; ++$day) {
$date = new Kronolith_Day($this->month, $day, $this->year);
$date->hour = $twentyFour ? 12 : 6;
$week = $date->weekOfYear();
if ($cell % 7 == 0) {
$weeklink = Horde::url('week.php')->add('date', $date->dateString())->link(array('class' => 'kronolith-weeklink')) . ($sidebyside ? sprintf(_("Week %d"), $week) : $week) . '</a>';
if ($sidebyside) {
$html .= sprintf('<td class="kronolith-first-col">%s<br />%s</td>', $weeklink, htmlspecialchars(Kronolith::getLabel($cal)));
} else {
if ($cell != 0) {
$html .= "</tr>\n<tr>";
}
$html .= '<td class="kronolith-first-col">' . $weeklink . '</td>';
}
}
if ($date->isToday()) {
$style = ' class="kronolith-today"';
} elseif ($date->month != $this->month) {
$style = ' class="kronolith-other-month"';
} elseif ($date->dayOfWeek() == 0 || $date->dayOfWeek() == 6) {
$style = ' class="kronolith-weekend"';
} else {
$style = '';
}
$html .= '<td' . $style . '><div class="kronolith-day">';
$html .= $day_url->add('date', $date->dateString())->link() . $date->mday . '</a>';
if ($addLinks) {
$new_url->add('date', $date->dateString());
if ($sidebyside) {
$new_url->add('calendar', $id);
}
$html .= $new_url->link(array('title' => _("Create a New Event"), 'class' => 'newEvent')) . $new_img . '</a>';
}
$html .= '</div>';
$date_stamp = $date->dateString();
if (!empty($this->_events[$date_stamp])) {
foreach ($this->_events[$date_stamp] as $event) {
if (!$sidebyside || $event->calendar == $id) {
$html .= '<div class="kronolith-event"' . $event->getCSSColors() . '>';
if ($showTime && !$event->isAllDay()) {
$html .= '<span class="kronolith-time">' . htmlspecialchars($event->getTimeRange()) . '</span>';
}
$html .= $event->getLink($date, true, $this_link);
if (!$event->isPrivate() && $showLocation) {
$html .= '<span class="kronolith-location">' . htmlspecialchars($event->getLocation()) . '</span>';
}
$html .= '</div>';
}
}
}
$html .= "</td>\n";
++$cell;
}
if ($sidebyside) {
$html .= '</tr>';
}
}
if (!$sidebyside && count($this->_currentCalendars)) {
$html .= '</tr>';
}
echo $html . '</tbody></table>';
}