// Include prepend.inc to load Qcodo require '../includes/prepend.inc.php'; /* if you DO NOT have "includes/" in your include_path */ // require('prepend.inc.php'); /* if you DO have "includes/" in your include_path */ // Include the classfile for CategoryListFormBase require __FORMBASE_CLASSES__ . '/CategoryListFormBase.class.php'; // Security check for ALLOW_REMOTE_ADMIN // To allow access REGARDLESS of ALLOW_REMOTE_ADMIN, simply remove the line below QApplication::CheckRemoteAdmin(); /** * This is a quick-and-dirty draft form object to do the List All functionality * of the Category class. It extends from the code-generated * abstract CategoryListFormBase class. * * Any display customizations and presentation-tier logic can be implemented * here by overriding existing or implementing new methods, properties and variables. * * Additional qform control objects can also be defined and used here, as well. * * @package My Application * @subpackage FormDraftObjects * */ class CategoryListForm extends CategoryListFormBase { } // Go ahead and run this form object to generate the page and event handlers, using // generated/category_list.tpl.php as the included HTML template file CategoryListForm::Run('CategoryListForm', 'generated/category_list.tpl.php');
protected function Form_Run() { // Security check for ALLOW_REMOTE_ADMIN // To allow access REGARDLESS of ALLOW_REMOTE_ADMIN, simply remove the line below QApplication::CheckRemoteAdmin(); } protected function Form_Create() { // Instantiate the Meta DataGrid $this->dtgCategories = new CategoryDataGrid($this); // Style the DataGrid (if desired) $this->dtgCategories->CssClass = 'datagrid'; $this->dtgCategories->AlternateRowStyle->CssClass = 'alternate'; // Add Pagination (if desired) $this->dtgCategories->Paginator = new QPaginator($this->dtgCategories); $this->dtgCategories->ItemsPerPage = 20; // Use the MetaDataGrid functionality to add Columns for this datagrid // Create an Edit Column $strEditPageUrl = __VIRTUAL_DIRECTORY__ . __FORM_DRAFTS__ . '/category_edit.php'; $this->dtgCategories->MetaAddEditLinkColumn($strEditPageUrl, 'Edit', 'Edit'); // Create the Other Columns (note that you can use strings for category's properties, or you // can traverse down QQN::category() to display fields that are down the hierarchy) $this->dtgCategories->MetaAddColumn('Id'); $this->dtgCategories->MetaAddColumn('ParentId'); $this->dtgCategories->MetaAddColumn('Name'); } } // Go ahead and run this form object to generate the page and event handlers, implicitly using // category_list.tpl.php as the included HTML template file CategoryListForm::Run('CategoryListForm');
/* $objClauses = array(); if ($objClause = $this->dtgCategory->OrderByClause) array_push($objClauses, $objClause); if ($objClause = $this->dtgCategory->LimitClause) array_push($objClauses, $objClause); if ($objClause = QQ::Expand(QQN::Category()->CreatedByObject)) array_push($objClauses, $objClause); $this->dtgCategory->DataSource = Category::LoadAll($objClauses); $this->dtgCategory->ShowHeader = true;*/ $this->dtgCategory->DataSource = Category::LoadAllWithCustomFieldsHelper($this->dtgCategory->SortInfo, $this->dtgCategory->LimitInfo, $objExpansionMap); $this->dtgCategory->ShowHeader = true; } } //protected function Form_Exit() { // Output database profiling - it shows you the queries made to create this page // This will not work on pages with the AJAX Pagination //QApplication::$Database[1]->OutputProfiling(); //} protected function btnNew_Click() { QApplication::Redirect('category_edit.php'); } protected function btnImport_Click() { QApplication::Redirect('category_import.php'); } } // Go ahead and run this form object to generate the page and event handlers, using // generated/category_edit.php.inc as the included HTML template file CategoryListForm::Run('CategoryListForm', __DOCROOT__ . __SUBDIRECTORY__ . '/admin/category_list.tpl.php');