protected function Form_Create() { $this->objCategory = ClassifiedCategory::LoadByToken(QApplication::PathInfo(0)); if (!$this->objCategory) { QApplication::Redirect('/classifieds/'); } $this->strPageTitle .= $this->objCategory->Name; $this->dtgPosts = new ClassifiedPostDataGrid($this); $this->dtgPosts->Paginator = new QPaginator($this->dtgPosts); $this->dtgPosts->MetaAddColumn('DatePosted', 'Html=<?= $_FORM->RenderDatePosted($_ITEM); ?>', 'Width=120px'); $this->dtgPosts->MetaAddColumn('Title', 'Html=<?= $_FORM->RenderTitle($_ITEM); ?>', 'Width=750px', 'HtmlEntities=false'); $this->dtgPosts->SetDataBinder('dtgPosts_Bind'); $this->dtgPosts->SortColumnIndex = 0; $this->dtgPosts->SortDirection = 1; $this->dtgPosts->NoDataHtml = 'There are currently no approved posts that have been posted in the past 90 days.'; }
protected function Form_Create() { $this->objCategory = ClassifiedCategory::LoadByToken(QApplication::PathInfo(0)); if (!$this->objCategory) { QApplication::Redirect('/classifieds/'); } $this->objPost = ClassifiedPost::Load(QApplication::PathInfo(1)); if (!$this->objPost) { QApplication::Redirect('/classifieds/list.php/' . $this->objCategory->Token); } if (!$this->objPost->IsViewable()) { QApplication::Redirect('/classifieds/list.php/' . $this->objCategory->Token); } if ($this->objPost->ClassifiedCategoryId != $this->objCategory->Id) { QApplication::Redirect('/classifieds/list.php/' . $this->objCategory->Token); } $this->strPageTitle .= $this->objPost->Title; }
protected function btnSave_Click($strFormId, $strControlId, $strParameter) { $this->txtName->Text = trim($this->txtName->Text); $this->txtToken->Text = QApplication::Tokenize($this->txtToken->Text); $this->txtDescription->Text = trim($this->txtDescription->Text); $this->txtDisclaimer->Text = trim($this->txtDisclaimer->Text); $this->txtInstructions->Text = trim($this->txtInstructions->Text); // Check Token for Unique if (($objCategory = ClassifiedCategory::LoadByToken($this->txtToken->Text)) && $objCategory->Id != $this->mctClassifiedCategory->ClassifiedCategory->Id) { $this->txtToken->Warning = 'Token is already taken'; $this->txtToken->Blink(); $this->txtToken->Focus(); return; } $this->mctClassifiedCategory->SaveClassifiedCategory(); ClassifiedCategory::RefreshOrderNumber(); $this->ReturnToList(); }
protected function Form_Create() { $this->objCategory = ClassifiedCategory::LoadByToken(QApplication::PathInfo(0)); if (!$this->objCategory) { QApplication::Redirect('/classifieds/'); } $objPost = new ClassifiedPost(); $objPost->ClassifiedCategory = $this->objCategory; $objPost->DatePosted = QDateTime::Now(); $objPost->DateExpired = QDateTime::Now(); $objPost->DateExpired->Day += 90; $objPost->ApprovalFlag = false; $this->mctPost = new ClassifiedPostMetaControl($this, $objPost); $this->txtTitle = $this->mctPost->txtTitle_Create(); $this->txtTitle->Required = true; $this->txtContent = $this->mctPost->txtContent_Create(); $this->txtContent->Required = true; $this->txtName = $this->mctPost->txtName_Create(); $this->txtName->Required = true; $this->txtPhone = $this->mctPost->txtPhone_Create(); $this->txtPhone->Required = true; $this->txtEmail = $this->mctPost->txtEmail_Create(); $this->txtEmail->Required = true; if (QApplication::$PublicLogin && ($objPerson = QApplication::$PublicLogin->Person)) { $this->txtName->Text = $objPerson->Name; if ($objPerson->PrimaryEmail) { $this->txtEmail->Text = $objPerson->PrimaryEmail->Address; } if ($objPerson->PrimaryPhone) { $this->txtPhone->Text = $objPerson->PrimaryPhone->Number; } } $this->btnSubmit = new QButton($this); $this->btnSubmit->AddAction(new QClickEvent(), new QAjaxAction('btnSubmit_Click')); $this->btnSubmit->CssClass = 'primary'; $this->btnSubmit->Text = 'Submit Request'; $this->btnSubmit->CausesValidation = true; $this->btnCancel = new QLinkButton($this); $this->btnCancel->CssClass = 'cancel'; $this->btnCancel->Text = 'Cancel'; $this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('btnCancel_Click')); $this->btnCancel->AddAction(new QClickEvent(), new QTerminateAction()); }