public function executeIndex(sfWebRequest $request) { //get request parameters $this->selectedBrand = $this->getRequestParameter('brand'); $this->selectedSeries = $this->getRequestParameter('series'); $this->selectedModel = $this->getRequestParameter('model'); $cConfig = new Criteria(); $cConfig->addJoin(ConfigPeer::MODEL_ID, ModelPeer::ID); $cConfig->addJoin(ModelPeer::SERIES_ID, SeriesPeer::ID); $cConfig->addJoin(SeriesPeer::BRAND_ID, BrandPeer::ID); if ($this->selectedBrand) { $cConfig->add(BrandPeer::ID, $this->selectedBrand); } if ($this->selectedSeries) { $cConfig->add(SeriesPeer::SERIES_NAME, $this->selectedSeries, Criteria::LIKE); } if ($this->selectedModel) { $cConfig->add(ModelPeer::MODEL_NAME, $this->selectedModel, Criteria::LIKE); } //$this->Configs = ConfigPeer::doSelect($cConfig); //paginatiom $pager = new sfPropelPager('Config', 15); $pager->setCriteria($cConfig); $pager->setPage($this->getRequestParameter('page')); $pager->init(); $this->pager = $pager; //get config columns $c = new Criteria(); $c->addDescendingOrderByColumn(ConfigFieldCategoryPeer::WEIGHT); $this->configFieldCategories = ConfigFieldCategoryPeer::doSelect($c); //get brands $cBrand = new Criteria(); $this->brands = BrandPeer::doSelect($cBrand); }
/** * Executes index action * * @param sfRequest $request A request object */ public function executeIndex(sfWebRequest $request) { //tabs array, we add tab items to it $this->tabs = array(); //get available brands $this->brands = BrandPeer::doSelect(new Criteria()); $tabIndex = 1; $this->tabs[$tabIndex]['title'] = 'برند'; $this->tabs[$tabIndex]['content'] = $this->renderBrands($this->brands); ++$tabIndex; //get field sets $this->configFieldCategories = ConfigFieldCategoryPeer::doSelect(new Criteria()); foreach ($this->configFieldCategories as $configFieldCategory) { $this->tabs[$tabIndex]['title'] = $configFieldCategory->getName(); $this->tabs[$tabIndex]['content'] = $this->renderFieldCategory($configFieldCategory); ++$tabIndex; } }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(ConfigFieldCategoryPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(ConfigFieldCategoryPeer::DATABASE_NAME); $criteria->add(ConfigFieldCategoryPeer::ID, $pks, Criteria::IN); $objs = ConfigFieldCategoryPeer::doSelect($criteria, $con); } return $objs; }
public function executeGetConfigEditor(sfWebRequest $request) { $cid = $request->getParameter('config_id'); if ($cid != -1) { $config = ConfigPeer::retrieveByPK($cid); $this->values = $config->getConfigFieldValues(); } else { $this->values = array(); } $this->cats = ConfigFieldCategoryPeer::doSelect(new Criteria()); }