/**
     * Creates a list with all the links in it
     * @return string
     */
    public function get_links()
    {
        require_once api_get_path(LIBRARY_PATH).'link.lib.php';

        $course_id = api_get_course_int_id();
        $tbl_link = Database::get_course_table(TABLE_LINK);

        $session_id = api_get_session_id();
        $condition_session = api_get_session_condition($session_id);

        $sql = "SELECT id, title, category_id FROM $tbl_link
                WHERE c_id = ".$course_id." $condition_session
                ORDER BY title ASC";
        $res_link = Database::query($sql);

        $return = '<ul class="lp_resource">';
        $return .= '<li class="lp_resource_element">';
        $return .= '<img alt="" src="../img/linksnew.gif" style="margin-right:5px;width:16px" title="" />';
        $return .= '<a href="' . api_get_path(REL_CODE_PATH) . 'link/link.php?' . api_get_cidreq() . '&action=addlink&amp;lp_id=' . $this->lp_id . '" title="' . get_lang('LinkAdd') . '">' . get_lang('LinkAdd') . '</a>';
        $return .= '</li>';
        $course_info = api_get_course_info();

        $linkCategories = getLinkCategories($course_id, $session_id);
        $categoryIdList = array();
        if (!empty($linkCategories)) {
            foreach ($linkCategories as $categoryInfo) {
                $categoryIdList[] = $categoryInfo['id'];
            }
        }

        while ($row_link = Database :: fetch_array($res_link)) {

            // Check if category exists if not then consider as deleted.
            if (!empty($row_link['category_id'])) {
                $categoryId = $row_link['category_id'];
                if (!in_array($categoryId, $categoryIdList)) {
                    continue;
                }
            }

            $item_visibility = api_get_item_visibility(
                $course_info,
                TOOL_LINK,
                $row_link['id'],
                $session_id
            );
            if ($item_visibility != 2)  {
                $return .= '<li class="lp_resource_element" data_id="'.$row_link['id'].'" data_type="'.TOOL_LINK.'" title="'.$row_link['title'].'" >';
                $return .= '<a class="moved" href="#">';
                $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
                $return .= '</a> ';
                $return .= '<img alt="" src="../img/lp_link.gif" style="margin-right:5px;" title="" />';
                $return .= '<a href="' . api_get_self().'?'.api_get_cidreq().'&amp;action=add_item&amp;type=' . TOOL_LINK . '&amp;file=' . $row_link['id'] . '&amp;lp_id=' . $this->lp_id . '">'.
                    $row_link['title'].
                    '</a>';
                $return .= '</li>';
            }
        }
        $return .= '</ul>';

        return $return;
    }
Esempio n. 2
0
										<dd><input type="text" id="url" class="input-text url" name="url" /></dd>
									</dl>
									<dl id="category-line" class="line">
										<dt><label for="url"><?php 
echo _t('분류');
?>
</label></dt>
										<dd>
											<select id="category" name="category">
											<option value="0"><?php 
echo _t('분류 없음');
?>
</option>
<?php 
$categories = array();
$categories = getLinkCategories(getBlogId());
foreach ($categories as $category) {
    ?>
											<option value="<?php 
    echo $category['id'];
    ?>
"><?php 
    echo htmlspecialchars($category['name']);
    ?>
</option>
<?php 
}
?>
											</select>
										</dd>
										<dd><?php 
Esempio n. 3
0
    $category_submitted
) {
    /*	Action Links */
    echo '<div class="actions">';
    if (api_is_allowed_to_edit(null, true)) {
        $urlview = Security::remove_XSS($urlview);
        echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=addlink&amp;category='.(!empty($category) ? $category : '').'&amp;urlview='.$urlview.'">'.
            Display::return_icon('new_link.png', get_lang('LinkAdd'),'',ICON_SIZE_MEDIUM).'</a>';
        echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=addcategory&amp;urlview='.$urlview.'">'.
            Display::return_icon('new_folder.png', get_lang('CategoryAdd'),'',ICON_SIZE_MEDIUM).'</a>';

        /* "<a href=\"".api_get_self()."?".api_get_cidreq()."&action=importcsv&amp;urlview=".$urlview."\">".get_lang('CsvImport')."</a>\n", // RH*/
    }
    // Making the show none / show all links. Show none means urlview=0000 (number of zeros depending on the
    // number of categories). Show all means urlview=1111 (number of 1 depending on teh number of categories).
    $resultcategories = getLinkCategories($course_id, $session_id);
    $aantalcategories = count($resultcategories);
    if (!empty($resultcategories)) {
        echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&urlview=';
        for ($j = 1; $j <= $aantalcategories; $j++) {
            echo '0';
        }
        echo '">'.Display::return_icon('view_remove.png', $shownone,'',ICON_SIZE_MEDIUM).'</a>';
        echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&urlview=';
        for ($j = 1; $j <= $aantalcategories; $j++) {
            echo '1';
        }
        echo '">'.Display::return_icon('view_tree.png', $showall,'',ICON_SIZE_MEDIUM).'</a>';
    }
    echo '</div>';