Exemplo n.º 1
0
 /**
  * DataSet Edit
  * @return <XiboAPIResponse>
  */
 public function DataSetEdit()
 {
     // Auth
     if (!$this->user->PageAuth('dataset')) {
         return $this->Error(1, 'Access Denied');
     }
     $dataSetId = $this->GetParam('dataSetId', _INT);
     $auth = $this->user->DataSetAuth($dataSetId, true);
     if (!$auth->edit) {
         return $this->Error(1, 'Access Denied');
     }
     $dataSet = $this->GetParam('dataset', _STRING);
     $description = $this->GetParam('description', _STRING);
     Kit::ClassLoader('dataset');
     $dataSetObject = new DataSet();
     if (!$dataSetObject->Edit($dataSetId, $dataSet, $description)) {
         return $this->Error($dataSetObject->GetErrorNumber(), $dataSetObject->GetErrorMessage());
     }
     return $this->Respond($this->ReturnId('success', true));
 }
Exemplo n.º 2
0
 public function EditDataSet()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error('Token does not match', E_USER_ERROR);
     }
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $dataSetId = Kit::GetParam('datasetid', _POST, _INT);
     $auth = $user->DataSetAuth($dataSetId, true);
     if (!$auth->edit) {
         trigger_error(__('Access Denied'));
     }
     $dataSet = Kit::GetParam('dataset', _POST, _STRING);
     $description = Kit::GetParam('description', _POST, _STRING);
     $dataSetObject = new DataSet($db);
     if (!$dataSetObject->Edit($dataSetId, $dataSet, $description)) {
         trigger_error($dataSetObject->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('DataSet Edited'));
     $response->Respond();
 }