Ejemplo 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');
}
Ejemplo n.º 2
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');
}
Ejemplo n.º 3
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;
 }
 public function classroomCourse()
 {
     require_once _base_ . '/lib/lib.navbar.php';
     require_once _lms_ . '/lib/lib.middlearea.php';
     $active_tab = 'classroom';
     $action = Get::req('action', DOTY_STRING, '');
     $page = Get::req('page', DOTY_INT, 1);
     $id_cat = Get::req('id_cat', DOTY_INT, 0);
     $nav_bar = new NavBar('page', Get::sett('visuItem'), $this->model->getTotalCourseNumber($active_tab), 'link');
     $nav_bar->setLink('index.php?r=homecatalogue/allCourse' . ($id_cat > 1 ? '&amp;id_cat=' . $id_cat : ''));
     $html = $this->model->getCourseList($active_tab, $page);
     $user_catalogue = array();
     //$this->model->getUserCatalogue(Docebo::user()->getIdSt());
     $user_coursepath = array();
     //$this->model->getUserCoursepath(Docebo::user()->getIdSt());
     echo '<div style="margin:1em;">';
     $this->render('tab_start', array('user_catalogue' => $user_catalogue, 'active_tab' => $active_tab, 'user_coursepath' => $user_coursepath, 'std_link' => 'index.php?r=homecatalogue/allCourse' . ($page > 1 ? '&amp;page=' . $page : ''), 'model' => $this->model_catalog));
     $this->render('courselist', array('html' => $html, 'nav_bar' => $nav_bar));
     $this->render('tab_end', array('std_link' => 'index.php?r=homecatalogue/allCourse' . ($page > 1 ? '&amp;page=' . $page : ''), 'model' => $this->model_catalog));
     echo '</div>';
 }
