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


PHP Article::buildArticleListCriteria方法代码示例

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


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

示例1: buildSiteListCriteria

 public static function buildSiteListCriteria(&$criteria, &$params_list, $is_module = false, $mid = 'm.id')
 {
     if (empty($params_list)) {
         return null;
     }
     $conditions = $values = $joins = array();
     if ($is_module) {
         $m = 'm';
         $m2 = 's';
         $midi18n = $mid;
         $join = null;
         $join_id = null;
         $join_idi18n = null;
         $join_i18n = 'site_i18n';
     } else {
         $m = 't';
         $m2 = 's';
         $mid = array('l' . $m, $mid);
         $midi18n = implode('.', $mid);
         $join = 'site';
         $join_id = $join . '_id';
         $join_idi18n = $join . '_idi18n';
         $join_i18n = $join . '_i18n';
     }
     $nb_id = 0;
     $nb_name = 0;
     if ($is_module) {
         $nb_id = self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $mid, 'id', $join_id);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Id', 'lt.main_id', 'sites', 'site_id');
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Id', 'ltt.linked_id', 'subsites', 'subsite_id');
     } else {
         $nb_id = self::buildConditionItem($conditions, $values, $joins, $params_list, 'MultiId', $mid, 'sites', $join_id);
     }
     $has_id = $nb_id == 1;
     if (!$has_id) {
         if ($is_module) {
             self::buildConditionItem($conditions, $values, $joins, $params_list, 'Georef', $join, 'geom', $join);
         }
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Around', $m2 . '.geom', 'tarnd', $join);
         $nb_name = self::buildConditionItem($conditions, $values, $joins, $params_list, 'String', array($midi18n, 'ti.search_name'), $is_module ? array('tnam', 'name') : 'tnam', array($join_idi18n, $join_i18n), 'Site');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         $nb_id += $nb_name;
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Compare', $m . '.elevation', 'talt', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Array', array($m, $m2, 'site_types'), 'ttyp', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Array', array($m, $m2, 'climbing_styles'), 'tcsty', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Compare', $m . '.equipment_rating', 'tprat', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Compare', $m . '.routes_quantity', 'rqua', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Compare', $m . '.mean_height', 'tmhei', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Compare', $m . '.mean_rating', 'tmrat', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Array', array($m, $m2, 'facings'), 'tfac', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Array', array($m, $m2, 'rock_types'), 'trock', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $m . '.children_proof', 'chil', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $m . '.rain_proof', 'rain', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', 'ti.culture', 'tcult', $join_i18n);
         // book criteria
         $nb_name = Book::buildBookListCriteria($criteria, $params_list, false, 't', 'main_id');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         // article criteria
         $nb_name = Article::buildArticleListCriteria($criteria, $params_list, false, 't', 'linked_id');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         if (isset($criteria[2]['join_tbook']) || isset($criteria[2]['join_tarticle'])) {
             $joins['join_site'] = true;
             if (!$is_module) {
                 $joins['post_site'] = true;
             }
         }
     }
     if (!empty($conditions)) {
         $criteria[0] = array_merge($criteria[0], $conditions);
         $criteria[1] = array_merge($criteria[1], $values);
     }
     if (!empty($joins)) {
         $joins['join_site'] = true;
     }
     if ($is_module && $nb_id) {
         $joins['nb_id'] = $nb_id;
     }
     $criteria[2] += $joins;
     return null;
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:86,代码来源:Site.class.php

