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


PHP CDbCriteria::addNotInCondition方法代码示例

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


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

示例1: run

 public function run()
 {
     if (empty($this->model) || empty($this->type)) {
         return;
     }
     // Определяем тип товара для поиска товаров данного типа
     $productType = ProductType::model()->published()->findByAlias($this->type);
     if (!$productType) {
         return;
     }
     // Определяем товар данного типа с таким же названием, как заданный
     $relatedProduct = Stone::model()->published()->type($productType->id)->with('series')->findByAttributes(array('title' => $this->model->title));
     // Получаем список рандомных товаров данного типа, похожих на заданный по цвету и виду камня
     $criteria = new CDbCriteria();
     $criteria->compare('t.series_id', $this->model->series_id);
     $criteria->compare('t.color_id', $this->model->color_id);
     $notSearchIds = array($this->model->id);
     if ($relatedProduct !== null) {
         $notSearchIds[] = $relatedProduct->id;
     }
     $criteria->addNotInCondition('t.id', $notSearchIds);
     $criteria->order = 'RAND()';
     $criteria->limit = 7;
     $models = Stone::model()->published()->type($productType->id)->with('series')->findAll($criteria);
     if ($relatedProduct !== null) {
         $models = array($relatedProduct) + $models;
     }
     $this->render($this->view, array('productType' => $productType, 'models' => $models, 'model' => $this->model));
 }
开发者ID:kuzmina-mariya,项目名称:unizaro-stone,代码行数:29,代码来源:SimilarProductsWidget.php

示例2: deleteOldItems

 public function deleteOldItems($model, $itemsPk)
 {
     $criteria = new CDbCriteria();
     $criteria->addNotInCondition('coupon_id', $itemsPk);
     $criteria->addCondition("listing_id= {$model->primaryKey}");
     Coupon::model()->deleteAll($criteria);
 }
开发者ID:yasirgit,项目名称:hotmall,代码行数:7,代码来源:CouponManager.php

示例3: actionIndex

 public function actionIndex()
 {
     Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . '/css/post.css');
     $left_news = Post::model()->findAll(array('select' => 'id, title, image, summary', 'condition' => 'catalog_id = :catalog_id', 'params' => array(':catalog_id' => 3), 'order' => 'id DESC', 'limit' => 3));
     $special_ids = array();
     foreach ($left_news as $row) {
         array_push($special_ids, $row->id);
     }
     $criteria = new CDbCriteria();
     $criteria->select = 'id, title, summary';
     $criteria->order = 'id DESC';
     $criteria->addCondition('catalog_id = 3');
     $criteria->addNotInCondition('id', $special_ids);
     $criteria->limit = 1;
     $top_news = Post::model()->findAll($criteria);
     array_push($special_ids, $top_news[0]->id);
     $criteria = new CDbCriteria();
     $criteria->order = 'id DESC';
     $criteria->addCondition('catalog_id = 3');
     $criteria->addNotInCondition('id', $special_ids);
     $count = Post::model()->count($criteria);
     $pager = new CPagination($count);
     $pager->pageSize = 30;
     $pager->applyLimit($criteria);
     $more_news = Post::model()->findAll($criteria);
     $data = array('left_news' => $left_news, 'top_news' => $top_news[0], 'more_news' => $more_news, 'pages' => $pager);
     $this->render('index', $data);
 }
开发者ID:zywh,项目名称:maplecity,代码行数:28,代码来源:StudyabroadController.php

示例4: actionHideremnants

 public function actionHideremnants()
 {
     $readableFile = Yii::getPathOfAlias('webroot') . $this->module->folderFiles;
     $content = @file_get_contents($readableFile . '/' . $this->module->readFileProducts);
     $errors = [];
     $productId = [];
     $IdC = [];
     if ($content) {
         foreach (explode("\n", $content) as $id => $string) {
             $attr = explode(";", $string);
             $IdC[] = $attr[2];
         }
         $criteria = new CDbCriteria();
         $criteria->select = 'id';
         $criteria->compare('id_1c', $IdC, true);
         $products = Product::model()->findAll($criteria);
         foreach ($products as $key => $value) {
             $productId[] = $value->id;
         }
         $criteria = new CDbCriteria();
         $criteria->addCondition('status = :status');
         $criteria->params = [':status' => 1];
         $criteria->addNotInCondition('id', $productId);
         $model = Product::model()->findAll($criteria);
         foreach ($model as $key => $value) {
             $value->status = 2;
             $value->save();
         }
     }
 }
