public function dtgPermission_PermissionColumn_Render(NarroPermission $objPermission) { if (QApplication::HasPermission('Can manage roles')) { $strControlId = 'chkPermission' . $objPermission->PermissionId; $chkPermission = new QCheckBox($this->dtgPermission); $chkPermission->Text = t($objPermission->PermissionName); $chkPermission->ActionParameter = $objPermission->PermissionId; $chkPermission->Checked = NarroRolePermission::QueryCount(QQ::AndCondition(QQ::Equal(QQN::NarroRolePermission()->RoleId, $this->objRole->RoleId), QQ::Equal(QQN::NarroRolePermission()->PermissionId, $objPermission->PermissionId))); if (QApplication::$UseAjax) { $chkPermission->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'chkPermission_Click')); } else { $chkPermission->AddAction(new QClickEvent(), new QServerControlAction($this, 'chkPermission_Click')); } return $chkPermission->Render(false); } else { return t($objPermission->PermissionName); } }
public function chkSelected_Render(Person $objPerson) { // In order to keep track whether or not a Person's Checkbox has been rendered, // we will use explicitly defined control ids. $strControlId = 'chkSelected' . $objPerson->Id; // Let's see if the Checkbox exists already $chkSelected = $this->GetControl($strControlId); if (!$chkSelected) { // Define the Checkbox -- it's parent is the Datagrid (b/c the datagrid is the one calling // this method which is responsible for rendering the checkbox. Also, we must // explicitly specify the control ID $chkSelected = new QCheckBox($this->dtgPersons, $strControlId); $chkSelected->Text = 'Select'; // We'll use Control Parameters to help us identify the Person ID being copied $chkSelected->ActionParameter = $objPerson->Id; // Let's assign a server action on click $chkSelected->AddAction(new QClickEvent(), new QServerAction('chkSelected_Click')); } // Render the checkbox. We want to *return* the contents of the rendered Checkbox, // not display it. (The datagrid is responsible for the rendering of this column). // Therefore, we must specify "false" for the optional blnDisplayOutput parameter. return $chkSelected->Render(false); }
public function chkSelected_Render($intId) { $strControlId = 'chkSelected' . $intId . 'x' . $this->ControlId; // Let's see if the Checkbox exists already $chkSelected = $this->objForm->GetControl($strControlId); if (!$chkSelected) { $chkSelected = new QCheckBox($this, $strControlId); // We'll use Control Parameters to help us identify the Person ID being copied $chkSelected->ActionParameter = $intId; if ($this->chkSelectAll->Checked) { $chkSelected->Checked = true; } } return $chkSelected->Render(false); }
public function RenderSelectGroup(GrowthGroup $objGrowthGroup) { $strControlId = 'SelectGrpBtn' . $objGrowthGroup->GroupId; $rbtnSelected = $this->objForm->GetControl($strControlId); if (!$rbtnSelected) { $rbtnSelected = new QCheckBox($this->dtgGroups, $strControlId); $rbtnSelected->Text = ''; $rbtnSelected->ActionParameter = $objGrowthGroup->GroupId; $rbtnSelected->Checked = false; $this->rbtnSelectArray[] = $rbtnSelected; } return $rbtnSelected->Render(false); }
public function dtgLanguage_ActiveColumn_Render(NarroLanguage $objLanguage) { if ($objLanguage->LanguageId == QApplication::$SourceLanguage->LanguageId || $objLanguage->LanguageId == QApplication::GetLanguageId()) { return ''; } $objCheckBox = $this->Form->GetControl('activelang' . $objLanguage->LanguageId); if (!$objCheckBox instanceof QCheckBox) { $objCheckBox = new QCheckBox($this->dtgLanguage, 'activelang' . $objLanguage->LanguageId); $objCheckBox->ActionParameter = $objLanguage->LanguageId; if (QApplication::$UseAjax) { $objCheckBox->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'chkActive_Click')); } else { $objCheckBox->AddAction(new QClickEvent(), new QServerControlAction($this, 'chkActive_Click')); } } $objCheckBox->Checked = $objLanguage->Active; return $objCheckBox->Render(false); }
public function RenderRadio(HouseholdParticipation $objParticipation) { if ($objParticipation->Household->HeadPersonId == $objParticipation->PersonId) { // Do Nothing return ' '; } else { $chkSelect = new QCheckBox($this->dtgMembers); $chkSelect->ActionParameter = $objParticipation->Id; $this->chkSelectArray[] = $chkSelect; return $chkSelect->Render(false); } }