• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CActiveDataProvider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: actionGetBidHistory

 public function actionGetBidHistory($id)
 {
     $dataAdapter = new CActiveDataProvider('Bidding', array('criteria' => array('condition' => 'fk_user = 1', 'limit' => '10', 'order' => 'id_bidding DESC')));
     $this->apiResponse['data'] = $dataAdapter->getData();
     $this->apiResponse['success'] = true;
     $this->sendResponse();
 }
开发者ID:kuldeepro,项目名称:playwin,代码行数:7,代码来源:BiddingController.php


示例2: actionIndex

 public function actionIndex()
 {
     if (Yii::app()->user->isGuest) {
         Yii::app()->user->loginRequired();
     }
     $settings = array();
     // Get user settings.
     $criteria = new CDbCriteria(array('condition' => 'uid=' . Yii::app()->user->id));
     $dataProvider = new CActiveDataProvider('DashboardPortlet', array('criteria' => $criteria));
     $data = $dataProvider->getData();
     if (isset($data[0])) {
         $userSettings = unserialize($data[0]->settings);
         foreach ($userSettings as $class => $properties) {
             $settings[$properties['column']][$properties['weight']] = array('class' => $class, 'visible' => $properties['visible'], 'weight' => $properties['weight']);
         }
         foreach ($settings as $key => $value) {
             // Sort all portlets in every column by weight.
             ksort($settings[$key]);
         }
     }
     // Use the default portlets settings if user did not set any portlet before.
     if (empty($settings)) {
         $deaultSettings = $this->getModule()->portlets;
         foreach ($deaultSettings as $class => $properties) {
             $column = isset($properties['column']) ? $properties['column'] : 0;
             $settings[$column][$properties['weight']] = array('class' => $class, 'visible' => isset($properties['visible']) ? $properties['visible'] : true, 'weight' => $properties['weight']);
         }
     }
     $this->render('index', array('portlets' => $settings));
 }
开发者ID:sharmarakesh,项目名称:edusec-college-management-system,代码行数:30,代码来源:DefaultController.php


示例3: actionFeed

 public function actionFeed()
 {
     Yii::import('aiajaya.extensions.efeed.*');
     // RSS 2.0 is the default type
     $feed = new EFeed();
     $feed->title = 'Gästebuch von ' . Yii::app()->name;
     $feed->description = 'Das Gästebuch vom ' . Yii::app()->name;
     $feed->addChannelTag('language', 'de-de');
     $feed->addChannelTag('pubDate', date(DATE_RSS, time()));
     $feed->addChannelTag('link', $this->createAbsoluteUrl('/page/guestbook/list'));
     // * self reference
     $feed->addChannelTag('atom:link', $this->createAbsoluteUrl('/page/guestbook/feed'));
     $criteria = new CDbCriteria(array('order' => '`createDate` DESC'));
     $dataProvider = new CActiveDataProvider('Comment', array('pagination' => array('pageSize' => 0), 'criteria' => $criteria));
     foreach ($dataProvider->getData() as $comment) {
         $item = $feed->createNewItem();
         $item->title = $comment->getBaseModel()->commentName;
         $item->link = $this->createAbsoluteUrl('/page/page/get', array('key' => $comment->getBaseModel()->key));
         $item->date = $comment->createDate;
         $item->description = $comment->message;
         $item->addTag('author', $comment->name);
         //$item->addTag('guid', 'http://www.ramirezcobos.com/',array('isPermaLink'=>'true'));
         $feed->addItem($item);
     }
     $feed->generateFeed();
     Yii::app()->end();
 }
开发者ID:balrok,项目名称:aiajaya,代码行数:27,代码来源:GuestbookController.php


示例4: actionView

 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id)
 {
     $user = User::model()->findByPk($id);
     $dataProvider = new CActiveDataProvider('Actions', array('criteria' => array('order' => 'complete DESC', 'condition' => 'assignedTo=\'' . $user->username . '\'')));
     $actionHistory = $dataProvider->getData();
     $this->render('view', array('model' => $this->loadModel($id), 'actionHistory' => $actionHistory));
 }
开发者ID:dsyman2,项目名称:X2CRM,代码行数:11,代码来源:UsersController.php


