开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
1 Star 0 Fork 921

张健(peter)/IBOS

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (2)
标签 (6)
master
develop
4.2
3.9
3.8
3.5
v3.5
3.3
master
分支 (2)
标签 (6)
master
develop
4.2
3.9
3.8
3.5
v3.5
3.3
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (2)
标签 (6)
master
develop
4.2
3.9
3.8
3.5
v3.5
3.3
IBOS
/
library
/
web
/
CDataProviderIterator.php
IBOS
/
library
/
web
/
CDataProviderIterator.php
CDataProviderIterator.php 4.21 KB
一键复制 编辑 原始数据 按行查看 历史
seekArt 提交于 2015年07月21日 17:24 +08:00 . 提交初始版本
<?php
/**
* CDataProviderIterator class file.
*
* @author Charles Pick <charles.pick@gmail.com>
* @link http://www.yiiframework.com/
* @copyright 2008-2013 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
/**
* CDataProviderIterator allows iteration over large data sets without holding the entire set in memory.
*
* CDataProviderIterator iterates over the results of a data provider, starting at the first page
* of results and ending at the last page. It is usually only suited for use with {@link CActiveDataProvider}.
*
* For example, the following code will iterate over all registered users (active record class User) without
* running out of memory, even if there are millions of users in the database.
* <pre>
* $dataProvider = new CActiveDataProvider("User");
* $iterator = new CDataProviderIterator($dataProvider);
* foreach($iterator as $user) {
* echo $user->name."\n";
* }
* </pre>
*
* @property CDataProvider $dataProvider the data provider to iterate over
* @property integer $totalItemCount the total number of items in the iterator
*
* @author Charles Pick <charles.pick@gmail.com>
* @author Carsten Brandt <mail@cebe.cc>
* @package system.web
* @since 1.1.13
*/
class CDataProviderIterator extends CComponent implements Iterator, Countable
{
private $_dataProvider;
private $_currentIndex=-1;
private $_currentPage=0;
private $_totalItemCount=-1;
private $_items;
/**
* Constructor.
* @param CDataProvider $dataProvider the data provider to iterate over
* @param integer $pageSize pageSize to use for iteration. This is the number of objects loaded into memory at the same time.
*/
public function __construct(CDataProvider $dataProvider, $pageSize=null)
{
$this->_dataProvider=$dataProvider;
$this->_totalItemCount=$dataProvider->getTotalItemCount();
if(($pagination=$this->_dataProvider->getPagination())===false)
$this->_dataProvider->setPagination($pagination=new CPagination());
if($pageSize!==null)
$pagination->setPageSize($pageSize);
}
/**
* Returns the data provider to iterate over
* @return CDataProvider the data provider to iterate over
*/
public function getDataProvider()
{
return $this->_dataProvider;
}
/**
* Gets the total number of items to iterate over
* @return integer the total number of items to iterate over
*/
public function getTotalItemCount()
{
return $this->_totalItemCount;
}
/**
* Loads a page of items
* @return array the items from the next page of results
*/
protected function loadPage()
{
$this->_dataProvider->getPagination()->setCurrentPage($this->_currentPage);
return $this->_items=$this->dataProvider->getData(true);
}
/**
* Gets the current item in the list.
* This method is required by the Iterator interface.
* @return mixed the current item in the list
*/
public function current()
{
return $this->_items[$this->_currentIndex];
}
/**
* Gets the key of the current item.
* This method is required by the Iterator interface.
* @return integer the key of the current item
*/
public function key()
{
$pageSize=$this->_dataProvider->getPagination()->getPageSize();
return $this->_currentPage*$pageSize+$this->_currentIndex;
}
/**
* Moves the pointer to the next item in the list.
* This method is required by the Iterator interface.
*/
public function next()
{
$pageSize=$this->_dataProvider->getPagination()->getPageSize();
$this->_currentIndex++;
if($this->_currentIndex >= $pageSize)
{
$this->_currentPage++;
$this->_currentIndex=0;
$this->loadPage();
}
}
/**
* Rewinds the iterator to the start of the list.
* This method is required by the Iterator interface.
*/
public function rewind()
{
$this->_currentIndex=0;
$this->_currentPage=0;
$this->loadPage();
}
/**
* Checks if the current position is valid or not.
* This method is required by the Iterator interface.
* @return boolean true if this index is valid
*/
public function valid()
{
return $this->key() < $this->_totalItemCount;
}
/**
* Gets the total number of items in the dataProvider.
* This method is required by the Countable interface.
* @return integer the total number of items
*/
public function count()
{
return $this->_totalItemCount;
}
}
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

基于Yii和bootstrap的开源OA/协同办公平台,连接全平台覆盖的酷办公客户端(Win,IOS,Android,Mac,Linux),支撑您的企业管理二次开发--作为国内首家开源OA,有的不只是颜值
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/case-code/IBOS.git
git@gitee.com:case-code/IBOS.git
case-code
IBOS
IBOS
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /