public static function RemoveTopicFromArticle($p_topicId, $p_articleNumber) { global $g_ado_db; $queryStr = "DELETE FROM ArticleTopics WHERE NrArticle={$p_articleNumber} AND TopicId={$p_topicId}"; $g_ado_db->Execute($queryStr); }
$articleTopics = ArticleTopic::GetArticleTopics($f_article_number); if (!Input::IsValid()) { camp_html_display_error(getGS('Invalid input: $1', Input::GetErrorString()), null, true); exit; } if (!$g_user->hasPermission('AttachTopicToArticle')) { camp_html_display_error(getGS("You do not have the right to detach topics from articles."), null, true); exit; } // delete foreach ($articleTopics as $topic) { if (!in_array($topic->getTopicId(), $f_topic_ids)) { ArticleTopic::RemoveTopicFromArticle($topic->getTopicId(), $f_article_number); } else { unset($f_topic_ids[array_search($topic->getTopicId(), $f_topic_ids)]); } } // insert rest foreach ($f_topic_ids as $topicIdString) { // Verify topic exists $tmpTopic = new Topic($topicIdString); if ($tmpTopic->exists()) { ArticleTopic::AddTopicToArticle($topicIdString, $f_article_number); } } ?>