示例5: getListItems

 /**
  * getListItems - Phương thức dùng để lấy dữ liệu
  */
 public function getListItems($category_id = null)
 {
     Yii::import('application.modules.products.models.ProductItem');
     $model = new ProductItem('search');
     $model->unsetAttributes();
     $criteria = new CDbCriteria();
     $criteria->order = 'created DESC';
     if ($category_id) {
         Yii::import('application.modules.products.models.ProductCategory');
         $categories = ProductCategory::model()->findByPk($category_id);
         if (!$categories) {
             return null;
         }
         $this->__category = $categories;
         $descendants = $categories->descendants()->findAll('is_active = 1');
         $arrCat = array($category_id);
         foreach ($descendants as $cat) {
             $arrCat[] = $cat->id;
         }
         $criteria->with = array('categoryitem');
         $criteria->together = true;
         foreach ($arrCat as $cat) {
             $criteria->compare('categoryitem.category_id', $cat, false, 'OR');
         }
     }
     $criteria->compare('status', 1);
     $search = new CActiveDataProvider($model, array('criteria' => $criteria, 'pagination' => array('pageSize' => Yii::app()->getModule('products')->entriesShow)));
     $data = $search->getData();
     $this->__pagination = $search->pagination;
     return $data;
 }
开发者ID:qkongvan,项目名称:k6-thuc-pham,代码行数:34,代码来源:ProductItemsWidget.php


示例6: getDataProvider

 /**
  *
  * 改进:使用延迟绑定,将这个函数写在父类里面
  *返回某个用户所发布的所有计划列表
  * @return CActiveDataProvider $dataProvider  返回CActiveDataProvider对象
  * 使用attach的好处是随时绑定,不一定在初始化的时候绑定
  */
 public function getDataProvider(CFormModel &$condition)
 {
     $this->attachBehaviors(array('NearScopeBehavior' => array('class' => 'ext.behavior.NearScopeBehavior', 'latitude' => $condition->latitude, 'longitude' => $condition->longitude)));
     $dataProvider = new CActiveDataProvider(Plan::model()->unexpired()->near()->with('user'), array('pagination' => array('pageSize' => 20)));
     $dataProvider->setCriteria($this->addCondition($condition));
     return $dataProvider;
 }
开发者ID:tiger2soft,项目名称:travelman,代码行数:14,代码来源:Plan.php


示例7: actionExcel

 public function actionExcel($id)
 {
     $po = $this->loadModel($id);
     $poItemCriteria = new CDbCriteria();
     $poItemCriteria->with = array('material');
     $poItemCriteria->compare('po_number', $id);
     $poItemDataProvider = new CActiveDataProvider('PoItems', array('criteria' => $poItemCriteria, 'pagination' => false));
     Yii::import('ext.phpexcel.XPHPExcel');
     $objPHPExcel = XPHPExcel::createPHPExcel();
     $objReader = PHPExcel_IOFactory::createReader('Excel5');
     $objPHPExcel = $objReader->load(Yii::app()->basePath . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . "templates" . DIRECTORY_SEPARATOR . "PO_Template.xls");
     $objPHPExcel->getProperties()->setCreator(Yii::app()->user->name)->setLastModifiedBy(Yii::app()->user->name)->setTitle("PO Order-" . $id);
     //->setSubject("Office 2007 XLSX Test Document")
     //->setDescription("Sales Order#")
     //->setKeywords("office 2007 openxml php")
     //->setCategory("Test result file");
     // Add the data
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue('C2', $po->po_number)->setCellValue('C3', Yii::app()->dateFormatter->formatDateTime($po->maturity_date, "short", null))->setCellValue('C4', Yii::app()->dateFormatter->formatDateTime($po->created, "short", null))->setCellValue('C5', Yii::app()->dateFormatter->formatDateTime($po->updated, "short", null))->setCellValue('E2', $po->comp->name)->setCellValue('E3', $po->contact)->setCellValue('E4', $po->contact_telephone)->setCellValue('C6', $po->paymentTerm->description)->setCellValue('C7', $po->is_open ? "Open" : "Closed")->setCellValue('A8', "Comments:\r" . $po->comments);
     $row = 13;
     //$i = 1;
     // Write the sale items now
     $items = $poItemDataProvider->getData();
     foreach ($items as $item) {
         $objPHPExcel->setActiveSheetIndex(0)->setCellValue("B" . $row, $item->material->cat->description . "-" . $item->material->description)->setCellValue("D" . $row, $item->qty)->setCellValue("E" . $row, $item->qty_units)->setCellValue("F" . $row, $item->unit_price)->setCellValue("G" . $row, $item->price_units)->setCellValue("H" . $row, $item->qty_recieved)->setCellValue("I" . $row, $item->qty_diff);
         //$i++;
         $row++;
     }
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
     // Redirect output to a client’s web browser
     //header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
     header('Content-Type: application/vnd.ms-excel');
     header('Content-Disposition: attachment;filename=' . '"PurchaseOrder-' . $id . '.xls"');
     header('Cache-Control: max-age=0');
     $objWriter->save('php://output');
 }
