Exemplo n.º 1
0
 /**
  * Copys a layout
  */
 public function Copy()
 {
     // 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();
     $layoutid = Kit::GetParam('layoutid', _POST, _INT);
     $layout = Kit::GetParam('layout', _POST, _STRING);
     $description = Kit::GetParam('description', _POST, _STRING);
     $copyMedia = Kit::GetParam('copyMediaFiles', _POST, _CHECKBOX);
     Kit::ClassLoader('Layout');
     $layoutObject = new Layout($db);
     if (!$layoutObject->Copy($layoutid, $layout, $description, $user->userid, (bool) $copyMedia)) {
         trigger_error($layoutObject->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('Layout Copied'));
     $response->Respond();
 }
Exemplo n.º 2
0
 /**
  * Copy Layout
  * @return <XiboAPIResponse>
  */
 public function LayoutCopy()
 {
     if (!$this->user->PageAuth('layout')) {
         return $this->Error(1, 'Access Denied');
     }
     Kit::ClassLoader('Layout');
     $layout = new Layout();
     $layoutId = $this->GetParam('layoutId', _INT);
     $name = $this->GetParam('layout', _STRING);
     $description = $this->GetParam('description', _STRING);
     $copyMedia = $this->GetParam('copyMedia', _INT);
     if (!$this->user->LayoutAuth($layoutId)) {
         return $this->Error(1, 'Access Denied');
     }
     // Copy this layout
     $layoutObject = new Layout();
     if (!($id = $layoutObject->Copy($layoutId, $name, $description, $this->user->userid, $copyMedia))) {
         return $this->Error($layoutObject->GetErrorNumber(), $layoutObject->GetErrorMessage());
     }
     Debug::LogEntry('audit', 'Copied layout with id' . $id);
     return $this->Respond($this->ReturnId('layout', $id));
 }
Exemplo n.º 3
0
 /**
  * Adds a template
  * @return 
  */
 function AddTemplate()
 {
     // 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();
     $template = Kit::GetParam('template', _POST, _STRING);
     $tags = Kit::GetParam('tags', _POST, _STRING);
     $description = Kit::GetParam('description', _POST, _STRING);
     $templateLayoutId = Kit::GetParam('layoutid', _POST, _INT);
     // Copy the layout and adjust the values of the new layout
     $layoutObject = new Layout();
     if (!($layoutId = $layoutObject->Copy($templateLayoutId, $template, $description, $user->userid, true))) {
         trigger_error($layoutObject->GetErrorMessage(), E_USER_ERROR);
     }
     // Tag it
     if ($tags != '') {
         // Create an array out of the tags
         $tagsArray = explode(',', $tags);
         $tagsArray[] = 'template';
     } else {
         $tagsArray = array('template');
     }
     // Add the tags XML to the layout
     $layoutObject->EditTags($layoutId, $tagsArray);
     $response->SetFormSubmitResponse('Template Added.');
     $response->Respond();
 }