Example #1
0
 /**
  * Adds a template
  * @return 
  */
 function AddTemplate()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error('Token does not match', 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);
     $layoutid = Kit::GetParam('layoutid', _POST, _INT);
     // Use the data class
     Kit::ClassLoader('template');
     $templateObject = new Template($db);
     // Delete the template
     if (!$templateObject->Add($template, $description, $tags, $layoutid, $user->userid)) {
         trigger_error($templateObject->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse('Template Added.');
     $response->Respond();
 }