开发者ID:mehulsbhatt,项目名称:sale_purchase_tracking,代码行数:35,代码来源:PurchaseOrderController.php


示例8: actionDashboard

 /**
  * Manages all models.
  */
 public function actionDashboard()
 {
     /* Wall Post */
     $model = new OmmuWalls();
     /* Get Walll */
     $criteria = new CDbCriteria();
     $criteria->condition = 'publish = :publish';
     $criteria->params = array(':publish' => 1);
     $criteria->order = 'creation_date DESC';
     $dataProvider = new CActiveDataProvider('OmmuWalls', array('criteria' => $criteria, 'pagination' => array('pageSize' => 5)));
     $data = '';
     $wall = $dataProvider->getData();
     if (!empty($wall)) {
         foreach ($wall as $key => $item) {
             $data .= Utility::otherDecode($this->renderPartial('/wall/_view', array('data' => $item), true, false));
         }
     }
     $pager = OFunction::getDataProviderPager($dataProvider);
     if ($pager[nextPage] != '0') {
         $summaryPager = 'Displaying 1-' . $pager[currentPage] * $pager[pageSize] . ' of ' . $pager[itemCount] . ' results.';
     } else {
         $summaryPager = 'Displaying 1-' . $pager[itemCount] . ' of ' . $pager[itemCount] . ' results.';
     }
     $nextPager = $pager['nextPage'] != 0 ? Yii::app()->createUrl('wall/get', array($pager['pageVar'] => $pager['nextPage'])) : 0;
     $this->pageTitle = Yii::t('phrase', 'Welcome') . ', ' . Yii::app()->user->displayname . '!';
     $this->pageDescription = Yii::t('phrase', 'Welcome to your social network control panel. Here you can manage and modify every aspect of your social network. Directly below, you will find a quick snapshot of your social network including some useful statistics.');
     $this->pageMeta = '';
     $this->render('application.webs.admin.admin_dashboard', array('model' => $model, 'data' => $data, 'pager' => $pager, 'summaryPager' => $summaryPager, 'nextPager' => $nextPager));
 }
开发者ID:OmmuOpenSource,项目名称:OOS-Company-Profile,代码行数:32,代码来源:AdminController.php


示例9: actionIndex

 public function actionIndex()
 {
     $with = array('active_keywords');
     $whereType = "and t.type='" . Globals::TYPE_REGISTRATION . "' and active_keywords.type='" . Globals::TYPE_ACTIVE . "'";
     $this->layout = '//layouts/memberList';
     $dataProvider = new CActiveDataProvider('ActiveModel', array('criteria' => array('order' => 't.id DESC', 'with' => $with, 'condition' => "t.wechatId = {$this->wechatInfo->id} {$whereType}", 'together' => true), 'pagination' => array('pageSize' => Page::SIZE, 'pageVar' => 'page')));
     $this->render('index', array('data' => $dataProvider->getData(), 'pages' => $dataProvider->getPagination(), 'wechatInfo' => $this->wechatInfo));
 }
开发者ID:00606,项目名称:wechat,代码行数:8,代码来源:RegistrationController.php


示例10: actionIndex

 public function actionIndex()
 {
     $roleDataProvider = new CActiveDataProvider('AuthItem', array('criteria' => array('condition' => 'type=2')));
     echo '<pre>';
     var_dump($roleDataProvider->getData());
     echo '</pre>';
     exit;
     $this->render('index');
 }
