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


PHP xPDOQuery::where方法代码示例

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


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

示例1: prepareQueryBeforeCount

 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->where(array('published' => 1, 'deleted' => 0));
     if ($parents = $this->getProperty('parents')) {
         $parents = explode(',', $parents);
         $in = array();
         foreach ($parents as $id) {
             $in = array_merge($in, $this->modx->getChildIds($id));
         }
         $c->where(array('parent:IN' => array_unique($in)));
     }
     if ($resources = $this->getProperty('resources')) {
         $resources = explode(',', $resources);
         $in = $out = array();
         foreach ($resources as $id) {
             if ($id > 0) {
                 $in[] = $id;
             } else {
                 if ($id < 0) {
                     $out[] = abs($id);
                 }
             }
         }
         if (!empty($in)) {
             $c->where(array('id:IN' => $in));
         }
         if (!empty($out)) {
             $c->where(array('id:NOT IN' => $out));
         }
     }
     if ($search = $this->getProperty('search')) {
         $c->where(array('pagetitle:LIKE' => "%{$search}%"));
     }
     return $c;
 }
开发者ID:bendasvadim,项目名称:Schedule,代码行数:35,代码来源:getlist.class.php

示例2: prepareQueryBeforeCount

 /**
  * {@inheritdoc}
  * @param xPDOQuery $c
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $this->elementId = $this->getProperty('elementId', false);
     $this->elementType = $this->getProperty('elementType', false);
     $id = $this->getProperty('id', 0);
     /*$tagNameParts = xPDO :: escSplit('@', $this->getProperty('tag'));
       $propertySet = isset($tagNameParts[1]) ? trim($tagNameParts[1]) : null;
       if (isset($propertySet) && strpos($propertySet,':') != false) {
           $propSetParts = xPDO :: escSplit(':', $propertySet);
           $propertySet = trim($propSetParts[0]);
       }*/
     $c->leftJoin('modElementPropertySet', 'Elements', array('Elements.element_class' => $this->elementType, 'Elements.element' => $this->elementId, 'Elements.property_set = modPropertySet.id'));
     $this->showNotAssociated = (bool) $this->getProperty('showNotAssociated', false);
     $showAssociated = (bool) $this->getProperty('showAssociated', false);
     if ($this->showNotAssociated) {
         $c->where(array('Elements.property_set' => null));
     } else {
         if ($showAssociated) {
             $c->where(array('Elements.property_set:!=' => null));
         }
     }
     /*if (empty($id)) {
           $propertySet = $this->getProperty('propertySet', '');
           if (!empty($propertySet) && $this->modx->getCount('modPropertySet', array('name'=>$propertySet))) {
               $c->orCondition("modPropertySet.name = {$this->modx->quote($propertySet)}");
           }
       }*/
     return $c;
 }
开发者ID:sergant210,项目名称:tagElementPlugin,代码行数:34,代码来源:getpropertysetlist.class.php

示例3: prepareQueryBeforeCount

 /** {@inheritDoc} */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->where(array('class_key' => 'msProduct'));
     $c->leftJoin('msProductData', 'Data', 'msProduct.id = Data.id');
     $c->leftJoin('msCategoryMember', 'Member', 'msProduct.id = Member.product_id');
     $c->leftJoin('msVendor', 'Vendor', 'Data.vendor = Vendor.id');
     $c->leftJoin('msCategory', 'Category', 'Category.id = msProduct.parent');
     if ($this->getProperty('combo')) {
         $c->select('msProduct.id,msProduct.pagetitle,msProduct.context_key');
     } else {
         $c->select($this->modx->getSelectColumns('msProduct', 'msProduct'));
         $c->select($this->modx->getSelectColumns('msProductData', 'Data', '', array('id'), true));
         $c->select($this->modx->getSelectColumns('msVendor', 'Vendor', 'vendor_', array('name')));
         $c->select($this->modx->getSelectColumns('msCategory', 'Category', 'category_', array('pagetitle')));
     }
     if ($query = $this->getProperty('query', null)) {
         $queryWhere = array('msProduct.id' => $query, 'OR:msProduct.pagetitle:LIKE' => '%' . $query . '%', 'OR:description:LIKE' => '%' . $query . '%', 'OR:introtext:LIKE' => '%' . $query . '%', 'OR:Data.article:LIKE' => '%' . $query . '%', 'OR:Data.vendor:LIKE' => '%' . $query . '%', 'OR:Data.made_in:LIKE' => '%' . $query . '%', 'OR:Vendor.name:LIKE' => '%' . $query . '%', 'OR:Category.pagetitle:LIKE' => '%' . $query . '%');
         $c->where($queryWhere);
     }
     $parent = $this->getProperty('parent');
     if (!empty($parent)) {
         $category = $this->modx->getObject('modResource', $this->getProperty('parent'));
         $this->parent = $parent;
         $parents = array($parent);
         if ($this->modx->getOption('ms2_category_show_nested_products', null, true)) {
             $tmp = $this->modx->getChildIds($parent, 10, array('context' => $category->get('context_key')));
             foreach ($tmp as $v) {
                 $parents[] = $v;
             }
         }
         $c->orCondition(array('parent:IN' => $parents, 'Member.category_id:IN' => $parents), '', 1);
     }
     return $c;
 }
