Example #1
0
 /**
  * View events for a given day
  *
  * @return     void
  */
 public function dayTask()
 {
     // Get some needed info
     $year = $this->year;
     $month = $this->month;
     $day = $this->day;
     $offset = $this->offset;
     $option = $this->_option;
     // Get the events for this day
     $filters = array();
     $filters['gid'] = $this->gid;
     $filters['category'] = $this->category;
     $filters['scope'] = 'event';
     $select_date = sprintf("%4d-%02d-%02d 00:00:00", $year, $month, $day);
     $select_date_fin = sprintf("%4d-%02d-%02d 23:59:59", $year, $month, $day);
     $select_date = Date::of($select_date, Config::get('offset'));
     $select_date_fin = Date::of($select_date_fin, Config::get('offset'));
     $filters['select_date'] = $select_date->toSql();
     $filters['select_date_fin'] = $select_date_fin->toSql();
     $ee = new Event($this->database);
     $events = $ee->getEvents('day', $filters);
     // Go through each event and ensure it should be displayed
     // $events = array();
     // if (count($rows) > 0)
     // {
     // 	foreach ($rows as $row)
     // 	{
     // 		$checkprint = new EventsRepeat($row, $year, $month, $day);
     // 		if ($checkprint->viewable == true)
     // 		{
     // 			$events[] = $row;
     // 		}
     // 	}
     // }
     // Everyone has access unless restricted to admins in the configuration
     $authorized = true;
     if (User::isGuest()) {
         $authorized = false;
     }
     if ($this->config->getCfg('adminlevel')) {
         $authorized = $this->_authorize();
     }
     // Get a list of categories
     $categories = $this->_getCategories();
     // Build the page title
     $this->_buildTitle();
     // Build the pathway
     $this->_buildPathway();
     // Output HTML
     $this->view->setLayout('day')->setName('browse');
     $this->view->option = $this->_option;
     $this->view->title = $this->_title;
     $this->view->task = $this->_task;
     $this->view->year = $year;
     $this->view->month = $month;
     $this->view->day = $day;
     $this->view->rows = $events;
     $this->view->authorized = $authorized;
     $this->view->fields = $this->config->getCfg('fields');
     $this->view->category = $this->category;
     $this->view->categories = $categories;
     $this->view->offset = $offset;
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     $this->view->display();
 }