开发者ID:rainyjune,项目名称:YSMusic,代码行数:9,代码来源:AuthItemRalationController.php


示例11: getRoomTypeList

 public function getRoomTypeList()
 {
     $dataProvider = new CActiveDataProvider('RoomType');
     $roomTypes = $dataProvider->getData();
     $roomTypesDropdown = array();
     foreach ($roomTypes as $roomType) {
         $roomTypesDropdown[$roomType->id] = $roomType->description;
     }
 }
开发者ID:bogiesoft,项目名称:YiiHotelReservation,代码行数:9,代码来源:RoomType.php


示例12: actionIndex

 /**
  * @param bool $ajax
  */
 public function actionIndex($ajax = false)
 {
     if ($ajax) {
         $dataProvider = new CActiveDataProvider('SurveillanceSections', ['criteria' => ['condition' => "tool='surveillance'", 'select' => 'sectionId, sectionName, description']]);
         echo CJSON::encode(['aaData' => $dataProvider->getData()]);
         return;
     }
     $this->render('index');
 }
开发者ID:schrapps,项目名称:risksur,代码行数:12,代码来源:AdminsurveillancesectionsController.php


示例13: run

 public function run($args)
 {
     ignore_user_abort(true);
     set_time_limit(0);
     $dataProvider = new CActiveDataProvider('Category', array('criteria' => array('order' => 'id ASC'), 'pagination' => false));
     foreach ($dataProvider->getData() as $category) {
         echo $category->name;
     }
 }
开发者ID:KEMSolutions,项目名称:Boukem1,代码行数:9,代码来源:TemporaryOperationCommand.php


示例14: actionIndex

 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     //$this->redirect('/card/index');
     //$dataProvider=new CActiveDataProvider('Product');
     $dataProvider = new CActiveDataProvider('Product', array('pagination' => array('pageSize' => 100)));
     $products = $dataProvider->getData();
     $model = new Order();
     $this->render('index', compact('model', 'products'));
 }
开发者ID:nellka,项目名称:mebel,代码行数:13,代码来源:SiteController.php


示例15: actionIndex

 /**
  * Lists all models.
  * @param $ajax bool
  */
 public function actionIndex($ajax = false)
 {
     if ($ajax) {
         $dataProvider = new CActiveDataProvider('EconomicMethods', ['criteria' => ['with' => ['econMethodGroup']]]);
         //			print_r($dataProvider->getData()); die;
         echo json_encode(['aaData' => ModelToArray::convertModelToArray($dataProvider->getData())]);
         return;
     }
     $this->render('index');
 }
开发者ID:schrapps,项目名称:risksur,代码行数:14,代码来源:AdmineconomicmethodsController.php


示例16: actionFindUser

 public function actionFindUser($group, $term)
 {
     $dataProvider = new CActiveDataProvider('User', array('criteria' => array('select' => array('id', 'email')), 'pagination' => array('pageSize' => 500)));
     $criteria = $dataProvider->getCriteria();
     $criteria->compare('email', $term, true);
     $result = CHtml::listData($dataProvider->getData(), 'id', 'email');
     $members = Yii::app()->db->createCommand()->select('userid')->from(AuthAssignment::model()->tableName())->where('itemname=:group', array(':group' => $group))->queryColumn();
     echo CJSON::encode(array_diff_key($result, array_flip($members)));
     Yii::app()->end();
 }
开发者ID:apa-narola,项目名称:yiimoduledemo,代码行数:10,代码来源:GroupsController.php


