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


PHP Zend_Db_Table_Select::distinct方法代码示例

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


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

示例1: intval

 function __construct(Zend_Db_Table_Select $select, $count = 15, $current = 1)
 {
     $table = $select->getTable();
     $this->select = $select->distinct();
     $this->row_count = $table->countRows($select);
     $this->pages_count = intval(ceil($this->row_count / $count));
     $current = min($current, $this->pages_count);
     // selection les tuples de cette pages.
     $select->limitPage($current, $count);
     $rowset = $table->fetchAll($select);
     parent::__construct($rowset, $count, $current);
     $this->pages_id = range(1, $this->pagesCount(), 1);
 }
开发者ID:bersace,项目名称:strass,代码行数:13,代码来源:Rowset.php

示例2: allAction

 /**
  * Display a list of all users in the system.
  *
  */
 public function allAction()
 {
     $this->view->acl = array('add' => $this->_helper->hasAccess('add'), 'edit' => $this->_helper->hasAccess('edit'), 'delete' => $this->_helper->hasAccess('delete'));
     $filterUsername = $this->_getParam('username');
     $filterFirstName = $this->_getParam('firstName');
     $filterLastName = $this->_getParam('lastName');
     $filterRole = $this->_getParam('role', 'any');
     $filterSort = $this->_getParam('sort', 'username');
     $filterDirection = $this->_getParam('direction', 'asc');
     $form = new Ot_Form_UserSearch();
     $form->populate($this->getAllParams());
     $account = new Ot_Model_DbTable_Account();
     $accountTbl = $account->info('name');
     $select = new Zend_Db_Table_Select($account);
     $select->from($accountTbl);
     if ($filterUsername != '') {
         $select->where($accountTbl . '.username LIKE ?', '%' . $filterUsername . '%');
     }
     if ($filterFirstName != '') {
         $select->where($accountTbl . '.firstName LIKE ?', '%' . $filterFirstName . '%');
     }
     if ($filterLastName != '') {
         $select->where($accountTbl . '.lastName LIKE ?', '%' . $filterLastName . '%');
     }
     if ($filterRole != '' && $filterRole != 'any') {
         $otRole = new Ot_Model_DbTable_AccountRoles();
         $roleTbl = $otRole->info('name');
         $select->join($roleTbl, $accountTbl . '.accountId = ' . $roleTbl . '.accountId', array());
         $select->where($roleTbl . '.roleId = ?', $filterRole);
         $select->distinct();
     }
     if ($filterSort == 'name') {
         $select->order('firstName ' . $filterDirection);
         $select->order('lastName ' . $filterDirection);
     } else {
         $select->order($filterSort . ' ' . $filterDirection);
     }
     $filterOptions = array('username' => $filterUsername, 'lastname' => $filterLastName, 'firstname' => $filterFirstName, 'direction' => $filterDirection, 'role' => $filterRole, 'sort' => $filterSort);
     foreach ($filterOptions as $key => $value) {
         if (!$value) {
             unset($filterOptions[$key]);
         }
     }
     $adapter = new Zend_Paginator_Adapter_DbSelect($select);
     $paginator = new Zend_Paginator($adapter);
     $paginator->setCurrentPageNumber($this->_getParam('page', 1));
     $aa = new Ot_Model_DbTable_AuthAdapter();
     $adapters = $aa->fetchAll();
     $adapterMap = array();
     foreach ($adapters as $a) {
         $adapterMap[$a->adapterKey] = $a;
     }
     $this->_helper->pageTitle('ot-account-all:title');
     $this->view->assign(array('paginator' => $paginator, 'form' => $form, 'interface' => true, 'sort' => $filterSort, 'direction' => $filterDirection, 'adapters' => $adapterMap, 'filterOptions' => array('urlParams' => $filterOptions)));
 }
开发者ID:ncsuwebdev,项目名称:otframework,代码行数:59,代码来源:AccountController.php

示例3: getSelectIds

 /**
  * Returns the Zend_Db_Select object used to build query
  *
  * @return Zend_Db_Select
  */
 public function getSelectIds()
 {
     $this->select->reset('columns');
     $this->select->distinct(true)->columns("id");
     return $this->select;
 }
开发者ID:alexukua,项目名称:opus4,代码行数:11,代码来源:DocumentFinder.php


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