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


PHP CDbCriteria::addInCondition方法代码示例

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


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

示例1: run

 public function run()
 {
     $voting = null;
     if (is_numeric(HU::post('id_voting'))) {
         $voting = Voting::model()->onlyActive()->with('answer')->findByPk(HU::post('id_voting'));
     }
     if ($voting == null) {
         //echo CHtml::encode($this->controller->widget('vote.widgets.VoteWidget', null, true));
         return;
     }
     if (Yii::app()->vote->check($voting->id_voting)) {
         $answers = $_POST['VotingAnswer']['name'];
         $cr = new CDbCriteria();
         $cr->addColumnCondition(array('id_voting' => $voting->id_voting));
         if (is_array($answers)) {
             $cr->addInCondition('id_voting_answer', $answers);
         } else {
             if (is_numeric($answers)) {
                 $cr->addColumnCondition(array('id_voting_answer' => $answers));
             }
         }
         VotingAnswer::model()->updateCounters(array('count' => 1), $cr);
         VisitSite::saveCurrentVisit(Voting::ID_OBJECT, $voting->id_voting);
         Yii::app()->user->setState('vote_' . $voting->id_voting, time());
         // перегружаем голосовалку, чтоб обновились показатели счетчиков
         $voting = Voting::model()->onlyActive()->with('answer')->findByPk($voting->id_voting);
     }
     $voteCount = $voting->getSumVote();
     echo CHtml::encode($this->controller->renderPartial("vote.widgets.views.statistic", array('voting' => $voting, 'voteCount' => $voteCount)), null, true);
 }
开发者ID:kot-ezhva,项目名称:ygin,代码行数:30,代码来源:VoteAction.php

示例2: displayDataset

 public function displayDataset($ids)
 {
     $criteria = new CDbCriteria();
     $criteria->addInCondition("id", $ids);
     $datasets = Dataset::model()->findAll($criteria);
     $this->generateFeed($datasets);
 }
开发者ID:jessesiu,项目名称:GigaDBV3,代码行数:7,代码来源:RssController.php

示例3: run

 public function run()
 {
     if (is_null($this->model)) {
         return;
     }
     $model = $this->model;
     // Условия выборки
     $criteria = new CDbCriteria();
     if ($this->limit > 0) {
         $criteria->limit = (int) $this->limit;
     }
     $criteria->order = 'RAND()';
     $criteria->scopes['type'] = $model->type->id;
     $criteria->compare('t.id', '<>' . $model->id);
     if ($model->category->id == RealtyCategory::ELITE_CATEGORY_ID) {
         $criteria->compare('::rooms_number::', $model->rooms_number);
         $criteria->addInCondition('::district::', $model->district);
     } elseif ($model->category->id == RealtyCategory::COUNTRY_CATEGORY_ID) {
         $criteria->addInCondition('::direction::', $model->direction);
     }
     if ($model->category->id == RealtyCategory::COMMERCIAL_CATEGORY_ID) {
         $criteria->addInCondition('::district::', $model->district);
     }
     // Выборка объектов
     $models = RealtyItem::model()->withEavAttributes(true)->active()->with(['category', 'type', 'currency'])->findAll($criteria);
     if (empty($models)) {
         return;
     }
     $this->render($this->view, ['models' => $models]);
 }
开发者ID:kuzmina-mariya,项目名称:4seasons,代码行数:30,代码来源:SimilarObjectsWidget.php

示例4: getDecisionsApproachingDeadlineByMda

 public function getDecisionsApproachingDeadlineByMda($mda_id)
 {
     $criteria = new CDbCriteria();
     $criteria->addInCondition('id', EacDecision::model()->getDecisionIdsFromResponsibleMdaMappings($mda_id));
     $criteria->addInCondition("datediff(deadline,now())", [14, 7, 3]);
     $decisions = EacDecision::model()->find($criteria);
     return $decisions;
 }
