public function __construct($objParentObject, $strSetEditPanelMethod, $strCloseEditPanelMethod, $strControlId = null) { // Call the Parent try { parent::__construct($objParentObject, $strControlId); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } // Record Method Callbacks $this->strSetEditPanelMethod = $strSetEditPanelMethod; $this->strCloseEditPanelMethod = $strCloseEditPanelMethod; // Setup DataGrid Columns $this->colEditLinkColumn = new QDataGridColumn(QApplication::Translate('Edit'), '<?= $_CONTROL->ParentControl->dtgManufacturer_EditLinkColumn_Render($_ITEM) ?>'); $this->colEditLinkColumn->HtmlEntities = false; $this->colManufacturerId = new QDataGridColumn(QApplication::Translate('Manufacturer Id'), '<?= $_ITEM->ManufacturerId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::Manufacturer()->ManufacturerId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Manufacturer()->ManufacturerId, false))); $this->colShortDescription = new QDataGridColumn(QApplication::Translate('Short Description'), '<?= QString::Truncate($_ITEM->ShortDescription, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Manufacturer()->ShortDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Manufacturer()->ShortDescription, false))); $this->colLongDescription = new QDataGridColumn(QApplication::Translate('Long Description'), '<?= QString::Truncate($_ITEM->LongDescription, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Manufacturer()->LongDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Manufacturer()->LongDescription, false))); $this->colImagePath = new QDataGridColumn(QApplication::Translate('Image Path'), '<?= QString::Truncate($_ITEM->ImagePath, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Manufacturer()->ImagePath), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Manufacturer()->ImagePath, false))); $this->colCreatedBy = new QDataGridColumn(QApplication::Translate('Created By'), '<?= $_CONTROL->ParentControl->dtgManufacturer_CreatedByObject_Render($_ITEM); ?>'); $this->colCreationDate = new QDataGridColumn(QApplication::Translate('Creation Date'), '<?= $_CONTROL->ParentControl->dtgManufacturer_CreationDate_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Manufacturer()->CreationDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Manufacturer()->CreationDate, false))); $this->colModifiedBy = new QDataGridColumn(QApplication::Translate('Modified By'), '<?= $_CONTROL->ParentControl->dtgManufacturer_ModifiedByObject_Render($_ITEM); ?>'); $this->colModifiedDate = new QDataGridColumn(QApplication::Translate('Modified Date'), '<?= QString::Truncate($_ITEM->ModifiedDate, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Manufacturer()->ModifiedDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Manufacturer()->ModifiedDate, false))); // Setup DataGrid $this->dtgManufacturer = new QDataGrid($this); $this->dtgManufacturer->CellSpacing = 0; $this->dtgManufacturer->CellPadding = 4; $this->dtgManufacturer->BorderStyle = QBorderStyle::Solid; $this->dtgManufacturer->BorderWidth = 1; $this->dtgManufacturer->GridLines = QGridLines::Both; // Datagrid Paginator $this->dtgManufacturer->Paginator = new QPaginator($this->dtgManufacturer); $this->dtgManufacturer->ItemsPerPage = 10; // Specify Whether or Not to Refresh using Ajax $this->dtgManufacturer->UseAjax = true; // Specify the local databind method this datagrid will use $this->dtgManufacturer->SetDataBinder('dtgManufacturer_Bind', $this); $this->dtgManufacturer->AddColumn($this->colEditLinkColumn); $this->dtgManufacturer->AddColumn($this->colManufacturerId); $this->dtgManufacturer->AddColumn($this->colShortDescription); $this->dtgManufacturer->AddColumn($this->colLongDescription); $this->dtgManufacturer->AddColumn($this->colImagePath); $this->dtgManufacturer->AddColumn($this->colCreatedBy); $this->dtgManufacturer->AddColumn($this->colCreationDate); $this->dtgManufacturer->AddColumn($this->colModifiedBy); $this->dtgManufacturer->AddColumn($this->colModifiedDate); // Setup the Create New button $this->btnCreateNew = new QButton($this); $this->btnCreateNew->Text = QApplication::Translate('Create a New') . ' ' . QApplication::Translate('Manufacturer'); $this->btnCreateNew->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCreateNew_Click')); }
protected function Form_Create() { // Setup DataGrid Columns $this->colEditLinkColumn = new QDataGridColumn(QApplication::Translate('Edit'), '<?= $_FORM->dtgManufacturer_EditLinkColumn_Render($_ITEM) ?>'); $this->colEditLinkColumn->HtmlEntities = false; $this->colManufacturerId = new QDataGridColumn(QApplication::Translate('Manufacturer Id'), '<?= $_ITEM->ManufacturerId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::Manufacturer()->ManufacturerId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Manufacturer()->ManufacturerId, false))); $this->colShortDescription = new QDataGridColumn(QApplication::Translate('Short Description'), '<?= QString::Truncate($_ITEM->ShortDescription, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Manufacturer()->ShortDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Manufacturer()->ShortDescription, false))); $this->colLongDescription = new QDataGridColumn(QApplication::Translate('Long Description'), '<?= QString::Truncate($_ITEM->LongDescription, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Manufacturer()->LongDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Manufacturer()->LongDescription, false))); $this->colImagePath = new QDataGridColumn(QApplication::Translate('Image Path'), '<?= QString::Truncate($_ITEM->ImagePath, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Manufacturer()->ImagePath), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Manufacturer()->ImagePath, false))); $this->colCreatedBy = new QDataGridColumn(QApplication::Translate('Created By'), '<?= $_FORM->dtgManufacturer_CreatedByObject_Render($_ITEM); ?>'); $this->colCreationDate = new QDataGridColumn(QApplication::Translate('Creation Date'), '<?= $_FORM->dtgManufacturer_CreationDate_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Manufacturer()->CreationDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Manufacturer()->CreationDate, false))); $this->colModifiedBy = new QDataGridColumn(QApplication::Translate('Modified By'), '<?= $_FORM->dtgManufacturer_ModifiedByObject_Render($_ITEM); ?>'); $this->colModifiedDate = new QDataGridColumn(QApplication::Translate('Modified Date'), '<?= QString::Truncate($_ITEM->ModifiedDate, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Manufacturer()->ModifiedDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Manufacturer()->ModifiedDate, false))); $this->colManufacturerCustomFieldHelper = new QDataGridColumn(QApplication::Translate('Manufacturer Custom Field Helper'), '<?= $_FORM->dtgManufacturer_ManufacturerCustomFieldHelper_Render($_ITEM); ?>'); // Setup DataGrid $this->dtgManufacturer = new QDataGrid($this); $this->dtgManufacturer->CellSpacing = 0; $this->dtgManufacturer->CellPadding = 4; $this->dtgManufacturer->BorderStyle = QBorderStyle::Solid; $this->dtgManufacturer->BorderWidth = 1; $this->dtgManufacturer->GridLines = QGridLines::Both; // Datagrid Paginator $this->dtgManufacturer->Paginator = new QPaginator($this->dtgManufacturer); $this->dtgManufacturer->ItemsPerPage = 10; // Specify Whether or Not to Refresh using Ajax $this->dtgManufacturer->UseAjax = false; // Specify the local databind method this datagrid will use $this->dtgManufacturer->SetDataBinder('dtgManufacturer_Bind'); $this->dtgManufacturer->AddColumn($this->colEditLinkColumn); $this->dtgManufacturer->AddColumn($this->colManufacturerId); $this->dtgManufacturer->AddColumn($this->colShortDescription); $this->dtgManufacturer->AddColumn($this->colLongDescription); $this->dtgManufacturer->AddColumn($this->colImagePath); $this->dtgManufacturer->AddColumn($this->colCreatedBy); $this->dtgManufacturer->AddColumn($this->colCreationDate); $this->dtgManufacturer->AddColumn($this->colModifiedBy); $this->dtgManufacturer->AddColumn($this->colModifiedDate); $this->dtgManufacturer->AddColumn($this->colManufacturerCustomFieldHelper); }
/** * Count Manufacturers * by ModifiedBy Index(es) * @param integer $intModifiedBy * @return int */ public static function CountByModifiedBy($intModifiedBy, $objOptionalClauses = null) { // Call Manufacturer::QueryCount to perform the CountByModifiedBy query return Manufacturer::QueryCount(QQ::Equal(QQN::Manufacturer()->ModifiedBy, $intModifiedBy), $objOptionalClauses); }
protected function lstManufacturer_Create() { $this->lstManufacturer = new QListBox($this); $this->lstManufacturer->Name = QApplication::Translate('Manufacturer'); $this->lstManufacturer->AddItem(QApplication::Translate('- Select One -'), null); $objManufacturerArray = Manufacturer::LoadAll(QQ::Clause(QQ::OrderBy(QQN::Manufacturer()->ShortDescription))); if ($objManufacturerArray) { foreach ($objManufacturerArray as $objManufacturer) { $objListItem = new QListItem($objManufacturer->__toString(), $objManufacturer->ManufacturerId); if ($this->objAssetModel->Manufacturer && $this->objAssetModel->Manufacturer->ManufacturerId == $objManufacturer->ManufacturerId) { $objListItem->Selected = true; } $this->lstManufacturer->AddItem($objListItem); } } $this->lstManufacturer->Enabled = false; }
protected function lstManufacturer_Create() { $this->lstManufacturer = new QListBox($this); $this->lstManufacturer->Name = 'Manufacturer'; $this->lstManufacturer->AddItem('- ALL -', null); foreach (Manufacturer::LoadAll(QQ::Clause(QQ::OrderBy(QQN::Manufacturer()->ShortDescription))) as $objManufacturer) { $this->lstManufacturer->AddItem($objManufacturer->ShortDescription, $objManufacturer->ManufacturerId); } }
protected function lstManufacturer_Create() { $this->lstManufacturer = new QListBox($this); $this->lstManufacturer->Name = 'Manufacturer'; $this->lstManufacturer->AddItem(new QListItem('- ALL -', null)); // foreach (Manufacturer::LoadAll('short_description') as $objManufacturer) { foreach (Manufacturer::LoadAll(QQ::Clause(QQ::OrderBy(QQN::Manufacturer()->ShortDescription))) as $objManufacturer) { $this->lstManufacturer->AddItem(new QListItem($objManufacturer->ShortDescription, $objManufacturer->ManufacturerId)); } $this->lstManufacturer->AddAction(new QEnterKeyEvent(), new QServerAction('btnSearch_Click')); $this->lstManufacturer->AddAction(new QEnterKeyEvent(), new QTerminateAction()); }
protected function lstManufacturer_Create() { $this->lstManufacturer = new QListBox($this); $this->lstManufacturer->Name = QApplication::Translate('Manufacturer'); $this->lstManufacturer->Required = true; if (!$this->blnEditMode) { $this->lstManufacturer->AddItem('- Select One -', null); } // $objManufacturerArray = Manufacturer::LoadAll('short_description ASC'); $objManufacturerArray = Manufacturer::LoadAll(QQ::Clause(QQ::OrderBy(QQN::Manufacturer()->ShortDescription))); if ($objManufacturerArray) { foreach ($objManufacturerArray as $objManufacturer) { $objListItem = new QListItem($objManufacturer->__toString(), $objManufacturer->ManufacturerId); if ($this->objAssetModel->Manufacturer && $this->objAssetModel->Manufacturer->ManufacturerId == $objManufacturer->ManufacturerId) { $objListItem->Selected = true; } $this->lstManufacturer->AddItem($objListItem); } } $this->lstManufacturer->TabIndex = 3; $this->intNextTabIndex++; }
/** * Used internally by the Meta-based Add Column tools. * * Given a QQNode or a Text String, this will return a Manufacturer-based QQNode. * It will also verify that it is a proper Manufacturer-based QQNode, and will throw an exception otherwise. * * @param mixed $mixContent * @return QQNode */ protected function ResolveContentItem($mixContent) { if ($mixContent instanceof QQNode) { if (!$mixContent->_ParentNode) { throw new QCallerException('Content QQNode cannot be a Top Level Node'); } if ($mixContent->_RootTableName == 'manufacturer') { if ($mixContent instanceof QQReverseReferenceNode && !$mixContent->_PropertyName) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } $objCurrentNode = $mixContent; while ($objCurrentNode = $objCurrentNode->_ParentNode) { if (!$objCurrentNode instanceof QQNode) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } if ($objCurrentNode instanceof QQReverseReferenceNode && !$objCurrentNode->_PropertyName) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } } return $mixContent; } else { throw new QCallerException('Content QQNode has a root table of "' . $mixContent->_RootTableName . '". Must be a root of "manufacturer".'); } } else { if (is_string($mixContent)) { switch ($mixContent) { case 'ManufacturerId': return QQN::Manufacturer()->ManufacturerId; case 'ShortDescription': return QQN::Manufacturer()->ShortDescription; case 'LongDescription': return QQN::Manufacturer()->LongDescription; case 'ImagePath': return QQN::Manufacturer()->ImagePath; case 'CreatedBy': return QQN::Manufacturer()->CreatedBy; case 'CreatedByObject': return QQN::Manufacturer()->CreatedByObject; case 'CreationDate': return QQN::Manufacturer()->CreationDate; case 'ModifiedBy': return QQN::Manufacturer()->ModifiedBy; case 'ModifiedByObject': return QQN::Manufacturer()->ModifiedByObject; case 'ModifiedDate': return QQN::Manufacturer()->ModifiedDate; case 'ManufacturerCustomFieldHelper': return QQN::Manufacturer()->ManufacturerCustomFieldHelper; default: throw new QCallerException('Simple Property not found in ManufacturerDataGrid content: ' . $mixContent); } } else { if ($mixContent instanceof QQAssociationNode) { throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.'); } else { throw new QCallerException('Invalid Content type'); } } } }
protected function dtgManufacturer_Create() { $this->dtgManufacturer = new QDataGrid($this); $this->dtgManufacturer->Name = 'manufacturer_list'; $this->dtgManufacturer->CellPadding = 5; $this->dtgManufacturer->CellSpacing = 0; $this->dtgManufacturer->CssClass = "datagrid"; $this->dtgManufacturer->SortColumnIndex = 0; // Enable AJAX - this won't work while using the DB profiler $this->dtgManufacturer->UseAjax = true; // Allow for column toggling $this->dtgManufacturer->ShowColumnToggle = true; // Enable Pagination, and set to 20 items per page $objPaginator = new QPaginator($this->dtgManufacturer); $this->dtgManufacturer->Paginator = $objPaginator; $this->dtgManufacturer->ItemsPerPage = 20; $this->dtgManufacturer->ShowExportCsv = true; $this->dtgManufacturer->AddColumn(new QDataGridColumnExt('ID', '<?= $_ITEM->ManufacturerId ?>', array('OrderByClause' => QQ::OrderBy(QQN::Manufacturer()->ManufacturerId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Manufacturer()->ManufacturerId, false), 'CssClass' => "dtg_column", 'HtmlEntities' => false))); $this->dtgManufacturer->AddColumn(new QDataGridColumnExt('Manufacturer', '<?= $_ITEM->__toStringWithLink("bluelink") ?>', array('OrderByClause' => QQ::OrderBy(QQN::Manufacturer()->ShortDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Manufacturer()->ShortDescription, false), 'CssClass' => "dtg_column", 'HtmlEntities' => false))); $this->dtgManufacturer->AddColumn(new QDataGridColumnExt('Description', '<?= $_ITEM->LongDescription ?>', array('Width' => "200", 'OrderByClause' => QQ::OrderBy(QQN::Manufacturer()->LongDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Manufacturer()->LongDescription, false), 'CssClass' => "dtg_column"))); /* $this->dtgManufacturer->AddColumn(new QDataGridColumnExt('Created By', '<?= $_ITEM->CreatedByObject->__toStringFullName() ?>', array('OrderByClause' => QQ::OrderBy(QQN::Manufacturer()->CreatedByObject->LastName, false, QQN::Manufacturer()->CreatedByObject->FirstName, false), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Manufacturer()->CreatedByObject->LastName, QQN::Manufacturer()->CreatedByObject->FirstName), 'CssClass' => "dtg_column")));*/ $this->dtgManufacturer->AddColumn(new QDataGridColumnExt('Created By', '<?= $_ITEM->CreatedByObject->__toStringFullName() ?>', array('SortByCommand' => 'manufacturer__created_by__last_name DESC, manufacturer__created_by__first_name DESC', 'ReverseSortByCommand' => 'manufacturer__created_by__last_name ASC, manufacturer__created_by__first_name ASC', 'CssClass' => "dtg_column"))); // Add the custom field columns with Display set to false. These can be shown by using the column toggle menu. $objCustomFieldArray = CustomField::LoadObjCustomFieldArray(5, false); if ($objCustomFieldArray) { foreach ($objCustomFieldArray as $objCustomField) { $this->dtgManufacturer->AddColumn(new QDataGridColumnExt($objCustomField->ShortDescription, '<?= $_ITEM->GetVirtualAttribute(\'' . $objCustomField->CustomFieldId . '\') ?>', 'SortByCommand="__' . $objCustomField->CustomFieldId . ' ASC"', 'ReverseSortByCommand="__' . $objCustomField->CustomFieldId . ' DESC"', 'HtmlEntities="false"', 'CssClass="dtg_column"', 'Display="false"')); } } $this->dtgManufacturer->SortColumnIndex = 1; $this->dtgManufacturer->SortDirection = 0; $objStyle = $this->dtgManufacturer->RowStyle; $objStyle->ForeColor = '#000000'; $objStyle->BackColor = '#FFFFFF'; $objStyle->FontSize = 12; $objStyle = $this->dtgManufacturer->AlternateRowStyle; $objStyle->BackColor = '#EFEFEF'; $objStyle = $this->dtgManufacturer->HeaderRowStyle; $objStyle->ForeColor = '#000000'; $objStyle->BackColor = '#EFEFEF'; $objStyle->CssClass = 'dtg_header'; $this->dtgManufacturer->SetDataBinder('dtgManufacturer_Bind'); }