當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Institution::setName方法代碼示例

本文整理匯總了PHP中Institution::setName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Institution::setName方法的具體用法?PHP Institution::setName怎麽用?PHP Institution::setName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Institution的用法示例。


在下文中一共展示了Institution::setName方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: institutions

 private function institutions($data)
 {
     $q = $this->getRequestParameter("q", '');
     if (!$q) {
         throw new BadRequestException('A search string must be provided.');
     }
     $page = $this->getRequestParameter("page", '1');
     $limit = $this->getRequestParameter("limit", self::PAGE_SIZE);
     $culture = $this->getRequestParameter("culture", 'es');
     $type = $this->getRequestParameter("type", false);
     $this->getUser()->setCulture($culture);
     $cl = new SphinxClient();
     $dbConf = Propel::getConfiguration();
     $dsn = $dbConf['datasources']['propel']['connection']['dsn'];
     $sphinxServer = sfConfig::get('sf_sphinx_server');
     $cl->SetServer($sphinxServer, 3312);
     $this->limit = 1000;
     $cl->SetLimits(0, $this->limit, $this->limit);
     $cl->SetArrayResult(true);
     #instituciones
     $this->res = $cl->Query($q, "institucion_{$culture}");
     $cl->SetFieldWeights(array('vanity' => 5));
     $cl->SetSortMode(SPH_SORT_RELEVANCE);
     $institutions = array();
     if ($this->res !== false) {
         if (isset($this->res["matches"]) && is_array($this->res["matches"])) {
             $c = new Criteria();
             $list = array();
             foreach ($this->res["matches"] as $idx => $match) {
                 $list[] = $match['id'];
             }
             $c->add(InstitucionPeer::ID, $list, Criteria::IN);
             $c->addAscendingOrderByColumn(InstitucionPeer::ORDEN);
             //$instituciones = InstitucionPeer::doSelect($c);
             $pager = new sfPropelPager('Institucion', $limit);
             $pager->setCriteria($c);
             $pager->setPage($this->getRequestParameter('page', $page));
             $pager->init();
             foreach ($pager->getResults() as $aInstitution) {
                 $institution = new Institution();
                 $institution->setId($aInstitution->getId());
                 $institution->setVanity($aInstitution->getVanity());
                 $institution->setName($aInstitution->getNombreCorto());
                 $institution->setLongName($aInstitution->getNombre());
                 $institutions[] = $institution;
             }
         }
     }
     return $institutions;
 }
開發者ID:voota,項目名稱:voota,代碼行數:50,代碼來源:actions.class.php


注:本文中的Institution::setName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。