开发者ID:robertgunze,项目名称:eams,代码行数:8,代码来源:DecisionsDeadlineNotificationCommand.php

示例5: fromto

 public function fromto($id1, $id2 = 0)
 {
     if (empty($id2)) {
         $id2 = Yii::app()->user->id;
     }
     $criteria = new CDbCriteria();
     $criteria->addInCondition('id_from', array($id1, $id2));
     $criteria->addInCondition('id_to', array($id1, $id2));
     $criteria->addCondition('id_to<>id_from');
     $this->getDbCriteria()->mergeWith($criteria);
     return $this;
 }
开发者ID:nellka,项目名称:mebel,代码行数:12,代码来源:Message.php

示例6: actionIndex

 public function actionIndex($style = null, $order = null, $manufacturer = null, $attribute = null)
 {
     if (isset($_GET['q'])) {
         $with = array();
         $category = array();
         $criteria = new CDbCriteria();
         $criteria->condition = "name like :search or description like :search";
         $criteria->params = array(':search' => "%{$_GET['q']}%");
         if (isset($_GET['category']) && $_GET['category'] > 0) {
             $category = Category::model()->findByPk($_GET['category']);
             $criteria->addCondition("category_id = {$category->id}");
         }
         $template = "type/_grid";
         if ($style == "list") {
             $template = 'type/_' . $style;
         }
         switch ($order) {
             case "price":
                 $criteria->order = "price";
                 break;
             case "created":
                 $criteria->order = "created DESC";
                 break;
             default:
                 $criteria->order = "name";
                 break;
         }
         if ($manufacturer) {
             $criteria->addInCondition("manufacturer_id", explode(',', trim($manufacturer)));
         }
         if ($attribute) {
             $crtr = new CDbCriteria();
             $crtr->addInCondition("id", explode(',', trim($attribute)));
             $opt = EntityAttributeOption::model()->findAll($crtr);
             $attrs = CHtml::listData($opt, 'id', 'option');
             $criteria->addInCondition("entityAttributeOptions.option", $attrs);
             $with = array('entityAttributeOptions' => array('together' => true));
         }
         $products = new Product();
         $total = $products->with($with)->count($criteria);
         $pages = new Pagination($total);
         $pages->pageSize = 4;
         $pages->applyLimit($criteria);
         $list = $products->with($with)->findAll($criteria);
         if (Yii::app()->request->isAjaxRequest) {
             $this->widget("ProductList", array('pages' => $pages, 'products' => $list, 'template' => $template));
             Yii::app()->end();
         }
         $this->render('index', array('models' => $list, 'pages' => $pages, 'q' => $_GET['q'], 'template' => $template, 'category' => $category));
     } else {
         throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
     }
 }
开发者ID:septembermd,项目名称:n1,代码行数:53,代码来源:SearchController.php

