コード例 #1
0
 public function completedTask()
 {
     $model = new AssessmentLms();
     $courselist = $model->findAll(array('cu.iduser = :id_user', 'cu.status = :status', 'c.course_type = ":course_type"'), array(':id_user' => Docebo::user()->getId(), ':status' => _CUS_END, ':course_type' => 'assessment'));
     //check courses accessibility
     $keys = array_keys($courselist);
     for ($i = 0; $i < count($keys); $i++) {
         $courselist[$keys[$i]]['can_enter'] = Man_Course::canEnterCourse($courselist[$keys[$i]]);
     }
     $this->render('courselist', array('path_course' => $this->path_course, 'courselist' => $courselist));
 }
コード例 #2
0
ファイル: course.php プロジェクト: abhinay100/forma_app
function dashmycourse(&$url, $lang, &$subscription, $cinfo, $index)
{
    require_once $GLOBALS['where_lms'] . '/lib/lib.levels.php';
    $lvl = CourseLevel::getLevels();
    $arr_status = array(_CUS_RESERVED => $lang->def('_T_USER_STATUS_RESERVED'), _CUS_WAITING_LIST => $lang->def('_WAITING_USERS'), _CUS_CONFIRMED => $lang->def('_T_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $lang->def('_T_USER_STATUS_SUBS'), _CUS_BEGIN => $lang->def('_T_USER_STATUS_BEGIN'), _CUS_END => $lang->def('_T_USER_STATUS_END'));
    DoceboLanguage::createInstance('course', 'lms');
    $arr_coursestatus = array(CST_PREPARATION => $lang->def('_CST_PREPARATION', 'course', 'lms'), CST_AVAILABLE => $lang->def('_CST_AVAILABLE', 'course', 'lms'), CST_EFFECTIVE => $lang->def('_CST_CONFIRMED', 'course', 'lms'), CST_CONCLUDED => $lang->def('_CST_CONCLUDED', 'course', 'lms'), CST_CANCELLED => $lang->def('_CST_CANCELLED', 'course', 'lms'));
    $course_type = $cinfo['course_type'];
    $there_material = array();
    if ($cinfo['img_othermaterial'] != '') {
        $there_material[] = '&id_course=' . $cinfo['idCourse'];
    }
    // course title -----------------------------------------------------
    $cinfo = array_merge($cinfo, $subscription['course'][$cinfo['idCourse']]);
    // -----------------------------------------------------------------
    $courseuser_st = -10;
    $html = '';
    $intest = '';
    if (!isset($subscription['edition'][$cinfo['idCourse']])) {
        $access = Man_Course::canEnterCourse($cinfo);
        $lb_param = "";
        if ($cinfo['first_is_scorm'][0] != '' && $cinfo['first_is_scorm'][0] != '0') {
            $lb_param .= ";width=" . $cinfo['first_is_scorm'][0] . "";
        }
        if ($cinfo['first_is_scorm'][1] != '' && $cinfo['first_is_scorm'][1] != '0') {
            $lb_param .= ";height=" . $cinfo['first_is_scorm'][1] . "";
        }
        $intest .= '<h2>';
        if ($access['can']) {
            $intest .= '' . ($cinfo['lang_code'] && $cinfo['lang_code'] != 'none' ? '<img src="' . getPathImage('cms') . 'language/' . $cinfo['lang_code'] . '.png" alt="' . $cinfo['lang_code'] . '" /> ' : '') . '<a class="course_enter" href="index.php?modname=course&amp;op=aula&amp;idCourse=' . $cinfo['idCourse'] . '" ' . ($cinfo['direct_play'] == 1 && $cinfo['level'] <= 3 && $cinfo['first_is_scorm'] ? ' rel="shadowbox' . $lb_param . '" title="' . $cinfo['name'] . '"' : ' title="' . $lang->def('_ENTER') . '"') . '>' . $cinfo['name'] . '</a>';
        } else {
            $intest .= '<img class="image_lock" id="locked_' . $cinfo['idCourse'] . '" src="' . getPathImage() . 'course/lock.gif" alt="' . $lang->def('_NOENTER') . '" />' . ($cinfo['lang_code'] && $cinfo['lang_code'] != 'none' ? '<img src="' . getPathImage('cms') . 'language/' . $cinfo['lang_code'] . '.png" alt="' . $cinfo['lang_code'] . '" /> ' : '') . $cinfo['name'] . '';
        }
        $intest .= '</h2>';
        // not editon
        //if($cinfo['level'] >= 4) {
        $intest .= '<p class="course_support_info">' . str_replace(array('[course_type]', '[create_date]', '[enrolled]', '[course_status]'), array($course_type, createDateDistance($cinfo['create_date'], 'catalogue', true), isset($cinfo['enrolled'][0]) ? $cinfo['enrolled'][0] : 0, $arr_coursestatus[$cinfo['course_status']]), $lang->def('_COURSE_INTRO')) . ($cinfo['date_begin'] != '0000-00-00' || $cinfo['date_end'] != '0000-00-00' ? str_replace(array('[date_begin]', '[date_end]'), array(Format::date($cinfo['date_begin'], 'date'), Format::date($cinfo['date_end'], 'date')), $lang->def('_COURSE_DATE')) : '') . '</p>';
        //}
        if ($cinfo['classrooms'] != '') {
            $intest .= '<p class="course_support_info">' . str_replace(array('[classrooms_name]', '[classrooms_location]'), array($cinfo['classrooms']['classroom'], $cinfo['classrooms']['location']), $lang->def('_IN_THE_CLASSROOM')) . '</p>';
        }
        $intest .= '<p class="course_support_info">' . $arr_status[$cinfo['user_status']] . ($cinfo['level'] >= 4 ? str_replace('[level]', $lvl[$cinfo['level']], $lang->def('_USER_LVL')) . ' ' . (trim($cinfo['code']) != '' ? '<br />[' . $cinfo['code'] . '] ' : '') : '') . '</p>';
        if (isset($access['expiring_in']) && $access['expiring_in'] != false && $access['expiring_in'] < 30) {
            $intest .= '<p class="course_support_info">' . str_replace('[expiring_in]', $access['expiring_in'], $lang->def('_EXPIRING_IN')) . '</p>';
        }
        if ($cinfo['show_result'] && $cinfo['user_status'] > _CUS_SUBSCRIBED && $cinfo['user_status'] < _CUS_SUSPEND) {
            $intest .= '<p class="course_support_info show_results">' . '<a href="index.php?modname=course&amp;op=aula&amp;idCourse=' . $cinfo['idCourse'] . '&amp;showresult=1">' . $lang->def('_SHOW_RESULTS') . '</a>' . '</p>';
        }
        $courseuser_st = $cinfo['user_status'];
    } elseif (count($subscription['edition'][$cinfo['idCourse']]) == 1) {
        // edition unique--------------------------------------------------------------------------------
        list($ed_id, $sub_info) = each($subscription['edition'][$cinfo['idCourse']]);
        $ed_info =& $cinfo['edition_list'][$ed_id];
        $cinfo['date_begin'] = $ed_info['date_begin'];
        $cinfo['date_end'] = $ed_info['date_end'];
        $access = Man_Course::canEnterCourse($cinfo);
        if ($ed_info['date_begin'] == '0000-00-00') {
            $ed_info['date_begin'] = '';
        }
        if ($ed_info['date_end'] == '0000-00-00') {
            $ed_info['date_end'] = '';
        }
        $intest = '<h2>';
        if ($access['can']) {
            $intest .= '<a class="course_enter" href="index.php?modname=course&amp;op=aula&amp;idCourse=' . $cinfo['idCourse'] . '&amp;id_e=' . $ed_id . '" ' . 'title="' . $lang->def('_ENTER') . '">' . ($cinfo['lang_code'] && $cinfo['lang_code'] != 'none' ? '<img src="' . getPathImage('cms') . 'language/' . $cinfo['lang_code'] . '.png" alt="' . $cinfo['lang_code'] . '" /> ' : '') . $ed_info['name'] . ($ed_info['date_begin'] != '' || $ed_info['date_end'] != '' ? ' <span>( ' . Format::date($ed_info['date_begin'], 'date') . ' ' . Format::date($ed_info['date_end'], 'date') . ' )</span> ' : '') . '</a>';
        } else {
            $intest .= '<img id="locked_' . $cinfo['idCourse'] . '" src="' . getPathImage() . 'course/lock.gif" alt="' . $lang->def('_NOENTER') . '" />' . ($cinfo['lang_code'] && $cinfo['lang_code'] != 'none' ? '<img src="' . getPathImage('cms') . 'language/' . $cinfo['lang_code'] . '.png" alt="' . $cinfo['lang_code'] . '" /> ' : '') . (trim($ed_info['code']) != '' ? '[' . $ed_info['code'] . '] ' : '') . $ed_info['name'] . ($ed_info['date_begin'] != '' || $ed_info['date_end'] != '' ? ' <span>( ' . Format::date($ed_info['date_begin'], 'date') . ' ' . Format::date($ed_info['date_end'], 'date') . ' )</span> ' : '');
        }
        $intest .= '</h2>';
        //if($sub_info['level'] >= 4) {
        $intest .= '<p class="course_support_info">' . str_replace(array('[course_type]', '[create_date]', '[enrolled]', '[course_status]'), array($ed_info['edition_type'], createDateDistance($cinfo['create_date'], 'catalogue', true), $cinfo['enrolled'][$ed_id], $arr_coursestatus[$ed_info['status']]), $lang->def('_COURSE_INTRO')) . '</p>';
        //}
        if ($ed_info['classrooms'] != '') {
            $intest .= '<p class="course_support_info">' . str_replace(array('[classrooms_name]', '[classrooms_location]'), array($ed_info['classrooms']['classroom'], $ed_info['classrooms']['location']), $lang->def('_IN_THE_CLASSROOM')) . '</p>';
        }
        $intest .= '<p class="course_support_info">' . $arr_status[$sub_info['user_status']] . str_replace('[level]', $lvl[$sub_info['level']], $lang->def('_USER_LVL')) . ' ' . (trim($cinfo['code']) != '' && $sub_info['level'] >= 4 ? '<br />[' . $cinfo['code'] . '] ' : '') . '</p>';
        if ($access['expiring_in'] != false && $access['expiring_in'] < 30) {
            $intest .= '<p class="course_support_info">' . str_replace('[expiring_in]', $access['expiring_in'], $lang->def('_EXPIRING_IN')) . '</p>';
        }
        $courseuser_st = $sub_info['user_status'];
    } else {
        // more than one edition ------------------------------------------------------------------------
        foreach ($subscription['edition'][$cinfo['idCourse']] as $ed_id => $sub_info) {
            //list($ed_id, $sub_info)  = each($subscription['edition'][$cinfo['idCourse']]);
            $ed_info =& $cinfo['edition_list'][$ed_id];
            $cinfo['date_begin'] = $ed_info['date_begin'];
            $cinfo['date_end'] = $ed_info['date_end'];
            $access = Man_Course::canEnterCourse($cinfo);
            if ($ed_info['date_begin'] == '0000-00-00') {
                $ed_info['date_begin'] = '';
            }
            if ($ed_info['date_end'] == '0000-00-00') {
                $ed_info['date_end'] = '';
            }
            $intest .= '<h2>';
            if ($access['can']) {
                $intest .= '<a class="course_enter" href="index.php?modname=course&amp;op=aula&amp;idCourse=' . $cinfo['idCourse'] . '&amp;id_e=' . $ed_id . '" ' . 'title="' . $lang->def('_ENTER') . '">' . ($cinfo['lang_code'] && $cinfo['lang_code'] != 'none' ? '<img src="' . getPathImage('cms') . 'language/' . $cinfo['lang_code'] . '.png" alt="' . $cinfo['lang_code'] . '" /> ' : '') . $ed_info['name'] . ($ed_info['date_begin'] != '' || $ed_info['date_end'] != '' ? ' <span>( ' . Format::date($ed_info['date_begin'], 'date') . ' ' . Format::date($ed_info['date_end'], 'date') . ' )</span> ' : '') . '</a>';
            } else {
                $intest .= '<img id="locked_' . $cinfo['idCourse'] . '" src="' . getPathImage() . 'course/lock.gif" alt="' . $lang->def('_NOENTER') . '" />' . ($cinfo['lang_code'] && $cinfo['lang_code'] != 'none' ? '<img src="' . getPathImage('cms') . 'language/' . $cinfo['lang_code'] . '.png" alt="' . $cinfo['lang_code'] . '" /> ' : '') . (trim($ed_info['code']) != '' ? '[' . $ed_info['code'] . '] ' : '') . $ed_info['name'] . ($ed_info['date_begin'] != '' || $ed_info['date_end'] != '' ? ' <span>( ' . Format::date($ed_info['date_begin'], 'date') . ' ' . Format::date($ed_info['date_end'], 'date') . ' )</span> ' : '');
            }
            $intest .= '</h2>';
            //if($sub_info['level'] >= 4) {
            $intest .= '<p class="course_support_info">' . str_replace(array('[course_type]', '[create_date]', '[enrolled]', '[course_status]'), array($ed_info['edition_type'], createDateDistance($cinfo['create_date'], 'catalogue', true), $cinfo['enrolled'][$ed_id], $arr_coursestatus[$ed_info['status']]), $lang->def('_COURSE_INTRO')) . '</p>';
            //}
            if ($ed_info['classrooms'] != '') {
                $intest .= '<p class="course_support_info">' . str_replace(array('[classrooms_name]', '[classrooms_location]'), array($ed_info['classrooms']['classroom'], $ed_info['classrooms']['location']), $lang->def('_IN_THE_CLASSROOM')) . '</p>';
            }
            $intest .= '<p class="course_support_info">' . $arr_status[$sub_info['user_status']] . str_replace('[level]', $lvl[$sub_info['level']], $lang->def('_USER_LVL')) . (trim($cinfo['code']) != '' && $sub_info['level'] >= 4 ? '<br />[' . $cinfo['code'] . '] ' : '') . '</p>';
        }
        if ($access['expiring_in'] != false && $access['expiring_in'] < 30) {
            $intest .= '<p class="course_support_info">' . str_replace('[expiring_in]', $access['expiring_in'], $lang->def('_EXPIRING_IN')) . '</p>';
        }
        $courseuser_st = $courseuser_st < $sub_info['user_status'] ? $sub_info['user_status'] : $courseuser_st;
    }
    // -----------------------------------------------------------------------------------------
    $html = '<div class="course_container' . (Get::sett('use_social_courselist') == 'on' ? ' double_height' : '') . ($index == 0 ? ' course_container_first' : '') . ($courseuser_st == _CUS_SUBSCRIBED ? ' cc_inprogress' : '') . ($courseuser_st == _CUS_BEGIN ? ' cc_begin' : '') . '">';
    if ($cinfo['use_logo_in_courselist'] == '1' && $cinfo['img_course'] != '' || Get::sett('use_social_courselist') == 'on') {
        $html .= '<div class="course_info_container">';
    }
    if ($cinfo['use_logo_in_courselist'] == '1' && $cinfo['img_course'] != '') {
        $html .= '<ul class="course_score"><li>';
        $html .= '<img height="70" src="' . $GLOBALS['where_files_relative'] . '/doceboLms/' . Get::sett('pathcourse') . $cinfo['img_course'] . '" alt="' . $lang->def('_COURSE_LOGO') . '" />';
        $html .= '</li></ul>';
    }
    $html .= $intest;
    $li = '';
    $li .= '<li class="advice_to_read">' . '<img src="' . getPathImage('lms') . 'coursecatalogue/' . ($cinfo['to_read']['advice'] != 0 ? 'adv_advice' : 'no_advice') . '.jpg" ' . ' title="' . str_replace('[advice]', $cinfo['to_read']['advice'], $lang->def('_ADVERT_ADVICE')) . '" ' . ' alt="' . str_replace('[advice]', $cinfo['to_read']['advice'], $lang->def('_ADVERT_ADVICE')) . '" />' . '</li>';
    $li .= '<li class="forum_to_read">' . '<img src="' . getPathImage('lms') . 'coursecatalogue/' . ($cinfo['to_read']['forum'] != 0 ? 'adv_forum' : 'no_forum') . '.jpg" ' . ' title="' . str_replace('[forum]', $cinfo['to_read']['forum'], $lang->def('_ADVERT_FORUM')) . '" ' . ' alt="' . str_replace('[forum]', $cinfo['to_read']['forum'], $lang->def('_ADVERT_FORUM')) . '" />' . '</li>';
    $li .= '<li class="lobj_to_read">' . '<img src="' . getPathImage('lms') . 'coursecatalogue/' . ($cinfo['to_read']['lobj'] != 0 ? 'adv_lobj' : 'no_lobj') . '.jpg" ' . ' title="' . str_replace('[lobj]', $cinfo['to_read']['lobj'], $lang->def('_ADVERT_LOBJ')) . '" ' . ' alt="' . str_replace('[lobj]', $cinfo['to_read']['lobj'], $lang->def('_ADVERT_LOBJ')) . '" />' . '</li>';
    if ($li != '') {
        $html .= '<ul class="course_advertising">' . $li . '</ul>';
    }
    // course related extra option -------------------------------------------------------------
    if (Get::sett('use_social_courselist') == 'on' || !empty($there_material)) {
        $li = '';
        if (Get::sett('use_social_courselist') == 'on') {
            $li .= '<li class="course_comment">' . '<a href="javascript:;" onclick="openComment(\'' . $cinfo['idCourse'] . '\'); return false;">' . '<span>' . $lang->def('_COMMENTS') . ' (' . (isset($cinfo['comment_count']) ? $cinfo['comment_count'] : '0') . ')</span></a>' . '</li>';
        }
        // the course material -----------------------------------------------------------------
        if (!empty($there_material)) {
            if (count($there_material) == 1) {
                // direct download of material -------------------------------------------------
                $li .= '<li class="course_materials">' . '<a href="' . $url->getUrl('op=donwloadmaterials' . array_pop($there_material)) . '">' . '<span>' . $lang->def('_MATERIALS') . '</span></a>' . '</li>';
            } else {
                // popup download of material --------------------------------------------------
                $li .= '<li class="course_materials">' . '<a href="javascript:;" onclick="openWindowWithAction(\'' . $cinfo['idCourse'] . '\', \'course_materials\'); return false;">' . '<span>' . $lang->def('_MATERIALS') . '</span></a>' . '</li>';
            }
        }
        if ($li != '') {
            $html .= '<ul class="course_related_actions">' . $li . '</ul>';
        }
    }
    /*if ($cinfo['direct_play'] == 1) {
    		$html .= '<p class="showresults">'
    			.'<a href="index.php?modname=course&amp;op=showresults&amp;id_course='.$cinfo['idCourse'].'">'
    			.'<span>'.$lang->def('_SHOW_RESULTS').'</span></a>'
    			.'</p>';
    	}*/
    // score and subscribe action ------------------------------------------------------------
    if (Get::sett('use_social_courselist') == 'on') {
        $html .= '<ul class="course_score">';
        $html .= '<li class="current_score"><span>' . $lang->def('_SCORE') . '</span><br />' . '<strong id="course_score_' . $cinfo['idCourse'] . '">' . $cinfo['course_vote'] . '</strong></li>';
        if ($cinfo['waiting'] == 0) {
            $html .= '<li class="score_it">' . '<a class="good" href="javascript:;" ' . 'onclick="course_vote(\'' . $cinfo['idCourse'] . '\', \'good\'); return false;" ' . 'title="' . $lang->def('_VOTE_GOOD_TITLE') . '">' . '<img id="score_image_good_' . $cinfo['idCourse'] . '" src="' . getPathImage() . 'coursecatalogue/good' . ($cinfo['user_score'] == '1' ? '_grey' : '') . '.png" alt="' . $lang->def('_VOTE_GOOD_ALT') . ' : ' . strip_tags($cinfo['name']) . '" />' . '</a> ' . '<a class="bad" href="javascript:;" ' . 'onclick="course_vote(\'' . $cinfo['idCourse'] . '\', \'bad\'); return false;" ' . 'title="' . $lang->def('_VOTE_BAD_TITLE') . '">' . '<img id="score_image_bad_' . $cinfo['idCourse'] . '" src="' . getPathImage() . 'coursecatalogue/bad' . ($cinfo['user_score'] == '-1' ? '_grey' : '') . '.png" alt="' . $lang->def('_VOTE_BAD_ALT') . ' : ' . strip_tags($cinfo['name']) . '" />' . '</a>' . '</li>';
        } else {
            $li .= '<li class="score_it" id="score_action_' . $cinfo['idCourse'] . '">' . '<img src="' . getPathImage() . 'coursecatalogue/good_grey.png" alt="' . $lang->def('_VOTE_GOOD_ALT') . ' : ' . strip_tags($cinfo['name']) . '" /> ' . '<img src="' . getPathImage() . 'coursecatalogue/bad_grey.png" alt="' . $lang->def('_VOTE_BAD_ALT') . ' : ' . strip_tags($cinfo['name']) . '" />' . '</li>';
        }
        $html .= '</ul>';
    }
    if ($cinfo['use_logo_in_courselist'] == '1' && $cinfo['img_course'] != '' || Get::sett('use_social_courselist') == 'on') {
        $html .= '</div>';
    }
    $html .= '</div>';
    return $html;
}
コード例 #3
0
ファイル: coursepath.php プロジェクト: abhinay100/forma_app
            if ($prerequisites !== '') {
                $num_prerequisites = count(explode(',', $prerequisites));
                $query = "SELECT COUNT(*)" . " FROM %lms_courseuser" . " WHERE idCourse IN (" . $prerequisites . ") AND idUser = "******" " . " AND status = " . _CUS_END;
                list($control) = sql_fetch_row(sql_query($query));
                if ($control < $num_prerequisites) {
                    $unlock = false;
                }
            }
        }
        if ($course_info['status'] == _CUS_END) {
            $ico_style = 'subs_actv';
            $ico_text = '_COURSE_COMPLETED';
        } elseif (!$unlock) {
            $ico_style = 'subs_locked';
            $ico_text = '_COURSE_LOCKED';
        } else {
            $ico_style = 'subs_noac';
            $ico_text = '_COURSE_ACTIVE';
        }
        $query_control_info = "SELECT c.idCourse, c.course_type, c.idCategory, c.code, c.name, c.description, c.difficult, c.status AS course_status, c.course_edition, " . "\tc.max_num_subscribe, c.create_date, " . "\tc.direct_play, c.img_othermaterial, c.course_demo, c.use_logo_in_courselist, c.img_course, c.lang_code, " . "\tc.course_vote, " . "\tc.date_begin, c.date_end, c.valid_time, c.show_result, c.userStatusOp," . "\tcu.status AS user_status, cu.level, cu.date_inscr, cu.date_first_access, cu.date_complete, cu.waiting" . " FROM %lms_course AS c " . " JOIN %lms_courseuser AS cu ON (c.idCourse = cu.idCourse) " . " WHERE c.idCourse = " . $id_course;
        $accesso_control_info = sql_fetch_assoc(sql_query($query_control_info));
        $course_access = Man_Course::canEnterCourse($accesso_control_info, $id_path);
        echo '<tr>' . '<td><span class="ico-sprite ' . $ico_style . '"><span>' . Lang::t($ico_text, 'coursepath') . '</span></span></td>' . '<td class="course_type">' . Lang::t('_' . strtoupper($course_info['course_type']), 'coursepath') . '</td>' . '<td>' . ($course_access['can'] ? '<a class="std_link" href="index.php?modname=course&amp;op=aula&amp;idCourse=' . $course_info['idCourse'] . '">' : '') . $course_info['name'] . ($course_access['can'] ? '</a>' : '') . '</td>' . '</tr>';
    }
    echo '</table>' . '</div>' . '<div class="nofloat"></div>' . '</div>';
    if ($first) {
        $first = false;
    } else {
        echo '<br />';
    }
}
コード例 #4
0
 public function completedTask()
 {
     $model = new ClassroomLms();
     $filter_text = Get::req('filter_text', DOTY_STRING, "");
     $filter_year = Get::req('filter_year', DOTY_INT, 0);
     $conditions = array('cu.iduser = :id_user', 'cu.status = :status');
     $params = array(':id_user' => (int) Docebo::user()->getId(), ':status' => _CUS_END);
     if (!empty($filter_text)) {
         $conditions[] = "(c.code LIKE '%:keyword%' OR c.name LIKE '%:keyword%')";
         $params[':keyword'] = $filter_text;
     }
     if (!empty($filter_year)) {
         $clist = $model->getUserCoursesByYear(Docebo::user()->getId(), $filter_year);
         if ($clist !== false) {
             $conditions[] = "cu.idCourse IN (" . implode(",", $clist) . ")";
         }
     }
     $courselist = $model->findAll($conditions, $params);
     //check courses accessibility
     $keys = array_keys($courselist);
     for ($i = 0; $i < count($keys); $i++) {
         $courselist[$keys[$i]]['can_enter'] = Man_Course::canEnterCourse($courselist[$keys[$i]]);
     }
     require_once _lms_ . '/lib/lib.middlearea.php';
     $ma = new Man_MiddleArea();
     $this->render('courselist', array('path_course' => $this->path_course, 'courselist' => $courselist, 'use_label' => $ma->currentCanAccessObj('tb_label'), 'display_info' => $this->_getClassDisplayInfo($keys), 'dm' => new DateManager(), 'keyword' => $filter_text));
 }
