public function deleteAction() { $record = Record::find($this->getParam('id')); if ($record) { $record->delete(); } $this->_flushConventionCache(); $this->alert('Record deleted.', 'green'); $this->redirectFromHere(array('action' => 'index', 'id' => NULL, 'csrf' => NULL)); }
/** * @param bool $required * @return \Entity\Convention * @throws \DF\Exception\DisplayOnly */ protected function _getConvention($required = false) { $convention = null; if ($this->hasParam('id')) { $id = (int) $this->getParam('id'); $convention = Convention::find($id); } if ($convention instanceof Convention) { return $convention; } elseif ($required) { throw new \DF\Exception\DisplayOnly('Convention not specified!'); } else { return null; } }
public function viewAction() { $id = $this->getParam('id'); $record = Convention::find($id); if (!$record instanceof Convention) { return $this->returnError('Convention not found.'); } $export_data = Convention::api($record); if (count($record->archives) > 0) { $export_data['archives'] = array('videos' => array(), 'sources' => array()); foreach ($record->archives as $row) { if ($row->isPlayable()) { $export_data['archives']['videos'][] = $row->toArray(); } else { $export_data['archives']['sources'][] = $row->toArray(); } } } return $this->returnSuccess($export_data); }