コード例 #1
0
ファイル: AdminNodeController.php プロジェクト: nabble/ajde
 public function updateJson()
 {
     $id = Ajde::app()->getRequest()->getParam('id');
     $meta = Ajde::app()->getRequest()->getPostParam('meta');
     $key = Ajde::app()->getRequest()->getPostParam('key');
     $value = Ajde::app()->getRequest()->getPostParam('value');
     $model = new NodeModel();
     $model->loadByPK($id);
     $success = false;
     if ($meta) {
         $model->saveMetaValue($key, $value);
         $success = true;
     } else {
         $model->set($key, $value);
         $success = $model->save();
     }
     return ['success' => true, 'message' => $success ? 'Node updated' : 'Something went wrong'];
 }