当前位置: 首页>>代码示例>>PHP>>正文


PHP sfPropelPager::setResults方法代码示例

本文整理汇总了PHP中sfPropelPager::setResults方法的典型用法代码示例。如果您正苦于以下问题:PHP sfPropelPager::setResults方法的具体用法?PHP sfPropelPager::setResults怎么用?PHP sfPropelPager::setResults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfPropelPager的用法示例。


在下文中一共展示了sfPropelPager::setResults方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getMainList

 public static function getMainList($documentId, $moduleName, $page = 1, $filter = null)
 {
     try {
         if ($moduleName == "Tag") {
             $moduleName = "Admin";
         }
         $mainList = XMLParser::getXMLdataValues(sfConfig::get('sf_root_dir') . "/apps/backend/modules/" . strtolower($moduleName) . "/config/mainList.xml");
         $displayedObjects = array();
         foreach ($mainList as $obj) {
             if ($obj['tag'] == 'OBJECT' && $obj['type'] == 'complete') {
                 $displayedObjects[] = $obj['value'];
             }
         }
         $c = new Criteria();
         if (empty($filter)) {
             if ($documentId > 0) {
                 $context = sfContext::getInstance();
                 $user = $context->getUser();
                 $user->setAttribute('search_keys', false);
                 $owner = $user->getSubscriber();
                 $ownerId = $owner->getId();
                 /*if($owner->getType() != "admin")
                 		{
                 			$c->addJoin(RelationPeer::ID2, DocumentPeer::ID, Criteria::LEFT_JOIN );
                 			$c->add(DocumentPeer::DOCUMENT_AUTHOR, $ownerId);
                 		}*/
                 $pager = new sfPropelPager("Relation", 50);
                 $c->add(RelationPeer::ID1, $documentId);
                 $c->add(RelationPeer::DOCUMENT_MODEL2, $displayedObjects, Criteria::IN);
                 $c->addAscendingOrderByColumn(RelationPeer::SORT_ORDER);
             } else {
                 $results['children'] = null;
                 $results['pager'] = null;
                 return $results;
             }
         } else {
             BackendFilters::$filter($c, $pager);
             if (!is_object($pager)) {
                 $pager = new sfPropelPager($pager, 50);
             }
         }
         if (get_class($c) == "Criteria") {
             $pager->setCriteria($c);
         } else {
             $pager->setResults($c);
         }
         $pager->setPage($page);
         $pager->init();
         if (empty($filter)) {
             foreach ($pager->getResults() as $relation) {
                 $id = $relation->getId2();
                 $children[] = Document::getDocumentInstance($id);
             }
         } else {
             $children = $pager->getResults();
         }
         $results['children'] = $children;
         $results['pager'] = $pager;
         return $results;
     } catch (Exception $e) {
         exit($e->getMessage());
     }
 }
开发者ID:kotow,项目名称:work,代码行数:63,代码来源:BackendService.class.php

示例2: pager

 public static function pager($model, $criteria = null, $limit = 10)
 {
     $request = sfContext::getInstance()->getRequest();
     $pager = new sfPropelPager($model, $limit);
     if (is_array($criteria)) {
         $pager->setResults($criteria);
     } else {
         if (is_null($criteria)) {
             $criteria = new Criteria();
         }
         $pager->setCriteria($criteria);
     }
     $request = sfContext::getInstance()->getRequest();
     $pager->setPage($request->getParameter('page'));
     $pager->init();
     return $pager;
 }
开发者ID:kotow,项目名称:work,代码行数:17,代码来源:UtilsHelper.php