示例7: deactivate

 public function deactivate(Plugin $plugin)
 {
     $data = $plugin->getData();
     Yii::app()->authManager->removeAuthItemObject('list', $data['id_object_banner_place']);
     Yii::app()->authManager->removeAuthItemObject('list', $data['id_object_banner']);
     $this->uninstallAggregateViewStatisticJob();
     $this->deactivatePhpScript(self::BANNER_PHP_SCRIPT_TYPE_ID);
     //удаляем SiteModule связанных с баннерами, если таковые имеются
     $idsPhpScript = Yii::app()->db->createCommand()->select('id_php_script')->from('da_php_script')->where('id_php_script_type = "' . self::BANNER_PHP_SCRIPT_TYPE_ID . '"')->queryAll();
     if ($idsPhpScript) {
         $idsPhpScriptArray = array();
         foreach ($idsPhpScript as $idPhpScript) {
             $idsPhpScriptArray[] = $idPhpScript['id_php_script'];
         }
         //отцепляем виджеты от наборов
         $idsSiteModule = Yii::app()->db->createCommand()->select('id_module')->from('da_site_module')->where('id_php_script IN (' . implode(',', $idsPhpScriptArray) . ')')->queryAll();
         $idsSiteModuleArray = array();
         foreach ($idsSiteModule as $idSiteModule) {
             $idsSiteModuleArray[] = $idSiteModule['id_module'];
         }
         $criteria = new CDbCriteria();
         $criteria->addInCondition('id_module', $idsSiteModuleArray);
         Yii::app()->db->commandBuilder->createDeleteCommand('da_site_module_rel', $criteria)->execute();
         //удаляем сами модули
         $criteria = new CDbCriteria();
         $criteria->addInCondition('id_php_script', $idsPhpScriptArray);
         Yii::app()->db->commandBuilder->createDeleteCommand('da_site_module', $criteria)->execute();
         //Yii::app()->db->createCommand()->update('da_site_module',array('is_visible' => 0),array('in','id_php_script',$idsPhpScriptArray));
         //удаляем php_script
         $criteria = new CDbCriteria();
         $criteria->compare('id_php_script_type', self::BANNER_PHP_SCRIPT_TYPE_ID);
         Yii::app()->db->commandBuilder->createDeleteCommand('da_php_script', $criteria)->execute();
     }
     $this->updateMenu = true;
 }
开发者ID:kot-ezhva,项目名称:ygin,代码行数:35,代码来源:BannerPlugin.php

示例8: getInfoByGroup

 /**
  *	根据菜单group array 查询菜单
  */
 public function getInfoByGroup($groups)
 {
     $criteria = new CDbCriteria();
     $criteria->addInCondition("t.group", $groups);
     $criteria->order = "code";
     return $this->getRows($criteria);
 }
开发者ID:FlynnFang,项目名称:cyfyy,代码行数:10,代码来源:MenuModel.php

示例9: search

 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search()
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $criteria = new CDbCriteria();
     $acdm_terms = AcademicTerm::model()->findAll('current_sem=1');
     $data = array();
     foreach ($acdm_terms as $list) {
         $data[] = $list['academic_term_id'];
     }
     $criteria->addInCondition('t.academic_name_id', $data, 'OR');
     $criteria->with = array('rel_batch_academic_period_id', 'rel_batch_academic_id', 'rel_division');
     $criteria->compare('rel_division.division_code', $this->division_code, true);
     //
     $criteria->compare('rel_batch_academic_period_id.academic_term_period', $this->academic_term_period, true);
     $criteria->compare('rel_batch_academic_id.academic_term_name', $this->academic_term_name, true);
     $criteria->compare('batch_id', $this->batch_id);
     $criteria->compare('batch_organization_id', $this->batch_organization_id);
     $criteria->compare('batch_created_by', $this->batch_created_by);
     $criteria->compare('batch_creation_date', $this->batch_creation_date, true);
     $criteria->compare('batch_code', $this->batch_code);
     $criteria->compare('t.branch_id', $this->branch_id);
     $criteria->compare('div_id', $this->div_id);
     $criteria->compare('academic_period_id', $this->academic_period_id);
     $criteria->compare('academic_name_id', $this->academic_name_id);
     $batch_data = new CActiveDataProvider(get_class($this), array('criteria' => $criteria));
     $_SESSION['batch_records'] = $batch_data;
     return $batch_data;
 }
开发者ID:sharmarakesh,项目名称:edusec-college-management-system,代码行数:33,代码来源:Batch.php

