Exemplo n.º 1
0
function tagslist()
{
    require_once _base_ . '/lib/lib.table.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.tags.php';
    $lang =& DoceboLanguage::createInstance('tags', 'framework');
    $id_tag = Get::req('id_tag', DOTY_INT, 0);
    $tag_name = Get::req('tag', DOTY_STRING, '');
    $filter = Get::req('filter', DOTY_STRING, '');
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0);
    $nav_bar->setLink('index.php?modname=tags&op=tags&id_tag=' . $id_tag);
    $ini = $nav_bar->getSelectedElement();
    $tags = new Tags('*');
    $resources = $tags->getResourceByTags($id_tag, false, false, $ini, Get::sett('visuItem'));
    $GLOBALS['page']->add(getTitleArea(array($lang->def('_TAGS')), 'tags') . '<div class="std_block">' . '<div class="tag_list">', 'content');
    while (list(, $res) = each($resources['list'])) {
        $link = $res['permalink'];
        $delim = strpos($link, '?') === false ? '?' : '&';
        if (strpos($link, '#') === false) {
            $link = $link . $delim . 'sop=setcourse&sop_idc=' . $res['id_course'];
        } else {
            $link = str_replace('#', $delim . 'sop=setcourse&sop_idc=' . $res['id_course'] . '#', $link);
        }
        $GLOBALS['page']->add('' . '<h2>' . '<a href="' . $link . '">' . $res['title'] . '</a>' . '</h2>' . '<p>' . $res['sample_text'] . '</p>' . '<div class="tag_cloud">' . '<span>' . $lang->def('_TAGS') . ' : </span>' . '<ul><li>' . implode('</li><li>', $res['related_tags']) . '</li></ul>' . '</div>' . '<br />', 'content');
    }
    $GLOBALS['page']->add('</div>' . $nav_bar->getNavBar($ini, $resources['count']) . '</div>', 'content');
}
Exemplo n.º 2
0
    function notes()
    {
        checkPerm('view');
        require_once _base_ . '/lib/lib.table.php';
        $lang =& DoceboLanguage::createInstance('notes', 'lms');
        $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0);
        $ini = $nav_bar->getSelectedElement();
        $ord = importVar('ord');
        $inv = importVar('inv');
        switch ($ord) {
            case "tit":
                $ord = $order = 'title';
                if ($inv != 'y') {
                    $a_down = '&amp;inv=y';
                } else {
                    $order .= ' DESC';
                    $a_down = '';
                }
                break;
            default:
                $ord = $order = 'data';
                if ($inv == 'y') {
                    $a_down = '';
                } else {
                    $order .= ' DESC';
                    $a_down = '&amp;inv=y';
                }
        }
        $reNotes = sql_query("\r\n\tSELECT idNotes, data, title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_notes \r\n\tWHERE owner ='" . getLogUserId() . "' AND idCourse='" . $_SESSION['idCourse'] . "' \r\n\tORDER BY {$order} \r\n\tLIMIT {$ini}," . Get::sett('visuItem'));
        list($num_notes) = sql_fetch_row(sql_query("SELECT COUNT(*) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_notes \r\n\tWHERE owner ='" . getLogUserId() . "' AND idCourse='" . $_SESSION['idCourse'] . "' "));
        $nav_bar->setElementTotal($num_notes);
        $img_up = '<img class="valing-middle" src="' . getPathImage() . 'standard/up_arrow.png" alt="' . $lang->def('_UP') . '"/>';
        $img_down = '<img class="valing-middle" src="' . getPathImage() . 'standard/down_arrow.png" alt="' . $lang->def('_DOWN') . '"/>';
        $tb = new Table(Get::sett('visuItem'), $lang->def('_NOTES'), $lang->def('_NOTES'));
        $contentH = array(($ord == 'data' ? $inv == 'y' ? $img_up : $img_down : '') . '<a href="index.php?modname=notes&amp;op=notes' . $a_down . '"> ' . $lang->def('_DATE') . '</a>', ($ord == 'title' ? $inv == 'y' ? $img_up : $img_down : '') . '<a href="index.php?modname=notes&amp;op=notes&amp;ord=tit' . $a_down . '">' . $lang->def('_TITLE') . '</a>', '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" alt="' . $lang->def('_DEL') . '" />');
        $typeH = array('min-cell', '', 'image', 'image');
        $tb->setColsStyle($typeH);
        $tb->addHead($contentH);
        while (list($idNotes, $data, $title) = sql_fetch_row($reNotes)) {
            $content = array(Format::date($data), '<a href="index.php?modname=notes&amp;op=displaynotes&amp;idNotes=' . $idNotes . '" title="' . $lang->def('_MORET') . '">' . $title . '</a>', '<a href="index.php?modname=notes&amp;op=modnotes&amp;idNotes=' . $idNotes . '">
				<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" /></a>', '<a id="delnotes_' . $idNotes . '"' . ' href="index.php?modname=notes&amp;op=delnotes&amp;idNotes=' . $idNotes . '"' . ' title="' . $lang->def('_TITLE') . ' : ' . strip_tags(str_replace(array('"', "'"), '', $title)) . '">
				<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" /></a>');
            $tb->addBody($content);
        }
        $tb->addActionAdd('<a href="index.php?modname=notes&amp;op=addnotes">' . '<img src="' . getPathImage() . 'standard/add.png" title="' . $lang->def('_ADD') . '" alt="' . $lang->def('_ADD') . '" /> ' . $lang->def('_ADD_NOTES') . '</a>');
        $GLOBALS['page']->add(getTitleArea(array($lang->def('_NOTES')), 'notes') . '<div class="std_block">', 'content');
        if (isset($_POST['result'])) {
            switch ($_POST['result']) {
                case "ok":
                    $GLOBALS['page']->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')), 'content');
                case "err":
                    $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE')), 'content');
            }
        }
        $GLOBALS['page']->add($tb->getTable() . $nav_bar->getNavBar($ini), 'content');
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=delnotes]');
        $GLOBALS['page']->add('</div>', 'content');
    }