开发者ID:rafull6,项目名称:texno-service,代码行数:35,代码来源:getlist.class.php

示例4: prepareQueryBeforeCount

 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->leftJoin('modMediaSource', 'Source');
     $c->leftJoin($this->classKey, 'Thumb', "`{$this->classKey}`.`id` = `Thumb`.`parent`");
     $c->groupby($this->classKey . '.id');
     $c->select('`Source`.`name` as `source_name`');
     $c->select('`Thumb`.`url` as `thumbnail`');
     $c->where(array('resource_id' => $this->getProperty('resource_id')));
     $parent = $this->getProperty('parent');
     if ($parent !== false) {
         $c->where(array('parent' => $parent));
     }
     $query = trim($this->getProperty('query'));
     if (!empty($query)) {
         $c->where(array('file:LIKE' => "%{$query}%", 'OR:name:LIKE' => "%{$query}%", 'OR:alt:LIKE' => "%{$query}%", 'OR:description:LIKE' => "%{$query}%", 'OR:add:LIKE' => "%{$query}%"));
     }
     $tags = array_map('trim', explode(',', $this->getProperty('tags')));
     if (!empty($tags[0])) {
         $tags = implode("','", $tags);
         $c->innerJoin('msResourceFileTag', 'Tag', "`{$this->classKey}`.`id` = `Tag`.`file_id` AND `Tag`.`tag` IN ('" . $tags . "')");
         $c->groupby($this->classKey . '.id');
         $c->prepare();
         $this->modx->log(1, $c->toSQL());
     }
     return $c;
 }
开发者ID:svyatoslavteterin,项目名称:belton.by,代码行数:31,代码来源:getlist.class.php

示例5: prepareQueryBeforeCount

 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $id = $this->getProperty('id');
     if (!empty($id) and $this->getProperty('combo')) {
         $q = $this->modx->newQuery($this->objectType);
         $q->where(array('id!=' => $id));
         $q->select('id');
         $q->limit(11);
         $q->prepare();
         $q->stmt->execute();
         $ids = $q->stmt->fetchAll(PDO::FETCH_COLUMN, 0);
         $ids = array_merge_recursive(array($id), $ids);
         $c->where(array("{$this->objectType}.id:IN" => $ids));
     }
     $active = $this->getProperty('active');
     if ($active != '') {
         $c->where("{$this->objectType}.active={$active}");
     }
     $query = trim($this->getProperty('query'));
     if ($query) {
         $c->where(array("{$this->objectType}.name_ru:LIKE" => "%{$query}%", "OR:{$this->objectType}.name_en:LIKE" => "%{$query}%"));
     }
     $c->sortby('active', 'DESC');
     $c->sortby('name_ru', 'ASC');
     return $c;
 }
开发者ID:ViieeS,项目名称:gl,代码行数:31,代码来源:getlist.class.php

示例6: prepareQueryBeforeCount

 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $context = array_map('trim', explode(',', $this->getProperty('context', $this->modx->context->key)));
     $c->where(array('class_key' => 'TicketsSection', 'published' => 1, 'deleted' => 0, 'context_key:IN' => $context));
     $sortby = $this->getProperty('sortby');
     $sortdir = $this->getProperty('sortdir');
     if ($sortby && $sortdir) {
         $c->sortby($sortby, $sortdir);
     }
     if (!empty($_REQUEST['tid']) && ($tmp = $this->modx->getObject('Ticket', (int) $_REQUEST['tid']))) {
         $this->current_category = $tmp->get('parent');
     }
     if ($parents = $this->getProperty('parents')) {
         $depth = $this->getProperty('depth', 0);
         $parents = array_map('trim', explode(',', $parents));
         foreach ($parents as $pid) {
             $parents = array_merge($parents, $this->modx->getChildIds($pid, $depth));
         }
         if (!empty($parents) && !empty($this->current_category)) {
             $c->where(array('parent:IN' => $parents, 'OR:id:=' => $this->current_category));
         } else {
             $c->where(array('parent:IN' => $parents));
         }
     }
     if ($resources = $this->getProperty('resources')) {
         $resources = array_map('trim', explode(',', $resources));
         $c->where(array('id:IN' => $resources));
     }
     return $c;
 }
开发者ID:soulcreate,项目名称:Tickets,代码行数:35,代码来源:getlist.class.php

