/** * Internal function to return a SpecialEvent object from a row. * @param $row array * @return SpecialEvent */ function &_returnSpecialEventFromRow(&$row) { $specialEvent = new SpecialEvent(); $specialEvent->setId($row['special_event_id']); $specialEvent->setSchedConfId($row['sched_conf_id']); $specialEvent->setStartTime($this->datetimeFromDB($row['start_time'])); $specialEvent->setEndTime($this->datetimeFromDB($row['end_time'])); $this->getDataObjectSettings('special_event_settings', 'special_event_id', $row['special_event_id'], $specialEvent); return $specialEvent; }
/** * Save specialEvent. */ function execute() { $specialEventDao =& DAORegistry::getDAO('SpecialEventDAO'); $schedConf =& Request::getSchedConf(); if (isset($this->specialEventId)) { $specialEvent =& $specialEventDao->getSpecialEvent($this->specialEventId); } if (!isset($specialEvent)) { $specialEvent = new SpecialEvent(); } $specialEvent->setSchedConfId($schedConf->getId()); $specialEvent->setName($this->getData('name'), null); // Localized $specialEvent->setDescription($this->getData('description'), null); // Localized $specialEvent->setStartTime(date('Y-m-d H:i:s', $this->getData('startTime'))); $specialEvent->setEndTime(date('Y-m-d H:i:s', $this->getData('endTime'))); // Update or insert specialEvent if ($specialEvent->getId() != null) { $specialEventDao->updateSpecialEvent($specialEvent); } else { $specialEventDao->insertSpecialEvent($specialEvent); } }