Ejemplo n.º 1
0
 protected function Form_Create()
 {
     // Setup DataGrid Columns
     $this->colEditLinkColumn = new QDataGridColumn(QApplication::Translate('Edit'), '<?= $_FORM->dtgModule_EditLinkColumn_Render($_ITEM) ?>');
     $this->colEditLinkColumn->HtmlEntities = false;
     $this->colModuleId = new QDataGridColumn(QApplication::Translate('Module Id'), '<?= $_ITEM->ModuleId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::Module()->ModuleId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Module()->ModuleId, false)));
     $this->colShortDescription = new QDataGridColumn(QApplication::Translate('Short Description'), '<?= QString::Truncate($_ITEM->ShortDescription, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Module()->ShortDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Module()->ShortDescription, false)));
     // Setup DataGrid
     $this->dtgModule = new QDataGrid($this);
     $this->dtgModule->CellSpacing = 0;
     $this->dtgModule->CellPadding = 4;
     $this->dtgModule->BorderStyle = QBorderStyle::Solid;
     $this->dtgModule->BorderWidth = 1;
     $this->dtgModule->GridLines = QGridLines::Both;
     // Datagrid Paginator
     $this->dtgModule->Paginator = new QPaginator($this->dtgModule);
     $this->dtgModule->ItemsPerPage = 10;
     // Specify Whether or Not to Refresh using Ajax
     $this->dtgModule->UseAjax = false;
     // Specify the local databind method this datagrid will use
     $this->dtgModule->SetDataBinder('dtgModule_Bind');
     $this->dtgModule->AddColumn($this->colEditLinkColumn);
     $this->dtgModule->AddColumn($this->colModuleId);
     $this->dtgModule->AddColumn($this->colShortDescription);
 }
Ejemplo n.º 2
0
 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->dtgModule_EditLinkColumn_Render($_ITEM) ?>');
     $this->colEditLinkColumn->HtmlEntities = false;
     $this->colModuleId = new QDataGridColumn(QApplication::Translate('Module Id'), '<?= $_ITEM->ModuleId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::Module()->ModuleId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Module()->ModuleId, false)));
     $this->colShortDescription = new QDataGridColumn(QApplication::Translate('Short Description'), '<?= QString::Truncate($_ITEM->ShortDescription, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Module()->ShortDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Module()->ShortDescription, false)));
     // Setup DataGrid
     $this->dtgModule = new QDataGrid($this);
     $this->dtgModule->CellSpacing = 0;
     $this->dtgModule->CellPadding = 4;
     $this->dtgModule->BorderStyle = QBorderStyle::Solid;
     $this->dtgModule->BorderWidth = 1;
     $this->dtgModule->GridLines = QGridLines::Both;
     // Datagrid Paginator
     $this->dtgModule->Paginator = new QPaginator($this->dtgModule);
     $this->dtgModule->ItemsPerPage = 10;
     // Specify Whether or Not to Refresh using Ajax
     $this->dtgModule->UseAjax = true;
     // Specify the local databind method this datagrid will use
     $this->dtgModule->SetDataBinder('dtgModule_Bind', $this);
     $this->dtgModule->AddColumn($this->colEditLinkColumn);
     $this->dtgModule->AddColumn($this->colModuleId);
     $this->dtgModule->AddColumn($this->colShortDescription);
     // Setup the Create New button
     $this->btnCreateNew = new QButton($this);
     $this->btnCreateNew->Text = QApplication::Translate('Create a New') . ' ' . QApplication::Translate('Module');
     $this->btnCreateNew->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCreateNew_Click'));
 }
Ejemplo n.º 3
0
 /**
  * Used internally by the Meta-based Add Column tools.
  *
  * Given a QQNode or a Text String, this will return a Module-based QQNode.
  * It will also verify that it is a proper Module-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 == 'module') {
             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 "module".');
         }
     } else {
         if (is_string($mixContent)) {
             switch ($mixContent) {
                 case 'ModuleId':
                     return QQN::Module()->ModuleId;
                 case 'ShortDescription':
                     return QQN::Module()->ShortDescription;
                 default:
                     throw new QCallerException('Simple Property not found in ModuleDataGrid 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');
             }
         }
     }
 }
Ejemplo n.º 4
0
 /**
  * This returns all Module objects except for the Home module
  * It is intended to use for the role_edit page because the home module always grants full authorization
  *
  * @return Array Module Objects
  */
 public static function LoadAllButHome()
 {
     $objModuleArray = Module::QueryArray(QQ::NotEqual(QQN::Module()->ModuleId, 1));
     return $objModuleArray;
 }
Ejemplo n.º 5
0
 /**
  * Load a single Module object,
  * by ModuleId Index(es)
  * @param integer $intModuleId
  * @return Module
  */
 public static function LoadByModuleId($intModuleId, $objOptionalClauses = null)
 {
     return Module::QuerySingle(QQ::Equal(QQN::Module()->ModuleId, $intModuleId), $objOptionalClauses);
 }
Ejemplo n.º 6
0
 /**
  * Load a single Module object,
  * by ModuleId Index(es)
  * @param integer $intModuleId
  * @return Module
  */
 public static function LoadByModuleId($intModuleId)
 {
     return Module::QuerySingle(QQ::Equal(QQN::Module()->ModuleId, $intModuleId));
 }