Example #1
0
 function loadHeader()
 {
     //EFFECTS: write in standard output extra header information
     $GLOBALS['page']->setWorkingZone('page_head');
     $GLOBALS['page']->add('<link href="' . getPathTemplate() . 'style/base-old-treeview.css" rel="stylesheet" type="text/css" />');
     return;
 }
Example #2
0
 function loadHeader()
 {
     //EFFECTS: write in standard output extra header information
     global $op;
     switch ($op) {
         case "additem":
         case "insitem":
         case "moditem":
         case "upitem":
             loadHeaderHTMLEditor();
             break;
         case "category":
             echo '<link href="' . getPathTemplate() . 'style/base-old-treeview.css" rel="stylesheet" type="text/css" />' . "\n";
             break;
     }
     return;
 }
Example #3
0
 function loadBody()
 {
     $GLOBALS['page']->setWorkingZone('page_head');
     switch ($GLOBALS['op']) {
         case "statuser":
             $GLOBALS['page']->add('<link href="' . getPathTemplate() . 'style/base-old-treeview.css" rel="stylesheet" type="text/css" />' . "\n");
             //$GLOBALS['page']->add( '<link href="'.getPathTemplate().'style/style_scormplayer.css" rel="stylesheet" type="text/css" />'."\n" );
             break;
         case "statitem":
         case "statcourse":
         case "statoneuser":
         case "statoneuseroneitem":
             $GLOBALS['page']->add('<link href="' . getPathTemplate() . 'style/base-old-treeview.css" rel="stylesheet" type="text/css" />' . "\n");
             $GLOBALS['page']->add('<link href="' . getPathTemplate() . 'style/report/style_report_general.css" rel="stylesheet" type="text/css" />' . "\n");
             //$GLOBALS['page']->add( '<link href="'.getPathTemplate().'style/style_organizations.css" rel="stylesheet" type="text/css" />'."\n" );
             //$GLOBALS['page']->add( '<link href="'.getPathTemplate().'style/style_scormplayer.css" rel="stylesheet" type="text/css" />'."\n" );
     }
     require _lms_ . '/modules/stats/stats.php';
 }
function viewReport()
{
    checkPerm('view');
    $idrep = Get::req('idrep', DOTY_INT, 0);
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    load_filter($idrep, true);
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.download.php';
    $lang =& DoceboLanguage::createInstance('report', 'framework');
    //$obj_report = openreport($idrep);
    if ($idrep != false && $idrep > 0) {
        $id_report = $idrep;
    } else {
        $id_report = $_SESSION['report_tempdata']['id_report'];
        if ($id_report != false && $idrep > 0) {
            load_filter($idrep, true, false);
        }
    }
    $query_report = "\r\n\tSELECT r.class_name, r.file_name, r.report_name, f.filter_name, f.filter_data, f.author\r\n\tFROM %lms_report AS r\r\n\t\tJOIN %lms_report_filter AS f\r\n\t\tON ( r.id_report = f.id_report )\r\n\tWHERE f.id_filter = '" . $idrep . "'";
    $re_report = sql_query($query_report);
    list($class_name, $file_name, $report_name, $filter_name, $report_data) = sql_fetch_row($re_report);
    if (sql_num_rows($re_report) == 0) {
        reportlist();
        return;
    }
    $report_data = unserialize($report_data);
    require_once _lms_ . '/admin/modules/report/' . $file_name;
    $obj_report = new $class_name($id_report);
    $obj_report->back_url = 'index.php?modname=public_report_admin&op=reportlist';
    $obj_report->jump_url = 'index.php?modname=public_report_admin&op=view_report&idrep=' . $idrep;
    $start_url = 'index.php?modname=public_report_admin&op=reportlist';
    $temp = Get::req('dl', DOTY_STRING, false);
    if ($temp) {
        list($filter_name) = mysql_fetch_row(mysql_query("SELECT filter_name FROM " . $GLOBALS['prefix_lms'] . "_report_filter WHERE id_filter = '" . $idrep . "'"));
        $filename = 'report_' . $filter_name . '_' . date("d_m_Y");
        switch ($temp) {
            case 'htm':
                sendStrAsFile($obj_report->getHTML(false, NULL), $filename . '.html');
                break;
            case 'csv':
                sendStrAsFile($obj_report->getCSV(false, NULL), $filename . '.csv');
                break;
            case 'xls':
                sendStrAsFile($obj_report->getXLS(false, NULL), $filename . '.xls');
                break;
        }
    }
    $report_info = $lang->def('_SHOW_REPORT_INFO', 'report', 'framework') . getReportNameById($idrep);
    $GLOBALS['page']->add(getTitleArea($lang->def('REPORT_SHOW_RESULTS', 'report', 'framework'), 'report', $lang->def('_REPORT_PRINTTABLE', 'report', 'framework')) . '<div class="std_block">', 'content');
    if (Get::req('no_show_repdownload', DOTY_INT, 0) <= 0) {
        $GLOBALS['page']->add(getBackUi($obj_report->back_url, $lang->def('_BACK', 'report', 'framework'), 'content') . getInfoUi($report_info), 'content');
        $export_url = 'index.php?modname=public_report_admin&amp;op=view_report&amp;idrep=' . $idrep;
        $GLOBALS['page']->add('<p class="export_list">' . '<a class="export_htm" href="' . $export_url . '&amp;dl=htm">' . $lang->def('_EXPORT_HTML', 'report', 'framework') . '</a>&nbsp;' . '<a class="export_csv" href="' . $export_url . '&amp;dl=csv">' . $lang->def('_EXPORT_CSV', 'report', 'framework') . '</a>&nbsp;' . '<a class="export_xls" href="' . $export_url . '&amp;dl=xls">' . $lang->def('_EXPORT_XLS', 'report', 'framework') . '</a>' . '</p><br />', 'content');
    }
    $GLOBALS['page']->add(Form::openForm('report_form', $obj_report->jump_url), 'content');
    // css -----------------------------------------------------------
    $GLOBALS['page']->add("\n" . '<link href="' . getPathTemplate('lms') . 'style/report/style_report_user.css" rel="stylesheet" type="text/css" />' . "\n", 'page_head');
    $obj_report->show_results($report_data['columns_filter_category'], $report_data);
    $out->add(Form::closeForm(), 'content');
    $out->add('</div>', 'content');
}
Example #5
0
	
	<!-- <link href="<?php 
echo getPathTemplate();
?>
style/style.css" rel="stylesheet" type="text/css" /> -->
	<link href="<?php 
echo getPathTemplate();
?>
style/lms-scormplayer.css" rel="stylesheet" type="text/css" />
	<?php 
if (!isset($playertemplate) || trim($playertemplate) == '') {
    $playertemplate = 'default';
}
?>
	<link href="<?php 
echo getPathTemplate() . 'player_scorm/' . $playertemplate;
?>
/def_style.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript">
		function msgPrereqNotSatisfied( text ) {
			var elem = document.getElementById('prerequisites');
			elem.appendChild(document.createTextNode(text))
			elem.style.visibility = 'visible';
		}
		// inform the player 
		window.onload = function() {
			parent.scormPlayer.blankPageLoaded();
		}
	</script>
	</head>
	<body>
Example #6
0
|   License  http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt           |
|                                                                           |
|   from docebo 4.0.5 CE 2008-2012 (c) docebo                               |
|   License http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt            |
\ ======================================================================== */
require_once _base_ . '/lib/lib.treedb.php';
require_once _base_ . '/lib/lib.treeview.php';
/**
 * @package  DoceboLms
 * @version  $Id: tree.category.php 573 2006-08-23 09:38:54Z fabio $
 * @category Course category
 * @author   Fabio Pirovano <*****@*****.**>
 */
