Ejemplo n.º 1
0
 /**
  * DataSet Column Add
  * @return <XiboAPIResponse>
  */
 public function DataSetColumnAdd()
 {
     // 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');
     }
     $heading = $this->GetParam('heading', _STRING);
     $listContent = $this->GetParam('listContent', _STRING);
     $columnOrder = $this->GetParam('columnOrder', _INT);
     $dataTypeId = $this->GetParam('dataTypeId', _INT);
     $dataSetColumnTypeId = $this->GetParam('datasetColumnTypeId', _INT);
     $formula = $this->GetParam('formula', _STRING);
     Kit::ClassLoader('datasetcolumn');
     $dataSetColumnObject = new DataSetColumn();
     if (!($dataSetColumnId = $dataSetColumnObject->Add($dataSetId, $heading, $dataTypeId, $listContent, $columnOrder, $dataSetColumnTypeId, $formula))) {
         return $this->Error($dataSetColumnObject->GetErrorNumber(), $dataSetColumnObject->GetErrorMessage());
     }
     return $this->Respond($this->ReturnId('datasetcolumn', $dataSetColumnId));
 }
Ejemplo n.º 2
0
 public function AddDataSetColumn()
 {
     // 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);
     $dataSet = Kit::GetParam('dataset', _POST, _STRING);
     $auth = $user->DataSetAuth($dataSetId, true);
     if (!$auth->edit) {
         trigger_error(__('Access Denied'));
     }
     $heading = Kit::GetParam('heading', _POST, _STRING);
     $listContent = Kit::GetParam('listcontent', _POST, _STRING);
     $columnOrder = Kit::GetParam('columnorder', _POST, _INT);
     $dataTypeId = Kit::GetParam('datatypeid', _POST, _INT);
     $dataSetColumnTypeId = Kit::GetParam('datasetcolumntypeid', _POST, _INT);
     $formula = Kit::GetParam('formula', _POST, _STRING);
     $dataSetObject = new DataSetColumn($db);
     if (!$dataSetObject->Add($dataSetId, $heading, $dataTypeId, $listContent, $columnOrder, $dataSetColumnTypeId, $formula)) {
         trigger_error($dataSetObject->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('Column Added'));
     $response->hideMessage = true;
     $response->loadForm = true;
     $response->loadFormUri = 'index.php?p=dataset&q=DataSetColumnsForm&datasetid=' . $dataSetId . '&dataset=' . $dataSet;
     $response->Respond();
 }