function &getStudentId() { require_once $GLOBALS['where_lms'] . '/lib/lib.course.php'; $course_user = array(); $course_man = new Man_Course(); $course_user = $course_man->getIdUserOfLevel($_SESSION['idCourse'], 3); return $course_user; }
function statistic() { checkPerm('view'); require_once _base_ . '/lib/lib.table.php'; require_once $GLOBALS['where_lms'] . '/lib/lib.course.php'; $lang =& DoceboLanguage::createInstance('statistic', 'lms'); $acl_man = Docebo::user()->getAclManager(); $course_man = new Man_Course(); $course_user = $course_man->getIdUserOfLevel($_SESSION['idCourse']); $users_list =& $acl_man->getUsers($course_user); $GLOBALS['page']->add(getTitleArea($lang->def('_STATISTICS'), 'statistic') . '<div class="std_block">', 'content'); if (Get::sett('tracking') == 'on') { $GLOBALS['page']->add('<div class="title">' . $lang->def('_PAGE_VIEW') . '</div>', 'content'); outPageView('index.php?modname=statistic&op=statistic'); } $GLOBALS['page']->add('<br />', 'content'); $tb = new Table(0, $lang->def('_USERS_LIST_CAPTION'), $lang->def('_USERS_LIST_SUMMARY')); $type_h = array('', '', ''); $cont_h = array($lang->def('_USERNAME'), $lang->def('_LASTNAME'), $lang->def('_FIRSTNAME')); $tb->setColsStyle($type_h); $tb->addHead($cont_h); while (list(, $user_info) = each($users_list)) { $cont = array('<a href="index.php?modname=statistic&op=userdetails&id=' . $user_info[ACL_INFO_IDST] . '" ' . 'title="' . $lang->def('_DETAILS') . ' : ' . $acl_man->relativeId($user_info[ACL_INFO_USERID]) . '">' . $acl_man->relativeId($user_info[ACL_INFO_USERID]) . '</a>', $user_info[ACL_INFO_LASTNAME], $user_info[ACL_INFO_FIRSTNAME]); $tb->addBody($cont); } $GLOBALS['page']->add($tb->getTable() . '</div>', 'content'); }
function insCourseEdition() { checkPerm('mod'); require_once _base_ . '/lib/lib.upload.php'; require_once $GLOBALS['where_lms'] . '/lib/lib.course.php'; require_once _base_ . '/lib/lib.multimedia.php'; $array_lang = Docebo::langManager()->getAllLangCode(); $array_lang[] = 'none'; $id_course = $_POST['course_id']; if ($_POST['course_edition_name'] == '') { $_POST['course_edition_name'] = Lang::t('_NO_NAME', 'course', 'lms'); } $path = '/appLms/' . Get::sett('pathcourse'); if (substr($path, -1) != '/' && substr($path, -1) != '\\') { $path = $path . '/'; } $file_sponsor = ''; $file_logo = ''; $file_material = ''; $file_othermaterial = ''; $error = 0; $show_level = 0; $user_status = 0; if (isset($_POST['user_status'])) { while (list($status) = each($_POST['user_status'])) { $user_status |= 1 << $status; } } if (isset($_POST['course_edition_show_level'])) { while (list($lv) = each($_POST['course_edition_show_level'])) { $show_level |= 1 << $lv; } } sl_open_fileoperations(); if ($_FILES['course_edition_user_material']['tmp_name'] != '') { $file_material = 'edition_user_material_' . mt_rand(0, 100) . '_' . time() . '_' . $_FILES['course_edition_user_material']['name']; $re = createImageFromTmp($_FILES['course_edition_user_material']['tmp_name'], $path . $file_material, $_FILES['course_edition_user_material']['name'], 150, 150, true); if (!$re) { $error = 1; $file_material = ''; } } if ($_FILES['course_edition_otheruser_material']['tmp_name'] != '') { $file_othermaterial = 'edition_otheruser_material_' . mt_rand(0, 100) . '_' . time() . '_' . $_FILES['course_edition_otheruser_material']['name']; $re = createImageFromTmp($_FILES['course_edition_otheruser_material']['tmp_name'], $path . $file_othermaterial, $_FILES['course_edition_otheruser_material']['name'], 150, 150, true); if (!$re) { $error = 1; $file_othermaterial = ''; } } if ($_FILES['course_edition_sponsor_logo']['tmp_name'] != '') { $file_sponsor = 'edition_sponsor_' . mt_rand(0, 100) . '_' . time() . '_' . $_FILES['course_edition_sponsor_logo']['name']; $re = createImageFromTmp($_FILES['course_edition_sponsor_logo']['tmp_name'], $path . $file_sponsor, $_FILES['course_edition_sponsor_logo']['name'], 150, 150, true); if (!$re) { $error = 1; $file_sponsor = ''; } } if ($_FILES['course_edition_logo']['tmp_name'] != '') { $file_logo = 'edition_logo_' . mt_rand(0, 100) . '_' . time() . '_' . $_FILES['course_edition_logo']['name']; $re = createImageFromTmp($_FILES['course_edition_logo']['tmp_name'], $path . $file_logo, $_FILES['course_edition_logo']['name'], 150, 150, true); if (!$re) { $error = 1; $file_sponsor = ''; } } sl_close_fileoperations(); // if subsribe gap is defined with the date ------------------------------- if ($_POST["can_subscribe"] != "2") { $sub_start_date = "NULL"; $sub_end_date = "NULL"; } else { $sub_start_date = "'" . Format::dateDb($_POST["sub_start_date"], "date") . "'"; $sub_end_date = "'" . Format::dateDb($_POST["sub_end_date"], "date") . "'"; } // insert the course in database ----------------------------------------------------------- $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']; } } $query_course_edition = "\r\n\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_course_edition\r\n\t\tSET idCourse \t\t\t= '" . $id_course . "',\r\n\t\t\tcode \t\t\t\t= '" . $_POST['course_edition_code'] . "',\r\n\t\t\tname \t\t\t\t= '" . $_POST['course_edition_name'] . "',\r\n\t\t\tdescription \t\t= '" . $_POST['course_edition_descr'] . "',\r\n\t\t\tstatus \t\t\t\t= '" . (int) $_POST['course_edition_status'] . "',\r\n\r\n\t\t\tdate_begin \t\t\t= '" . Format::dateDb($_POST['course_edition_date_begin'], 'date') . "',\r\n\t\t\tdate_end \t\t\t= '" . Format::dateDb($_POST['course_edition_date_end'], 'date') . "',\r\n\t\t\thour_begin \t\t\t= '" . $hour_begin . "',\r\n\t\t\thour_end \t\t\t= '" . $hour_end . "',\r\n\r\n\t\t\timg_material \t\t= '" . $file_material . "',\r\n\t\t\timg_othermaterial \t= '" . $file_othermaterial . "',\r\n\r\n\t\t\tmin_num_subscribe \t= '" . (int) $_POST["min_num_subscribe"] . "',\r\n\t\t\tmax_num_subscribe \t= '" . (int) $_POST["max_num_subscribe"] . "',\r\n\t\t\tprice \t\t\t\t= '" . $_POST["edition_price"] . "',\r\n\t\t\tadvance \t\t\t= '" . $_POST["edition_advance"] . "',\r\n\r\n\t\t\tedition_type \t\t= '" . $_POST["edition_type"] . "',\r\n\t\t\tallow_overbooking \t= '" . (isset($_POST["allow_overbooking"]) ? 1 : 0) . "',\r\n\t\t\tcan_subscribe \t\t= '" . (int) $_POST["can_subscribe"] . "',\r\n\t\t\tsub_start_date \t\t= " . $sub_start_date . ",\r\n\t\t\tsub_end_date \t\t= " . $sub_end_date . ""; if (!sql_query($query_course_edition)) { $error = 1; 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); } Util::jump_to('index.php?modname=course&op=course_list&result=err_course'); } else { $edition_id = sql_insert_id(); $acl_manager =& Docebo::user()->getAclManager(); $group = '/lms/course_edition/' . $edition_id . '/subscribed'; $group_idst = $acl_manager->getGroupST($group); if ($group_idst === FALSE) { $group_idst = $acl_manager->registerGroup($group, 'all the user of a course edition', true, "course"); } // send alert --------------------------------------------------------------------------- require_once _base_ . '/lib/lib.eventmanager.php'; $msg_composer = new EventMessageComposer(); $msg_composer->setSubjectLangText('email', '_ALERT_SUBJECT', false); $msg_composer->setBodyLangText('email', '_ALERT_TEXT', array('[url]' => Get::sett('url'), '[course_code]' => $_POST['course_edition_code'], '[course]' => $_POST['course_edition_name'])); $msg_composer->setBodyLangText('sms', '_ALERT_TEXT_SMS', array('[url]' => Get::sett('url'), '[course_code]' => $_POST['course_edition_code'], '[course]' => $_POST['course_edition_name'])); require_once $GLOBALS['where_lms'] . '/lib/lib.course.php'; $course_man = new Man_Course(); $recipients = $course_man->getIdUserOfLevel($id_course); createNewAlert('CoursePropModified', 'course', 'add', '1', 'Inserted course ' . $_POST['course_name'], $recipients, $msg_composer); Util::jump_to('index.php?modname=course&op=course_list&result=ok_course'); } }
public function saveTrackStatusChange($idUser, $idCourse, $status) { require_once $GLOBALS['where_lms'] . '/lib/lib.course.php'; list($prev_status) = sql_fetch_row(sql_query("\r\n\t\tSELECT status\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_courseuser\r\n\t\tWHERE idUser = '******' AND idCourse = '" . (int) $idCourse . "'")); $extra = ''; if ($prev_status != $status) { switch ($status) { case _CUS_SUBSCRIBED: //approved subscriptin for example $extra = ", date_inscr = NOW()"; break; case _CUS_BEGIN: //first access UpdatesLms::resetCache(); $extra = ", date_first_access = NOW()"; break; case _CUS_END: //end course $extra = ", date_complete = NOW()"; break; } } if (!sql_query("\r\n\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_courseuser\r\n\t\tSET status = '" . (int) $status . "' " . $extra . "\r\n\t\tWHERE idUser = '******' AND idCourse = '" . (int) $idCourse . "'")) { return false; } $re = sql_query("\r\n\t\tSELECT when_do\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_statuschangelog\r\n\t\tWHERE status_user = '******' AND\r\n\t\t\tidUser = '******' AND\r\n\t\t\tidCourse = '" . (int) $idCourse . "'"); if (sql_num_rows($re)) { sql_query("\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_statuschangelog\r\n\t\t\tSET when_do = NOW()\r\n\t\t\tWHERE status_user = '******' AND\r\n\t\t\t\tidUser = '******' AND\r\n\t\t\t\tidCourse = '" . (int) $idCourse . "'"); } else { sql_query("\r\n\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_statuschangelog\r\n\t\t\tSET status_user = '******',\r\n\t\t\t\tidUser = '******',\r\n\t\t\t\tidCourse = '" . (int) $idCourse . "',\r\n\t\t\t\twhen_do = NOW()"); } if ($prev_status != $status && $status == _CUS_END) { // send alert if (!sql_num_rows($re)) { /* //add course's competences scores to user require_once($GLOBALS['where_lms'].'/lib/lib.competences.php'); $competences_man = new Competences_Manager(); $competences_man->AssignCourseCompetencesToUser($idCourse, $idUser); */ } require_once $GLOBALS['where_lms'] . '/lib/lib.course.php'; require_once _base_ . '/lib/lib.eventmanager.php'; $teachers = Man_Course::getIdUserOfLevel($idCourse, '6'); $cd = new DoceboCourse($idCourse); $acl_man =& Docebo::user()->getAclManager(); $array_subst = array('[user]' => $acl_man->getUserName($idUser), '[course]' => $cd->getValue('name')); $msg_composer = new EventMessageComposer(); $msg_composer->setSubjectLangText('email', '_USER_END_COURSE_SBJ', false); $msg_composer->setBodyLangText('email', '_USER_END_COURSE_TEXT', $array_subst); $msg_composer->setBodyLangText('sms', '_USER_END_COURSE_TEXT_SMS', $array_subst); // send message to the user subscribed createNewAlert('UserCourseEnded', 'status', 'modify', '1', 'User end course', $teachers, $msg_composer); //add course's competences scores to user /* require_once($GLOBALS['where_lms'].'/lib/lib.competences.php'); $competences_man = new Competences_Manager(); $competences_man->AssignCourseCompetencesToUser($idCourse, $idUser); */ //increment coursecompleted if this course is in a coursepath require_once _lms_ . '/lib/lib.coursepath.php'; $cpmodel = new CoursePath_Manager(); $cpmodel->assignComplete($idCourse, $idUser); } return true; }
function add_row($row, $pk) { $id_course = false; if ($row['code'] == '') { $row['code'] = $this->default_cols['code']; } if ($row['name'] == '') { $row['name'] = $this->default_cols['name']; } if ($row['description'] == '') { $row['description'] = $this->default_cols['description']; } if ($row['lang_code'] == '') { $row['lang_code'] = $this->default_cols['lang_code']; } if ($row['status'] == '') { $row['status'] = $this->default_cols['status']; } if ($row['subscribe_method'] == '') { $row['subscribe_method'] = $this->default_cols['subscribe_method']; } if ($row['permCloseLO'] == '') { $row['permCloseLO'] = $this->default_cols['permCloseLO']; } if ($row['difficult'] == '') { $row['difficult'] = $this->default_cols['difficult']; } if ($row['show_progress'] == '') { $row['show_progress'] = $this->default_cols['show_progress']; } if ($row['show_time'] == '') { $row['show_time'] = $this->default_cols['show_time']; } if ($row['show_extra_info'] == '') { $row['show_extra_info'] = $this->default_cols['show_extra_info']; } if ($row['show_rules'] == '') { $row['show_rules'] = $this->default_cols['show_rules']; } if ($row['date_begin'] == '') { $row['date_begin'] = $this->default_cols['date_begin']; } if ($row['date_end'] == '') { $row['date_end'] = $this->default_cols['date_end']; } if ($row['valid_time'] == '') { $row['valid_time'] = $this->default_cols['valid_time']; } if ($row['max_num_subscribe'] == '') { $row['max_num_subscribe'] = $this->default_cols['max_num_subscribe']; } if ($row['prize'] == '') { $row['prize'] = $this->default_cols['prize']; } if ($row['selling'] == '') { $row['selling'] = $this->default_cols['selling']; } // check if the course identified by the pk alredy exits $id_course = $this->get_row_by_pk($pk); if ($id_course === false) { $this->last_error = 'Error in search query : ( ' . mysql_error() . ' )'; return false; } if ($id_course === 'jump') { return true; } $is_add = false; if ($id_course === 0) { $is_add = true; // course is to add $query_course = "\r\n\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_course \r\n\t\t\tSET idCategory = '0', \r\n\t\t\t\tcode = '" . addslashes($row['code']) . "', \r\n\t\t\t\tname = '" . addslashes($row['name']) . "', \r\n\t\t\t\tdescription = '" . $row['description'] . "', \r\n\t\t\t\tlang_code = '" . $row['lang_code'] . "', \r\n\t\t\t\tstatus = '" . $row['status'] . "', \r\n\t\t\t\tsubscribe_method = '" . $row['subscribe_method'] . "',\r\n\t\t\t\tpermCloseLO = '" . $row['permCloseLO'] . "', \r\n\t\t\t\tdifficult = '" . $row['difficult'] . "', \r\n\t\t\t\tshow_progress = '" . $row['show_progress'] . "', \r\n\t\t\t\tshow_time = '" . $row['show_time'] . "', \r\n\t\t\t\tshow_extra_info = '" . $row['show_extra_info'] . "', \r\n\t\t\t\tshow_rules = '" . $row['show_rules'] . "', \r\n\t\t\t\tdate_begin = '" . $row['date_begin'] . "', \r\n\t\t\t\tdate_end = '" . $row['date_end'] . "', \r\n\t\t\t\tvalid_time = '" . $row['valid_time'] . "',\r\n\t\t\t\tmax_num_subscribe = '" . $row['max_num_subscribe'] . "', \r\n\t\t\t\tprize = '" . $row['prize'] . "',\r\n\t\t\t\tselling = '" . $row['selling'] . "',\r\n\t\t\t\timported_from_connection = '" . $this->get_name() . "'"; if (!sql_query($query_course)) { $this->last_error = 'Error in insert query : ( ' . mysql_error() . ' )' . '<!-- ' . $query_course . ' -->'; return false; } $id_course = mysql_insert_id(); // import the menu if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) { $re &= sql_query("\r\n\t\t\t\tINSERT INTO " . $GLOBALS['prefix_fw'] . "_admin_course \r\n\t\t\t\t( id_entry, type_of_entry, idst_user ) VALUES \r\n\t\t\t\t( '" . $id_course . "', 'course', '" . getLogUserId() . "') "); } //if the scs exist create a room if ($GLOBALS['where_scs'] !== false) { require_once $GLOBALS['where_scs'] . '/lib/lib.room.php'; $rules = array('room_name' => $row['name'], 'room_type' => 'course', 'id_source' => $id_course); $admin_rules = getAdminRules(); $rules = array_merge($rules, $admin_rules); $re = insertRoom($rules); } $course_idst = DoceboCourse::createCourseLevel($id_course); require_once $GLOBALS['where_lms'] . '/lib/lib.manmenu.php'; if (!cerateCourseMenuFromCustom($this->std_menu_to_assign, $id_course, $course_idst)) { $this->last_error = 'Error in menu assignament'; return false; } } else { // course is to update $query_course = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_course \r\n\t\t\tSET code = '" . addslashes($row['code']) . "', \r\n\t\t\t\tname = '" . addslashes($row['name']) . "', \r\n\t\t\t\tdescription = '" . $row['description'] . "', \r\n\t\t\t\tlang_code = '" . $row['lang_code'] . "', \r\n\t\t\t\tstatus = '" . $row['status'] . "', \r\n\t\t\t\tsubscribe_method = '" . $row['subscribe_method'] . "',\r\n\t\t\t\tpermCloseLO = '" . $row['permCloseLO'] . "', \r\n\t\t\t\tdifficult = '" . $row['difficult'] . "', \r\n\t\t\t\tshow_progress = '" . $row['show_progress'] . "', \r\n\t\t\t\tshow_time = '" . $row['show_time'] . "', \r\n\t\t\t\tshow_extra_info = '" . $row['show_extra_info'] . "', \r\n\t\t\t\tshow_rules = '" . $row['show_rules'] . "', \r\n\t\t\t\tdate_begin = '" . $row['date_begin'] . "', \r\n\t\t\t\tdate_end = '" . $row['date_end'] . "', \r\n\t\t\t\tvalid_time = '" . $row['valid_time'] . "',\r\n\t\t\t\tmax_num_subscribe = '" . $row['max_num_subscribe'] . "', \r\n\t\t\t\tprize = '" . $row['prize'] . "',\r\n\t\t\t\tselling = '" . $row['selling'] . "'\r\n\t\t\tWHERE idCourse = '" . $id_course . "'"; if (!sql_query($query_course)) { $this->last_error = 'Error in update query : ( ' . mysql_error() . ' )' . '<!-- ' . $query_course . ' -->'; return false; } } if ($id_course != false) { if ($this->cache_inserted) { $this->arr_id_inserted[] = $id_course; } if ($this->sendnotify == 1) { // send notify if ($is_add) { require_once $GLOBALS['where_framework'] . '/lib/lib.eventmanager.php'; $msg_composer = new EventMessageComposer(); $msg_composer->setSubjectLangText('email', '_ALERT_SUBJECT', false); $msg_composer->setBodyLangText('email', '_ALERT_TEXT', array('[url]' => Get::sett('url'), '[course_code]' => $row['code'], '[course]' => $row['name'])); $msg_composer->setBodyLangText('sms', '_ALERT_TEXT_SMS', array('[url]' => Get::sett('url'), '[course_code]' => $row['code'], '[course]' => $row['name'])); require_once $GLOBALS['where_lms'] . '/lib/lib.course.php'; $course_man = new Man_Course(); $recipients = $course_man->getIdUserOfLevel($id_course); createNewAlert('CoursePropModified', 'course', 'add', '1', 'Inserted course ' . $_POST['course_name'], $recipients, $msg_composer); } } return true; } $this->last_error = 'Unknow error'; return false; }
function upcourseinfo() { checkPerm('mod'); $array_lang = Docebo::langManager()->getAllLangCode(); $user_status = 0; if (isset($_POST['user_status'])) { while (list($status) = each($_POST['user_status'])) { $user_status |= 1 << $status; } } $file_sponsor = ''; $file_logo = ''; $re = true; $show_level = 0; if (isset($_POST['course_show_level'])) { while (list($lv) = each($_POST['course_show_level'])) { $show_level |= 1 << $lv; } } $query_course = "\r\n\tUPDATE " . $GLOBALS['prefix_lms'] . "_course \r\n\tSET code = '" . $_POST['course_code'] . "', \r\n\t\tname = '" . $_POST['course_name'] . "', \r\n\t\tdescription = '" . $_POST['course_descr'] . "', \r\n\t\tlang_code = '" . $array_lang[$_POST['course_lang']] . "', \r\n\t\tstatus = '" . (int) $_POST['course_status'] . "', \r\n\t\tlevel_show_user = '******', \r\n\t\tmediumTime = '" . $_POST['course_medium_time'] . "',\r\n\t\tpermCloseLO = '" . $_POST['course_em'] . "', \r\n\t\tuserStatusOp = '" . $user_status . "', \r\n\t\tdifficult = '" . $_POST['course_difficult'] . "', \r\n\t\tshow_progress = '" . (isset($_POST['course_progress']) ? 1 : 0) . "', \r\n\t\tshow_time = '" . (isset($_POST['course_time']) ? 1 : 0) . "', \r\n\t\tshow_extra_info = '" . (isset($_POST['course_advanced']) ? 1 : 0) . "', \r\n\t\tshow_rules = '" . (int) $_POST['course_show_rules'] . "' \r\n\tWHERE idCourse = '" . $_SESSION['idCourse'] . "'"; if (!sql_query($query_course)) { $re = false; } $acl_man =& Docebo::user()->getAclManager(); // send alert require_once _base_ . '/lib/lib.eventmanager.php'; $msg_composer = new EventMessageComposer(); $msg_composer->setSubjectLangText('email', '_ALERT_SUBJECT_MODCOURSE_INFO', false); $msg_composer->setBodyLangText('email', '_ALERT_TEXT_MODCOURSE_INFO', array('[url]' => Get::sett('url'), '[course_code]' => $_POST['course_code'], '[course]' => $_POST['course_name'])); $msg_composer->setBodyLangText('sms', '_ALERT_TEXT_MODCOURSE_INFO_SMS', array('[url]' => Get::sett('url'), '[course_code]' => $_POST['course_code'], '[course]' => $_POST['course_name'])); require_once $GLOBALS['where_lms'] . '/lib/lib.course.php'; $course_man = new Man_Course(); $recipients = $course_man->getIdUserOfLevel($_SESSION['idCourse']); createNewAlert('CoursePorpModified', 'course', 'add', '1', 'Inserted course ' . $_POST['course_name'], $recipients, $msg_composer); Util::jump_to('index.php?modname=course&op=infocourse&result=' . ($re ? 'ok' : 'err')); }
</h2> <p class="course_support_info"> <?php echo Lang::t($this->ustatus[$course['user_status']], 'course') . '' . Lang::t('_USER_LVL', 'course', array('[level]' => '<b>' . $this->levels[$course['level']] . '</b>')); ?> </p> <?php $acl_man = Docebo::user()->getAclManager(); $levels = CourseLevel::getLevels(); while (list($num_lv, $name_level) = each($levels)) { if (CourseLevel::isTeacher($num_lv)) { } if ($course['level_show_user'] & 1 << $num_lv) { if (CourseLevel::isTeacher($num_lv)) { echo " " . $name_level . ": "; $users =& $acl_man->getUsers(Man_Course::getIdUserOfLevel($course['idCourse'], $num_lv, $course['course_edition'])); if (!empty($users)) { $first = true; while (list($id_user, $user_info) = each($users)) { if ($first) { $first = false; } else { echo ', '; } // echo '<a href="index.php?modname=course&op=viewprofile&id_user='******'">' . $acl_man->getConvertedUserName($user_info) . '</a>'; echo '<b>' . $acl_man->getConvertedUserName($user_info) . '</b>'; } // end while } // end if }
function getRepoUserListWithFileCount($id_repo, $from_date = false) { require_once $GLOBALS['where_lms'] . '/lib/lib.course.php'; $file_list = array(); $acl_man = Docebo::user()->getAclManager(); $course_man = new Man_Course(); $course_user = $course_man->getIdUserOfLevel($this->_id_course, 3); if (empty($course_user)) { return $file_list; } $users_list =& $acl_man->getUsers($course_user); while (list(, $user) = each($users_list)) { $file_list[$user[ACL_INFO_IDST]] = array(); $file_list[$user[ACL_INFO_IDST]]['id_user'] = $user[ACL_INFO_IDST]; $file_list[$user[ACL_INFO_IDST]]['username'] = $acl_man->getConvertedUserName($user); } $query = " SELECT f.id_author, COUNT(*) " . " FROM " . $this->_tableFile() . " AS f " . " WHERE f.id_repository = " . (int) $id_repo . " " . " AND f.id_author IN ( " . implode(',', $course_user) . " ) " . " GROUP BY f.id_author"; $re_query = sql_query($query); while ($row = sql_fetch_row($re_query)) { $file_list[$row[0]]['file_count'] = $row[1]; } // if from_date is passed if ($from_date !== false) { $query = " SELECT f.id_author, COUNT(*) " . " FROM " . $this->_tableFile() . " AS f " . " WHERE f.id_repository = " . (int) $id_repo . " " . " AND f.id_author IN ( " . implode(',', $course_user) . " ) " . " \t AND f.post_date > '" . $from_date . "' " . " GROUP BY f.id_author"; $re_query = sql_query($query); while ($row = sql_fetch_row($re_query)) { $file_list[$row[0]]['file_new'] = $row[1]; } } return $file_list; }