示例2: buildAreaListCriteria

 public static function buildAreaListCriteria(&$criteria, &$params_list, $is_module = false, $mid = 'm.id')
 {
     if (empty($params_list)) {
         return null;
     }
     $conditions = $values = $joins = array();
     if ($is_module) {
         $m = 'm';
         $m2 = 'a';
         $midi18n = $mid;
         $join = null;
         $join_id = null;
         $join_idi18n = null;
         $join_i18n = 'area_i18n';
     } else {
         $m = 'a';
         $m2 = $m;
         $mid = array('g' . $m, $mid);
         $midi18n = implode('.', $mid);
         $join = 'area';
         $join_id = $join . '_id';
         $join_idi18n = $join . '_idi18n';
         $join_i18n = $join . '_i18n';
     }
     $nb_id = 0;
     $nb_name = 0;
     if ($is_module) {
         $nb_id = self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $mid, array('id', 'areas'), $join_id);
     } else {
         $nb_id = self::buildConditionItem($conditions, $values, $joins, 'Multilist', $mid, 'areas', $join_id, false, $params_list);
     }
     $has_id = $nb_id == 1;
     if (!$has_id) {
         if ($is_module) {
             // self::buildConditionItem($conditions, $values, $joins, $params_list, 'Array', array($m, 'a', 'activities'), 'act', $join);
             self::buildConditionItem($conditions, $values, $joins, $params_list, 'Bbox', 'geom', 'bbox', $join);
             self::buildConditionItem($conditions, $values, $joins, $params_list, 'Around', 'geom', 'around', $join);
         }
         $nb_name = self::buildConditionItem($conditions, $values, $joins, $params_list, 'String', array($midi18n, 'ai.search_name'), $is_module ? array('anam', 'name') : 'anam', array($join_idi18n, $join_i18n), 'Area');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         $nb_id += $nb_name;
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $m . '.area_type', 'atyp', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Array', array($m, 'a', 'activities'), 'aact', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', 'ai.culture', 'acult', $join_i18n);
         // article criteria
         $nb_name = Article::buildArticleListCriteria($criteria, $params_list, false, 'a', 'linked_id');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         if (isset($criteria[2]['join_aarticle'])) {
             $joins['join_area'] = true;
             if (!$is_module) {
                 $joins['post_area'] = true;
             }
         }
     }
     if (!empty($conditions)) {
         $criteria[0] = array_merge($criteria[0], $conditions);
         $criteria[1] = array_merge($criteria[1], $values);
     }
     if (!empty($joins)) {
         $joins['join_area'] = true;
     }
     if ($is_module && $nb_id) {
         $joins['nb_id'] = $nb_id;
     }
     $criteria[2] += $joins;
     return null;
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:71,代码来源:Area.class.php

示例3: buildImageListCriteria

 public static function buildImageListCriteria(&$criteria, &$params_list, $is_module = false, $mid = 'linked_id')
 {
     if (empty($params_list)) {
         return null;
     }
     $conditions = $values = $joins = array();
     if ($is_module) {
         $m = 'm';
         $m2 = 'i';
         $mid = 'm.id';
         $midi18n = $mid;
         $join = null;
         $join_id = null;
         $join_idi18n = null;
         $join_i18n = 'image_i18n';
     } else {
         $m = 'i';
         $m2 = $m;
         $mid = array('l' . $m, $mid);
         $midi18n = implode('.', $mid);
         $join = 'image';
         $join_id = $join . '_id';
         $join_idi18n = $join . '_idi18n';
         $join_i18n = $join . '_i18n';
     }
     $nb_id = 0;
     $nb_name = 0;
     if ($is_module) {
         $nb_id = self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $mid, array('id', 'images'), $join_id);
     } else {
         $nb_id = self::buildConditionItem($conditions, $values, $joins, $params_list, 'MultiId', $mid, 'images', $join_id);
     }
     $has_id = $nb_id == 1;
     if (!$has_id) {
         if ($is_module) {
             self::buildConditionItem($conditions, $values, $joins, $params_list, 'Array', array($m, 'i', 'activities'), 'act', $join);
             self::buildConditionItem($conditions, $values, $joins, $params_list, 'Date', 'date_time::date', array('date', 'idate'), $join);
             self::buildConditionItem($conditions, $values, $joins, $params_list, 'Georef', $join, 'geom', $join);
         } else {
             self::buildConditionItem($conditions, $values, $joins, $params_list, 'Date', $m . '.date_time::date', 'idate', $join);
         }
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Around', $m2 . '.geom', 'iarnd', $join);
         $nb_name = self::buildConditionItem($conditions, $values, $joins, $params_list, 'String', array($midi18n, 'ii.search_name'), $is_module ? array('inam', 'name') : 'inam', array($join_id, $join_i18n), 'Image');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         $nb_id += $nb_name;
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Array', array($m, 'i', 'activities'), 'iact', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Compare', $m . '.elevation', 'ialt', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Array', array($m, 'i', 'categories'), 'icat', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $m . '.image_type', 'ityp', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', 'ii.culture', 'icult', $join_i18n);
         // article criteria
         $nb_name = Article::buildArticleListCriteria($criteria, $params_list, false, 'i', 'main_id');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         if (isset($criteria[2]['join_iarticle'])) {
             $joins['join_image'] = true;
             if (!$is_module) {
                 $joins['post_image'] = true;
             }
         }
     }
     if (!empty($conditions)) {
         $criteria[0] = array_merge($criteria[0], $conditions);
         $criteria[1] = array_merge($criteria[1], $values);
     }
     if (!empty($joins)) {
         $joins['join_image'] = true;
     }
     if ($is_module && $nb_id) {
         $joins['nb_id'] = $nb_id;
     }
     $criteria[2] += $joins;
     return null;
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:77,代码来源:Image.class.php

