protected function Form_Create() { // Load the MetaControl and Ensure Edit Permissions $this->mctList = CommunicationListMetaControl::Create($this, QApplication::PathInfo(0), QMetaControlCreateType::CreateOnRecordNotFound); if ($this->mctList->EditMode) { if (!$this->mctList->CommunicationList->Ministry->IsLoginCanAdminMinistry(QApplication::$Login)) { $this->RedirectToView(); } } $this->txtName = $this->mctList->txtName_Create(); $this->txtName->Required = true; $this->txtDescription = $this->mctList->txtDescription_Create(); $this->txtDescription->Required = false; $this->txtDescription->TextMode = QTextMode::MultiLine; $this->txtDescription->Height = '50px'; $this->txtToken = $this->mctList->txtToken_Create(); $this->txtToken->Name = 'Email Address'; $this->txtToken->HtmlAfter = '<span> @ groups.alcf.net</span>'; $this->lstType = $this->mctList->lstEmailBroadcastType_Create(); $this->lstType->Instructions = '<span class="help" onclick="displayHelp(\'helpEmailBroadcastType\')"><img src="/assets/images/icons/help.png" alt="help"></span>'; $this->chkSubscribable = $this->mctList->chkSubscribable_Create(); if (QApplication::$Login->RoleTypeId == RoleType::ChMSAdministrator) { $this->lstMinistry = $this->mctList->lstMinistry_Create(null, null, QQ::OrderBy(QQN::Ministry()->Name)); } else { $intMinistryIdArray = array(); foreach (QApplication::$Login->GetMinistryArray() as $objMinistry) { $intMinistryIdArray[] = $objMinistry->Id; } $this->lstMinistry = $this->mctList->lstMinistry_Create(null, QQ::In(QQN::Ministry()->Id, $intMinistryIdArray), QQ::OrderBy(QQN::Ministry()->Name)); } if ($this->mctList->EditMode) { $this->lstMinistry->Enabled = false; } $this->strPageTitle = 'Email List - ' . ($this->mctList->EditMode ? 'Edit' : 'Create New'); $this->btnSave = new QButton($this); $this->btnSave->Text = 'Save'; $this->btnSave->CssClass = 'primary'; $this->btnSave->AddAction(new QClickEvent(), new QAjaxAction('btnSave_Click')); $this->btnSave->CausesValidation = true; $this->btnCancel = new QLinkButton($this); $this->btnCancel->Text = 'Cancel'; $this->btnCancel->CssClass = 'cancel'; $this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('btnCancel_Click')); $this->btnCancel->AddAction(new QClickEvent(), new QTerminateAction()); if ($this->mctList->EditMode) { $this->btnDelete = new QLinkButton($this); $this->btnDelete->Text = 'Delete'; $this->btnDelete->CssClass = 'delete'; $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction('Are you SURE you want to permanently DELETE this Email List? This will also delete ALL the messages as well!')); $this->btnDelete->AddAction(new QClickEvent(), new QAjaxAction('btnDelete_Click')); $this->btnDelete->AddAction(new QClickEvent(), new QTerminateAction()); } }
/** * Static Helper Method to Create using QueryString arguments * * @param mixed $objParentObject QForm or QPanel which will be using this CommunicationListMetaControl * @param QMetaControlCreateType $intCreateType rules governing CommunicationList object creation - defaults to CreateOrEdit * @return CommunicationListMetaControl */ public static function CreateFromQueryString($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) { $intId = QApplication::QueryString('intId'); return CommunicationListMetaControl::Create($objParentObject, $intId, $intCreateType); }