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;
 }
Ejemplo n.º 2
0
 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;
     }
 }
Ejemplo n.º 3
0
 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);
 }