protected function Form_Create() { // Setup DataGrid Columns $this->colEditLinkColumn = new QDataGridColumn(QApplication::Translate('Edit'), '<?= $_FORM->dtgContact_EditLinkColumn_Render($_ITEM) ?>'); $this->colEditLinkColumn->HtmlEntities = false; $this->colContactId = new QDataGridColumn(QApplication::Translate('Contact Id'), '<?= $_ITEM->ContactId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->ContactId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->ContactId, false))); $this->colCompanyId = new QDataGridColumn(QApplication::Translate('Company Id'), '<?= $_FORM->dtgContact_Company_Render($_ITEM); ?>'); $this->colAddressId = new QDataGridColumn(QApplication::Translate('Address Id'), '<?= $_FORM->dtgContact_Address_Render($_ITEM); ?>'); $this->colFirstName = new QDataGridColumn(QApplication::Translate('First Name'), '<?= QString::Truncate($_ITEM->FirstName, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->FirstName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->FirstName, false))); $this->colLastName = new QDataGridColumn(QApplication::Translate('Last Name'), '<?= QString::Truncate($_ITEM->LastName, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->LastName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->LastName, false))); $this->colTitle = new QDataGridColumn(QApplication::Translate('Title'), '<?= QString::Truncate($_ITEM->Title, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->Title), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->Title, false))); $this->colEmail = new QDataGridColumn(QApplication::Translate('Email'), '<?= QString::Truncate($_ITEM->Email, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->Email), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->Email, false))); $this->colPhoneOffice = new QDataGridColumn(QApplication::Translate('Phone Office'), '<?= QString::Truncate($_ITEM->PhoneOffice, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->PhoneOffice), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->PhoneOffice, false))); $this->colPhoneHome = new QDataGridColumn(QApplication::Translate('Phone Home'), '<?= QString::Truncate($_ITEM->PhoneHome, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->PhoneHome), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->PhoneHome, false))); $this->colPhoneMobile = new QDataGridColumn(QApplication::Translate('Phone Mobile'), '<?= QString::Truncate($_ITEM->PhoneMobile, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->PhoneMobile), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->PhoneMobile, false))); $this->colFax = new QDataGridColumn(QApplication::Translate('Fax'), '<?= QString::Truncate($_ITEM->Fax, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->Fax), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->Fax, false))); $this->colDescription = new QDataGridColumn(QApplication::Translate('Description'), '<?= QString::Truncate($_ITEM->Description, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->Description), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->Description, false))); $this->colCreatedBy = new QDataGridColumn(QApplication::Translate('Created By'), '<?= $_FORM->dtgContact_CreatedByObject_Render($_ITEM); ?>'); $this->colCreationDate = new QDataGridColumn(QApplication::Translate('Creation Date'), '<?= $_FORM->dtgContact_CreationDate_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->CreationDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->CreationDate, false))); $this->colModifiedBy = new QDataGridColumn(QApplication::Translate('Modified By'), '<?= $_FORM->dtgContact_ModifiedByObject_Render($_ITEM); ?>'); $this->colModifiedDate = new QDataGridColumn(QApplication::Translate('Modified Date'), '<?= QString::Truncate($_ITEM->ModifiedDate, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->ModifiedDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->ModifiedDate, false))); $this->colContactCustomFieldHelper = new QDataGridColumn(QApplication::Translate('Contact Custom Field Helper'), '<?= $_FORM->dtgContact_ContactCustomFieldHelper_Render($_ITEM); ?>'); // Setup DataGrid $this->dtgContact = new QDataGrid($this); $this->dtgContact->CellSpacing = 0; $this->dtgContact->CellPadding = 4; $this->dtgContact->BorderStyle = QBorderStyle::Solid; $this->dtgContact->BorderWidth = 1; $this->dtgContact->GridLines = QGridLines::Both; // Datagrid Paginator $this->dtgContact->Paginator = new QPaginator($this->dtgContact); $this->dtgContact->ItemsPerPage = 10; // Specify Whether or Not to Refresh using Ajax $this->dtgContact->UseAjax = false; // Specify the local databind method this datagrid will use $this->dtgContact->SetDataBinder('dtgContact_Bind'); $this->dtgContact->AddColumn($this->colEditLinkColumn); $this->dtgContact->AddColumn($this->colContactId); $this->dtgContact->AddColumn($this->colCompanyId); $this->dtgContact->AddColumn($this->colAddressId); $this->dtgContact->AddColumn($this->colFirstName); $this->dtgContact->AddColumn($this->colLastName); $this->dtgContact->AddColumn($this->colTitle); $this->dtgContact->AddColumn($this->colEmail); $this->dtgContact->AddColumn($this->colPhoneOffice); $this->dtgContact->AddColumn($this->colPhoneHome); $this->dtgContact->AddColumn($this->colPhoneMobile); $this->dtgContact->AddColumn($this->colFax); $this->dtgContact->AddColumn($this->colDescription); $this->dtgContact->AddColumn($this->colCreatedBy); $this->dtgContact->AddColumn($this->colCreationDate); $this->dtgContact->AddColumn($this->colModifiedBy); $this->dtgContact->AddColumn($this->colModifiedDate); $this->dtgContact->AddColumn($this->colContactCustomFieldHelper); }
protected function lstToContact_Create() { $this->lstToContact = new QListBox($this); $this->lstToContact->Name = QApplication::Translate('To Contact'); $this->lstToContact->Required = true; if (!$this->blnEditMode) { $this->lstToContact->AddItem('- Select One -', null); } $objToContactArray = Contact::LoadArrayByCompanyId(QApplication::$TracmorSettings->CompanyId, QQ::Clause(QQ::OrderBy(QQN::Contact()->LastName, QQN::Contact()->FirstName))); if ($objToContactArray) { foreach ($objToContactArray as $objToContact) { $objListItem = new QListItem($objToContact->__toString(), $objToContact->ContactId); if ($this->objReceipt->ToContact && $this->objReceipt->ToContact->ContactId == $objToContact->ContactId) { $objListItem->Selected = true; } $this->lstToContact->AddItem($objListItem); } } $this->lstToContact->TabIndex = 3; $this->intNextTabIndex++; }
protected function dtgContact_Create() { $this->dtgContact = new QDataGrid($this); $this->dtgContact->Name = 'contact_list'; $this->dtgContact->CellPadding = 5; $this->dtgContact->CellSpacing = 0; $this->dtgContact->CssClass = "datagrid"; // Disable AJAX for the datagrid $this->dtgContact->UseAjax = false; // Allow for column toggling $this->dtgContact->ShowColumnToggle = true; // Allow for CSV Export $this->dtgContact->ShowExportCsv = true; // Enable Pagination $objPaginator = new QPaginator($this->dtgContact); $this->dtgContact->Paginator = $objPaginator; $this->dtgContact->ItemsPerPage = QApplication::$TracmorSettings->SearchResultsPerPage; // Add Check boxes $this->dtgContact->AddColumn(new QDataGridColumnExt('<?= $_CONTROL->chkSelectAll_Render() ?>', '<?=$_CONTROL->chkSelected_Render($_ITEM->ContactId) ?>', 'CssClass="dtg_column"', 'HtmlEntities=false')); $this->dtgContact->AddColumn(new QDataGridColumnExt('ID', '<?= $_ITEM->ContactId ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->ContactId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->ContactId, false), 'CssClass' => "dtg_column", 'HtmlEntities' => false))); $this->dtgContact->AddColumn(new QDataGridColumnExt('<img src=../images/icons/attachment_gray.gif border=0 title=Attachments alt=Attachments>', '<?= Attachment::toStringIcon($_ITEM->GetVirtualAttribute(\'attachment_count\')); ?>', 'SortByCommand="__attachment_count ASC"', 'ReverseSortByCommand="__attachment_count DESC"', 'CssClass="dtg_column"', 'HtmlEntities="false"')); $this->dtgContact->AddColumn(new QDataGridColumnExt('Name', '<?= $_ITEM->__toStringWithLink("bluelink") ?>', 'SortByCommand="last_name ASC, first_name DESC"', 'ReverseSortByCommand="last_name DESC, first_name DESC"', 'CssClass="dtg_column"', 'HtmlEntities=false')); $this->dtgContact->AddColumn(new QDataGridColumnExt('Title', '<?= $_ITEM->Title ?>', 'Width=200', 'SortByCommand="title ASC"', 'ReverseSortByCommand="title DESC"', 'CssClass="dtg_column"')); $this->dtgContact->AddColumn(new QDataGridColumnExt('Company', '<?= $_ITEM->Company->__toStringWithLink("bluelink") ?>', 'SortByCommand="contact__company_id__short_description ASC"', 'ReverseSortByCommand="contact__company_id__short_description DESC"', 'CssClass="dtg_column"', 'HtmlEntities=false')); $this->dtgContact->AddColumn(new QDataGridColumnExt('Email', '<?= $_ITEM->Email ?>', 'SortByCommand="email ASC"', 'ReverseSortByCommand="email DESC"', 'CssClass="dtg_column"')); $this->dtgContact->AddColumn(new QDataGridColumnExt('Address', '<?= ($_ITEM->Address instanceof Address) ? $_ITEM->Address->__toStringWithLink("bluelink") : "" ?>', 'SortByCommand="contact__address_id__short_description ASC"', 'ReverseSortByCommand="contact__address_id__short_description DESC"', 'CssClass="dtg_column"', 'HtmlEntities=false')); // Add the custom field columns with Display set to false. These can be shown by using the column toggle menu. $objCustomFieldArray = CustomField::LoadObjCustomFieldArray(8, false); if ($objCustomFieldArray) { foreach ($objCustomFieldArray as $objCustomField) { //Only add the custom field column if the role has authorization to view it. if ($objCustomField->objRoleAuthView && $objCustomField->objRoleAuthView->AuthorizedFlag) { $this->dtgContact->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->dtgContact->SortColumnIndex = 3; $this->dtgContact->SortDirection = 0; $objStyle = $this->dtgContact->RowStyle; $objStyle->ForeColor = '#000000'; $objStyle->BackColor = '#FFFFFF'; $objStyle->FontSize = 12; $objStyle = $this->dtgContact->AlternateRowStyle; $objStyle->BackColor = '#EFEFEF'; $objStyle = $this->dtgContact->HeaderRowStyle; $objStyle->ForeColor = '#000000'; $objStyle->BackColor = '#EFEFEF'; $objStyle->CssClass = 'dtg_header'; $this->dtgContact->SetDataBinder('dtgContact_Bind'); }
public function lstToCompany_Select() { if ($this->pnlShipmentMassEdit->lstToCompany->SelectedValue) { $objCompany = Company::Load($this->pnlShipmentMassEdit->lstToCompany->SelectedValue); if ($objCompany) { // Load the values for the 'To Contact' List if ($this->pnlShipmentMassEdit->lstToContact) { $objToContactArray = Contact::LoadArrayByCompanyId($objCompany->CompanyId, QQ::Clause(QQ::OrderBy(QQN::Contact()->LastName, QQN::Contact()->FirstName))); $this->pnlShipmentMassEdit->lstToContact->RemoveAllItems(); if ($objToContactArray) { foreach ($objToContactArray as $objToContact) { $objListItem = new QListItem($objToContact->__toString(), $objToContact->ContactId); $this->pnlShipmentMassEdit->lstToContact->AddItem($objListItem); } $this->pnlShipmentMassEdit->lstToContact->Enabled = true; } } // Load the values for the 'To Address' List if ($this->pnlShipmentMassEdit->lstToAddress) { $objToAddressArray = Address::LoadArrayByCompanyId($objCompany->CompanyId, QQ::Clause(QQ::OrderBy(QQN::Address()->ShortDescription))); $this->pnlShipmentMassEdit->lstToAddress->RemoveAllItems(); if ($objToAddressArray) { foreach ($objToAddressArray as $objToAddress) { $objListItem = new QListItem($objToAddress->__toString(), $objToAddress->AddressId); $this->pnlShipmentMassEdit->lstToAddress->AddItem($objListItem); } $this->pnlShipmentMassEdit->lstToAddress->Enabled = true; //$this->lstToAddress_Select(); } } } } }
protected function dtgContact_Create() { $this->dtgContact = new QDataGrid($this); $this->dtgContact->CellPadding = 5; $this->dtgContact->CellSpacing = 0; $this->dtgContact->CssClass = "datagrid"; // Enable AJAX - this won't work while using the DB profiler $this->dtgContact->UseAjax = true; // Enable Pagination, and set to 20 items per page $objPaginator = new QPaginator($this->dtgContact); $this->dtgContact->Paginator = $objPaginator; $this->dtgContact->ItemsPerPage = 10; $this->dtgContact->AddColumn(new QDataGridColumn(QApplication::Translate('Name'), '<?= $_ITEM->__toStringWithLink("bluelink") ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->LastName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->LastName, false), 'CssClass' => "dtg_column", 'HtmlEntities' => false))); $this->dtgContact->AddColumn(new QDataGridColumn(QApplication::Translate('Title'), '<?= $_ITEM->Title ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->Title), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->Title, false), 'Width' => "200", 'CssClass' => "dtg_column"))); $this->dtgContact->AddColumn(new QDataGridColumn(QApplication::Translate('Email'), '<?= $_ITEM->Email ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->Email), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->Email, false), 'CssClass' => "dtg_column"))); $this->dtgContact->SortColumnIndex = 0; $this->dtgContact->SortDirection = 0; $objStyle = $this->dtgContact->RowStyle; $objStyle->ForeColor = '#000000'; $objStyle->BackColor = '#FFFFFF'; $objStyle->FontSize = 12; $objStyle = $this->dtgContact->AlternateRowStyle; $objStyle->BackColor = '#EFEFEF'; $objStyle = $this->dtgContact->HeaderRowStyle; $objStyle->ForeColor = '#000000'; $objStyle->BackColor = '#EFEFEF'; $objStyle->CssClass = 'dtg_header'; }
public function lstToCompany_Select() { if ($this->lstToCompany->SelectedValue) { $objCompany = Company::Load($this->lstToCompany->SelectedValue); if ($objCompany) { // Load the values for the 'To Contact' List if ($this->lstToContact) { $objToContactArray = Contact::LoadArrayByCompanyId($objCompany->CompanyId, QQ::Clause(QQ::OrderBy(QQN::Contact()->LastName, QQN::Contact()->FirstName))); $this->lstToContact->RemoveAllItems(); $this->lstToContact->AddItem('- Select One -', null); if ($objToContactArray) { foreach ($objToContactArray as $objToContact) { $objListItem = new QListItem($objToContact->__toString(), $objToContact->ContactId); $this->lstToContact->AddItem($objListItem); } $this->lstToContact->Enabled = true; } } } } else { $this->lstToContact->Enabled = false; $this->lstToContact->RemoveAllItems(); $this->lstToContact->AddItem('- Select One -', null); } }
protected function lstToCompany_Select() { $this->disableAdvancedIfInternal(); // Clear any displayed warnings if ($this->lblNewToContact) { $this->lblNewToContact->Warning = ''; $this->lblNewToAddress->Warning = ''; } if ($this->lstToCompany->SelectedValue) { $objCompany = Company::Load($this->lstToCompany->SelectedValue); if ($objCompany) { // Load the values for the 'To Contact' List if ($this->lstToContact) { $objToContactArray = Contact::LoadArrayByCompanyId($objCompany->CompanyId, QQ::Clause(QQ::OrderBy(QQN::Contact()->LastName, QQN::Contact()->FirstName))); if ($this->lstToContact->SelectedValue) { $SelectedContactId = $this->lstToContact->SelectedValue; } elseif ($this->objShipment->ToContactId) { $SelectedContactId = $this->objShipment->ToContactId; } else { $SelectedContactId = null; } $this->lstToContact->RemoveAllItems(); $this->lstToContact->AddItem('- Select One -', null); if ($objToContactArray) { foreach ($objToContactArray as $objToContact) { $objListItem = new QListItem($objToContact->__toString(), $objToContact->ContactId); if ($SelectedContactId == $objToContact->ContactId) { $objListItem->Selected = true; } $this->lstToContact->AddItem($objListItem); } $this->lstToContact->Enabled = true; } } // Load the values for the 'To Address' List if ($this->lstToAddress) { $objToAddressArray = Address::LoadArrayByCompanyId($objCompany->CompanyId, QQ::Clause(QQ::OrderBy(QQN::Address()->ShortDescription))); if ($this->lstToAddress->SelectedValue) { $SelectedAddressId = $this->lstToAddress->SelectedValue; } elseif ($this->objShipment->ToAddressId) { $SelectedAddressId = $this->objShipment->ToAddressId; } else { $SelectedAddressId = null; } $this->lstToAddress->RemoveAllItems(); $this->lstToAddress->AddItem('- Select One -', null); if ($objToAddressArray) { foreach ($objToAddressArray as $objToAddress) { $objListItem = new QListItem($objToAddress->__toString(), $objToAddress->AddressId); if ($SelectedAddressId == $objToAddress->AddressId) { $objListItem->Selected = true; } $this->lstToAddress->AddItem($objListItem); } $this->lstToAddress->Enabled = true; $this->lstToAddress_Select(); } } } } }
public function lstToCompany_Select() { if ($this->lstToCompany->SelectedValue) { $objCompany = Company::Load($this->lstToCompany->SelectedValue); if ($objCompany) { // Load the values for the 'To Contact' List if ($this->lstToContact) { $objToContactArray = Contact::LoadArrayByCompanyId($objCompany->CompanyId, QQ::Clause(QQ::OrderBy(QQN::Contact()->LastName, QQN::Contact()->FirstName))); $this->lstToContact->RemoveAllItems(); $this->lstToContact->AddItem('Any', 'any_' . $objCompany->CompanyId); if ($objToContactArray) { foreach ($objToContactArray as $objToContact) { $objListItem = new QListItem($objToContact->__toString(), $objToContact->ContactId); $this->lstToContact->AddItem($objListItem); } //$this->lstToContact->Enabled = true; } // For companies that have no contacts // Removed because SQL-query causes no errors /*else { $this->lstToContact->RemoveAllItems(); $this->lstToContact->AddItem('- Select One -', null); }*/ } } } else { //$this->lstToContact->Enabled = false; $this->lstToContact->RemoveAllItems(); $this->lstToContact->AddItem('- Select One -', null); $this->lstToContact->AddItem('Any', 'any'); } }
/** * Count Contacts * by CompanyId Index(es) * @param integer $intCompanyId * @return int */ public static function CountByCompanyId($intCompanyId, $objOptionalClauses = null) { // Call Contact::QueryCount to perform the CountByCompanyId query return Contact::QueryCount(QQ::Equal(QQN::Contact()->CompanyId, $intCompanyId), $objOptionalClauses); }
/** * Used internally by the Meta-based Add Column tools. * * Given a QQNode or a Text String, this will return a Contact-based QQNode. * It will also verify that it is a proper Contact-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 == 'contact') { 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 "contact".'); } } else { if (is_string($mixContent)) { switch ($mixContent) { case 'ContactId': return QQN::Contact()->ContactId; case 'CompanyId': return QQN::Contact()->CompanyId; case 'Company': return QQN::Contact()->Company; case 'AddressId': return QQN::Contact()->AddressId; case 'Address': return QQN::Contact()->Address; case 'FirstName': return QQN::Contact()->FirstName; case 'LastName': return QQN::Contact()->LastName; case 'Title': return QQN::Contact()->Title; case 'Email': return QQN::Contact()->Email; case 'PhoneOffice': return QQN::Contact()->PhoneOffice; case 'PhoneHome': return QQN::Contact()->PhoneHome; case 'PhoneMobile': return QQN::Contact()->PhoneMobile; case 'Fax': return QQN::Contact()->Fax; case 'Description': return QQN::Contact()->Description; case 'CreatedBy': return QQN::Contact()->CreatedBy; case 'CreatedByObject': return QQN::Contact()->CreatedByObject; case 'CreationDate': return QQN::Contact()->CreationDate; case 'ModifiedBy': return QQN::Contact()->ModifiedBy; case 'ModifiedByObject': return QQN::Contact()->ModifiedByObject; case 'ModifiedDate': return QQN::Contact()->ModifiedDate; case 'ContactCustomFieldHelper': return QQN::Contact()->ContactCustomFieldHelper; default: throw new QCallerException('Simple Property not found in ContactDataGrid 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'); } } } }
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->dtgContact_EditLinkColumn_Render($_ITEM) ?>'); $this->colEditLinkColumn->HtmlEntities = false; $this->colContactId = new QDataGridColumn(QApplication::Translate('Contact Id'), '<?= $_ITEM->ContactId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->ContactId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->ContactId, false))); $this->colCompanyId = new QDataGridColumn(QApplication::Translate('Company Id'), '<?= $_CONTROL->ParentControl->dtgContact_Company_Render($_ITEM); ?>'); $this->colAddressId = new QDataGridColumn(QApplication::Translate('Address Id'), '<?= $_CONTROL->ParentControl->dtgContact_Address_Render($_ITEM); ?>'); $this->colFirstName = new QDataGridColumn(QApplication::Translate('First Name'), '<?= QString::Truncate($_ITEM->FirstName, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->FirstName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->FirstName, false))); $this->colLastName = new QDataGridColumn(QApplication::Translate('Last Name'), '<?= QString::Truncate($_ITEM->LastName, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->LastName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->LastName, false))); $this->colTitle = new QDataGridColumn(QApplication::Translate('Title'), '<?= QString::Truncate($_ITEM->Title, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->Title), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->Title, false))); $this->colEmail = new QDataGridColumn(QApplication::Translate('Email'), '<?= QString::Truncate($_ITEM->Email, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->Email), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->Email, false))); $this->colPhoneOffice = new QDataGridColumn(QApplication::Translate('Phone Office'), '<?= QString::Truncate($_ITEM->PhoneOffice, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->PhoneOffice), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->PhoneOffice, false))); $this->colPhoneHome = new QDataGridColumn(QApplication::Translate('Phone Home'), '<?= QString::Truncate($_ITEM->PhoneHome, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->PhoneHome), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->PhoneHome, false))); $this->colPhoneMobile = new QDataGridColumn(QApplication::Translate('Phone Mobile'), '<?= QString::Truncate($_ITEM->PhoneMobile, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->PhoneMobile), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->PhoneMobile, false))); $this->colFax = new QDataGridColumn(QApplication::Translate('Fax'), '<?= QString::Truncate($_ITEM->Fax, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->Fax), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->Fax, false))); $this->colDescription = new QDataGridColumn(QApplication::Translate('Description'), '<?= QString::Truncate($_ITEM->Description, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->Description), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->Description, false))); $this->colCreatedBy = new QDataGridColumn(QApplication::Translate('Created By'), '<?= $_CONTROL->ParentControl->dtgContact_CreatedByObject_Render($_ITEM); ?>'); $this->colCreationDate = new QDataGridColumn(QApplication::Translate('Creation Date'), '<?= $_CONTROL->ParentControl->dtgContact_CreationDate_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->CreationDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->CreationDate, false))); $this->colModifiedBy = new QDataGridColumn(QApplication::Translate('Modified By'), '<?= $_CONTROL->ParentControl->dtgContact_ModifiedByObject_Render($_ITEM); ?>'); $this->colModifiedDate = new QDataGridColumn(QApplication::Translate('Modified Date'), '<?= QString::Truncate($_ITEM->ModifiedDate, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Contact()->ModifiedDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Contact()->ModifiedDate, false))); // Setup DataGrid $this->dtgContact = new QDataGrid($this); $this->dtgContact->CellSpacing = 0; $this->dtgContact->CellPadding = 4; $this->dtgContact->BorderStyle = QBorderStyle::Solid; $this->dtgContact->BorderWidth = 1; $this->dtgContact->GridLines = QGridLines::Both; // Datagrid Paginator $this->dtgContact->Paginator = new QPaginator($this->dtgContact); $this->dtgContact->ItemsPerPage = 10; // Specify Whether or Not to Refresh using Ajax $this->dtgContact->UseAjax = true; // Specify the local databind method this datagrid will use $this->dtgContact->SetDataBinder('dtgContact_Bind', $this); $this->dtgContact->AddColumn($this->colEditLinkColumn); $this->dtgContact->AddColumn($this->colContactId); $this->dtgContact->AddColumn($this->colCompanyId); $this->dtgContact->AddColumn($this->colAddressId); $this->dtgContact->AddColumn($this->colFirstName); $this->dtgContact->AddColumn($this->colLastName); $this->dtgContact->AddColumn($this->colTitle); $this->dtgContact->AddColumn($this->colEmail); $this->dtgContact->AddColumn($this->colPhoneOffice); $this->dtgContact->AddColumn($this->colPhoneHome); $this->dtgContact->AddColumn($this->colPhoneMobile); $this->dtgContact->AddColumn($this->colFax); $this->dtgContact->AddColumn($this->colDescription); $this->dtgContact->AddColumn($this->colCreatedBy); $this->dtgContact->AddColumn($this->colCreationDate); $this->dtgContact->AddColumn($this->colModifiedBy); $this->dtgContact->AddColumn($this->colModifiedDate); // Setup the Create New button $this->btnCreateNew = new QButton($this); $this->btnCreateNew->Text = QApplication::Translate('Create a New') . ' ' . QApplication::Translate('Contact'); $this->btnCreateNew->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCreateNew_Click')); }
/** * Count Contacts * by CompanyId Index(es) * @param integer $intCompanyId * @return int */ public static function CountByCompanyId($intCompanyId) { // Call Contact::QueryCount to perform the CountByCompanyId query return Contact::QueryCount(QQ::Equal(QQN::Contact()->CompanyId, $intCompanyId)); }