示例4: buildBookListCriteria

 public static function buildBookListCriteria(&$criteria, &$params_list, $is_module = false, $prefix = '', $mid = 'm.id')
 {
     if (empty($params_list)) {
         return null;
     }
     $conditions = $values = $joins = array();
     $m2 = $prefix . 'b';
     if ($is_module) {
         $m = 'm';
         $midi18n = $mid;
         $join = null;
         $join_id = null;
         $join_idi18n = null;
         $join_i18n = 'book_i18n';
     } else {
         $m = $m2;
         $mid = array('l' . $m, $mid);
         $midi18n = implode('.', $mid);
         $join = $prefix . 'book';
         $join_id = $join . '_id';
         $join_idi18n = $join . '_idi18n';
         $join_i18n = $join . '_i18n';
     }
     $has_id = false;
     $nb_id = 0;
     $nb_name = 0;
     if ($is_module) {
         $nb_id = self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $mid, array('id', 'books'), $join_id);
     } else {
         $nb_id = self::buildConditionItem($conditions, $values, $joins, $params_list, 'MultiId', $mid, $prefix . 'books', $join_id);
     }
     $has_id = $nb_id == 1;
     if (!$has_id) {
         if ($is_module) {
             self::buildConditionItem($conditions, $values, $joins, $params_list, 'Array', array($m, $m2, 'activities'), 'act', $join);
             self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', 'lbc.linked_id', 'btags', 'join_btag_id');
         }
         $nb_name = self::buildConditionItem($conditions, $values, $joins, $params_list, 'String', array($midi18n, $prefix . 'bi.search_name'), $is_module ? array('bnam', 'name') : $prefix . 'bnam', array($join_idi18n, $join_i18n), 'Book');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         $nb_id += $nb_name;
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Array', array($m, $m2, 'activities'), $prefix . 'bact', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Array', array($m, $m2, 'book_types'), $prefix . 'btyp', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Array', array($m, $m2, 'langs'), $prefix . 'blang', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $prefix . 'bi.culture', $prefix . 'bcult', $join_i18n);
         // article criteria
         $nb_name = Article::buildArticleListCriteria($criteria, $params_list, false, $prefix . 'b', 'linked_id');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         if (isset($criteria[2]['join_' . $prefix . 'barticle'])) {
             $joins['join_' . $prefix . 'book'] = true;
             if (!$is_module) {
                 $joins['post_' . $prefix . 'book'] = true;
             }
         }
     }
     if (!empty($conditions)) {
         $criteria[0] = array_merge($criteria[0], $conditions);
         $criteria[1] = array_merge($criteria[1], $values);
     }
     if (!empty($joins)) {
         $joins['join_' . $prefix . 'book'] = true;
     }
     if ($is_module && $nb_id) {
         $joins['nb_id'] = $nb_id;
     }
     $criteria[2] += $joins;
     return null;
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:71,代码来源:Book.class.php

示例5: buildUserListCriteria