Exemplo n.º 3
0
function sessiondetails()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    $idst_user = importVar('id', true, 0);
    $id_enter = importVar('id_enter', true, 0);
    $p_ini = importVar('p_ini');
    $link = 'index.php?modname=statistic&amp;op=sessiondetails&amp;id=' . $idst_user . '&amp;id_enter=' . $id_enter;
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0, 'link');
    $nav_bar->setLink($link . '&amp;p_ini=' . $p_ini);
    $ini = $nav_bar->getSelectedElement();
    $lang =& DoceboLanguage::createInstance('statistic', 'lms');
    $acl_man = Docebo::user()->getAclManager();
    $user_info =& $acl_man->getUser($idst_user, false);
    $query_track = "\r\n\tSELECT g.function, g.type, g.timeof, UNIX_TIMESTAMP(g.timeof) AS unix_time \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_trackingeneral AS g\r\n\tWHERE g.idCourse = '" . (int) $_SESSION['idCourse'] . "' AND g.idUser = '******' AND " . " ( g.idEnter = '" . $id_enter . "' OR (  g.idEnter = 0 AND g.session_id = '" . importVar('sid') . "' ) ) " . " ORDER BY g.timeof \r\n\tLIMIT " . $ini . ", " . Get::sett('visuItem');
    $re_tracks = sql_query($query_track);
    $query_tot_track = "\r\n\tSELECT COUNT(*) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_trackingeneral \r\n\tWHERE idCourse = '" . (int) $_SESSION['idCourse'] . "' AND idUser = '******' AND idEnter = '" . $id_enter . "'";
    list($tot_elem) = sql_fetch_row(sql_query($query_tot_track));
    $nav_bar->setElementTotal($tot_elem);
    // Find modulename -> name int his course
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    $course_man = new Man_Course();
    $mods_names =& $course_man->getModulesName($_SESSION['idCourse']);
    $page_title = array('index.php?modname=statistic&amp;op=statistic' => $lang->def('_STATISTICS'), 'index.php?modname=statistic&amp;op=userdetails&amp;id=' . $idst_user . '&amp;p_ini=' . $p_ini => $user_info[ACL_INFO_LASTNAME] . $user_info[ACL_INFO_FIRSTNAME] ? $user_info[ACL_INFO_LASTNAME] . ' ' . $user_info[ACL_INFO_FIRSTNAME] : $acl_man->relativeId($user_info[ACL_INFO_USERID]), $lang->def('_VIEW_SESSION_DETAILS'));
    $GLOBALS['page']->add(getTitleArea($page_title, 'statistic') . '<div class="std_block">' . getBackUi('index.php?modname=statistic&amp;op=userdetails&amp;id=' . $idst_user . '&amp;p_ini=' . $p_ini, $lang->def('_BACK')), 'content');
    $tb = new Table(0, $lang->def('_VIEW_SESSION_DETAILS'), $lang->def('_VIEW_SESSION_DETAILS'));
    $type_h = array('', '', '');
    $cont_h = array($lang->def('_DATE'), $lang->def('_TYPE_OF_OPERATION'), $lang->def('_TIME_IN'));
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    $type_h[2] = 'align_right';
    $tb->setColsStyle($type_h);
    $total_sec = 0;
    $read_previous = false;
    while ($read = mysql_fetch_assoc($re_tracks)) {
        if ($read_previous !== false) {
            $time_in = $read['unix_time'] - $read_previous['unix_time'];
            $hours = (int) ($time_in / 3600);
            $minutes = (int) ($time_in % 3600 / 60);
            $seconds = (int) ($time_in % 60);
            if ($minutes < 10) {
                $minutes = '0' . $minutes;
            }
            if ($seconds < 10) {
                $seconds = '0' . $seconds;
            }
            $readable = $hours . 'h ' . $minutes . 'm ' . $seconds . 's ';
            $cont = array(Format::date($read_previous['timeof'], false, true), '<span class="text_bold">' . (isset($mods_names[$read_previous['function']]) ? $mods_names[$read_previous['function']] : $read_previous['function']) . '</span> [' . $read_previous['type'] . ']', $readable);
            $tb->addBody($cont);
        }
        $read_previous = $read;
    }
    $query_last_track = "\r\n\tSELECT g.function, g.type, g.timeof, UNIX_TIMESTAMP(g.timeof) AS unix_time \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_trackingeneral AS g\r\n\tWHERE g.idCourse = '" . (int) $_SESSION['idCourse'] . "' AND g.idUser = '******' AND g.idEnter = '" . $id_enter . "' \r\n\tLIMIT " . ($ini + Get::sett('visuItem')) . ", 1";
    $re_track = sql_query($query_last_track);
    if (mysql_num_rows($re_track) > 0) {
        $read = mysql_fetch_assoc($re_track);
        $time_in = $read['unix_time'] - $read_previous['unix_time'];
        $hours = (int) ($time_in / 3600);
        $minutes = (int) ($time_in % 3600 / 60);
        $seconds = (int) ($time_in % 60);
        if ($minutes < 10) {
            $minutes = '0' . $minutes;
        }
        if ($seconds < 10) {
            $seconds = '0' . $seconds;
        }
        $readable = $hours . 'h ' . $minutes . 'm ' . $seconds . 's ';
    } else {
        $readable = '';
    }
    $cont = array(Format::date($read_previous['timeof']), '<span class="text_bold">' . (isset($mods_names[$read_previous['function']]) ? $mods_names[$read_previous['function']] : $read_previous['function']) . '</span> [' . $read_previous['type'] . ']', $readable);
    $tb->addBody($cont);
    $GLOBALS['page']->add($tb->getTable() . $nav_bar->getNavBar() . getBackUi('index.php?modname=statistic&amp;op=userdetails&amp;id=' . $idst_user . '&amp;p_ini=' . $p_ini, $lang->def('_BACK')) . '</div>', 'content');
}
Exemplo n.º 4
0
 function getViewUserFiles()
 {
     require_once _base_ . '/lib/lib.navbar.php';
     $viewer = $this->getViewer();
     $type = Get::req('type', DOTY_MIXED, '');
     $this->loadUserData($viewer);
     // main container ---------------------------------------------------------------------
     $html = '<h1>' . $this->_lang->def('_PROFILE') . ': ' . $this->resolveUsername() . '</h1>';
     $html .= '<div id="up_user_info" class="up_user_info">';
     $html .= $this->getUserRelatedAction($type);
     require_once $GLOBALS['where_framework'] . '/lib/lib.myfiles.php';
     $user_file = new MyFilesPolicy($this->_user_profile->getIdUser(), $this->getViewer(), $this->_up_data_man->isFriend($this->_user_profile->getIdUser(), $this->getViewer()), $this->_up_data_man->isTeacher($this->getViewer()));
     $num_files = $user_file->getFileCount($type);
     $nav_bar = new NavBar('ini', UP_FILE_LIMIT, $num_files, 'link');
     $ini = $nav_bar->getSelectedElement();
     $nav_bar->setLink($this->_url_man->getUrl($this->_varname_action . '=view_files&type=' . $type . ''));
     $re_files = $user_file->getFileList($type, false, $ini, UP_FILE_LIMIT);
     switch ($type) {
         case "image":
             $html .= '<h2 class="up_type1">' . $this->_lang->def('_IMAGES') . '</h2>' . $nav_bar->getNavBar($ini) . '<div class="up_box_files">';
             if ($re_files && $num_files > 0) {
                 $html .= '<ul class="image_list">';
                 while ($image = $user_file->fetch_row($re_files)) {
                     $size = @getimagesize($GLOBALS['where_files_relative'] . $user_file->getFileAddress($image[MYFILE_FILE_NAME]));
                     $class_limit = '';
                     if ($size[0] > 200 && $size[0] > $size[1]) {
                         $class_limit = 'image_limit_width';
                     }
                     if ($size[1] > 200 && $size[0] < $size[1]) {
                         $class_limit = 'image_limit_height';
                     }
                     $html .= '<li>' . '<a href="' . $this->_url_man->getUrl($this->_varname_action . '=file_details&id_user='******'&type=' . $type . '&id_file=' . $image[MYFILE_ID_FILE]) . '">' . '<img class="user_image ' . $class_limit . '" src="' . $GLOBALS['where_files_relative'] . $user_file->getFileAddress($image[MYFILE_FILE_NAME]) . '" ' . 'title="' . strip_tags($image[MYFILE_DESCRIPTION]) . '" alt="' . strip_tags($image[MYFILE_TITLE]) . '" />' . '<br/>' . $image[MYFILE_TITLE] . '</a>' . '</li>';
                 }
                 $html .= '</ul>';
             } else {
                 $html .= '<p>' . $this->_lang->def('_NO_IMAGE_FOUND') . '</p>';
             }
             $html .= '<div class="nofloat"></div>' . '</div>';
             break;
         case "video":
             $html .= '<h2 class="up_type1">' . $this->_lang->def('_USER_VIDEOS') . '</h2>' . $nav_bar->getNavBar($ini) . '<div class="up_box_files">';
             if ($re_files && $num_files > 0) {
                 require_once _base_ . '/lib/lib.multimedia.php';
                 $html .= '<ul class="video_list">';
                 while ($video = $user_file->fetch_row($re_files)) {
                     $play_code = getEmbedPlay($GLOBALS['where_files_relative'] . $user_file->getFilePath(), $video[MYFILE_FILE_NAME], false, '250', false, false);
                     $class_limit = '';
                     $html .= '<li>' . ($play_code === false ? implode('_', array_slice(explode('_', $video[MYFILE_FILE_NAME]), 3)) : $play_code) . '<br />' . '<a href="' . $this->_url_man->getUrl($this->_varname_action . '=file_details&id_user='******'&type=' . $type . '&id_file=' . $video[MYFILE_ID_FILE]) . '">' . $video[MYFILE_TITLE] . ($play_code === false ? ' (' . $this->_lang->def('_DOWNLOAD') . ')' : '') . '</a>' . '</li>';
                 }
                 $html .= '</ul>';
             } else {
                 $html .= '<p>' . $this->_lang->def('_NO_IMAGE_FOUND') . '</p>';
             }
             $html .= '<div class="nofloat"></div>' . '</div>';
             break;
         case "audio":
             $html .= '<h2 class="up_type1">' . $this->_lang->def('_USER_AUDIO') . '</h2>' . $nav_bar->getNavBar($ini) . '<div class="up_box_files">';
             if ($re_files && $num_files > 0) {
                 require_once _base_ . '/lib/lib.multimedia.php';
                 $html .= '<ul class="video_list">';
                 while ($audio = $user_file->fetch_row($re_files)) {
                     $play_code = getEmbedPlay($GLOBALS['where_files_relative'] . $user_file->getFilePath(), $audio[MYFILE_FILE_NAME], false, '250', false, false);
                     $class_limit = '';
                     $html .= '<li>' . ($play_code === false ? implode('_', array_slice(explode('_', $audio[MYFILE_FILE_NAME]), 3)) : $play_code) . '<br />' . '<a href="' . $this->_url_man->getUrl($this->_varname_action . '=file_details&id_user='******'&type=' . $type . '&id_file=' . $audio[MYFILE_ID_FILE]) . '">' . $audio[MYFILE_TITLE] . ($play_code === false ? ' (' . $this->_lang->def('_DOWNLOAD') . ')' : '') . '</a>' . '</li>';
                 }
                 $html .= '</ul>';
             } else {
                 $html .= '<p>' . $this->_lang->def('_NO_IMAGE_FOUND') . '</p>';
             }
             $html .= '<div class="nofloat"></div>' . '</div>';
             break;
         case "other":
             $html .= '<h2 class="up_type1">' . $this->_lang->def('_USER_OTHER') . '</h2>' . $nav_bar->getNavBar($ini) . '<div class="up_box_files">';
             if ($re_files && $num_files > 0) {
                 require_once _base_ . '/lib/lib.multimedia.php';
                 $html .= '<ul class="other_list">';
                 while ($other = $user_file->fetch_row($re_files)) {
                     $class_limit = '';
                     $html .= '<li>' . '<a href="' . $this->_url_man->getUrl($this->_varname_action . '=file_details&id_user='******'&type=' . $type . '&id_file=' . $other[MYFILE_ID_FILE]) . '">' . '<img src="' . getPathImage('fw') . mimeDetect($user_file->getFilePath() . $other[MYFILE_FILE_NAME]) . '" alt="myme-type" />' . $other[MYFILE_TITLE] . '</a>' . '<br/>' . $other[MYFILE_DESCRIPTION] . '</li>';
                 }
                 $html .= '</ul>';
             } else {
                 $html .= '<p>' . $this->_lang->def('_NO_IMAGE_FOUND') . '</p>';
             }
             $html .= '<div class="nofloat"></div>' . '</div>';
             break;
     }
     $html .= $nav_bar->getNavBar($ini);
     $html .= '</div>';
     return $html;
 }
