Exemplo n.º 1
0
 /**
  * Delete Template
  * @return <XiboAPIResponse>
  */
 public function TemplateDelete()
 {
     if (!$this->user->PageAuth('template')) {
         return $this->Error(1, 'Access Denied');
     }
     $layout = new Layout();
     $layoutId = $this->GetParam('templateId', _INT);
     if (!$this->user->LayoutAuth($layoutId)) {
         return $this->Error(1, 'Access Denied');
     }
     if (!$layout->Delete($layoutId)) {
         return $this->Error($layout->GetErrorNumber(), $layout->GetErrorMessage());
     }
     return $this->Respond($this->ReturnId('success', true));
 }
Exemplo n.º 2
0
 /**
  * Deletes a template
  * @return
  */
 function DeleteTemplate()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error(__('Sorry the form has expired. Please refresh.'), E_USER_ERROR);
     }
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $templateId = Kit::GetParam('templateId', _POST, _INT);
     if ($templateId == 0) {
         trigger_error(__('No template selected'), E_USER_ERROR);
     }
     // Is this user allowed to delete this template?
     $auth = $this->user->TemplateAuth($templateId, true);
     if (!$auth->del) {
         trigger_error(__('Access denied'), E_USER_ERROR);
     }
     // Use the data class
     $template = new Layout();
     // Delete the template
     if (!$template->Delete($templateId)) {
         trigger_error($template->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('The Template has been Deleted'));
     $response->Respond();
 }
Exemplo n.º 3
0
 /**
  * Deletes a layout record from the DB
  */
 function delete()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error(__('Sorry the form has expired. Please refresh.'), E_USER_ERROR);
     }
     $response = new ResponseManager();
     $layoutId = Kit::GetParam('layoutid', _POST, _INT, 0);
     if (!$this->auth->del) {
         trigger_error(__('You do not have permissions to delete this layout'), E_USER_ERROR);
     }
     $layoutObject = new Layout();
     if (!$layoutObject->Delete($layoutId)) {
         trigger_error($layoutObject->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('The Layout has been Deleted'));
     $response->Respond();
 }
Exemplo n.º 4
0
 /**
  * Delete Layout
  * @return <XiboAPIResponse>
  */
 public function LayoutDelete()
 {
     if (!$this->user->PageAuth('layout')) {
         return $this->Error(1, 'Access Denied');
     }
     Kit::ClassLoader('Layout');
     $layout = new Layout($this->db);
     $layoutId = $this->GetParam('layoutId', _INT);
     if (!$this->user->LayoutAuth($layoutId)) {
         return $this->Error(1, 'Access Denied');
     }
     if (!$layout->Delete($layoutId)) {
         return $this->Error($layout->GetErrorNumber(), $layout->GetErrorMessage());
     }
     return $this->Respond($this->ReturnId('success', true));
 }