Esempio n. 1
0
File: list.php Progetto: alcf/chms
 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.';
 }
Esempio n. 2
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. 3
0
 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();
 }
Esempio n. 4
0
File: post.php Progetto: alcf/chms
 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());
 }
 public function run()
 {
     ClassifiedCategory::create(array('title' => 'Vozila', 'description' => 'Automobili, kamioni, motocikli, auto-delovi', 'class' => 'fa-car', 'slug' => 'vozila'));
     ClassifiedCategory::create(array('title' => 'Nekretnine', 'description' => 'Kuće, stanovi, garaže, vikendice, placevi', 'class' => 'fa-home', 'slug' => 'nekretnine'));
     ClassifiedCategory::create(array('title' => 'Kućni ljubimci', 'description' => 'Prodaja, poklanjanje, hrana za ljubimce', 'class' => 'fa-paw', 'slug' => 'kucni-ljubimci'));
     ClassifiedCategory::create(array('title' => 'Telefoni', 'description' => 'Mobilni i fiksni telefoni, oprema, prodaja/zamena, delovi', 'class' => 'fa-phone', 'slug' => 'telefoni'));
     ClassifiedCategory::create(array('title' => 'Nameštaj i pokućstvo', 'description' => 'Stolovi, stolice, kreveti, ormari, kuhinje, antikviteti, tepisi', 'class' => 'fa-archive', 'slug' => 'namestaj-pokucstvo'));
     ClassifiedCategory::create(array('title' => 'Računari', 'description' => 'PC računari, tableti, monitori, komponente, štampači, mrežna oprema, servisi', 'class' => 'fa-laptop ', 'slug' => 'racunari'));
     ClassifiedCategory::create(array('title' => 'Audio, TV, Foto', 'description' => 'Televizori, foto aparati, zvučnici, kamere, oprema', 'class' => 'fa-camera', 'slug' => 'audio-tv-foto'));
     ClassifiedCategory::create(array('title' => 'Poljoprivreda', 'description' => 'Traktori, kombajni, kosilice, ostale poljoprivredne mašine, domaće životinje, seme, sadnice', 'class' => 'fa-leaf', 'slug' => 'poljoprivreda'));
     ClassifiedCategory::create(array('title' => 'Mašine, alati, oprema', 'description' => 'Industrijski i zanatski proizvodi, mašine, alati, pumpe, kompresori, kancelarijski aparati i oprema', 'class' => 'fa-wrench', 'slug' => 'audio-tv-foto'));
     ClassifiedCategory::create(array('title' => 'Sport i rekreacija', 'description' => 'Sportska odeća i obuća, roleri, fitnes oprema, oprema za lov i ribolov, kamp oprema, bicikli', 'class' => 'fa-soccer-ball-o', 'slug' => 'sport-rekreacija'));
     ClassifiedCategory::create(array('title' => 'Kućni aparati', 'description' => 'Frižideri, zamrzivači, grejna tela, mali kućni aparati, bela tehnika, bojleri, klima uređaji, šivaće mašine', 'class' => 'fa-plug', 'slug' => 'kucni-aparati'));
     ClassifiedCategory::create(array('title' => 'Zdravlje', 'description' => 'Profesionalna medicinska oprema, ortopedska pomogala, medicinski aparati, usluge', 'class' => 'fa-stethoscope', 'slug' => 'zdravlje'));
     ClassifiedCategory::create(array('title' => 'Odeća, obuća i dodaci', 'description' => 'Ženska, muška i dečija odeća i obuća, modni dodaci, tekstil, pozamanterija', 'class' => 'fa-suitcase', 'slug' => 'odeca-obuca'));
     ClassifiedCategory::create(array('title' => 'Sve za decu', 'description' => 'Oprema za bebe, odeća, obuća, bicikli, igračke, nameštaj, knjige', 'class' => 'fa-child', 'slug' => 'sve-za-decu'));
     ClassifiedCategory::create(array('title' => 'Muzika i instrumenti', 'description' => 'Gitare, harmonike, bubnjevi, klaviri, duvački i gudački instrumenti, pribor i oprema', 'class' => 'fa-music', 'slug' => 'muzicki-instrumenti'));
     ClassifiedCategory::create(array('title' => 'Usluge', 'description' => 'Građevinske usluge, Transport i selidba, podučavanje, knjigovodstvene usluge, servis i popravka, stolarske, krojačke, pravne usluge', 'class' => 'fa-life-saver', 'slug' => 'usluge'));
     ClassifiedCategory::create(array('title' => 'Lični oglasi', 'description' => 'Ona traži njega, On traži nju', 'class' => 'fa-heart', 'slug' => 'licni-oglasi'));
 }
Esempio n. 6
0
File: index.php Progetto: alcf/chms
 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());
 }
Esempio n. 7
0
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, ClassifiedCategory::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
 /**
  * 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 = ClassifiedCategory::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 ClassifiedCategory, given the clauses above
     $this->DataSource = ClassifiedCategory::QueryArray($objCondition, $objClauses);
 }
 /**
  * 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 ClassifiedCategoryMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing ClassifiedCategory object creation - defaults to CreateOrEdit
  * @return ClassifiedCategoryMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objClassifiedCategory = ClassifiedCategory::Load($intId);
         // ClassifiedCategory was found -- return it!
         if ($objClassifiedCategory) {
             return new ClassifiedCategoryMetaControl($objParentObject, $objClassifiedCategory);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a ClassifiedCategory 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 ClassifiedCategoryMetaControl($objParentObject, new ClassifiedCategory());
 }
Esempio n. 10
0
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objClassifiedCategory) {
         $objObject->objClassifiedCategory = ClassifiedCategory::GetSoapObjectFromObject($objObject->objClassifiedCategory, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intClassifiedCategoryId = null;
         }
     }
     if ($objObject->dttDatePosted) {
         $objObject->dttDatePosted = $objObject->dttDatePosted->__toString(QDateTime::FormatSoap);
     }
     if ($objObject->dttDateExpired) {
         $objObject->dttDateExpired = $objObject->dttDateExpired->__toString(QDateTime::FormatSoap);
     }
     return $objObject;
 }
Esempio n. 11
0
 public function pxyMoveUp_Click($strFormId, $strControlId, $strParameter)
 {
     $objObject = ClassifiedCategory::Load($strParameter);
     $objObject->MoveUp();
     $this->dtgCategories->Refresh();
 }
Esempio n. 12
0
 protected function btnDelete_Click()
 {
     $this->mctClassifiedCategory->DeleteClassifiedCategory();
     ClassifiedCategory::RefreshOrderNumber();
     $this->ReturnToList();
 }
Esempio n. 13
0
File: index.php Progetto: alcf/chms
 public function dtrCategories_Bind()
 {
     $this->dtrCategories->DataSource = ClassifiedCategory::LoadAll(QQ::OrderBy(QQN::ClassifiedCategory()->OrderNumber));
 }
 public function showCreateForm()
 {
     $categories = ClassifiedCategory::all();
     return View::make('classifieds.create', array('categories' => $categories));
 }
 /**
  * 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;
     }
 }
 public function showIndex()
 {
     $categories = ClassifiedCategory::all();
     return View::make('index', array('categories' => $categories));
 }