Пример #1
0
 public function showTask()
 {
     require_once _lms_ . '/lib/lib.middlearea.php';
     $ma = new Man_MiddleArea();
     $block_list = array();
     //if($ma->currentCanAccessObj('user_details_short')) $block_list['user_details_short'] = true;
     if ($ma->currentCanAccessObj('user_details_full')) {
         $block_list['user_details_full'] = true;
     }
     if ($ma->currentCanAccessObj('credits')) {
         $block_list['credits'] = true;
     }
     if ($ma->currentCanAccessObj('news')) {
         $block_list['news'] = true;
     }
     $tb_label = $ma->currentCanAccessObj('tb_label');
     if (!$tb_label) {
         $_SESSION['id_common_label'] = 0;
     } else {
         $id_common_label = Get::req('id_common_label', DOTY_INT, -1);
         if ($id_common_label >= 0) {
             $_SESSION['id_common_label'] = $id_common_label;
         } elseif ($id_common_label == -2) {
             $_SESSION['id_common_label'] = -1;
         }
         $block_list['labels'] = true;
     }
     if ($tb_label && $_SESSION['id_common_label'] == -1) {
         require_once _lms_ . '/admin/models/LabelAlms.php';
         $label_model = new LabelAlms();
         $user_label = $label_model->getLabelForUser(Docebo::user()->getId());
         $this->render('_labels', array('block_list' => $block_list, 'label' => $user_label));
     } else {
         if (!empty($block_list)) {
             $this->render('_tabs_block', array('block_list' => $block_list));
         } else {
             $this->render('_tabs', array());
         }
     }
     require_once _lms_ . '/lib/lib.middlearea.php';
     $ma = new Man_MiddleArea();
     $this->render('pluginslist', array('pluginslist' => $pluginslist));
 }