//.........这里部分代码省略.........
         $nb_id = self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $mid, array('id', 'users'), $join_id);
     } else {
         $nb_id = self::buildConditionItem($conditions, $values, $joins, $params_list, 'MultiId', $mid, 'users', $join_id);
     }
     $has_id = $nb_id == 1;
     if (!$has_id) {
         if ($is_module) {
             self::buildConditionItem($conditions, $values, $joins, $params_list, 'Array', array($m, 'u', 'activities'), 'act', $join);
             self::buildConditionItem($conditions, $values, $joins, $params_list, 'Georef', $join, 'geom', $join);
             $nb_name = self::buildConditionItem($conditions, $values, $joins, $params_list, 'Mstring', array(array($midi18n, 'ui.search_name'), array($midi18n, 'upd.search_username')), 'utfnam', array(array($join_idi18n, $join_i18n), array($join_idi18n, $join_private_data)), array('User', 'UserPrivateData'));
             if ($nb_name === 'no_result') {
                 return $nb_name;
             } elseif ($nb_name[0]['nb_result'] == 0) {
                 $nb_id += $nb_name[1]['nb_result'];
             } elseif ($nb_name[1]['nb_result'] == 0) {
                 $nb_id += $nb_name[0]['nb_result'];
             }
         }
         // friends
         $user_groups = c2cTools::getArrayElement($params_list, 'friends');
         if (!is_null($user_groups)) {
             $user_groups = explode(' ', $user_groups);
             $user_ids = array();
             $friend_ids = array();
             $first_group = true;
             foreach ($user_groups as $user_group) {
                 $user_group_ids = explode('-', $user_group);
                 $user_ids = array_merge($user_ids, $user_group_ids);
                 $conditions_temp = array("a.type = 'uo'");
                 $values_temp = array();
                 self::buildListCondition($conditions_temp, $values_temp, 'lu.main_id', $user_group);
                 $where = implode(' AND ', $conditions_temp);
                 $friends = Doctrine_Query::create()->select('DISTINCT a.main_id')->from('Association a')->leftJoin('a.MainMainAssociation lu')->where($where, $values_temp)->execute(array(), Doctrine::FETCH_ARRAY);
                 if (count($friends)) {
                     $friend_group_ids = array();
                     foreach ($friends as $friend) {
                         $friend_group_ids[] = $friend['main_id'];
                     }
                     $friend_group_ids = array_unique($friend_group_ids);
                     if ($first_group) {
                         $friend_ids = $friend_group_ids;
                     } else {
                         $friend_ids = array_intersect($friend_ids, $friend_group_ids);
                     }
                 }
                 $first_group = false;
             }
             if (count($friend_ids)) {
                 $friend_ids = array_diff($friend_ids, $user_ids);
             }
             if (count($friend_ids)) {
                 $params_list['friends'] = implode('-', $friend_ids);
                 if ($is_module) {
                     self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $mid, 'friends', $join_id);
                 } else {
                     self::buildConditionItem($conditions, $values, $joins, $params_list, 'MultiId', $mid, 'friends', $join_id);
                 }
             } else {
                 return 'no_result';
             }
         }
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Around', $m2 . '.geom', 'uarnd', $join);
         $nb_name = self::buildConditionItem($conditions, $values, $joins, $params_list, 'String', array($midi18n, 'ui.search_name'), $is_module ? array('unam', 'name') : 'unam', array($join_idi18n, $join_i18n), 'User');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         $nb_id += $nb_name;
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'String', array($midi18n, 'upd.search_username'), 'ufnam', array($join_idi18n, $join_private_data), 'UserPrivateData');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         $nb_id += $nb_name;
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Array', array($m, 'u', 'activities'), 'uact', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $m . '.category', 'ucat', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', 'ui.culture', 'ucult', $join_i18n);
         // article criteria
         $nb_name = Article::buildArticleListCriteria($criteria, $params_list, false, 'u', 'linked_id');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         if (isset($criteria[2]['join_uarticle'])) {
             $joins['join_user'] = true;
             if (!$is_module) {
                 $joins['post_user'] = true;
             }
         }
     }
     if (!empty($conditions)) {
         $criteria[0] = array_merge($criteria[0], $conditions);
         $criteria[1] = array_merge($criteria[1], $values);
     }
     if (!empty($joins)) {
         $joins['join_user'] = true;
     }
     if ($is_module && $nb_id) {
         $joins['nb_id'] = $nb_id;
     }
     $criteria[2] += $joins;
     return null;
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:101,代码来源:User.class.php

