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


PHP CActiveDataProvider::getKeys方法代码示例

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


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

示例1: renderKeys

 public function renderKeys()
 {
     echo CHtml::openTag('div', array('class' => 'keys', 'style' => 'display:none', 'title' => Yii::app()->getRequest()->getUrl()));
     foreach ($this->dataProvider->getKeys() as $key) {
         echo "<span>" . CHtml::encode($key) . "</span>";
     }
     echo "</div>\n";
 }
开发者ID:GsHatRed,项目名称:Yiitest,代码行数:8,代码来源:TbKanbanListView.php

示例2: getKeys

 /**
  * 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)
 {
     /* x2modstart */
     if ($this->calculateChecksum && $refresh) {
         throw new CException('refresh cannot be called if calculcateChecksum is set to true');
     }
     /* x2modend */
     return parent::getKeys($refresh);
 }
开发者ID:keyeMyria,项目名称:CRM,代码行数:16,代码来源:SmartActiveDataProvider.php

示例3: actionBoard

	/**
	 * Lists all models.
	 */
	public function actionBoard($slug) {
		if (!$slug)
			throw new CHttpException(404, 'The requested board does not exist.');
		$board=Yii::app()->cache->get($slug);
		if ($board===false) {
			$board=Board::model()->find('slug=:slug', array(':slug'=> $slug));
			if ($board)
				Yii::app()->cache->set($slug, $board, 2592000); // 1 month
			else
				throw new CHttpException(404, 'The requested page does not exist.');
		}
		$this->pageTitle=Yii::app()->name." - ".$board->name;
		$model=new Post;
		$model->board=$board->id;
		if (isset($_POST['Post'])) {
			$model->attributes=$_POST['Post'];
			$model->image=CUploadedFile::getInstance($model, 'image');
			$name=time() . rand(10, 90);
			if ($model->image)
				$model->filename=$board->slug . "/" . $name . "." . $model->image->getExtensionName();
			if ($model->save()) {
				$this->uploadImage($name, $board->slug, $model);
				$model->addReplies();
				$this->redirect(array('thread', 'slug'=> $board->slug, 'id'=> $model->vid));
			}
		}

		$notmain=isset($_GET['Post_page']);
		$dataProvider=Yii::app()->cache->get('board' . $board->slug);
		if ($notmain || $dataProvider===false) {
			$dataProvider=new CActiveDataProvider('Post', array(
						'criteria'=> array(
							'condition'=> 'board=:boardId AND parent_id=0',
							'params'=> array(':boardId'=> $board->id),
							'order'=> 'updated DESC',
						),
					));
			// attach replies, need find more correct way
			Post::addLastReplies($dataProvider->getData());
			$dataProvider->getKeys(); // wtf? without this before set cache we get error
			if(!$notmain)
				Yii::app()->cache->set('board' . $board->slug, $dataProvider, 86400); // 1 day
		}
		$this->render('board', array(
			'dataProvider'=> $dataProvider,
			'model'=> $model,
			'board'=> $board,
		));
	}
开发者ID:nucleartux,项目名称:YiiCh,代码行数:52,代码来源:PostController.php


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