Пример #2
0
function courseUpdate()
{
    require_once _base_ . '/lib/lib.upload.php';
    require_once _base_ . '/lib/lib.multimedia.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.manmenu.php';
    $array_lang = Docebo::langManager()->getAllLangCode();
    $array_lang[] = 'none';
    $acl_man =& Docebo::user()->getAclManager();
    if ($_POST['course_type'] === 'classroom') {
        $url = 'index.php?r=alms/classroom/show&result=';
    } else {
        $url = 'index.php?modname=course&op=course_list&result=';
    }
    if (isset($_POST['mod_course'])) {
        list($id_course) = each($_POST['mod_course']);
    } else {
        list($id_course) = $_GET['mod_course'];
    }
    require_once _lms_ . '/admin/models/LabelAlms.php';
    $label_model = new LabelAlms();
    $label = Get::req('label', DOTY_INT, 0);
    $label_model->associateLabelToCourse($label, $id_course);
    // calc quota limit
    $quota = $_POST['course_quota'];
    if (isset($_POST['inherit_quota'])) {
        $quota = Get::sett('course_quota');
        $_POST['course_quota'] = COURSE_QUOTA_INHERIT;
    }
    $quota = $quota * 1024 * 1024;
    $course_man = new DoceboCourse($id_course);
    $used = $course_man->getUsedSpace();
    if ($_POST['course_name'] == '') {
        $_POST['course_name'] = Lang::t('_NO_NAME', 'course', 'lms');
    }
    // restriction on course status ------------------------------------------
    $user_status = 0;
    if (isset($_POST['user_status'])) {
        while (list($status) = each($_POST['user_status'])) {
            $user_status |= 1 << $status;
        }
    }
    // level that will be showed in the course --------------------------------
    $show_level = 0;
    if (isset($_POST['course_show_level'])) {
        while (list($lv) = each($_POST['course_show_level'])) {
            $show_level |= 1 << $lv;
        }
    }
    // save the file uploaded -------------------------------------------------
    $error = false;
    $quota_exceeded = false;
    $path = Get::sett('pathcourse');
    $path = '/appLms/' . Get::sett('pathcourse') . (substr($path, -1) != '/' && substr($path, -1) != '\\' ? '/' : '');
    $old_file_size = 0;
    if (is_array($_FILES) && !empty($_FILES) || is_array($_POST["file_to_del"])) {
        sl_open_fileoperations();
    }
    // load user material ---------------------------------------------------------------------------
    $arr_file = manageCourseFile('course_user_material', $_POST["old_course_user_material"], $path, $quota != 0 ? $quota - $used : false, isset($_POST['file_to_del']['course_user_material']));
    $error |= $arr_file['error'];
    $quota_exceeded |= $arr_file['quota_exceeded'];
    $file_material = $arr_file['filename'];
    $used = $used + ($arr_file['new_size'] - $arr_file['old_size']);
    $old_file_size += $arr_file['old_size'];
    // course otheruser material -------------------------------------------------------------------
    $arr_file = manageCourseFile('course_otheruser_material', $_POST["old_course_otheruser_material"], $path, $quota != 0 ? $quota - $used : false, isset($_POST['file_to_del']['course_otheruser_material']));
    $error |= $arr_file['error'];
    $quota_exceeded |= $arr_file['quota_exceeded'];
    $file_othermaterial = $arr_file['filename'];
    $used = $used + ($arr_file['new_size'] - $arr_file['old_size']);
    $old_file_size += $arr_file['old_size'];
    // course demo-----------------------------------------------------------------------------------
    $arr_file = manageCourseFile('course_demo', $_POST["old_course_demo"], $path, $quota != 0 ? $quota - $used : false, isset($_POST['file_to_del']['course_demo']));
    $error |= $arr_file['error'];
    $quota_exceeded |= $arr_file['quota_exceeded'];
    $file_demo = $arr_file['filename'];
    $used = $used + ($arr_file['new_size'] - $arr_file['old_size']);
    $old_file_size += $arr_file['old_size'];
    // course sponsor---------------------------------------------------------------------------------
    $arr_file = manageCourseFile('course_sponsor_logo', $_POST["old_course_sponsor_logo"], $path, $quota != 0 ? $quota - $used : false, isset($_POST['file_to_del']['course_sponsor_logo']), true);
    $error |= $arr_file['error'];
    $quota_exceeded |= $arr_file['quota_exceeded'];
    $file_sponsor = $arr_file['filename'];
    $used = $used + ($arr_file['new_size'] - $arr_file['old_size']);
    $old_file_size += $arr_file['old_size'];
    // course logo-----------------------------------------------------------------------------------
    $arr_file = manageCourseFile('course_logo', $_POST["old_course_logo"], $path, $quota != 0 ? $quota - $used : false, isset($_POST['file_to_del']['course_logo']), true);
    $error |= $arr_file['error'];
    $quota_exceeded |= $arr_file['quota_exceeded'];
    $file_logo = $arr_file['filename'];
    $used = $used + ($arr_file['new_size'] - $arr_file['old_size']);
    $old_file_size += $arr_file['old_size'];
    // ----------------------------------------------------------------------------------------------
    sl_close_fileoperations();
    $date_begin = Format::dateDb($_POST['course_date_begin'], "date");
    $date_end = Format::dateDb($_POST['course_date_end'], "date");
    if ($_POST["can_subscribe"] == "2") {
        $sub_start_date = Format::dateDb($_POST["sub_start_date"], "date");
        $sub_end_date = Format::dateDb($_POST["sub_end_date"], "date");
    }
    $hour_begin = '-1';
    $hour_end = '-1';
    if ($_POST['hour_begin']['hour'] != '-1') {
        $hour_begin = strlen($_POST['hour_begin']['hour']) == 1 ? '0' . $_POST['hour_begin']['hour'] : $_POST['hour_begin']['hour'];
        if ($_POST['hour_begin']['quarter'] == '-1') {
            $hour_begin .= ':00';
        } else {
            $hour_begin .= ':' . $_POST['hour_begin']['quarter'];
        }
    }
    if ($_POST['hour_end']['hour'] != '-1') {
        $hour_end = strlen($_POST['hour_end']['hour']) == 1 ? '0' . $_POST['hour_end']['hour'] : $_POST['hour_end']['hour'];
        if ($_POST['hour_end']['quarter'] == '-1') {
            $hour_end .= ':00';
        } else {
            $hour_end .= ':' . $_POST['hour_end']['quarter'];
        }
    }
    // update database ----------------------------------------------------
    $query_course = "\r\n\tUPDATE " . $GLOBALS['prefix_lms'] . "_course\r\n\tSET code \t\t\t\t= '" . $_POST['course_code'] . "',\r\n\t\tname \t\t\t\t= '" . $_POST['course_name'] . "',\r\n\t\tdescription \t\t= '" . $_POST['course_descr'] . "',\r\n\t\tlang_code \t\t\t= '" . $array_lang[$_POST['course_lang']] . "',\r\n\t\tstatus \t\t\t\t= '" . (int) $_POST['course_status'] . "',\r\n\t\tlevel_show_user \t= '" . $show_level . "',\r\n\t\tsubscribe_method \t= '" . (int) $_POST['course_subs'] . "',\r\n\t\tidCategory\t\t\t= '" . (int) $_POST['idCategory'] . "',\r\n\r\n\t\tlinkSponsor \t\t= '" . $_POST['course_sponsor_link'] . "',\r\n\r\n\t\timgSponsor \t\t\t= '" . $file_sponsor . "',\r\n\t\timg_course \t\t\t= '" . $file_logo . "',\r\n\t\timg_material \t\t= '" . $file_material . "',\r\n\t\timg_othermaterial \t= '" . $file_othermaterial . "',\r\n\t\tcourse_demo \t\t= '" . $file_demo . "',\r\n\r\n\t\tmediumTime \t\t\t= '" . $_POST['course_medium_time'] . "',\r\n\t\tpermCloseLO \t\t= '" . $_POST['course_em'] . "',\r\n\t\tuserStatusOp \t\t= '" . $user_status . "',\r\n\t\tdifficult \t\t\t= '" . $_POST['course_difficult'] . "',\r\n\r\n\t\tshow_progress \t\t= '" . (isset($_POST['course_progress']) ? 1 : 0) . "',\r\n\t\tshow_time \t\t\t= '" . (isset($_POST['course_time']) ? 1 : 0) . "',\r\n\r\n\t\tshow_who_online\t\t= '" . $_POST['show_who_online'] . "',\r\n\r\n\t\tshow_extra_info \t= '" . (isset($_POST['course_advanced']) ? 1 : 0) . "',\r\n\t\tshow_rules \t\t\t= '" . (int) $_POST['course_show_rules'] . "',\r\n\r\n\t\tdirect_play \t\t= '" . (isset($_POST['direct_play']) ? 1 : 0) . "',\r\n\r\n\t\tdate_begin \t\t\t= '" . $date_begin . "',\r\n\t\tdate_end \t\t\t= '" . $date_end . "',\r\n\t\thour_begin \t\t\t= '" . $hour_begin . "',\r\n\t\thour_end \t\t\t= '" . $hour_end . "',\r\n\r\n\t\tvalid_time \t\t\t= '" . (int) $_POST['course_day_of'] . "',\r\n\r\n\t\tmin_num_subscribe \t= '" . (int) $_POST['min_num_subscribe'] . "',\r\n\t\tmax_num_subscribe \t= '" . (int) $_POST['max_num_subscribe'] . "',\r\n\r\n\t\tcourse_type \t\t= '" . $_POST['course_type'] . "',\r\n\t\tpoint_to_all \t\t= '" . (isset($_POST['point_to_all']) ? $_POST['point_to_all'] : 0) . "',\r\n\t\tcourse_edition \t\t= '" . (isset($_POST['course_edition']) ? $_POST['course_edition'] : 0) . "',\r\n\t\tselling \t\t\t= '" . (isset($_POST['course_sell']) ? 1 : 0) . "',\r\n\t\tprize \t\t\t\t= '" . (isset($_POST['course_prize']) ? $_POST['course_prize'] : 0) . "',\r\n\t\tpolicy_point \t\t= '" . $_POST['policy_point'] . "',\r\n\r\n\t\tcourse_quota \t\t= '" . $_POST['course_quota'] . "',\r\n\r\n\t\tallow_overbooking \t= '" . (isset($_POST["allow_overbooking"]) ? 1 : 0) . "',\r\n\t\tcan_subscribe \t\t= '" . (int) $_POST["can_subscribe"] . "',\r\n\t\tsub_start_date \t\t= " . ($_POST["can_subscribe"] == "2" ? "'" . $sub_start_date . "'" : 'NULL') . ",\r\n\t\tsub_end_date \t\t= " . ($_POST["can_subscribe"] == "2" ? "'" . $sub_end_date . "'" : 'NULL') . ",\r\n\r\n\t\tadvance \t\t\t= '" . $_POST['advance'] . "',\r\n\t\tshow_result \t\t= '" . (isset($_POST['show_result']) ? 1 : 0) . "',\r\n\r\n\r\n\t\tuse_logo_in_courselist = '" . (isset($_POST['use_logo_in_courselist']) ? '1' : '0') . "'";
    if (isset($_POST['random_course_autoregistration_code'])) {
        $control = 1;
        $str = '';
        while ($control) {
            for ($i = 0; $i < 10; $i++) {
                $seed = mt_rand(0, 10);
                if ($seed > 5) {
                    $str .= mt_rand(0, 9);
                } else {
                    $str .= chr(mt_rand(65, 90));
                }
            }
            $control_query = "SELECT COUNT(*)" . " " . $GLOBALS['prefix_lms'] . "_course" . " WHERE autoregistration_code = '" . $str . "'" . " AND idCourse <> '" . $id_course . "'";
            $control_result = sql_query($control_query);
            list($result) = sql_fetch_row($control_result);
            $control = $result;
        }
        $query_course .= ", autoregistration_code = '" . $str . "'";
    } else {
        $query_course .= ", autoregistration_code = '" . $_POST['course_autoregistration_code'] . "'";
    }
    $query_course .= " WHERE idCourse = '" . $id_course . "'";
    if (!sql_query($query_course)) {
        if ($file_sponsor != '') {
            sl_unlink($path . $file_sponsor);
        }
        if ($file_logo != '') {
            sl_unlink($path . $file_logo);
        }
        if ($file_material != '') {
            sl_unlink($path . $file_material);
        }
        if ($file_othermaterial != '') {
            sl_unlink($path . $file_othermaterial);
        }
        if ($file_demo != '') {
            sl_unlink($path . $file_demo);
        }
        $course_man->subFileToUsedSpace(false, $old_file_size);
        Util::jump_to($url . 'err_course');
    }
    // Let's update the classroom occupation schedule if course type is classroom -------
    if (hasClassroom($_POST["general_course_type"])) {
        $old_date_begin = $_POST["old_date_begin"];
        $old_date_end = $_POST["old_date_end"];
        updateCourseTimtable($id_course, FALSE, $date_begin, $date_end, $old_date_begin, $old_date_end);
    }
    // cascade modify on all the edition of thi course ---------------------------------
    if (isset($_POST['cascade_on_ed'])) {
        $query_editon = "\r\n\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_course_edition\r\n\t\tSET code \t\t\t= '" . $_POST['course_code'] . "',\r\n\t\t\tname \t\t\t= '" . $_POST['course_name'] . "',\r\n\t\t\tdescription \t= '" . $_POST['course_descr'] . "',\r\n\t\t\tedition_type \t= '" . $_POST['course_type'] . "',\r\n\t\t\tstatus \t\t\t= '" . $_POST['course_status'] . "'\r\n\t\tWHERE idCourse = '" . $id_course . "'";
        sql_query($query_editon);
    }
    Util::jump_to($url . 'ok_course' . ($quota_exceeded ? '&limit_reach=1' : ''));
}
 public function show()
 {
     $model = new ClassroomLms();
     if (Get::sett('on_usercourse_empty') === 'on') {
         $conditions_t = array('cu.iduser = :id_user');
         $params_t = array(':id_user' => (int) Docebo::user()->getId());
         $cp_courses = $model->getUserCoursePathCourses(Docebo::user()->getIdst());
         if (!empty($cp_courses)) {
             $conditions_t[] = "cu.idCourse NOT IN (" . implode(",", $cp_courses) . ")";
         }
         $courselist_t = $model->findAll($conditions_t, $params_t);
         if (empty($courselist_t)) {
             Util::jump_to('index.php?r=lms/catalog/show&sop=unregistercourse');
         }
     }
     require_once _lms_ . '/lib/lib.middlearea.php';
     $ma = new Man_MiddleArea();
     $block_list = array();
     if ($ma->currentCanAccessObj('user_details_short')) {
         $block_list['user_details_short'] = true;
     }
     if ($ma->currentCanAccessObj('user_details_full')) {
         $block_list['user_details_full'] = true;
     }
     if ($ma->currentCanAccessObj('credits')) {
         $block_list['credits'] = true;
     }
     if ($ma->currentCanAccessObj('news')) {
         $block_list['news'] = true;
     }
     $tb_label = $ma->currentCanAccessObj('tb_label');
     if (!$tb_label) {
         $_SESSION['id_common_label'] = 0;
     } else {
         $id_common_label = Get::req('id_common_label', DOTY_INT, -1);
         if ($id_common_label >= 0) {
             $_SESSION['id_common_label'] = $id_common_label;
         } elseif ($id_common_label == -2) {
             $_SESSION['id_common_label'] = -1;
         }
         $block_list['labels'] = true;
     }
     if ($tb_label && $_SESSION['id_common_label'] == -1) {
         require_once _lms_ . '/admin/models/LabelAlms.php';
         $label_model = new LabelAlms();
         $user_label = $label_model->getLabelForUser(Docebo::user()->getId());
         $this->render('_labels', array('block_list' => $block_list, 'label' => $user_label));
     } else {
         if (!empty($block_list)) {
             $this->render('_tabs_block', array('block_list' => $block_list));
         } else {
             $this->render('_tabs', array());
         }
     }
 }
