protected function Form_Create() { // Setup DataGrid Columns $this->colEditLinkColumn = new QDataGridColumn(QApplication::Translate('Edit'), '<?= $_FORM->dtgAudit_EditLinkColumn_Render($_ITEM) ?>'); $this->colEditLinkColumn->HtmlEntities = false; $this->colAuditId = new QDataGridColumn(QApplication::Translate('Audit Id'), '<?= $_ITEM->AuditId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::Audit()->AuditId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Audit()->AuditId, false))); $this->colEntityQtypeId = new QDataGridColumn(QApplication::Translate('Entity Qtype'), '<?= $_FORM->dtgAudit_EntityQtypeId_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Audit()->EntityQtypeId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Audit()->EntityQtypeId, false))); $this->colCreatedBy = new QDataGridColumn(QApplication::Translate('Created By'), '<?= $_FORM->dtgAudit_CreatedByObject_Render($_ITEM); ?>'); $this->colCreationDate = new QDataGridColumn(QApplication::Translate('Creation Date'), '<?= $_FORM->dtgAudit_CreationDate_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Audit()->CreationDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Audit()->CreationDate, false))); $this->colModifiedBy = new QDataGridColumn(QApplication::Translate('Modified By'), '<?= $_FORM->dtgAudit_ModifiedByObject_Render($_ITEM); ?>'); $this->colModifiedDate = new QDataGridColumn(QApplication::Translate('Modified Date'), '<?= QString::Truncate($_ITEM->ModifiedDate, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Audit()->ModifiedDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Audit()->ModifiedDate, false))); // Setup DataGrid $this->dtgAudit = new QDataGrid($this); $this->dtgAudit->CellSpacing = 0; $this->dtgAudit->CellPadding = 4; $this->dtgAudit->BorderStyle = QBorderStyle::Solid; $this->dtgAudit->BorderWidth = 1; $this->dtgAudit->GridLines = QGridLines::Both; // Datagrid Paginator $this->dtgAudit->Paginator = new QPaginator($this->dtgAudit); $this->dtgAudit->ItemsPerPage = 10; // Specify Whether or Not to Refresh using Ajax $this->dtgAudit->UseAjax = false; // Specify the local databind method this datagrid will use $this->dtgAudit->SetDataBinder('dtgAudit_Bind'); $this->dtgAudit->AddColumn($this->colEditLinkColumn); $this->dtgAudit->AddColumn($this->colAuditId); $this->dtgAudit->AddColumn($this->colEntityQtypeId); $this->dtgAudit->AddColumn($this->colCreatedBy); $this->dtgAudit->AddColumn($this->colCreationDate); $this->dtgAudit->AddColumn($this->colModifiedBy); $this->dtgAudit->AddColumn($this->colModifiedDate); }
protected function Form_Create() { // Create the Header Menu $this->ctlHeaderMenu_Create(); $this->ctlShortcutMenu_Create(); if ($_GET && $_GET['method'] == 'delete') { $objAudit = Audit::Load($_GET['intAuditId']); if ($objAudit) { $objAudit->Delete(); QApplication::Redirect("./inventory_audit_list.php"); } } // Load an array of Audit objects using join on UserAccount. $this->objAuditArray = Audit::LoadArrayByEntityQtypeId(2, QQ::Clause(QQ::Expand(QQN::Audit()->CreatedByObject))); }
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->dtgAudit_EditLinkColumn_Render($_ITEM) ?>'); $this->colEditLinkColumn->HtmlEntities = false; $this->colAuditId = new QDataGridColumn(QApplication::Translate('Audit Id'), '<?= $_ITEM->AuditId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::Audit()->AuditId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Audit()->AuditId, false))); $this->colEntityQtypeId = new QDataGridColumn(QApplication::Translate('Entity Qtype'), '<?= $_CONTROL->ParentControl->dtgAudit_EntityQtypeId_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Audit()->EntityQtypeId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Audit()->EntityQtypeId, false))); $this->colCreatedBy = new QDataGridColumn(QApplication::Translate('Created By'), '<?= $_CONTROL->ParentControl->dtgAudit_CreatedByObject_Render($_ITEM); ?>'); $this->colCreationDate = new QDataGridColumn(QApplication::Translate('Creation Date'), '<?= $_CONTROL->ParentControl->dtgAudit_CreationDate_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Audit()->CreationDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Audit()->CreationDate, false))); $this->colModifiedBy = new QDataGridColumn(QApplication::Translate('Modified By'), '<?= $_CONTROL->ParentControl->dtgAudit_ModifiedByObject_Render($_ITEM); ?>'); $this->colModifiedDate = new QDataGridColumn(QApplication::Translate('Modified Date'), '<?= QString::Truncate($_ITEM->ModifiedDate, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Audit()->ModifiedDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Audit()->ModifiedDate, false))); // Setup DataGrid $this->dtgAudit = new QDataGrid($this); $this->dtgAudit->CellSpacing = 0; $this->dtgAudit->CellPadding = 4; $this->dtgAudit->BorderStyle = QBorderStyle::Solid; $this->dtgAudit->BorderWidth = 1; $this->dtgAudit->GridLines = QGridLines::Both; // Datagrid Paginator $this->dtgAudit->Paginator = new QPaginator($this->dtgAudit); $this->dtgAudit->ItemsPerPage = 10; // Specify Whether or Not to Refresh using Ajax $this->dtgAudit->UseAjax = true; // Specify the local databind method this datagrid will use $this->dtgAudit->SetDataBinder('dtgAudit_Bind', $this); $this->dtgAudit->AddColumn($this->colEditLinkColumn); $this->dtgAudit->AddColumn($this->colAuditId); $this->dtgAudit->AddColumn($this->colEntityQtypeId); $this->dtgAudit->AddColumn($this->colCreatedBy); $this->dtgAudit->AddColumn($this->colCreationDate); $this->dtgAudit->AddColumn($this->colModifiedBy); $this->dtgAudit->AddColumn($this->colModifiedDate); // Setup the Create New button $this->btnCreateNew = new QButton($this); $this->btnCreateNew->Text = QApplication::Translate('Create a New') . ' ' . QApplication::Translate('Audit'); $this->btnCreateNew->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCreateNew_Click')); }
protected function Form_Create() { // Create the Header Menu $this->ctlHeaderMenu_Create(); $this->ctlShortcutMenu_Create(); //QApplication::$Database[1]->EnableProfiling(); if ($_GET && $_GET['method'] == 'delete') { $objAudit = Audit::Load($_GET['intAuditId']); if ($objAudit) { // Set the relationship to ON DELETE CASCADE so that the AuditScans will be automatically deleted when deleting the Audit Object $objAudit->Delete(); QApplication::Redirect("./asset_audit_list.php"); } } // Load an array of Audit objects using join on UserAccount. $this->objAuditArray = Audit::LoadAll(QQ::Clause(QQ::Expand(QQN::Audit()->CreatedByObject))); }
/** * Used internally by the Meta-based Add Column tools. * * Given a QQNode or a Text String, this will return a Audit-based QQNode. * It will also verify that it is a proper Audit-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 == 'audit') { 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 "audit".'); } } else { if (is_string($mixContent)) { switch ($mixContent) { case 'AuditId': return QQN::Audit()->AuditId; case 'EntityQtypeId': return QQN::Audit()->EntityQtypeId; case 'CreatedBy': return QQN::Audit()->CreatedBy; case 'CreatedByObject': return QQN::Audit()->CreatedByObject; case 'CreationDate': return QQN::Audit()->CreationDate; case 'ModifiedBy': return QQN::Audit()->ModifiedBy; case 'ModifiedByObject': return QQN::Audit()->ModifiedByObject; case 'ModifiedDate': return QQN::Audit()->ModifiedDate; default: throw new QCallerException('Simple Property not found in AuditDataGrid 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'); } } } }
/** * Count Audits * by ModifiedBy Index(es) * @param integer $intModifiedBy * @return int */ public static function CountByModifiedBy($intModifiedBy) { // Call Audit::QueryCount to perform the CountByModifiedBy query return Audit::QueryCount(QQ::Equal(QQN::Audit()->ModifiedBy, $intModifiedBy)); }
/** * Count Audits * by ModifiedBy Index(es) * @param integer $intModifiedBy * @return int */ public static function CountByModifiedBy($intModifiedBy, $objOptionalClauses = null) { // Call Audit::QueryCount to perform the CountByModifiedBy query return Audit::QueryCount(QQ::Equal(QQN::Audit()->ModifiedBy, $intModifiedBy), $objOptionalClauses); }