Beispiel #1
0
 /**
  * Funtioin to process the Edit view
  * @param Vtiger_Request $request
  */
 public function process(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $moduleName = $request->getModule();
     $record = $request->get('record');
     if (!empty($record)) {
         $recordModel = EmailTemplates_Record_Model::getInstanceById($record);
         $viewer->assign('RECORD_ID', $record);
         $viewer->assign('MODE', 'edit');
     } else {
         $recordModel = new EmailTemplates_Record_Model();
         $viewer->assign('MODE', '');
         $recordModel->set('templatename', '');
         $recordModel->set('description', '');
         $recordModel->set('subject', '');
         $recordModel->set('body', '');
     }
     $recordModel->setModule('EmailTemplates');
     if (!$this->record) {
         $this->record = $recordModel;
     }
     $allFiledsOptions = $this->record->getEmailTemplateFields();
     $viewer->assign('RECORD', $this->record);
     $viewer->assign('MODULE', $moduleName);
     $viewer->assign('CURRENTDATE', date('Y-n-j'));
     $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
     $viewer->assign('ALL_FIELDS', $allFiledsOptions);
     $viewer->view('EditView.tpl', $moduleName);
 }
Beispiel #2
0
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $record = $request->get('record');
     $recordModel = new EmailTemplates_Record_Model();
     $recordModel->setModule($moduleName);
     if (!empty($record)) {
         $recordModel->setId($record);
     }
     $recordModel->set('templatename', $request->get('templatename'));
     $recordModel->set('description', $request->get('description'));
     $recordModel->set('subject', $request->get('subject'));
     $recordModel->set('body', $request->get('templatecontent'));
     $recordModel->save();
     $loadUrl = $recordModel->getDetailViewUrl();
     header("Location: {$loadUrl}");
 }