Ejemplo n.º 1
0
 public function month_view($year = null, $month = null)
 {
     // - HELPERS
     $this->load->helper(array('html', 'url', 'calendar', 'str', 'math'));
     // - MODELS
     $this->load->model('Calendar_events_m');
     $calendar = new CalendarHelper();
     // - MONTH VIEW
     $month_dt = new DateTime("{$year}-{$month}-01", new DateTimeZone('Europe/London'));
     $month_view = $calendar->get_month_view($year, $month);
     $m_cal_events = new Calendar_events_m();
     $events = $m_cal_events->get_events_of_month($year, $month, null);
     //echo '<pre>' . json_encode($month_view, JSON_PRETTY_PRINT) . '</pre>';
     $events = $m_cal_events->get_events_of_date_range($month_view->start->format('Y-m-d'), $month_view->end->format('Y-m-d'), null);
     //echo json_encode($events);
     for ($i = 0; $i < count($events); $i++) {
         $events[$i]->event_name = Str::decode($events[$i]->event_name);
         $events[$i]->location = Str::decode($events[$i]->location);
         $events[$i]->notes = Str::decode($events[$i]->notes);
         $month_view->dates[$events[$i]->date]->events[] = $events[$i];
     }
     //echo json_encode($month_view);
     // - YEAR ROW
     $year_row = array();
     for ($i = 1; $i <= 12; $i++) {
         $month_num = MathNH::alz($i, 2);
         $year_row[$month_num] = $calendar->get_month_view($year, $month_num);
         $events = $m_cal_events->get_binary_events_of_month($year, $month_num, null);
         for ($j = 0; $j < count($events); $j++) {
             $year_row[$month_num]->dates[$events[$j]->date]->has_events = TRUE;
         }
     }
     $next_month = new DateTime($month_dt->format('Y-m-d'), new DateTimeZone('Europe/London'));
     $next_month->modify('+1 month');
     $prev_month = new DateTime($month_dt->format('Y-m-d'), new DateTimeZone('Europe/London'));
     $prev_month->modify('-1 month');
     $next_year = new DateTime($month_dt->format('Y-m-d'), new DateTimeZone('Europe/London'));
     $next_year->modify('+1 year');
     $prev_year = new DateTime($month_dt->format('Y-m-d'), new DateTimeZone('Europe/London'));
     $prev_year->modify('-1 year');
     // - Views
     $this->load->view('main/alpha.html', array('title' => "Calendar - Month View - " . $month_dt->format('F Y'), 'extra_css' => array(), 'extra_js' => array('js/greensock/TweenMax.min.js', 'js/form.js')));
     //$this->view->load('header.html');
     //$this->view->load('content_opener.html', ['subheader' => "Calendar - Month View - " . $month_dt->format('F Y')]);
     $this->load->view('calendar/month_view.html', array('year' => $year, 'month' => $month, 'month_view' => $month_view->dates, 'events' => $events, 'month_dt' => $month_dt, 'next' => $next_month, 'prev' => $prev_month));
     $this->load->view('calendar/year_row.html', array('year' => $year, 'month' => $month, 'year_row' => $year_row, 'next' => $next_year, 'prev' => $prev_year));
     /*
     		$this->view->load('content_closer.html');
     		$this->view->load('footer.html');
     		
     		$this->view->load('omega.html');*/
 }
 /**
  * Contructor
  * @param type $controller
  * @param type $name
  */
 public function __construct($controller, $name)
 {
     $gridEventConfig = ComingEventsForm::eventConfig();
     $GridFieldPast = new GridField('PastEvents', '', CalendarHelper::past_events()->sort('StartDateTime DESC'), $gridEventConfig);
     $fields = new FieldList($GridFieldPast);
     $actions = new FieldList();
     $this->addExtraClass('PastEventsForm');
     parent::__construct($controller, $name, $fields, $actions);
 }
 /**
  * Contructor
  * @param type $controller
  * @param type $name
  */
 public function __construct($controller, $name)
 {
     $gridEventConfig = self::eventConfig();
     $GridFieldComing = new GridField('Events', '', CalendarHelper::coming_events(), $gridEventConfig);
     $fields = new FieldList($GridFieldComing);
     $actions = new FieldList();
     $this->addExtraClass('ComingEventsForm');
     parent::__construct($controller, $name, $fields, $actions);
 }
		<fieldset>
			<legend>Residency Information</legend>
		</fieldset>

		<div>
			<div style="text-align:right" class="span3">
	    		<?php 
