本文整理汇总了PHP中JUDownloadHelper::deleteFieldValuesOfDocument方法的典型用法代码示例。如果您正苦于以下问题:PHP JUDownloadHelper::deleteFieldValuesOfDocument方法的具体用法?PHP JUDownloadHelper::deleteFieldValuesOfDocument怎么用?PHP JUDownloadHelper::deleteFieldValuesOfDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JUDownloadHelper
的用法示例。
在下文中一共展示了JUDownloadHelper::deleteFieldValuesOfDocument方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveCategoryChangeFieldGroup
public function saveCategoryChangeFieldGroup($tableBeforeSave, $table, $isNew)
{
if (!$isNew) {
$db = JFactory::getDbo();
if ($tableBeforeSave->fieldgroup_id != $table->fieldgroup_id) {
$docId_arr = JUDownloadHelper::getDocumentIdsByCatId($table->id);
foreach ($docId_arr as $docId) {
JUDownloadHelper::deleteFieldValuesOfDocument($docId);
}
$query = "DELETE FROM #__judownload_fields_ordering WHERE item_id = {$table->id} AND type = 'category'";
$db->setQuery($query);
$db->execute();
JUDownloadHelper::changeInheritedFieldGroupId($table->id, $table->fieldgroup_id);
}
}
}
示例2: moveDocuments
//.........这里部分代码省略.........
if (!$canDoEdit) {
if (!$user->id) {
JError::raiseWarning(100, JText::sprintf('COM_JUDOWNLOAD_YOU_DONT_HAVE_PERMISSION_TO_ACCESS_DOCUMENT', $table->title));
continue;
} else {
if ($user->id == $table->created_by) {
$canDoEditOwn = $user->authorise('judl.document.edit.own', $assetName);
if (!$canDoEditOwn) {
JError::raiseWarning(100, JText::sprintf('COM_JUDOWNLOAD_YOU_DONT_HAVE_PERMISSION_TO_ACCESS_DOCUMENT', $table->title));
continue;
}
}
}
}
$query = "SELECT cat_id FROM #__judownload_documents_xref WHERE doc_id = " . $doc_id . " AND main=1";
$db->setQuery($query);
$cat_id = $db->loadResult();
if ($tocat_id == $cat_id) {
continue;
}
$result = $dispatcher->trigger($this->onContentBeforeMove, array($this->option . '.' . $this->name, $table, $tocat_id, $move_option_arr));
if (in_array(false, $result, true)) {
$this->setError($table->getError());
return false;
}
if ($table->style_id == -1) {
$oldTemplateStyleObject = JUDownloadFrontHelperTemplate::getTemplateStyleOfCategory($cat_id);
$newTemplateStyleObject = JUDownloadFrontHelperTemplate::getTemplateStyleOfCategory($tocat_id);
if ($oldTemplateStyleObject->template_id != $newTemplateStyleObject->template_id) {
if (in_array('keep_template_params', $move_option_arr)) {
$table->style_id = $oldTemplateStyleObject->id;
} else {
$query = "UPDATE #__judownload_documents SET template_params = '' WHERE id=" . $doc_id;
$db->setQuery($query);
$db->execute();
}
}
}
$query = "SELECT COUNT(*) FROM #__judownload_documents_xref WHERE cat_id=" . $tocat_id . " AND doc_id=" . $doc_id . " AND main=0";
$db->setQuery($query);
$is_secondary_cat = $db->loadResult();
if ($is_secondary_cat) {
$query = "DELETE FROM #__judownload_documents_xref WHERE doc_id=" . $doc_id . " AND main=1";
$db->setQuery($query);
$db->execute();
$query = "UPDATE #__judownload_documents_xref SET main=1 WHERE cat_id=" . $tocat_id . " AND doc_id=" . $doc_id;
$db->setQuery($query);
$db->execute();
} else {
$query = "UPDATE #__judownload_documents_xref SET cat_id=" . $tocat_id . " WHERE doc_id=" . $doc_id . " AND main=1";
$db->setQuery($query);
$db->execute();
}
if (in_array('keep_permission', $move_option_arr)) {
$query = 'UPDATE #__assets SET `parent_id` = ' . $tocat_asset_id . ' WHERE name="com_judownload.document.' . $doc_id . '"';
$db->setQuery($query);
$db->execute();
} else {
$query = 'UPDATE #__assets SET `parent_id` = ' . $tocat_asset_id . ', `rules` = "{}" WHERE name="com_judownload.document.' . $doc_id . '"';
$db->setQuery($query);
$db->execute();
}
$moved_documents[] = $doc_id;
$this->cleanCache();
$dispatcher->trigger($this->onContentAfterMove, array($this->option . '.' . $this->name, $table, $tocat_id, $move_option_arr));
}
$total_moved_documents = count($moved_documents);
if ($total_moved_documents) {
$old_field_groupid = JUDownloadHelper::getCategoryById($cat_id)->fieldgroup_id;
$new_field_groupid = JUDownloadHelper::getCategoryById($tocat_id)->fieldgroup_id;
$keep_extra_fields = in_array("keep_extra_fields", $move_option_arr);
if ($keep_extra_fields) {
$keep_extra_fields = $old_field_groupid == $new_field_groupid ? true : false;
}
if (!$keep_extra_fields) {
foreach ($moved_documents as $doc_id) {
JUDownloadHelper::deleteFieldValuesOfDocument($doc_id);
}
}
$old_criteria_groupid = JUDownloadHelper::getCategoryById($cat_id)->criteriagroup_id;
$new_criteria_groupid = JUDownloadHelper::getCategoryById($tocat_id)->criteriagroup_id;
$keep_rates = in_array("keep_rates", $move_option_arr);
if ($keep_rates) {
$keep_rates = $old_criteria_groupid == $new_criteria_groupid ? true : false;
}
if (!$keep_rates) {
JTable::addIncludePath(JPATH_ADMINISTRATOR . "/components/com_judownload/tables");
$ratingTable = JTable::getInstance("Rating", "JUDownloadTable");
foreach ($moved_documents as $doc_id) {
$query = "SELECT id FROM #__judownload_rating WHERE doc_id = " . $doc_id;
$db->setQuery($query);
$ratingIds = $db->loadColumn();
foreach ($ratingIds as $ratingId) {
$ratingTable->delete($ratingId);
}
}
}
}
return $total_moved_documents;
}
示例3: deleteMainData
public function deleteMainData($pk, $deleteSelf = false)
{
$db = JFactory::getDbo();
JUDownloadHelper::deleteFieldValuesOfDocument($pk);
$query = "DELETE FROM #__judownload_documents_relations WHERE doc_id = " . $pk;
$db->setQuery($query);
$db->execute();
$query = "DELETE FROM #__judownload_changelogs WHERE doc_id = " . $pk;
$db->setQuery($query);
$db->execute();
$query = "DELETE FROM #__judownload_files WHERE doc_id = " . $pk;
$db->setQuery($query);
$db->execute();
$query = "DELETE FROM #__judownload_versions WHERE doc_id = " . $pk;
$db->setQuery($query);
$db->execute();
$file_dir = JPATH_ROOT . "/" . JUDownloadFrontHelper::getDirectory("file_directory", "media/com_judownload/files/") . $pk . "/";
if (JFolder::exists($file_dir)) {
JFolder::delete($file_dir);
}
$query = "DELETE FROM #__judownload_documents_xref WHERE doc_id = " . $pk;
$db->setQuery($query);
$db->execute();
if ($deleteSelf) {
return parent::delete($pk);
}
return true;
}