function lmsLoginOperation() { require_once $GLOBALS['where_lms'] . '/lib/lib.subscribe.php'; require_once $GLOBALS['where_lms'] . '/lib/lib.preassessment.php'; $pa_man = new AssessmentList(); $user_course_as_assessment = $pa_man->getUserAssessmentSubsription(Docebo::user()->getArrSt()); if (is_array($user_course_as_assessment)) { $subs_man = new CourseSubscribe_Management(); $subs_man->multipleUserSubscribe(getLogUserId(), $user_course_as_assessment['course_list'], $user_course_as_assessment['level_number']); } }
public function setRulesFromScore($score_arr) { require_once _base_ . '/lib/lib.json.php'; require_once _lms_ . '/lib/lib.subscribe.php'; $res = true; $where_score_arr = array(); foreach ($score_arr as $val) { $where_score_arr[] = "(category_id = '" . (int) $val['category_id'] . "' " . "AND from_score <= '" . (int) $val['score'] . "' AND to_score >= '" . (int) $val['score'] . "')"; } if (empty($where_score_arr)) { return ''; } $fields = "*"; $qtxt = "SELECT " . $fields . " FROM %lms_assessment_rule\r\n\t\t\tWHERE test_id='" . $this->test_id . "'\r\n\t\t\tAND (" . implode(' OR ', $where_score_arr) . ")\r\n\t\t\tORDER BY from_score ASC"; $q = $this->db->query($qtxt); $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); $csm = new CourseSubscribe_Management(); $cmpman = new CompetencesAdm(); $feedback_txt = array(); while ($row = $this->db->fetch_assoc($q)) { $course_arr = $json->decode($row['courses_list']); $competence_arr = $json->decode($row['competences_list']); $feedback_txt[] = $row['feedback_txt']; //courses subscriptions - only students are affected if (!empty($course_arr) && $_SESSION['levelCourse'] <= 3) { $arr_courses = array_keys($course_arr); $csm->multipleUserSubscribe(getLogUserId(), $arr_courses, 3); } //competences assignment - only students are affected if (!empty($competence_arr) && $_SESSION['levelCourse'] <= 3) { foreach ($competence_arr as $c_id => $data) { if ($data['type'] == 'score') { $score = isset($data['score']) ? $data['score'] : 0; if ($score > 0) { if (!$cmpman->userHasCompetence($c_id, Docebo::user()->getIdst())) { $cmpman->assignCompetenceUsers($c_id, array(Docebo::user()->getIdst() => $score)); } else { $cmpman->addScoreToUsers($c_id, array(Docebo::user()->getIdst()), $score); } } } else { if (!$cmpman->userHasCompetence($c_id, Docebo::user()->getIdst())) { $cmpman->assignCompetenceUsers($c_id, array(Docebo::user()->getIdst() => 1)); } } } } } $output = ""; if (!empty($feedback_txt)) { $output = implode('<br/><br />', $feedback_txt); } return $output; }
function preAssessmentDispatch($op) { Util::get_js(Get::rel_path('lms') . '/admin/modules/preassessment/ajax.preassessment.js', true, true); require_once _base_ . '/lib/lib.urlmanager.php'; $url =& UrlManager::getInstance(); $url->setStdQuery('modname=preassessment&op=assesmentlist'); if (isset($_POST['undo'])) { $op = 'assesmentlist'; } if (isset($_POST['cancelselector'])) { $op = 'assesmentlist'; } switch ($op) { case "assesmentlist": assesmentlist($url); break; case "modassessment": modassessment($url); break; case "delassessment": delassessment($url); break; // user management ---------------------------------------- // user management ---------------------------------------- case "modassessuser": modassessuser($url); break; case "modassessadmin": modassessadmin($url); break; // manage management -------------------------------------- // manage management -------------------------------------- case "manageassessment": checkPerm('mod'); $id_assessment = importVar('id_assess', true, 0); require_once $GLOBALS['where_lms'] . '/lib/lib.preassessment.php'; $assess_man = new AssessmentList(); if (!$assess_man->addAssessmentUser($id_assessment, USER_ASSES_TYPE_ADMIN, array(getLogUserId()))) { Util::jump_to($url->getUrl('result=error_assign')); } else { require_once $GLOBALS['where_lms'] . '/lib/lib.subscribe.php'; $subs_man = new CourseSubscribe_Management(); $subs_man->multipleUserSubscribe(getLogUserId(), array($id_assessment), 6); Docebo::user()->loadUserSectionST(); Docebo::user()->SaveInSession(); Util::jump_to($GLOBALS['where_lms_relative'] . '/index.php?modname=course&op=aula&idCourse=' . $id_assessment . '&from_admin=1'); } break; // rule management ---------------------------------------- // rule management ---------------------------------------- case "modrule": modrule($url); break; case "assignrule": assignrule($url); break; case "saverule": saverule($url); break; case "delrule": delrule($url); break; } }