protected function Form_Create() { $this->strInitialToken = QApplication::PathInfo(0); if ($this->strInitialToken) { $this->objList = CommunicationList::LoadByToken($this->strInitialToken); } $this->chkBtnListArray = array(); foreach (CommunicationList::LoadArrayBySubscribable(true, QQ::OrderBy(QQN::CommunicationList()->Token)) as $objEmailList) { $objItemList = new QCheckBox($this); $objItemList->Name = $objEmailList->Token; $objItemList->Text = $objEmailList->Name . ' - ' . $objEmailList->Description . "\n"; if ($objEmailList->Token == $this->strInitialToken) { $objItemList->Checked = true; } $this->chkBtnListArray[] = $objItemList; } $this->txtEmail = new QTextBox($this); $this->txtEmail->Name = 'Email: '; $this->txtEmail->Visible = true; $this->txtFirstName = new QTextBox($this); $this->txtFirstName->Name = 'First Name: '; $this->txtFirstName->Visible = true; $this->txtLastName = new QTextBox($this); $this->txtLastName->Name = 'Last Name'; $this->txtLastName->Visible = true; $this->btnSubscribe = new QButton($this); $this->btnSubscribe->Name = 'Subscribe'; $this->btnSubscribe->Text = 'Subscribe'; $this->btnSubscribe->CssClass = 'primary'; $this->btnSubscribe->Visible = true; $this->btnSubscribe->AddAction(new QClickEvent(), new QAjaxAction('btnSubscribe_Click')); $this->lblMessage = new QLabel($this); $this->lblMessage->FontBold = true; $this->lblMessage->Visible = false; }
public function dtgCommLists_Bind() { if ($this->intMinistryId) { $this->dtgCommLists->MetaDataBinder(QQ::Equal(QQN::CommunicationList()->MinistryId, $this->intMinistryId)); $this->dtgCommLists->Visible = true; } else { $this->dtgCommLists->DataSource = null; $this->dtgCommLists->Visible = false; } $this->lblStartText->Visible = !$this->dtgCommLists->Visible; }
protected function SetupPanel() { $objExistingLists = array(); foreach ($this->objPerson->GetCommunicationListArray() as $objList) { $objExistingLists[$objList->Id] = true; } $this->lstCommunicationLists = new QListBox($this); $this->lstCommunicationLists->Name = 'Communication List'; $this->lstCommunicationLists->AddItem('- Select One -'); $this->lstCommunicationLists->Required = true; foreach (CommunicationList::LoadAll(QQ::OrderBy(QQN::CommunicationList()->Name)) as $objList) { if (!array_key_exists($objList->Id, $objExistingLists)) { $this->lstCommunicationLists->AddItem($objList->Name, $objList->Id); } } $this->btnSave->Text = 'Add'; }
protected function Form_Create() { $this->strInitialToken = QApplication::PathInfo(0); if ($this->strInitialToken) { $this->objList = CommunicationList::LoadByToken($this->strInitialToken); } $this->chkBtnListArray = array(); foreach (CommunicationList::LoadArrayBySubscribable(true, QQ::OrderBy(QQN::CommunicationList()->Token)) as $objEmailList) { $objItemList = new QCheckBox($this); $objItemList->Name = $objEmailList->Token; $objItemList->Text = $objEmailList->Name; if ($objEmailList->Token == $this->strInitialToken) { $objItemList->Checked = true; } $this->chkBtnListArray[] = $objItemList; } $this->txtEmail = new QTextBox($this); $this->txtEmail->Name = 'Email: '; $this->txtEmail->Visible = true; $this->lstTerminationReason = new QListBox($this); $this->lstTerminationReason->Name = 'Reason for unsubscribing: '; $this->objAttribute = Attribute::QuerySingle(QQ::Equal(QQN::Attribute()->Name, 'Unsubscribe From Church Newsletter')); foreach ($this->objAttribute->GetAttributeOptionArray(QQ::OrderBy(QQN::AttributeOption()->Name)) as $objOption) { $this->lstTerminationReason->AddItem($objOption->Name, $objOption->Id); } $this->lstTerminationReason->AddItem('- Other... -', -1); $this->lstTerminationReason->AddAction(new QChangeEvent(), new QAjaxAction('lstTerminationReason_Change')); $this->txtOther = new QTextBox($this); $this->txtOther->Name = 'Other'; $this->txtOther->Visible = false; $this->btnUnsubscribe = new QButton($this); $this->btnUnsubscribe->Name = 'Unsubscribe'; $this->btnUnsubscribe->Text = 'Unsubscribe'; $this->btnUnsubscribe->CssClass = 'primary'; $this->btnUnsubscribe->AddAction(new QClickEvent(), new QAjaxAction('btnUnsubscribe_Click')); $this->lblMessage = new QLabel($this); $this->lblMessage->FontBold = true; $this->lblMessage->ForeColor = 'red'; $this->lblMessage->Visible = false; }
/** * Checks to see if an association exists with a specific Person * @param Person $objPerson * @return bool */ public function IsPersonAssociated(Person $objPerson) { if (is_null($this->intId)) { throw new QUndefinedPrimaryKeyException('Unable to call IsPersonAssociated on this unsaved CommunicationList.'); } if (is_null($objPerson->Id)) { throw new QUndefinedPrimaryKeyException('Unable to call IsPersonAssociated on this CommunicationList with an unsaved Person.'); } $intRowCount = CommunicationList::QueryCount(QQ::AndCondition(QQ::Equal(QQN::CommunicationList()->Id, $this->intId), QQ::Equal(QQN::CommunicationList()->Person->PersonId, $objPerson->Id))); return $intRowCount > 0; }
public function dtgCommunicationLists_Bind() { $this->dtgCommunicationLists->DataSource = $this->objPerson->GetCommunicationListArray(QQ::OrderBy(QQN::CommunicationList()->Name)); }
/** * Used internally by the Meta-based Add Column tools. * * Given a QQNode or a Text String, this will return a CommunicationList-based QQNode. * It will also verify that it is a proper CommunicationList-based QQNode, and will throw an exception otherwise. * * @param mixed $mixContent * @return QQNode */ protected function ResolveContentItem($mixContent) { if ($mixContent instanceof QQNode) { if (!$mixContent->_ParentNode) { throw new QCallerException('Content QQNode cannot be a Top Level Node'); } if ($mixContent->_RootTableName == 'communication_list') { if ($mixContent instanceof QQReverseReferenceNode && !$mixContent->_PropertyName) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } $objCurrentNode = $mixContent; while ($objCurrentNode = $objCurrentNode->_ParentNode) { if (!$objCurrentNode instanceof QQNode) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } if ($objCurrentNode instanceof QQReverseReferenceNode && !$objCurrentNode->_PropertyName) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } } return $mixContent; } else { throw new QCallerException('Content QQNode has a root table of "' . $mixContent->_RootTableName . '". Must be a root of "communication_list".'); } } else { if (is_string($mixContent)) { switch ($mixContent) { case 'Id': return QQN::CommunicationList()->Id; case 'EmailBroadcastTypeId': return QQN::CommunicationList()->EmailBroadcastTypeId; case 'MinistryId': return QQN::CommunicationList()->MinistryId; case 'Ministry': return QQN::CommunicationList()->Ministry; case 'Name': return QQN::CommunicationList()->Name; case 'Token': return QQN::CommunicationList()->Token; case 'Description': return QQN::CommunicationList()->Description; case 'Subscribable': return QQN::CommunicationList()->Subscribable; default: throw new QCallerException('Simple Property not found in CommunicationListDataGrid content: ' . $mixContent); } } else { if ($mixContent instanceof QQAssociationNode) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } else { throw new QCallerException('Invalid Content type'); } } } }