开发者ID:QSODevelopers,项目名称:yupe-storeswap,代码行数:30,代码来源:DefaultController.php

示例5: report

 function report($id, $pro_id)
 {
     $criteria = new CDbCriteria();
     $criteria->order = 'code';
     $criteria->compare('department_id', $pro_id);
     $criteria->compare('parent_id', $id);
     //$criteria->compare('amount!',0);
     $criteria->addNotInCondition('id', array(193, 119, 164, 198));
     $models = aBudget::model()->findAll($criteria);
     $this->myheader($id, $pro_id);
     $w = array(47, 23, 23, 10, 23, 10, 23, 10, 23);
     $this->SetFont('Arial', '', 7);
     $_total = 0;
     $_realization = 0;
     $_payment = 0;
     $_unpayment = 0;
     $_balance = 0;
     foreach ($models as $model) {
         $_amount = $model->amount;
         $_real = aBudget::model()->allComponent($model->id, 2012, 1);
         $_realP = $_amount != 0 ? $_real / $_amount * 100 : 0;
         $_paid = aBudget::model()->allComponentPaid($model->id, 2012, 1);
         $_paidP = $_real != 0 ? $_paid / $_real * 100 : 0;
         $_unpaid = $_real - $_paid;
         $_unpaidP = $_real != 0 ? $_unpaid / $_real * 100 : 0;
         $_endBalance = isset($model->end_balance) ? $model->end_balance->balance : $_amount;
         $this->SetFont('Arial', '', 7);
         $this->Cell($w[0], 6, $model->code . ". " . $model->name, 'L');
         $this->Cell($w[1], 6, number_format($_amount, 2, ',', '.'), 'LR', 0, 'R');
         $this->Cell($w[2], 6, number_format($_real, 2, ',', '.'), '', 0, 'R');
         $this->Cell($w[3], 6, round($_realP, 2), 'LR', 0, 'R');
         $this->Cell($w[4], 6, number_format($_paid, 2, ',', '.'), '', 0, 'R');
         $this->Cell($w[5], 6, round($_paidP, 2), 'LR', 0, 'R');
         $this->Cell($w[6], 6, number_format($_unpaid, 2, ',', '.'), '', 0, 'R');
         $this->Cell($w[7], 6, round($_unpaidP, 2), 'LR', 0, 'R');
         $this->Cell($w[8], 6, number_format($_endBalance, 0, ',', '.'), 'LR', 0, 'R');
         $this->Ln();
         $_total = $_total + $_amount;
         $_realization = $_realization + $_real;
         $_payment = $_payment + $_paid;
         $_unpayment = $_unpayment + $_unpaid;
         $_balance = $_balance + $_endBalance;
     }
     $this->Cell(array_sum($w), 4, '', 'T');
     $this->Ln(6);
     $_realizationP = $_total != 0 ? $_realization / $_total * 100 : 0;
     $_paymentP = $_realization != 0 ? $_payment / $_realization * 100 : 0;
     $_unpaymentP = $_realization != 0 ? $_unpayment / $_realization * 100 : 0;
     $this->SetFont('Arial', 'B', 8);
     $this->Cell($w[0], 8, 'T O T A L', 1);
     $this->Cell($w[1], 8, number_format($_total, 0, ',', '.'), 1, 0, 'R');
     $this->Cell($w[2], 8, number_format($_realization, 0, ',', '.'), 1, 0, 'R');
     $this->Cell($w[3], 8, round($_realizationP, 2), 1, 0, 'R');
     $this->Cell($w[4], 8, number_format($_payment, 0, ',', '.'), 1, 0, 'R');
     $this->Cell($w[5], 8, round($_paymentP, 2), 1, 0, 'R');
     $this->Cell($w[6], 8, number_format($_unpayment, 0, ',', '.'), 1, 0, 'R');
     $this->Cell($w[7], 8, round($_unpaymentP, 2), 1, 0, 'R');
     $this->Cell($w[8], 8, number_format($_balance, 0, ',', '.'), 1, 0, 'R');
     $this->Ln();
 }
开发者ID:rusli-nasir,项目名称:ERP_Accounting_Indonesia,代码行数:60,代码来源:aBudgetPosition2.php