示例7: prepareQueryBeforeCount

 /**
  * @return mixed
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->select($this->modx->getSelectColumns('modManagerLog', 'modManagerLog', '', array('action'), true));
     //        $c->select($this->modx->getSelectColumns('modManagerLog','modManagerLog'));
     $c->select(array('User.username', 'Template.templatename', 'Chunk.name as chunkname', 'Snippet.name as snippetname', 'Plugin.name as pluginname', 'TV.name as tvname'));
     $c->innerJoin('modUser', 'User');
     $c->leftJoin('modTemplate', 'Template', '`modManagerLog`.item = `Template`.`id` AND `modManagerLog`.`classKey` = "modTemplate"');
     $c->leftJoin('modChunk', 'Chunk', '`modManagerLog`.item = `Chunk`.`id` AND `modManagerLog`.`classKey` = "modChunk"');
     $c->leftJoin('modSnippet', 'Snippet', '`modManagerLog`.item = `Snippet`.`id` AND `modManagerLog`.`classKey` = "modSnippet"');
     $c->leftJoin('modPlugin', 'Plugin', '`modManagerLog`.item = `Plugin`.`id` AND `modManagerLog`.`classKey` = "modPlugin"');
     $c->leftJoin('modTemplateVar', 'TV', '`modManagerLog`.item = `TV`.`id` AND `modManagerLog`.`classKey` = "modTemplateVar"');
     $query = trim($this->getProperty('query'));
     if ($query) {
         $c->where('(Template.templatename LIKE "%' . $query . '%" OR Chunk.name LIKE "%' . $query . '%" OR Snippet.name LIKE "%' . $query . '%" OR Plugin.name LIKE "%' . $query . '%" OR TV.name LIKE "%' . $query . '%")');
     } else {
         $c->where('(modManagerLog.action LIKE "template_%" OR modManagerLog.action LIKE "chunk_%" OR modManagerLog.action LIKE "snippet_%" OR modManagerLog.action LIKE "plugin_%" OR modManagerLog.action LIKE "tv_%")');
     }
     $user = intval($this->getProperty('user'));
     if ($user) {
         $c->andCondition(array('modManagerLog.user' => $user));
     }
     $dateStart = trim($this->getProperty('datestart'));
     if ($dateStart) {
         $dateStart = date('Y-m-d', strtotime($dateStart));
         $c->andCondition(array('modManagerLog.occurred:>=' => $dateStart));
     }
     $dateEnd = trim($this->getProperty('dateend'));
     if ($dateEnd) {
         $dateEnd = date('Y-m-d 23:59:59', strtotime($dateEnd));
         $c->andCondition(array('modManagerLog.occurred:<=' => $dateEnd));
     }
     return $c;
 }
开发者ID:sergant210,项目名称:AdminTools,代码行数:36,代码来源:getlist.class.php

示例8: prepareQueryBeforeCount

 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     if ($linkType = $this->getProperty('link_type', false)) {
         $templates = array();
         $resources = array();
         if ($linkType === 'res-chunk') {
             $templates = $this->getParentsByLink('temp-chunk');
             $templates = array_merge($templates, $this->getParentsByLink('chunk-chunk', 'temp-chunk'));
             $resources = $this->getParentsByLink('res-chunk');
         } else {
             if ($linkType === 'res-snip') {
                 $templates = $this->getParentsByLink('temp-snip');
                 $templates = array_merge($templates, $this->getParentsByLink('chunk-snip', 'temp-chunk'));
                 $resources = $this->getParentsByLink('res-snip');
             }
         }
         $templates = array_unique($templates);
         $tempCount = count($templates);
         $resCount = count($resources);
         if ($tempCount == 0 && $resCount == 0) {
             $c->where(array('id' => 0));
         } else {
             if ($tempCount > 0) {
                 $c->where(array('template:IN' => $templates));
             }
             if ($resCount > 0) {
                 $c->orCondition(array('id:IN' => $resources));
             }
         }
     } else {
         $c->where(array('template' => $this->getProperty('id')));
     }
     return $c;
 }
开发者ID:raadhuis,项目名称:modx-basic,代码行数:39,代码来源:getlist.class.php

示例9: prepareQueryBeforeCount

 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->leftJoin("glData", "glData", "glData.identifier = {$this->classKey}.id");
     $c->select($this->modx->getSelectColumns("glData", "glData"));
     $c->select($this->modx->getSelectColumns($this->classKey, $this->classKey));
     switch ($this->classKey) {
         case 'glCountry':
             break;
         case 'glRegion':
             $c->leftJoin("glCountry", "glCountry", "glCountry.iso = {$this->classKey}.country");
             $c->select($this->modx->getSelectColumns("glCountry", "glCountry", 'country_', array('id'), true));
             break;
         case 'glCity':
             $c->leftJoin("glRegion", "glRegion", "glRegion.id = {$this->classKey}.region_id");
             $c->select($this->modx->getSelectColumns("glRegion", "glRegion", 'region_', array('id'), true));
             $c->leftJoin("glCountry", "glCountry", "glCountry.iso = glRegion.country");
             $c->select($this->modx->getSelectColumns("glCountry", "glCountry", 'country_', array('id'), true));
             break;
     }
     $active = $this->getProperty('active');
     if ($active != '') {
         $c->where(array("{$this->objectType}.active" => $active));
     }
     $default = $this->getProperty('default');
     if ($default != '') {
         $c->where(array("{$this->objectType}.default" => $default));
     }
     $query = trim($this->getProperty('query'));
     if ($query) {
         $c->where(array("{$this->objectType}.name_ru:LIKE" => "%{$query}%", "OR:{$this->objectType}.name_en:LIKE" => "%{$query}%"));
     }
     return $c;
 }
开发者ID:vgrish,项目名称:gl,代码行数:38,代码来源:getlist.class.php

示例10: prepareQueryBeforeCount

 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $class = $this->getProperty('class');
     if ($class) {
         $c->where(array('class' => $class));
     }
     if ($this->getProperty('combo')) {
         $c->select('id,name');
         if ($instance_id = $this->getProperty('instance_id')) {
             if ($instance = $this->modx->getObject($class, $instance_id)) {
                 $status = $instance->getOne('Status');
                 if ($status->get('final') == 1) {
                     $c->where(array('id' => $status->get('id')));
                 } else {
                     if ($status->get('fixed') == 1) {
                         $c->where(array('rank:>=' => $status->get('rank')));
                     }
                 }
             }
         }
     }
     $query = trim($this->getProperty('query'));
     if ($query) {
         $c->where(array('name:LIKE' => "%{$query}%", 'OR:description:LIKE' => "%{$query}%"));
     }
     return $c;
 }
开发者ID:vgrish,项目名称:mlmsystem,代码行数:32,代码来源:getlist.class.php

示例11: prepareQueryBeforeCount

 function prepareQueryBeforeCount(xPDOQuery $c)
 {
     // Filter by position
     if ($position = $this->getProperty('position')) {
         $mode = $this->getProperty('mode', 'include');
         $q = $this->modx->newQuery('byAdPosition');
         $q->select('ad');
         $q->where(array('position' => $position));
         if ($q->prepare() && $q->stmt->execute()) {
             $ads = array_unique($q->stmt->fetchAll(PDO::FETCH_COLUMN));
         }
         if (!empty($ads)) {
             if ($mode == 'exclude') {
                 $c->where(array('id:NOT IN' => $ads));
             } else {
                 $c->where(array('id:IN' => $ads));
             }
         }
     }
     // Filter by search query
     if ($query = $this->getProperty('query')) {
         $c->where(array('name:LIKE' => "%{$query}%", 'OR:description:LIKE' => "%{$query}%"));
     }
     return $c;
 }
开发者ID:suasti,项目名称:BannerY,代码行数:25,代码来源:getlist.class.php

示例12: prepareQueryBeforeCount

 /** {@inheritDoc} */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->where(array('class_key' => 'msCategory'));
     if ($query = $this->getProperty('query')) {
         $c->where(array('pagetitle:LIKE' => "%{$query}%"));
     }
     return $c;
 }