if (!isset($GLOBALS['css_treeview_load']) && isset($GLOBALS['page'])) {
    //if(!isset($GLOBALS['css_treeview_load'])) {
    $GLOBALS['page']->add('<link href="' . getPathTemplate() . 'style/base-old-treeview.css" rel="stylesheet" type="text/css" />', 'page_head');
    $GLOBALS['css_treeview_load'] = true;
}
class TreeDb_CatDb extends TreeDb
{
    // Constructor of TreeDb_CatDb class
    function TreeDb_CatDb($table_name)
    {
        $this->table = $table_name;
        $this->fields = array('id' => 'idCategory', 'idParent' => 'idParent', 'path' => 'path', 'lev' => 'lev');
    }
    function _getOtherFields($tname = FALSE)
    {
    }
    function _getOtherValues()
    {
Example #7
0
function userCourseList(&$url, $use_tab = true, $page_add = true)
{
    YuiLib::load(array('animation' => 'animation-min.js', 'dragdrop' => 'dragdrop-min.js', 'button' => 'button-min.js', 'container' => 'container-min.js', 'my_window' => 'windows.js'), array('container/assets/skins/sam' => 'container.css', 'button/assets/skins/sam' => 'button.css'));
    if ($page_add) {
        addJs($GLOBALS['where_lms_relative'] . '/modules/coursecatalogue/', 'ajax.coursecatalogue.js');
    }
    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.course.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.coursereport.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php';
    require_once $GLOBALS["where_framework"] . "/lib/lib.ajax_comment.php";
    require_once $GLOBALS['where_lms'] . '/lib/lib.classroom.php';
    // pre-loading coursepath ------------------------------------------------------------------
    $path_man = new CoursePath_Manager();
    // search for the coursepath ----------------------------------------------------------
    $user_coursepath = $path_man->getUserSubscriptionsInfo(getLogUserId(), true);
    $coursepath = $path_man->getCoursepathAllInfo(array_keys($user_coursepath));
    if (!empty($coursepath)) {
        // find structures of the course path ---------------------------------------------
        $path_courses = $path_man->getPathStructure(array_keys($coursepath));
        $cp_info = $path_man->getAllCoursesInfo($path_courses['all_paths']);
        /*echo "<pre>\n\n";
        		print_r($cp_info);
        		echo "\n\n</pre>";*/
    }
    // ------------------------------------------------------------------------
    $course_stats = array('total' => 0, 'u_can_enter' => 0, 'with_status' => array(CST_AVAILABLE => 0, CST_EFFECTIVE => 0, CST_CONCLUDED => 0, CST_CANCELLED => 0), 'with_ustatus' => array(_CUS_SUBSCRIBED => 0, _CUS_BEGIN => 0, _CUS_END => 0, _CUS_SUSPEND => 0), 'with_wstatus' => array(_CUS_RESERVED => 0, _CUS_WAITING_LIST => 0), 'with_ulevel' => array(), 'expiring' => 0, 'cert_relesable' => 0);
    // ------------------------------------------------------------------------
    $filter = importVar('filter', false, 'total');
    if ($filter == 'level') {
        $filter_level = importVar('filter_on', true, 0);
    }
    $current_tab = importVar('current_tab', false, 'lo_plan');
    if ($use_tab && $page_add) {
        addCss('style_tab');
        $lo_plan = importVar('lo_plan', false, 0);
        $lo_history = importVar('lo_history', false, 0);
        if ($lo_plan != 0) {
            $current_tab = 'lo_plan';
        }
        if ($lo_history != 0) {
            $current_tab = 'lo_history';
        }
    }
    if ($use_tab && $page_add) {
        addCss('style_tab');
        $lo_plan = importVar('lo_plan', false, 0);
        $lo_history = importVar('lo_history', false, 0);
        if ($lo_plan != 0) {
            $current_tab = 'lo_plan';
        }
        if ($lo_history != 0) {
            $current_tab = 'lo_history';
        }
    }
    require_once $GLOBALS['where_lms'] . '/lib/lib.certificate.php';
    $cert = new Certificate();
    $released = $cert->certificateReleased(getLogUserId());
    $available_cert = $cert->certificateForCourses(false, false);
    // cahce classroom -----------------------------------------------------------------
    $classroom_man = new ClassroomManager();
    $classrooms = $classroom_man->getClassroomNameList();
    $lang =& DoceboLanguage::createInstance('catalogue');
    $lang_c =& DoceboLanguage::createInstance('course');
    $man_course = new Man_Course();
    $subcourse_list = sql_query("" . " SELECT u.idCourse, u.edition_id, level, u.date_inscr, u.date_first_access, " . "\t\tu.date_complete, u.status AS user_status, u.waiting, u.edition_id " . " FROM " . $GLOBALS['prefix_lms'] . "_courseuser AS u" . " WHERE idUser = '******'");
    $subscription = array();
    while ($cinfo = mysql_fetch_assoc($subcourse_list)) {
        $subscription['course'][$cinfo['idCourse']] = $cinfo;
        if ($cinfo['edition_id'] != 0) {
            $subscription['edition'][$cinfo['idCourse']][$cinfo['edition_id']] = $cinfo;
        }
    }
    // searching courses ---------------------------------------------------------------
    $select_course = "" . " SELECT c.idCourse, c.course_type, c.idCategory, c.code, c.name, c.description, c.lang_code, c.difficult, " . "\tc.subscribe_method, c.date_begin, c.date_end, c.max_num_subscribe, " . "\tc.selling, c.prize, c.create_date, c.status AS course_status, c.course_edition, " . "\tc.classrooms, c.img_othermaterial, c.course_demo, c.course_vote, " . "\tc.can_subscribe, c.sub_start_date, c.sub_end_date, c.valid_time, c.userStatusOp, c.show_result, u.status AS user_status, u.level " . ", c.use_logo_in_courselist, c.img_course, c.direct_play ";
    $from_course = " FROM " . $GLOBALS['prefix_lms'] . "_course AS c " . "\t JOIN " . $GLOBALS['prefix_lms'] . "_courseuser AS u ";
    $where_course = " c.idCourse = u.idCourse " . " AND u.idUser = '******' " . " AND ( c.status <> '" . CST_PREPARATION . "' OR u.level > 3 )" . " AND c.course_type <> 'assessment' ";
    $selected_year = 0;
    $selected_search = '';
    if (isset($_POST['apply_filter'])) {
        if ($_POST['year']) {
            $where_course .= " AND c.create_date BETWEEN '" . $_POST['year'] . "-01-01 00:00:00' AND '" . $_POST['year'] . "-12-31 23:59:59'";
            $selected_year = $_POST['year'];
        }
        if ($_POST['search'] !== '') {
            $where_course .= " AND c.name LIKE '%" . $_POST['search'] . "%'";
            $selected_search = $_POST['search'];
        }
    }
    $group_by_course = " GROUP BY c.idCourse ";
    $order_course = " ORDER BY ";
    $tablist = Get::sett('tablist_mycourses', '');
    if ($tablist != '') {
        $arr_order_course = explode(',', $tablist);
        $arr_temp = array();
        foreach ($arr_order_course as $key => $value) {
            switch ($value) {
                case 'status':
                    $arr_temp[] = ' u.status ';
                    break;
                case 'code':
                    $arr_temp[] = ' c.code ';
                    break;
                case 'name':
                    $arr_temp[] = ' c.name ';
                    break;
            }
        }
        $order_course = $order_course . implode(', ', $arr_temp);
    }
    if ($order_course == " ORDER BY ") {
        //default without parameter
        $order_course .= " u.status, c.name ";
    }
    // apply search filter --------------------------------------------------------------
    $all_lang = Docebo::langManager()->getAllLangCode();
    $re_course = sql_query($select_course . $from_course . " WHERE " . $where_course . $group_by_course . $order_course);
    // retrive editions ----------------------------------------------------------------
    $select_edition = " SELECT e.* ";
    $from_edition = " FROM " . $GLOBALS["prefix_lms"] . "_course_editions AS e " . " JOIN " . $GLOBALS["prefix_lms"] . "_courseuser AS u ";
    $where_edition = " WHERE e.status <> '" . CST_PREPARATION . "' AND e.id_edition = u.edition_id ";
    $re_edition = sql_query($select_edition . $from_edition . $where_edition);
    // --------------------------------------------------------------------------------
    $editions = array();
    if ($re_edition) {
        while ($edition_elem = mysql_fetch_assoc($re_edition)) {
            $edition_elem['classrooms'] = isset($classrooms[$edition_elem['classrooms']]) ? $classrooms[$edition_elem['classrooms']] : '';
            $editions[$edition_elem["id_course"]][$edition_elem["id_course"]] = $edition_elem;
        }
    }
    $man_courseuser = new Man_CourseUser();
    $ax_comm = new AjaxComment('course', 'lms');
    $comment_count = $ax_comm->getResourceCommentCount();
    $user_score = $man_courseuser->getUserCourseScored(getLogUserId());
    // -----------------------------------------------------------------------------
    $needed_info_for = array();
    if (!empty($subscription['course'])) {
        $id_course_list = array_keys($subscription['course']);
        // find last access to the courses ---------------------------------------------------------------------
        require_once $GLOBALS['where_lms'] . '/lib/lib.track_user.php';
        $last_access_courses = TrackUser::getLastAccessToCourse(getLogUserId());
        // retrive unreaded advice -----------------------------------------------------------------------------
        require_once $GLOBALS['where_lms'] . '/lib/lib.advice.php';
        $advices = Man_Advice::getCountUnreaded(getLogUserId(), $id_course_list, $last_access_courses);
        // retrive unreaded forum messages ---------------------------------------------------------------------
        require_once $GLOBALS['where_lms'] . '/lib/lib.forum.php';
        $forums = Man_Forum::getCountUnreaded(getLogUserId(), $id_course_list, $last_access_courses);
        // retrive new lesson ----------------------------------------------------------------------------------
        require_once $GLOBALS['where_lms'] . '/lib/lib.orgchart.php';
        $org_chart = OrganizationManagement::getCountUnreaded(getLogUserId(), $id_course_list, $last_access_courses);
        if (!empty($path_courses['all_items'])) {
            $needed_info_for = array_diff($path_courses['all_items'], $id_course_list);
        }
        $first_is_scorm = OrganizationManagement::objectFilter($id_course_list, 'scormorg');
        $enroll_list = sql_query("" . " SELECT u.idCourse, u.edition_id, COUNT(*) as number " . " FROM " . $GLOBALS['prefix_lms'] . "_courseuser AS u" . " WHERE u.idCourse IN (" . implode($id_course_list, ',') . ") " . " AND u.level = '3'" . " AND u.status IN ('" . _CUS_CONFIRMED . "', '" . _CUS_SUBSCRIBED . "', '" . _CUS_BEGIN . "', '" . _CUS_END . "', '" . _CUS_SUSPEND . "', '" . _CUS_WAITING_LIST . "')" . " AND u.absent = '0'" . " GROUP BY u.idCourse, u.edition_id ");
        $enrolled = array();
        while ($cinfo = mysql_fetch_assoc($enroll_list)) {
            $enrolled[$cinfo['idCourse']][$cinfo['edition_id']] = $cinfo['number'];
        }
    }
    // search pre-assessment -----------------------------------------------------------
    $select_assess = "" . " SELECT c.idCourse, c.course_type, c.idCategory, c.code, c.name, c.description, c.lang_code, c.difficult, " . "\tc.subscribe_method, c.date_begin, c.date_end, c.max_num_subscribe, " . "\tc.selling, c.prize, c.create_date, c.status AS course_status, c.course_edition, " . "\tc.classrooms, c.img_othermaterial, c.course_demo, c.course_vote, " . "\tc.can_subscribe, c.sub_start_date, c.sub_end_date, c.valid_time, c.userStatusOp, " . "\tu.level, u.date_inscr, u.date_first_access, u.date_complete, u.status AS user_status, u.waiting, c.advance, u.waiting ";
    $from_assess = " FROM " . $GLOBALS['prefix_lms'] . "_course AS c " . "\t JOIN " . $GLOBALS['prefix_lms'] . "_courseuser AS u ";
    $where_assess = " c.idCourse = u.idCourse " . " AND u.idUser = '******' " . " AND c.course_type = 'assessment' " . " AND  ( c.status <> '" . CST_PREPARATION . "' OR u.level > 3 ) " . ($filter == 'level' ? " AND level = '" . $filter_level . "'" : "");
    //." AND ( u.status <> '"._CUS_END."' OR u.level > 3 ) ";
    $preass_list = sql_query($select_assess . $from_assess . " WHERE " . $where_assess . " ORDER BY c.name ");
    // pre assessment list ---------------------------------------------------------------------------------------
    $i = 0;
    if (mysql_num_rows($preass_list) && $current_tab == 'lo_plan') {
        if ($page_add) {
            $GLOBALS['page']->add('<div id="mycourse_asses">' . '<h1>' . $lang_c->def('_ASSESSMENT_LIST') . '</h1>', 'content');
        }
        while ($cinfo = mysql_fetch_assoc($preass_list)) {
            $cinfo['user_score'] = isset($user_score[$cinfo['idCourse']]) ? $user_score[$cinfo['idCourse']] : NULL;
            if (isset($comment_count[$cinfo['idCourse']])) {
                $cinfo['comment_count'] = $comment_count[$cinfo['idCourse']];
            }
            if ($page_add) {
                $GLOBALS['page']->add(dashmyassess($url, $lang_c, $cinfo, $i++), 'content');
            }
        }
        if ($page_add) {
            $GLOBALS['page']->add('</div>', 'content');
        }
    }
    // page intest ------------------------------------------------------------
    require_once $GLOBALS['where_lms'] . '/lib/lib.levels.php';
    $lvl = CourseLevel::getLevels();
    $title = $lang->def('_COURSE_LIST');
    switch ($filter) {
        case "access":
            $title = $lang->def('_COURSE_YOU_CAN_ACCESS');
            break;
        case "expiring":
            $title = $lang->def('_COURSE_EXPIRING');
            break;
        case "subscribed":
            $title = $lang->def('_COURSE_SUBSCRIBED');
            break;
        case "begin":
            $title = $lang->def('_COURSE_BEGIN');
            break;
        case "end":
            $title = $lang->def('_COURSE_END');
            break;
        case "level":
            $title = str_replace('[level]', $lvl[$_GET['filter_on']], $lang->def('_COURSE_AS'));
            break;
    }
    if ($page_add) {
        $GLOBALS['page']->add('<div id="mycourse_list">' . '<h1>' . $title . '</h1>', 'content');
    }
    $i = 0;
    $direct_play = false;
    while ($cinfo = mysql_fetch_assoc($re_course)) {
        $access = Man_Course::canEnterCourse($cinfo);
        if ($cinfo['direct_play'] == 1) {
            $direct_play = true;
        }
        $course_stats['total']++;
        if ($cinfo['user_status'] == _CUS_RESERVED || $cinfo['user_status'] == _CUS_WAITING_LIST) {
            $course_stats['with_wstatus'][$cinfo['user_status']]++;
        } elseif ($access['can']) {
            $course_stats['u_can_enter']++;
        }
        if (isset($course_stats['with_ustatus'][$cinfo['user_status']])) {
            $course_stats['with_ustatus'][$cinfo['user_status']]++;
        } else {
            $course_stats['with_ustatus'][$cinfo['user_status']] = 1;
        }
        if (!isset($course_stats['with_ulevel'][$cinfo['level']])) {
            $course_stats['with_ulevel'][$cinfo['level']] = 1;
        } else {
            $course_stats['with_ulevel'][$cinfo['level']]++;
        }
        if (isset($available_cert[$cinfo['idCourse']])) {
            while (list($id_cert, $certificate) = each($available_cert[$cinfo['idCourse']])) {
                if (!isset($released[$id_cert]) && $cert->canRelease($certificate[CERT_AV_STATUS], $cinfo['user_status'])) {
                    $course_stats['cert_relesable']++;
                }
            }
        }
    }
    if (mysql_num_rows($re_course)) {
        mysql_data_seek($re_course, 0);
    }
    while ($cinfo = mysql_fetch_assoc($re_course)) {
        $cinfo['edition_list'] = isset($editions[$cinfo['idCourse']]) ? $editions[$cinfo['idCourse']] : array();
        $cinfo['user_score'] = isset($user_score[$cinfo['idCourse']]) ? $user_score[$cinfo['idCourse']] : NULL;
        $cinfo['enrolled'] = isset($enrolled[$cinfo['idCourse']]) ? $enrolled[$cinfo['idCourse']] : false;
        if (isset($comment_count[$cinfo['idCourse']])) {
            $cinfo['comment_count'] = $comment_count[$cinfo['idCourse']];
        }
        $cinfo['classrooms'] = isset($classrooms[$cinfo['classrooms']]) ? $classrooms[$cinfo['classrooms']] : '';
        // advertising --------------------------------------------------------------------------------------------
        $cinfo['to_read']['advice'] = isset($advices[$cinfo['idCourse']]) ? $advices[$cinfo['idCourse']] : 0;
        $cinfo['to_read']['forum'] = isset($forums[$cinfo['idCourse']]) ? $forums[$cinfo['idCourse']] : 0;
        $cinfo['to_read']['lobj'] = isset($org_chart[$cinfo['idCourse']]) ? $org_chart[$cinfo['idCourse']] : 0;
        // 10 days in the future
        $range = time() + 10 * 24 * 60 * 60;
        $expiring = false;
        if ($cinfo['date_end'] != '0000-00-00') {
            $time_end = fromDatetimeToTimestamp($cinfo['date_end']);
            if ($range > $time_end) {
                $expiring = true;
                $course_stats['expiring']++;
            }
        }
        if ($cinfo['valid_time'] != '0' && $cinfo['valid_time'] != '' && $cinfo['date_first_access'] != '') {
            $time_first_access = fromDatetimeToTimestamp($cinfo['date_first_access']);
            if ($range > $time_first_access + $cinfo['valid_time'] * 24 * 3600) {
                $expiring = true;
                $course_stats['expiring']++;
            }
        }
        if (isset($first_is_scorm[$cinfo['idCourse']])) {
            $cinfo['first_is_scorm'] = $first_is_scorm[$cinfo['idCourse']];
        } else {
            $cinfo['first_is_scorm'] = false;
        }
        $access = Man_Course::canEnterCourse($cinfo);
        // --------------------------------------------------------------------
        if (!isset($path_courses['all_items'][$cinfo['idCourse']])) {
            // the course is not related with a coursepath, so i can print it --------------
            if ($filter == 'level') {
                if ($subscription['course'][$cinfo['idCourse']]['level'] == $filter_level) {
                    $dash = dashmycourse($url, $lang_c, $subscription, $cinfo, $i++);
                } else {
                    $dash = '';
                }
            } else {
                $dash = dashmycourse($url, $lang_c, $subscription, $cinfo, $i++);
            }
            if ($use_tab == true) {
                if ($course_stats['with_ustatus'][_CUS_END] == $course_stats['total']) {
                    $current_tab = 'lo_history';
                }
                if ($current_tab == 'lo_history') {
                    if ($cinfo['user_status'] == _CUS_END && $page_add) {
                        $GLOBALS['page']->add($dash, 'content');
                    }
                } else {
                    if (($cinfo['user_status'] != _CUS_END || $cinfo['level'] >= 4) && $page_add) {
                        $GLOBALS['page']->add($dash, 'content');
                    }
                }
            } else {
                switch ($filter) {
                    case "access":
                        if ($access['can'] && $page_add) {
                            $GLOBALS['page']->add($dash, 'content');
                        }
                        break;
                    case "expiring":
                        if ($expiring && $page_add) {
                            $GLOBALS['page']->add($dash, 'content');
                        }
                        break;
                    case "subscribed":
                        if ($cinfo['user_status'] == _CUS_SUBSCRIBED && $page_add) {
                            $GLOBALS['page']->add($dash, 'content');
                        }
                        break;
                    case "begin":
                        if ($cinfo['user_status'] == _CUS_BEGIN && $page_add) {
                            $GLOBALS['page']->add($dash, 'content');
                        }
                        break;
                    case "end":
                        if ($cinfo['user_status'] == _CUS_END && $page_add) {
                            $GLOBALS['page']->add($dash, 'content');
                        }
                        break;
                    case "level":
                        if ($_GET['filter_on'] == $cinfo['level'] && $page_add) {
                            $GLOBALS['page']->add($dash, 'content');
                        }
                        break;
                    default:
                        if ($page_add) {
                            $GLOBALS['page']->add($dash, 'content');
                        }
                }
            }
        } else {
            // the course is related with a coursepath, so i must wait to print it ----------
            //$cinfo['prerequisites'] = $path_courses['all_items'][$cinfo['idCourse']]; // <- useless?
            //$courses =array($cinfo['idCourse']=>$cinfo);
            $prere = $cp_info[$cinfo['idCourse']]["prerequisites"];
            if ($path_man->checkPrerequisites($prere, $subscription)) {
                $cinfo['prerequisites_satisfied'] = true;
            } else {
                $cinfo['prerequisites_satisfied'] = false;
            }
            if ($filter == 'level') {
                if ($subscription['course'][$cinfo['idCourse']]['level'] == $filter_level) {
                    $course_cache[$cinfo['idCourse']] = dashmycourse($url, $lang_c, $subscription, $cinfo, 1, true, 4);
                } else {
                    $course_cache[$cinfo['idCourse']] = '';
                }
            } else {
                $course_cache[$cinfo['idCourse']] = dashmycourse($url, $lang_c, $subscription, $cinfo, 1, true, 4);
            }
        }
        // end else-if -------------------------------------------------------
    }
    //  end while ------------------------------------------------------------
    if ($direct_play && $page_add) {
        $GLOBALS['page']->add('' . '	<link href="' . getPathTemplate() . '/style/shadowbox.css" rel="stylesheet" type="text/css" />' . '<script type="text/javascript" src="' . $GLOBALS['where_framework_relative'] . '/addons/shadowbox/shadowbox-yui.js"></script>' . "\n" . '<script type="text/javascript" src="' . $GLOBALS['where_framework_relative'] . '/addons/shadowbox/shadowbox.js"></script>' . "\n", 'page_head');
        $GLOBALS['page']->add('<script type="text/javascript">
	
		YAHOO.util.Event.onDOMReady(function() {
			var options = { listenOverlay:false, overlayOpacity:"0.8", 
				loadingImage:"' . getPathImage('lms') . 'standard/loading.gif", overlayBgImage:"' . getPathImage('lms') . 'standard/overlay-85.png", 
				text: {close: "' . Lang::t('_CLOSE') . '", cancel: "' . Lang::t('_UNDO') . '", loading:"' . Lang::t('_LOADING') . '" },
				onOpen: function (gallery) { window.onbeforeunload = function() { return "' . Lang::t('_CONFIRM_EXIT', 'organization', 'lms') . '"; } }
		    }; 
			Shadowbox.init(options); 
			Shadowbox.close = function() { 
				window.frames[\'shadowbox_content\'].uiPlayer.closePlayer(true, window);
			}
		});
		</script>');
    }
    if ($course_stats['total'] == 0 && $page_add) {
        $GLOBALS['page']->add('' . '<b>' . $lang->def('_NO_COURSE') . '</b> ' . '<br />', 'content');
    }
    if ($page_add) {
        $GLOBALS['page']->add('</div>', 'content');
    }
    // Coursepath --------------------------------------------------------------
    if (!empty($coursepath)) {
        // find structures of the course path ----------------------------------
        $path_slot = $path_man->getPathSlot(array_keys($coursepath));
        // coursepath list -----------------------------------------------------
        if ($page_add) {
            $GLOBALS['page']->add('<div id="mycoursepath_list">' . '<h1>' . $lang->def('_COURSEPATH_LIST') . '</h1>', 'content');
        }
        $i = 0;
        // find course basilar information -------------------------------------
        if (!empty($needed_info_for)) {
            $course_info = $man_course->getAllCourses(false, false, $needed_info_for);
        } else {
            $course_info = array();
        }
        while (list($id_path, $path) = each($coursepath)) {
            $html = '<div class="coursepath_container coursepath_container_simple">';
            $html .= '<h2>' . ($path[COURSEPATH_CODE] != '' ? '[' . $path[COURSEPATH_CODE] . '] ' : '') . $path[COURSEPATH_NAME] . '</h2>';
            if (!isset($path_courses[$id_path]) || empty($path_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 .= '<h3>' . $lang->def('_MANDATORY') . '</h3>';
                        if (!empty($path_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 .= '<h3>' . $title . '</h3>';
                        if (!empty($path_courses[$id_path][$id_slot])) {
                            $html .= '<ul class="coursepath_otherslot">';
                        }
                    }
                    while (list($id) = each($path_courses[$id_path][$id_slot])) {
                        if (isset($course_cache[$id])) {
                            $html .= '<li>' . $course_cache[$id] . '</li>';
                        } else {
                            $html .= '<li>' . dashAcourse($id, 4) . '</li>';
                        }
                    }
                    if (!empty($path_courses[$id_path][$id_slot])) {
                        $html .= '</ul>';
                    }
                }
            }
            $html .= '</div>';
            if ($page_add) {
                $GLOBALS['page']->add($html, 'content');
            }
        }
        if ($page_add) {
            $GLOBALS['page']->add('</div>', 'content');
        }
    }
    if ($course_stats['cert_relesable'] < 0) {
        $course_stats['cert_relesable'] = 0;
    }
    return $course_stats;
}
Example #8
0
 if (!empty($GLOBALS['chapter'])) {
     $start_from_chapter = $GLOBALS['chapter'];
 } else {
     $start_from_chapter = Get::req('start_from_chapter', DOTY_MIXED, false);
 }
 if ($autoplay == '') {
     $autoplay = '1';
 }
 if ($playertemplate == '') {
     $playertemplate = 'default';
 }
 if ($environment == false) {
     $environment = 'course_lo';
 }
 if ($playertemplate != '') {
     if (!file_exists(getPathTemplate() . 'player_scorm/' . $playertemplate . '/def_style.css')) {
         $playertemplate = 'default';
     }
 } else {
     $playertemplate = 'default';
 }
 $idscorm_organization = $idResource;
 $idUser = (int) getLogUserId();
 /*Start database connection***********************************************/
 /* get scorm version */
 $scormVersion = getScormVersion('idscorm_organization', $idscorm_organization);
 /* get object title */
 list($lo_title) = sql_fetch_row(sql_query("SELECT title" . " FROM " . $GLOBALS['prefix_lms'] . "_organization" . " WHERE idResource = '{$idResource}'" . "   AND objectType = 'scormorg'"));
 $itemtrack = new Scorm_ItemsTrack(null, $GLOBALS['prefix_lms']);
 $rsItemTrack = $itemtrack->getItemTrack($idUser, $idReference, NULL, $idscorm_organization);
 if ($rsItemTrack === FALSE) {
Example #9
0
 function loadOrgChartView()
 {
     require_once dirname(__FILE__) . '/../modules/org_chart/tree.org_chart.php';
     $lang =& DoceboLanguage::createInstance('organization_chart', 'framework');
     $userlevelid = Docebo::user()->getUserLevelId();
     $repoDb = new TreeDb_OrgDb($GLOBALS['prefix_fw'] . '_org_chart_tree');
     $treeView = new TreeView_OrgView($repoDb, 'organization_chart', Get::sett('title_organigram_chart'));
     $treeView->setLanguage($lang);
     $treeView->aclManager =& $this->aclManager;
     if ($userlevelid != ADMIN_GROUP_GODADMIN) {
         require_once $GLOBALS['where_framework'] . '/lib/lib.adminmanager.php';
         $adminManager = new AdminManager();
         $treeView->setFilterNodes($adminManager->getAdminTree(Docebo::user()->getIdSt()));
     }
     $treeView->loadState();
     $treeView->parsePositionData($_POST, $_POST, $_POST);
     $treeView->selector_mode = $this->selector_mode;
     $treeView->simple_selector = $this->show_orgchart_simple_selector;
     $treeView->itemSelectedMulti = $this->selection;
     $treeView->itemSelectedMulti_alt = $this->selection_alt;
     $treeView->multi_choice = $this->multi_choice;
     $treeView->select_all = $this->select_all;
     $treeView->deselect_all = $this->deselect_all;
     $treeView->saveState();
     require_once _base_ . '/lib/lib.form.php';
     $GLOBALS['page']->add('<link href="' . getPathTemplate('framework') . '/style/base-old-treeview.css" rel="stylesheet" type="text/css" />', 'page_head');
     $GLOBALS['page']->setWorkingZone('content');
     if (!$this->selector_mode) {
         $GLOBALS['page']->add(getTitleArea($lang->def('_ORG_CHART'), 'org_chart'));
         $GLOBALS['page']->add('<div class="std_block">');
         $GLOBALS['page']->addEnd('</div>');
     }
     if ($treeView->op != '') {
         $processed = FALSE;
         switch ($treeView->op) {
             case 'reedit_person':
                 $processed = TRUE;
                 $this->editPerson();
                 break;
             case 'create_user':
                 //$this->org_createUser($treeView->getSelectedFolderId());
                 $processed = TRUE;
                 Util::jump_to('index.php?modname=directory&op=org_createuser&treeid=' . $treeView->getSelectedFolderId());
                 break;
             case 'addtotree':
                 $processed = TRUE;
                 Util::jump_to('index.php?modname=directory&op=addtotree&treeid=' . $treeView->getSelectedFolderId());
                 break;
             case 'waiting_user':
                 $processed = TRUE;
                 Util::jump_to('index.php?modname=directory&op=org_waitinguser&treeid=' . $treeView->getSelectedFolderId());
                 break;
         }
         if (!$this->selector_mode && !$processed) {
             $GLOBALS['page']->add(Form::openForm('directory_org_chart', 'index.php?modname=directory&amp;op=org_chart', 'std_form', 'post', 'multipart/form-data'));
             $GLOBALS['page']->addEnd(Form::closeForm());
         }
         switch ($treeView->op) {
             case 'newfolder':
                 $GLOBALS['page']->add($treeView->loadNewFolder());
                 break;
             case 'deletefolder':
                 $GLOBALS['page']->add($treeView->loadDeleteFolder());
                 break;
             case 'renamefolder':
                 $GLOBALS['page']->add($treeView->loadRenameFolder());
                 break;
             case 'movefolder':
                 $GLOBALS['page']->add($treeView->loadMoveFolder());
                 break;
             case 'import_users':
                 $GLOBALS['page']->add($treeView->loadImportUsers());
                 break;
             case 'import_users2':
                 $GLOBALS['page']->add($treeView->loadImportUsers2());
                 break;
             case 'import_users3':
                 $GLOBALS['page']->add($treeView->loadImportUsers3());
                 break;
             case 'assign2_field':
                 $GLOBALS['page']->add($treeView->loadAssignField2());
                 break;
             case 'assign_field':
                 $GLOBALS['page']->add($treeView->loadAssignField());
                 break;
             case 'folder_field2':
                 $GLOBALS['page']->add($treeView->loadFolderField2());
                 break;
             case 'folder_field':
                 $GLOBALS['page']->add($treeView->loadFolderField());
                 break;
         }
     } else {
         if (!$this->selector_mode) {
             //quick change password
             if (checkPerm('edituser_org_chart', true, 'directory', 'framework')) {
                 $GLOBALS['page']->add('<div class="align_right">' . '<a href="javascript:;" onclick="YAHOO.Animation.BlindToggle(\'quick_change\');">' . $lang->def('_CHANGEPASSWORD') . '</a>' . '<div id="quick_change" style="display:none;">' . '<form method="post" action="index.php?modname=directory&amp;op=quick_change_password">' . '<div class="instruction_container">' . '<input type="hidden" id="authentic_request_chpwd" name="authentic_request" value="' . Util::getSignature() . '" />' . '<label for="cp_userid">' . $lang->def('_USERNAME') . ' </label>' . '<input type="text" id="cp_userid" name="cp_userid" maxlenght="255" />&nbsp;&nbsp;' . '<label for="cp_pwd">' . $lang->def('_PASSWORD') . ' </label>' . '<input type="password" id="cp_pwd" name="cp_pwd" maxlenght="255" autocomplete="off" />&nbsp;&nbsp;' . '<input type="submit" id="cp_click" name="cp_click" value="' . $lang->def("_SAVE") . '" /><br/>' . '<input type="checkbox" id="cp_force" name="cp_force" value="1" checked="checked" />' . ' <label for="cp_force">' . $lang->def('_FORCE_CHANGE') . '</label>' . '</div>' . '</form>' . '</div>' . '</div><br/>');
             }
             $treeView->lv_data = new PeopleDataRetriever($GLOBALS['dbConn'], $GLOBALS['prefix_fw']);
             $rend = new Table(Get::sett('visuUser'));
             $treeView->lv_view = new PeopleListView('', $treeView->lv_data, $rend, 'usersmembersdirectory');
             $treeView->lv_view->hide_suspend = FALSE;
             $treeView->lv_view->setLinkPagination("index.php?modname=directory&amp;op=org_chart");
             $treeView->lv_view->aclManager =& $this->aclManager;
             $treeView->lv_view->parsePositionData($_POST);
             if ($treeView->lv_view->getOp() == 'newitem') {
                 $this->editPerson();
             } elseif ($treeView->lv_view->getOp() == 'editperson') {
                 $this->editPerson($treeView->lv_view->getIdSelectedItem());
             } elseif ($treeView->lv_view->getOp() == 'deleteperson') {
                 $this->deletePerson($treeView->lv_view->getIdSelectedItem());
             } else {
                 if ($treeView->lv_view->getOp() == 'removeperson') {
                     $idmember = $treeView->lv_view->getIdSelectedItem();
                     $idmember_idst = $this->aclManager->getUserST($idmember);
                     $id_org = $treeView->getSelectedFolderId();
                     $id_org_idst = $treeView->tdb->getGroupST($id_org);
                     $id_org_desc_idst = $treeView->tdb->getGroupDescendantsST($id_org);
                     // echo "\nmember idst: $member_idst, org_idst: $id_org_idst, org_desc_idst: $id_org_desc_idst\n";
                     $this->aclManager->removeFromGroup($id_org_idst, $idmember_idst);
                     $this->aclManager->removeFromGroup($id_org_desc_idst, $idmember_idst);
                     $treeView->lv_view->op = '';
                 }
                 $GLOBALS['page']->add(Form::openForm('directory_org_chart', 'index.php?modname=directory&amp;op=org_chart'));
                 $GLOBALS['page']->addEnd(Form::closeForm());
                 if (Get::sett('use_org_chart') == '1') {
                     $GLOBALS['page']->add($treeView->load());
                     $GLOBALS['page']->add($treeView->loadActions());
                 }
                 if (Get::sett('use_org_chart') == '1') {
                     $id_org = $treeView->getSelectedFolderId();
                     if ($id_org > 0 && $treeView->isFolderAccessible()) {
                         if ($treeView->lv_view->flat_mode) {
                             $groupid = $treeView->tdb->getGroupDescendantsId($id_org);
                         } else {
                             $groupid = $treeView->tdb->getGroupId($id_org);
                         }
                     }
                 } else {
                     $id_org = 0;
                 }
                 if ($id_org > 0 && $treeView->isFolderAccessible()) {
                     $this->membersTree($groupid, $treeView);
                 } elseif ($id_org == 0) {
                     $this->membersTree('', $treeView);
                 }
                 if (Get::sett('use_org_chart') != '1') {
                     $GLOBALS['page']->add($treeView->loadActions());
                 }
             }
         } else {
             $GLOBALS['page']->add($treeView->load());
         }
     }
 }
Example #10
0
            $user_session = 'public_area';
        } else {
            $sn = "docebo_core";
            $user_session = 'admin_area';
        }
        break;
}
session_name($sn);
session_start();
// load regional setting
// load current user from session
require_once _base_ . '/lib/lib.user.php';
$GLOBALS['current_user'] =& DoceboUser::createDoceboUserFromSession($user_session);
// Utils and so on
require_once $GLOBALS['where_framework'] . '/lib/lib.php';
// load standard language module and put it global
$glang =& DoceboLanguage::createInstance('standard', 'framework');
$glang->setGlobal();
require_once _base_ . '/lib/lib.platform.php';
// create instance of StdPageWriter
StdPageWriter::createInstance();
require_once $GLOBALS['where_framework'] . '/lib/lib.preoperation.php';
$GLOBALS["template_path"] = $path_to_root . '/' . getPathTemplate('scs') . 'tools/htmlwachat/';
$GLOBALS["img_path"] = $path_to_root . '/' . getPathTemplate('scs') . 'tools/htmlwachat/';
$GLOBALS['page']->add('<link href="' . $GLOBALS["template_path"] . 'style_chat.css" rel="stylesheet" type="text/css" />' . "\n", 'page_head');
$out =& $GLOBALS["page"];
$out->setWorkingZone("content");
$lang =& DoceboLanguage::createInstance('htmlframechat', 'scs');
require_once $GLOBALS["where_scs"] . '/lib/lib.html_chat_common.php';
require_once dirname(__FILE__) . '/functions.php';
$GLOBALS["chat_emo"] = new HtmlChatEmoticons_WAChat();
Example #11
0
/**
 * @return string 	the relative address of the images directory
 */
function getPathImage($platform = false)
{
    return getPathTemplate($platform) . 'images/';
}
Example #12
0
function report_show_results($idrep = false)
{
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.download.php';
    //import yui pop-up stuff
    setup_report_js();
    $lang =& DoceboLanguage::createInstance('report');
    $start_url = 'index.php?modname=report&op=reportlist';
    $download = Get::req('dl', DOTY_STRING, false);
    $no_download = Get::req('no_show_repdownload', DOTY_INT, 0);
    $nosave = Get::req('nosave', DOTY_INT, 0);
    if ($idrep == false) {
        //die( print_r($_SESSION['report_tempdata'], true ) );
        if (!isset($_SESSION['report_tempdata'])) {
            $ref =& $_SESSION['report'];
        } else {
            $ref =& $_SESSION['report_tempdata'];
        }
        $id_report = $ref['id_report'];
        $res = sql_query("SELECT class_name, file_name FROM %lms_report WHERE id_report=" . $id_report . " AND enabled=1");
        $author = 0;
        $filter_name = $ref['report_name'];
        //['columns_filter_category']
        if ($res && sql_num_rows($res) > 0) {
            list($class_name, $file_name) = sql_fetch_row($res);
            if (file_exists(_base_ . '/customscripts/' . _folder_lms_ . '/admin/modules/report/' . $file_name) && Get::cfg('enable_customscripts', false) == true) {
                require_once _base_ . '/customscripts/' . _folder_lms_ . '/admin/modules/report/' . $file_name;
            } else {
                require_once _lms_ . '/admin/modules/report/' . $file_name;
            }
        } else {
            reportlist();
        }
    } else {
        /// find main class report filename and report info
        $query_report = "\r\n\t\tSELECT r.class_name, r.file_name, r.report_name, f.filter_name, f.filter_data, f.author\r\n\t\tFROM %lms_report AS r\r\n\t\t\tJOIN %lms_report_filter AS f\r\n\t\t\tON ( r.id_report = f.id_report )\r\n\t\tWHERE f.id_filter = '" . $idrep . "'";
        $re_report = sql_query($query_report);
        if (sql_num_rows($re_report) == 0) {
            reportlist();
            return;
        }
        // create the report object
        list($class_name, $file_name, $report_name, $filter_name, $filter_data, $author) = sql_fetch_row($re_report);
        if (file_exists(_base_ . '/customscripts/' . _folder_lms_ . '/admin/modules/report/' . $file_name) && Get::cfg('enable_customscripts', false) == true) {
            require_once _base_ . '/customscripts/' . _folder_lms_ . '/admin/modules/report/' . $file_name;
        } else {
            require_once _lms_ . '/admin/modules/report/' . $file_name;
        }
    }
    $obj_report = new $class_name($idrep);
    $obj_report->back_url = $start_url;
    $obj_report->jump_url = 'index.php?modname=report&op=show_results&idrep=' . $idrep;
    if ($author == 0) {
        $filter_name = $filter_name ? $lang->def($filter_name) : '';
    }
    $data = _decode($filter_data);
    if ($download != false) {
        $export_filename = 'report_' . $filter_name . '_' . date("d_m_Y");
        switch ($download) {
            case 'htm':
                sendStrAsFile($obj_report->getHTML($data['columns_filter_category'], $data), $export_filename . '.html');
                break;
            case 'csv':
                sendStrAsFile($obj_report->getCSV($data['columns_filter_category'], $data), $export_filename . '.csv');
                break;
            case 'xls':
                sendStrAsFile($obj_report->getXLS($data['columns_filter_category'], $data), $export_filename . '.xls');
                break;
        }
    }
    cout(getTitleArea(array($start_url => $lang->def('_REPORT'), $filter_name), 'report') . '<div class="std_block">' . getBackUi($start_url, $lang->def('_BACK_TO_LIST'), 'content'));
    if ($nosave > 0) {
        $mod_id = Get::req('modid', DOTY_INT, false);
        cout('<br/>' . getBackUi('index.php?modname=report&op=report_save' . ($mod_id ? '&modid=' . $mod_id : ''), $lang->def('_SAVE_AND_BACK_TO_LIST')));
    }
    if ($no_download <= 0) {
        cout('<p class="export_list">' . '<a class="ico-wt-sprite subs_htm" href="' . $obj_report->jump_url . '&amp;dl=htm"><span>' . $lang->def('_EXPORT_HTML') . '</span></a>&nbsp;' . '<a class="ico-wt-sprite subs_csv" href="' . $obj_report->jump_url . '&amp;dl=csv"><span>' . $lang->def('_EXPORT_CSV') . '</span></a>&nbsp;' . '<a class="ico-wt-sprite subs_xls" href="' . $obj_report->jump_url . '&amp;dl=xls"><span>' . $lang->def('_EXPORT_XLS') . '</span></a>' . '</p>' . '<br/>');
    }
    // css -----------------------------------------------------------
    cout('<link href="' . getPathTemplate('lms') . 'style/report/style_report_user.css" rel="stylesheet" type="text/css" />' . "\n", 'page_head');
    // $_SESSION['report_tempdata']['columns_filter_category']
    $query_update = "UPDATE %lms_report_filter SET views = views+1 WHERE id_filter = '" . $idrep . "'";
    $re_update = sql_query($query_update);
    cout(Form::openForm('user_report_columns_courses', $obj_report->jump_url));
    cout($obj_report->show_results($data['columns_filter_category'], $data));
    cout(Form::closeForm() . '</div>');
}
/**
 * @version  $Id:$
 * @author	 Fabio Pirovano <fabio [at] docebo-com>
 * @package course
 */
function displayCourseList(&$url, $order_type)
{
    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.course.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.coursereport.php';
    require_once $GLOBALS["where_framework"] . "/lib/lib.ajax_comment.php";
    require_once $GLOBALS['where_lms'] . '/lib/lib.classroom.php';
    // cahce classroom
    $classroom_man = new ClassroomManager();
    $classrooms = $classroom_man->getClassroomNameList();
    $lang =& DoceboLanguage::createInstance('catalogue');
    $lang_c =& DoceboLanguage::createInstance('course');
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0);
    $man_course = new Man_Course();
    $id_parent = importVar('id_parent', false, 0);
    $nav_url = $id_parent != 0 ? $url->getUrl('id_parent=' . $id_parent) : $url->getUrl();
    $nav_bar->setLink($nav_url);
    $ini = $nav_bar->getSelectedElement();
    $profile = new UserProfile(getLogUserId());
    $profile->init('profile', 'framework', '', 'ap');
    $profile->addStyleSheet('lms');
    // searching courses
    $use_category = $order_type == 'category';
    $select_course = "" . " SELECT c.idCourse, c.course_type, c.idCategory, c.code, c.name, c.description, c.lang_code, c.difficult, " . "\tc.subscribe_method, c.date_begin, c.date_end, c.max_num_subscribe, " . "\tc.selling, c.prize, c.create_date, c.status AS course_status, c.course_edition, " . "\tc.classrooms, c.img_material, c.course_demo, c.course_vote, COUNT(*) as enrolled, " . "\tc.can_subscribe, c.sub_start_date, c.sub_end_date, c.allow_overbooking, c.max_num_subscribe, c.min_num_subscribe, c.direct_play, " . "\tc.valid_time, c.userStatusOp, u.level, u.date_inscr, u.date_first_access, u.date_complete, u.status AS user_status, u.waiting, c.advance ";
    $from_course = " FROM " . $GLOBALS['prefix_lms'] . "_course AS c " . "\tLEFT JOIN " . $GLOBALS['prefix_lms'] . "_courseuser AS u " . "\t\tON ( c.idCourse = u.idCourse ) ";
    $where_course = " c.status <> '" . CST_PREPARATION . "' ";
    if (Get::sett('catalogue_hide_ended') == 'on') {
        $where_course .= " AND ( c.date_end = '0000-00-00'" . " OR c.date_end > '" . date('Y-m-d') . "' ) ";
    }
    $group_by_course = " GROUP BY c.idCourse ";
    switch ($order_type) {
        case "mostscore":
            $order_course = " ORDER BY c.course_vote DESC ";
            break;
        case "popular":
            $order_course = " ORDER BY enrolled DESC ";
            break;
        case "recent":
            $order_course = " ORDER BY c.create_date DESC ";
            break;
        default:
            $order_course = " ORDER BY c.name ";
    }
    $limit_course = " LIMIT " . $ini . ", " . Get::sett('visuItem');
    $where_course .= " AND c.course_type <> 'assessment'";
    if (Docebo::user()->isAnonymous()) {
        $where_course .= " AND c.show_rules = 0";
    } else {
        $where_course .= " AND c.show_rules  <> 2";
    }
    // maybe a must apply some filter to remove from the list some courses --------------
    $cat_man = new Catalogue_Manager();
    $catalogues =& $cat_man->getUserAllCatalogueId(getLogUserId());
    // at least one catalogue is assigned to this user
    if (!empty($catalogues)) {
        $cat_courses = $cat_man->getAllCourseOfUser(getLogUserId());
        if (empty($cat_courses)) {
            $where_course .= " AND 0 ";
        } else {
            $where_course .= " AND c.idCourse IN ( " . implode(',', $cat_courses) . " ) ";
        }
    } elseif (Get::sett('on_catalogue_empty') == 'off') {
        $where_course .= " AND 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']['course'])) {
            $where_course = " ( ( " . $where_course . " ) OR c.idCourse IN (" . implode(',', $ass_elem['parsed']['course']) . ") ) ";
        }
    }
    // apply search filter --------------------------------------------------------------
    $s_searched = get_searched('simple_search', '');
    $filter_lang = get_searched('filter_lang', 'all');
    $filter_date_begin = get_searched('filter_date_begin', '');
    if ($filter_date_begin != '') {
        $filter_date_begin = Format::dateDb($filter_date_begin, 'date') . ' 00:00:00';
    }
    $filter_date_end = get_searched('filter_date_end', '');
    if ($filter_date_end != '') {
        $filter_date_end = Format::dateDb($filter_date_end, 'date') . ' 00:00:00';
    }
    $all_lang = Docebo::langManager()->getAllLangCode();
    if (must_search_filter()) {
        if (trim($s_searched) != '') {
            $where_course .= " AND ( c.code LIKE '%" . $s_searched . "%' " . " OR c.name LIKE '%" . $s_searched . "%' " . " OR c.description LIKE '%" . $s_searched . "%' ) ";
        }
        if ($filter_lang != 'all') {
            $where_course .= " AND c.lang_code = '" . $all_lang[$filter_lang] . "' ";
        }
        if ($filter_date_begin != '') {
            $where_course .= " AND ( c.date_begin >= '" . $filter_date_begin . "' OR c.course_edition = 1 ) ";
        }
        if ($filter_date_end != '') {
            $where_course .= " AND ( c.date_end <= '" . $filter_date_end . "' OR c.course_edition = 1 ) ";
        }
    }
    if ($use_category) {
        $where_course .= " AND c.idCategory = '" . (int) $id_parent . "'";
    }
    $re_course = sql_query($select_course . $from_course . " WHERE " . $where_course . $group_by_course . $order_course . $limit_course);
    list($course_number) = sql_fetch_row(sql_query("SELECT COUNT(*) " . " FROM " . $GLOBALS['prefix_lms'] . "_course AS c " . " WHERE " . $where_course));
    $nav_bar->setElementTotal($course_number);
    // retrive editions ----------------------------------------------------------------
    $select_edition = " SELECT e.* ";
    $from_edition = " FROM " . $GLOBALS["prefix_lms"] . "_course_edition AS e";
    $where_edition = " WHERE e.status <> '" . CST_PREPARATION . "' ";
    $where_edition .= " AND (e.date_begin > '" . date("Y-m-d H:i:s") . "' OR e.date_begin = '0000-00-00 00:00:00')";
    $order_edition = " ORDER BY date_begin ";
    if (must_search_filter()) {
        if ($filter_date_begin != '') {
            $where_edition .= " AND date_begin >= '" . $filter_date_begin . "' ";
        }
        if ($filter_date_end != '') {
            $where_edition .= " AND date_end <= '" . $filter_date_end . "' ";
        }
    }
    $re_edition = sql_query($select_edition . $from_edition . $where_edition . $order_edition);
    $editions = array();
    if ($re_edition) {
        while ($edition_elem = mysql_fetch_assoc($re_edition)) {
            $edition_elem['classrooms'] = isset($classrooms[$edition_elem['classrooms']]) ? $classrooms[$edition_elem['classrooms']] : '';
            $edition_elem['waiting'] = 0;
            $edition_elem['user_count'] = 0;
            $edition_elem['theacher_list'] = getSubscribed($edition_elem["idCourse"], false, 6, true, $edition_elem["idCourseEdition"]);
            $editions[$edition_elem["idCourse"]][$edition_elem["idCourseEdition"]] = $edition_elem;
        }
    }
    // retrive editions subscribed -----------------------------------------------------
    $select_ed_count = "SELECT u.idCourse, u.edition_id, sum(u.waiting) as waiting, COUNT(*) as user_count ";
    $from_ed_count = " FROM " . $GLOBALS["prefix_lms"] . "_courseuser AS u";
    $where_ed_count = " WHERE u.edition_id <> 0 " . " AND u.level = '3'" . " AND u.status IN ('" . _CUS_CONFIRMED . "', '" . _CUS_SUBSCRIBED . "', '" . _CUS_BEGIN . "', '" . _CUS_END . "', '" . _CUS_SUSPEND . "', '" . _CUS_WAITING_LIST . "')" . " AND u.absent = '0'";
    $group_ed_count = "GROUP BY u.edition_id ";
    $re_ed_count = sql_query($select_ed_count . $from_ed_count . $where_ed_count . $group_ed_count);
    if ($re_ed_count) {
        while ($ed_count_elem = mysql_fetch_assoc($re_ed_count)) {
            if (isset($editions[$ed_count_elem["idCourse"]][$ed_count_elem["edition_id"]])) {
                $editions[$ed_count_elem["idCourse"]][$ed_count_elem["edition_id"]]['waiting'] = $ed_count_elem['waiting'];
                $editions[$ed_count_elem["idCourse"]][$ed_count_elem["edition_id"]]['user_count'] = $ed_count_elem['user_count'];
            }
        }
    }
    // retrive course subscription -----------------------------------------------------
    $man_courseuser = new Man_CourseUser();
    $usercourses = $man_courseuser->getUserSubscriptionsInfo(getLogUserId(), false);
    $user_score = $man_courseuser->getUserCourseScored(getLogUserId());
    require_once $GLOBALS['where_lms'] . '/lib/lib.orgchart.php';
    $first_is_scorm = OrganizationManagement::objectFilter(array_keys($usercourses), 'scormorg');
    // load search form ----------------------------------------------------------------
    $GLOBALS['page']->add(searchForm($url, $lang), 'content');
    if ($use_category && !must_search_filter()) {
        // show category selection -----------------------------------------------------
        $descendant = $man_course->getCategoryCourseAndSonCount();
        $GLOBALS['page']->add('<p class="category_path">' . '<b>' . $lang->def('_CATEGORY_PATH', 'course') . ' :</b> ' . $man_course->getCategoryPath($id_parent, $lang->def('_MAIN_CATEGORY', 'course'), $lang->def('_TITLE_CATEGORY_JUMP', 'course'), $url->getUrl(), 'id_parent') . '</p>', 'content');
        $categories =& $man_course->getCategoriesInfo($id_parent);
        if (!empty($categories)) {
            $GLOBALS['page']->add('<ul class="category_list">', 'content');
            while (list($id_cat, $cat) = each($categories)) {
                $GLOBALS['page']->add('<li' . (!isset($descendant[$id_cat]) ? ' class="empty_folder"' : '') . '>' . '<a href="' . $url->getUrl('id_parent=' . $id_cat) . '">' . $cat['name'] . '<br />' . '<b>' . str_replace(array('[course]', '[category]'), array(isset($descendant[$id_cat]['course']) ? $descendant[$id_cat]['course'] : 0, isset($descendant[$id_cat]['category']) ? $descendant[$id_cat]['category'] : 0), $lang->def('_COURSE_CONTENT', 'course')) . '</b>' . '</a></li>', 'content');
            }
            $GLOBALS['page']->add('</ul>' . '<div class="nofloat"></div>', 'content');
        }
    }
    if (!$re_course || !mysql_num_rows($re_course)) {
        // no course found for the criteria --------------------------------------------
        $GLOBALS['page']->add('<p class="no_course_found">' . $lang->def('_NO_COURSE_FOUND') . '</p>' . '</div>', 'content');
        return;
    }
    $ax_comm = new AjaxComment('course', 'lms');
    $comment_count = $ax_comm->getResourceCommentCount();
    $GLOBALS['page']->add($nav_bar->getNavBar($ini), 'content');
    $i = 0;
    $direct_play = false;
    while ($cinfo = mysql_fetch_assoc($re_course)) {
        if (must_search_filter()) {
            $s_searched = get_searched('simple_search', '');
            if ($s_searched != '') {
                $cinfo['code'] = preg_replace("/" . $s_searched . "/i", '<b class="filter_evidence">' . $s_searched . '</b>', $cinfo['code']);
                $cinfo['name'] = preg_replace("/" . $s_searched . "/i", '<b class="filter_evidence">' . $s_searched . '</b>', $cinfo['name']);
                $cinfo['description'] = preg_replace("/" . $s_searched . "/i", '<b class="filter_evidence">' . $s_searched . '</b>', $cinfo['description']);
            }
        }
        $cinfo['theacher_list'] = getSubscribed($cinfo['idCourse'], false, 6, true);
        $cinfo['edition_list'] = isset($editions[$cinfo['idCourse']]) ? $editions[$cinfo['idCourse']] : array();
        $cinfo['edition_available'] = count($cinfo['edition_list']);
        $cinfo['user_score'] = isset($user_score[$cinfo['idCourse']]) ? $user_score[$cinfo['idCourse']] : NULL;
        $cinfo['classrooms'] = isset($classrooms[$cinfo['classrooms']]) ? $classrooms[$cinfo['classrooms']] : '';
        if (isset($first_is_scorm[$cinfo['idCourse']])) {
            $cinfo['first_is_scorm'] = $first_is_scorm[$cinfo['idCourse']];
        } else {
            $cinfo['first_is_scorm'] = false;
        }
        if (isset($comment_count[$cinfo['idCourse']])) {
            $cinfo['comment_count'] = $comment_count[$cinfo['idCourse']];
        }
        $view = true;
        if (must_search_filter()) {
            if ($cinfo['course_edition'] == 1 && empty($cinfo['edition_list'])) {
                $view = false;
            }
        }
        if ($view) {
            $GLOBALS['page']->add(dashcourse($url, $lang_c, $cinfo, isset($usercourses[$cinfo['idCourse']]) ? $usercourses[$cinfo['idCourse']] : false, $i++), 'content');
        }
        if ($cinfo['direct_play'] == 1) {
            $direct_play = true;
        }
    }
    if ($direct_play) {
        $GLOBALS['page']->add('' . '	<link href="' . getPathTemplate() . '/style/shadowbox.css" rel="stylesheet" type="text/css" />' . '<script type="text/javascript" src="' . $GLOBALS['where_framework_relative'] . '/addons/shadowbox/shadowbox-yui.js"></script>' . "\n" . '<script type="text/javascript" src="' . $GLOBALS['where_framework_relative'] . '/addons/shadowbox/shadowbox.js"></script>' . "\n", 'page_head');
        $GLOBALS['page']->add('<script type="text/javascript">
	
		YAHOO.util.Event.onDOMReady(function() {
			var options = { listenOverlay:false, overlayOpacity:"0.8", 
				loadingImage:"' . getPathImage('lms') . 'standard/loading.gif", overlayBgImage:"' . getPathImage('lms') . 'standard/overlay-85.png", 
				text: {close: "' . Lang::t('_CLOSE') . '", cancel: "' . Lang::t('_UNDO') . '", loading:"' . Lang::t('_LOADING') . '" },
				onOpen: function (gallery) { window.onbeforeunload = function() { return "' . Lang::t('_CONFIRM_EXIT', 'organization', 'lms') . '"; } }
		    }; 
			Shadowbox.init(options); 
			Shadowbox.close = function() {
				window.onbeforeunload = null;
				window.frames[\'shadowbox_content\'].uiPlayer.closePlayer(true, window);
			}
		});
		</script>');
    }
    $GLOBALS['page']->add($nav_bar->getNavBar($ini), 'content');
}
Example #14
0
$idscorm_organization = (int) $_GET['idscorm_organization'];
$idReference = (int) $_GET['idReference'];
$imagesPath = getPathImage() . 'scorm/';
$playertemplate = isset($_GET['template']) ? $_GET['template'] : '';
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN"';
echo '    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
echo '<html xmlns="http://www.w3.org/1999/xhtml">';
echo '<head>';
echo '	<title>Untitled document</title>';
// TODO: verificare se la prossima riga � un problema con IIS
// echo '	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />';
echo '	<link href="' . getPathTemplate() . 'style/base.css" rel="stylesheet" type="text/css" />';
echo '	<link href="' . getPathTemplate() . 'style/lms-scormplayer.css" rel="stylesheet" type="text/css" />';
if ($playertemplate != '') {
    if (file_exists(getPathTemplate() . 'player_scorm/' . $playertemplate . '/def_style.css')) {
        echo '	<link href="' . getPathTemplate() . 'player_scorm/' . $playertemplate . '/def_style.css" rel="stylesheet" type="text/css" />';
    } else {
        $playertemplate = '';
    }
}
echo <<<_TEXTEND
<script type="text/javascript" language="JavaScript">
\t<!--


\tvar API = window.top.API;
\t
\tfunction FinishCallBack( param ) {
\t\twindow.location.reload();
\t}
\t