StatusCommandsController Class Reference
[Status]
Controller to intercept status change commands. More...
Inheritance diagram for
StatusCommandsController:
Public Member Functions |
|
action_status_cmd_handler (PageData $page_data, $model, $id, $newstatus) | |
get_routes () | |
Return routes. |
Detailed Description
Controller to intercept status change commands.
All status change commands are send to command StatusCommand.
Definition at line 10 of file statuscommands.controller.php.
Member Function Documentation
StatusCommandsController::action_status_cmd_handler | ( | PageData $ | page_data, | |
$ | model, | |||
$ | id, | |||
$ | newstatus | |||
) |
Definition at line 20 of file statuscommands.controller.php.
00020 { 00021 $dao = DB::create($model); 00022 if (empty($dao)) { 00023 // No such type 00024 return CONTROLLER_NOT_FOUND; 00025 } 00026 $arr_id = explode(GYRO_COMMAND_ID_SEP, $id); 00027 foreach ($dao->get_table_keys() as $key => $field) { 00028 $dao->$key = array_shift($arr_id); 00029 } 00030 00031 if ($dao->find(IDataObject::AUTOFETCH) != 1) { 00032 // Zero or many items 00033 return CONTROLLER_NOT_FOUND; 00034 } 00035 00036 $cmd = CommandsFactory::create_command($dao, 'status', $newstatus); 00037 if (!$cmd->can_execute(false)) { 00038 return CONTROLLER_ACCESS_DENIED; 00039 } 00040 00041 $status = $cmd->execute(); 00042 if ($status->is_ok()) { 00043 $status = new Message(tr('The status has been changed', 'status')); 00044 } 00045 History::go_to(0, $status); 00046 exit; 00047 }
StatusCommandsController::get_routes | ( | ) |
Return routes.
Reimplemented from ControllerBase.
Definition at line 14 of file statuscommands.controller.php.
00014 { 00015 return array( 00016 new CommandsRoute('https://process_commands/{model:s}/{id:ui>}/status/{newstatus:s}', $this, 'status_cmd_handler'), 00017 ); 00018 }
The documentation for this class was generated from the following file:
- gyro/modules/status/controller/statuscommands.controller.php