Пример #4
0
 public function delCourse($id_course)
 {
     if ((int) $id_course <= 0) {
         return false;
     }
     require_once _lms_ . '/lib/lib.course.php';
     require_once _base_ . '/lib/lib.upload.php';
     $course_man = new Man_Course();
     //remove course subscribed------------------------------------------
     $levels =& $course_man->getCourseIdstGroupLevel($id_course);
     foreach ($levels as $lv => $idst) {
         Docebo::aclm()->deleteGroup($idst);
     }
     $alluser = getIDGroupAlluser($id_course);
     Docebo::aclm()->deleteGroup($alluser);
     $course_man->removeCourseRole($id_course);
     $course_man->removeCourseMenu($id_course);
     $query = "DELETE FROM %lms_courseuser WHERE idCourse = '" . (int) $id_course . "'";
     $qres = sql_query($query);
     if (!$qres) {
         return false;
     }
     //--- remove course data ---------------------------------------------------
     $query_course = "SELECT imgSponsor, img_course, img_material, img_othermaterial, course_demo, course_type, has_editions\n\t\t\tFROM %lms_course\n\t\t\tWHERE idCourse = '" . (int) $id_course . "'";
     $qres = sql_query($query_course);
     list($file_sponsor, $file_logo, $file_material, $file_othermaterial, $file_demo, $course_type, $course_edition) = sql_fetch_row($qres);
     require_once _base_ . '/lib/lib.upload.php';
     $path = '/appLms/' . Get::sett('pathcourse');
     if (substr($path, -1) != '/' && substr($path, -1) != '\\') {
         $path .= '/';
     }
     sl_open_fileoperations();
     if ($file_sponsor != '') {
         sl_unlink($path . $file_sponsor);
     }
     if ($file_logo != '') {
         sl_unlink($path . $file_logo);
     }
     if ($file_material != '') {
         sl_unlink($path . $file_material);
     }
     if ($file_othermaterial != '') {
         sl_unlink($path . $file_othermaterial);
     }
     if ($file_demo != '') {
         sl_unlink($path . $file_demo);
     }
     sl_close_fileoperations();
     //if the scs exist delete course rooms
     if ($GLOBALS['where_scs'] !== false) {
         require_once _scs_ . '/lib/lib.room.php';
         $re = deleteRoom(false, 'course', $id_course);
     }
     //--- delete classroom or editions -----------------------------------------
     if ($course_type == 'classroom') {
         require_once _lms_ . '/admin/model/ClassroomAlms.php';
         $classroom_model = new ClassroomAlms($id_course);
         $classroom = $classroom_model->classroom_man->getDateIdForCourse($id_course);
         foreach ($classroom as $id_date) {
             if (!$classroom_model->classroom_man->delDate($id_date)) {
                 return false;
             }
         }
     } elseif ($course_edition == 1) {
         require_once _lms_ . '/admin/model/EditionAlms.php';
         $edition_model = new EditionAlms($id_course);
         $editions = $edition_model->classroom_man->getEditionIdFromCourse($id_course);
         foreach ($editions as $id_edition) {
             if (!$edition_model->edition_man->delEdition($id_edition)) {
                 return false;
             }
         }
     }
     //--- end classrooms or editions -------------------------------------------
     //--- clear LOs ------------------------------------------------------------
     require_once _lms_ . '/lib/lib.module.php';
     require_once _lms_ . '/lib/lib.param.php';
     require_once _lms_ . '/class.module/track.object.php';
     $arr_lo_param = array();
     $arr_lo_track = array();
     $arr_org_access = array();
     $query = "SELECT * FROM %lms_organization WHERE idCourse = " . (int) $id_course;
     $ores = sql_query($query);
     while ($obj = sql_fetch_object($ores)) {
         $deleted = true;
         if ($obj->idResource != 0 && $obj->objectType != "") {
             $lo = createLO($obj->objectType);
             $deleted = $lo->del($obj->idResource);
             //delete learning object
         }
         if ($deleted) {
             $arr_lo_track[] = $obj->idOrg;
             $arr_org_access[] = $obj->idOrg;
             //collect org access ids
             $arr_lo_param[] = $obj->idParam;
             //collect idParams ids
         }
     }
     //delete all organizations references for the course
     $query = "DELETE FROM %lms_organization WHERE idCourse = " . (int) $id_course;
     $res = sql_query($query);
     //delete LOs trackings
     if (!empty($arr_lo_track)) {
         $track_object = new Track_Object(false, 'course_lo');
         $track_object->delIdTrackFromCommon($arr_lo_track);
     }
     //delete org accesses
     if (!empty($arr_org_access)) {
         $query = "DELETE FROM %lms_organization_access\n\t\t\t\tWHERE idOrgAccess IN (" . implode(",", $arr_org_access) . ")";
         $res = sql_query($query);
     }
     //delete lo params
     if (!empty($arr_lo_param)) {
         $query = "DELETE FROM %lms_lo_param\n\t\t\t\tWHERE idParam IN (" . implode(",", $arr_lo_param) . ")";
     }
     //--- end LOs --------------------------------------------------------------
     //--- clear coursepath references ------------------------------------------
     require_once _lms_ . '/lib/lib.coursepath.php';
     $cman = new CoursePath_Manager();
     $cman->deleteCourseFromCoursePaths($id_course);
     //--- end coursepath references --------------------------------------------
     //--- clear certificates assignments ---------------------------------------
     require_once _lms_ . '/lib/lib.certificate.php';
     $cman = new Certificate();
     $cman->deleteCourseCertificateAssignments($id_course);
     //--- end certificates assignments -----------------------------------------
     //--- clear labels ---------------------------------------------------------
     $lmodel = new LabelAlms();
     $lmodel->clearCourseLabel($id_course);
     //--- end labels -----------------------------------------------------------
     //--- clear advices --------------------------------------------------------
     require_once _lms_ . '/lib/lib.advice.php';
     $aman = new Man_Advice();
     $aman->deleteAllCourseAdvices($id_course);
     //--- end advices ----------------------------------------------------------
     //--- clear coursereports --------------------------------------------------
     require_once _lms_ . '/lib/lib.coursereport.php';
     $cman = new CourseReportManager();
     $cman->deleteAllReports($id_course);
     //--- end coursereports ----------------------------------------------------
     //--- clear competences ----------------------------------------------------
     $cmodel = new CompetencesAdm();
     $cmodel->deleteAllCourseCompetences($id_course);
     //--- end competences ------------------------------------------------------
     //--- finally delete course from courses table -----------------------------
     if (!sql_query("DELETE FROM %lms_course WHERE idCourse = '" . $id_course . "'")) {
         return false;
     }
     return true;
 }