コード例 #5
0
ファイル: api.user.php プロジェクト: abhinay100/forma_app
 public function getMyCourses($id_user, $params = false)
 {
     require_once _lms_ . '/lib/lib.course.php';
     $output = array();
     $output['success'] = true;
     $search = array('cu.iduser = :id_user');
     $search_params = array(':id_user' => $id_user);
     if (!empty($params['filter'])) {
         switch ($params['filter']) {
             case 'completed':
                 $search[] = 'cu.status = :status';
                 $search_params[':status'] = _CUS_END;
                 break;
             case 'notcompleted':
                 $search[] = 'cu.status >= :status_from';
                 $search_params[':status_from'] = _CUS_SUBSCRIBED;
                 $search[] = 'cu.status < :status_to';
                 $search_params[':status_to'] = _CUS_END;
                 break;
             case 'notstarted':
                 $search[] = 'cu.status = :status';
                 $search_params[':status'] = _CUS_SUBSCRIBED;
                 break;
         }
     }
     $model = new CourseLms();
     $course_list = $model->findAll($search, $search_params);
     //check courses accessibility
     $keys = array_keys($course_list);
     for ($i = 0; $i < count($keys); $i++) {
         $course_list[$keys[$i]]['can_enter'] = Man_Course::canEnterCourse($course_list[$keys[$i]]);
     }
     //$output['log']=var_export($course_list, true);
     foreach ($course_list as $key => $course_info) {
         $output[]['course_info'] = array('course_id' => $course_info['idCourse'], 'course_name' => str_replace('&', '&amp;', $course_info['name']), 'course_description' => str_replace('&', '&amp;', $course_info['description']), 'course_link' => Get::sett('url') . _folder_lms_ . '/index.php?modname=course&amp;op=aula&amp;idCourse=' . $course_info['idCourse']);
     }
     return $output;
 }
