public function MoveDown() { $blnFound = false; foreach (ClassifiedCategory::LoadAll(QQ::OrderBy(QQN::ClassifiedCategory()->OrderNumber)) as $objObject) { if ($blnFound) { break; } if ($objObject->Id == $this->Id) { $blnFound = true; } } $this->OrderNumber++; $this->Save(); if ($objObject) { $objObject->OrderNumber--; $objObject->Save(); } self::RefreshOrderNumber(); }
protected function Form_Create() { $this->dtgPosts = new ClassifiedPostDataGrid($this); $this->dtgPosts->FontSize = '10px'; $this->dtgPosts->MetaAddColumn(QQN::ClassifiedPost()->DatePosted, 'Width=90px'); $this->dtgPosts->MetaAddColumn(QQN::ClassifiedPost()->DateExpired, 'Width=80px'); $this->dtgPosts->MetaAddColumn('Title', 'Html=<?= $_FORM->RenderTitle($_ITEM); ?>', 'Width=200px', 'HtmlEntities=false'); $this->dtgPosts->MetaAddColumn(QQN::ClassifiedPost()->ClassifiedCategory->Name, 'Name=Category', 'Width=100px'); $this->dtgPosts->MetaAddColumn(QQN::ClassifiedPost()->ApprovalFlag, 'Name=Displayed', 'Html=<?= $_FORM->RenderApproved($_ITEM); ?>', 'Width=80px'); $this->dtgPosts->MetaAddColumn(QQN::ClassifiedPost()->Name, 'Width=80px'); $this->dtgPosts->MetaAddColumn(QQN::ClassifiedPost()->Email, 'Width=100px'); $this->dtgPosts->MetaAddColumn(QQN::ClassifiedPost()->Phone, 'Width=80px'); $this->dtgPosts->SortColumnIndex = 0; $this->dtgPosts->SortDirection = 1; $this->dtgPosts->NoDataHtml = '<span style="font-size: 14px; font-style: normal; "><strong>No Posts Found.</strong> Try a less-restrictive criteria using the filters above.</span>'; $this->lstCategory = new QListBox($this); $this->lstCategory->AddItem('- View All -', null); foreach (ClassifiedCategory::LoadAll(QQ::OrderBy(QQN::ClassifiedCategory()->OrderNumber)) as $objCategory) { $this->lstCategory->AddItem($objCategory->Name, $objCategory->Id); } $this->lstApproval = new QListBox($this); $this->lstApproval->AddItem('- View All -', null); $this->lstApproval->AddItem('Already Approved', true); $this->lstApproval->AddItem('Not Yet Approved', false, true); $this->lstExpiration = new QListBox($this); $this->lstExpiration->AddItem('- View All -', null); $this->lstExpiration->AddItem('Already Expired', true); $this->lstExpiration->AddItem('Not Yet Expired', false, true); $this->txtTitle = new QTextBox($this); $this->txtName = new QTextBox($this); $this->dtgPosts->SetDataBinder('dtgPosts_Bind'); $this->lstApproval->AddAction(new QChangeEvent(), new QAjaxAction('Filter_Refresh')); $this->lstCategory->AddAction(new QChangeEvent(), new QAjaxAction('Filter_Refresh')); $this->lstExpiration->AddAction(new QChangeEvent(), new QAjaxAction('Filter_Refresh')); $this->txtTitle->AddAction(new QChangeEvent(), new QAjaxAction('Filter_Refresh')); $this->txtName->AddAction(new QChangeEvent(), new QAjaxAction('Filter_Refresh')); $this->txtTitle->AddAction(new QEnterKeyEvent(), new QAjaxAction('Filter_Refresh')); $this->txtTitle->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $this->txtName->AddAction(new QEnterKeyEvent(), new QAjaxAction('Filter_Refresh')); $this->txtName->AddAction(new QEnterKeyEvent(), new QTerminateAction()); }
public function dtrCategories_Bind() { $this->dtrCategories->DataSource = ClassifiedCategory::LoadAll(QQ::OrderBy(QQN::ClassifiedCategory()->OrderNumber)); }
/** * Refresh this MetaControl with Data from the local ClassifiedPost object. * @param boolean $blnReload reload ClassifiedPost from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objClassifiedPost->Reload(); } if ($this->lblId) { if ($this->blnEditMode) { $this->lblId->Text = $this->objClassifiedPost->Id; } } if ($this->lstClassifiedCategory) { $this->lstClassifiedCategory->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstClassifiedCategory->AddItem(QApplication::Translate('- Select One -'), null); } $objClassifiedCategoryArray = ClassifiedCategory::LoadAll(); if ($objClassifiedCategoryArray) { foreach ($objClassifiedCategoryArray as $objClassifiedCategory) { $objListItem = new QListItem($objClassifiedCategory->__toString(), $objClassifiedCategory->Id); if ($this->objClassifiedPost->ClassifiedCategory && $this->objClassifiedPost->ClassifiedCategory->Id == $objClassifiedCategory->Id) { $objListItem->Selected = true; } $this->lstClassifiedCategory->AddItem($objListItem); } } } if ($this->lblClassifiedCategoryId) { $this->lblClassifiedCategoryId->Text = $this->objClassifiedPost->ClassifiedCategory ? $this->objClassifiedPost->ClassifiedCategory->__toString() : null; } if ($this->chkApprovalFlag) { $this->chkApprovalFlag->Checked = $this->objClassifiedPost->ApprovalFlag; } if ($this->lblApprovalFlag) { $this->lblApprovalFlag->Text = $this->objClassifiedPost->ApprovalFlag ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->txtTitle) { $this->txtTitle->Text = $this->objClassifiedPost->Title; } if ($this->lblTitle) { $this->lblTitle->Text = $this->objClassifiedPost->Title; } if ($this->txtContent) { $this->txtContent->Text = $this->objClassifiedPost->Content; } if ($this->lblContent) { $this->lblContent->Text = $this->objClassifiedPost->Content; } if ($this->calDatePosted) { $this->calDatePosted->DateTime = $this->objClassifiedPost->DatePosted; } if ($this->lblDatePosted) { $this->lblDatePosted->Text = sprintf($this->objClassifiedPost->DatePosted) ? $this->objClassifiedPost->__toString($this->strDatePostedDateTimeFormat) : null; } if ($this->calDateExpired) { $this->calDateExpired->DateTime = $this->objClassifiedPost->DateExpired; } if ($this->lblDateExpired) { $this->lblDateExpired->Text = sprintf($this->objClassifiedPost->DateExpired) ? $this->objClassifiedPost->__toString($this->strDateExpiredDateTimeFormat) : null; } if ($this->txtName) { $this->txtName->Text = $this->objClassifiedPost->Name; } if ($this->lblName) { $this->lblName->Text = $this->objClassifiedPost->Name; } if ($this->txtPhone) { $this->txtPhone->Text = $this->objClassifiedPost->Phone; } if ($this->lblPhone) { $this->lblPhone->Text = $this->objClassifiedPost->Phone; } if ($this->txtEmail) { $this->txtEmail->Text = $this->objClassifiedPost->Email; } if ($this->lblEmail) { $this->lblEmail->Text = $this->objClassifiedPost->Email; } }