echo $form->labelEx($residentRecord, 'resident_since');
?>
			</div>
			<div style="text-align:left" class="span6">
				<?php 
echo CHtml::activeDropDownList($residentRecord, 'residentSinceDate', $birthdayDateArr, array('prompt' => "Day", "style" => "width: 84px;"));
?>
				<?php 
echo CHtml::activeDropDownList($residentRecord, 'residentSinceMonth', CalendarHelper::retrieveYearAsArray(), array('prompt' => "Month", "style" => "width: 120px;"));
?>
				<br>
				<?php 
echo CHtml::activeTextField($residentRecord, 'residentSinceYear', array('placeholder' => "Year", 'value' => $residentSinceYear));
?>
	    		<br><?php 
echo $form->error($residentRecord, 'resident_since');
?>
			</div>
			<div class="clearfix"></div>
		</div>
	

		<fieldset>
			<legend>Employment Information</legend>
Ejemplo n.º 5
0
 public function getEvents()
 {
     return CalendarHelper::coming_events()->filter(array('RegionID' => $this->ID));
 }
 /**
  * Event list for "eventlist" mode
  * 
  * @return type
  */
 public function Events()
 {
     $action = $this->request->param('Action');
     //Debug::dump($this->request->params());
     //Normal & Registerable events
     $s = CalendarConfig::subpackage_settings('pagetypes');
     $indexSetting = $s['calendarpage']['index'];
     if ($action == 'eventregistration' || $action == 'eventlist' || $action == '' && $indexSetting == 'eventlist') {
         $events = CalendarHelper::events_for_month($this->CurrentMonth());
         if ($action == 'eventregistration') {
             $events = $events->filter('Registerable', 1);
         }
         return $events;
     }
     //Search
     if ($action == 'search') {
         $query = $this->SearchQuery();
         $query = strtolower(addslashes($query));
         //Debug::dump($query);
         $qarr = preg_split('/[ +]/', $query);
         $filter = '';
         $first = true;
         foreach ($qarr as $qitem) {
             if (!$first) {
                 $filter .= " AND ";
             }
             $filter .= " (\n\t\t\t\t\tTitle LIKE '%{$qitem}%'\n\t\t\t\t\tOR Details LIKE '%{$qitem}%'\n\t\t\t\t)";
             $first = false;
         }
         //Debug::dump($filter);
         $events = CalendarHelper::all_events()->where($filter);
         return $events;
     }
     //TODO below doesn't need to be that complicated...
     //		$events = null;
     //		if ($action == 'past') {
     //			$events = CalendarHelper::past_events();
     //		} else {
     //			if ($this->CurrentCategoryID()) {
     //				$events = PublicEventCategory::get()
     //					->ByID($this->CurrentCategoryID())
     //					->ComingEvents($this->CurrentDisplayDate());
     //			} else {
     //				$events = CalendarHelper::coming_events($this->CurrentDisplayDate());
     //			}
     //		}
     //
     //		if ($this->CurrentCalendarID()) {
     //			$events = $events->filter(array(
     //				'CalendarID' => $this->CurrentCalendarID()
     //			));
     //		}
     //
     //		$list = new PaginatedList($events, $this->request);
     //		$list->setPageLength(10);
     //
     //		return $list;
 }
Ejemplo n.º 7
0
 public function getFutureEvents()
 {
     return CalendarHelper::coming_events();
 }