コード例 #1
0
ファイル: view.php プロジェクト: 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;
 }
コード例 #2
0
ファイル: post.php プロジェクト: 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());
 }
コード例 #3
0
    /**
     * Deletes all associated ClassifiedPosts
     * @return void
     */
    public function DeleteAllClassifiedPosts()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateClassifiedPost on this unsaved ClassifiedCategory.');
        }
        // Get the Database Object for this Class
        $objDatabase = ClassifiedCategory::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (ClassifiedPost::LoadArrayByClassifiedCategoryId($this->intId) as $objClassifiedPost) {
                $objClassifiedPost->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`classified_post`
				WHERE
					`classified_category_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }
コード例 #4
0
 /**
  * Main utility method to aid with data binding.  It is used by the default BindAllRows() databinder but
  * could and should be used by any custom databind methods that would be used for instances of this
  * MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause. 
  *
  * 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).
  *
  * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself
  * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query		 
  * @return void
  */
 public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null)
 {
     // Setup input parameters to default values if none passed in
     if (!$objCondition) {
         $objCondition = QQ::All();
     }
     $objClauses = $objOptionalClauses ? $objOptionalClauses : array();
     // We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = ClassifiedPost::QueryCount($objCondition, $objClauses);
     }
     // 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 ClassifiedPost, given the clauses above
     $this->DataSource = ClassifiedPost::QueryArray($objCondition, $objClauses);
 }
コード例 #5
0
ファイル: ClassifiedPostGen.class.php プロジェクト: alcf/chms
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, ClassifiedPost::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
コード例 #6
0
 /**
  * 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());
 }