示例6: buildParkingListCriteria

 public static function buildParkingListCriteria(&$criteria, &$params_list, $is_module = false, $mid = 'm.id', $m = 'p')
 {
     if (empty($params_list)) {
         return null;
     }
     $conditions = $values = $joins = array();
     if ($is_module) {
         $m = 'm';
         $m2 = 'p';
         $midi18n = $mid;
         $join = null;
         $join_id = null;
         $join_idi18n = null;
         $join_i18n = 'parking_i18n';
     } else {
         $m2 = $m;
         $mid = array('l' . $m, $mid);
         $midi18n = implode('.', $mid);
         $join = 'parking';
         $join_id = $join . '_id';
         $join_idi18n = $join . '_idi18n';
         $join_i18n = $join . '_i18n';
     }
     $nb_id = 0;
     $nb_name = 0;
     if ($is_module) {
         $nb_id = self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $mid, 'id', $join_id);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Id', 'lp.main_id', 'parkings', 'parking_id');
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Id', 'lpp.linked_id', 'subparkings', 'subparking_id');
     } else {
         $nb_id = self::buildConditionItem($conditions, $values, $joins, $params_list, 'MultiId', $mid, 'parkings', $join_id);
     }
     $has_id = $nb_id == 1;
     if (!$has_id) {
         if ($is_module) {
             self::buildConditionItem($conditions, $values, $joins, $params_list, 'Georef', $join, 'geom', $join);
         }
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Around', $m2 . '.geom', 'parnd', $join);
         $nb_name = self::buildConditionItem($conditions, $values, $joins, $params_list, 'String', array($midi18n, 'pi.search_name'), $is_module ? array('pnam', 'name') : 'pnam', array($join_idi18n, $join_i18n), 'Parking');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         $nb_id += $nb_name;
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Compare', $m . '.elevation', 'palt', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $m . '.public_transportation_rating', 'tp', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Array', array($m, $m2, 'public_transportation_types'), 'tpty', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', 'pi.culture', 'pcult', $join_i18n);
         // book criteria
         $nb_name = Book::buildBookListCriteria($criteria, $params_list, false, 'p', 'main_id');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         // article criteria
         $nb_name = Article::buildArticleListCriteria($criteria, $params_list, false, 'p', 'linked_id');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         if (isset($criteria[2]['join_pbook']) || isset($criteria[2]['join_particle'])) {
             $joins['join_parking'] = true;
             if (!$is_module) {
                 $joins['post_parking'] = true;
             }
         }
     }
     if (!empty($conditions)) {
         $criteria[0] = array_merge($criteria[0], $conditions);
         $criteria[1] = array_merge($criteria[1], $values);
     }
     if (!empty($joins)) {
         $joins['join_parking'] = true;
     }
     if ($is_module && $nb_id) {
         $joins['nb_id'] = $nb_id;
     }
     $criteria[2] += $joins;
     return null;
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:77,代码来源:Parking.class.php