Пример #5
0
 public function label()
 {
     require_once _lms_ . '/admin/models/LabelAlms.php';
     $label_model = new LabelAlms();
     echo '<h2 class="heading">' . Lang::t('_LABEL', 'catalogue') . '</h2>' . '<div class="content">' . Form::openForm('label_form', 'index.php?r=elearning/show') . Form::getDropdown(Lang::t('_LABELS', 'catalogue'), 'id_common_label_dd', 'id_common_label', $label_model->getDropdownLabelForUser(Docebo::user()->getId()), $_SESSION['id_common_label'] == -1 ? -2 : $_SESSION['id_common_label']) . Form::closeForm() . '<script type="text/javascript">' . 'var dd = YAHOO.util.Dom.get(\'id_common_label_dd\');' . 'YAHOO.util.Event.onDOMReady(YAHOO.util.Event.addListener(dd, "change", function(e){var form = YAHOO.util.Dom.get(\'label_form\');form.submit();}));' . '</script>' . '</div>';
 }
 public function showTask()
 {
     $model = new ElearningLms();
     if (Get::sett('on_usercourse_empty') === 'on') {
         $conditions_t = array('cu.iduser = :id_user');
         $params_t = array(':id_user' => (int) Docebo::user()->getId());
         $cp_courses = $model->getUserCoursePathCourses(Docebo::user()->getIdst());
         if (!empty($cp_courses)) {
             $conditions_t[] = "cu.idCourse NOT IN (" . implode(",", $cp_courses) . ")";
         }
         $courselist_t = $model->findAll($conditions_t, $params_t);
         if (empty($courselist_t)) {
             Util::jump_to('index.php?r=lms/catalog/show&sop=unregistercourse');
         }
     }
     require_once _lms_ . '/lib/lib.middlearea.php';
     $ma = new Man_MiddleArea();
     $block_list = array();
     //if($ma->currentCanAccessObj('user_details_short')) $block_list['user_details_short'] = true;
     if ($ma->currentCanAccessObj('user_details_full')) {
         $block_list['user_details_full'] = true;
     }
     if ($ma->currentCanAccessObj('credits')) {
         $block_list['credits'] = true;
     }
     if ($ma->currentCanAccessObj('news')) {
         $block_list['news'] = true;
     }
     $tb_label = $ma->currentCanAccessObj('tb_label');
     if (!$tb_label) {
         $_SESSION['id_common_label'] = 0;
     } else {
         $id_common_label = Get::req('id_common_label', DOTY_INT, -1);
         if ($id_common_label >= 0) {
             $_SESSION['id_common_label'] = $id_common_label;
         } elseif ($id_common_label == -2) {
             $_SESSION['id_common_label'] = -1;
         }
         $block_list['labels'] = true;
     }
     if ($tb_label && $_SESSION['id_common_label'] == -1) {
         require_once _lms_ . '/admin/models/LabelAlms.php';
         $label_model = new LabelAlms();
         $user_label = $label_model->getLabelForUser(Docebo::user()->getId());
         $this->render('_labels', array('block_list' => $block_list, 'label' => $user_label));
     } else {
         if (!empty($block_list)) {
             $this->render('_tabs_block', array('block_list' => $block_list));
         } else {
             $this->render('_tabs', array());
         }
     }
     // add feedback:
     // - feedback_type: [err|inf] display error feedback or info feedback
     // - feedback_code: translation code of message
     // - feedback_extra: extrainfo concat at end message
     $feedback_code = Get::req('feedback_code', DOTY_STRING, "");
     $feedback_type = Get::req('feedback_type', DOTY_STRING, "");
     $feedback_extra = Get::req('feedback_extra', DOTY_STRING, "");
     switch ($feedback_type) {
         case "err":
             $msg = Lang::t($feedback_code, 'login') . " " . $feedback_extra;
             UIFeedback::error($msg);
             break;
         case "inf":
             $msg = Lang::t($feedback_code, 'login') . " " . $feedback_extra;
             UIFeedback::info($msg);
             break;
     }
 }