public function GetControlHtml() { $this->strText = ''; $strSpecialChars = QApplication::$User->GetPreferenceValueByName('Special characters'); if (trim($strSpecialChars) == '') { $strSpecialChars = QApplication::$TargetLanguage->SpecialCharacters; } foreach (explode(' ', $strSpecialChars) as $strChar) { $objLabel = new QLabel($this); $objLabel->Text = $strChar; $objLabel->FontSize = 20; $objLabel->Padding = 3; $objLabel->AddAction(new QMouseOverEvent(), new QJavaScriptAction("this.style.backgroundColor='red'; this.style.color='white'; this.style.cursor='crosshair'")); $objLabel->AddAction(new QMouseOutEvent(), new QJavaScriptAction("this.style.backgroundColor=''; this.style.color='black'; this.style.cursor='normal'")); $objLabel->AddAction(new QClickEvent(), new QJavaScriptAction(sprintf("qc.getControl('%s').value += '%s'; qc.getControl('%s').focus();", $this->strTextareaControlId, isset(self::$arrEntities[$strChar]) ? self::$arrEntities[$strChar] : $strChar, $this->strTextareaControlId))); $this->strText .= $objLabel->Render(false); } return $this->strText; }
public function RenderRole(HouseholdParticipation $objParticipation) { $strControlId = 'txtRole' . $objParticipation->Id; if (!($txtRole = $this->GetControl($strControlId))) { $txtRole = new QTextBox($this->dtgMembers, $strControlId); $txtRole->Text = $objParticipation->RoleOverride; } $strControlId = 'lblRole' . $objParticipation->Id; if (!($lblRole = $this->GetControl($strControlId))) { $lblRole = new QLabel($this->dtgMembers, $strControlId); $lblRole->Text = 'Head'; } if ($this->objHousehold->HeadPersonId == $objParticipation->PersonId) { $txtRole->Text = null; $txtRole->Visible = false; $lblRole->Visible = true; } else { $txtRole->Visible = true; $lblRole->Visible = false; } return $lblRole->Render(false) . $txtRole->Render(false); }
public function dtgTranslation_colActions_Render(NarroSuggestion $objSuggestion) { if ($this->objContextInfo->ValidSuggestionId != $objSuggestion->SuggestionId && (QApplication::HasPermissionForThisLang('Can delete any suggestion', $this->objContextInfo->Context->ProjectId) || $objSuggestion->UserId == QApplication::GetUserId() && QApplication::GetUserId() != NarroUser::ANONYMOUS_USER_ID)) { $strControlId = 'del' . $this->objContextInfo->ContextInfoId . 's' . $objSuggestion->SuggestionId; $btnDelete = $this->dtgTranslation->GetChildControl($strControlId); if (!$btnDelete) { $btnDelete = new QLabel($this->dtgTranslation, $strControlId); $btnDelete->ToolTip = t('Delete'); $btnDelete->CssClass = 'ui-icon ui-icon-circle-close'; $btnDelete->AddAction(new QClickEvent(), new QJavaScriptAction(sprintf('this.disabled=\'disabled\''))); $btnDelete->AddAction(new QClickEvent(), new QConfirmAction(t('Are you sure you want to delete this suggestion?'))); if (QApplication::$UseAjax) { $btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDelete_Click')); } else { $btnDelete->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnDelete_Click')); } } $btnDelete->ActionParameter = $objSuggestion->SuggestionId; } if (QApplication::HasPermissionForThisLang('Can vote', $this->objContextInfo->Context->ProjectId)) { $strControlId = 'votup' . $this->objContextInfo->ContextInfoId . 's' . $objSuggestion->SuggestionId; $btnVoteUp = $this->dtgTranslation->GetChildControl($strControlId); if (!$btnVoteUp) { $btnVoteUp = new QLabel($this->dtgTranslation, $strControlId); $btnVoteUp->Display = QApplication::HasPermissionForThisLang('Can vote', $this->objContextInfo->Context->ProjectId); $btnVoteUp->ToolTip = t('Vote up'); $btnVoteUp->CssClass = 'ui-icon ui-icon-circle-arrow-n'; $btnVoteUp->AddAction(new QClickEvent(), new QJavaScriptAction(sprintf('this.disabled=\'disabled\''))); if (QApplication::$UseAjax) { $btnVoteUp->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnVote_Click')); } else { $btnVoteUp->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnVote_Click')); } } $btnVoteUp->ActionParameter = $objSuggestion->SuggestionId; $strControlId = 'votdn' . $this->objContextInfo->ContextInfoId . 's' . $objSuggestion->SuggestionId; $btnVoteDown = $this->dtgTranslation->GetChildControl($strControlId); if (!$btnVoteDown) { $btnVoteDown = new QLabel($this->dtgTranslation, $strControlId); $btnVoteDown->Display = QApplication::HasPermissionForThisLang('Can vote', $this->objContextInfo->Context->ProjectId); $btnVoteDown->ToolTip = t('Vote down'); $btnVoteDown->CssClass = 'ui-icon ui-icon-circle-arrow-s'; $btnVoteDown->AddAction(new QClickEvent(), new QJavaScriptAction(sprintf('this.disabled=\'disabled\''))); if (QApplication::$UseAjax) { $btnVoteDown->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnVote_Click')); } else { $btnVoteDown->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnVote_Click')); } } $btnVoteDown->ActionParameter = $objSuggestion->SuggestionId; } if ($this->objContextInfo->ValidSuggestionId != $objSuggestion->SuggestionId && QApplication::HasPermissionForThisLang('Can approve', $this->objContextInfo->Context->ProjectId)) { $strControlId = 'apr' . $this->objContextInfo->ContextInfoId . 's' . $objSuggestion->SuggestionId; $btnApprove = $this->dtgTranslation->GetChildControl($strControlId); if (!$btnApprove) { $btnApprove = new QLabel($this->dtgTranslation, $strControlId); $btnApprove->CssClass = 'ui-icon ui-icon-check'; $btnApprove->ToolTip = t('Approve'); $btnApprove->AddAction(new QClickEvent(), new QJavaScriptAction(sprintf('this.disabled=\'disabled\''))); if (QApplication::$UseAjax) { $btnApprove->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnApprove_Click')); } else { $btnApprove->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnApprove_Click')); } } $btnApprove->ActionParameter = $objSuggestion->SuggestionId; } $strText = ''; if (isset($btnVoteUp)) { $strText .= ' ' . $btnVoteUp->Render(false); } if (isset($btnVoteDown)) { $strText .= ' ' . $btnVoteDown->Render(false); } if (isset($btnApprove)) { $strText .= ' ' . $btnApprove->Render(false); } if (isset($btnDelete)) { $strText .= ' ' . $btnDelete->Render(false); } return '<div style="float:right">' . $strText . '</div>'; }
public function DueDateColumn_Render(AssetTransaction $objAssetTransaction) { $strControlId = 'lblDueDate' . $objAssetTransaction->Asset->TempId; $lblDueDate = $this->GetControl($strControlId); if (!$lblDueDate) { // Create the due date label for this row in the datagrid // Use the ActionParameter to specify the Temp ID of the asset $lblDueDate = new QLabel($this->dtgAssetTransact, $strControlId); $lblDueDate->ActionParameter = $objAssetTransaction->Asset->TempId; $lblDueDate->CausesValidation = false; if ($objAssetTransaction->ScheduleReceiptDueDate && $objAssetTransaction->ScheduleReceiptFlag) { $lblDueDate->Text = $objAssetTransaction->ScheduleReceiptDueDate->__toString(); } elseif ($objAssetTransaction->ScheduleReceiptFlag) { $lblDueDate->Text = 'Set Due Date'; } else { $lblDueDate->Text = 'Set Due Date'; $lblDueDate->Visible = false; } $lblDueDate->SetCustomStyle('text-decoration', 'underline'); $lblDueDate->SetCustomStyle('cursor', 'pointer'); $lblDueDate->AddAction(new QClickEvent(), new QAjaxAction('lblDueDate_Click')); } return $lblDueDate->Render(false); }
public function dtgRole_RoleNameColumn_Render(NarroRole $objNarroRole) { $strControlId = 'lblRoleName' . $objNarroRole->RoleId; $lblRoleName = $this->Form->GetControl($strControlId); if (!$lblRoleName) { $lblRoleName = new QLabel($this->dtgRole, $strControlId); $lblRoleName->DisplayStyle = QDisplayStyle::Inline; $lblRoleName->Text = t($objNarroRole->RoleName); } $strControlId = 'txtEditRole' . $objNarroRole->RoleId; $txtEditRole = $this->Form->GetControl($strControlId); if (!$txtEditRole) { $txtEditRole = new QTextBox($this->dtgRole, $strControlId); $txtEditRole->DisplayStyle = QDisplayStyle::None; $txtEditRole->Text = $objNarroRole->RoleName; } return $lblRoleName->Render(false) . $txtEditRole->Render(false); }
public function render_btnToggleRecords($parControl, $strType) { $strControlId = 'btnToggleRecordsforaddressofperson' . $strType->Id . 'ofproject' . $this->objProject->Id; if (!($objControl = $parControl->GetChildControl($strControlId))) { // But in this case the parent control of the button // would be this child QDataGrid, don't forget that... $person_addresses = Address::QueryCount(QQ::Equal(QQN::Address()->PersonId, $strType->Id)); if ($person_addresses > 0) { $objControl = new QButton($parControl, $strControlId); $objControl->Width = 20; $objControl->Text = '+'; $objControl->CssClass = 'inputbutton'; $objControl->ActionParameter = "{$strType->Id}"; // Important! for a better coding we want to all // actions referer to the child QdataGris stay // in the child Qdatagrid, so the actions are now // QAjaxControlAction or QServerControlAction, were the // controlId parameter is $this, becaouse in $this class // is defined the event for this button... kind of easy, // and clean. $objControl->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnToggleRecords_Click', $this->objParentObject->WaitIcon)); } else { // No addresses to expand; we'll use an empty label control to signify that $objControl = new QLabel($parControl, $strControlId); $objControl->Text = ''; } } // 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); }