示例10: run

 public function run()
 {
     $ids = Yii::app()->request->getParam('id');
     $sortOrder = Yii::app()->request->getParam('sortOrder');
     $command = Yii::app()->request->getParam('command');
     empty($ids) && $this->controller->message('error', Yii::t('admin', 'No Select'));
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     $criteria = new CDbCriteria();
     $criteria->addInCondition('id', $ids);
     switch ($command) {
         case 'sortOrder':
             //推荐内容排序
             foreach ($ids as $id) {
                 Recommend::model()->updateByPk($id, array('sort_order' => $sortOrder[$id]));
             }
             break;
         case 'unCommend':
             //取消推荐内容
             Recommend::model()->deleteAll($criteria);
             break;
         default:
             throw new CHttpException(404, Yii::t('admin', 'Error Operation'));
     }
     $this->controller->message('success', Yii::t('admin', 'Batch Operate Success'));
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:27,代码来源:BatchAction.php

示例11: actionEvents

 public function actionEvents()
 {
     /**
      * @var $task Task
      * @var $cmd CDbCommand
      */
     $result = array('success' => 1);
     if (isset($_GET['from']) && isset($_GET['to'])) {
         $start = date(Task::DF_INTER, intval($_GET['from']) / 1000);
         $end = date(Task::DF_INTER, intval($_GET['to']) / 1000);
         //echo $start."\n".$end;
         $criteria = new CDbCriteria();
         $criteria->addBetweenCondition('start_date', $start, $end);
         if ($this->_user()->role == User::ROLE_USER) {
             $cmd = Yii::app()->db->createCommand();
             $taskIds = $cmd->select('task_id')->from(Job::model()->tableName())->where('organization_id = :id AND (updated_at BETWEEN :start AND :end)', array(':id' => $this->_user()->organization_id, ':start' => $start, ':end' => $end))->queryColumn();
             $criteria->addInCondition('id', $taskIds);
         }
         $tasks = Task::model()->findAll($criteria, array('order' => array('priority' => 'DESC')));
         $data = array();
         foreach ($tasks as $task) {
             $data[] = array('id' => $task->id, 'title' => $task->name, 'url' => Yii::app()->createUrl('task/view', array('id' => $task->id)), 'start' => strtotime($task->created_at) . '000', 'end' => strtotime($task->created_at) + 1800 . '000', 'class' => 'priority-' . $task->priority);
         }
         $result['result'] = $data;
     }
     $this->renderJSON($result);
 }
开发者ID:nsarvar,项目名称:performance,代码行数:27,代码来源:CalendarController.php

示例12: deEmpleado

 public function deEmpleado($idEmpleado)
 {
     $finalArray = array();
     $empleadoCommand = array();
     //para el Empleado
     $params = array(':idEmpleado' => $idEmpleado, ':entidadTipo' => Empleado::model()->tableName());
     $commad = Yii::app()->db->createCommand()->select('*')->from('actividad_sistema')->where('entidad_id = :idEmpleado AND entidad_tipo=:entidadTipo');
     $commad->params = $params;
     $empleadoCommand = $commad->queryAll();
     $finalArray = $empleadoCommand;
     //        $finalArray = array_merge($deudaClienteCommand, $clienteCommand);
     //        $finalArray = array_merge($finalArray, $transaClienteCommand);
     //        $finalArray = array_merge($finalArray, $clienteMailCommand);
     $arrayId = array();
     foreach ($finalArray as $dato) {
         array_push($arrayId, $dato['id']);
     }
     $criteria = new CDbCriteria();
     $criteria->addInCondition('id', $arrayId);
     $criteria->compare('entidad_tipo', $this->entidad_tipo, true);
     $criteria->compare('entidad_id', $this->entidad_id);
     $criteria->compare('tipo', $this->tipo, true);
     $criteria->compare('usuario_id', $this->usuario_id);
     $criteria->compare('fecha', $this->fecha, true);
     $criteria->compare('detalle', $this->detalle, true);
     $criteria->order = 'fecha DESC';
     return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => array('pageSize' => $this->pageSize)));
 }
开发者ID:Wladimir89,项目名称:software1grh,代码行数:28,代码来源:ActividadSistema.php

示例13: actionChangeStatus

 public function actionChangeStatus(array $ids, $value = 0)
 {
     $value = $value == 1 ? true : false;
     $criteria = new CDbCriteria();
     $criteria->addInCondition('id', $ids);
     AdminUserGroup::model()->updateAll(array('status' => $value), $criteria);
 }