示例7: buildOutingListCriteria

 public static function buildOutingListCriteria(&$criteria, &$params_list, $is_module = false, $mid = 'm.id')
 {
     if (empty($params_list)) {
         return null;
     }
     $conditions = $values = $joins = array();
     if ($is_module) {
         $m = 'm';
         $m2 = '';
         $midi18n = $mid;
         $join = null;
         $join_id = null;
         $join_idi18n = null;
         $join_i18n = 'outing_i18n';
     } else {
         $m = 'o';
         $m2 = 'o.';
         $mid = array('l' . $m, $mid);
         $midi18n = implode('.', $mid);
         $join = 'outing';
         $join_id = $join . '_id';
         $join_idi18n = $join . '_idi18n';
         $join_i18n = $join . '_i18n';
     }
     $nb_id = 0;
     $nb_name = 0;
     if ($is_module) {
         $nb_id = self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $mid, array('id', 'outings'), $join_id);
     } else {
         $nb_id = self::buildConditionItem($conditions, $values, $joins, $params_list, 'MultiId', $mid, 'outings', $join_id);
     }
     $has_id = $nb_id == 1;
     if (!$has_id) {
         if ($is_module) {
             self::buildConditionItem($conditions, $values, $joins, $params_list, 'Array', array($m, 'o', 'activities'), 'act', $join);
             self::buildConditionItem($conditions, $values, $joins, $params_list, 'Date', 'date', array('date', 'odate'), $join);
             self::buildConditionItem($conditions, $values, $joins, $params_list, 'Georef', null, 'geom', $join);
         } else {
             self::buildConditionItem($conditions, $values, $joins, $params_list, 'Date', $m . '.date', 'odate', $join);
         }
         $nb_name = self::buildConditionItem($conditions, $values, $joins, $params_list, 'String', array($midi18n, 'oi.search_name'), $is_module ? array('onam', 'name') : 'onam', array($join_idi18n, $join_i18n), 'Outing');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         $nb_id += $nb_name;
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Array', array($m, 'o', 'activities'), 'oact', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Compare', $m . '.max_elevation', 'oalt', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Compare', $m . '.height_diff_up', 'odif', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Compare', $m . '.height_diff_down', 'oddif', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Relative', array($m2 . 'height_diff_down', $m2 . 'height_diff_up'), 'odudif', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Compare', $m . '.outing_length', 'olen', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Bool', $m . '.outing_with_public_transportation', 'owtp', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Bool', $m . '.partial_trip', 'ptri', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $m . '.frequentation_status', 'ofreq', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Compare', $m . '.conditions_status', 'ocond', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Array', array($m, 'o', 'avalanche_date'), 'avdate', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Compare', $m . '.glacier_status', 'oglac', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Compare', $m . '.track_status', 'otrack', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Compare', $m . '.access_status', 'opark', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $m . '.lift_status', 'olift', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Compare', $m . '.hut_status', 'ohut', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Georef', $m . '.geom_wkt', 'ogeom', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', 'oi.culture', 'ocult', $join_i18n);
         // article criteria
         $nb_name = Article::buildArticleListCriteria($criteria, $params_list, false, 'o', 'linked_id');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         if (isset($criteria[2]['join_oarticle'])) {
             $joins['join_outing'] = true;
             if (!$is_module) {
                 $joins['post_outing'] = true;
             }
         }
     }
     if (!empty($conditions)) {
         $criteria[0] = array_merge($criteria[0], $conditions);
         $criteria[1] = array_merge($criteria[1], $values);
     }
     if (!empty($joins)) {
         $joins['join_outing'] = true;
     }
     if ($is_module && $nb_id) {
         $joins['nb_id'] = $nb_id;
     }
     $criteria[2] += $joins;
     return null;
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:88,代码来源:Outing.class.php

