/** * Internal function to return a TimeBlock object from a row. * @param $row array * @return TimeBlock */ function &_returnTimeBlockFromRow(&$row) { $timeBlock = new TimeBlock(); $timeBlock->setId($row['time_block_id']); $timeBlock->setSchedConfId($row['sched_conf_id']); $timeBlock->setStartTime($this->datetimeFromDB($row['start_time'])); $timeBlock->setEndTime($this->datetimeFromDB($row['end_time'])); $timeBlock->setAssignedColour($row['assigned_colour']); $timeBlock->setUnassignedColour($row['unassigned_colour']); $this->getDataObjectSettings('time_block_settings', 'time_block_id', $row['time_block_id'], $timeBlock); return $timeBlock; }
/** * Save time block. */ function execute() { $timeBlockDao =& DAORegistry::getDAO('TimeBlockDAO'); $schedConf =& Request::getSchedConf(); if (isset($this->timeBlockId)) { $timeBlock =& $timeBlockDao->getTimeBlock($this->timeBlockId); } if (!isset($timeBlock)) { $timeBlock = new TimeBlock(); } $timeBlock->setSchedConfId($schedConf->getId()); $timeBlock->setStartTime($this->getData('startTime')); $timeBlock->setEndTime($this->getData('endTime')); // Update or insert time block if ($timeBlock->getId() != null) { $timeBlockDao->updateTimeBlock($timeBlock); } else { $timeBlockDao->insertTimeBlock($timeBlock); } }