本文整理汇总了PHP中JUDownloadHelper::getFieldGroupIdByDocId方法的典型用法代码示例。如果您正苦于以下问题:PHP JUDownloadHelper::getFieldGroupIdByDocId方法的具体用法?PHP JUDownloadHelper::getFieldGroupIdByDocId怎么用?PHP JUDownloadHelper::getFieldGroupIdByDocId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JUDownloadHelper
的用法示例。
在下文中一共展示了JUDownloadHelper::getFieldGroupIdByDocId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: copyDocuments
//.........这里部分代码省略.........
$table->checkIn();
$total_copied_documents++;
} else {
continue;
}
$newDocId = $table->id;
if ($table->icon) {
$ori_icon_name = $table->icon;
$new_icon_name = $newDocId . substr($ori_icon_name, strpos($ori_icon_name, '_'));
$query = "UPDATE #__judownload_documents SET icon = '" . $new_icon_name . "' WHERE id=" . $newDocId;
$db->setQuery($query);
$db->execute();
$icon_directory = JPATH_ROOT . "/" . JUDownloadFrontHelper::getDirectory("document_icon_directory", "media/com_judownload/images/document/");
if (JFile::exists($icon_directory . $ori_icon_name)) {
JFile::copy($icon_directory . $ori_icon_name, $icon_directory . $new_icon_name);
}
if (JFile::exists($icon_directory . "original/" . $ori_icon_name)) {
JFile::copy($icon_directory . "original/" . $ori_icon_name, $icon_directory . "original/" . $new_icon_name);
}
}
$query = "INSERT INTO #__judownload_documents_xref (doc_id, cat_id, main) VALUES({$newDocId}, {$tocat_id}, 1)";
$db->setQuery($query);
$db->execute();
$query = "SELECT * FROM #__judownload_tags_xref WHERE doc_id=" . $doc_id . " ORDER BY ordering ASC";
$db->setQuery($query);
$tags = $db->loadObjectList();
if (!empty($tags)) {
foreach ($tags as $tag) {
$query = "INSERT INTO #__judownload_tags_xref (tag_id, doc_id, ordering) VALUES (" . $tag->tag_id . ", " . $newDocId . ", " . $tag->ordering . ")";
$db->setQuery($query);
$db->execute();
}
}
$ori_fieldgroup_id = JUDownloadHelper::getFieldGroupIdByDocId($doc_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("#__judownload_fields AS field");
$query->select("plg.folder");
$query->join("", "#__judownload_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");
}
$db->setQuery($query);
$fields = $db->loadObjectList();
foreach ($fields as $field) {
$fieldObj = JUDownloadFrontHelperField::getField($field, $doc_id);
$fieldObj->onCopy($newDocId, $fieldsData);
}
if (in_array('copy_files', $copy_option_arr)) {
$query = "SELECT * FROM #__judownload_files WHERE doc_id = " . $doc_id;
$db->setQuery($query);
$files = $db->loadObjectList();
if ($files) {
foreach ($files as $file) {
$fileTable->reset();
if ($fileTable->bind($file) && $fileTable->check()) {
$fileTable->id = 0;
$fileTable->doc_id = $newDocId;
if ($fileTable->store()) {
$filesStoreMap[$file->id] = $fileTable->id;