示例8: buildListCriteria

 public static function buildListCriteria($params_list)
 {
     $criteria = $conditions = $values = $joins = $joins_order = array();
     $criteria[0] = array();
     // conditions
     $criteria[1] = array();
     // values
     $criteria[2] = array();
     // joins
     $criteria[3] = array();
     // joins for order
     // criteria for disabling personal filter
     self::buildPersoCriteria($conditions, $values, $joins, $params_list, 'articles');
     // orderby criteria
     $orderby_list = c2cTools::getRequestParameterArray(array('orderby', 'orderby2', 'orderby3'));
     self::buildOrderCondition($joins_order, $orderby_list, array('cnam'), array('article_i18n', 'join_article'));
     // area criteria
     self::buildAreaCriteria($criteria, $params_list, 'a');
     // return if no criteria
     if (isset($joins['all']) || empty($params_list)) {
         $criteria[0] = array_merge($criteria[0], $conditions);
         $criteria[1] = array_merge($criteria[1], $values);
         $criteria[2] += $joins;
         $criteria[3] += $joins_order;
         return $criteria;
     }
     // article criteria
     $has_name = Article::buildArticleListCriteria($criteria, $params_list, true);
     if ($has_name === 'no_result') {
         return $has_name;
     }
     // linked document criteria
     self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', 'lcd.main_id', 'cdocs', 'cdoc');
     // summit criteria
     $has_name = Summit::buildSummitListCriteria($criteria, $params_list, false, 'main_id');
     if ($has_name === 'no_result') {
         return $has_name;
     }
     // hut criteria
     $has_name = Hut::buildHutListCriteria($criteria, $params_list, false, 'main_id');
     if ($has_name === 'no_result') {
         return $has_name;
     }
     // parking criteria
     $has_name = Parking::buildParkingListCriteria($criteria, $params_list, false, 'main_id');
     if ($has_name === 'no_result') {
         return $has_name;
     }
     // route criteria
     $has_name = Route::buildRouteListCriteria($criteria, $params_list, false, 'main_id');
     if ($has_name === 'no_result') {
         return $has_name;
     }
     // site criteria
     $has_name = Site::buildSiteListCriteria($criteria, $params_list, false, 'main_id');
     if ($has_name === 'no_result') {
         return $has_name;
     }
     // outing criteria
     $has_name = Outing::buildOutingListCriteria($criteria, $params_list, false, 'main_id');
     if ($has_name === 'no_result') {
         return $has_name;
     }
     // book criteria
     $has_name = Book::buildBookListCriteria($criteria, $params_list, false, 'c', 'main_id');
     if ($has_name === 'no_result') {
         return $has_name;
     }
     // image criteria
     $has_name = Image::buildImageListCriteria($criteria, $params_list, false);
     if ($has_name === 'no_result') {
         return $has_name;
     }
     // user criteria
     self::buildConditionItem($conditions, $values, $joins, $params_list, 'MultiId', array('u', 'main_id'), 'users', 'user_id');
     $criteria[0] = array_merge($criteria[0], $conditions);
     $criteria[1] = array_merge($criteria[1], $values);
     $criteria[2] += $joins;
     $criteria[3] += $joins_order;
     return $criteria;
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:81,代码来源:Article.class.php

示例9: buildHutListCriteria

 public static function buildHutListCriteria(&$criteria, &$params_list, $is_module = false, $mid = 'm.id')
 {
     if (empty($params_list)) {
         return null;
     }
     $conditions = $values = $joins = array();
     if ($is_module) {
         $m = 'm';
         $m2 = 'h';
         $midi18n = $mid;
         $join = null;
         $join_id = null;
         $join_idi18n = null;
         $join_i18n = 'hut_i18n';
     } else {
         $m = 'h';
         $m2 = $m;
         $mid = array('l' . $m, $mid);
         $midi18n = implode('.', $mid);
         $join = 'hut';
         $join_id = $join . '_id';
         $join_idi18n = $join . '_idi18n';
         $join_i18n = $join . '_i18n';
     }
     $nb_id = 0;
     $nb_name = 0;
     if ($is_module) {
         $nb_id = self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $mid, array('id', 'huts'), $join_id);
     } else {
         $nb_id = self::buildConditionItem($conditions, $values, $joins, $params_list, 'MultiId', $mid, 'huts', $join_id);
     }
     $has_id = $nb_id == 1;
     if (!$has_id) {
         if ($is_module) {
             self::buildConditionItem($conditions, $values, $joins, $params_list, 'Array', array($m, 'h', 'activities'), 'act', $join);
             self::buildConditionItem($conditions, $values, $joins, $params_list, 'Georef', $join, 'geom', $join);
         }
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Around', $m2 . '.geom', 'harnd', $join);
         $nb_name = self::buildConditionItem($conditions, $values, $joins, $params_list, 'String', array($midi18n, 'hi.search_name'), $is_module ? array('hnam', 'name') : 'hnam', array($join_idi18n, $join_i18n), 'Hut');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         $nb_id += $nb_name;
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Array', array($m, 'h', 'activities'), 'hact', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Compare', $m . '.elevation', 'halt', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $m . '.shelter_type', 'htyp', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Bool', $m . '.is_staffed', 'hsta', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Compare', $m . '.staffed_capacity', 'hscap', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Compare', $m . '.unstaffed_capacity', 'hucap', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $m . '.has_unstaffed_matress', 'hmat', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $m . '.has_unstaffed_blanket', 'hbla', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $m . '.has_unstaffed_gas', 'hgas', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $m . '.has_unstaffed_wood', 'hwoo', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', 'hi.culture', 'hcult', $join_i18n);
         // book criteria
         $nb_name = Book::buildBookListCriteria($criteria, $params_list, false, 'h', 'main_id');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         // article criteria
         $nb_name = Article::buildArticleListCriteria($criteria, $params_list, false, 'h', 'linked_id');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         if (isset($criteria[2]['join_hbook']) || isset($criteria[2]['join_harticle'])) {
             $joins['join_hut'] = true;
             if (!$is_module) {
                 $joins['post_hut'] = true;
             }
         }
     }
     if (!empty($conditions)) {
         $criteria[0] = array_merge($criteria[0], $conditions);
         $criteria[1] = array_merge($criteria[1], $values);
     }
     if (!empty($joins)) {
         $joins['join_hut'] = true;
     }
     if ($is_module && $nb_id) {
         $joins['nb_id'] = $nb_id;
     }
     $criteria[2] += $joins;
     return null;
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:84,代码来源:Hut.class.php

