コード例 #1
0
ファイル: AdminNodeController.php プロジェクト: nabble/ajde
 public function quickJson()
 {
     $parent = Ajde::app()->getRequest()->getPostParam('parent');
     $title = Ajde::app()->getRequest()->getPostParam('title');
     $due = Ajde::app()->getRequest()->getPostParam('due');
     $allocated = Ajde::app()->getRequest()->getPostParam('allocated');
     $model = new NodeModel();
     $model->populate(['parent' => $parent, 'title' => $title, 'user' => UserModel::getLoggedIn()->getPK(), 'nodetype' => NodeModel::NODETYPE_ISSUE]);
     Ajde_Event::trigger($model, 'beforeCrudSave', []);
     $success = $model->insert();
     Ajde_Event::trigger($model, 'afterCrudSave', []);
     $model->saveMetaValue(NodeModel::META_ISSUESTATUS, NodeModel::ISSUESTATUS_NEW);
     $model->saveMetaValue(NodeModel::META_ISSUEDUE, $due);
     $model->saveMetaValue(NodeModel::META_ALLOCATED, $allocated);
     return ['success' => $success, 'message' => $success ? 'Node added' : 'Something went wrong'];
 }