本文整理汇总了PHP中Calendar::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Calendar::factory方法的具体用法?PHP Calendar::factory怎么用?PHP Calendar::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Calendar
的用法示例。
在下文中一共展示了Calendar::factory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: eventbrite_venue_get_calendar_of_events
/**
* Builds the calendar control for the specified month and year
*
* @param int $month numeric value of the month
* @param int $year year
* @return type
*/
function eventbrite_venue_get_calendar_of_events($month, $year)
{
$month_events = eventbrite_venue_get_monthly_events($month, $year);
$calendar = Calendar::factory($month, $year);
$calendar->standard('today')->standard('prev-next');
foreach ($month_events as $month_event) {
$start_date = new DateTime($month_event->start->local);
$end_date = new DateTime($month_event->end->local);
$start_time = $start_date->format('g:ia');
$end_time = $end_date->format('g:ia');
$cta_text = get_eventbrite_setting('call-to-action');
// if set to the 'Buy Tickets' option only use 'Buy' to preserve space in flyout
$cta_text = 'Buy Tickets' === $cta_text ? 'Buy' : $cta_text;
$eb_event_url = eventbrite_venue_get_eb_event_url($month_event, 'wpcalendar');
$wp_event_url = eventbrite_venue_get_wp_event_url($month_event);
$event_popover_url = $eb_event_url;
if ($wp_event_url) {
$event_popover_url = $wp_event_url;
}
$format_string = '%1$s - %2$s<a href="%3$s" data-toggle="popover"
data-content="<a href=\'%8$s\' class=\'pull-right btn\'>%9$s</a><p><span>%1$s-%2$s</span>%5$s</p><p>%6$s</p>"
data-original-title="%7$s">%4$s</a>';
$output = sprintf($format_string, esc_html($start_time), esc_html($end_time), esc_url($event_popover_url), esc_html($month_event->name->text), esc_html(eventbrite_venue_get_event_ticket_price_string($month_event->ticket_classes)), esc_html(eventbrite_venue_get_event_excerpt($month_event->description->text, 20)), esc_html($month_event->name->text), esc_url($eb_event_url), __(esc_html($cta_text), 'eventbrite-venue'));
$event = $calendar->event()->condition('timestamp', $start_date->format('U'))->title(esc_html($month_event->name->text))->output($output);
$calendar->attach($event);
$diff = date_diff($start_date, $end_date);
$days_diff = (int) $diff->format('%a');
if ($days_diff) {
$start_day = (int) $start_date->format('Ymd');
$event_title = sprintf(_x('%s - cont.', 'calendar', 'eventbrite-venue'), esc_html($month_event->name->text));
$output = sprintf($format_string, esc_html($start_time), esc_html($end_time), esc_url($event_popover_url), esc_html($event_title), esc_html(eventbrite_venue_get_event_ticket_price_string($month_event->ticket_classes)), esc_html(eventbrite_venue_get_event_excerpt($month_event->description->text, 20)), esc_html($month_event->name->text), esc_url(eventbrite_venue_get_eb_event_url($month_event, 'wpcalendar')), __(esc_html($cta_text), 'eventbrite-venue'));
$counter = 0;
while ($counter < $days_diff) {
$counter += 1;
$event = $calendar->event()->condition('timestamp', strtotime($start_day + $counter))->title(esc_html($month_event->name->text))->output($output);
$calendar->attach($event);
}
}
}
return $calendar;
}
示例2: _side_views
/**
* Side views
*/
public function _side_views()
{
// calendar
$calendar = Calendar::factory($this->date->format('n'), $this->date->format('Y'));
widget::add('side', $calendar->render());
// events
$new_events = ORM::factory('event')->order_by('id', 'DESC')->find_all(15);
$updated_events = ORM::factory('event')->where('modifies', '>', 0)->order_by('modified', 'DESC')->find_all(15);
$tabs = array();
$tabs[] = array('href' => '#events-new', 'title' => __('New events'), 'tab' => View_Mod::factory('events/events_list', array('mod_id' => 'events-new', 'mod_class' => 'cut tab events', 'title' => __('New events'), 'events' => $new_events)));
$tabs[] = array('href' => '#events-updated', 'title' => __('Updated events'), 'tab' => View_Mod::factory('events/events_list', array('mod_id' => 'events-updated', 'mod_class' => 'cut tab events', 'title' => __('Updated events'), 'events' => $updated_events)));
widget::add('side', new View('generic/tabs', array('id' => 'events-tab', 'tabs' => $tabs)));
//widget::add('foot', html::script_source('$(function() { $("#events-tab > ul").tabs({ fx: { height: "toggle", opacity: "toggle", duration: "fast" } }); });'));
}
示例3: include_once
//this is the calendar class
include_once("classes/calendar.php");
//Any pre-page logic should go here!
if (isset($_POST['addappt-submit'])) {
$_POST['datetime'] = $_POST['date'].' '.$_POST['time'].":00:00";
$_POST['submitter_id']=$_SESSION['user_id'];
$_POST['tech_id']=$_SESSION['user_id'];
add_appt($_POST);
}
//Generate the calendar
$month = isset($_GET['m']) ? $_GET['m'] : NULL;
$year = isset($_GET['y']) ? $_GET['y'] : NULL;
$calendar = Calendar::factory($month, $year);
$calendar->standard('today')
->standard('prev-next')
->standard('holidays');
$events = array();
$appts = get_appts();
while ($appt = $appts->fetch_array()) {
//convert the datetime to a timestamp, because the calendar does not understand datetimes
$datetime = new DateTime($appt['datetime']);
$timestamp = $datetime->getTimestamp();
//Build the rest of the information
$title = ucfirst(appt_type_to_string($appt['type']));
示例4: isset
<?php
$month = isset($_GET['m']) ? $_GET['m'] : NULL;
$year = isset($_GET['y']) ? $_GET['y'] : NULL;
if (Auth::instance()->logged_in("nhis")) {
$treatmentcycles = Model::factory('treatmentcyclemd')->SelectAll();
} elseif (Auth::instance()->logged_in("hmo")) {
$hmouser = Model::factory('hmomd')->get_hmo_by_user($user->id);
$treatmentcycles = Model::factory('treatmentcyclemd')->SelectAwaitingAuthCode($hmouser['hmid']);
} else {
$treatmentcycles = array();
}
$calendar = Calendar::factory($month, $year, array('show_days' => array(1, 1, 1, 1, 1, 1, 1)));
/* $event1 = $calendar->event()
->condition('timestamp', strtotime(date('F').' 21, '.date('Y')))
->title('Hello All')
->output('<a href="#">Going to Google</a>');
$event2 = $calendar->event()
->condition('timestamp', strtotime(date('F').' 21, '.date('Y')))
->title('Something Awesome')
->output('<a href="#">My Portfolio</a>');
$event = $calendar->event()
->condition('current', TRUE) // Event is in the current month
->condition('month', 10) // On the 11th month (November)
->condition('day_of_week', 4) // On a Thursday
->condition('occurrence', 4) // The 4th Thursday of the month
->title('NHIS')
->output('NHIS Meeting');*/
$calendar->standard('today')->standard('prev-next');