Exemplo n.º 5
0
function news()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.navbar.php';
    $mod_perm = checkPerm('mod', true);
    $lang =& DoceboLanguage::createInstance('admin_news', 'lms');
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $tb = new Table(Get::sett('visuItem'), $lang->def('_NEWS'), $lang->def('_NEWS_SUMMARY'));
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0, 'link');
    $ini = $nav_bar->getSelectedElement();
    //search query
    $query_news = "\r\n\tSELECT idNews, publish_date, title, short_desc, important\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_news_internal\r\n\tORDER BY important DESC, publish_date DESC\r\n\tLIMIT {$ini}," . Get::sett('visuItem');
    $query_news_tot = "\r\n\tSELECT COUNT(*)\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_news_internal ";
    $re_news = sql_query($query_news);
    list($tot_news) = sql_fetch_row(sql_query($query_news_tot));
    $nav_bar->setElementTotal($tot_news);
    $impo_gif = '<img src="' . getPathImage('lms') . 'standard/important.png" ' . 'title="' . $lang->def('_TITLE_IMPORTANT') . '" ' . 'alt="' . $lang->def('_IMPORTANT') . '" />';
    $type_h = array('image', '', '', 'news_short_td');
    $cont_h = array($impo_gif, $lang->def('_DATE'), $lang->def('_TITLE'), $lang->def('_SHORTDESC'));
    if ($mod_perm) {
        $cont_h[] = '<img src="' . getPathImage() . 'standard/moduser.png" title="' . $lang->def('_RECIPIENTS') . '" ' . 'alt="' . $lang->def('_RECIPIENTS') . '" />';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" ' . 'alt="' . $lang->def('_MOD') . '" />';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" ' . 'alt="' . $lang->def('_DEL') . '"" />';
        $type_h[] = 'image';
    }
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    while (list($id_news, $publish_date, $title, $short_desc, $impo) = sql_fetch_row($re_news)) {
        $cont = array($impo ? $impo_gif : '', Format::date($publish_date), $title, Util::cut($short_desc));
        if ($mod_perm) {
            $cont[] = '<a href="index.php?modname=internal_news&amp;op=editviewer&amp;load=1&amp;id_news=' . $id_news . '" ' . 'title="' . $lang->def('_RECIPIENTS') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/moduser.png" alt="' . $lang->def('_RECIPIENTS') . ' : ' . $title . '" /></a>';
            $cont[] = '<a href="index.php?modname=internal_news&amp;op=modnews&amp;id_news=' . $id_news . '" ' . 'title="' . $lang->def('_MOD') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $title . '" /></a>';
            $cont[] = '<a href="index.php?modname=internal_news&amp;op=delnews&amp;id_news=' . $id_news . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $title . '" /></a>';
        }
        $tb->addBody($cont);
    }
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=delnews]');
    if ($mod_perm) {
        $tb->addActionAdd('<a href="index.php?modname=internal_news&amp;op=addnews" title="' . $lang->def('_NEW') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_NEW') . '</a>');
    }
    $out->add(getTitleArea($lang->def('_NEWS'), 'news') . '<div class="std_block">');
    if (isset($_GET['result'])) {
        switch ($_GET['result']) {
            case "ok":
                $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
            case "err":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
            case "err_del":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
        }
    }
    if ($mod_perm) {
        $form = new Form();
        $how_much = Get::sett('visuNewsHomePage');
        if (isset($_POST['save_homepage'])) {
            $query_how_news = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_setting\r\n\t\t\tSET param_value = '" . abs((int) $_POST['howmuch']) . "'\r\n\t\t\tWHERE param_name = 'visuNewsHomePage'";
            if (sql_query($query_how_news)) {
                $how_much = abs((int) $_POST['howmuch']);
            }
        }
    }
    $out->add($tb->getTable() . $nav_bar->getNavBar($ini) . '</div>');
}
Exemplo n.º 6
0
function webpages()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $mod_perm = checkPerm('mod', true);
    $lang =& DoceboLanguage::createInstance('admin_webpages', 'lms');
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $tb = new Table(0, $lang->def('_WEBPAGES_CAPTION'));
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0, 'button');
    $ini = $nav_bar->getSelectedElement();
    //search query
    $query_pages = "\r\n\tSELECT idPages, title, publish, in_home, sequence \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_webpages \r\n\tORDER BY sequence \r\n\tLIMIT {$ini}," . Get::sett('visuItem');
    $num_query_pages = "\r\n\tSELECT COUNT(*) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_webpages ";
    //do query
    $re_pages = sql_query($query_pages);
    list($tot_pages) = sql_fetch_row(sql_query($num_query_pages));
    $nav_bar->setElementTotal($tot_pages);
    //-Table---------------------------------------------------------
    $cont_h = array($lang->def('_TITLE'), '<img src="' . getPathImage() . 'webpages/home.png" alt="' . $lang->def('_ALT_HOME') . '" title="' . $lang->def('_TITLE_HOME') . '" />', '<img src="' . getPathImage() . 'standard/publish.png" alt="' . $lang->def('_PUBLISH') . '" title="' . $lang->def('_STATUS') . '" />');
    $type_h = array('', 'image', 'image', 'image');
    if ($mod_perm) {
        $cont_h[] = '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . '" title="' . $lang->def('_MOVE_DOWN') . '" />';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . '" title="' . $lang->def('_MOVE_UP') . '" />';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '" />';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" title="' . $lang->def('_DEL') . '" />';
        $type_h[] = 'image';
    }
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    $i = 1;
    while (list($id, $title, $publish, $in_home) = sql_fetch_row($re_pages)) {
        $cont = array($title, $in_home ? '<img src="' . getPathImage() . 'webpages/home.png" alt="' . $lang->def('_ALT_HOME') . '" title="' . $lang->def('_TITLE_HOME') . '" />' : '');
        if ($publish) {
            $cont[] = '<a href="index.php?modname=webpages&amp;op=unpublish&amp;id_page=' . $id . '" title="' . $lang->def('_PUBLISH') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/publish.png" alt="' . $lang->def('_PUBLISH') . ' : ' . $title . '" /></a>';
        } else {
            $cont[] = '<a href="index.php?modname=webpages&amp;op=publish&amp;id_page=' . $id . '" title="' . $lang->def('_UNPUBLISH') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/unpublish.png" alt="' . $lang->def('_UNPUBLISH') . ' : ' . $title . '" /></a>';
        }
        if ($mod_perm) {
            if ($i != $tot_pages - $ini * Get::sett('visuItem')) {
                $cont[] = '<a href="index.php?modname=webpages&amp;op=movedown&amp;id_page=' . $id . '" title="' . $lang->def('_MOVE_DOWN') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . ' : ' . $title . '" /></a>';
            } else {
                $cont[] = '&nbsp;';
            }
            if ($i != 1 || $ini != 0) {
                $cont[] = '<a href="index.php?modname=webpages&amp;op=moveup&amp;id_page=' . $id . '" title="' . $lang->def('_MOVE_UP') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . ' : ' . $title . '" /></a>';
            } else {
                $cont[] = '&nbsp;';
            }
            $cont[] = '<a href="index.php?modname=webpages&amp;op=modpages&amp;id_page=' . $id . '" title="' . $lang->def('_MOD') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $title . '" /></a>';
            $cont[] = '<a href="index.php?modname=webpages&amp;op=delpages&amp;id_page=' . $id . '" title="' . $lang->def('_DEL') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $title . '" /></a>';
        }
        $tb->addBody($cont);
        ++$i;
    }
    if ($mod_perm) {
        $tb->addActionAdd('<a class="ico-wt-sprite subs_add" href="index.php?modname=webpages&amp;op=addpages" title="' . Lang::t('_ADD', 'webpages') . '"><span>' . Lang::t('_ADD', 'webpages') . '</span></a>');
    }
    //visualize result
    $out->add(getTitleArea($lang->def('_TITLE_WEBPAGES'), 'webpages') . '<div class="std_block">');
    if (isset($_GET['result'])) {
        switch ($_GET['result']) {
            case "ok":
                $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
            case "err":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
            case "err_del":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
        }
    }
    $out->add($tb->getTable() . Form::openForm('nav_webpages', 'index.php?modname=webpages&amp;op=webpages') . $nav_bar->getNavBar($ini) . Form::closeForm() . '</div>');
    if ($mod_perm) {
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=delpages]');
    }
}
Exemplo n.º 7
0
function archiveList()
{
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('advice');
    $mod_perm = checkPerm('mod', true);
    $out = $GLOBALS['page'];
    $out->setWorkingZone('content');
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0, 'button');
    $ini = $nav_bar->getSelectedElement();
    $query_my_arch_advice = "\r\n\t\tSELECT DISTINCT idAdvice\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_adviceuser\r\n\t\tWHERE idUser = '******' AND archivied = '1'";
    $re_my_arch_advice = sql_query($query_my_arch_advice);
    while (list($id) = sql_fetch_row($re_my_arch_advice)) {
        $advice_arch[] = $id;
    }
    if (!empty($advice_arch)) {
        $query_advice = "\r\n\t\t\tSELECT idAdvice, posted, title, description, important, author\r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_advice\r\n\t\t\tWHERE idCourse='" . $_SESSION['idCourse'] . "' AND idAdvice IN ( " . implode($advice_arch, ',') . " )\r\n\t\t\tORDER BY posted DESC\r\n\t\t\tLIMIT {$ini}," . Get::sett('visuItem');
        $re_advice = sql_query($query_advice);
        list($numofadvice) = sql_fetch_row(sql_query("\r\n\t\t\tSELECT COUNT(DISTINCT idAdvice)\r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_advice\r\n\t\t\tWHERE idCourse='" . $_SESSION['idCourse'] . "' AND idAdvice IN ( " . implode($advice_arch, ',') . " )"));
        $nav_bar->setElementTotal($numofadvice);
        if (isset($_GET['result'])) {
            switch ($_GET['result']) {
                case "ok":
                    $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                    break;
                case "err":
                    $out->add(getErrorUi($lang->def('_ERR_INSERT')));
                    break;
                case "err_user":
                    $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                    break;
            }
        }
        while (list($idA, $posted, $title, $description, $impo, $author) = sql_fetch_row($re_advice)) {
            $out->add('<div class="list_block">' . '<h2 class="heading">');
            if ($impo) {
                $out->add('<img src="' . getPathImage() . 'standard/important.png" alt="' . $lang->def('_IMPORTANT') . '" /> ');
            } else {
                $out->add('');
            }
            $out->add($title . '</h2>' . '<div class="content"><p class="publish-date">' . Format::date($posted) . '</p>' . $description . '</div>' . '<div class="actions">');
            if ($mod_perm) {
                $out->add('<ul class="link_list_inline">' . '<li><a class="ico-wt-sprite subs_users" href="index.php?modname=advice&amp;op=modreader&amp;id_advice=' . $idA . '&amp;load=1" title="' . $lang->def('_VIEW_PERMISSION') . ' : ' . $title . '">' . '<span>' . $lang->def('_MOD') . '</span></a></li>' . '<li><a class="ico-wt-sprite subs_mod" href="index.php?modname=advice&amp;op=modadvice&amp;idAdvice=' . $idA . '" title="' . $lang->def('_MOD') . ' : ' . $title . '">' . '<span>' . $lang->def('_MOD') . '</span></a></li>' . '<li><a class="ico-wt-sprite subs_del" href="index.php?modname=advice&amp;op=deladvice&amp;idAdvice=' . $idA . '" title="' . $lang->def('_DEL') . ' : ' . $title . '">' . '<span>' . $lang->def('_DEL') . '</span></a></li>' . '</ul>');
                require_once _base_ . '/lib/lib.dialog.php';
                setupHrefDialogBox('a[href*=deladvice]');
            }
            $out->add('</div>' . '</div><br />');
        }
    }
    $form = new Form();
    $out->add($form->getHidden('archive_status', 'archive_status', '1') . $nav_bar->getNavBar($ini));
}
Exemplo n.º 8
0
function forumsearch()
{
    checkPerm('view');
    if (isset($_POST['search_arg'])) {
        $_SESSION['forum']['search_arg'] = $_POST['search_arg'];
        $search_arg = importVar('search_arg');
    } else {
        $search_arg = $_SESSION['forum']['search_arg'];
    }
    $ord = importVar('ord');
    $mod_perm = checkPerm('mod', true);
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.navbar.php';
    require_once _base_ . '/lib/lib.form.php';
    $lang =& DoceboLanguage::createInstance('forum');
    $acl_man =& Docebo::user()->getAclManager();
    if ($mod_perm) {
        $query_view_forum = "\r\n\t\tSELECT DISTINCT idForum\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_forum\r\n\t\tWHERE idCourse = '" . (int) $_SESSION['idCourse'] . "'";
    } else {
        $acl =& Docebo::user()->getAcl();
        $all_user_idst = $acl->getSTGroupsST(getLogUserId());
        $all_user_idst[] = getLogUserId();
        $query_view_forum = "\r\n\t\tSELECT DISTINCT f.idForum\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_forum AS f\r\n\t\t\tLEFT JOIN " . $GLOBALS['prefix_lms'] . "_forum_access AS fa ON ( f.idForum = fa.idForum )\r\n\t\tWHERE f.idCourse = '" . (int) $_SESSION['idCourse'] . "' AND\r\n\t\t\t( fa.idMember IS NULL OR fa.idMember IN (" . implode($all_user_idst, ',') . " )  ) ";
    }
    $forums = array();
    $re_forum = sql_query($query_view_forum);
    while (list($id_f) = sql_fetch_row($re_forum)) {
        $forums[] = $id_f;
    }
    if (empty($forums)) {
        $page_title = array('index.php?modname=forum&amp;op=forum' => $lang->def('_FORUM'), $lang->def('_SEARCH_RESULT_FOR') . ' : ' . $search_arg);
        $GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . $lang->def('_NO_PLACEFORSEARCH') . '</div>', 'content');
    }
    $query_num_thread = "\r\n\tSELECT COUNT(DISTINCT t.idThread)\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forumthread AS t JOIN\r\n\t\t\t" . $GLOBALS['prefix_lms'] . "_forummessage AS m\r\n\tWHERE t.idThread = m.idThread AND t.idForum IN ( " . implode($forums, ',') . " )\r\n\t\tAND ( m.title LIKE '%" . $search_arg . "%' OR m.textof LIKE '%" . $search_arg . "%' ) ";
    list($tot_thread) = sql_fetch_row(sql_query($query_num_thread));
    $jump_url = 'index.php?modname=forum&amp;op=search';
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), $tot_thread, 'link');
    $nav_bar->setLink($jump_url . '&amp;ord=' . $ord);
    $ini = $nav_bar->getSelectedElement();
    $ini_page = $nav_bar->getSelectedPage();
    $query_thread = "\r\n\tSELECT DISTINCT t.idThread, t.idForum, t.author AS thread_author, t.posted, t.title, t.num_post, t.num_view, t.locked, t.erased\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forumthread AS t JOIN\r\n\t\t\t" . $GLOBALS['prefix_lms'] . "_forummessage AS m\r\n\tWHERE t.idThread = m.idThread AND t.idForum IN ( " . implode($forums, ',') . " )\r\n\t\tAND ( m.title LIKE '%" . $search_arg . "%' OR m.textof LIKE '%" . $search_arg . "%' ) ";
    switch ($ord) {
        case "obji":
            $query_thread .= " ORDER BY t.title DESC ";
            break;
        case "obj":
            $query_thread .= " ORDER BY t.title ";
            break;
        case "authi":
            $query_thread .= " ORDER BY t.author DESC ";
            break;
        case "auth":
            $query_thread .= " ORDER BY t.author ";
            break;
        case "posti":
            $query_thread .= " ORDER BY m.posted ";
            break;
        case "post":
        default:
            $ord = 'post';
            $query_thread .= " ORDER BY m.posted DESC ";
            break;
    }
    $query_thread .= " LIMIT {$ini}, " . Get::sett('visuItem');
    $re_thread = sql_query($query_thread);
    $re_last_post = sql_query("\r\n\tSELECT m.idThread, t.author AS thread_author, m.posted, m.title, m.author  AS mess_author, m.generator\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forumthread AS t LEFT JOIN\r\n\t\t" . $GLOBALS['prefix_lms'] . "_forummessage AS m ON ( t.last_post = m.idMessage )\r\n\tWHERE t.idForum IN ( " . implode($forums, ',') . " )");
    while (list($idT_p, $id_ta, $posted, $title_p, $id_a, $is_gener) = sql_fetch_row($re_last_post)) {
        $last_authors[$id_ta] = $id_ta;
        if ($posted !== NULL) {
            $last_post[$idT_p]['info'] = Format::date($posted) . '<br />' . substr(strip_tags($title_p), 0, 15) . ' ...';
            $last_post[$idT_p]['author'] = $id_a;
            $last_authors[$id_a] = $id_a;
        }
    }
    if (isset($last_authors)) {
        $authors_names =& $acl_man->getUsers($last_authors);
    }
    $page_title = array('index.php?modname=forum&amp;op=forum' => $lang->def('_FORUM'), $lang->def('_SEARCH_RESULT_FOR') . ' : ' . $search_arg);
    $GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . Form::openForm('search_forum', 'index.php?modname=forum&amp;op=search') . '<div class="quick_search_form">' . '<label for="search_arg">' . $lang->def('_SEARCH_LABEL') . '</label> ' . Form::getInputTextfield('search_t', 'search_arg', 'search_arg', $search_arg, $lang->def('_SEARCH'), 255, '') . '<input class="search_b" type="submit" id="search_button" name="search_button" value="' . $lang->def('_SEARCH') . '" />' . '</div>' . Form::closeForm(), 'content');
    $tb = new Table(Get::sett('visuItem'), $lang->def('_THREAD_CAPTION'), $lang->def('_THRAD_SUMMARY'));
    $img_up = '<img src="' . getPathImage() . 'standard/ord_asc.png" alt="' . $lang->def('_ORD_ASC') . '" />';
    $img_down = '<img src="' . getPathImage() . 'standard/ord_desc.png" alt="' . $lang->def('_ORD_DESC') . '" />';
    $cont_h = array('<img src="' . getPathImage() . 'standard/msg_read.png" title="' . $lang->def('_FREET') . '" alt="' . $lang->def('_FREE') . '" />', '<a href="' . $jump_url . '&amp;ord=' . ($ord == 'obj' ? 'obji' : 'obj') . '" title="' . $lang->def('_ORDER_BY') . '">' . ($ord == 'obj' ? $img_up : ($ord == 'obji' ? $img_down : '')) . $lang->def('_THREAD') . '</a>', $lang->def('_NUMREPLY'), '<a href="' . $jump_url . '&amp;ord=' . ($ord == 'auth' ? 'authi' : 'auth') . '" title="' . $lang->def('_ORDER_BY') . '">' . ($ord == 'auth' ? $img_up : ($ord == 'authi' ? $img_down : '')) . $lang->def('_AUTHOR') . '</a>', $lang->def('_NUMVIEW'), '<a href="' . $jump_url . '&amp;ord=' . ($ord == 'post' ? 'posti' : 'post') . '" title="' . $lang->def('_ORDER_BY') . '">' . ($ord == 'post' ? $img_up : ($ord == 'posti' ? $img_down : '')) . $lang->def('_LASTPOST') . '</a>');
    $type_h = array('image', '', 'align_center', 'align_center', 'image', 'align_center');
    if ($mod_perm) {
        $cont_h[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '" />';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" title="' . $lang->def('_DEL') . '" />';
        $type_h[] = 'image';
    }
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    while (list($idT, $id_forum, $t_author, $posted, $title, $num_post, $num_view, $locked, $erased) = sql_fetch_row($re_thread)) {
        $c_css = '';
        // thread author
        $t_author = isset($authors_names[$t_author]) ? $authors_names[$t_author][ACL_INFO_LASTNAME] . $authors_names[$t_author][ACL_INFO_FIRSTNAME] == '' ? $acl_man->relativeId($authors_names[$t_author][ACL_INFO_USERID]) : $authors_names[$t_author][ACL_INFO_LASTNAME] . ' ' . $authors_names[$t_author][ACL_INFO_FIRSTNAME] : $lang->def('_UNKNOWN_AUTHOR');
        // last post author
        if (isset($last_post[$idT])) {
            $author = $last_post[$idT]['author'];
            $last_mess_write = $last_post[$idT]['info'] . ' ( ' . $lang->def('_BY') . ': <span class="mess_author">' . (isset($authors_names[$author]) ? $authors_names[$author][ACL_INFO_LASTNAME] . $authors_names[$author][ACL_INFO_FIRSTNAME] == '' ? $acl_man->relativeId($authors_names[$author][ACL_INFO_USERID]) : $authors_names[$author][ACL_INFO_LASTNAME] . ' ' . $authors_names[$author][ACL_INFO_FIRSTNAME] : $lang->def('_UNKNOWN_AUTHOR')) . '</span> )';
        } else {
            $last_mess_write = $lang->def('_NONE');
        }
        // status of the thread
        if ($erased) {
            $status = '<img src="' . getPathImage() . 'standard/cancel.png" alt="' . $lang->def('_FREE') . '" />';
        } elseif ($locked) {
            $status = '<img src="' . getPathImage() . 'standard/locked.png" alt="' . $lang->def('_LOCKED') . '" />';
        } elseif (isset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$idT])) {
            $status = '<img src="' . getPathImage() . 'standard/msg_unread.png" alt="' . $lang->def('_UNREAD') . '" />';
            $c_css = ' class="text_bold"';
        } else {
            $status = '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_FREE') . '" />';
        }
        $content = array($status);
        $content[] = $erased && !$mod_perm ? '<div class="forumErased">' . $lang->def('_OPERATION_SUCCESSFUL') . '</div>' : '<a' . $c_css . ' href="index.php?modname=forum&amp;op=searchmessage&amp;idThread=' . $idT . '&amp;ini_thread=' . $ini_page . '">' . ($search_arg !== '' ? eregi_replace($search_arg, '<span class="filter_evidence">' . $search_arg . '</span>', $title) : $title) . '</a>';
        $content[] = $num_post . (isset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$idT]) && $_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$idT] != 'new_thread' ? '<br /><span class="forum_notread">(' . $_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$idT] . ' ' . $lang->def('_ADD') . ')</span>' : '');
        $content[] = $t_author;
        $content[] = $num_view;
        //$content[] = Format::date($posted);
        $content[] = $last_mess_write;
        if ($mod_perm) {
            $content[] = '<a href="index.php?modname=forum&amp;op=modthread&amp;idThread=' . $idT . '&amp;search=1&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_MOD') . ' : ' . strip_tags($title) . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . strip_tags($title) . '" /></a>';
            $content[] = '<a href="index.php?modname=forum&amp;op=delthread&amp;idThread=' . $idT . '&amp;search=1&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . strip_tags($title) . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . strip_tags($title) . '" /></a>';
        }
        $tb->addBody($content);
    }
    $GLOBALS['page']->add($tb->getTable(), 'content');
    $GLOBALS['page']->add($nav_bar->getNavBar($ini) . '</div>', 'content');
}
Exemplo n.º 9
0
function displayCoursePathList(&$url, $selected_tab)
{
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.user_profile.php';
    require_once _base_ . '/lib/lib.navbar.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.preassessment.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.catalogue.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.preassessment.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.coursereport.php';
    $lang =& DoceboLanguage::createInstance('catalogue');
    $lang_c =& DoceboLanguage::createInstance('course');
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0);
    $nav_bar->setLink($url->getUrl());
    $ini = $nav_bar->getSelectedElement();
    $course_man = new Man_Course();
    $path_man = new CoursePath_Manager();
    $cat_man = new Catalogue_Manager();
    $man_courseuser = new Man_CourseUser();
    $profile = new UserProfile(getLogUserId());
    $profile->init('profile', 'framework', '', 'ap');
    $profile->addStyleSheet('lms');
    $catalogues =& $cat_man->getUserAllCatalogueId(getLogUserId());
    if (!empty($catalogues)) {
        // at least one catalogue is assigned to this user
        $cat_path =& $cat_man->getAllCoursepathOfUser(getLogUserId());
        if (!empty($cat_path)) {
            $path_man->filterInPath($cat_path);
        }
    } elseif (Get::sett('on_catalogue_empty') == 'off') {
        $path_man->filterInPath(array(0));
    }
    if (!Docebo::user()->isAnonymous()) {
        if (!isset($_SESSION['cp_assessment_effect'])) {
            $pa_man = new AssessmentList();
            $arr_assessment = $pa_man->getUserAssessmentSubsription(Docebo::user()->getArrSt());
            $report = new CourseReportManager();
            $user_result = $report->getAllUserFinalScore(getLogUserId(), $arr_assessment['course_list']);
            $rule_man = new AssessmentRule();
            $ass_elem = $rule_man->getCompleteEffectListForAssessmentWithUserResult($arr_assessment['course_list'], $user_result);
            $_SESSION['cp_assessment_effect'] = urlencode(serialize($ass_elem));
        } else {
            $ass_elem = unserialize(urldecode($_SESSION['cp_assessment_effect']));
        }
        if (!empty($ass_elem['parsed']['coursepath'])) {
            $path_man->filterOrInPath($ass_elem['parsed']['coursepath']);
        }
    }
    // retrive all the classroorm
    // search for the coursepath ------------------------------------------------------
    $coursepath = $path_man->getCoursepathList($ini, Get::sett('visuItem'));
    if (empty($coursepath)) {
        // no path found for the criteria ---------------------------------------------
        $GLOBALS['page']->add('<p class="no_course_found">' . $lang->def('_NO_COURSE_FOUND') . '</p></div>', 'content');
        return;
    }
    // find structures of the course path ---------------------------------------------
    $courses = $path_man->getPathStructure(array_keys($coursepath));
    $path_slot = $path_man->getPathSlot(array_keys($coursepath));
    // fin user subscription needed ---------------------------------------------------
    $user_paths =& $path_man->getUserSubscriptionsInfo(getLogUserId(), false);
    $usercourses =& $man_courseuser->getUserSubscriptionsInfo(getLogUserId(), false);
    // find course basilar information ------------------------------------------------
    $course_info = $course_man->getAllCourses(false, false, $courses['all_items'], true);
    $GLOBALS['page']->add($nav_bar->getNavBar($ini), 'content');
    while (list($id_path, $path) = each($coursepath)) {
        $html = '<div class="coursepath_container">';
        $in_h = ' <span class="coursepath_subscribe">';
        $can_subs = true;
        if (isset($ass_elem['parsed']['coursepath'])) {
            if (isset($ass_elem['not_done']['coursepath']) && in_array($id_path, $ass_elem['not_done']['coursepath'])) {
                // the assosiacted preassessment is not done
                $in_h .= '';
                //$lang->def('_MUST_DO_PREASSESSMENT');
                $can_subs = false;
            } elseif (isset($ass_elem['to_apply']['coursepath']) && in_array($id_path, $ass_elem['to_apply']['coursepath'])) {
                // the assosiacted preassessment suggest this coursepath
                $in_h .= $lang->def('_PREASSESSMENT_SUGGESTION');
            }
        } else {
            switch ($path[COURSEPATH_METHOD]) {
                case METHOD_WAIT:
                    $in_h .= $lang->def('_METHOD_WAIT');
                    break;
                case METHOD_AUTO:
                    $in_h .= $lang->def('_METHOD_AUTO');
                    break;
                case METHOD_MANUAL:
                default:
                    $in_h .= $lang->def('_METHOD_MANUAL');
                    $can_subs = false;
                    break;
            }
        }
        $in_h .= '</span>';
        $in_h .= ' <span class="coursepath_status">';
        if (isset($usercourses[$id_path])) {
            // user is alredy subscribed to this coursepath
            if ($usercourses[$id_path]['waiting']) {
                $in_h .= $lang->def('_COURSEPATH_WAITING');
            } else {
                $in_h .= $lang->def('_USER_STATUS_SUBS');
            }
        }
        $in_h .= '</span>';
        // -------------------------------------------------------------
        $html .= '<div class="coursepath_info_container">';
        $html .= '<h2 class="pathtitle">' . $in_h . ($path[COURSEPATH_CODE] != '' ? '[' . $path[COURSEPATH_CODE] . '] ' : '') . $path[COURSEPATH_NAME] . '</h2>' . '<p class="course_support_info">' . str_replace('[enrolled]', $path[CP_ENROLLED], $lang->def('_COURSEPATH_INTRO')) . '</p>';
        if (!isset($courses[$id_path]) || empty($courses[$id_path])) {
            $html .= $lang->def('_NO_COURSE_ASSIGNED_TO_COURSEPATH') . '<br />';
        } else {
            // display the slots
            foreach ($path_slot[$id_path] as $id_slot => $slot_info) {
                if ($id_slot == 0) {
                    $html .= '<h4>' . $lang->def('_MANDATORY') . '</h4>';
                    if (!empty($courses[$id_path][$id_slot])) {
                        $html .= '<ul class="coursepath_mainslot">';
                    }
                } else {
                    if ($slot_info['min_selection'] > 0 && $slot_info['max_selection'] > 0) {
                        $title = str_replace(array('[min_selection]', '[max_selection]'), array($slot_info['min_selection'], $slot_info['max_selection']), $lang->def('_COURSE_PATH_SLOT_MIN_MAX'));
                    } elseif ($slot_info['max_selection'] > 0) {
                        $title = str_replace('[max_selection]', $slot_info['max_selection'], $lang->def('_COURSE_PATH_SLOT_MAX'));
                    } else {
                        $title = $lang->def('_COURSE_PATH_SLOT');
                    }
                    $html .= '<h4>' . $title . '</h4>';
                    if (!empty($courses[$id_path][$id_slot])) {
                        $html .= '<ul class="coursepath_otherslot">';
                    }
                }
                $i = 0;
                while (list($id) = each($courses[$id_path][$id_slot])) {
                    $html .= '<li class="path_course ' . ($i % 2 ? 'path_odd' : '') . '">' . '<a class="show_details_more" href="javascript:;" onclick="course_dash(this, \'' . $id . '\',\'info_' . $id_path . '_' . $id . '\', \'' . $can_subs . '\');">' . $lang->def('_DETAILS') . '</a>' . ($course_info[$id]['code'] != '' ? ' [' . $course_info[$id]['code'] . '] ' : '') . $course_info[$id]['name'] . '<div id="info_' . $id_path . '_' . $id . '"></div>' . '</li>';
                    $i++;
                }
                if (!empty($courses[$id_path][$id_slot])) {
                    $html .= '</ul>';
                }
            }
        }
        $html .= '</div>';
        $html .= '</div>';
        $GLOBALS['page']->add($html, 'content');
    }
    $GLOBALS['page']->add($nav_bar->getNavBar($ini), 'content');
}