本文整理汇总了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;