function dashAcourse($id_course, $h_number) { require_once _base_ . '/lib/lib.form.php'; require_once _base_ . '/lib/lib.user_profile.php'; require_once _base_ . '/lib/lib.navbar.php'; require_once $GLOBALS['where_lms'] . '/lib/lib.preassessment.php'; require_once $GLOBALS['where_lms'] . '/lib/lib.catalogue.php'; require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php'; require_once $GLOBALS['where_lms'] . '/lib/lib.course.php'; require_once $GLOBALS["where_lms"] . "/modules/coursecatalogue/lib.coursecatalogue.php"; $lang =& DoceboLanguage::createInstance('standard', 'framework'); $lang->setGlobal(); $lang =& DoceboLanguage::createInstance('course', 'lms'); $normal_subs = 1; $man_course = new DoceboCourse($id_course); $cinfo = $man_course->getAllInfo(); $man_courseuser = new Man_CourseUser(); $usercourses =& $man_courseuser->getUserSubscriptionsInfo(getLogUserId(), false); $select_edition = " SELECT * "; $from_edition = " FROM " . $GLOBALS["prefix_lms"] . "_course_edition"; $where_edition = " WHERE idCourse = '" . $id_course . "' "; $order_edition = " ORDER BY date_begin "; $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['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; } } $select_ed_count = "SELECT idCourse, edition_id, sum(waiting) as waiting, COUNT(*) as user_count "; $from_ed_count = "FROM " . $GLOBALS["prefix_lms"] . "_courseuser "; $where_ed_count = "WHERE edition_id <> 0 AND idCourse = '" . $id_course . "'"; $group_ed_count = "GROUP BY 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)) { $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']; } } $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; require_once _base_ . '/lib/lib.urlmanager.php'; $url =& UrlManager::getInstance('catalogue'); $url->setStdQuery('r=' . _after_login_); if ($normal_subs == 0) { $cinfo['can_subscribe'] = 0; } $html = dashcourse($url, $lang, $cinfo, isset($usercourses[$cinfo['idCourse']]) ? $usercourses[$cinfo['idCourse']] : false, 0, $h_number); return $html; }
function subscribedel() { checkPerm('subscribe', false, 'course'); require_once $GLOBALS['where_lms'] . '/lib/lib.course.php'; require_once _base_ . '/lib/lib.form.php'; require_once _base_ . '/lib/lib.table.php'; $id_course = importVar('id_course', true, 0); $course_to_save = Man_Course::saveCourseStatus(); $edition_id = getCourseEditionId(); $out =& $GLOBALS['page']; $lang =& DoceboLanguage::CreateInstance('subscribe', 'lms'); $acl_man =& Docebo::user()->getAclManager(); $levels = CourseLevel::getLevels(); $user_alredy_subscribed = getSubscribed($id_course, false, false, true, $edition_id); $user_levels = getSubscribedLevel($id_course, false, false, $edition_id); require_once $GLOBALS['where_framework'] . '/lib/lib.adminmanager.php'; $adminManager = new AdminManager(); $acl_manager = new DoceboACLManager(); $idst_associated = $adminManager->getAdminTree(getLogUserId()); $array_user_associated =& $acl_manager->getAllUsersFromIdst($idst_associated); $user_level = Docebo::user()->getUserLevelId(); if ($user_level != ADMIN_GROUP_GODADMIN) { $user_alredy_subscribed = array_intersect($user_alredy_subscribed, $array_user_associated); } $user_selected_info =& $acl_man->getUsers($user_alredy_subscribed); $GLOBALS['page']->add(getTitleArea($lang->def('_SUBSCRIBE'), 'subscribe') . '<div class="std_block">' . Form::openForm('levelselection', 'index.php?modname=subscribe&op=subscriberemove') . Form::getHidden('id_course', 'id_course', $id_course) . Form::getHidden('edition_id', 'edition_id', $edition_id), 'content'); $tb = new Table(0, $lang->def('_CAPTION_SELECT_LEVELS'), $lang->def('_SUMMARY_SELECT_LEVEL')); $type_h = array('', '', '', 'image'); $content_h = array($lang->def('_USERNAME'), $lang->def('_FULLNAME'), $lang->def('_LEVEL'), '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '">'); $tb->addHead($content_h, $type_h); $num_user_sel = 0; if (is_array($user_selected_info)) { reset($user_selected_info); while (list($id_user, $user_info) = each($user_selected_info)) { // if the user isn't alredy subscribed to the course $content = array(substr($user_info[ACL_INFO_USERID], 1), $user_info[ACL_INFO_LASTNAME] . ' ' . $user_info[ACL_INFO_FIRSTNAME], $levels[$user_levels[$id_user]], $content[] = Form::getInputCheckbox('user_to_remove' . $id_user, 'user_to_remove[' . $id_user . ']', $id_user, false, '') . '<label class="access-only" for="user_to_remove' . $id_user . '">' . $user_info[ACL_INFO_USERID] . '</label>'); $tb->addBody($content); } $GLOBALS['page']->add($tb->getTable(), 'content'); } $GLOBALS['page']->add(Form::openButtonSpace() . '<br />' . Form::getButton('subscribe', 'subscribe', $lang->def('_DEL')) . Form::getButton('cancelselector', 'cancelselector', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm(), 'content'); $GLOBALS['page']->add('</div>', 'content'); }
function testQuestion() { checkPerm('view'); YuiLib::load(array('animation' => 'my_animation.js')); addJs($GLOBALS['where_lms_relative'] . '/modules/coursereport/', 'ajax.coursereport.js'); require_once _base_ . '/lib/lib.table.php'; require_once $GLOBALS['where_lms'] . '/lib/lib.test.php'; $lang =& DoceboLanguage::createInstance('coursereport', 'lms'); $out =& $GLOBALS['page']; $out->setWorkingZone('content'); $out->add('<script type="text/javascript">' . ' setup_coursereport(\'' . $GLOBALS['where_lms_relative'] . '/ajax.server.php?plf=lms&mn=coursereport&\'); ' . '</script>', 'page_head'); $id_test = importVar('id_test', true, 0); $test_man = new GroupTestManagement(); $lev = FALSE; if (isset($_GET['type_filter']) && $_GET['type_filter'] != null) { $lev = $_GET['type_filter']; } $students = getSubscribed((int) $_SESSION['idCourse'], FALSE, $lev, TRUE, false, false, true); $id_students = array_keys($students); $quests = array(); $answers = array(); $tracks = array(); $test_info = $test_man->getTestInfo(array($id_test)); $page_title = array('index.php?modname=coursereport&op=coursereport' => $lang->def('_COURSEREPORT', 'menu_course'), $test_info[$id_test]['title']); $out->add(getTitleArea($page_title, 'coursereport') . '<div class="std_block">'); $query_test = "SELECT title" . " FROM " . $GLOBALS['prefix_lms'] . "_test" . " WHERE idTest = '" . $id_test . "'"; list($titolo_test) = sql_fetch_row(sql_query($query_test)); $query_quest = "SELECT idQuest, type_quest, title_quest" . " FROM " . $GLOBALS['prefix_lms'] . "_testquest" . " WHERE idTest = '" . $id_test . "'" . " ORDER BY sequence"; $result_quest = sql_query($query_quest); while (list($id_quest, $type_quest, $title_quest) = sql_fetch_row($result_quest)) { $quests[$id_quest]['idQuest'] = $id_quest; $quests[$id_quest]['type_quest'] = $type_quest; $quests[$id_quest]['title_quest'] = $title_quest; // $query_answer = "SELECT idAnswer, is_correct, answer" // ." FROM ".$GLOBALS['prefix_lms']."_testquestanswer" // ." WHERE idQuest = '".$id_quest."'" // ." ORDER BY sequence"; $query_answer = "SELECT tqa.idAnswer, tqa.is_correct, tqa.answer" . " FROM " . $GLOBALS['prefix_lms'] . "_testquestanswer AS tqa" . " LEFT JOIN" . " " . $GLOBALS['prefix_lms'] . "_testtrack_answer tta ON tqa.idAnswer = tta.idAnswer" . " LEFT JOIN" . " " . $GLOBALS['prefix_lms'] . "_testtrack tt ON tt.idTrack = tta.idTrack" . " WHERE tqa.idQuest = '" . $id_quest . "'"; $query_answer .= " and tt.idUser in (" . implode(",", $id_students) . ")"; $query_answer .= " ORDER BY tqa.sequence"; $result_answer = sql_query($query_answer); while (list($id_answer, $is_correct, $answer) = sql_fetch_row($result_answer)) { $answers[$id_quest][$id_answer]['idAnswer'] = $id_answer; $answers[$id_quest][$id_answer]['is_correct'] = $is_correct; $answers[$id_quest][$id_answer]['answer'] = $answer; } if ($type_quest == 'choice_multiple' || $type_quest == 'choice' || $type_quest == 'inline_choice') { $answers[$id_quest][0]['idAnswer'] = 0; $answers[$id_quest][0]['is_correct'] = 0; $answers[$id_quest][0]['answer'] = $lang->def('_NO_ANSWER'); } } $query_track = "SELECT idTrack" . " FROM " . $GLOBALS['prefix_lms'] . "_testtrack" . " WHERE idTest = '" . $id_test . "'" . " AND score_status = 'valid'" . " AND idUser in (" . implode(",", $id_students) . ")"; $result_track = sql_query($query_track); while (list($id_track) = sql_fetch_row($result_track)) { $query_track_answer = "SELECT idQuest, idAnswer, more_info" . " FROM " . $GLOBALS['prefix_lms'] . "_testtrack_answer" . " WHERE idTrack = '" . $id_track . "'"; // COMMENTATO MA NON E' CHIARO COME MAI C'E'???? //." AND user_answer = 1"; //print_r($query_track_answer.'<br />'); $result_track_answer = sql_query($query_track_answer); //echo $query_track_answer."<br>"; while (list($id_quest, $id_answer, $more_info) = sql_fetch_row($result_track_answer)) { $tracks[$id_track][$id_quest][$id_answer]['more_info'] = $more_info; //echo " -> ".$id_quest." - ".$id_answer." - ".$more_info."<br>"; } } $query_total_play = "SELECT COUNT(*)" . " FROM " . $GLOBALS['prefix_lms'] . "_testtrack" . " WHERE idTest = '" . $id_test . "'" . " AND score_status = 'valid'" . " AND idUser in (" . implode(",", $id_students) . ")"; list($total_play) = sql_fetch_row(sql_query($query_total_play)); /*if ($total_play == 0) { $query_total_play = "SELECT COUNT(*)" ." FROM ".$GLOBALS['prefix_lms']."_testtrack" ." WHERE idTest = '".$id_test."' AND score_status = 'not_checked'"; list($total_play2) = mysql_fetch_row(mysql_query($query_total_play)); $total_play += $total_play2; }*/ //print_r($tracks); foreach ($quests as $quest) { switch ($quest['type_quest']) { case "inline_choice": case "hot_text": case "choice_multiple": case "choice": $cont_h = array($lang->def('_ANSWER'), $lang->def('_PERCENTAGE')); $type_h = array('', 'image nowrap'); $tb = new Table(0, str_replace('[title]', $quest['title_quest'], $lang->def('_TABLE_QUEST'))); $tb->setColsStyle($type_h); $tb->addHead($cont_h); foreach ($answers[$quest['idQuest']] as $answer) { $cont = array(); if ($answer['is_correct']) { $txt = '<img src="' . getPathImage('lms') . 'standard/publish.png" alt="' . $lang->def('_ANSWER_CORRECT') . '" title="' . $lang->def('_ANSWER_CORRECT') . '" align="left" /> '; } else { $txt = ''; } $cont[] = '<p>' . $txt . ' ' . $answer['answer'] . '</p>'; $answer_given = 0; reset($tracks); $i = 0; foreach ($tracks as $track) { $i++; if (isset($track[$quest['idQuest']][$answer['idAnswer']])) { $answer_given++; } elseif (!isset($track[$quest['idQuest']]) && $answer['idAnswer'] == 0) { $answer_given++; } } if ($answer['idAnswer'] == 0 && $i < $total_play) { // if ($i < $total_play) { $answer_given = $answer_given + ($total_play - $i); } if ($total_play > 0) { $percentage = $answer_given / $total_play * 100; } else { $percentage = 0; } $percentage = number_format($percentage, 2); $cont[] = Util::draw_progress_bar($percentage, true, false, false, false, false); $tb->addBody($cont); } $out->add($tb->getTable() . '<br/>'); break; case "upload": case "extended_text": $out->add('<div>'); $out->add('<p><a href="#" onclick="getQuestDetail(' . $quest['idQuest'] . ', ' . $id_test . ', \'' . $quest['type_quest'] . '\'); return false;" id="more_quest_' . $quest['idQuest'] . '"><img src="' . getPathImage('fw') . 'standard/more.gif" alt="' . $lang->def('_MORE_INFO') . '" />' . str_replace('[title]', $quest['title_quest'], $lang->def('_TABLE_QUEST_LIST')) . '</a></p>'); $out->add('<p><a href="#" onclick="closeQuestDetail(' . $quest['idQuest'] . '); return false;" id="less_quest_' . $quest['idQuest'] . '" style="display:none"><img src="' . getPathImage('fw') . 'standard/less.gif" alt="' . $lang->def('_CLOSE') . '" />' . str_replace('[title]', $quest['title_quest'], $lang->def('_TABLE_QUEST_LIST')) . '</a></p>'); $out->add('</div>'); $out->add('<div id="quest_' . $quest['idQuest'] . '">'); $out->add('</div>'); break; case "text_entry": $cont_h = array($lang->def('_PERCENTAGE_CORRECT')); $type_h = array('align-center'); $tb = new Table(0, str_replace('[title]', $quest['title_quest'], $lang->def('_TABLE_QUEST_CORRECT_TXT'))); $tb->setColsStyle($type_h); $tb->addHead($cont_h); foreach ($answers[$quest['idQuest']] as $answer) { $cont = array(); $answer_correct = 0; foreach ($tracks as $track) { if ($track[$quest['idQuest']][$answer['idAnswer']]['more_info'] === $answer['answer']) { $answer_correct++; } } $percentage = $answer_correct / $total_play * 100; $percentage = number_format($percentage, 2); $cont[] = Util::draw_progress_bar($percentage, true, false, false, false, false); $tb->addBody($cont); } $out->add($tb->getTable() . '<br/>'); break; case "associate": $cont_h = array($lang->def('_ANSWER'), $lang->def('_PERCENTAGE_CORRECT')); $type_h = array('', 'align-center'); $tb = new Table(0, str_replace('[title]', $quest['title_quest'], $lang->def('_TABLE_QUEST_CORRECT_ASS'))); $tb->setColsStyle($type_h); $tb->addHead($cont_h); foreach ($answers[$quest['idQuest']] as $answer) { $cont = array(); $cont[] = $answer['answer']; $answer_correct = 0; foreach ($tracks as $track) { if ($track[$quest['idQuest']][$answer['idAnswer']]['more_info'] === $answer['is_correct']) { $answer_correct++; } } $percentage = $answer_correct / $total_play * 100; echo "risp corrette: " . $answer_correct . " totale: " . $total_play; $percentage = number_format($percentage, 2); $cont[] = Util::draw_progress_bar($percentage, true, false, false, false, false); $tb->addBody($cont); } $out->add($tb->getTable() . '<br/>'); break; } reset($answers); reset($tracks); } $out->add('</div>'); }
function savePanel() { checkPerm('mod'); require_once _base_ . '/lib/lib.form.php'; require_once _adm_ . '/lib/lib.publicadminmanager.php'; require_once _lms_ . '/lib/lib.course.php'; require_once _lms_ . '/lib/lib.date.php'; require_once _lms_ . '/lib/lib.competences.php'; $save = Get::req('save', DOTY_MIXED, false); $undo = Get::req('undo', DOTY_MIXED, false); $update = Get::req('update', DOTY_MIXED, false); $db = DbConn::getInstance(); $lang =& DoceboLanguage::CreateInstance('public_coursepanel', 'lms'); $man_competences = new Competences_Manager(); //back page link $back_ui = getBackUi('index.php?modname=public_coursepanel&op=coursepanel', $lang->def('_BACK')); cout(getTitleArea($lang->def('_COURSEPANEL'), 'coursepanel') . '<div class="std_block">' . $back_ui, 'content'); $sel_competence = Get::req('sel_competence', DOTY_INT, false); $sel_course = Get::req('sel_course', DOTY_INT, false); $required_filter = Get::req('required_filter', DOTY_INT, 0); $is_retraining = $man_competences->isRetrainingCourse($sel_course, $sel_competence); $back_url = "index.php?modname=public_coursepanel&op=coursepanel&sel_competence=" . (int) $sel_competence . "&sel_course=" . (int) $sel_course; if ($required_filter > 0) { $back_url .= '&required_filter=1'; } $to_consider = Get::req('to_consider', DOTY_MIXED, false); if ($to_consider) { require_once _base_ . '/lib/lib.json.php'; $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); $to_consider = $json->decode(base64_decode($to_consider)); } else { $to_consider = array('users' => array(), 'editions' => array()); } if ($undo) { Util::jump_to("index.php"); } elseif ($save) { //change users' subscription to course editions $data = Get::req('subscriptions', DOTY_MIXED, array()); $man_course = new Man_Course(); $course_info = $man_course->getCourseInfo($sel_course); if (!$sel_competence || !$sel_course) { //error ... Util::jump_to($back_url . "&err=invalid"); } //check the admin level of the current user, if it's not an admin or the idst is invalid, return an error $id_pa = getLogUserId(); if (!$id_pa) { Util::jump_to($back_url . "&err=invalid"); } $acl_man = new DoceboACLManager(); $admin_manager = new PublicAdminManager(); $array_users = array(); $idst_associated = $admin_manager->getAdminTree($id_pa); $array_users =& $acl_man->getAllUsersFromIdst($idst_associated); $array_users = array_unique($array_users); if (empty($array_users)) { Util::jump_to($back_url . "&err=invalid"); } //filter array of user ids by competence $filtered_users = array(); $query_filter = "SELECT id_user FROM %lms_competence_user WHERE id_user IN (" . implode(",", $array_users) . ") AND id_competence='" . (int) $sel_competence . "'"; $res_filter = $db->query($query_filter); while (list($idst) = $db->fetch_row($res_filter)) { $filtered_users[] = $idst; } $subs_limit = array(); $subs_count = array(); if ($course_info['course_type'] == 'elearning') { $editions[] = $sel_course; $subscribed[$sel_course] = getSubscribed((int) $sel_course); $course_info = $man_course->getCourseInfo($sel_course); $subs_count[$sel_course] = count($data); } elseif ($course_info['course_type'] == 'classroom') { //get all combinations id_user - id_date $date_man = new DateManager(); $editions = array(); $query_editions = "SELECT id_date, id_course, code, name FROM %lms_course_date WHERE id_course='" . (int) $sel_course . "'"; $res_editions = $db->query($query_editions); while (list($id_edition, $id_course, $code, $name) = $db->fetch_row($res_editions)) { $editions[] = $id_edition; $subscribed[$id_edition] = $date_man->getDateSubscribed($id_edition); $date_info = $date_man->getDateInfo($id_edition); $subs_limit[$id_edition] = array('max' => $date_info['max_par'], 'subs' => $date_info['user_subscribed']); $subs_count[$id_edition] = 0; } } //------------------------------------------------------------------------------ //count the users to be subscribed/unsubscribed and check subscription limits, if any //subtract users to de-subscribe from courses foreach ($subscribed as $id_edition => $users_list) { foreach ($users_list as $id_user) { if ($course_info['course_type'] == 'elearning') { if (!isset($data[$id_user])) { $subs_count[$id_edition]--; } } elseif ($course_info['course_type'] == 'classroom') { //check if the current selection match the current subscriptions if (!isset($data[$id_user][$id_edition])) { $subs_count[$id_edition]--; } } } } foreach ($data as $user => $edition_list) { //id user foreach ($edition_list as $edition => $val) { //id date edition if (isset($subscribed[$edition][$user])) { //already subscribed, do nothing } else { $subs_count[$edition]++; } } } //check if we have enough room to subscribe users //{at the moment, rely on js ...} //------------------------------------------------------------------------------ //unsubscribe deselected users foreach ($subscribed as $id_edition => $users_list) { foreach ($users_list as $id_user) { if ($course_info['course_type'] == 'elearning') { if (!isset($data[$id_user])) { if (in_array($id_user, $to_consider['users']) && in_array($id_edition, $to_consider['editions'])) { $group_levels = DoceboCourse::getCourseLevel($sel_course); $user_levels = getSubscribedLevel($sel_course, false, false, 0); $_res = _removeCourseSubscription($sel_course, $id_user, $group_levels[$user_levels[$id_user]], 0); } } } elseif ($course_info['course_type'] == 'classroom') { //check if the current selection match the current subscriptions if (!isset($data[$id_user][$id_edition])) { if (in_array($id_user, $to_consider['users']) && in_array($id_edition, $to_consider['editions'])) { $date_man->removeUserFromDate($id_user, $id_edition, $sel_course); } } } } } //------------------------------------------------------------------------------ //check every single user for inscription $count = 0; $lv_sel = 3; //student level $waiting = 0; //don't subscribe as "waiting for approvation" //retrive id of group of the course for the varioud level $level_idst = DoceboCourse::getCourseLevel((int) $sel_course); //if the group doesn't exists create it if (count($level_idst) == 0 || $level_idst[1] == '') { $level_idst =& DoceboCourse::createCourseLevel((int) $sel_course); } foreach ($data as $user => $edition_list) { //id user foreach ($edition_list as $edition => $val) { //id date edition if (isset($subscribed[$edition][$user])) { //already subscribed, do nothing } else { //this user is to be subscribed, do it //add to level group of the course $acl_man->addToGroup($level_idst[$lv_sel], $user); // Add in table $re = $db->query("INSERT INTO %lms_courseuser (idUser, idCourse, edition_id, level, waiting, subscribed_by, date_inscr)" . " VALUES ( '" . (int) $user . "', '" . (int) $sel_course . "', '0', '" . $lv_sel . "', '" . $waiting . "', '" . getLogUserId() . "', '" . date("Y-m-d H:i:s") . "' )\t"); //additional operations for editions if ($course_info['course_type'] == 'elearning') { //... } elseif ($course_info['course_type'] == 'classroom') { $ret = $date_man->addUserToDate($edition, $user, getLogUserId()); if ($ret) { $count++; } } } } } Util::jump_to($back_url . "&err=ok&count=" . (int) $count); } elseif ($update) { $sel_competence = Get::req('sel_competence', DOTY_INT, false); $sel_course = Get::req('sel_course', DOTY_INT, false); Util::jump_to($back_url); //."&sel_competence=".(int)$sel_competence."&sel_course=".(int)$sel_course); } else { //... } cout($back_ui . '</div>', 'content'); }
function getSubstitution() { $subs = array(); $lang =& DoceboLanguage::createInstance('course', 'lms'); $lang =& DoceboLanguage::createInstance('certificate', 'lms'); if ($this->id_meta != 0) { require_once $GLOBALS['where_lms'] . '/lib/lib.course.php'; require_once $GLOBALS['where_lms'] . '/lib/lib.coursereport.php'; $acl_man =& $GLOBALS['current_user']->getAclManager(); $courses = array(); $array_coursetype = array('elearning' => $lang->def('_COURSE_TYPE_ELEARNING', 'course', 'lms'), 'classroom' => $lang->def('_CLASSROOM', 'course', 'lms'), 'web_seminar' => $lang->def('Web seminar')); $course_time = 0; $blended_time = 0; $query = "SELECT DISTINCT idCourse" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idMetaCertificate = '" . $this->id_meta . "'" . " AND idUser = '******'"; $result = sql_query($query); $table_course = '<table width="100%" cellspacing="1" cellpadding="1" border="1" align="" summary="Corsi frequentati">' . '<thead>' . '<tr>' . '<td>' . $lang->def('_COURSE_NAME') . '</td>' . '<td>' . $lang->def('_COURSE_TYPE') . '</td>' . '<td align="right">' . $lang->def('_COURSE_TIME') . '</td>' . '</tr>' . '</thead>' . '</tbody>'; $table_blended = '<table width="100%" cellspacing="1" cellpadding="1" border="1" align="" summary="Corsi frequentati">' . '<thead>' . '<tr>' . '<td>' . $lang->def('_COURSE_NAME') . '</td>' . '<td>' . $lang->def('_COURSE_PROF') . '</td>' . '<td>' . $lang->def('_COURSE_TYPE') . '</td>' . '<td align="right">' . $lang->def('_COURSE_TIME') . '</td>' . '</thead>' . '</tbody>'; $course_count = 0; $blended_count = 0; $array_meta_complete = array(); $array_meta_inscr = array(); $array_meta_access = array(); while (list($id_course) = sql_fetch_row($result)) { $query = "SELECT date_complete, date_inscr, date_first_access" . " FROM " . $GLOBALS['prefix_lms'] . "_courseuser" . " WHERE idCourse = '" . $id_course . "'" . " AND idUser = '******'"; list($date_complete_meta, $date_inscr_meta, $date_access_meta) = sql_fetch_row(sql_query($query)); $array_meta_complete[] = $date_complete_meta; $array_meta_inscr[] = $date_inscr_meta; $array_meta_access[] = $date_access_meta; $man_course = new Man_Course(); $course_info = $man_course->getCourseInfo($id_course); $rep_man = new CourseReportManager(); $score_course = $rep_man->getUserFinalScore(array($this->id_user), array($this->id_course)); if ($course_info['course_type'] === 'blended') { $teacher_array = getSubscribed($id_course, false, 6, true); $first = true; if (is_array($teacher_array) && !empty($teacher_array)) { while (list(, $id_teach) = each($teacher_array)) { $teacher_info = $acl_man->getUser($id_teach); if ($first) { $teacher = $teacher_info[ACL_INFO_FIRSTNAME] . ' ' . $teacher_info[ACL_INFO_LASTNAME]; $first = false; } else { $teacher = '<br/>' . $teacher_info[ACL_INFO_FIRSTNAME] . ' ' . $teacher_info[ACL_INFO_LASTNAME]; } } } else { $teacher = ' '; } $table_blended .= '<tr>' . '<td>' . $course_info['name'] . '</td>' . '<td>' . $teacher . '</td>' . '<td>' . $array_coursetype[$course_info['course_type']] . '</td>' . '<td align="right">' . $course_info['mediumTime'] . '</td>' . '</tr>'; $blended_time += $course_info['mediumTime']; $blended_count++; } else { $table_course .= '<tr>' . '<td>' . $course_info['name'] . '</td>' . '<td>' . $array_coursetype[$course_info['course_type']] . '</td>' . '<td align="right">' . $course_info['mediumTime'] . '</td>' . '</tr>'; $course_time += $course_info['mediumTime']; $course_count++; } } $table_course .= '<tr>' . '<td align="right" colspan="2">' . $lang->def('_TOTAL_HOURS') . '</td>' . '<td align="right">' . $course_time . '</td>' . '</tr>' . '</tbody>' . '</table>'; $table_blended .= '<tr>' . '<td align="right" colspan="2">' . $lang->def('_TOTAL_HOURS') . '</td>' . '<td align="right">' . $blended_time . '</td>' . '</tr>' . '</tbody>' . '</table>'; rsort($array_meta_complete); sort($array_meta_inscr); sort($array_meta_access); $subs['[meta_complete]'] = $array_meta_complete[0]; $subs['[meta_inscr]'] = $array_meta_inscr[0]; $subs['[meta_access]'] = $array_meta_access[0]; $subs['[table_course]'] = $course_count ? $table_course : ''; $subs['[table_blended]'] = $blended_count ? $table_blended : ''; } else { require_once $GLOBALS['where_lms'] . '/lib/lib.course.php'; $courseuser = new Man_CourseUser(); $course_stat =& $courseuser->getUserCourses($this->id_user, false, false, false, array($this->id_course)); if (isset($course_stat[$this->id_course])) { $subs['[date_enroll]'] = Format::date($course_stat[$this->id_course]['date_inscr'], 'date'); $subs['[date_first_access]'] = Format::date($course_stat[$this->id_course]['date_first_access'], 'date'); $subs['[date_complete]'] = Format::date($course_stat[$this->id_course]['date_complete'], 'date'); $subs['[date_complete_year]'] = substr($course_stat[$this->id_course]['date_complete'], 0, 4); } else { $subs['[date_enroll]'] = ''; $subs['[date_first_access]'] = ''; $subs['[date_complete]'] = ''; $subs['[date_complete_year]'] = ''; } require_once $GLOBALS['where_lms'] . '/lib/lib.orgchart.php'; $org_man = new OrganizationManagement($this->id_course); $score_start = $org_man->getStartObjectScore(array($this->id_user), array($this->id_course)); $score_final = $org_man->getFinalObjectScore(array($this->id_user), array($this->id_course)); require_once $GLOBALS['where_lms'] . '/lib/lib.coursereport.php'; $rep_man = new CourseReportManager(); $score_course = $rep_man->getUserFinalScore(array($this->id_user), array($this->id_course)); $subs['[test_score_start]'] = isset($score_start[$this->id_course][$this->id_user]) ? $score_start[$this->id_course][$this->id_user]['score'] : ''; $subs['[test_score_start_max]'] = isset($score_start[$this->id_course][$this->id_user]) ? $score_start[$this->id_course][$this->id_user]['max_score'] : ''; $subs['[test_score_final]'] = isset($score_final[$this->id_course][$this->id_user]) ? $score_final[$this->id_course][$this->id_user]['score'] : ''; $subs['[test_score_final_max]'] = !empty($score_final[$this->id_course][$this->id_user]['max_score']) ? $score_final[$this->id_course][$this->id_user]['max_score'] : '100'; $subs['[course_score_final]'] = isset($score_course[$this->id_user][$this->id_course]) ? $score_course[$this->id_user][$this->id_course]['score'] : ''; $subs['[course_score_final_max]'] = isset($score_course[$this->id_user][$this->id_course]) ? $score_course[$this->id_user][$this->id_course]['max_score'] : ''; require_once $GLOBALS['where_lms'] . '/lib/lib.track_user.php'; $time_in = TrackUser::getUserTotalCourseTime($this->id_user, $this->id_course); $hours = (int) ($time_in / 3600); $minutes = (int) ($time_in % 3600 / 60); $seconds = (int) ($time_in % 60); if ($minutes < 10) { $minutes = '0' . $minutes; } if ($seconds < 10) { $seconds = '0' . $seconds; } $subs['[total_time]'] = $hours . 'h ' . $minutes . 'm ' . $seconds . 's'; $subs['[total_time_hour]'] = $hours; $subs['[total_time_minute]'] = $minutes; $subs['[total_time_second]'] = $seconds; } return $subs; }
$values = array(); switch ($id_field) { case "name": $acl_man = new DoceboACLManager(); $users = getSubscribed($id_course); $allusers_info = $acl_man->getUsers($users); while (list(, $user_info) = each($allusers_info)) { $values[$user_info[ACL_INFO_IDST]] = $user_info[ACL_INFO_LASTNAME] . ' ' . $user_info[ACL_INFO_FIRSTNAME]; } break; case "email": $acl_man = new DoceboACLManager(); $users = getSubscribed($id_course); $allusers_info = $acl_man->getUsers($users); while (list(, $user_info) = each($allusers_info)) { $values[$user_info[ACL_INFO_IDST]] = $user_info[ACL_INFO_EMAIL]; } break; default: $users = getSubscribed($id_course); $values = $fman->fieldValue((int) $id_field, $users); } if ($id_field == 'name') { } else { } require_once _base_ . '/lib/lib.json.php'; $json = new Services_JSON(); $output = $json->encode($values); aout($output); break; }
$edition_elem['classrooms'] = isset($classrooms[$edition_elem['classrooms']]) ? $classrooms[$edition_elem['classrooms']] : false; $editions[$edition_elem["idCourse"]][$edition_elem["idCourseEdition"]] = $edition_elem; } } $select_ed_count = "SELECT idCourse, edition_id, sum(waiting) as waiting, COUNT(*) as user_count "; $from_ed_count = "FROM " . $GLOBALS["prefix_lms"] . "_courseuser "; $where_ed_count = "WHERE edition_id <> 0 AND idCourse = '" . $id_course . "'"; $group_ed_count = "GROUP BY 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)) { $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']; } } $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; require_once _base_ . '/lib/lib.urlmanager.php'; $url =& UrlManager::getInstance('catalogue'); $url->setStdQuery('modname=coursecatalogue&op=coursecatalogue'); if ($normal_subs == 0) { $cinfo['can_subscribe'] = 0; } $html = dashcourse($url, $lang, $cinfo, isset($usercourses[$cinfo['idCourse']]) ? $usercourses[$cinfo['idCourse']] : false, 0); $value = array("content" => $html, "elem_id" => importVar('elem_id'), "id_course" => importVar('id_course', false, 0)); require_once _base_ . '/lib/lib.json.php'; $json = new Services_JSON(); $output = $json->encode($value); aout($output);
/** * @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'); }