示例10: buildSummitListCriteria

 public static function buildSummitListCriteria(&$criteria, &$params_list, $is_module = false, $mid = 'm.id')
 {
     if (empty($params_list)) {
         return null;
     }
     $conditions = $values = $joins = array();
     if ($is_module) {
         $m = 'm';
         $m2 = 's';
         $midi18n = $mid;
         $join = null;
         $join_id = null;
         $join_idi18n = null;
         $join_i18n = 'summit_i18n';
     } else {
         $m = 's';
         $m2 = $m;
         $mid = array('l' . $m, $mid);
         $midi18n = implode('.', $mid);
         $join = 'summit';
         $join_id = $join . '_id';
         $join_idi18n = $join . '_idi18n';
         $join_i18n = $join . '_i18n';
     }
     $nb_id = 0;
     $nb_name = 0;
     if ($is_module) {
         $nb_id = self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $mid, 'id', $join_id);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Id', 'ls.main_id', 'summits', 'summit_id');
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Id', 'lss.linked_id', 'subsummits', 'subsummit_id');
     } else {
         $nb_id = self::buildConditionItem($conditions, $values, $joins, $params_list, 'MultiId', $mid, 'summits', $join_id);
     }
     $has_id = $nb_id == 1;
     if (!$has_id) {
         if ($is_module) {
             self::buildConditionItem($conditions, $values, $joins, $params_list, 'Georef', $join, 'geom', $join);
             self::buildConditionItem($conditions, $values, $joins, $params_list, 'Istring', 'maps_info', 'mapinfo', $join);
         }
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Around', $m2 . '.geom', 'sarnd', $join);
         $nb_name = self::buildConditionItem($conditions, $values, $joins, $params_list, 'String', array($midi18n, 'si.search_name'), $is_module ? array('snam', 'name') : 'snam', array($join_idi18n, $join_i18n), 'Summit');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         $nb_id += $nb_name;
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'Compare', $m . '.elevation', 'salt', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', $m . '.summit_type', 'styp', $join);
         self::buildConditionItem($conditions, $values, $joins, $params_list, 'List', 'si.culture', 'scult', $join_i18n);
         // book criteria
         $nb_name = Book::buildBookListCriteria($criteria, $params_list, false, 's', 'main_id');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         // article criteria
         $nb_name = Article::buildArticleListCriteria($criteria, $params_list, false, 's', 'linked_id');
         if ($nb_name === 'no_result') {
             return $nb_name;
         }
         if (isset($criteria[2]['join_sbook']) || isset($criteria[2]['join_sarticle'])) {
             $joins['join_summit'] = true;
             if (!$is_module) {
                 $joins['post_summit'] = true;
             }
         }
     }
     if (!empty($conditions)) {
         $criteria[0] = array_merge($criteria[0], $conditions);
         $criteria[1] = array_merge($criteria[1], $values);
     }
     if (!empty($joins)) {
         $joins['join_summit'] = true;
     }
     if ($is_module && $nb_id) {
         $joins['nb_id'] = $nb_id;
     }
     $criteria[2] += $joins;
     return null;
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:78,代码来源:Summit.class.php


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