Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Donate
Please sign in before you donate.
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
1 Star 0 Fork 921

张健(peter)/IBOS

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
master
Branches (2)
Tags (6)
master
develop
4.2
3.9
3.8
3.5
v3.5
3.3
master
Branches (2)
Tags (6)
master
develop
4.2
3.9
3.8
3.5
v3.5
3.3
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
master
Branches (2)
Tags (6)
master
develop
4.2
3.9
3.8
3.5
v3.5
3.3
IBOS
/
library
/
web
/
CDataProvider.php
IBOS
/
library
/
web
/
CDataProvider.php
CDataProvider.php 7.01 KB
Copy Edit Raw Blame History
seekArt authored 2015年07月21日 17:24 +08:00 . 提交初始版本
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
<?php
/**
* CDataProvider is a base class that implements the {@link IDataProvider} interface.
*
* Derived classes mainly need to implement three methods: {@link fetchData},
* {@link fetchKeys} and {@link calculateTotalItemCount}.
*
* @property string $id The unique ID that uniquely identifies the data provider among all data providers.
* @property CPagination $pagination The pagination object. If this is false, it means the pagination is disabled.
* @property CSort $sort The sorting object. If this is false, it means the sorting is disabled.
* @property array $data The list of data items currently available in this data provider.
* @property array $keys The list of key values corresponding to {@link data}. Each data item in {@link data}
* is uniquely identified by the corresponding key value in this array.
* @property integer $itemCount The number of data items in the current page.
* @property integer $totalItemCount Total number of possible data items.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @package system.web
* @since 1.1
*/
abstract class CDataProvider extends CComponent implements IDataProvider
{
private $_id;
private $_data;
private $_keys;
private $_totalItemCount;
private $_sort;
private $_pagination;
/**
* Fetches the data from the persistent data storage.
* @return array list of data items
*/
abstract protected function fetchData();
/**
* Fetches the data item keys from the persistent data storage.
* @return array list of data item keys.
*/
abstract protected function fetchKeys();
/**
* Calculates the total number of data items.
* @return integer the total number of data items.
*/
abstract protected function calculateTotalItemCount();
/**
* Returns the ID that uniquely identifies the data provider.
* @return string the unique ID that uniquely identifies the data provider among all data providers.
*/
public function getId()
{
return $this->_id;
}
/**
* Sets the provider ID.
* @param string $value the unique ID that uniquely identifies the data provider among all data providers.
*/
public function setId($value)
{
$this->_id=$value;
}
/**
* Returns the pagination object.
* @param string $className the pagination object class name. Parameter is available since version 1.1.13.
* @return CPagination|false the pagination object. If this is false, it means the pagination is disabled.
*/
public function getPagination($className='CPagination')
{
if($this->_pagination===null)
{
$this->_pagination=new $className;
if(($id=$this->getId())!='')
$this->_pagination->pageVar=$id.'_page';
}
return $this->_pagination;
}
/**
* Sets the pagination for this data provider.
* @param mixed $value the pagination to be used by this data provider. This could be a {@link CPagination} object
* or an array used to configure the pagination object. If this is false, it means the pagination should be disabled.
*
* You can configure this property same way as a component:
* <pre>
* array(
* 'class' => 'MyPagination',
* 'pageSize' => 20,
* ),
* </pre>
*/
public function setPagination($value)
{
if(is_array($value))
{
if(isset($value['class']))
{
$pagination=$this->getPagination($value['class']);
unset($value['class']);
}
else
$pagination=$this->getPagination();
foreach($value as $k=>$v)
$pagination->$k=$v;
}
else
$this->_pagination=$value;
}
/**
* Returns the sort object.
* @param string $className the sorting object class name. Parameter is available since version 1.1.13.
* @return CSort|false the sorting object. If this is false, it means the sorting is disabled.
*/
public function getSort($className='CSort')
{
if($this->_sort===null)
{
$this->_sort=new $className;
if(($id=$this->getId())!='')
$this->_sort->sortVar=$id.'_sort';
}
return $this->_sort;
}
/**
* Sets the sorting for this data provider.
* @param mixed $value the sorting to be used by this data provider. This could be a {@link CSort} object
* or an array used to configure the sorting object. If this is false, it means the sorting should be disabled.
*
* You can configure this property same way as a component:
* <pre>
* array(
* 'class' => 'MySort',
* 'attributes' => array('name', 'weight'),
* ),
* </pre>
*/
public function setSort($value)
{
if(is_array($value))
{
if(isset($value['class']))
{
$sort=$this->getSort($value['class']);
unset($value['class']);
}
else
$sort=$this->getSort();
foreach($value as $k=>$v)
$sort->$k=$v;
}
else
$this->_sort=$value;
}
/**
* Returns the data items currently available.
* @param boolean $refresh whether the data should be re-fetched from persistent storage.
* @return array the list of data items currently available in this data provider.
*/
public function getData($refresh=false)
{
if($this->_data===null || $refresh)
$this->_data=$this->fetchData();
return $this->_data;
}
/**
* Sets the data items for this provider.
* @param array $value put the data items into this provider.
*/
public function setData($value)
{
$this->_data=$value;
}
/**
* Returns the key values associated with the data items.
* @param boolean $refresh whether the keys should be re-calculated.
* @return array the list of key values corresponding to {@link data}. Each data item in {@link data}
* is uniquely identified by the corresponding key value in this array.
*/
public function getKeys($refresh=false)
{
if($this->_keys===null || $refresh)
$this->_keys=$this->fetchKeys();
return $this->_keys;
}
/**
* Sets the data item keys for this provider.
* @param array $value put the data item keys into this provider.
*/
public function setKeys($value)
{
$this->_keys=$value;
}
/**
* Returns the number of data items in the current page.
* This is equivalent to <code>count($provider->getData())</code>.
* When {@link pagination} is set false, this returns the same value as {@link totalItemCount}.
* @param boolean $refresh whether the number of data items should be re-calculated.
* @return integer the number of data items in the current page.
*/
public function getItemCount($refresh=false)
{
return count($this->getData($refresh));
}
/**
* Returns the total number of data items.
* When {@link pagination} is set false, this returns the same value as {@link itemCount}.
* @param boolean $refresh whether the total number of data items should be re-calculated.
* @return integer total number of possible data items.
*/
public function getTotalItemCount($refresh=false)
{
if($this->_totalItemCount===null || $refresh)
$this->_totalItemCount=$this->calculateTotalItemCount();
return $this->_totalItemCount;
}
/**
* Sets the total number of data items.
* This method is provided in case when the total number cannot be determined by {@link calculateTotalItemCount}.
* @param integer $value the total number of data items.
* @since 1.1.1
*/
public function setTotalItemCount($value)
{
$this->_totalItemCount=$value;
}
}
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

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

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

取消
提交

About

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

Releases

No release

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/case-code/IBOS.git
git@gitee.com:case-code/IBOS.git
case-code
IBOS
IBOS
master
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

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