示例3: getMainList

 public static function getMainList(&$documentId, $moduleName, $page = 1)
 {
     $moduleName = strtolower($moduleName);
     try {
         if ($moduleName == "settings") {
             $settingsArr = array();
             if (is_readable(sfConfig::get('sf_root_dir') . "/config/settings.xml")) {
                 $objects = XMLParser::getXMLdataValues(sfConfig::get('sf_root_dir') . "/config/settings.xml");
             }
             foreach ($objects as $obj) {
                 if ($obj['tag'] == 'ELEMENT' && $obj['type'] == 'open') {
                     $objName = $obj['attributes']['LABEL'];
                     $objDescription = $obj['attributes']['DESCRIPTION'];
                 }
                 if ($obj['tag'] == 'ITEM' && $obj['type'] == 'complete') {
                     //$val = $obj['attributes']['VALUE'];
                     $settingName = $objName;
                     //$settingName = strtolower($objName);
                     $settingsArr[$settingName] = $objDescription;
                 }
             }
             $pager = new sfPropelPager("Relation", 20);
             $pager->setResults($settingsArr);
             $pager->setPage($page);
             $pager->init();
             foreach ($pager->getResults() as $name => $label) {
                 $res['children'][$name] = $label;
             }
             $res['paging'] = $pager->paging(true);
             return $res;
         }
         if ($moduleName == "labels") {
             $localesArr = array();
             if (is_readable(sfConfig::get('sf_root_dir') . "/config/locales.xml")) {
                 $objects = XMLParser::getXMLdataValues(sfConfig::get('sf_root_dir') . "/config/locales.xml");
                 foreach ($objects as $obj) {
                     if ($obj['tag'] == 'LOCALE' && $obj['type'] == 'open') {
                         $objName = $obj['attributes']['LABEL'];
                         if ($obj['attributes']['DESCRIPTION']) {
                             $objDescription = $obj['attributes']['DESCRIPTION'];
                         } else {
                             $objDescription = '[' . $obj['attributes']['LABEL'] . ']';
                         }
                     }
                     if ($obj['tag'] == 'ITEM' && $obj['type'] == 'complete') {
                         //$val = $obj['attributes']['VALUE'];
                         $localeName = $objName;
                         //$localeName = strtolower($objName);
                         $localesArr[$localeName] = $objDescription;
                     }
                 }
             }
             $pager = new sfPropelPager("Relation", 20);
             $pager->setResults($localesArr);
             $pager->setPage($page);
             $pager->init();
             foreach ($pager->getResults() as $name => $label) {
                 $res['children'][$name] = $label;
             }
             $res['paging'] = $pager->paging(true);
             return $res;
         }
         $mainList = XMLParser::getXMLdataValues(sfConfig::get('sf_root_dir') . "/apps/panel/modules/" . $moduleName . "/config/mainList.xml");
         $displayedObjects = array();
         $rootId = null;
         foreach ($mainList as $obj) {
             if ($obj['tag'] == 'OBJECT' && $obj['type'] == 'complete') {
                 $displayedObjects[] = $obj['value'];
             }
             // check overwrite RootID
             if ($obj['tag'] == 'OBJECTS' && $obj['type'] == 'open') {
                 if (array_key_exists("attributes", $obj) && array_key_exists("PARENT", $obj['attributes'])) {
                     $rootName = $obj['attributes']['PARENT'];
                     $rootDocument = Rootfolder::getRootfolderByModule($rootName);
                     if ($rootDocument) {
                         $rootId = $rootDocument->getId();
                     }
                 }
                 if (array_key_exists("attributes", $obj) && array_key_exists("TAG", $obj['attributes'])) {
                     $tag = $obj['attributes']['TAG'];
                     $rootDocument = Document::getDocumentByExclusiveTag($tag);
                     if ($rootDocument) {
                         $rootId = $rootDocument->getId();
                     }
                 }
             }
         }
         $children = array();
         $res = array('children' => array(), 'paging' => '');
         $c = new Criteria();
         if (!$documentId) {
             if ($rootId) {
                 $documentId = $rootId;
             } else {
                 $document = Rootfolder::getRootfolderByModule($moduleName);
                 if ($document) {
                     $documentId = $document->getId();
                 }
             }
         }
//.........这里部分代码省略.........
开发者ID:kotow,项目名称:work,代码行数:101,代码来源:PanelService.class.php


注:本文中的sfPropelPager::setResults方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。