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; }
protected function SaveAttribute() { if ($this->txtAttributePreviousChurch != null && $this->txtAttributeOccupation->Text != "") { $objAttributeValue = new AttributeValue(); $objAttribute = Attribute::QuerySingle(QQ::Equal(QQN::Attribute()->Name, "Previous Church")); $objAttributeValue->AttributeId = $objAttribute->Id; $objAttributeValue->PersonId = $this->mctPerson->Person->Id; $objAttributeValue->TextValue = $this->txtAttributePreviousChurch->Text; $objAttributeValue->DatetimeValue = QDateTime::Now(); $objAttributeValue->Save(); } if ($this->txtAttributeOccupation != null && $this->txtAttributeOccupation->Text != "") { $objAttributeValue = new AttributeValue(); $objAttribute = Attribute::QuerySingle(QQ::Equal(QQN::Attribute()->Name, "Occupation")); $objAttributeValue->AttributeId = $objAttribute->Id; $objAttributeValue->PersonId = $this->mctPerson->Person->Id; $objAttributeValue->TextValue = $this->txtAttributeOccupation->Text; $objAttributeValue->DatetimeValue = QDateTime::Now(); $objAttributeValue->Save(); } if ($this->lstAttributeMethodJoin != null && $this->lstAttributeMethodJoin->SelectedName != '- Select One -') { $objAttributeValue = new AttributeValue(); $objAttribute = Attribute::QuerySingle(QQ::Equal(QQN::Attribute()->Name, "Method of Joining ALCF")); $objAttributeValue->AttributeId = $objAttribute->Id; $objAttributeValue->PersonId = $this->mctPerson->Person->Id; $objAttributeValue->TextValue = $this->lstAttributeMethodJoin->SelectedName; $objAttributeValue->DatetimeValue = QDateTime::Now(); $objAttributeValue->SingleAttributeOptionId = $this->lstAttributeMethodJoin->SelectedValue; $objAttributeValue->SingleAttributeOption->Name = $this->lstAttributeMethodJoin->SelectedName; $objAttributeValue->Save(); } if ($this->lstAttributeEthnicity != null && $this->lstAttributeEthnicity->SelectedName != '- Select One -') { $objAttributeValue = new AttributeValue(); $objAttribute = Attribute::QuerySingle(QQ::Equal(QQN::Attribute()->Name, "Ethnicity")); $objAttributeValue->AttributeId = $objAttribute->Id; $objAttributeValue->PersonId = $this->mctPerson->Person->Id; $objAttributeValue->TextValue = $this->lstAttributeEthnicity->SelectedName; $objAttributeValue->DatetimeValue = QDateTime::Now(); $objAttributeValue->SingleAttributeOptionId = $this->lstAttributeEthnicity->SelectedValue; $objAttributeValue->SingleAttributeOption->Name = $this->lstAttributeEthnicity->SelectedName; $objAttributeValue->Save(); } if ($this->dtxAttributeDateAcceptedChrist != null && $this->dtxAttributeDateAcceptedChrist->DateTime != null) { $objAttributeValue = new AttributeValue(); $objAttribute = Attribute::QuerySingle(QQ::Equal(QQN::Attribute()->Name, "Date Accepted Christ")); $objAttributeValue->AttributeId = $objAttribute->Id; $objAttributeValue->PersonId = $this->mctPerson->Person->Id; $objAttributeValue->DatetimeValue = $this->dtxAttributeDateAcceptedChrist->DateTime; $objAttributeValue->DateValue = $this->dtxAttributeDateAcceptedChrist->DateTime; $objAttributeValue->Save(); } if ($this->chkAcceptedChristAtALCF->Checked) { $objAttributeValue = new AttributeValue(); $objAttribute = Attribute::QuerySingle(QQ::Equal(QQN::Attribute()->Name, "Accepted Christ At ALCF")); $objAttributeValue->AttributeId = $objAttribute->Id; $objAttributeValue->PersonId = $this->mctPerson->Person->Id; $objAttributeValue->BooleanValue = true; $objAttributeValue->Save(); } }
/** * Used internally by the Meta-based Add Column tools. * * Given a QQNode or a Text String, this will return a Attribute-based QQNode. * It will also verify that it is a proper Attribute-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 == 'attribute') { 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 "attribute".'); } } else { if (is_string($mixContent)) { switch ($mixContent) { case 'Id': return QQN::Attribute()->Id; case 'AttributeDataTypeId': return QQN::Attribute()->AttributeDataTypeId; case 'Name': return QQN::Attribute()->Name; default: throw new QCallerException('Simple Property not found in AttributeDataGrid 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'); } } } }
public function dtgAttributes_Bind() { $objExisting = array(); foreach ($this->objPerson->GetAttributeValueArray() as $objAttributeValue) { $objExisting[$objAttributeValue->AttributeId] = true; } $objAttributeArray = array(); foreach (Attribute::LoadAll(QQ::OrderBy(QQN::Attribute()->Name)) as $objAttribute) { if (!array_key_exists($objAttribute->Id, $objExisting)) { $objAttributeArray[] = $objAttribute; } } $this->iAttributeCount = count($objAttributeArray); $this->dtgAttributes->DataSource = $objAttributeArray; }
/** * Count Attributes * by AttributeDataTypeId Index(es) * @param integer $intAttributeDataTypeId * @return int */ public static function CountByAttributeDataTypeId($intAttributeDataTypeId, $objOptionalClauses = null) { // Call Attribute::QueryCount to perform the CountByAttributeDataTypeId query return Attribute::QueryCount(QQ::Equal(QQN::Attribute()->AttributeDataTypeId, $intAttributeDataTypeId), $objOptionalClauses); }