/** * Returns the value as an associative array (helper method) * * @param string $returnType type of date object that return value represents * @param string $format ['int' | 'array' | 'timestamp' | 'object'] * @param mixed $stamp timestamp (depending on Calendar engine being used) * @param int $default default value (i.e. give me the answer quick) * * @return mixed * @access private */ function returnValue($returnType, $format, $stamp, $default) { switch (strtolower($format)) { case 'int': return $default; case 'array': return $this->toArray($stamp); break; case 'object': include_once CALENDAR_ROOT . 'Factory.php'; return Calendar_Factory::createByTimestamp($returnType, $stamp); break; case 'timestamp': default: return $stamp; break; } }
/** * Gets the value of the following week, according to the requested format * * @param string $format ['timestamp' | 'n_in_month' | 'n_in_year' | 'array'] * @return mixed * @access public */ function nextWeek($format = 'n_in_month') { switch (strtolower($format)) { case 'int': case 'n_in_month': return $this->lastWeek ? null : $this->thisWeek('n_in_month') + 1; break; case 'n_in_year': return $this->cE->getWeekNInYear($this->cE->stampToYear($this->nextWeek), $this->cE->stampToMonth($this->nextWeek), $this->cE->stampToDay($this->nextWeek)); break; case 'array': return $this->toArray($this->nextWeek); break; case 'object': require_once CALENDAR_ROOT . 'Factory.php'; return Calendar_Factory::createByTimestamp('Week', $this->nextWeek); break; case 'timestamp': default: return $this->nextWeek; break; } }
/** * 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); } }