Exemple #1
0
 function get_leaves()
 {
     if ($this->_config->get('show_navigation_pseudo_leaves') && $_MIDGARD['user']) {
         $leaves["{$this->_topic->id}_LOCATIONS"] = array(MIDCOM_NAV_URL => "locations/", MIDCOM_NAV_NAME => 'Paikkatiedot');
     }
     if ($this->_config->get('show_navigation_pseudo_leaves')) {
         $leaves["{$this->_topic->id}_FEEDS"] = array(MIDCOM_NAV_URL => "feeds/", MIDCOM_NAV_NAME => 'Syötteet');
     }
     if ($this->_config->get('archive_enable') && $this->_config->get('archive_in_navigation') && $this->_config->get('show_navigation_pseudo_leaves')) {
         $leaves["{$this->_topic->id}_ARCHIVE"] = array(MIDCOM_NAV_URL => "archive/", MIDCOM_NAV_NAME => 'Arkisto');
     }
     if ($this->_config->get('show_navigation_pseudo_leaves') && $this->_config->get('archive_years_in_navigation')) {
         // Check for symlink
         if (!$this->_content_topic) {
             $this->_determine_content_topic();
         }
         $fevent = fi_kilonkipinat_events_compute_first_event($this->_content_topic);
         if (!$fevent) {
             return $leaves;
         }
         $first_year = (int) date('Y', strtotime($fevent->start));
         $year = $first_year;
         $levent = fi_kilonkipinat_events_compute_last_event($this->_content_topic);
         if (!$levent) {
             $last_year = (int) date('Y', time());
         } else {
             $last_year = (int) date('Y', strtotime($levent->end));
         }
         while ($year <= $last_year) {
             $next_year = $year + 1;
             $leaves["{$this->_topic->id}_ARCHIVE_{$year}"] = array(MIDCOM_NAV_URL => "archive/between/{$year}-01-01/{$next_year}-01-01/", MIDCOM_NAV_NAME => $year);
             $year = $next_year;
         }
         $leaves = array_reverse($leaves);
     }
     return $leaves;
 }
Exemple #2
0
 /**
  * Loads the first event time from the DB. This is the base for all operations on the
  * resultset.
  *
  * This is done under sudo if possible, to avoid problems arising if the first posting
  * is hidden.
  *
  * This call will put the event on which the first month is based into the request key
  * 'first_event'.
  *
  * @return Calendar_Month The month of the first event or null on failure.
  * @access private
  */
 function _compute_first_month()
 {
     if ($this->_config->get('list_from_master')) {
         $result = fi_kilonkipinat_events_compute_first_event($this->_request_data['master_event_obj']);
     } else {
         $result = fi_kilonkipinat_events_compute_first_event($this->_request_data['content_topic']);
     }
     if ($result) {
         $this->_request_data['first_event'] = $result;
         return Calendar_Factory::createByTimestamp('Month', strtotime($result->start));
     } else {
         $this->_request_data['first_event'] = null;
         return null;
     }
 }