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->dtgCategory_EditLinkColumn_Render($_ITEM) ?>');
     $this->colEditLinkColumn->HtmlEntities = false;
     $this->colCategoryId = new QDataGridColumn(QApplication::Translate('Category Id'), '<?= $_ITEM->CategoryId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::Category()->CategoryId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Category()->CategoryId, false)));
     $this->colShortDescription = new QDataGridColumn(QApplication::Translate('Short Description'), '<?= QString::Truncate($_ITEM->ShortDescription, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Category()->ShortDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Category()->ShortDescription, false)));
     $this->colLongDescription = new QDataGridColumn(QApplication::Translate('Long Description'), '<?= QString::Truncate($_ITEM->LongDescription, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Category()->LongDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Category()->LongDescription, false)));
     $this->colImagePath = new QDataGridColumn(QApplication::Translate('Image Path'), '<?= QString::Truncate($_ITEM->ImagePath, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Category()->ImagePath), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Category()->ImagePath, false)));
     $this->colAssetFlag = new QDataGridColumn(QApplication::Translate('Asset Flag'), '<?= ($_ITEM->AssetFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::Category()->AssetFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Category()->AssetFlag, false)));
     $this->colInventoryFlag = new QDataGridColumn(QApplication::Translate('Inventory Flag'), '<?= ($_ITEM->InventoryFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::Category()->InventoryFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Category()->InventoryFlag, false)));
     $this->colCreatedBy = new QDataGridColumn(QApplication::Translate('Created By'), '<?= $_CONTROL->ParentControl->dtgCategory_CreatedByObject_Render($_ITEM); ?>');
     $this->colCreationDate = new QDataGridColumn(QApplication::Translate('Creation Date'), '<?= $_CONTROL->ParentControl->dtgCategory_CreationDate_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Category()->CreationDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Category()->CreationDate, false)));
     $this->colModifiedBy = new QDataGridColumn(QApplication::Translate('Modified By'), '<?= $_CONTROL->ParentControl->dtgCategory_ModifiedByObject_Render($_ITEM); ?>');
     $this->colModifiedDate = new QDataGridColumn(QApplication::Translate('Modified Date'), '<?= QString::Truncate($_ITEM->ModifiedDate, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Category()->ModifiedDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Category()->ModifiedDate, false)));
     // Setup DataGrid
     $this->dtgCategory = new QDataGrid($this);
     $this->dtgCategory->CellSpacing = 0;
     $this->dtgCategory->CellPadding = 4;
     $this->dtgCategory->BorderStyle = QBorderStyle::Solid;
     $this->dtgCategory->BorderWidth = 1;
     $this->dtgCategory->GridLines = QGridLines::Both;
     // Datagrid Paginator
     $this->dtgCategory->Paginator = new QPaginator($this->dtgCategory);
     $this->dtgCategory->ItemsPerPage = 10;
     // Specify Whether or Not to Refresh using Ajax
     $this->dtgCategory->UseAjax = true;
     // Specify the local databind method this datagrid will use
     $this->dtgCategory->SetDataBinder('dtgCategory_Bind', $this);
     $this->dtgCategory->AddColumn($this->colEditLinkColumn);
     $this->dtgCategory->AddColumn($this->colCategoryId);
     $this->dtgCategory->AddColumn($this->colShortDescription);
     $this->dtgCategory->AddColumn($this->colLongDescription);
     $this->dtgCategory->AddColumn($this->colImagePath);
     $this->dtgCategory->AddColumn($this->colAssetFlag);
     $this->dtgCategory->AddColumn($this->colInventoryFlag);
     $this->dtgCategory->AddColumn($this->colCreatedBy);
     $this->dtgCategory->AddColumn($this->colCreationDate);
     $this->dtgCategory->AddColumn($this->colModifiedBy);
     $this->dtgCategory->AddColumn($this->colModifiedDate);
     // Setup the Create New button
     $this->btnCreateNew = new QButton($this);
     $this->btnCreateNew->Text = QApplication::Translate('Create a New') . ' ' . QApplication::Translate('Category');
     $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->dtgCategory_EditLinkColumn_Render($_ITEM) ?>');
     $this->colEditLinkColumn->HtmlEntities = false;
     $this->colCategoryId = new QDataGridColumn(QApplication::Translate('Category Id'), '<?= $_ITEM->CategoryId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::Category()->CategoryId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Category()->CategoryId, false)));
     $this->colShortDescription = new QDataGridColumn(QApplication::Translate('Short Description'), '<?= QString::Truncate($_ITEM->ShortDescription, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Category()->ShortDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Category()->ShortDescription, false)));
     $this->colLongDescription = new QDataGridColumn(QApplication::Translate('Long Description'), '<?= QString::Truncate($_ITEM->LongDescription, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Category()->LongDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Category()->LongDescription, false)));
     $this->colImagePath = new QDataGridColumn(QApplication::Translate('Image Path'), '<?= QString::Truncate($_ITEM->ImagePath, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Category()->ImagePath), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Category()->ImagePath, false)));
     $this->colAssetFlag = new QDataGridColumn(QApplication::Translate('Asset Flag'), '<?= ($_ITEM->AssetFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::Category()->AssetFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Category()->AssetFlag, false)));
     $this->colInventoryFlag = new QDataGridColumn(QApplication::Translate('Inventory Flag'), '<?= ($_ITEM->InventoryFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::Category()->InventoryFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Category()->InventoryFlag, false)));
     $this->colCreatedBy = new QDataGridColumn(QApplication::Translate('Created By'), '<?= $_FORM->dtgCategory_CreatedByObject_Render($_ITEM); ?>');
     $this->colCreationDate = new QDataGridColumn(QApplication::Translate('Creation Date'), '<?= $_FORM->dtgCategory_CreationDate_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Category()->CreationDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Category()->CreationDate, false)));
     $this->colModifiedBy = new QDataGridColumn(QApplication::Translate('Modified By'), '<?= $_FORM->dtgCategory_ModifiedByObject_Render($_ITEM); ?>');
     $this->colModifiedDate = new QDataGridColumn(QApplication::Translate('Modified Date'), '<?= QString::Truncate($_ITEM->ModifiedDate, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Category()->ModifiedDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Category()->ModifiedDate, false)));
     $this->colCategoryCustomFieldHelper = new QDataGridColumn(QApplication::Translate('Category Custom Field Helper'), '<?= $_FORM->dtgCategory_CategoryCustomFieldHelper_Render($_ITEM); ?>');
     // Setup DataGrid
     $this->dtgCategory = new QDataGrid($this);
     $this->dtgCategory->CellSpacing = 0;
     $this->dtgCategory->CellPadding = 4;
     $this->dtgCategory->BorderStyle = QBorderStyle::Solid;
     $this->dtgCategory->BorderWidth = 1;
     $this->dtgCategory->GridLines = QGridLines::Both;
     // Datagrid Paginator
     $this->dtgCategory->Paginator = new QPaginator($this->dtgCategory);
     $this->dtgCategory->ItemsPerPage = 10;
     // Specify Whether or Not to Refresh using Ajax
     $this->dtgCategory->UseAjax = false;
     // Specify the local databind method this datagrid will use
     $this->dtgCategory->SetDataBinder('dtgCategory_Bind');
     $this->dtgCategory->AddColumn($this->colEditLinkColumn);
     $this->dtgCategory->AddColumn($this->colCategoryId);
     $this->dtgCategory->AddColumn($this->colShortDescription);
     $this->dtgCategory->AddColumn($this->colLongDescription);
     $this->dtgCategory->AddColumn($this->colImagePath);
     $this->dtgCategory->AddColumn($this->colAssetFlag);
     $this->dtgCategory->AddColumn($this->colInventoryFlag);
     $this->dtgCategory->AddColumn($this->colCreatedBy);
     $this->dtgCategory->AddColumn($this->colCreationDate);
     $this->dtgCategory->AddColumn($this->colModifiedBy);
     $this->dtgCategory->AddColumn($this->colModifiedDate);
     $this->dtgCategory->AddColumn($this->colCategoryCustomFieldHelper);
 }
 /**
  * Used internally by the Meta-based Add Column tools.
  *
  * Given a QQNode or a Text String, this will return a Category-based QQNode.
  * It will also verify that it is a proper Category-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 == 'category') {
             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 "category".');
         }
     } else {
         if (is_string($mixContent)) {
             switch ($mixContent) {
                 case 'Id':
                     return QQN::Category()->Id;
                 case 'ParentId':
                     return QQN::Category()->ParentId;
                 case 'Name':
                     return QQN::Category()->Name;
                 default:
                     throw new QCallerException('Simple Property not found in CategoryDataGrid 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');
             }
         }
     }
 }
 /**
  * Used internally by the Meta-based Add Column tools.
  *
  * Given a QQNode or a Text String, this will return a Category-based QQNode.
  * It will also verify that it is a proper Category-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 == 'category') {
             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 "category".');
         }
     } else {
         if (is_string($mixContent)) {
             switch ($mixContent) {
                 case 'CategoryId':
                     return QQN::Category()->CategoryId;
                 case 'ShortDescription':
                     return QQN::Category()->ShortDescription;
                 case 'LongDescription':
                     return QQN::Category()->LongDescription;
                 case 'ImagePath':
                     return QQN::Category()->ImagePath;
                 case 'AssetFlag':
                     return QQN::Category()->AssetFlag;
                 case 'InventoryFlag':
                     return QQN::Category()->InventoryFlag;
                 case 'CreatedBy':
                     return QQN::Category()->CreatedBy;
                 case 'CreatedByObject':
                     return QQN::Category()->CreatedByObject;
                 case 'CreationDate':
                     return QQN::Category()->CreationDate;
                 case 'ModifiedBy':
                     return QQN::Category()->ModifiedBy;
                 case 'ModifiedByObject':
                     return QQN::Category()->ModifiedByObject;
                 case 'ModifiedDate':
                     return QQN::Category()->ModifiedDate;
                 case 'CategoryCustomFieldHelper':
                     return QQN::Category()->CategoryCustomFieldHelper;
                 default:
                     throw new QCallerException('Simple Property not found in CategoryDataGrid 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');
             }
         }
     }
 }
Esempio n. 5
0
 /**
  * Count Categories
  * by ModifiedBy Index(es)
  * @param integer $intModifiedBy
  * @return int
  */
 public static function CountByModifiedBy($intModifiedBy, $objOptionalClauses = null)
 {
     // Call Category::QueryCount to perform the CountByModifiedBy query
     return Category::QueryCount(QQ::Equal(QQN::Category()->ModifiedBy, $intModifiedBy), $objOptionalClauses);
 }
Esempio n. 6
0
 /**
  * Load a single Category object,
  * by Id Index(es)
  * @param integer $intId
  * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  * @return Category
  */
 public static function LoadById($intId, $objOptionalClauses = null)
 {
     return Category::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::Category()->Id, $intId)), $objOptionalClauses);
 }
 protected function lstCategory_Create()
 {
     $this->lstCategory = new QListBox($this);
     $this->lstCategory->AddItem('- ALL -', null);
     $arrCategory = Category::QueryArray(QQ::Equal(QQN::Category()->InventoryFlag, 1));
     foreach ($arrCategory as $objCategory) {
         $this->lstCategory->AddItem($objCategory->ShortDescription, $objCategory->CategoryId);
     }
 }
Esempio n. 8
0
 protected function dtgCategory_Create()
 {
     $this->dtgCategory = new QDataGrid($this);
     $this->dtgCategory->Name = 'category_list';
     $this->dtgCategory->CellPadding = 5;
     $this->dtgCategory->CellSpacing = 0;
     $this->dtgCategory->CssClass = "datagrid";
     $this->dtgCategory->SortColumnIndex = 0;
     // Enable AJAX - this won't work while using the DB profiler
     $this->dtgCategory->UseAjax = true;
     // Allow for column toggling
     $this->dtgCategory->ShowColumnToggle = true;
     // Enable Pagination, and set to 20 items per page
     $objPaginator = new QPaginator($this->dtgCategory);
     $this->dtgCategory->Paginator = $objPaginator;
     $this->dtgCategory->ItemsPerPage = 20;
     $this->dtgCategory->ShowExportCsv = true;
     $this->dtgCategory->AddColumn(new QDataGridColumnExt('ID', '<?= $_ITEM->CategoryId ?>', array('OrderByClause' => QQ::OrderBy(QQN::Category()->CategoryId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Category()->CategoryId, false), 'CssClass' => "dtg_column", 'HtmlEntities' => false)));
     $this->dtgCategory->AddColumn(new QDataGridColumnExt('Category', '<?= $_ITEM->__toStringWithLink("bluelink") ?>', array('OrderByClause' => QQ::OrderBy(QQN::Category()->ShortDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Category()->ShortDescription, false), 'CssClass' => "dtg_column", 'HtmlEntities' => false)));
     $this->dtgCategory->AddColumn(new QDataGridColumnExt('Description', '<?= $_ITEM->LongDescription ?>', array('Width' => "200", 'OrderByClause' => QQ::OrderBy(QQN::Category()->LongDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Category()->LongDescription, false), 'CssClass' => "dtg_column")));
     /*      $this->dtgCategory->AddColumn(new QDataGridColumnExt('Created By', '<?= $_ITEM->CreatedByObject->__toStringFullName() ?>', array('OrderByClause' => QQ::OrderBy(QQN::Category()->CreatedByObject->LastName, false, QQN::Category()->CreatedByObject->FirstName, false), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Category()->CreatedByObject->LastName, QQN::Category()->CreatedByObject->FirstName), 'CssClass' => "dtg_column")));*/
     $this->dtgCategory->AddColumn(new QDataGridColumnExt('Created By', '<?= $_ITEM->CreatedByObject->__toStringFullName() ?>', array('SortByCommand' => 'category__created_by__last_name DESC, category__created_by__first_name DESC', 'ReverseSortByCommand' => 'category__created_by__last_name ASC, category__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(6, false);
     if ($objCustomFieldArray) {
         foreach ($objCustomFieldArray as $objCustomField) {
             $this->dtgCategory->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->dtgCategory->SortColumnIndex = 1;
     $this->dtgCategory->SortDirection = 0;
     $objStyle = $this->dtgCategory->RowStyle;
     $objStyle->ForeColor = '#000000';
     $objStyle->BackColor = '#FFFFFF';
     $objStyle->FontSize = 12;
     $objStyle = $this->dtgCategory->AlternateRowStyle;
     $objStyle->BackColor = '#EFEFEF';
     $objStyle = $this->dtgCategory->HeaderRowStyle;
     $objStyle->ForeColor = '#000000';
     $objStyle->BackColor = '#EFEFEF';
     $objStyle->CssClass = 'dtg_header';
     $this->dtgCategory->SetDataBinder('dtgCategory_Bind');
 }
Esempio n. 9
0
 /**
  * Count Categories
  * by ModifiedBy Index(es)
  * @param integer $intModifiedBy
  * @return int
  */
 public static function CountByModifiedBy($intModifiedBy)
 {
     // Call Category::QueryCount to perform the CountByModifiedBy query
     return Category::QueryCount(QQ::Equal(QQN::Category()->ModifiedBy, $intModifiedBy));
 }