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


PHP JUDirectoryHelper::getCriteriaGroupIdByListingId方法代码示例

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


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

示例1: copyListings


//.........这里部分代码省略.........
             $ori_fieldgroup_id = JUDirectoryHelper::getFieldGroupIdByListingId($listing_id);
             $copy_extra_fields = in_array("copy_extra_fields", $copy_option_arr);
             if ($copy_extra_fields) {
                 $copy_extra_fields = $ori_fieldgroup_id == $catTable->fieldgroup_id ? true : false;
             }
             $query = $db->getQuery(true);
             $query->select("field.*");
             $query->from("#__judirectory_fields AS field");
             $query->select("plg.folder");
             $query->join("", "#__judirectory_plugins AS plg ON field.plugin_id = plg.id");
             if ($copy_extra_fields && $ori_fieldgroup_id) {
                 $query->where("field.group_id IN (1, {$ori_fieldgroup_id})");
             } else {
                 $query->where("field.group_id = 1");
             }
             $query->order('field.group_id, field.ordering');
             $db->setQuery($query);
             $fields = $db->loadObjectList();
             foreach ($fields as $field) {
                 $fieldObj = JUDirectoryFrontHelperField::getField($field, $listing_id);
                 $fieldObj->onCopy($newListingId, $fieldsData);
             }
             if (in_array('copy_related_listings', $copy_option_arr)) {
                 $query = "INSERT INTO `#__judirectory_listings_relations` (listing_id, listing_id_related, ordering) SELECT {$newListingId}, listing_id_related, ordering FROM `#__judirectory_listings_relations` WHERE listing_id = {$listing_id}";
                 $db->setQuery($query);
                 $db->execute();
             }
             if (in_array('copy_rates', $copy_option_arr)) {
                 $ratingMapping = array();
                 $query = "SELECT * FROM #__judirectory_rating WHERE listing_id = {$listing_id}";
                 $db->setQuery($query);
                 $ratings = $db->loadObjectList();
                 if (count($ratings)) {
                     $criteriagroup_id = JUDirectoryHelper::getCriteriaGroupIdByListingId($listing_id);
                     foreach ($ratings as $rating) {
                         $oldRatingId = $rating->id;
                         $rating->id = 0;
                         $rating->listing_id = $newListingId;
                         if ($db->insertObject('#__judirectory_rating', $rating, 'id')) {
                             if (JUDirectoryHelper::hasMultiRating() && $criteriagroup_id && $criteriagroup_id == $catTable->criteriagroup_id) {
                                 JUDirectoryMultiRating::copyCriteriaValue($rating->id, $oldRatingId);
                             }
                             $ratingMapping[$oldRatingId] = $rating->id;
                         }
                     }
                 }
             }
             if (in_array('copy_comments', $copy_option_arr)) {
                 $query = "SELECT id FROM #__judirectory_comments WHERE listing_id=" . $listing_id . " AND parent_id = 1";
                 $db->setQuery($query);
                 $commentIds = $db->loadColumn();
                 $commentMapping = array();
                 while (!empty($commentIds)) {
                     $commentId = array_shift($commentIds);
                     $query = "SELECT id FROM #__judirectory_comments WHERE listing_id=" . $listing_id . " AND parent_id = {$commentId}";
                     $db->setQuery($query);
                     $_commentIds = $db->loadColumn();
                     foreach ($_commentIds as $_commentId) {
                         if (!in_array($_commentId, $commentIds)) {
                             array_push($commentIds, $_commentId);
                         }
                     }
                     $commentTable->load($commentId, true);
                     $commentTable->id = 0;
                     $commentTable->listing_id = $newListingId;
                     $commentTable->parent_id = isset($commentMapping[$commentTable->parent_id]) ? $commentMapping[$commentTable->parent_id] : 0;
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:67,代码来源:listing.php


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