Ejemplo n.º 1
0
Archivo: remove.php Proyecto: alcf/chms
 protected function Form_Create()
 {
     // Setup Household Object
     $this->objHousehold = Household::Load(QApplication::PathInfo(0));
     if (!$this->objHousehold) {
         QApplication::Redirect('/households/');
     }
     $this->strPageTitle .= $this->objHousehold->Name;
     // Setup DataGrids
     $this->dtgMembers = new HouseholdParticipationDataGrid($this);
     $this->dtgMembers->AddColumn(new QDataGridColumn('Remove', '<?= $_FORM->RenderRadio($_ITEM); ?>', 'Width=80px', 'HtmlEntities=false'));
     $this->dtgMembers->MetaAddColumn('Role', 'Width=80px');
     $this->dtgMembers->MetaAddColumn(QQN::HouseholdParticipation()->Person->FirstName, 'Name=Name', 'Html=<?= $_ITEM->Person->LinkHtml; ?>', 'HtmlEntities=false', 'Width=300px');
     $this->dtgMembers->MetaAddColumn(QQN::HouseholdParticipation()->Person->PrimaryEmail->Address, 'Name=Email', 'Width=250px');
     $this->dtgMembers->MetaAddColumn(QQN::HouseholdParticipation()->Person->PrimaryPhone->Number, 'Name=Phone', 'Width=200px');
     $this->dtgMembers->GetColumn(0)->OrderByClause = null;
     $this->dtgMembers->GetColumn(1)->OrderByClause = null;
     $this->dtgMembers->GetColumn(2)->OrderByClause = null;
     $this->dtgMembers->GetColumn(3)->OrderByClause = null;
     $this->dtgMembers->GetColumn(4)->OrderByClause = null;
     $this->dtgMembers->DataSource = $this->objHousehold->GetOrderedParticipantArray();
     $this->btnSave = new QButton($this);
     $this->btnSave->Text = 'Remove';
     $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());
     $this->dlgMessage = new MessageDialog($this);
 }
Ejemplo n.º 2
0
Archivo: split.php Proyecto: alcf/chms
 protected function Form_Create()
 {
     // Setup Household Object
     $this->objHousehold = Household::Load(QApplication::PathInfo(0));
     if (!$this->objHousehold) {
         QApplication::Redirect('/households/');
     }
     $this->strPageTitle .= $this->objHousehold->Name;
     $this->lblHeadline = new QLabel($this);
     $this->lblHeadline->TagName = 'h3';
     $this->lblHeadline->Text = 'Select Individual(s) to Split Off';
     // Setup DataGrids
     $this->dtgMembers = new HouseholdParticipationDataGrid($this);
     $this->dtgMembers->AddColumn(new QDataGridColumn('Select', '<?= $_FORM->RenderRadio($_ITEM); ?>', 'Width=80px', 'HtmlEntities=false'));
     $this->dtgMembers->MetaAddColumn('Role', 'Width=80px');
     $this->dtgMembers->MetaAddColumn(QQN::HouseholdParticipation()->Person->FirstName, 'Name=Name', 'Html=<?= $_ITEM->Person->LinkHtml; ?>', 'HtmlEntities=false', 'Width=300px');
     $this->dtgMembers->MetaAddColumn(QQN::HouseholdParticipation()->Person->PrimaryEmail->Address, 'Name=Email', 'Width=250px');
     $this->dtgMembers->MetaAddColumn(QQN::HouseholdParticipation()->Person->PrimaryPhoneText, 'Name=Phone', 'Width=200px');
     $this->dtgMembers->GetColumn(0)->OrderByClause = null;
     $this->dtgMembers->GetColumn(1)->OrderByClause = null;
     $this->dtgMembers->GetColumn(2)->OrderByClause = null;
     $this->dtgMembers->GetColumn(3)->OrderByClause = null;
     $this->dtgMembers->GetColumn(4)->OrderByClause = null;
     $this->dtgMembers->SetDataBinder('dtgMembers_Bind');
     $this->lstHead = new QListBox($this);
     $this->lstHead->Name = 'Head of New Household';
     $this->lstHead->Visible = false;
     $this->pnlAddress = new EditHouseholdHomeAddressPanel($this);
     $this->pnlAddress->Visible = false;
     $this->lstHead->Name = 'Head of New Household';
     $this->lstHead->Visible = false;
     $this->btnNext = new QButton($this);
     $this->btnNext->Text = 'Next';
     $this->btnNext->CssClass = 'primary';
     $this->btnNext->AddAction(new QClickEvent(), new QAjaxAction('btnNext_Click'));
     $this->btnNext->CausesValidation = true;
     $this->btnSave = new QButton($this);
     $this->btnSave->Text = 'Save Changes';
     $this->btnSave->CssClass = 'primary';
     $this->btnSave->AddAction(new QClickEvent(), new QAjaxAction('btnSave_Click'));
     $this->btnSave->CausesValidation = true;
     $this->btnSave->Visible = false;
     $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());
     $this->dlgMessage = new MessageDialog($this);
 }
