protected function lstCountry_Create() { $this->lstCountry = new QListBox($this); $this->lstCountry->Name = QApplication::Translate('Country'); $this->lstCountry->Required = true; $this->lstCountry->AddItem('- Select One -', null); $this->lstCountry->AddItem('United States', 228); $objCountryArray = Country::LoadAll(); if ($objCountryArray) { foreach ($objCountryArray as $objCountry) { $objListItem = new QListItem($objCountry->__toString(), $objCountry->CountryId); if ($this->objAddress->Country && $this->objAddress->Country->CountryId == $objCountry->CountryId) { $objListItem->Selected = true; } $this->lstCountry->AddItem($objListItem); } } $this->lstCountry->AddAction(new QChangeEvent(), new QAjaxControlAction($this, 'lstCountry_Select')); }
protected function dtgCountry_Bind() { // Because we want to enable pagination AND sorting, we need to setup the $objClauses array to send to LoadAll() // Remember! We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below $this->dtgCountry->TotalItemCount = Country::CountAll(); // Setup the $objClauses Array $objClauses = array(); // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add // the OrderByClause to the $objClauses array if ($objClause = $this->dtgCountry->OrderByClause) { array_push($objClauses, $objClause); } // Add the LimitClause information, as well if ($objClause = $this->dtgCountry->LimitClause) { array_push($objClauses, $objClause); } // Set the DataSource to be the array of all Country objects, given the clauses above $this->dtgCountry->DataSource = Country::LoadAll($objClauses); }
/** * Refresh this MetaControl with Data from the local Person object. * @param boolean $blnReload reload Person from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objPerson->Reload(); } if ($this->lblId) { if ($this->blnEditMode) { $this->lblId->Text = $this->objPerson->Id; } } if ($this->lstPersonType) { $this->lstPersonType->SelectedValue = $this->objPerson->PersonTypeId; } if ($this->lblPersonTypeId) { $this->lblPersonTypeId->Text = $this->objPerson->PersonTypeId ? PersonType::$NameArray[$this->objPerson->PersonTypeId] : null; } if ($this->txtUsername) { $this->txtUsername->Text = $this->objPerson->Username; } if ($this->lblUsername) { $this->lblUsername->Text = $this->objPerson->Username; } if ($this->txtPassword) { $this->txtPassword->Text = $this->objPerson->Password; } if ($this->lblPassword) { $this->lblPassword->Text = $this->objPerson->Password; } if ($this->txtFirstName) { $this->txtFirstName->Text = $this->objPerson->FirstName; } if ($this->lblFirstName) { $this->lblFirstName->Text = $this->objPerson->FirstName; } if ($this->txtLastName) { $this->txtLastName->Text = $this->objPerson->LastName; } if ($this->lblLastName) { $this->lblLastName->Text = $this->objPerson->LastName; } if ($this->txtEmail) { $this->txtEmail->Text = $this->objPerson->Email; } if ($this->lblEmail) { $this->lblEmail->Text = $this->objPerson->Email; } if ($this->txtDisplayName) { $this->txtDisplayName->Text = $this->objPerson->DisplayName; } if ($this->lblDisplayName) { $this->lblDisplayName->Text = $this->objPerson->DisplayName; } if ($this->chkPasswordResetFlag) { $this->chkPasswordResetFlag->Checked = $this->objPerson->PasswordResetFlag; } if ($this->lblPasswordResetFlag) { $this->lblPasswordResetFlag->Text = $this->objPerson->PasswordResetFlag ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->chkDisplayRealNameFlag) { $this->chkDisplayRealNameFlag->Checked = $this->objPerson->DisplayRealNameFlag; } if ($this->lblDisplayRealNameFlag) { $this->lblDisplayRealNameFlag->Text = $this->objPerson->DisplayRealNameFlag ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->chkDisplayEmailFlag) { $this->chkDisplayEmailFlag->Checked = $this->objPerson->DisplayEmailFlag; } if ($this->lblDisplayEmailFlag) { $this->lblDisplayEmailFlag->Text = $this->objPerson->DisplayEmailFlag ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->chkOptInFlag) { $this->chkOptInFlag->Checked = $this->objPerson->OptInFlag; } if ($this->lblOptInFlag) { $this->lblOptInFlag->Text = $this->objPerson->OptInFlag ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->chkDonatedFlag) { $this->chkDonatedFlag->Checked = $this->objPerson->DonatedFlag; } if ($this->lblDonatedFlag) { $this->lblDonatedFlag->Text = $this->objPerson->DonatedFlag ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->txtLocation) { $this->txtLocation->Text = $this->objPerson->Location; } if ($this->lblLocation) { $this->lblLocation->Text = $this->objPerson->Location; } if ($this->lstCountry) { $this->lstCountry->RemoveAllItems(); $this->lstCountry->AddItem(QApplication::Translate('- Select One -'), null); $objCountryArray = Country::LoadAll(); if ($objCountryArray) { foreach ($objCountryArray as $objCountry) { $objListItem = new QListItem($objCountry->__toString(), $objCountry->Id); if ($this->objPerson->Country && $this->objPerson->Country->Id == $objCountry->Id) { $objListItem->Selected = true; } $this->lstCountry->AddItem($objListItem); } } } if ($this->lblCountryId) { $this->lblCountryId->Text = $this->objPerson->Country ? $this->objPerson->Country->__toString() : null; } if ($this->txtUrl) { $this->txtUrl->Text = $this->objPerson->Url; } if ($this->lblUrl) { $this->lblUrl->Text = $this->objPerson->Url; } if ($this->lstTimezone) { $this->lstTimezone->RemoveAllItems(); $this->lstTimezone->AddItem(QApplication::Translate('- Select One -'), null); $objTimezoneArray = Timezone::LoadAll(); if ($objTimezoneArray) { foreach ($objTimezoneArray as $objTimezone) { $objListItem = new QListItem($objTimezone->__toString(), $objTimezone->Id); if ($this->objPerson->Timezone && $this->objPerson->Timezone->Id == $objTimezone->Id) { $objListItem->Selected = true; } $this->lstTimezone->AddItem($objListItem); } } } if ($this->lblTimezoneId) { $this->lblTimezoneId->Text = $this->objPerson->Timezone ? $this->objPerson->Timezone->__toString() : null; } if ($this->calRegistrationDate) { $this->calRegistrationDate->DateTime = $this->objPerson->RegistrationDate; } if ($this->lblRegistrationDate) { $this->lblRegistrationDate->Text = sprintf($this->objPerson->RegistrationDate) ? $this->objPerson->__toString($this->strRegistrationDateDateTimeFormat) : null; } if ($this->lstTopicsAsEmail) { $this->lstTopicsAsEmail->RemoveAllItems(); $objAssociatedArray = $this->objPerson->GetTopicAsEmailArray(); $objTopicArray = Topic::LoadAll(); if ($objTopicArray) { foreach ($objTopicArray as $objTopic) { $objListItem = new QListItem($objTopic->__toString(), $objTopic->Id); foreach ($objAssociatedArray as $objAssociated) { if ($objAssociated->Id == $objTopic->Id) { $objListItem->Selected = true; } } $this->lstTopicsAsEmail->AddItem($objListItem); } } } if ($this->lblTopicsAsEmail) { $objAssociatedArray = $this->objPerson->GetTopicAsEmailArray(); $strItems = array(); foreach ($objAssociatedArray as $objAssociated) { $strItems[] = $objAssociated->__toString(); } $this->lblTopicsAsEmail->Text = implode($strGlue, $strItems); } if ($this->lstTopicsAsReadOnce) { $this->lstTopicsAsReadOnce->RemoveAllItems(); $objAssociatedArray = $this->objPerson->GetTopicAsReadOnceArray(); $objTopicArray = Topic::LoadAll(); if ($objTopicArray) { foreach ($objTopicArray as $objTopic) { $objListItem = new QListItem($objTopic->__toString(), $objTopic->Id); foreach ($objAssociatedArray as $objAssociated) { if ($objAssociated->Id == $objTopic->Id) { $objListItem->Selected = true; } } $this->lstTopicsAsReadOnce->AddItem($objListItem); } } } if ($this->lblTopicsAsReadOnce) { $objAssociatedArray = $this->objPerson->GetTopicAsReadOnceArray(); $strItems = array(); foreach ($objAssociatedArray as $objAssociated) { $strItems[] = $objAssociated->__toString(); } $this->lblTopicsAsReadOnce->Text = implode($strGlue, $strItems); } if ($this->lstTopicsAsRead) { $this->lstTopicsAsRead->RemoveAllItems(); $objAssociatedArray = $this->objPerson->GetTopicAsReadArray(); $objTopicArray = Topic::LoadAll(); if ($objTopicArray) { foreach ($objTopicArray as $objTopic) { $objListItem = new QListItem($objTopic->__toString(), $objTopic->Id); foreach ($objAssociatedArray as $objAssociated) { if ($objAssociated->Id == $objTopic->Id) { $objListItem->Selected = true; } } $this->lstTopicsAsRead->AddItem($objListItem); } } } if ($this->lblTopicsAsRead) { $objAssociatedArray = $this->objPerson->GetTopicAsReadArray(); $strItems = array(); foreach ($objAssociatedArray as $objAssociated) { $strItems[] = $objAssociated->__toString(); } $this->lblTopicsAsRead->Text = implode($strGlue, $strItems); } }
protected function lstCountry_Create() { $this->lstCountry = new QListBox($this); $this->lstCountry->Name = 'Country'; $this->lstCountry->AddItem('- ALL -', null); foreach (Country::LoadAll() as $objCountry) { $this->lstCountry->AddItem($objCountry->ShortDescription, $objCountry->CountryId); } // Add actions for when this input is changed $this->lstCountry->AddAction(new QChangeEvent(), new QServerAction('lstCountry_Select')); $this->lstCountry->AddAction(new QEnterKeyEvent(), new QServerAction('lstCountry_Select')); $this->lstCountry->AddAction(new QEnterKeyEvent(), new QTerminateAction()); }
protected function lstCountry_Create() { $this->lstCountry = new QListBox($this); $this->lstCountry->Name = QApplication::Translate('Country'); $this->lstCountry->Required = true; if (!$this->blnEditMode) { $this->lstCountry->AddItem(QApplication::Translate('- Select One -'), null); } $objCountryArray = Country::LoadAll(); if ($objCountryArray) { foreach ($objCountryArray as $objCountry) { $objListItem = new QListItem($objCountry->__toString(), $objCountry->CountryId); if ($this->objAddress->Country && $this->objAddress->Country->CountryId == $objCountry->CountryId) { $objListItem->Selected = true; } $this->lstCountry->AddItem($objListItem); } } }
protected function lstCountry_Create() { $this->lstCountry = new QListBox($this); $this->lstCountry->Name = QApplication::Translate('Country'); if (!$this->blnEditMode) { $this->lstCountry->AddItem('- Select One -', null); $this->lstCountry->AddItem('United States', 228); } $objCountryArray = Country::LoadAll(); if ($objCountryArray) { foreach ($objCountryArray as $objCountry) { $objListItem = new QListItem($objCountry->__toString(), $objCountry->CountryId); $this->lstCountry->AddItem($objListItem); } } $this->lstCountry->AddAction(new QChangeEvent(), new QAjaxAction('lstCountry_Select')); $this->lstCountry->TabIndex = $this->intTabIndex++; }
public function dtgCountry_Bind() { // Get Total Count b/c of Pagination $this->dtgCountry->TotalItemCount = Country::CountAll(); $objClauses = array(); if ($objClause = $this->dtgCountry->OrderByClause) { array_push($objClauses, $objClause); } if ($objClause = $this->dtgCountry->LimitClause) { array_push($objClauses, $objClause); } $this->dtgCountry->DataSource = Country::LoadAll($objClauses); }
/** * Refresh this MetaControl with Data from the local Address object. * @param boolean $blnReload reload Address from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objAddress->Reload(); } if ($this->lblAddressId) { if ($this->blnEditMode) { $this->lblAddressId->Text = $this->objAddress->AddressId; } } if ($this->lstCompany) { $this->lstCompany->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstCompany->AddItem(QApplication::Translate('- Select One -'), null); } $objCompanyArray = Company::LoadAll(); if ($objCompanyArray) { foreach ($objCompanyArray as $objCompany) { $objListItem = new QListItem($objCompany->__toString(), $objCompany->CompanyId); if ($this->objAddress->Company && $this->objAddress->Company->CompanyId == $objCompany->CompanyId) { $objListItem->Selected = true; } $this->lstCompany->AddItem($objListItem); } } } if ($this->lblCompanyId) { $this->lblCompanyId->Text = $this->objAddress->Company ? $this->objAddress->Company->__toString() : null; } if ($this->txtShortDescription) { $this->txtShortDescription->Text = $this->objAddress->ShortDescription; } if ($this->lblShortDescription) { $this->lblShortDescription->Text = $this->objAddress->ShortDescription; } if ($this->lstCountry) { $this->lstCountry->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstCountry->AddItem(QApplication::Translate('- Select One -'), null); } $objCountryArray = Country::LoadAll(); if ($objCountryArray) { foreach ($objCountryArray as $objCountry) { $objListItem = new QListItem($objCountry->__toString(), $objCountry->CountryId); if ($this->objAddress->Country && $this->objAddress->Country->CountryId == $objCountry->CountryId) { $objListItem->Selected = true; } $this->lstCountry->AddItem($objListItem); } } } if ($this->lblCountryId) { $this->lblCountryId->Text = $this->objAddress->Country ? $this->objAddress->Country->__toString() : null; } if ($this->txtAddress1) { $this->txtAddress1->Text = $this->objAddress->Address1; } if ($this->lblAddress1) { $this->lblAddress1->Text = $this->objAddress->Address1; } if ($this->txtAddress2) { $this->txtAddress2->Text = $this->objAddress->Address2; } if ($this->lblAddress2) { $this->lblAddress2->Text = $this->objAddress->Address2; } if ($this->txtCity) { $this->txtCity->Text = $this->objAddress->City; } if ($this->lblCity) { $this->lblCity->Text = $this->objAddress->City; } if ($this->lstStateProvince) { $this->lstStateProvince->RemoveAllItems(); $this->lstStateProvince->AddItem(QApplication::Translate('- Select One -'), null); $objStateProvinceArray = StateProvince::LoadAll(); if ($objStateProvinceArray) { foreach ($objStateProvinceArray as $objStateProvince) { $objListItem = new QListItem($objStateProvince->__toString(), $objStateProvince->StateProvinceId); if ($this->objAddress->StateProvince && $this->objAddress->StateProvince->StateProvinceId == $objStateProvince->StateProvinceId) { $objListItem->Selected = true; } $this->lstStateProvince->AddItem($objListItem); } } } if ($this->lblStateProvinceId) { $this->lblStateProvinceId->Text = $this->objAddress->StateProvince ? $this->objAddress->StateProvince->__toString() : null; } if ($this->txtPostalCode) { $this->txtPostalCode->Text = $this->objAddress->PostalCode; } if ($this->lblPostalCode) { $this->lblPostalCode->Text = $this->objAddress->PostalCode; } if ($this->lstCreatedByObject) { $this->lstCreatedByObject->RemoveAllItems(); $this->lstCreatedByObject->AddItem(QApplication::Translate('- Select One -'), null); $objCreatedByObjectArray = UserAccount::LoadAll(); if ($objCreatedByObjectArray) { foreach ($objCreatedByObjectArray as $objCreatedByObject) { $objListItem = new QListItem($objCreatedByObject->__toString(), $objCreatedByObject->UserAccountId); if ($this->objAddress->CreatedByObject && $this->objAddress->CreatedByObject->UserAccountId == $objCreatedByObject->UserAccountId) { $objListItem->Selected = true; } $this->lstCreatedByObject->AddItem($objListItem); } } } if ($this->lblCreatedBy) { $this->lblCreatedBy->Text = $this->objAddress->CreatedByObject ? $this->objAddress->CreatedByObject->__toString() : null; } if ($this->calCreationDate) { $this->calCreationDate->DateTime = $this->objAddress->CreationDate; } if ($this->lblCreationDate) { $this->lblCreationDate->Text = sprintf($this->objAddress->CreationDate) ? $this->objAddress->__toString($this->strCreationDateDateTimeFormat) : null; } if ($this->lstModifiedByObject) { $this->lstModifiedByObject->RemoveAllItems(); $this->lstModifiedByObject->AddItem(QApplication::Translate('- Select One -'), null); $objModifiedByObjectArray = UserAccount::LoadAll(); if ($objModifiedByObjectArray) { foreach ($objModifiedByObjectArray as $objModifiedByObject) { $objListItem = new QListItem($objModifiedByObject->__toString(), $objModifiedByObject->UserAccountId); if ($this->objAddress->ModifiedByObject && $this->objAddress->ModifiedByObject->UserAccountId == $objModifiedByObject->UserAccountId) { $objListItem->Selected = true; } $this->lstModifiedByObject->AddItem($objListItem); } } } if ($this->lblModifiedBy) { $this->lblModifiedBy->Text = $this->objAddress->ModifiedByObject ? $this->objAddress->ModifiedByObject->__toString() : null; } if ($this->lblModifiedDate) { if ($this->blnEditMode) { $this->lblModifiedDate->Text = $this->objAddress->ModifiedDate; } } if ($this->lstAddressCustomFieldHelper) { $this->lstAddressCustomFieldHelper->RemoveAllItems(); $this->lstAddressCustomFieldHelper->AddItem(QApplication::Translate('- Select One -'), null); $objAddressCustomFieldHelperArray = AddressCustomFieldHelper::LoadAll(); if ($objAddressCustomFieldHelperArray) { foreach ($objAddressCustomFieldHelperArray as $objAddressCustomFieldHelper) { $objListItem = new QListItem($objAddressCustomFieldHelper->__toString(), $objAddressCustomFieldHelper->AddressId); if ($objAddressCustomFieldHelper->AddressId == $this->objAddress->AddressId) { $objListItem->Selected = true; } $this->lstAddressCustomFieldHelper->AddItem($objListItem); } } // Because AddressCustomFieldHelper's AddressCustomFieldHelper is not null, if a value is already selected, it cannot be changed. if ($this->lstAddressCustomFieldHelper->SelectedValue) { $this->lstAddressCustomFieldHelper->Enabled = false; } else { $this->lstAddressCustomFieldHelper->Enabled = true; } } if ($this->lblAddressCustomFieldHelper) { $this->lblAddressCustomFieldHelper->Text = $this->objAddress->AddressCustomFieldHelper ? $this->objAddress->AddressCustomFieldHelper->__toString() : null; } }
/** * Default / simple DataBinder for this Meta DataGrid. This can easily be overridden * by calling SetDataBinder() on this DataGrid with another DataBinder of your choice. * * If a paginator is set on this DataBinder, it will use it. If not, then no pagination will be used. * It will also perform any sorting (if applicable). */ public function MetaDataBinder() { // Remember! We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below if ($this->Paginator) { $this->TotalItemCount = Country::CountAll(); } // Setup the $objClauses Array $objClauses = array(); // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add // the OrderByClause to the $objClauses array if ($objClause = $this->OrderByClause) { array_push($objClauses, $objClause); } // Add the LimitClause information, as well if ($objClause = $this->LimitClause) { array_push($objClauses, $objClause); } // Set the DataSource to be a Query result from Country, given the clauses above $this->DataSource = Country::LoadAll($objClauses); }
/** * Refresh this MetaControl with Data from the local StateProvince object. * @param boolean $blnReload reload StateProvince from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objStateProvince->Reload(); } if ($this->lblStateProvinceId) { if ($this->blnEditMode) { $this->lblStateProvinceId->Text = $this->objStateProvince->StateProvinceId; } } if ($this->lstCountry) { $this->lstCountry->RemoveAllItems(); $this->lstCountry->AddItem(QApplication::Translate('- Select One -'), null); $objCountryArray = Country::LoadAll(); if ($objCountryArray) { foreach ($objCountryArray as $objCountry) { $objListItem = new QListItem($objCountry->__toString(), $objCountry->CountryId); if ($this->objStateProvince->Country && $this->objStateProvince->Country->CountryId == $objCountry->CountryId) { $objListItem->Selected = true; } $this->lstCountry->AddItem($objListItem); } } } if ($this->lblCountryId) { $this->lblCountryId->Text = $this->objStateProvince->Country ? $this->objStateProvince->Country->__toString() : null; } if ($this->txtShortDescription) { $this->txtShortDescription->Text = $this->objStateProvince->ShortDescription; } if ($this->lblShortDescription) { $this->lblShortDescription->Text = $this->objStateProvince->ShortDescription; } if ($this->txtAbbreviation) { $this->txtAbbreviation->Text = $this->objStateProvince->Abbreviation; } if ($this->lblAbbreviation) { $this->lblAbbreviation->Text = $this->objStateProvince->Abbreviation; } }