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; }
/** * Loads the last event (end) 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 last posting * is hidden. This keeps up performance, as an execute_unchecked() can be made in this case. * If sudo cannot be acquired, the system falls back to excute(). * * This call will put the event on which the last month is based into the request key * 'last_event'. * * @return Calendar_Month The month of the last event or null on failure. * @access private */ function _compute_last_month() { if ($this->_config->get('list_from_master')) { $result = fi_kilonkipinat_events_compute_last_event($this->_request_data['master_event_obj']); } else { $result = fi_kilonkipinat_events_compute_last_event($this->_request_data['content_topic']); } if ($result) { $this->_request_data['last_event'] = $result; return Calendar_Factory::createByTimestamp('Month', strtotime($result->end)); } else { $this->_request_data['last_event'] = null; return Calendar_Factory::createByTimestamp('Month', time() + 1); } }