开发者ID:volkovnd,项目名称:miniShop2,代码行数:9,代码来源:getlist.class.php

示例13: prepareQueryBeforeCount

 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->where(array('product_id' => $this->getProperty('product_id')));
     $parent = $this->getProperty('parent');
     if ($parent !== false) {
         $c->where(array('parent' => $parent));
     }
     return $c;
 }
开发者ID:bendasvadim,项目名称:miniShop2,代码行数:9,代码来源:getlist.class.php

示例14: prepareQueryBeforeCount

 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $query = $this->getProperty('query');
     if (!empty($query)) {
         $c->where(array('pagetitle:LIKE' => '%' . $query . '%'));
     }
     $c->where(array('deleted' => false, 'published' => true));
     $c->sortby('pagetitle', 'ASC');
     return $c;
 }
开发者ID:Boddlnagg,项目名称:CustomRequest,代码行数:10,代码来源:getlist.class.php

示例15: prepareQueryBeforeCount

 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->leftJoin('quipThread', 'Thread');
     $c->where(array('quipCommentNotify.thread:=' => $this->getProperty('thread')));
     $search = $this->getProperty('search');
     if ($search) {
         $c->where(array('quipCommentNotify.email:LIKE' => '%' . $search . '%'), null, 2);
     }
     return $c;
 }
开发者ID:raadhuis,项目名称:modx-basic,代码行数:10,代码来源:getlist.class.php


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