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


PHP JUDownloadHelper::getCriteriaGroupIdByDocId方法代码示例

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


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

示例1: copyDocuments


//.........这里部分代码省略.........
                     $versionTable->doc_id = $newDocId;
                     $versionTable->store();
                     $versionsStoreMap[$oldDocVersionId] = $versionTable->id;
                 }
             }
             if (in_array('copy_changelogs', $copy_option_arr)) {
                 $query = "SELECT * FROM #__judownload_changelogs WHERE `doc_id` = {$doc_id}";
                 $db->setQuery($query);
                 $changelogs = $db->loadObjectList();
                 if ($changelogs) {
                     foreach ($changelogs as $changelog) {
                         $changelogTable->reset();
                         if ($changelogTable->bind($changelog) && $changelogTable->check()) {
                             $changelogTable->id = 0;
                             $changelogTable->doc_id = $newDocId;
                             $changelogTable->store();
                         } else {
                             continue;
                         }
                     }
                 }
             }
             if (in_array('copy_related_documents', $copy_option_arr)) {
                 $query = "INSERT INTO `#__judownload_documents_relations` (doc_id, doc_id_related, ordering) SELECT {$newDocId}, doc_id_related, ordering FROM `#__judownload_documents_relations` WHERE doc_id = {$doc_id}";
                 $db->setQuery($query);
                 $db->execute();
             }
             if (in_array('copy_rates', $copy_option_arr)) {
                 $ratingMapping = array();
                 $query = "SELECT * FROM #__judownload_rating WHERE doc_id = {$doc_id}";
                 $db->setQuery($query);
                 $ratings = $db->loadObjectList();
                 if (count($ratings)) {
                     $criteriagroup_id = JUDownloadHelper::getCriteriaGroupIdByDocId($doc_id);
                     foreach ($ratings as $rating) {
                         $oldRatingId = $rating->id;
                         $rating->id = 0;
                         $rating->doc_id = $newDocId;
                         if ($db->insertObject('#__judownload_rating', $rating, 'id')) {
                             if (JUDownloadHelper::hasMultiRating() && $criteriagroup_id && $criteriagroup_id == $catTable->criteriagroup_id) {
                                 JUDownloadMultiRating::copyCriteriaValue($rating->id, $oldRatingId);
                             }
                             $ratingMapping[$oldRatingId] = $rating->id;
                         }
                     }
                 }
             }
             if (in_array('copy_comments', $copy_option_arr)) {
                 $query = "SELECT id FROM #__judownload_comments WHERE doc_id=" . $doc_id . " AND parent_id = 1";
                 $db->setQuery($query);
                 $commentIds = $db->loadColumn();
                 $commentMapping = array();
                 while (!empty($commentIds)) {
                     $commentId = array_shift($commentIds);
                     $query = "SELECT id FROM #__judownload_comments WHERE doc_id=" . $doc_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->doc_id = $newDocId;
                     $commentTable->parent_id = isset($commentMapping[$commentTable->parent_id]) ? $commentMapping[$commentTable->parent_id] : 0;
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:67,代码来源:document.php


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