コード例 #1
0
 protected function Form_Create()
 {
     // Setup DataGrid Columns
     $this->colEditLinkColumn = new QDataGridColumn(QApplication::Translate('Edit'), '<?= $_FORM->dtgEntityQtypeCustomField_EditLinkColumn_Render($_ITEM) ?>');
     $this->colEditLinkColumn->HtmlEntities = false;
     $this->colEntityQtypeCustomFieldId = new QDataGridColumn(QApplication::Translate('Entity Qtype Custom Field Id'), '<?= $_ITEM->EntityQtypeCustomFieldId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::EntityQtypeCustomField()->EntityQtypeCustomFieldId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::EntityQtypeCustomField()->EntityQtypeCustomFieldId, false)));
     $this->colEntityQtypeId = new QDataGridColumn(QApplication::Translate('Entity Qtype'), '<?= $_FORM->dtgEntityQtypeCustomField_EntityQtypeId_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::EntityQtypeCustomField()->EntityQtypeId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::EntityQtypeCustomField()->EntityQtypeId, false)));
     $this->colCustomFieldId = new QDataGridColumn(QApplication::Translate('Custom Field Id'), '<?= $_FORM->dtgEntityQtypeCustomField_CustomField_Render($_ITEM); ?>');
     // Setup DataGrid
     $this->dtgEntityQtypeCustomField = new QDataGrid($this);
     $this->dtgEntityQtypeCustomField->CellSpacing = 0;
     $this->dtgEntityQtypeCustomField->CellPadding = 4;
     $this->dtgEntityQtypeCustomField->BorderStyle = QBorderStyle::Solid;
     $this->dtgEntityQtypeCustomField->BorderWidth = 1;
     $this->dtgEntityQtypeCustomField->GridLines = QGridLines::Both;
     // Datagrid Paginator
     $this->dtgEntityQtypeCustomField->Paginator = new QPaginator($this->dtgEntityQtypeCustomField);
     $this->dtgEntityQtypeCustomField->ItemsPerPage = 10;
     // Specify Whether or Not to Refresh using Ajax
     $this->dtgEntityQtypeCustomField->UseAjax = false;
     // Specify the local databind method this datagrid will use
     $this->dtgEntityQtypeCustomField->SetDataBinder('dtgEntityQtypeCustomField_Bind');
     $this->dtgEntityQtypeCustomField->AddColumn($this->colEditLinkColumn);
     $this->dtgEntityQtypeCustomField->AddColumn($this->colEntityQtypeCustomFieldId);
     $this->dtgEntityQtypeCustomField->AddColumn($this->colEntityQtypeId);
     $this->dtgEntityQtypeCustomField->AddColumn($this->colCustomFieldId);
 }
コード例 #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->dtgEntityQtypeCustomField_EditLinkColumn_Render($_ITEM) ?>');
     $this->colEditLinkColumn->HtmlEntities = false;
     $this->colEntityQtypeCustomFieldId = new QDataGridColumn(QApplication::Translate('Entity Qtype Custom Field Id'), '<?= $_ITEM->EntityQtypeCustomFieldId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::EntityQtypeCustomField()->EntityQtypeCustomFieldId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::EntityQtypeCustomField()->EntityQtypeCustomFieldId, false)));
     $this->colEntityQtypeId = new QDataGridColumn(QApplication::Translate('Entity Qtype'), '<?= $_CONTROL->ParentControl->dtgEntityQtypeCustomField_EntityQtypeId_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::EntityQtypeCustomField()->EntityQtypeId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::EntityQtypeCustomField()->EntityQtypeId, false)));
     $this->colCustomFieldId = new QDataGridColumn(QApplication::Translate('Custom Field Id'), '<?= $_CONTROL->ParentControl->dtgEntityQtypeCustomField_CustomField_Render($_ITEM); ?>');
     // Setup DataGrid
     $this->dtgEntityQtypeCustomField = new QDataGrid($this);
     $this->dtgEntityQtypeCustomField->CellSpacing = 0;
     $this->dtgEntityQtypeCustomField->CellPadding = 4;
     $this->dtgEntityQtypeCustomField->BorderStyle = QBorderStyle::Solid;
     $this->dtgEntityQtypeCustomField->BorderWidth = 1;
     $this->dtgEntityQtypeCustomField->GridLines = QGridLines::Both;
     // Datagrid Paginator
     $this->dtgEntityQtypeCustomField->Paginator = new QPaginator($this->dtgEntityQtypeCustomField);
     $this->dtgEntityQtypeCustomField->ItemsPerPage = 10;
     // Specify Whether or Not to Refresh using Ajax
     $this->dtgEntityQtypeCustomField->UseAjax = true;
     // Specify the local databind method this datagrid will use
     $this->dtgEntityQtypeCustomField->SetDataBinder('dtgEntityQtypeCustomField_Bind', $this);
     $this->dtgEntityQtypeCustomField->AddColumn($this->colEditLinkColumn);
     $this->dtgEntityQtypeCustomField->AddColumn($this->colEntityQtypeCustomFieldId);
     $this->dtgEntityQtypeCustomField->AddColumn($this->colEntityQtypeId);
     $this->dtgEntityQtypeCustomField->AddColumn($this->colCustomFieldId);
     // Setup the Create New button
     $this->btnCreateNew = new QButton($this);
     $this->btnCreateNew->Text = QApplication::Translate('Create a New') . ' ' . QApplication::Translate('EntityQtypeCustomField');
     $this->btnCreateNew->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCreateNew_Click'));
 }
コード例 #3
0
 /**
  * Count EntityQtypeCustomFields
  * by CustomFieldId Index(es)
  * @param integer $intCustomFieldId
  * @return int
  */
 public static function CountByCustomFieldId($intCustomFieldId)
 {
     // Call EntityQtypeCustomField::QueryCount to perform the CountByCustomFieldId query
     return EntityQtypeCustomField::QueryCount(QQ::Equal(QQN::EntityQtypeCustomField()->CustomFieldId, $intCustomFieldId));
 }
コード例 #4
0
         $strTableName = "shipment";
         $strObjectId = "ShipmentId";
         $strId = 'shipment`.`shipment_id';
         $strHelperTable = '`shipment_custom_field_helper`';
         break;
     case 11:
         $strTableName = "receipt";
         $strObjectId = "ReceiptId";
         $strId = 'receipt`.`receipt_id';
         $strHelperTable = '`receipt_custom_field_helper`';
         break;
     default:
         throw new Exception('Not a valid EntityQtypeId.');
 }
 $blnNoAlterTable = false;
 $objEntityQtypeCustomFieldArray = EntityQtypeCustomField::LoadArrayByEntityQtypeId($intEntityQtypeId, QQ::Clause(QQ::Expand(QQN::EntityQtypeCustomField()->CustomField)));
 if ($objEntityQtypeCustomFieldArray) {
     foreach ($objEntityQtypeCustomFieldArray as $objEntityQtypeCustomField) {
         echo 'ALTER TABLE ' . $strHelperTable . ' ADD cfv_' . $objEntityQtypeCustomField->CustomFieldId . " TEXT DEFAULT NULL;<br />";
     }
 } else {
     $blnNoAlterTable = true;
 }
 $arrCustomFieldSql = array();
 $arrCustomFieldSql['strSelect'] = '';
 $arrCustomFieldSql['strFrom'] = '';
 $arrCustomFieldSql['strInsertColumnHeader'] = '';
 $arrCustomFieldSql['strInsertValues'] = '';
 if ($objEntityQtypeCustomFieldArray) {
     foreach ($objEntityQtypeCustomFieldArray as $objEntityQtypeCustomField) {
         $strAlias = $objEntityQtypeCustomField->CustomFieldId;
コード例 #5
0
 /**
  * Used internally by the Meta-based Add Column tools.
  *
  * Given a QQNode or a Text String, this will return a EntityQtypeCustomField-based QQNode.
  * It will also verify that it is a proper EntityQtypeCustomField-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 == 'entity_qtype_custom_field') {
             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 "entity_qtype_custom_field".');
         }
     } else {
         if (is_string($mixContent)) {
             switch ($mixContent) {
                 case 'EntityQtypeCustomFieldId':
                     return QQN::EntityQtypeCustomField()->EntityQtypeCustomFieldId;
                 case 'EntityQtypeId':
                     return QQN::EntityQtypeCustomField()->EntityQtypeId;
                 case 'CustomFieldId':
                     return QQN::EntityQtypeCustomField()->CustomFieldId;
                 case 'CustomField':
                     return QQN::EntityQtypeCustomField()->CustomField;
                 default:
                     throw new QCallerException('Simple Property not found in EntityQtypeCustomFieldDataGrid 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');
             }
         }
     }
 }
コード例 #6
0
 /**
  * Load a single EntityQtypeCustomField object,
  * by EntityQtypeId and CustomFieldId index(es)
  * This assumes that there is only one object per combination of these two parameters, which is the case but not enforced
  * @param integer $intEntityQtypeCustomFieldId
  * @return EntityQtypeCustomField
  */
 public static function LoadByEntityQtypeIdCustomFieldId($intEntityQtypeId, $intCustomFieldId)
 {
     return EntityQtypeCustomField::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::EntityQtypeCustomField()->EntityQtypeId, $intEntityQtypeId), QQ::Equal(QQN::EntityQtypeCustomField()->CustomFieldId, $intCustomFieldId)));
 }