コード例 #6
0
ファイル: lib.course.php プロジェクト: abhinay100/forma_app
function logIntoCourse($id_course, $gotofirst_page = true)
{
    // Reset previous opened track session if any
    if (!Docebo::user()->isAnonymous() && isset($_SESSION['idCourse'])) {
        require_once _lms_ . '/lib/lib.track_user.php';
        TrackUser::setActionTrack(getLogUserId(), $_SESSION['idCourse'], '', '');
    }
    // Unset possibile previous session setting
    if (isset($_SESSION['direct_play'])) {
        unset($_SESSION['direct_play']);
    }
    $re_course = sql_query("\r\n\tSELECT level, status, waiting\r\n\tFROM %lms_courseuser\r\n\tWHERE idCourse = " . (int) $id_course . " AND idUser = "******"");
    list($level_c, $status_user, $waiting_user) = sql_fetch_row($re_course);
    Docebo::setCourse($id_course);
    $course_info = Docebo::course()->getAllInfo();
    $course_info['course_status'] = $course_info['status'];
    $course_info['user_status'] = $status_user;
    $course_info['waiting'] = $waiting_user;
    $course_info['level'] = $level_c;
    // Can the user enter into the course ?
    if (!Man_Course::canEnterCourse($course_info)) {
        return false;
    }
    // Disable tracking for ghost level
    $_SESSION['is_ghost'] = $course_info['level'] == 2 ? true : false;
    // If it's the first time we need to change the course status
    if ($course_info['user_status'] == _CUS_SUBSCRIBED) {
        require_once _lms_ . '/lib/lib.stats.php';
        saveTrackStatusChange(getLogUserId(), $id_course, _CUS_BEGIN);
    }
    // Setup some session data
    $_SESSION['timeEnter'] = date("Y-m-d H:i:s");
    $_SESSION['idCourse'] = $id_course;
    $_SESSION['levelCourse'] = $course_info['level'];
    //we need to redo this
    //$_SESSION['idEdition'] 		= $id_e;
    Docebo::user()->loadUserSectionST('/lms/course/private/' . $course_info['level'] . '/');
    Docebo::user()->SaveInSession();
    // Initialize the session into the course
    TrackUser::createSessionCourseTrack();
    $first_page = firstPage();
    $_SESSION['current_main_menu'] = $first_page['idMain'];
    $_SESSION['sel_module_id'] = $first_page['idModule'];
    $jumpurl = 'index.php?modname=' . $first_page['modulename'] . '&op=' . $first_page['op'] . '&id_module_sel=' . $first_page['idModule'];
    // course in direct play or assessment
    if ($course_info['direct_play'] == 1 || $course_info['course_type'] == 'assessment') {
        if ($_SESSION['levelCourse'] >= 4) {
            // direct play with a teacher, basically it's not ok
            // check if we are managing the LOs from admin: if yes, jump into the test management
            if ($course_info['course_type'] == 'assessment' && Get::req('from_admin', DOTY_INT, 0) > 0) {
                // enter the assessment course and go to test editing if there is a test with no question in it
                $query = "SELECT idOrg, idResource " . " FROM %lms_organization " . " WHERE idCourse = " . (int) $_SESSION['idCourse'] . " AND objectType = 'test' " . " ORDER BY path ASC, title ASC " . " LIMIT 0,1";
                $res = sql_query($query);
                if ($res && sql_num_rows($res) > 0) {
                    list($id_org, $id_test) = sql_fetch_row($res);
                    if ($id_test > 0) {
                        require_once _lms_ . '/lib/lib.test.php';
                        $tman = new TestManagement($id_test);
                        if ($tman->getNumberOfQuestion() <= 0) {
                            Util::jump_to('index.php?modname=test&op=modtestgui&idTest=' . $id_test . '&back_url=' . urlencode($jumpurl));
                        }
                    }
                }
            }
        } else {
            // direct play with a student
            // i need to play directly the course if it's not completed and is the only object of the course
            require_once _lms_ . '/lib/lib.orgchart.php';
            $orgman = new OrganizationManagement($_SESSION['idCourse']);
            $first_lo =& $orgman->getInfoWhereType(false, $_SESSION['idCourse']);
            if (count($first_lo) == 1) {
                $_SESSION['direct_play'] = 1;
                $obj = array_shift($first_lo);
                Util::jump_to('index.php?modname=organization&op=custom_playitem&id_item=' . $obj['id_org'] . '');
            } elseif (count($first_lo) >= 2) {
                $obj = array_shift($first_lo);
                // if we have more than an object we need to play the first one until it's completed
                $query = "SELECT status FROM %lms_commontrack WHERE idReference = " . (int) $obj['id_org'] . " AND idUser = "******"assessment") {
    		//check if we are managing the LOs from admin: if yes, jump into the test management
    		if (Get::req('from_admin', DOTY_INT, 0) > 0) {
    			//enter the assessment course and go to test editing
    			$query = "SELECT idOrg, idResource FROM %lms_organization WHERE idCourse=".(int)$_SESSION['idCourse']." AND objectType='test' "
    				." ORDER BY path ASC, title ASC LIMIT 0,1";
    			$res = sql_query($query);
    			if ($res && sql_num_rows($res)>0) {
    
    				list($id_org, $id_test) = sql_fetch_row($res);
    
    				if ($id_test > 0) {
    					require_once(_lms_.'/lib/lib.test.php');
    					$tman = new TestManagement($id_test);
    
    					if ($tman->getNumberOfQuestion() <= 0) {
    						Util::jump_to('index.php?modname=test&op=modtestgui&idTest='.$id_test.'&back_url='.urlencode($jumpurl));
    					}
    				}
    			}
    		}
    	}
    	if($gotofirst_page) Util::jump_to($jumpurl);
    	else return true;
    }
    
    
    switch($course_info['course_type']) {
    	case "assessment" : {
    
    		if($_SESSION['levelCourse'] <= 3) {
    
    			// i need to play directly the test
    			require_once($GLOBALS['where_lms'].'/lib/lib.orgchart.php');
    			$orgman = new OrganizationManagement($_SESSION['idCourse']);
    			$test =& $orgman->getInfoWhereType('test', $_SESSION['idCourse']);
    
    			if(count($test) == 1) {
    				$obj = array_shift($test);
    				$_SESSION['test_assessment'] = 1;
    				Util::jump_to('index.php?modname=organization&op=custom_playitem&id_item='.$obj['id_org'].'');
    			}
    			if($gotofirst_page) Util::jump_to($jumpurl);
    			else return true;
    		} else {
    			if($gotofirst_page) {
    				//...
    				Util::jump_to($jumpurl);
    			}
    			else return true;
    		}
    	};break;
    	default: {
    		if($gotofirst_page) Util::jump_to($jumpurl);
    		else return true;
    	}
    }
    /* not used in
    // now analyze the course type and select the acton to perform
    if(isset($_GET['showresult'])) {
    
    	require_once(_lms_.'/lib/lib.orgchart.php');
    	$orgman = new OrganizationManagement($_SESSION['idCourse']);
    	$scorm =& $orgman->getInfoWhereType('scormorg', $_SESSION['idCourse']);
    
    	if(count($scorm) == '1') {
    		$obj = array_shift($scorm);
    		Util::jump_to('index.php?modname=organization&op=scorm_track&id_user='******'&id_org='.$obj['id_resource'].'&amp;back='.$GLOBALS['course_descriptor']->getValue('direct_play'));
    	}
    	Util::jump_to('index.php?modname=course&op=showresults&id_course='.$_SESSION['idCourse']);
    }
    */
}
コード例 #7
0
/**
 * this course simply print the course box, we need to provide all the information ,
 * this function only display the information collected by other function
 * @param array $cinfo it must containt [ idCourse, code, name, description, create_date,
 * 						number_of_subscription, type_of, materials, demo, teacher_list, score, if_user_alredy_scored_this,
 * 						 prize, is_sell, alredy_subscribed, type_of_subscription
 *
 * 						idCourse, course_type, idCategory, code, name, description, lang_code, difficult,
 *						subscribe_method, date_begin, date_end, max_num_subscribe,
 *						selling, prize, create_date, course_status, course_edition,
 *						classrooms, course_demo, course_vote, enrolled
 *
 * @param int $index the number of object visualized
 */
function dashcourse(&$url, &$lang, &$cinfo, $uc_status, $index, $enable_actions = true, $h_number = 2)
{
    $has_edition = $cinfo['course_edition'];
    YuiLib::load(array('animation' => 'my_animation'));
    $course_type = $cinfo['course_type'];
    $action = relationWithCourse($cinfo['idCourse'], $cinfo, $uc_status, false);
    $there_material = array();
    $lang_c =& DoceboLanguage::createInstance('course', 'lms');
    if (!defined("_ECOM_CURRENCY")) {
        $currency_label = getPLSetting("ecom", "currency_label", "");
        define("_ECOM_CURRENCY", $currency_label);
    }
    $cs = array(CST_PREPARATION => $lang_c->def('_CST_PREPARATION', 'course', 'lms'), CST_AVAILABLE => $lang_c->def('_CST_AVAILABLE', 'course', 'lms'), CST_EFFECTIVE => $lang_c->def('_CST_CONFIRMED', 'course', 'lms'), CST_CONCLUDED => $lang_c->def('_CST_CONCLUDED', 'course', 'lms'), CST_CANCELLED => $lang_c->def('_CST_CANCELLED', 'course', 'lms'));
    if ($cinfo['img_material'] != '') {
        $there_material[] = '&id_course=' . $cinfo['idCourse'];
    }
    $html = '<div class="course_container' . (Get::sett('use_social_courselist') == 'on' ? ' double_height' : ' normal_height') . ($index == 0 ? ' course_container_first' : '') . '">';
    $html .= '<div class="course_info_container">' . '<h' . $h_number . '>' . ($cinfo['lang_code'] ? '<img src="' . getPathImage('cms') . 'language/' . $cinfo['lang_code'] . '.png" alt="' . $cinfo['lang_code'] . '" /> ' : '') . $cinfo['name'] . '</h' . $h_number . '>';
    if ($cinfo['classrooms'] != '') {
        $html .= str_replace(array('[classrooms_name]', '[classrooms_location]'), array($cinfo['classrooms']['classroom'], $cinfo['classrooms']['location']), $lang->def('_IN_THE_CLASSROOM'));
    }
    // -----------------------------------------------------------------
    if (!$has_edition) {
        $html .= '<p class="course_support_info">';
        // number of subscription not limited
        if ($cinfo['max_num_subscribe'] == 0) {
            $html .= str_replace(array('[course_type]', '[create_date]', '[enrolled]', '[course_status]'), array($course_type, createDateDistance($cinfo['create_date'], 'catalogue', true), $cinfo['enrolled'], $cs[$cinfo['course_status']]), $lang->def('_COURSE_INTRO')) . ' [' . $cinfo['code'] . '] ';
        } else {
            // limited number of subscription
            $html .= str_replace(array('[course_type]', '[create_date]', '[enrolled]', '[course_status]', '[max_subscribe]'), array($course_type, createDateDistance($cinfo['create_date'], 'catalogue', true), $cinfo['enrolled'], $cs[$cinfo['course_status']], $cinfo['max_num_subscribe']), $lang->def('_COURSE_INTRO_WITH_MAX'));
            if ($cinfo['enrolled'] >= $cinfo['max_num_subscribe'] && $cinfo['allow_overbooking'] == '1') {
                // limited number of subscription reached
                $html .= '<br/>' . $lang->def('_CAN_JOIN_WAITING_LIST');
            }
        }
        if ($cinfo['min_num_subscribe'] != 0) {
            $html .= '<br/>' . str_replace('[min_subscribe]', $cinfo['min_num_subscribe'], $lang->def('_MIN_SUBSCRIBE_FOR_COURSE'));
        }
        $html .= '</p>';
    }
    // --------------------
    if (trim($cinfo['description']) == '') {
        $html .= '';
    } elseif (strpos($cinfo['description'], '<p') === false) {
        $html .= '<p class="course_description">' . $cinfo['description'] . '</p>';
    } else {
        $html .= '<div class="course_description">' . $cinfo['description'] . '</div>';
    }
    if (empty($cinfo['edition_list']) && $has_edition) {
        $html .= '<img src="' . getPathImage('lms') . 'coursecatalogue/editions.png" alt="' . $lang->def('_EDITIONs') . '" /> ' . $lang->def('_NO_CONTENT');
    } elseif ($has_edition) {
        // edition list actions ---------------------------------------------------
        $html .= '<p class="editions_actions">';
        $html .= '<img src="' . getPathImage('lms') . 'coursecatalogue/editions.png" alt="' . $lang->def('_EDITIONs') . '" /> ';
        $html .= '<a id="course_edition_' . $cinfo['idCourse'] . '_open" class="course_editions_expand" href="javascript:;" onclick="
			YAHOO.Animation.BlindIn(\'course_edition_' . $cinfo['idCourse'] . '\', \'\');
			YAHOO.util.Dom.get(\'course_edition_' . $cinfo['idCourse'] . '_open\').style.display = \'none\';
			YAHOO.util.Dom.get(\'course_edition_' . $cinfo['idCourse'] . '_close\').style.display = \'inline\';
			return false;">' . str_replace(array('[edition_count]', '[edition_available]'), array(count($cinfo['edition_list']), $cinfo['edition_available']), $lang->def('_SHOW_COURSE_EDITION')) . '</a>';
        $html .= '<a id="course_edition_' . $cinfo['idCourse'] . '_close" class="course_editions_collapse" href="javascript:;" onclick="
			YAHOO.Animation.BlindOut(\'course_edition_' . $cinfo['idCourse'] . '\');
			YAHOO.util.Dom.get(\'course_edition_' . $cinfo['idCourse'] . '_close\').style.display = \'none\';
			YAHOO.util.Dom.get(\'course_edition_' . $cinfo['idCourse'] . '_open\').style.display = \'inline\';
			return false;">' . $lang->def('_HIDE_COURSE_EDITION') . '</a>' . '</p>';
        // edition list show -------------------------------------------------------------------------
        $html .= '<ul id="course_edition_' . $cinfo['idCourse'] . '" class="course_editions">';
        while (list($id_edition, $ed_info) = each($cinfo['edition_list'])) {
            if ($ed_info['img_material'] != '') {
                $there_material[] = '&id_course=' . $cinfo['idCourse'] . '&edition_id' . $ed_info['idCourseEdition'];
            }
            $html .= '<li><b class="course_title">[' . $ed_info['code'] . '] ' . $ed_info['name'] . '</b><p>';
            if ($ed_info['date_begin'] != '0000-00-00' && $ed_info['date_end'] != '0000-00-00' || $ed_info['classrooms'] != '') {
                $html .= $lang->def('_EDITIONS');
            }
            if ($ed_info['date_begin'] != '0000-00-00' && $ed_info['date_end'] != '0000-00-00') {
                $html .= ' ' . str_replace(array('[date_begin]', '[date_end]'), array(Format::date($ed_info['date_begin'], 'date'), Format::date($ed_info['date_end'], 'date')), $lang->def('_EDTION_TIME'));
            }
            if ($ed_info['classrooms'] != '') {
                $html .= str_replace(array('[classrooms_name]', '[classrooms_location]'), array($ed_info['classrooms']['classroom'], $ed_info['classrooms']['location']), $lang->def('_IN_THE_CLASSROOM'));
            }
            if ($ed_info['date_begin'] != '0000-00-00' && $ed_info['date_end'] != '0000-00-00' || $ed_info['classrooms'] != '') {
                $html .= '<br />';
            }
            if ($ed_info['max_num_subscribe'] == 0) {
                $html .= str_replace(array('[user_count]', '[waiting_count]', ' su [max_user]'), array($ed_info['user_count'], $ed_info['waiting'], ''), $lang->def('_USER_EDITION_SUBSCRIBE')) . '</p>';
            } else {
                $html .= str_replace(array('[user_count]', '[waiting_count]', '[max_user]'), array($ed_info['user_count'], $ed_info['waiting'], $ed_info['max_num_subscribe']), $lang->def('_USER_EDITION_SUBSCRIBE')) . '</p>';
            }
            if ($ed_info['user_count'] != '' && $ed_info['date_end'] != '0000-00-00' || $ed_info['classrooms'] != '') {
                $html .= '<br />';
            }
            // number of subscription not limited
            /*if($ed_info['max_num_subscribe'] == 0) {
            
            				$html .= str_replace(	array('[user_count]', '[waiting_count]', ' su [max_user]'),
            										array($ed_info['user_count'], $ed_info['waiting'], ''),
            										$lang->def('_USER_EDITION_SUBSCRIBE') );
            			} else {
            
            				// limited number of subscription
            				$html .= str_replace(	array('[user_count]', '[max_subscribe]', '[waiting_count]'),
            										array($ed_info['user_count'], $ed_info['max_num_subscribe'], $ed_info['waiting']),
            										$lang->def('_USER_EDITION_SUBSCRIBE_WITH_MAX') );
            
            				if($ed_info['user_count'] >= $ed_info['max_num_subscribe'] && $ed_info['allow_overbooking'] == '1') {
            
            					// limited number of subscription reached
            					$html .= '<br/>'.$lang->def('_CAN_JOIN_WAITING_LIST');
            				}
            			}
            			if($ed_info['min_num_subscribe'] != 0) {
            				$html .= '<br/>'.str_replace('[min_subscribe]', $cinfo['min_num_subscribe'], $lang->def('_MIN_SUBSCRIBE_FOR_EDITION'));
            			}
            			$html .= '</p>';*/
            // theacher list ----------------------------------------------------------
            if (Get::sett('use_social_courselist') == 'on') {
                if (isset($ed_info['theacher_list']) && is_array($ed_info['theacher_list']) && !empty($ed_info['theacher_list'])) {
                    $html .= '<h3 class="course_teacher_list">' . $lang->def('_THEACER_LIST') . '</h3>' . '<ul class="course_teacher_list">';
                    while (list(, $id_teach) = each($ed_info['theacher_list'])) {
                        $profile = new UserProfile($id_teach);
                        $profile->init('profile', 'framework', '', 'ap');
                        $html .= '<li class="the_course">' . '<a href="' . $url->getUrl('op=showprofile&id_course=' . $cinfo['idCourse'] . '&id_user='******'">' . $profile->getUserPhotoOrAvatar('micro') . ' ' . $profile->resolveUsername() . '</a></li>';
                    }
                    $html .= '</ul>';
                }
            }
            $html .= '</li>';
        }
        $html .= '</ul>';
        $html .= '<script type="text/javascript">
			YAHOO.util.Dom.get(\'course_edition_' . $cinfo['idCourse'] . '\').style.display = \'none\';
			YAHOO.util.Dom.get(\'course_edition_' . $cinfo['idCourse'] . '_close\').style.display = \'none\';
		</script>';
    } elseif (Get::sett('use_social_courselist') == 'on') {
        // theacher list ----------------------------------------------------------
        if (isset($cinfo['theacher_list']) && is_array($cinfo['theacher_list']) && !empty($cinfo['theacher_list'])) {
            $html .= '<h3 class="course_teacher_list">' . $lang->def('_THEACER_LIST') . '</h3>' . '<ul class="course_teacher_list">';
            while (list(, $id_teach) = each($cinfo['theacher_list'])) {
                $profile = new UserProfile($id_teach);
                $profile->init('profile', 'framework', '', 'ap');
                $html .= '<li>' . '<a href="' . $url->getUrl('op=showprofile&id_course=' . $cinfo['idCourse'] . '&id_user='******'">' . $profile->getUserPhotoOrAvatar('micro') . ' ' . $profile->resolveUsername() . '</a></li>';
            }
            $html .= '</ul>';
        }
    }
    // course related extra option ---------------------------------------------
    if (Get::sett('use_social_courselist') == 'on' || !empty($there_material) || $cinfo['course_demo'] != '') {
        $html .= '<ul class="course_related_actions">';
        if (Get::sett('use_social_courselist') == 'on') {
            $html .= '<li class="course_comment">' . '<a href="javascript:;" onclick="openComment(\'' . $cinfo['idCourse'] . '\'); return false;">' . '<span>' . $lang->def('_COMMENTS') . ' (' . (isset($cinfo['comment_count']) ? $cinfo['comment_count'] : '0') . ')</span></a></li>';
        }
        // the course material -----------------------------------------------------------------
        if (!empty($there_material)) {
            if (count($there_material) == 1) {
                // direct download of material -------------------------------------------------
                $html .= '<li class="course_materials">' . '<a href="' . $url->getUrl('op=donwloadmaterials' . array_pop($there_material)) . '">' . '<span>' . $lang->def('_MATERIALS') . '</span></a></li>';
            } else {
                // popup download of material --------------------------------------------------
                $html .= '<li class="course_materials">' . '<a href="javascript:;" onclick="openWindowWithAction(\'' . $cinfo['idCourse'] . '\', \'course_materials\'); return false;">' . '<span>' . $lang->def('_MATERIALS') . '</span></a></li>';
            }
        }
        // the course demo link ----------------------------------------------------------------
        if ($cinfo['course_demo'] != '') {
            require_once _base_ . '/lib/lib.multimedia.php';
            $ext = end(explode('.', $cinfo['course_demo']));
            if (isPossibleEmbedPlay('/appLms/' . Get::sett('pathcourse'), $cinfo['course_demo'], $ext)) {
                // play demo in popup ---------------------------------------------------------
                $html .= '<li class="course_demo">' . '<a href="javascript:;" onclick="openWindowWithAction(\'' . $cinfo['idCourse'] . '\', \'play_demo\'); return false;">' . '<span>' . $lang->def('_DEMO') . '</span></a></li>';
            } else {
                // download demo --------------------------------------------------------------
                $html .= '<li class="course_demo">' . '<a href="' . $url->getUrl('op=showdemo&id_course=' . $cinfo['idCourse']) . '">' . '<span>' . $lang->def('_DEMO') . '</span></a></li>';
            }
        }
        $html .= '</ul>';
    }
    $html .= '</div>';
    // score and subscribe action ----------------------------------------------
    $html .= '<ul class="course_score">';
    if ($enable_actions) {
        if ($has_edition) {
            list($edition_for_enter) = sql_fetch_row(sql_query("SELECT edition_id" . " FROM " . $GLOBALS['prefix_lms'] . "_courseuser" . " WHERE idUser = '******'" . " AND idCourse = '" . $cinfo['idCourse'] . "'" . " ORDER BY edition_id DESC" . " LIMIT 0,1"));
        }
        if ($cinfo['first_is_scorm'] != false && $cinfo['direct_play']) {
            $lb_param = "";
            if ($cinfo['first_is_scorm'][0] != '' && $cinfo['first_is_scorm'][0] != '0') {
                $lb_param .= ";width=" . $cinfo['first_is_scorm'][0] . "";
            }
            if ($cinfo['first_is_scorm'][1] != '' && $cinfo['first_is_scorm'][1] != '0') {
                $lb_param .= ";height=" . $cinfo['first_is_scorm'][1] . "";
            }
        }
        if ($action[0] == 'subscribed') {
            $access = Man_Course::canEnterCourse($cinfo);
        }
        $html .= '<li id="action_of_' . $cinfo['idCourse'] . '" class="third_action ' . $action[0] . '">' . ($action[1] != false ? '<a href="javascript:;"' . ' onclick="openWindowWithAction(\'' . $cinfo['idCourse'] . '\', \'course_action_confirm' . ($has_edition ? '_edition' : '') . '\'); return false;">' : '') . ($action[0] == 'subscribed' && $access['can'] ? '<a href="index.php?modname=course&op=aula&idCourse=' . $cinfo['idCourse'] . ($has_edition ? '&amp;id_e=' . $edition_for_enter : '') . '"' . ($cinfo['direct_play'] == 1 && $cinfo['level'] <= 3 && $cinfo['first_is_scorm'] ? ' rel="shadowbox' . $lb_param . '" title="' . $cinfo['name'] . '"' : ' title="' . $lang->def('_ENTER') . '"') . '>' . $lang->def('_ENTER') . '</a>' : $lang->def('_' . strtoupper($action[0])) . '<br />');
        switch ($action[0]) {
            case "can_buy":
            case "can_reserve":
                $html .= $cinfo['prize'] . ' ' . _ECOM_CURRENCY;
                break;
        }
        $html .= ($action[2] != false ? '<img src="' . getPathImage() . 'coursecatalogue/' . $action[2] . '" ' . 'alt="' . $lang->def('_ALT_' . strtoupper($action[0])) . '"/>' : '') . ($action[1] != false ? '</a>' : '') . '</li>';
    }
    if (Get::sett('use_social_courselist') == 'on') {
        $html .= '<li class="current_score"><span>' . $lang->def('_SCORE') . '</span><br />' . '<strong id="course_score_' . $cinfo['idCourse'] . '">' . $cinfo['course_vote'] . '</strong></li>';
        if ($uc_status != false && $uc_status['waiting'] == 0) {
            $html .= '<li class="score_it">' . '<a class="good" href="javascript:;" ' . 'onclick="course_vote(\'' . $cinfo['idCourse'] . '\', \'good\'); return false;" ' . 'title="' . $lang->def('_VOTE_GOOD_TITLE') . '">' . '<img id="score_image_good_' . $cinfo['idCourse'] . '" src="' . getPathImage() . 'coursecatalogue/good' . ($cinfo['user_score'] == '1' ? '_grey' : '') . '.png" alt="' . $lang->def('_VOTE_GOOD_ALT') . ' : ' . strip_tags($cinfo['name']) . '" />' . '</a> ' . '<a class="bad" href="javascript:;" ' . 'onclick="course_vote(\'' . $cinfo['idCourse'] . '\', \'bad\'); return false;" ' . 'title="' . $lang->def('_VOTE_BAD_TITLE') . '">' . '<img id="score_image_bad_' . $cinfo['idCourse'] . '" src="' . getPathImage() . 'coursecatalogue/bad' . ($cinfo['user_score'] == '-1' ? '_grey' : '') . '.png" alt="' . $lang->def('_VOTE_BAD_ALT') . ' : ' . strip_tags($cinfo['name']) . '" />' . '</a>' . '</li>';
        } else {
            $html .= '<li class="score_it" id="score_action_' . $cinfo['idCourse'] . '">' . '<img src="' . getPathImage() . 'coursecatalogue/good_grey.png" alt="' . $lang->def('_VOTE_GOOD_ALT') . ' : ' . strip_tags($cinfo['name']) . '" /> ' . '<img src="' . getPathImage() . 'coursecatalogue/bad_grey.png" alt="' . $lang->def('_VOTE_BAD_ALT') . ' : ' . strip_tags($cinfo['name']) . '" />' . '</li>';
        }
    }
    $html .= '</ul>';
    $html .= '</div>';
    return $html;
}
コード例 #8
0
 public function allTask()
 {
     $model = new ElearningLms();
     $filter_text = Get::req('filter_text', DOTY_STRING, "");
     $filter_year = Get::req('filter_year', DOTY_INT, 0);
     $conditions = array('cu.iduser = :id_user', 'cu.status <> :status');
     $params = array(':id_user' => (int) Docebo::user()->getId(), ':status' => _CUS_END);
     if (!empty($filter_text)) {
         $conditions[] = "(c.code LIKE '%:keyword%' OR c.name LIKE '%:keyword%')";
         $params[':keyword'] = $filter_text;
     }
     if (!empty($filter_year)) {
         $conditions[] = "(cu.date_inscr >= ':year-00-00 00:00:00' AND cu.date_inscr <= ':year-12-31 23:59:59')";
         $params[':year'] = $filter_year;
     }
     //		$cp_courses = $model->getUserCoursePathCourses( Docebo::user()->getIdst() );
     //		if (!empty($cp_courses)) {
     //			$conditions[] = "cu.idCourse NOT IN (".implode(",", $cp_courses).")";
     //		}
     $courselist = $model->findAll($conditions, $params);
     //check courses accessibility
     $keys = array_keys($courselist);
     for ($i = 0; $i < count($keys); $i++) {
         $courselist[$keys[$i]]['can_enter'] = Man_Course::canEnterCourse($courselist[$keys[$i]]);
     }
     require_once _lms_ . '/lib/lib.middlearea.php';
     $ma = new Man_MiddleArea();
     $this->render('courselist', array('path_course' => $this->path_course, 'courselist' => $courselist, 'use_label' => $ma->currentCanAccessObj('tb_label'), 'keyword' => $filter_text));
 }