protected function Form_Create() { $this->objHousehold = Household::Load(QApplication::PathInfo(1)); if ($this->objHousehold) { if (!HouseholdParticipation::LoadByPersonIdHouseholdId($this->objPerson->Id, $this->objHousehold->Id)) { QApplication::Redirect('/individuals/'); } } else { $objHouseholdParticipationArray = HouseholdParticipation::LoadArrayByPersonId($this->objPerson->Id); if ($objHouseholdParticipationArray) { $this->objHousehold = $objHouseholdParticipationArray[0]->Household; } } $this->strPageTitle .= $this->objPerson->Name; // Unset based on Permissions if (!QApplication::$Login->IsPermissionAllowed(PermissionType::AccessStewardship)) { unset($this->strSubNavItemArray['stewardship']); } if (!QApplication::$Login->IsPermissionAllowed(PermissionType::MergeIndividuals)) { unset($this->strSubNavItemArray['merge']); } // Alter Inactive/Active based on whether or not the person has a login if ($this->objPerson->PublicLogin) { $this->strSubNavItemArray['online'][2] = null; } $this->lblHeading = new QLabel($this); $this->lblSubheading = new QLabel($this); $this->lblSubheading->CssClass = 'subhead'; $this->lblSubheading->HtmlEntities = false; $this->lstHouseholdSwitcher = new QListBox($this); $this->lstHouseholdSwitcher->SetCustomStyle('float', 'right'); $this->lstHouseholdSwitcher->SetCustomStyle('margin-top', '8px;'); $this->lstHouseholdSwitcher->Visible = false; $this->lstHouseholdSwitcher->AddAction(new QChangeEvent(), new QAjaxAction('lstHouseholdSwitcher_Change')); $this->pnlHouseholdSelector = new HouseholdSelectorPanel($this); $this->pnlSubnavBar = new ViewIndividualSubNavPanel($this); $this->pnlMainContent = new QPanel($this); $this->pnlMainContent->AutoRenderChildren = true; $this->pnlMainContent->CssClass = 'subnavContent'; $this->SetUrlHashProcessor('Form_ProcessHash'); $this->lblHeading_Refresh(); $this->lstHouseholdSwitcher_Refresh(); }
/** * Deletes all associated HouseholdParticipations * @return void */ public function DeleteAllHouseholdParticipations() { if (is_null($this->intId)) { throw new QUndefinedPrimaryKeyException('Unable to call UnassociateHouseholdParticipation on this unsaved Person.'); } // Get the Database Object for this Class $objDatabase = Person::GetDatabase(); // Journaling if ($objDatabase->JournalingDatabase) { foreach (HouseholdParticipation::LoadArrayByPersonId($this->intId) as $objHouseholdParticipation) { $objHouseholdParticipation->Journal('DELETE'); } } // Perform the SQL Query $objDatabase->NonQuery(' DELETE FROM `household_participation` WHERE `person_id` = ' . $objDatabase->SqlVariable($this->intId) . ' '); }