示例6: actionAutoComplete

 /**
  * Search the local authorities and return both their address and the address of their social security department
  *
  * @param $term
  */
 public function actionAutoComplete($term)
 {
     $crit = new \CDbCriteria();
     // NOTE: have commented out the address eager loading here due to column ambiguity issues with the relation definitions.
     // need to investigate if this can be solved with the cunning use of scopes on the Contact model or not.
     $crit->with = array('contact' => array('alias' => 'service_contact'), 'commissioning_body', 'commissioning_body.contact', 'type' => array('alias' => 'service_type'), 'commissioning_body.type' => array('alias' => 'body_type'));
     $crit->compare('LOWER(t.name)', strtolower($term), true);
     $crit->compare('LOWER(commissioning_body.name)', strtolower($term), true, 'OR');
     $crit->addColumnCondition(array('service_type.shortname' => 'SSD'));
     $crit->addColumnCondition(array('body_type.shortname' => 'LA'));
     $crit->order = 'commissioning_body.name, t.name';
     $results = array();
     $found_bodies = array();
     foreach (\CommissioningBodyService::model()->findAll($crit) as $cbs) {
         $body = $cbs->commissioning_body;
         $found_bodies[] = $body->id;
         $results[] = array('id' => 'service' . $cbs->id, 'value' => $cbs->name . " ({$body->name})", 'service' => array('id' => $cbs->id, 'name' => $cbs->name, 'address' => $cbs->getLetterAddress(array('delimiter' => ",\n")), 'telephone' => $cbs->contact->primary_phone), 'body' => array('id' => $body->id, 'name' => $body->name, 'address' => $body->getLetterAddress(array('delimiter' => ",\n")), 'telephone' => $body->contact->primary_phone));
     }
     $body_crit = new \CDbCriteria();
     $body_crit->with = array('type', 'contact', 'contact.correspondAddress');
     $body_crit->compare('LOWER(t.name)', strtolower($term), true);
     $body_crit->addNotInCondition('t.id', $found_bodies);
     $body_crit->addColumnCondition(array('type.shortname' => 'LA'));
     foreach (\CommissioningBody::model()->findAll($body_crit) as $body) {
         $results[] = array('id' => 'body' . $body->id, 'value' => $body->name, 'body' => array('id' => $body->id, 'name' => $body->name, 'address' => $body->getLetterAddress(array('delimiter' => ",\n")), 'telephone' => $body->contact->primary_phone));
     }
     echo json_encode($results);
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:33,代码来源:LocalAuthorityController.php

示例7: actionUser

 public function actionUser()
 {
     $user = User::model()->findByPk(isset($_REQUEST['user_id']) ? intval($_REQUEST['user_id']) : null);
     if (is_null($user)) {
         $user = new User();
     }
     $criteria = new CDbCriteria();
     $criteria->compare('controller', Yii::app()->params['controllers'][2]);
     $criteria->compare('enable', '1');
     $criteria->addNotInCondition('action', AccessGlobal::getDefaultAction());
     $criteria->order = "action asc";
     $actions = AccessGlobal::model()->findAll($criteria);
     if (Yii::app()->request->isPostRequest && isset($_POST['User'])) {
         $user->attributes = $_POST['User'];
         $user->pass = $_POST['User']['pass'];
         if ($user->save()) {
             AccessUser::model()->deleteAllByAttributes(array('user_id' => $user->user_id));
             $accessForUser = array_merge($_POST['access'] ? $_POST['access'] : array(), AccessGlobal::getIdDefaultAction());
             foreach ($accessForUser as $val) {
                 $access = new AccessUser();
                 $access->user_id = $user->user_id;
                 $access->action_id = $val;
                 $access->save();
             }
             $this->redirect($this->createUrl('superadmin/users'));
         }
     }
     $this->render('user', array('user' => $user, 'actions' => $actions, 'access' => AccessUser::getActionIdFromUser($user->user_id)));
 }
开发者ID:anton-itscript,项目名称:WM-Web,代码行数:29,代码来源:SuperadminController.php

示例8: getSimilarPosts

 public function getSimilarPosts(Post $post, $limit = 10)
 {
     $criteria = new CDbCriteria();
     $criteria->limit = $limit;
     $criteria->order = 'publish_time DESC';
     $criteria->addNotInCondition('t.id', [$post->id]);
     $criteria->mergeWith(Post::model()->public()->published()->getFindByTagsCriteria($post->getTags()));
     return Post::model()->findAll($criteria);
 }
开发者ID:RonLab1987,项目名称:43berega,代码行数:9,代码来源:PostManager.php

示例9: getPrescriptionItemsForPatient

 /**
  * @param Patient $patient
  * @param array   $exclude
  *
  * @return array|CActiveRecord[]|mixed|null
  */
 public function getPrescriptionItemsForPatient(Patient $patient, $exclude = array())
 {
     $prescriptionCriteria = new CDbCriteria(array('order' => 'event_date DESC'));
     $prescriptionCriteria->addCondition('episode.patient_id = :id');
     $prescriptionCriteria->addNotInCondition('t.id', $exclude);
     $prescriptionCriteria->params = array_merge($prescriptionCriteria->params, array(':id' => $patient->id));
     $prescriptionItems = OphDrPrescription_Item::model()->with('prescription', 'drug', 'duration', 'prescription.event', 'prescription.event.episode')->findAll($prescriptionCriteria);
     return $prescriptionItems;
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:15,代码来源:OphDrPrescription_API.php

示例10: run

 public function run()
 {
     $criteria = new CDbCriteria();
     $criteria->limit = $this->limit;
     $criteria->order = 'publish_date DESC';
     $criteria->addNotInCondition('t.id', array($this->post->id));
     $criteria->mergeWith(Post::model()->public()->published()->getFindByTagsCriteria($this->post->getTags()));
     $posts = Post::model()->findAll($criteria);
     $this->render($this->view, array('posts' => $posts));
 }
开发者ID:sepaker,项目名称:yupe,代码行数:10,代码来源:SimilarPostsWidget.php

示例11: searchNotFor

 public function searchNotFor($id)
 {
     $criteria = new CDbCriteria();
     $criteria->compare('name', $this->name, true);
     $criteria->compare('price', $this->price);
     $criteria->compare('sku', $this->sku, true);
     $criteria->compare('category_id', $this->category_id);
     $criteria->addNotInCondition('id', [$id]);
     return new CActiveDataProvider(get_class($this), ['criteria' => $criteria, 'sort' => ['defaultOrder' => 't.position']]);
 }
开发者ID:alextravin,项目名称:yupe,代码行数:10,代码来源:ProductSearch.php

示例12: getOrganizationsForTaskCreate

 public function getOrganizationsForTaskCreate()
 {
     $criteria = new CDbCriteria();
     if ($this->so_ids) {
         $criteria->addNotInCondition('id', explode(',', $this->so_ids), true);
     }
     $criteria->compare('name', $this->name, true);
     $criteria->compare('type', $this->type, true);
     $criteria->compare('region_id', $this->region_id, true);
     return new CActiveDataProvider($this, array('criteria' => $criteria, 'sort' => array('defaultOrder' => 'name', 'route' => 'task/organizations/'), 'pagination' => array('pageSize' => 1000, 'route' => 'task/organizations/')));
 }
开发者ID:nsarvar,项目名称:performance,代码行数:11,代码来源:Organization.php

示例13: afterSave

 protected function afterSave()
 {
     if ($this->scenario == 'selectEvaAttributes') {
         $evaAttribsArray = json_decode($this->evaAttributes);
         $assMethodsCriteria = new CDbCriteria();
         $assMethodsCriteria->condition = 'evaluationId=' . $this->evalId;
         $assMethodsCriteria->addNotInCondition('evaAttribute', $evaAttribsArray);
         EvaAssessmentMethods::model()->deleteAll($assMethodsCriteria);
         return parent::afterSave();
     }
 }
开发者ID:schrapps,项目名称:risksur,代码行数:11,代码来源:EvaluationHeader.php

示例14: searchFilter

 public function searchFilter()
 {
     $criteria1 = new CDbCriteria();
     $criteria1->compare('receiver_id', Yii::app()->user->id, false, 'OR');
     $criteria1->compare('sender_id', Yii::app()->user->id, false, 'OR');
     $criteria = new CDbCriteria();
     $criteria->mergeWith($criteria1);
     $criteria->compare('type_id', 2);
     $criteria->addNotInCondition('read_id', array(6));
     $criteria->order = 'sender_date DESC';
     return new CActiveDataProvider(get_class($this), array('criteria' => $criteria, 'pagination' => array('pageSize' => 5)));
 }
开发者ID:kit9,项目名称:ERP_Accounting_Indonesia,代码行数:12,代码来源:sNotification.php

示例15: getValidParents

 public function getValidParents()
 {
     $result = array();
     $criteria = new CDbCriteria();
     if (!$this->_model->getIsNewRecord()) {
         $criteria->addNotInCondition($this->getPK(), $this->getDescendantsIds($this->_model));
     }
     foreach ($this->_model->findAll($criteria) as $model) {
         $result[$model->{$this->getPK()}] = $model->getCaption();
     }
     return $result;
 }
开发者ID:hit-shappens,项目名称:testapp,代码行数:12,代码来源:ParentChildARBehavior.php


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