Ejemplo n.º 3
0
Archivo: view.php Proyecto: alcf/chms
 protected function Form_Create()
 {
     // Setup Household Object
     $this->objHousehold = Household::Load(QApplication::PathInfo(0));
     if (!$this->objHousehold) {
         QApplication::Redirect('/households/');
     }
     $this->strPageTitle .= $this->objHousehold->Name;
     // Setup DataGrids
     $this->dtgMembers = new HouseholdParticipationDataGrid($this);
     $this->dtgMembers->MetaAddColumn('Role', 'Width=80px', 'Html=<?= $_ITEM->RoleToDisplay; ?>');
     $this->dtgMembers->MetaAddColumn(QQN::HouseholdParticipation()->Person->FirstName, 'Name=Name', 'Html=<?= $_ITEM->Person->LinkHtml; ?>', 'HtmlEntities=false', 'Width=300px');
     $this->dtgMembers->MetaAddColumn(QQN::HouseholdParticipation()->Person->PrimaryEmail->Address, 'Name=Email', 'Width=250px');
     $this->dtgMembers->MetaAddColumn(QQN::HouseholdParticipation()->Person->PrimaryPhone->Number, 'Name=Phone', 'Width=290px');
     $this->dtgMembers->GetColumn(0)->OrderByClause = null;
     $this->dtgMembers->GetColumn(1)->OrderByClause = null;
     $this->dtgMembers->GetColumn(2)->OrderByClause = null;
     $this->dtgMembers->GetColumn(3)->OrderByClause = null;
     $this->dtgMembers->SetDataBinder('dtgMembers_Bind');
     $this->dtgHomeAddresses = new QDataGrid($this);
     $this->dtgHomeAddresses->AddColumn(new QDataGridColumn('', '<?= $_FORM->RenderHomeAddressType($_ITEM); ?>', 'HtmlEntities=false', 'Width=60px'));
     $this->dtgHomeAddresses->AddColumn(new QDataGridColumn('Address', '<?= $_FORM->RenderHomeAddress($_ITEM); ?>', 'HtmlEntities=false', 'Width=235px'));
     $this->dtgHomeAddresses->AddColumn(new QDataGridColumn('City, State', '<?= $_ITEM->City . ", " . $_ITEM->State; ?>', 'Width=160px'));
     $this->dtgHomeAddresses->AddColumn(new QDataGridColumn('Zip', '<?= $_ITEM->ZipCode; ?>', 'Width=90px'));
     $this->dtgHomeAddresses->AddColumn(new QDataGridColumn('Phone', '<?= $_FORM->RenderHomePhone($_ITEM); ?>', 'Width=105px'));
     $this->dtgHomeAddresses->AddColumn(new QDataGridColumn('', '<?= $_ITEM->InvalidFlag ? "<img src=\\"/assets/images/marker_invalid.png\\" title=\\"Invalid Address\\"/>" : null; ?>', 'Width=54px', 'HtmlEntities=false'));
     $this->dtgHomeAddresses->SetDataBinder('dtgHomeAddresses_Bind', $this);
     $this->pxySetCurrentHomeAddress = new QControlProxy($this);
     $this->pxySetCurrentHomeAddress->AddAction(new QClickEvent(), new QAjaxAction('pxySetCurrentHomeAddress_Click'));
     $this->pxySetCurrentHomeAddress->AddAction(new QClickEvent(), new QTerminateAction());
     // Display Stewardship Preferences?
     if (QApplication::IsLoginHasPermission(PermissionType::AccessStewardship)) {
         $this->lblStewardship = new QLabel($this);
         $this->lblStewardship->HtmlEntities = false;
         $this->lblStewardship_Refresh();
         $this->pxyStewardship = new QControlProxy($this);
         $this->pxyStewardship->AddAction(new QClickEvent(), new QAjaxAction('pxyStewardship_Click'));
         $this->pxyStewardship->AddAction(new QClickEvent(), new QTerminateAction());
     }
 }
Ejemplo n.º 4
0
 /**
  * Sets the address record as the "Current" address, and all others as "Previous"
  * Address MUST be associated with the household or this will throw an exception
  * @param Address $objCurrentAddress
  * @return void
  */
 public function SetAsCurrentAddress(Address $objCurrentAddress)
 {
     if ($objCurrentAddress->HouseholdId != $this->intId) {
         throw new QCallerException('Address does not belong to this Household');
     }
     // Get any home address and home phone records for this household (and any from-split households)
     $intAddressIdArray = array();
     $intPhoneIdArray = array();
     foreach ($this->GetAddressArray() as $objAddress) {
         if ($objAddress->Id != $objCurrentAddress->Id && $objAddress->CurrentFlag) {
             $objAddress->CurrentFlag = false;
             $objAddress->Save();
         }
         $intAddressIdArray[$objAddress->Id] = true;
         foreach ($objAddress->GetPhoneArray() as $objPhone) {
             $intPhoneIdArray[$objPhone->Id] = true;
         }
     }
     // Add any old HomeAddresses from previous households
     foreach ($this->GetHouseholdSplitAsSplitArray() as $objHouseholdSplit) {
         foreach ($objHouseholdSplit->Household->GetAddressArray() as $objAddress) {
             $intAddressIdArray[$objAddress->Id] = true;
             foreach ($objAddress->GetPhoneArray() as $objPhone) {
                 $intPhoneIdArray[$objPhone->Id] = true;
             }
         }
     }
     if (!$objCurrentAddress->CurrentFlag) {
         $objCurrentAddress->CurrentFlag = true;
         $objCurrentAddress->Save();
     }
     // Update "MailingAddress" and "StewardshipAddress" info for HouseholdParticipants
     // Update "PrimaryAddressText" info for HouseholdParticipants
     foreach ($this->GetHouseholdParticipationArray(QQ::Expand(QQN::HouseholdParticipation()->Person->Id)) as $objHouseholdParticipation) {
         $objPerson = $objHouseholdParticipation->Person;
         if (array_key_exists($objPerson->MailingAddressId, $intAddressIdArray)) {
             $objPerson->MailingAddress = $objCurrentAddress;
         }
         if (array_key_exists($objPerson->StewardshipAddressId, $intAddressIdArray)) {
             $objPerson->StewardshipAddress = $objCurrentAddress;
         }
         if (array_key_exists($objPerson->PrimaryPhoneId, $intPhoneIdArray)) {
             $objPerson->PrimaryPhone = $objCurrentAddress->PrimaryPhone;
         }
         $objPerson->RefreshPrimaryContactInfo();
     }
 }
Ejemplo n.º 5
0
 /**
  * Count HouseholdParticipations
  * by HouseholdId Index(es)
  * @param integer $intHouseholdId
  * @return int
  */
 public static function CountByHouseholdId($intHouseholdId, $objOptionalClauses = null)
 {
     // Call HouseholdParticipation::QueryCount to perform the CountByHouseholdId query
     return HouseholdParticipation::QueryCount(QQ::Equal(QQN::HouseholdParticipation()->HouseholdId, $intHouseholdId), $objOptionalClauses);
 }
 /**
  * Used internally by the Meta-based Add Column tools.
  *
  * Given a QQNode or a Text String, this will return a HouseholdParticipation-based QQNode.
  * It will also verify that it is a proper HouseholdParticipation-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 == 'household_participation') {
             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 "household_participation".');
         }
     } else {
         if (is_string($mixContent)) {
             switch ($mixContent) {
                 case 'Id':
                     return QQN::HouseholdParticipation()->Id;
                 case 'PersonId':
                     return QQN::HouseholdParticipation()->PersonId;
                 case 'Person':
                     return QQN::HouseholdParticipation()->Person;
                 case 'HouseholdId':
                     return QQN::HouseholdParticipation()->HouseholdId;
                 case 'Household':
                     return QQN::HouseholdParticipation()->Household;
                 case 'Role':
                     return QQN::HouseholdParticipation()->Role;
                 case 'RoleOverride':
                     return QQN::HouseholdParticipation()->RoleOverride;
                 default:
                     throw new QCallerException('Simple Property not found in HouseholdParticipationDataGrid 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');
             }
         }
     }
 }