示例17: getPageItems

 /**
  * 将page组装成nav item
  * Enter description here ...
  */
 public static function getPageItems()
 {
     $pageDataProvider = new CActiveDataProvider('BottomText', array('criteria' => array('order' => 'weight asc ')));
     $items = array();
     foreach ($pageDataProvider->getData() as $page) {
         $item['content'] = $page->content;
         $items[] = $item;
     }
     return $items;
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:14,代码来源:NavPage.php


示例18: listarcorreos

 public function listarcorreos($ideven, $externo)
 {
     $criteria = new CDbCriteria();
     $criteria->compare('id', $this->id, true);
     $criteria->compare('correodestinatario', $this->correodestinatario, true);
     $criteria->addCondition('hidevento=' . $externo);
     $criteria->addCondition("esinterno='" . $ideven . "'");
     $prove = new CActiveDataProvider($this, array('criteria' => $criteria));
     return $prove->getdata();
 }
开发者ID:hipogea,项目名称:zega,代码行数:10,代码来源:Mensajesd.php


示例19: actionUser

 public function actionUser()
 {
     $this->layout = '//layouts/list';
     $group = GroupModel::model()->findall();
     foreach ($group as $v) {
         $groupList[$v->group_id] = $v->name;
     }
     $dataProvider = new CActiveDataProvider('UserModel', array('criteria' => array('order' => 'uid desc'), 'pagination' => array('pageSize' => Page::SIZE)));
     $this->render('userList', array('data' => $dataProvider->getData(), 'pages' => $dataProvider->getPagination(), 'group' => $groupList));
 }
开发者ID:00606,项目名称:wechat,代码行数:10,代码来源:GroupController.php


示例20: actionIndex

    public function actionIndex($confirm = 0)
    {
        $this->layout = '//layouts/column1';
        if ($confirm) {
            $this->render('cvconfirm');
        } else {
            $formModel = new JobForm();
            $cvModel = new JobCv();
            $job = new Job();
            $jobProvider = new CActiveDataProvider('Job', array('criteria' => array('condition' => 'active = 1', 'order' => 'category_id ASC, title ASC'), 'pagination' => false));
            $jobCategory = JobCategory::model()->findAll();
            foreach ($jobProvider->getData() as $data) {
                $formModel->{$data['id']} = null;
            }
            if (isset($_POST['JobForm'])) {
                $listJob = '<ul>';
                $oneChecked = false;
                foreach ($_POST['JobForm'] as $key => $item) {
                    if (is_numeric($key) && $item == '1') {
                        $oneChecked = true;
                        $jobChecked = Job::model()->findByPk($key);
                        $listJob .= '<li>' . $jobChecked->title . ' (' . $jobChecked->category->name . ')</li>';
                    }
                }
                $listJob .= '</ul>';
                $cvModel->date = date('Y-m-d H:i:s');
                $cvModel->cv = $_POST['JobCv']['cv'];
                if (!$oneChecked) {
                    $cvModel->addError('cv', Yii::t('jobModule.common', 'Vous devez cocher au moins un emploi'));
                } elseif ($cvModel->save()) {
                    foreach ($_POST['JobForm'] as $attribute => $value) {
                        if (is_numeric($attribute) && $value == '1') {
                            $jobId = (int) $attribute;
                            Yii::app()->db->createCommand('INSERT INTO job_job_cv (job_id, job_cv_id) VALUES (:job_id, :job_cv_id)')->execute(array(':job_id' => $jobId, ':job_cv_id' => $cvModel->id));
                        }
                    }
                    $subject = 'Postulation pour une offre d’emploi';
                    $body = '
					<p>Bonjour,<br/><br/>
					Vous avez reçu une candidature pour un ou plusieurs emplois à partir du site Web d`Arianne Phosphate Inc.<br/>
					' . $listJob . '<br/>
					<a href="' . $this->createAbsoluteUrl('admincv/read', array('id' => $cvModel->id)) . '">Voir les détails de la candidature</a><br/><br/>
					</p>
					';
                    $attachment = "./" . $cvModel->cvHandler->dir . "/" . Helper::encodeFileName($cvModel->cv);
                    if (($mailerError = Helper::sendMail($this->module->cvEmail, $subject, $body, $attachment)) !== true) {
                        throw new CHttpException(500, $mailerError);
                    }
                    $this->redirect($this->createUrl('index', array('confirm' => 1)));
                }
            }
            $this->render('index', array('jobProvider' => $jobProvider, 'categories' => $jobCategory, 'formModel' => $formModel, 'cvModel' => $cvModel));
        }
    }
开发者ID:kostya1017,项目名称:our,代码行数:54,代码来源:DefaultController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CActiveForm类代码示例发布时间:2022-05-23
下一篇:
PHP CAccessControlFilter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap