Esempio n. 1
0
File: view.php Progetto: alcf/chms
 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;
 }
Esempio n. 2
0
File: post.php Progetto: alcf/chms
 protected function Form_Create()
 {
     $objPost = ClassifiedPost::Load(QApplication::PathInfo(0));
     if (!$objPost) {
         QApplication::Redirect('/classifieds/');
     }
     $this->mctPost = new ClassifiedPostMetaControl($this, $objPost);
     $this->strPageTitle = 'Classifieds - Edit Post';
     $this->txtTitle = $this->mctPost->txtTitle_Create();
     $this->txtTitle->Required = true;
     $this->txtContent = $this->mctPost->txtContent_Create();
     $this->txtContent->Required = true;
     $this->lstClassifiedCategory = $this->mctPost->lstClassifiedCategory_Create();
     $this->lstClassifiedCategory->Required = true;
     $this->calDatePosted = $this->mctPost->calDatePosted_Create();
     $this->calDatePosted->Required = true;
     $this->calDateExpired = $this->mctPost->calDateExpired_Create();
     $this->calDateExpired->Required = true;
     $this->chkApprovalFlag = $this->mctPost->chkApprovalFlag_Create();
     $this->lblName = $this->mctPost->lblName_Create();
     $this->lblPhone = $this->mctPost->lblPhone_Create();
     $this->lblEmail = $this->mctPost->lblEmail_Create();
     $this->btnSave = new QButton($this);
     $this->btnSave->Text = 'Update';
     $this->btnSave->CssClass = 'primary';
     $this->btnSave->AddAction(new QClickEvent(), new QAjaxAction('btnSave_Click'));
     $this->btnSave->CausesValidation = true;
     $this->btnCancel = new QLinkButton($this);
     $this->btnCancel->Text = 'Cancel';
     $this->btnCancel->CssClass = 'cancel';
     $this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('btnCancel_Click'));
     $this->btnCancel->AddAction(new QClickEvent(), new QTerminateAction());
     $this->btnDelete = new QLinkButton($this);
     $this->btnDelete->Text = 'Delete';
     $this->btnDelete->CssClass = 'delete';
     $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction('Are you SURE you want to DELETE this post?  Generally this is not needed.  Simply leaving it in Not Approved status will keep it off the main website.'));
     $this->btnDelete->AddAction(new QClickEvent(), new QAjaxAction('btnDelete_Click'));
     $this->btnDelete->AddAction(new QClickEvent(), new QTerminateAction());
 }
Esempio n. 3
0
 /**
  * Reload this ClassifiedPost from the database.
  * @return void
  */
 public function Reload()
 {
     // Make sure we are actually Restored from the database
     if (!$this->__blnRestored) {
         throw new QCallerException('Cannot call Reload() on a new, unsaved ClassifiedPost object.');
     }
     // Reload the Object
     $objReloaded = ClassifiedPost::Load($this->intId);
     // Update $this's local variables to match
     $this->ClassifiedCategoryId = $objReloaded->ClassifiedCategoryId;
     $this->blnApprovalFlag = $objReloaded->blnApprovalFlag;
     $this->strTitle = $objReloaded->strTitle;
     $this->strContent = $objReloaded->strContent;
     $this->dttDatePosted = $objReloaded->dttDatePosted;
     $this->dttDateExpired = $objReloaded->dttDateExpired;
     $this->strName = $objReloaded->strName;
     $this->strPhone = $objReloaded->strPhone;
     $this->strEmail = $objReloaded->strEmail;
 }
 /**
  * Static Helper Method to Create using PK arguments
  * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
  * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
  * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to 
  * edit, or if we are also allowed to create a new one, etc.
  * 
  * @param mixed $objParentObject QForm or QPanel which will be using this ClassifiedPostMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing ClassifiedPost object creation - defaults to CreateOrEdit
  * @return ClassifiedPostMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objClassifiedPost = ClassifiedPost::Load($intId);
         // ClassifiedPost was found -- return it!
         if ($objClassifiedPost) {
             return new ClassifiedPostMetaControl($objParentObject, $objClassifiedPost);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a ClassifiedPost object with PK arguments: ' . $intId);
             }
         }
         // If EditOnly is specified, throw an exception
     } else {
         if ($intCreateType == QMetaControlCreateType::EditOnly) {
             throw new QCallerException('No PK arguments specified');
         }
     }
     // If we are here, then we need to create a new record
     return new ClassifiedPostMetaControl($objParentObject, new ClassifiedPost());
 }