public function dtg_ButtonRender($item) { $strControl = new QButton($this); $strControl->Text = 'Button'; $strControl->ActionParameter = $item; $strControl->AddAction(new QClickEvent(), new QServerAction('btn_click')); return $strControl->Render(false); }
public function dtgDatagrid_EditLinkColumn_Render(Datagrid $objDatagrid) { $strControlId = 'btnEdit' . $this->dtgDatagrid->CurrentRowIndex; $btnEdit = $this->objForm->GetControl($strControlId); if (!$btnEdit) { $btnEdit = new QButton($this->dtgDatagrid, $strControlId); $btnEdit->Text = QApplication::Translate('Edit'); $btnEdit->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnEdit_Click')); } $btnEdit->ActionParameter = $objDatagrid->DatagridId; return $btnEdit->Render(false); }
public function renderButton(Person $objPerson) { $objControlId = "editButton" . $objPerson->Id; if (!($objControl = $this->GetControl($objControlId))) { $objControl = new QButton($this, $objControlId); $objControl->Text = "Edit Person #" . $objPerson->Id; $objControl->AddAction(new QClickEvent(), new QAjaxAction("renderButton_Click")); $objControl->ActionParameter = $objPerson->Id; } // We pass the parameter of "false" to make sure the control doesn't render // itself RIGHT HERE - that it instead returns its string rendering result. return $objControl->Render(false); }
/** * A non-delegated event version. Create a new button for each control and attach an action to it. * * @param Person $objPerson * @return String */ public function RenderDeleteButton($objPerson) { $strControlId = 'btn' . $objPerson->Id; $objControl = $this->GetControl($strControlId); if (!$objControl) { $objControl = new QButton($this); $objControl->Text = 'Edit'; $objControl->ActionParameter = $objPerson->Id; $objControl->AddAction(new QClickEvent(), new QAjaxAction('dtgPersonsButton_Click')); // This will generate a javascript call for every button created. } return $objControl->Render(false); }
public function lnkSelected_Render(Praises $objPraise) { $strControlId = 'lnkSelected' . $objPraise->Id; // Let's see if the Checkbox exists already $lnkSelected = $this->GetControl($strControlId); if (!$lnkSelected) { $lnkSelected = new QButton($this->dtgPraises, $strControlId); $lnkSelected->Text = $objPraise->Subject; $lnkSelected->ActionParameter = $objPraise->Id; $lnkSelected->CssClass = 'linkButton'; $lnkSelected->AddAction(new QClickEvent(), new QServerAction('lnkSelected_Click')); } return $lnkSelected->Render(false); }
public function EditColumn_Render(Attribute $objAttribute) { // Let's specify a specific Control ID for our button, using the datagrid's CurrentRowIndex $strControlId = 'btnEditAttribute' . $this->dtgAttributes->CurrentRowIndex; $btnEdit = $this->objForm->GetControl($strControlId); if (!$btnEdit) { // Only create/instantiate a new Edit button for this Row if it doesn't yet exist $btnEdit = new QButton($this->dtgAttributes, $strControlId); $btnEdit->Text = 'Add'; $btnEdit->CssClass = 'primary'; // Define an Event Handler on the Button // Because the event handler, itself, is defined in the control, we use QAjaxControlAction instead of QAjaxAction $btnEdit->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnEditAttribute_Click')); } // Finally, update the Actionparameter for our button to store the $objAttribute's ID. $btnEdit->ActionParameter = $objAttribute->Id . "_" . $objAttribute->AttributeDataTypeId . "_" . $objAttribute->Name . "_" . $this->dtgAttributes->CurrentRowIndex; // Return the Rendered Button Control return $btnEdit->Render(false); }
public function render_btnToggleRecordsSummary(Project $objProject) { // Create their unique id... $objControlId = 'btnToggleRecordsSummary' . $objProject->Id; if (!($objControl = $this->GetControl($objControlId))) { $intTeamMemberCount = Person::CountByProjectAsTeamMember($objProject->Id); if ($intTeamMemberCount > 0) { // If not exists create our toggle button who his parent // is our master QDataGrid... $objControl = new QButton($this->dtgProjects, $objControlId); $objControl->Width = 25; $objControl->Text = '+' . $intTeamMemberCount; $objControl->CssClass = 'inputbutton'; // Pass the id of the bounded item just for other process // on click event $objControl->ActionParameter = $objProject->Id; // Add event on click the toogle button $objControl->AddAction(new QClickEvent(), new QAjaxAction('btnToggleRecordsSummary_Click')); } } // We pass the parameter of "false" to make sure the control doesn't render // itself RIGHT HERE - that it instead returns its string rendering result. return $objControl->Render(false); }
public function EditColumn_Render(Person $objPerson) { if ($objPerson->Id == $this->intEditPersonId || $this->intEditPersonId == -1 && !$objPerson->Id) { // We are rendering the row of the person we are editing OR we are rending the row // of the NEW (blank) person. Go ahead and render the Save and Cancel buttons. return $this->btnSave->Render(false) . ' ' . $this->btnCancel->Render(false); } else { // Get the Edit button for this row (we will create it if it doesn't yet exist) $strControlId = 'btnEdit' . $objPerson->Id; $btnEdit = $this->GetControl($strControlId); if (!$btnEdit) { // Create the Edit button for this row in the DataGrid // Use ActionParameter to specify the ID of the person $btnEdit = new QButton($this->dtgPersons, $strControlId); $btnEdit->Text = 'Edit This Person'; $btnEdit->ActionParameter = $objPerson->Id; $btnEdit->AddAction(new QClickEvent(), new QAjaxAction('btnEdit_Click')); $btnEdit->CausesValidation = false; } // If we are currently editing a person, then set this Edit button to be disabled if ($this->intEditPersonId) { $btnEdit->Enabled = false; } else { $btnEdit->Enabled = true; } // Return the rendered Edit button return $btnEdit->Render(false); } }
public function RenderSelect(Person $objPerson, $intRow) { $strControlId = 'chkSelected' . $objPerson->Id . $intRow; $btnSelect = $this->objForm->GetControl($strControlId); if (!$btnSelect) { $btnSelect = new QButton($this->dtgPeople, $strControlId); $btnSelect->Text = 'Select'; $btnSelect->CssClass = 'primary'; $btnSelect->ActionParameter = $objPerson->Id; $btnSelect->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'pxySelect_Click')); $btnSelect->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSelect_Click')); } return $btnSelect->Render(false); }
public function dtgUserRole_ActionsColumn_Render(NarroUserRole $objUserRole) { $strControlId = 'btnEditRole' . $objUserRole->UserRoleId; $btnEdit = $this->Form->GetControl($strControlId); if (!$btnEdit) { $btnEdit = new QButton($this->dtgUserRole, $strControlId); $btnEdit->Text = t('Edit'); if (QApplication::$UseAjax) { $btnEdit->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnEditRole_Click')); } else { $btnEdit->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnEditRole_Click')); } } $btnEdit->ActionParameter = $objUserRole->UserRoleId; $btnEdit->Display = QApplication::HasPermission('Can manage user roles', $objUserRole->ProjectId, $objUserRole->LanguageId); $strControlId = 'btnDeleteRole' . $objUserRole->UserRoleId; $btnDelete = $this->Form->GetControl($strControlId); if (!$btnDelete) { $btnDelete = new QButton($this->dtgUserRole, $strControlId); $btnDelete->Text = t('Delete'); $btnDelete->AddAction(new QClickEvent(), new QConfirmAction(t('Are you sure you want to revoke this role for this user?'))); if (QApplication::$UseAjax) { $btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDeleteRole_Click')); } else { $btnDelete->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnDeleteRole_Click')); } } $btnDelete->ActionParameter = $objUserRole->UserRoleId; $btnDelete->Display = QApplication::HasPermission('Can manage user roles', $objUserRole->ProjectId, $objUserRole->LanguageId); return $btnEdit->Render(false) . ' ' . $btnDelete->Render(false); }
public function dtgNotificationUserAccount_EditLinkColumn_Render(NotificationUserAccount $objNotificationUserAccount) { $strControlId = 'btnEdit' . $this->dtgNotificationUserAccount->CurrentRowIndex; $btnEdit = $this->objForm->GetControl($strControlId); if (!$btnEdit) { $btnEdit = new QButton($this->dtgNotificationUserAccount, $strControlId); $btnEdit->Text = QApplication::Translate('Edit'); $btnEdit->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnEdit_Click')); } $btnEdit->ActionParameter = $objNotificationUserAccount->NotificationUserAccountId; return $btnEdit->Render(false); }
public function RemoveColumn_Render(InventoryLocation $objInventoryLocation) { // If the transaction is a Move or a Take Out, use the InventoryLocationId as the Action Parameter if ($this->ctlInventoryTransact->intTransactionTypeId == 1 || $this->ctlInventoryTransact->intTransactionTypeId == 5) { $strControlId = 'btnRemove' . $objInventoryLocation->InventoryLocationId; } elseif ($this->ctlInventoryTransact->intTransactionTypeId == 4) { $strControlId = 'btnRemove' . $objInventoryLocation->InventoryModelId; } $btnRemove = $this->GetControl($strControlId); if (!$btnRemove) { // Create the Remove button for this row in the DataGrid // Use ActionParameter to specify the ID of the InventoryLocation or InventoryModelId, depending on the transaction type $btnRemove = new QButton($this->ctlInventoryTransact->dtgInventoryTransact, $strControlId); $btnRemove->Text = 'Remove'; // If the transaction is a Move or a Take Out, use the InventoryLocationId as the Action Parameter if ($this->ctlInventoryTransact->intTransactionTypeId == 1 || $this->ctlInventoryTransact->intTransactionTypeId == 5) { $btnRemove->ActionParameter = $objInventoryLocation->InventoryLocationId; } elseif ($this->ctlInventoryTransact->intTransactionTypeId == 4) { $btnRemove->ActionParameter = $objInventoryLocation->InventoryModelId; } $btnRemove->AddAction(new QClickEvent(), new QAjaxAction('btnRemove_Click')); $btnRemove->AddAction(new QEnterKeyEvent(), new QAjaxAction('btnRemove_Click')); $btnRemove->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $btnRemove->CausesValidation = false; } return $btnRemove->Render(false); }
public function render_btnRecordDelete($parControl, Address $objRecord) { ++$this->tempdelete; if ($objRecord->Id == $this->intEditAddressId || $this->intEditAddressId == -1 && !$objRecord->Id) { return null; } else { $strControlId = 'btnRecordDelete' . $objRecord->Id . 'dlt' . $this->tempdelete; if (!($objControl = $this->Form->GetControl($strControlId))) { $objControl = new QButton($parControl, $strControlId); $objControl->Text = 'Delete'; $objControl->CssClass = 'inputbutton'; $objControl->ActionParameter = $objRecord->Id; $objControl->AddAction(new QClickEvent(), new QConfirmAction('Are you sure ?')); $objControl->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnRecordDelete_Click', $this->dtgAddresses->WaitIcon)); return $objControl->Render(false); } } }
public function dtgRole_Actions_Render(NarroRole $objNarroRole) { $strControlId = 'btnEditRole' . $objNarroRole->RoleId; $btnEdit = $this->Form->GetControl($strControlId); if (!$btnEdit) { $btnEdit = new QButton($this->dtgRole, $strControlId); $btnEdit->Text = t('Edit'); if (QApplication::$UseAjax) { $btnEdit->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnEditRole_Click')); } else { $btnEdit->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnEditRole_Click')); } } $btnEdit->ActionParameter = $objNarroRole->RoleId; $btnEdit->Display = QApplication::HasPermission('Can manage user roles'); $strControlId = 'btnDeleteRole' . $objNarroRole->RoleId; $btnDelete = $this->Form->GetControl($strControlId); if (!$btnDelete) { $btnDelete = new QButton($this->dtgRole, $strControlId); $btnDelete->Text = t('Delete'); $btnDelete->AddAction(new QClickEvent(), new QConfirmAction(t('Are you sure you want to delete this role?'))); if (QApplication::$UseAjax) { $btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDeleteRole_Click')); } else { $btnDelete->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnDeleteRole_Click')); } } $btnDelete->ActionParameter = $objNarroRole->RoleId; $btnDelete->Display = QApplication::HasPermission('Can manage user roles'); $strControlId = 'btnPermissions' . $objNarroRole->RoleId; $btnPermissions = $this->Form->GetControl($strControlId); if (!$btnPermissions) { $btnPermissions = new QButton($this->dtgRole, $strControlId); $btnPermissions->Text = t('Permissions'); $btnPermissions->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnPermissions_Click')); } $btnPermissions->ActionParameter = $objNarroRole->RoleId; $strControlId = 'btnViewUsers' . $objNarroRole->RoleId; $btnViewUsers = $this->Form->GetControl($strControlId); if (!$btnViewUsers) { $btnViewUsers = new QButton($this->dtgRole, $strControlId); $btnViewUsers->Text = t('View users'); $btnViewUsers->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnViewUsers_Click')); } $btnViewUsers->ActionParameter = $objNarroRole->RoleId; $strOutput = ''; if ($objNarroRole->RoleId > 5) { $strOutput .= $btnEdit->Render(false) . ' ' . $btnDelete->Render(false) . ' '; } $strOutput .= $btnPermissions->Render(false) . ' ' . $btnViewUsers->Render(false); return $strOutput; }
public function RenderDelete(GroupRegistrations $objGroupRegistration) { $strControlId = 'delete' . $objGroupRegistration->Id; $btnDelete = $this->GetControl($strControlId); if (!$btnDelete) { $btnDelete = new QButton($this->dtgGroupRegistrations, $strControlId); $btnDelete->Text = 'Delete'; $btnDelete->ActionParameter = $objGroupRegistration->Id; $btnDelete->AddAction(new QClickEvent(), new QAjaxAction('btnDelete_Clicked')); } return $btnDelete->Render(false); }
public function RemoveColumn_Render(Asset $objAsset) { $strControlId = 'btnRemove' . $objAsset->AssetId; $btnRemove = $this->GetControl($strControlId); if (!$btnRemove) { // Create the Remove button for this row in the DataGrid // Use ActionParameter to specify the ID of the asset $btnRemove = new QButton($this->ctlAssetTransact->dtgAssetTransact, $strControlId); $btnRemove->Text = 'Remove'; $btnRemove->ActionParameter = $objAsset->AssetId; $btnRemove->AddAction(new QClickEvent(), new QAjaxAction('btnRemove_Click')); $btnRemove->AddAction(new QEnterKeyEvent(), new QAjaxAction('btnRemove_Click')); $btnRemove->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $btnRemove->CausesValidation = false; if ($objAsset->LinkedFlag) { $btnRemove->Enabled = false; } } return $btnRemove->Render(false); }
public function colTranslationCount_Render(NarroLanguage $objLanguage) { $btnTmx = $this->dtgLanguage->GetChildControl('tmx' . $objLanguage->LanguageId); if (!$btnTmx instanceof QButton) { $btnTmx = new QButton($this->dtgLanguage, 'tmx' . $objLanguage->LanguageId); $btnTmx->ActionParameter = $objLanguage->LanguageId; $btnTmx->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnTmx_Click')); $btnTmx->Text = 'TMX'; $btnTmx->ToolTip = t('Download all translations in a TMX file'); } return $objLanguage->GetVirtualAttribute("translations_count") . ' ' . $btnTmx->Render(false); }
public function RemoveInventoryColumn_Render(InventoryTransaction $objInventoryTransaction) { // Only display the remove button if it has not been received if ($objInventoryTransaction->blnReturnReceivedStatus()) { return ''; } else { //$strControlId = 'btnRemoveInventory' . $objInventoryTransaction->InventoryLocation->InventoryLocationId; $strControlId = 'btnRemoveInventory' . $objInventoryTransaction->InventoryLocationId; $btnRemove = $this->GetControl($strControlId); if (!$btnRemove) { // Create the Remove button for this row in the DataGrid // Use ActionParameter to specify the ID of the InventoryLocationId $btnRemove = new QButton($this->dtgInventoryTransact, $strControlId); $btnRemove->Text = 'Remove'; $btnRemove->ActionParameter = $objInventoryTransaction->InventoryLocationId; $btnRemove->AddAction(new QClickEvent(), new QAjaxAction('btnRemoveInventory_Click')); $btnRemove->AddAction(new QEnterKeyEvent(), new QAjaxAction('btnRemoveInventory_Click')); $btnRemove->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $btnRemove->CausesValidation = false; } return $btnRemove->Render(false); } }
public function dtgRoleEntityQtypeCustomFieldAuthorization_EditLinkColumn_Render(RoleEntityQtypeCustomFieldAuthorization $objRoleEntityQtypeCustomFieldAuthorization) { $strControlId = 'btnEdit' . $this->dtgRoleEntityQtypeCustomFieldAuthorization->CurrentRowIndex; $btnEdit = $this->objForm->GetControl($strControlId); if (!$btnEdit) { $btnEdit = new QButton($this->dtgRoleEntityQtypeCustomFieldAuthorization, $strControlId); $btnEdit->Text = QApplication::Translate('Edit'); $btnEdit->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnEdit_Click')); } $btnEdit->ActionParameter = $objRoleEntityQtypeCustomFieldAuthorization->RoleEntityQtypeCustomFieldAuthorizationId; return $btnEdit->Render(false); }