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); }
public function btnSave_Click() { $objParticipants = $this->objHousehold->GetOrderedParticipantArray(); // Set the new Head foreach ($objParticipants as $objParticipant) { $radHead = $this->GetControl('radHead' . $objParticipant->Id); if ($radHead->Checked) { $this->objHousehold->SetAsHeadPerson($objParticipant->Person); } } // Update the Roles foreach ($objParticipants as $objParticipant) { $radHead = $this->GetControl('radHead' . $objParticipant->Id); $txtRole = $this->GetControl('txtRole' . $objParticipant->Id); if (!$radHead->Checked) { $objParticipant->RoleOverride = trim($txtRole->Text); } else { $objParticipant->RoleOverride = null; } $objParticipant->RefreshRole(); } QApplication::Redirect('/households/view.php/' . $this->objHousehold->Id); }