public function modTask() { if (!$this->permissions['mod']) { $output = array('success' => false, 'message' => $this->_getMessage("no permission")); echo $this->json->encode($output); } $id = get::req('id', DOTY_INT, 0); //check if specified period is valid if ($id <= 0) { //if invalid, output an error message $output = array('success' => false, 'message' => Lang::t('_INVALID_PERIOD_SPECIFIED')); echo $this->json->encode($output); } else { //extract DB data by id $record = $this->model->getTimePeriod($id); //render the dialog content $this->render('mod', array('id' => $id, 'title' => $record->title, 'start_date' => $record->start_date, 'end_date' => $record->end_date, 'json' => $this->json)); } }