开发者ID:hung5s,项目名称:yap,代码行数:7,代码来源:AdminUserGroupApi.php

示例14: getPushTasks

 public function getPushTasks($push_ids, $push_type)
 {
     $push_tasks = array();
     $criteria = new CDbCriteria();
     $criteria->condition = 'push_type =:push_type and push_status =:push_status';
     $criteria->params = array(':push_type' => $push_type, ':push_status' => 1);
     if ($push_ids) {
         $criteria->addInCondition('id', $push_ids);
     }
     //软件名称、软件包名、下载地址、图标的地址、宣传图片的地址、广告语(两句话,通知栏展示)
     $tasks = $this->findAll($criteria);
     if ($tasks) {
         $host = Util::getHost();
         foreach ($tasks as $key => $task) {
             $push_ad_info = DreamAdPackage::model()->getAdPackageInfo($task->push_ad_id);
             if ($push_ad_info) {
                 $push_tasks[$key]['app_name'] = $push_ad_info->app_name;
                 $push_tasks[$key]['type'] = 'self';
                 $push_tasks[$key]['title'] = $task->push_title;
                 $push_tasks[$key]['content'] = $task->push_description;
                 $push_tasks[$key]['package_name'] = $push_ad_info->package_name;
                 $push_tasks[$key]['icon_url'] = $host . $push_ad_info->icon_url;
                 $push_tasks[$key]['cover_url'] = $push_ad_info->image_url ? $host . $push_ad_info->image_url : "";
                 $download_url = strpos($push_ad_info->download_url, '://') ? $push_ad_info->download_url : $host . $push_ad_info->download_url;
                 $push_tasks[$key]['download_url'] = $download_url;
             }
         }
     }
     return $push_tasks;
 }
开发者ID:wpp8909,项目名称:findzhibo,代码行数:30,代码来源:DreamPushTask.php

示例15: actionAll

 public function actionAll()
 {
     $model = Notify::model();
     $user_id = Yii::app()->user->id;
     $criteria = new CDbCriteria();
     $criteria->with = ['status' => ['select' => ['status.id', 'status.notify_id', 'status.user_id', 'status.read_status', 'IF(status.date_showed, status.date_showed, "' . date('c') . '") as date_showed'], 'on' => 'status.user_id = :user_id']];
     $criteria->params = [':user_id' => $user_id, ':all_users' => Notify::All_USERS, ':type' => Notify::TYPE_DEFAULT, ':today' => date('c'), ':user_date_create' => $model->getUserDateCreate($user_id)];
     $criteria->addCondition('t.user_id=:user_id OR t.user_id=:all_users');
     if ($model->isGroupSupport() && $model->getUserGroups($user_id)) {
         $criteria->addInCondition('t.group_id', $model->getUserGroups($user_id), 'OR');
     }
     $criteria->addCondition('(t.date_create >= :user_date_create AND t.date_show<=:today) AND  (IF(date_end, :today <= date_end, 1) OR status.user_id IS NOT NULL)');
     $criteria->addCondition('t.type = :type');
     $criteria->order = 'date_showed desc, t.date_show desc';
     $count = Notify::model()->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = Yii::app()->notify->numberDisplayInAll;
     $pages->applyLimit($criteria);
     $notifications = Notify::model()->findAll($criteria);
     $ids = array_keys(array_filter(CHtml::listData($notifications, 'id', 'status.read_status'), function ($var) {
         return $var == 0;
     }));
     if ($ids) {
         Notify::changeReadStatusByIds($ids, $user_id, Notify::READ);
         $notifications = Notify::model()->findAll($criteria);
     }
     $this->render('all', ['notifications' => $notifications, 'pages' => $pages]);
 }
开发者ID:bookin,项目名称:yii-notification-center,代码行数:28,代码来源:NotifyController.php


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