Ejemplo n.º 5
0
function adviceList()
{
    require_once _base_ . '/lib/lib.navbar.php';
    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);
    $nav_bar->setLink('index.php?modname=advice&amp;op=advice&amp;tab=advice');
    $ini = $nav_bar->getSelectedElement();
    $user_idst = Docebo::user()->getArrSt();
    // $acl->getUserGroupsST(getLogUserId());
    $query_my_advice = "\r\n\t\tSELECT DISTINCT idAdvice\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_adviceuser\r\n\t\tWHERE ( idUser IN ( " . implode($user_idst, ',') . " ) AND archivied = '0' )";
    $re_my_advice = sql_query($query_my_advice);
    $advice_all = array();
    while (list($id) = sql_fetch_row($re_my_advice)) {
        $advice_all[$id] = $id;
    }
    $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 (isset($advice_arch) && is_array($advice_arch)) {
        $advice_all = array_diff($advice_all, $advice_arch);
    }
    if (!empty($advice_all)) {
        $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_all, ',') . " )\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_all, ',') . " )"));
        $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;
            }
        }
        if (sql_num_rows($re_advice) >= 1 && $mod_perm) {
            $out->add('<div class="table-container-over">' . '<a class="ico-wt-sprite subs_add" href="index.php?modname=advice&amp;op=addadvice" title="' . $lang->def('_ADD_ADVICE') . '">' . '<span>' . $lang->def('_ADD_ADVICE') . '</span></a>' . '</div>');
        }
        while (list($idA, $posted, $title, $description, $impo, $author) = sql_fetch_row($re_advice)) {
            $out->add('<div class="list_block' . ($impo ? ' highlight' : '') . '">' . '<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">' . '<ul class="link_list_inline">' . '<li><a href="index.php?modname=advice&amp;op=archiveadvice&amp;idAdvice=' . $idA . '" title="' . $lang->def('_ARCHIVE_THIS_ADVICE') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_ALT_ARCHIVE') . '" /> ' . $lang->def('_ALT_ARCHIVE') . '</a></li>');
            if ($mod_perm) {
                $out->add('<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>');
            }
            $out->add('</ul>' . '</div>' . '</div>');
        }
    }
    if ($mod_perm) {
        cout('<br/><div class="table-container-below">
			<a class="ico-wt-sprite subs_add" href="index.php?modname=advice&amp;op=addadvice" title="' . $lang->def('_ADD_ADVICE') . '">
			<span>' . $lang->def('_ADD_ADVICE') . '</span></a>
		</div>', 'content');
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=deladvice]');
    }
    $form = new Form();
    $out->add($nav_bar->getNavBar($ini));
}
Ejemplo n.º 6
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');
}
Ejemplo n.º 7
0
function coursecatalogue($id_block, $title, $option = array())
{
    YuiLib::load(array('animation' => 'my_animation', 'container' => 'container-min', 'container' => 'container_core-min'));
    cout(Util::get_js(Get::rel_path('cms') . '/modules/catalog/catalog.js', true), 'page_head');
    if (!isset($_SESSION['chart'])) {
        $_SESSION['chart'] = array();
    }
    $id_course = Get::req('id_course', DOTY_INT, 0);
    $action = Get::req('action', DOTY_STRING, '');
    if ($id_course !== 0 && $action === '') {
        $_SESSION['chart'][$id_course]['idCourse'] = $id_course;
    } else {
        require_once _lms_ . '/lib/lib.subscribe.php';
        $man_subscribe = new CourseSubscribe_Management();
        $man_subscribe->subscribeToCourse(getLogUserId(), $id_course);
    }
    require_once _cms_ . '/lib/lib.catalog.php';
    require_once _base_ . '/lib/lib.navbar.php';
    cout('<link href="./modules/catalog/catalog.css" type="text/css" rel="stylesheet"/>', 'page_head');
    $css_path = Get::tmpl_path('base') . 'yui-skin';
    cout(Util::get_css($css_path . '/tabview.css', true), 'page_head');
    $lang =& DoceboLanguage::CreateInstance('catalogue', 'cms');
    $man_cat = new Man_Catalog();
    $array_id_block = explode('_', $id_block);
    $page = Get::req('page', DOTY_INT, 0);
    if ($page == 0) {
        $page = $this->getBlockPage($array_id_block[0]);
    }
    cout(getTitleArea($title) . '<div class="std_block">');
    $catalogue = $man_cat->getCatalogueForBlock($array_id_block[0]);
    $all_course = false;
    if (array_search(0, $catalogue) !== false) {
        unset($catalogue[array_search(0, $catalogue)]);
        $all_course = true;
    }
    $id_catalogue = Get::req('id_catalogue', DOTY_INT, -2);
    if ($id_catalogue == -2) {
        if (count($catalogue)) {
            if (isset($catalogue[0])) {
                $id_catalogue = $catalogue[0]['id_catalogue'];
            } else {
                $id_catalogue = $catalogue[1]['id_catalogue'];
            }
        } else {
            $id_catalogue = 0;
        }
    }
    $id_category = Get::req('id_cat', DOTY_INT, 0);
    $number_courses = $man_cat->getCourseNumberForBlock($array_id_block[0], $id_catalogue, $id_category, $all_course);
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), $number_courses);
    $nav_bar->setLink('index.php?pag=' . $page . '&amp;id_catalogue=' . $id_catalogue . ($id_category != 0 ? '&amp;id_cat=' . $id_category : ''));
    $ini = $nav_bar->getSelectedPage();
    $limit = ($ini - 1) * Get::sett('visuItem');
    cout($nav_bar->getNavBar() . '<div id="demo" class="yui-navset">' . '<ul class="yui-nav">');
    foreach ($catalogue as $catalogue_info) {
        cout('<li ' . ($catalogue_info['id_catalogue'] == $id_catalogue ? ' class="selected"' : '') . '><a href="index.php?pag=' . $page . '&amp;id_catalogue=' . $catalogue_info['id_catalogue'] . '"><em>' . $catalogue_info['name'] . '</em></a></li>');
    }
    cout('<li ' . ($id_catalogue == 0 ? ' class="selected"' : '') . '><a href="index.php?pag=' . $page . '&amp;id_catalogue=0"><em>' . $lang->def('_ALL_COURSES') . '</em></a></li>' . '<li ' . ($id_catalogue == -1 ? ' class="selected"' : '') . '><a href="index.php?pag=' . $page . '&amp;id_catalogue=-1"><em>' . $lang->def('_CATEGORY') . '</em></a></li>');
    reset($catalogue);
    cout('</ul>');
    cout('<div class="yui-content">');
    if ($number_courses == 0 && $id_catalogue != -1) {
        cout('<p>' . $lang->def('_NO_COURSE_FOR_CATALOG') . '</p>');
    } elseif ($id_catalogue == -1) {
        //Category Visualization
        if ($id_category == 0) {
            $query = "SELECT ca.idCategory, ca.path, ca.lev, ca.iLeft, ca.iRight, COUNT(co.idCourse)" . " FROM " . $GLOBALS['prefix_lms'] . "_category AS ca" . " LEFT JOIN " . $GLOBALS['prefix_lms'] . "_course AS co ON co.idCategory = ca.idCategory" . " WHERE ca.lev = 1" . " GROUP BY ca.idCategory" . " ORDER BY ca.lev, ca.path";
        } else {
            $query = "SELECT iLeft, iRight" . " FROM " . $GLOBALS['prefix_lms'] . "_category" . " WHERE idCategory = " . $id_category;
            list($ileft, $iright) = sql_fetch_row(sql_query($query));
            $query = "SELECT ca.idCategory, ca.path, ca.lev, ca.iLeft, ca.iRight, COUNT(co.idCourse)" . " FROM " . $GLOBALS['prefix_lms'] . "_category AS ca" . " LEFT JOIN " . $GLOBALS['prefix_lms'] . "_course AS co ON co.idCategory = ca.idCategory" . " WHERE ca.iLeft >= " . $ileft . " AND ca.iRight <= " . $iright . " GROUP BY ca.idCategory" . " ORDER BY ca.lev, ca.path";
        }
        $result = sql_query($query);
        $first = true;
        $num_folder = sql_num_rows($result);
        cout('<div class="cat_nav">');
        while (list($id_cat, $path, $lev, $ileft, $iright, $courses) = sql_fetch_row($result)) {
            $cat_name = end(explode('/', $path));
            if ($id_category == $id_cat) {
                cout('<div class="cat_position">' . '<a href="index.php?pag=' . $page . '&id_catalogue=-1">' . $lang->def('_CATEGORY') . '</a>');
                if ($lev > 1) {
                    $query_parent = "SELECT idCategory, path" . " FROM " . $GLOBALS['prefix_lms'] . "_category" . " WHERE iLeft < " . $ileft . " AND iRight > " . $iright . " ORDER BY lev ASC";
                    $result_parent = sql_query($query_parent);
                    while (list($id_cat_pa, $path_pa) = sql_fetch_row($result_parent)) {
                        $pa_name = end(explode('/', $path_pa));
                        cout(' - <a href="index.php?pag=' . $page . '&id_catalogue=-1&amp;id_cat=' . $id_cat_pa . '">' . $pa_name . '</a>');
                    }
                }
                cout(' - ' . $cat_name . '</div>');
            }
            if ($first && $num_folder > 0) {
                $first = false;
                cout('<ul class="cat_nav_list">');
            }
            if ($id_category != $id_cat) {
                $sub_folder = ($iright - $ileft - 1) / 2;
                cout('<li>' . '<a href="index.php?pag=' . $page . '&id_catalogue=-1&amp;id_cat=' . $id_cat . '">' . $cat_name . '<br />' . ($sub_folder > 0 ? '<span class="cat_item_info">' . $lang->def("_CATEGORIES") . ' (' . $sub_folder . ')<br />' : '') . ($courses > 0 ? '<span class="cat_item_info">' . $lang->def("_COURSES") . ' (' . $courses . ')' : '') . '</a>' . '</li>');
            }
        }
        if ($num_folder > 0) {
            cout('</ul>');
        }
        cout('</div>');
        //Course visualization
        cout('<div class="course_list">');
        if ($number_courses == 0) {
            cout('<p>' . $lang->def('_NO_COURSE_FOR_CATEGORY') . '</p>');
        } else {
            $courses = $man_cat->getCourseForBlock($array_id_block[0], $limit, $id_catalogue, $id_category, $all_course);
            foreach ($courses as $course_info) {
                $action = $this->controlCourse($course_info, $page, $id_catalogue, $id_category, $ini);
                cout('<div class="course">' . '<div class="course_info">' . '<h3 class="course_title"><img src="' . getPathImage() . '/language/' . strtolower($course_info['lang_code']) . '.png" alt="" title="" /> ' . $course_info['name'] . '</h3>' . '<p class="course_description">' . $course_info['description'] . '</p>' . '</div>' . '<div class="course_action">' . $action . '</div>' . '</div>');
            }
        }
        cout('</div>');
    } else {
        //Course in catalogue visualization
        $courses = $man_cat->getCourseForBlock($array_id_block[0], $limit, $id_catalogue, $id_category, $all_course);
        foreach ($courses as $course_info) {
            $action = $this->controlCourse($course_info, $page, $id_catalogue, $id_category, $ini);
            cout('<div class="course">' . '<div class="course_info">' . '<h3 class="course_title"><img src="' . getPathImage() . '/language/' . strtolower($course_info['lang_code']) . '.png" alt="" title="" /> ' . $course_info['name'] . '</h3>' . '<p class="course_description">' . $course_info['description'] . '</p>' . '</div>' . '<div class="course_action">' . $action . '</div>' . '</div>');
        }
    }
    cout('</div>' . '</div>' . $nav_bar->getNavBar() . '</div>');
}
Ejemplo n.º 8
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');
}
Ejemplo n.º 9
0
 public function coursepathCourse()
 {
     require_once _base_ . '/lib/lib.navbar.php';
     $active_tab = 'coursepath';
     $nav_bar = new NavBar('page', Get::sett('visuItem'), count($this->model->getUserCoursepath(Docebo::user()->getIdSt())), 'link');
     $nav_bar->setLink('index.php?r=catalog/coursepathCourse');
     $page = Get::req('page', DOTY_INT, 1);
     $html = $this->model->getCoursepathList(Docebo::user()->getIdSt(), $page);
     $user_catalogue = $this->model->getUserCatalogue(Docebo::user()->getIdSt());
     $user_coursepath = $this->model->getUserCoursepath(Docebo::user()->getIdSt());
     echo '<div class="layout_colum_container">';
     $lmstab = $this->widget('lms_tab', array('active' => 'catalog', 'close' => false));
     $this->render('tab_start', array('user_catalogue' => $user_catalogue, 'active_tab' => $active_tab, 'user_coursepath' => $user_coursepath));
     $this->render('courselist', array('html' => $html, 'nav_bar' => $nav_bar));
     $this->render('tab_end', array());
     $lmstab->endWidget();
     echo '</div>';
 }