Exemple #1
0
 /**
  * Add store field
  */
 public function addfieldAction()
 {
     $this->_checkLoaded();
     $this->_checkObject();
     $id = Request::post('id', 'string', false);
     if (!$id || $this->_object->fieldExists($id)) {
         Response::jsonError($this->_lang->FIELD_EXISTS);
     }
     if ($this->_object->addField(array('name' => $id, 'type' => 'string'))) {
         $o = $this->_object->getField($id);
         $this->_storeProject();
         Response::jsonSuccess(array('name' => $o->name, 'type' => $o->type));
     } else {
         Response::jsonError($this->_lang->CANT_EXEC);
     }
 }