function vam_get_topic_tree($parent_id = '0', $spacing = '', $exclude = '', $topic_tree_array = '', $include_itself = false) { global $languages_id; if (!is_array($topic_tree_array)) { $topic_tree_array = array(); } if (sizeof($topic_tree_array) < 1 && $exclude != '0') { $topic_tree_array[] = array('id' => '0', 'text' => TEXT_TOP); } if ($include_itself) { $topic_query = vam_db_query("select cd.topics_name from " . TABLE_TOPICS_DESCRIPTION . " cd where cd.language_id = '" . (int) $_SESSION['languages_id'] . "' and cd.topics_id = '" . (int) $parent_id . "'"); $topic = vam_db_fetch_array($topic_query); $topic_tree_array[] = array('id' => $parent_id, 'text' => $topic['topics_name']); } $topics_query = vam_db_query("select c.topics_id, cd.topics_name, c.parent_id from " . TABLE_TOPICS . " c, " . TABLE_TOPICS_DESCRIPTION . " cd where c.topics_id = cd.topics_id and cd.language_id = '" . (int) $_SESSION['languages_id'] . "' and c.parent_id = '" . (int) $parent_id . "' order by c.sort_order, cd.topics_name"); while ($topics = vam_db_fetch_array($topics_query)) { if ($exclude != $topics['topics_id']) { $topic_tree_array[] = array('id' => $topics['topics_id'], 'text' => $spacing . $topics['topics_name']); } $topic_tree_array = vam_get_topic_tree($topics['topics_id'], $spacing . ' ', $exclude, $topic_tree_array); } return $topic_tree_array; }
$contents[] = array('align' => 'center', 'text' => '<br>' . '<span class="button"><button type="submit" value="' . BUTTON_DELETE . '">' . vam_image(DIR_WS_IMAGES . 'icons/buttons/delete.png', '', '12', '12') . ' ' . BUTTON_DELETE . '</button></span>' . ' <a class="button" href="' . vam_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath . '&aID=' . $aInfo->articles_id) . '"><span>' . vam_image(DIR_WS_IMAGES . 'icons/buttons/cancel.png', '', '12', '12') . ' ' . BUTTON_CANCEL . '</span></a>'); break; case 'move_article': $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_MOVE_ARTICLE . '</b>'); $contents = array('form' => vam_draw_form('articles', FILENAME_ARTICLES, 'action=move_article_confirm&tPath=' . $tPath) . vam_draw_hidden_field('articles_id', $aInfo->articles_id)); $contents[] = array('text' => sprintf(TEXT_MOVE_ARTICLES_INTRO, $aInfo->articles_name)); $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENT_TOPICS . '<br><b>' . vam_output_generated_topic_path($aInfo->articles_id, 'article') . '</b>'); $contents[] = array('text' => '<br>' . sprintf(TEXT_MOVE, $aInfo->articles_name) . '<br>' . vam_draw_pull_down_menu('move_to_topic_id', vam_get_topic_tree(), $current_topic_id)); $contents[] = array('align' => 'center', 'text' => '<br>' . '<span class="button"><button type="submit" value="' . BUTTON_MOVE . '">' . vam_image(DIR_WS_IMAGES . 'icons/buttons/move.png', '', '12', '12') . ' ' . BUTTON_MOVE . '</button></span>' . ' <a class="button" href="' . vam_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath . '&aID=' . $aInfo->articles_id) . '"><span>' . vam_image(DIR_WS_IMAGES . 'icons/buttons/cancel.png', '', '12', '12') . ' ' . BUTTON_CANCEL . '</span></a>'); break; case 'copy_to': $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_COPY_TO . '</b>'); $contents = array('form' => vam_draw_form('copy_to', FILENAME_ARTICLES, 'action=copy_to_confirm&tPath=' . $tPath) . vam_draw_hidden_field('articles_id', $aInfo->articles_id)); $contents[] = array('text' => TEXT_INFO_COPY_TO_INTRO); $contents[] = array('text' => '<br>' . TEXT_INFO_CURRENT_TOPICS . '<br><b>' . vam_output_generated_topic_path($aInfo->articles_id, 'article') . '</b>'); $contents[] = array('text' => '<br>' . TEXT_TOPICS . '<br>' . vam_draw_pull_down_menu('topics_id', vam_get_topic_tree(), $current_topic_id)); $contents[] = array('text' => '<br>' . TEXT_HOW_TO_COPY . '<br>' . vam_draw_radio_field('copy_as', 'link', true) . ' ' . TEXT_COPY_AS_LINK . '<br>' . vam_draw_radio_field('copy_as', 'duplicate') . ' ' . TEXT_COPY_AS_DUPLICATE); $contents[] = array('align' => 'center', 'text' => '<br>' . '<span class="button"><button type="submit" value="' . BUTTON_COPY . '">' . vam_image(DIR_WS_IMAGES . 'icons/buttons/copy.png', '', '12', '12') . ' ' . BUTTON_COPY . '</button></span>' . ' <a class="button" href="' . vam_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath . '&aID=' . $aInfo->articles_id) . '"><span>' . vam_image(DIR_WS_IMAGES . 'icons/buttons/cancel.png', '', '12', '12') . ' ' . BUTTON_CANCEL . '</span></a>'); break; default: if ($rows > 0) { if (isset($tInfo) && is_object($tInfo)) { // topic info box contents $heading[] = array('text' => '<b>' . $tInfo->topics_name . '</b>'); $contents[] = array('align' => 'center', 'text' => '<a class="button" href="' . vam_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath . '&tID=' . $tInfo->topics_id . '&action=edit_topic') . '"><span>' . vam_image(DIR_WS_IMAGES . 'icons/buttons/edit.png', '', '12', '12') . ' ' . BUTTON_EDIT . '</span></a> <a class="button" href="' . vam_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath . '&tID=' . $tInfo->topics_id . '&action=delete_topic') . '"><span>' . vam_image(DIR_WS_IMAGES . 'icons/buttons/delete.png', '', '12', '12') . ' ' . BUTTON_DELETE . '</span></a> <a class="button" href="' . vam_href_link(FILENAME_ARTICLES, 'tPath=' . $tPath . '&tID=' . $tInfo->topics_id . '&action=move_topic') . '"><span>' . vam_image(DIR_WS_IMAGES . 'icons/buttons/move.png', '', '12', '12') . ' ' . BUTTON_MOVE . '</span></a>'); $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . vam_date_short($tInfo->date_added)); if (vam_not_null($tInfo->last_modified)) { $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . vam_date_short($tInfo->last_modified)); } $contents[] = array('text' => '<br>' . TEXT_SUBTOPICS . ' ' . $tInfo->childs_count . '<br>' . TEXT_ARTICLES . ' ' . $tInfo->articles_count); } elseif (isset($aInfo) && is_object($aInfo)) {