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() { $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 createSel($selName, $cursor) { $sel = new QLabel($this->container); $sel->setCursor($cursor); $sel->objectName = "___pq_creator_sizectrl_{$selName}_"; $sel->resize($this->size, $this->size); $sel->styleSheet = $this->styleSheet; if (strpos($this->selobj->disabledSels, $selName) === false) { $sel->enableResize = true; } $sel->setPHPEventListener($this, eventListener); $sel->addPHPEventListenerType(QEvent::MouseButtonPress); $sel->addPHPEventListenerType(QEvent::MouseButtonRelease); $sel->addPHPEventListenerType(QEvent::MouseMove); $sel->show(); return $sel; }
public function __construct(QFileInfo $fileInfo, QWidget $parent = NULL) { parent::__construct($parent); $permissionsGroup = new QGroupBox(tr("Permissions")); $readable = new QCheckBox(tr("Readable")); if ($fileInfo->isReadable()) { $readable->setChecked(true); } $writable = new QCheckBox(tr("Writable")); if ($fileInfo->isWritable()) { $writable->setChecked(true); } $executable = new QCheckBox(tr("Executable")); if ($fileInfo->isExecutable()) { $executable->setChecked(true); } $ownerGroup = new QGroupBox(tr("Ownership")); $ownerLabel = new QLabel(tr("Owner")); $ownerValueLabel = new QLabel($fileInfo->owner()); $ownerValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); $groupLabel = new QLabel(tr("Group")); $groupValueLabel = new QLabel($fileInfo->group()); $groupValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken); $permissionsLayout = new QVBoxLayout(); $permissionsLayout->addWidget($readable); $permissionsLayout->addWidget($writable); $permissionsLayout->addWidget($executable); $permissionsGroup->setLayout($permissionsLayout); $ownerLayout = new QVBoxLayout(); $ownerLayout->addWidget($ownerLabel); $ownerLayout->addWidget($ownerValueLabel); $ownerLayout->addWidget($groupLabel); $ownerLayout->addWidget($groupValueLabel); $ownerGroup->setLayout($ownerLayout); $mainLayout = new QVBoxLayout(); $mainLayout->addWidget($permissionsGroup); $mainLayout->addWidget($ownerGroup); $mainLayout->addStretch(1); $this->setLayout($mainLayout); }
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 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 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 __set($strName, $mixValue) { $this->blnModified = true; switch ($strName) { // APPEARANCE case "HoverTip": try { $this->objHoverTip = $mixValue; break; } catch (QInvalidCastException $objExc) { $objExc->IncrementOffset(); throw $objExc; } default: try { parent::__set($strName, $mixValue); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } break; } }
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>'; }
private function create_button($text, $icon, $slot = '', $enabled = true, $align = 'left') { $widget = new QWidget($this); $button = new QPushButton($widget); $button->text = $text; $button->setMinimumSize(200, 36); $button->enabled = $enabled; $button->styleSheet = "text-align:{$align};padding-left:50px;padding-right:20px;font-size:14px;"; $label = new QLabel($widget); $label->icon = $this->iconsPath . "/{$icon}"; $label->resize(32, 32); $label->enabled = $enabled; $label->move(10, 0); if (!empty($slot)) { $button->connect(SIGNAL('clicked(bool)'), $this, $slot); $label->connect(SIGNAL('mouseClicked()'), $button, SLOT('click()')); } $layout = new QHBoxLayout(); $layout->setContentsMargins(0, 6, 0, 0); $layout->addWidget($button); $widget->setLayout($layout); return $widget; }
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 show() { parent::show(); $desktop = new QDesktopWidget(); $screenNumber = $desktop->screenNumber($this); $this->screenGeometry = $desktop->screenGeometry($screenNumber); $this->logoPaw1->move($this->x, -$this->screenGeometry["height"] / 2); $this->logoPaw1->show(); $this->logoPaw2->move($this->x, -$this->screenGeometry["height"] / 2); $this->logoPaw2->show(); $this->logoPaw3->move($this->x, -$this->screenGeometry["height"] / 2); $this->logoPaw3->show(); $this->logoPaw4->move($this->x, -$this->screenGeometry["height"] / 2); $this->logoPaw4->show(); $this->logoPaw5->move($this->x, -$this->screenGeometry["height"] / 2); $this->logoPaw5->show(); $this->timer->start(); $this->labelVersion->move($this->width / 2 - $this->labelVersion->width / 2, 210); $this->updaterResult = $this->updater->check($this->server); return qApp::exec(); }
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; }
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); }
private function updateScreenshotLabel() { $this->screenshotLabel->setPixmap($this->originalPixmap->scaled($this->screenshotLabel->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation)); }