public function __construct($objParentObject, $strControlId = null, $intEntityQtypeId = null, $intEntityId = null) { parent::__construct($objParentObject, $strControlId); $this->intAttachmentCount = Attachment::CountByEntityQtypeIdEntityId($intEntityQtypeId, $intEntityId); if ($this->intAttachmentCount > 0) { $this->strTemplate = __DOCROOT__ . __SUBDIRECTORY__ . '/common/QAttachments.tpl.php'; $this->lblAttachments_Create(); $this->pnlAttachments = new QPanel($this); $this->pnlAttachments->strTemplate = __DOCROOT__ . __SUBDIRECTORY__ . '/common/attachments.tpl.php'; $this->pnlAttachments->Display = false; $this->objAttachmentArray = Attachment::LoadArrayByEntityQtypeIdEntityId($intEntityQtypeId, $intEntityId); $this->arrAttachments = array(); foreach ($this->objAttachmentArray as $key => $objAttachment) { $strAttachment = sprintf('<strong><a href="' . __PHP_ASSETS__ . '/download.php?tmp_filename=%s&attachment_id=%s" target="_blank" style="color:blue;">%s</a></strong> (%s bytes) %s by %s ', $objAttachment->TmpFilename, $objAttachment->AttachmentId, $objAttachment->Filename, $objAttachment->Size, $objAttachment->CreationDate, $objAttachment->CreatedByObject->__toStringFullName()); $lblDelete = new QLabel($this->pnlAttachments); $lblDelete->Text = 'Delete<br/>'; $lblDelete->ForeColor = '#555555'; $lblDelete->FontUnderline = true; $lblDelete->SetCustomStyle('cursor', 'pointer'); $lblDelete->HtmlEntities = false; $lblDelete->ActionParameter = $objAttachment->AttachmentId; $lblDelete->AddAction(new QClickEvent(), new QConfirmAction('Are you sure you want to delete this attachment?')); $lblDelete->AddAction(new QClickEvent(), new QServerControlAction($this, 'lblDelete_Click')); QApplication::AuthorizeControl($objAttachment, $lblDelete, 3); $this->arrAttachments[$key]['strAttachment'] = $strAttachment; $this->arrAttachments[$key]['lblDelete'] = $lblDelete; } } else { $this->Display = false; } }
public function GetControlHtml() { // Create the Column Labels. They cannot be created when creating the datagrid because columns can be added after instantiation. $this->arrColumnLabels = array(); if ($this->objParentControl->ColumnArray) { foreach ($this->objParentControl->ColumnArray as $objColumn) { $lblColumn = new QLabel($this->pnlColumnToggleMenu); // If it is an image, and only an image, and it has an alt attribute, then use that value for the menu if (substr($objColumn->Name, 0, 4) == '<img') { if ($intMatch = stripos($objColumn->Name, "alt=")) { $intStart = $intMatch + 4; $lblColumn->Text = substr($objColumn->Name, $intStart, strlen($objColumn->Name) - 1 - $intStart); } else { $lblColumn->Text = strip_tags($objColumn->Name); } } else { $lblColumn->Text = $objColumn->Name; } $lblColumn->ActionParameter = $objColumn->Name; $lblColumn->AddAction(new QClickEvent(), new QToggleDisplayAction($this->pnlColumnToggleMenu)); $lblColumn->AddAction(new QClickEvent(), new QServerControlAction($this, 'lblColumn_Click')); $lblColumn->AddAction(new QMouseOverEvent(), new QJavascriptAction('this.style.backgroundColor=\'#EEEEEE\';')); $lblColumn->AddAction(new QMouseOutEvent(), new QJavaScriptAction('this.style.backgroundColor=\'#FFFFFF\';')); if ($objColumn->Display) { $lblColumn->FontBold = true; } // Style $lblColumn->TagName = 'div'; $lblColumn->SetCustomStyle('margin', '4px 4px 4px 8px'); $lblColumn->SetCustomStyle('cursor', 'pointer'); array_push($this->arrColumnLabels, $lblColumn); } } if ($this->objParentControl->ShowExportCsv) { $this->lblExportCsv = new QLabel($this); $this->lblExportCsv->Text = 'Export CSV'; $this->lblExportCsv->AddAction(new QClickEvent(), new QServerControlAction($this, 'lblExportCsv_Click')); $this->lblExportCsv->AddAction(new QClickEvent(), new QTerminateAction()); $this->lblExportCsv->AddAction(new QMouseOverEvent(), new QJavascriptAction('this.style.backgroundColor=\'#EEEEEE\';')); $this->lblExportCsv->AddAction(new QMouseOutEvent(), new QJavaScriptAction('this.style.backgroundColor=\'#FFFFFF\';')); $this->lblExportCsv->TagName = 'div'; $this->lblExportCsv->SetCustomStyle('cursor', 'pointer'); } // Setting display to false again. This is to fix the problem when changing pagination or sorting while the menu is open. $this->pnlColumnToggleMenu->Display = false; // Render the Column Toggle Menu $strToReturn = $this->pnlColumnToggleMenu->Render(false); return $strToReturn; }
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 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); }
protected function lblFile_Create($pnlWrap) { $lblFile = new QLabel($pnlWrap, $pnlWrap->ControlId . 'lbl'); $lblFile->HtmlEntities = false; $lblFile->Cursor = QCursor::Pointer; $lblFile->ActionParameter = $pnlWrap->ControlId; $lblFile->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'lblFile_Click')); return $lblFile; }