protected function retrieveItem(AppModel $object, $parameter_not_found = MESSAGE_PARAMETER_NOT_FOUND, $parameter_not_valid = MESSAGE_PARAMETER_NOT_VALID, $record_not_found = MESSAGE_RECORD_NOT_FOUND) { if (count($this->registry->request['args']) <= 0) { $this->error_500(array("error_string" => $parameter_not_found)); } $id = intval($this->registry->request['args']['0']); if ($id == 0) { $this->error_500(array("error_string" => $parameter_not_valid)); } $item = $object->get($id); if ($item == null) { $this->error_500(array("error_string" => $record_not_found)); } return $item; }
/** * estrare un singolo record dalla tabella * @param id * @return item or null */ public function get($id){ $item = parent::get($id); $sys_userrole = new sys_userrole($this -> _db); $item_role = $sys_userrole -> get($item-> sys_userrole_fk); $item -> role_label = $item_role -> name; $item -> role_desc = $item_role -> description; intval($item -> blocked) == 0 ? $item -> blocked_label = "No" : $item -> blocked_label = "Si"; intval($item -> sendemail) == 0 ? $item -> sendemail_label = "No" : $item -> sendemail_label = "Si"; $date = DateTime::createFromFormat("Y-m-d H:i:s", $item -> registerdate); $item -> registerdate = $date -> format("d/m/Y"); return $item; }