public static function getGroupsForList() { $groups = array(); foreach (SJB_EmailTemplateEditor::getEmailTemplateGroups() as $groupID => $groupCaption) { array_push($groups, array('id' => $groupID, 'caption' => $groupCaption)); } return $groups; }
public function execute() { $errors = array(); $this->setEtGroups(SJB_EmailTemplateEditor::getEmailTemplateGroups()); if (isset($_REQUEST['passed_parameters_via_uri'])) { $passed_parameters_via_uri = SJB_UrlParamProvider::getParams(); $etGroup = SJB_Array::get($passed_parameters_via_uri, 0); $etSID = SJB_Array::get($passed_parameters_via_uri, 1); $action = SJB_Array::get($passed_parameters_via_uri, 2); if ($etGroup && SJB_Array::get($this->etGroups, $etGroup)) { $this->tp->assign('group', $etGroup); if ($etSID) { switch ($action) { case 'delete': $this->deleteEmailTemplate($etGroup, $etSID); break; case 'getvars': $this->prepareTemplateVarsInfo($etGroup); exit; break; default: if (isset($_FILES['file']) && $_FILES['file']['name'] && $_FILES['file']['error']) { $errors['Attachment'] = 'UPLOAD_ERR_INI_SIZE'; } else { $filename = SJB_Request::getVar('filename', false); if ($filename) { SJB_UploadFileManager::openEmailTemplateFile($filename, $etSID); $errors['NO_SUCH_FILE'] = true; } } $this->editEmailTemplate($etSID, $errors); break; } } else { $this->addNewTemplateForm($etGroup); $this->getEmailTemplatesByGroup($etGroup); } } } else { $this->addNewTemplateForm(); } if ($errors || $this->errors) { $errors = array_merge($errors, $this->errors); } $this->tp->assign('message', $this->successMessage); $this->tp->assign('error', $this->error); $this->tp->assign('errors', $errors); $this->tp->assign('etGroups', $this->etGroups); $this->tp->assign('uploadMaxFilesize', SJB_UploadFileManager::getIniUploadMaxFilesize()); $this->tp->display($this->template); }