Ejemplo n.º 1
0
 function getCategories($param = false)
 {
     $temp = $param ? $param : Get::req($this->id . "_input", DOTY_MIXED, false);
     $nodes = explode(',', $temp);
     $output = array();
     $branches = array();
     foreach ($nodes as $node) {
         if (stristr($node, "d")) {
             $branches[] = '/ocd_' . str_replace('d', '', $node);
         } else {
             $branches[] = '/oc_' . $node;
         }
     }
     $acl = new DoceboACLManager();
     $groups = $acl->getGroupsIdByPaths($branches);
     $output = $acl->getAllUsersFromIdst($groups);
     return $output;
 }
 function _get_games_query($type = 'html', $report_data = NULL, $other = '')
 {
     require_once dirname(__FILE__) . '/report_tableprinter.php';
     if ($report_data == NULL) {
         $ref =& $_SESSION['report_tempdata'];
     } else {
         $ref =& $report_data;
     }
     $_ERR_NOUSER = Lang::t('_EMPTY_SELECTION', 'report');
     $_ERR_NOCOMP = Lang::t('_EMPTY_SELECTION', 'report');
     $_ERR_NODATA = Lang::t('_NO_CONTENT', 'report');
     require_once _lms_ . '/lib/lib.report.php';
     $lang_type = _getLOtranslations();
     $sel_all = $ref['rows_filter']['select_all'];
     $arr_selected_users = $ref['rows_filter']['selection'];
     //list of users selected in the filter (users, groups and org.branches)
     $comp_all = $ref['columns_filter']['all_games'];
     $arr_selected_comp = $ref['columns_filter']['comp_selection'];
     //list of communications selected in the filter
     $start_date = substr($ref['columns_filter']['comp_start_date'], 0, 10);
     $end_date = substr($ref['columns_filter']['comp_end_date'], 0, 10);
     //check and validate time period dates
     if (!preg_match('/^(\\d{4})\\D?(0[1-9]|1[0-2])\\D?([12]\\d|0[1-9]|3[01])$/', $start_date) || $start_date == '0000-00-00') {
         $start_date = '';
     }
     if (!preg_match('/^(\\d{4})\\D?(0[1-9]|1[0-2])\\D?([12]\\d|0[1-9]|3[01])$/', $end_date) || $end_date == '0000-00-00') {
         $end_date = '';
     }
     if ($start_date != '') {
         $start_date .= ' 00:00:00';
     }
     if ($end_date != '') {
         $end_date .= ' 23:59:59';
     }
     if ($start_date != '' && $end_date != '') {
         if ($start_date > $end_date) {
             //invalid time period
             $start_date = '';
             $end_date = '';
         }
     }
     //instantiate acl manager
     $acl_man = new DoceboACLManager();
     $acl_man->include_suspended = true;
     //extract user idst from selection
     if ($sel_all) {
         $arr_selected_users = $acl_man->getAllUsersIdst();
     } else {
         $arr_selected_users = $acl_man->getAllUsersFromIdst($arr_selected_users);
     }
     //admin users filter
     $userlevelid = Docebo::user()->getUserLevelId();
     if ($userlevelid != ADMIN_GROUP_GODADMIN && !Docebo::user()->isAnonymous()) {
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_tree = $adminManager->getAdminTree(Docebo::user()->getIdST());
         $admin_users = $acl_man->getAllUsersFromIdst($admin_tree);
         $admin_users = array_unique($admin_users);
         //filter users selection by admin visible users
         $arr_selected_users = array_intersect($arr_selected_users, $admin_users);
         //free some memory
         unset($admin_tree);
         unset($admin_users);
         unset($adminManager);
     }
     //Has the "All games" options been selected ?
     if ($comp_all) {
         $query = "SELECT id_game FROM %lms_games";
         $res = $this->db->query($query);
         $arr_selected_comp = array();
         while (list($id_game) = $this->db->fetch_row($res)) {
             $arr_selected_comp[] = $id_game;
         }
     }
     //check selected users ...
     //$arr_selected_users = array(); //list of users selected in the filter (users, groups and org.branches)
     if ($arr_selected_users <= 0) {
         cout('<p>' . $_ERR_NOUSER . '</p>');
         return;
     }
     //$arr_selected_comp = array(); //list of communications selected in the filter
     if ($arr_selected_comp <= 0) {
         cout('<p>' . $_ERR_NOCOMP . '</p>');
         return;
     }
     $arr_comp = array();
     //array $id_comm => list of generic idst
     foreach ($arr_selected_comp as $id_game) {
         $arr_comp[$id_game] = array();
     }
     //if no users have been assigned to the games, than display as 0 - 0
     $arr_idst = array();
     //flat list of idst
     $query = "SELECT * FROM %lms_games_access WHERE id_comp IN (" . implode(",", $arr_selected_comp) . ")";
     $res = $this->db->query($query);
     while (list($id_game, $idst) = $this->db->fetch_row($res)) {
         $arr_idst[] = $idst;
         $arr_comp[$id_game][] = $idst;
     }
     if (count($arr_idst) <= 0) {
         cout('<p>' . $_ERR_NOUSER . '</p>');
         return;
     }
     $arr_groups = array();
     //flat list of group idst
     $query = "SELECT idst FROM %adm_group WHERE idst IN (" . implode(",", $arr_idst) . ")";
     $res = $this->db->query($query);
     while (list($idst) = $this->db->fetch_row($res)) {
         $arr_groups[] = $idst;
     }
     //if any group selected, then extract users and create an array [id_group][id_user]
     $arr_idst_users_flat = array();
     $arr_members = array();
     //array $idst group => list of idst
     if (count($arr_groups) > 0) {
         $query = "SELECT idst, idstMember FROM %adm_group_members WHERE " . " idst IN (" . implode(",", $arr_groups) . ")" . " AND idstMember IN (" . implode(",", $arr_selected_users) . ")";
         $res = $this->db->query($query);
         while (list($idst, $idstMember) = $this->db->fetch_row($res)) {
             $arr_members[$idst][] = $idstMember;
             $arr_idst_users_flat[] = $idstMember;
         }
     }
     //set an array with all users idst ($_all)
     $diff = array_diff($arr_selected_users, $arr_groups);
     $_all_users = array_merge($arr_idst_users_flat, $diff);
     unset($diff);
     if (count($_all_users) <= 0) {
         cout('<p>' . $_ERR_NOUSER . '</p>');
         return;
     }
     //users have been extracted by group, now calculate report's rows ----------
     //get games info data and put it in an array by id_game => {info}
     $arr_comp_data = array();
     $query = "SELECT * FROM %lms_games WHERE id_game IN (" . implode(",", $arr_selected_comp) . ")";
     $res = $this->db->query($query);
     while ($obj = $this->db->fetch_obj($res)) {
         $arr_comp_data[$obj->id_game] = array('title' => $obj->title, 'type_of' => $obj->type_of, 'start_date' => $obj->start_date, 'end_date' => $obj->end_date);
     }
     //which selected communication has been seen by selected users?
     $arr_viewed = array();
     $query = "SELECT idReference, COUNT(idUser) as count " . " FROM %lms_games_track WHERE status IN ('completed', 'passed') " . " AND idUser IN (" . implode(",", $_all_users) . ") " . " AND idReference IN (" . implode(",", $arr_selected_comp) . ") " . ($start_date != '' ? " AND dateAttempt >= '" . $start_date . "' " : "") . ($end_date != '' ? " AND dateAttempt <= '" . $end_date . "' " : "") . " GROUP BY idReference";
     $res = $this->db->query($query);
     while ($obj = $this->db->fetch_obj($res)) {
         $arr_viewed[$obj->idReference] = $obj->count;
     }
     //calculate average values, no conditions on the status
     $arr_average = array();
     $query = "SELECT idReference, AVG(current_score) as average_current_score, " . " AVG(max_score) as average_max_score, AVG(num_attempts) as average_num_attempts " . " FROM %lms_games_track WHERE idUser IN (" . implode(",", $_all_users) . ") " . " AND idReference IN (" . implode(",", $arr_selected_comp) . ") " . ($start_date != '' ? " AND dateAttempt >= '" . $start_date . "' " : "") . ($end_date != '' ? " AND dateAttempt <= '" . $end_date . "' " : "") . " GROUP BY idReference";
     $res = $this->db->query($query);
     while ($obj = $this->db->fetch_obj($res)) {
         $arr_average[$obj->idReference] = $obj;
     }
     /*
     		//user details buffer
     		$acl_man = Docebo::user()->getAclManager();
     		$user_details = array();
     		$query = "SELECT idst, userid FROM %adm_user WHERE idst IN (".implode(",", $_all_users).")";
     		$res = $this->db->query($query);
     		while ($obj = $this->db->fetch_obj($res)) {
     			$user_details[$obj->idst] = $acl_man($obj->userid);
     		}
     */
     //set table properties and buffer
     $head = array(Lang::t('_GAMES_TITLE', 'report'), Lang::t('_GAMES_TYPE', 'report'), Lang::t('_FROM', 'standard'), Lang::t('_TO', 'standard'), Lang::t('_GAMES_ATTEMPTED', 'report'), Lang::t('_GAMES_TOTAL', 'report'), Lang::t('_GAMES_PERCENT', 'report'), Lang::t('_GAMES_AVG_SCORE', 'report'), Lang::t('_GAMES_AVG_MAX_SCORE', 'report'), Lang::t('_GAMES_AVG_NUM_ATTEMPTS', 'report'));
     $buffer = new ReportTablePrinter();
     $buffer->openTable('', '');
     $buffer->openHeader();
     $buffer->addHeader($head);
     $buffer->closeHeader();
     $buffer->openBody();
     //rows cycle
     foreach ($arr_comp as $id_game => $comp_id_list) {
         //calculate total assigned users for every communication
         $count = 0;
         foreach ($comp_id_list as $idst) {
             if (array_key_exists($idst, $arr_members)) {
                 foreach ($arr_members[$idst] as $idst_user) {
                     $count++;
                 }
             } else {
                 $count++;
             }
         }
         //line (one per communication)
         $line = array();
         $type_of = $arr_comp_data[$id_game]['type_of'];
         $completed_by = isset($arr_viewed[$id_game]) ? $arr_viewed[$id_game] : 0;
         $line[] = $arr_comp_data[$id_game]['title'];
         $line[] = isset($lang_type[$type_of]) ? $lang_type[$type_of] : '';
         $line[] = Format::date($arr_comp_data[$id_game]['start_date'], 'date');
         $line[] = Format::date($arr_comp_data[$id_game]['end_date'], 'date');
         $line[] = $completed_by;
         $line[] = $count;
         $line[] = number_format(($count > 0 ? $completed_by / $count : 0) * 100, 2, ',', '') . ' %';
         $avg1 = isset($arr_average[$id_game]) ? $arr_average[$id_game]->average_current_score : '';
         $avg2 = isset($arr_average[$id_game]) ? $arr_average[$id_game]->average_max_score : '';
         $avg3 = isset($arr_average[$id_game]) ? $arr_average[$id_game]->average_num_attempts : '';
         $line[] = number_format($avg1, 2, ',', '.');
         $line[] = number_format($avg2, 2, ',', '.');
         $line[] = number_format($avg3, 2, ',', '.');
         $buffer->addLine($line);
     }
     $buffer->closeBody();
     $buffer->closeTable();
     cout($buffer->get());
 }
Ejemplo n.º 3
0
 function _get_games_query($type = 'html', $report_data = NULL, $other = '')
 {
     require_once dirname(__FILE__) . '/report_tableprinter.php';
     if ($report_data == NULL) {
         $ref =& $_SESSION['report_tempdata'];
     } else {
         $ref =& $report_data;
     }
     $_ERR_NOUSER = Lang::t('_EMPTY_SELECTION', 'report');
     $_ERR_NOCOMP = Lang::t('_EMPTY_SELECTION', 'report');
     $_ERR_NODATA = Lang::t('_NO_CONTENT', 'report');
     //LO object types translations
     require_once _lms_ . '/lib/lib.report.php';
     $lang_type = _getLOtranslations();
     $sel_all = $ref['rows_filter']['all_users'];
     $arr_selected_users = $ref['rows_filter']['users'];
     //list of users selected in the filter (users, groups and org.branches)
     $comp_all = isset($ref['columns_filter']['all_games']) ? $ref['columns_filter']['all_games'] : false;
     $arr_selected_comp = isset($ref['columns_filter']['comp_selection']) ? $ref['columns_filter']['comp_selection'] : array();
     //list of communications selected in the filter
     $start_date = isset($ref['columns_filter']['comp_start_date']) ? substr($ref['columns_filter']['comp_start_date'], 0, 10) : '';
     $end_date = isset($ref['columns_filter']['comp_end_date']) ? substr($ref['columns_filter']['comp_end_date'], 0, 10) : '';
     //check and validate time period dates
     if (!preg_match('/^(\\d{4})\\D?(0[1-9]|1[0-2])\\D?([12]\\d|0[1-9]|3[01])$/', $start_date) || $start_date == '0000-00-00') {
         $start_date = '';
     }
     if (!preg_match('/^(\\d{4})\\D?(0[1-9]|1[0-2])\\D?([12]\\d|0[1-9]|3[01])$/', $end_date) || $end_date == '0000-00-00') {
         $end_date = '';
     }
     if ($start_date != '') {
         $start_date .= ' 00:00:00';
     }
     if ($end_date != '') {
         $end_date .= ' 23:59:59';
     }
     if ($start_date != '' && $end_date != '') {
         if ($start_date > $end_date) {
             //invalid time period
             $start_date = '';
             $end_date = '';
         }
     }
     //other checkings and validations
     if (!$sel_all && count($selection) <= 0) {
         cout('<p>' . $_ERR_NOUSER . '</p>');
         return;
     }
     $acl_man = new DoceboACLManager();
     $acl_man->include_suspended = true;
     //extract user idst from selection
     if ($sel_all) {
         $arr_selected_users = $acl_man->getAllUsersIdst();
     } else {
         $arr_selected_users = $acl_man->getAllUsersFromIdst($arr_selected_users);
     }
     if ($comp_all) {
         $query = "SELECT id_game FROM %lms_games";
         $res = $this->db->query($query);
         $arr_selected_comp = array();
         while (list($id_game) = $this->db->fetch_row($res)) {
             $arr_selected_comp[] = $id_game;
         }
     }
     //admin users filter
     $userlevelid = Docebo::user()->getUserLevelId();
     if ($userlevelid != ADMIN_GROUP_GODADMIN && !Docebo::user()->isAnonymous()) {
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_tree = $adminManager->getAdminTree(Docebo::user()->getIdST());
         $admin_users = $acl_man->getAllUsersFromIdst($admin_tree);
         $admin_users = array_unique($admin_users);
         //filter users selection by admin visible users
         $arr_selected_users = array_intersect($arr_selected_users, $admin_users);
         //free some memory
         unset($admin_tree);
         unset($admin_users);
         unset($adminManager);
     }
     //check selected users ...
     if (count($arr_selected_users) <= 0) {
         //message: no users selected
         cout('<p>' . $_ERR_NOUSER . '</p>');
         return;
     }
     //check selected communications ...
     if (count($arr_selected_comp) <= 0) {
         //message: no communications selected
         cout('<p>' . $_ERR_NOCOMP . '</p>');
         return;
     }
     //set table properties and buffer
     $head = array(Lang::t('_GAMES_TITLE', 'report'), Lang::t('_GAMES_TYPE', 'report'), Lang::t('_FROM', 'report'), Lang::t('_TO', 'report'), Lang::t('_USER', 'report'), Lang::t('_GAMES_ATTEMPTED', 'report'), Lang::t('_GAMES_ATTEMPT_DATE', 'report'), Lang::t('_GAMES_FIRST_ATTEMPT_DATE', 'report'), Lang::t('_GAMES_CURRENT_SCORE', 'report'), Lang::t('_GAMES_MAX_SCORE', 'report'), Lang::t('_GAMES_NUM_ATTEMPTS', 'report'));
     if ($this->use_mail) {
         $head[] = array('style' => 'img-cell', 'value' => $this->_loadEmailIcon());
     }
     $buffer = new ReportTablePrinter();
     $buffer->openTable('', '');
     $buffer->openHeader();
     $buffer->addHeader($head);
     $buffer->closeHeader();
     $buffer->openBody();
     //rows cycle
     //which selected communication has been seen by selected users?
     $_YES = Lang::t('_YES', 'standard');
     $_NO = Lang::t('_NO', 'standard');
     $arr_viewed = array();
     $query = "SELECT ct.idReference, c.title, c.type_of, c.start_date, c.end_date, ct.status, " . " ct.dateAttempt, ct.firstAttempt, ct.idUser, u.userid, u.firstname, u.lastname, " . " ct.current_score, ct.max_score, ct.num_attempts " . " FROM (%lms_games_track as ct " . " JOIN %lms_games as c ON (ct.idReference=c.id_game)) " . " JOIN %adm_user as u ON (ct.idUser=u.idst) " . " WHERE ct.idUser IN (" . implode(",", $arr_selected_users) . ") " . " AND c.id_game IN (" . implode(",", $arr_selected_comp) . ") " . ($start_date != '' ? " AND ct.dateAttempt >= '" . $start_date . "' " : "") . ($end_date != '' ? " AND ct.dateAttempt <= '" . $end_date . "' " : "") . " ORDER BY c.title, u.userid";
     $res = $this->db->query($query);
     if ($this->db->num_rows($res) <= 0) {
         cout('<p>' . $_ERR_NODATA . '</p>');
         return;
     }
     while ($obj = $this->db->fetch_obj($res)) {
         $line = array();
         $line[] = $obj->title;
         $line[] = isset($lang_type[$obj->type_of]) ? $lang_type[$obj->type_of] : '';
         $line[] = Format::date($obj->start_date, "date");
         $line[] = Format::date($obj->end_date, "date");
         $line[] = $acl_man->relativeId($obj->userid);
         $line[] = $obj->status == 'completed' || $obj->status == 'passed' ? $_YES : $_NO;
         $line[] = Format::date($obj->dateAttempt, "datetime");
         $line[] = Format::date($obj->firstAttempt, "datetime");
         $line[] = $obj->current_score;
         $line[] = $obj->max_score;
         $line[] = $obj->num_attempts;
         if ($this->use_mail) {
             $line[] = '<div class="align_center">' . Form::getInputCheckbox('mail_' . $obj->idUser, 'mail_recipients[]', $obj->idUser, isset($_POST['select_all']), '') . '</div>';
         }
         $buffer->addLine($line);
     }
     $buffer->closeBody();
     $buffer->closeTable();
     cout($buffer->get());
     $this->_loadEmailActions();
 }
Ejemplo n.º 4
0
function modAssignmentAssignMetaCertificate()
{
    checkPerm('mod');
    require_once _base_ . '/lib/lib.form.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.directory.php';
    require_once _base_ . '/lib/lib.userselector.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.course_managment.php';
    $lang =& DoceboLanguage::createInstance('certificate', 'lms');
    $id_certificate = importVar('id_certificate', true, 0);
    $id_meta = Get::req('idmeta', DOTY_INT, 0);
    $step = Get::req('step', DOTY_INT, 0);
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $acl_man =& Docebo::user()->getAclManager();
    $aclManager = new DoceboACLManager();
    $user_select = new UserSelector();
    $form = new Form();
    $sel = new Course_Manager();
    $course_man = new Man_Course();
    if (isset($_POST['okselector'])) {
        $user_selected = $user_select->getSelection($_POST);
        $_SESSION['meta_certificate']['users'] = $user_selected;
        $step++;
    }
    if (isset($_POST['import_filter'])) {
        $_SESSION['meta_certificate']['course'] = $sel->getCourseSelection($_POST);
        $step++;
    }
    if (isset($_POST['insert'])) {
        $step++;
    }
    if ($step == 3) {
        $array_user =& $aclManager->getAllUsersFromIdst($_SESSION['meta_certificate']['users']);
        $array_user = array_unique($array_user);
        $res = true;
        $user_reset = array();
        $course_reset = array();
        $reasign = array();
        //array reasign
        $query = "SELECT idUser, idCourse" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idMetaCertificate = '" . $id_meta . "'";
        $result = sql_query($query);
        while (list($id_user, $id_course) = sql_fetch_row($result)) {
            $reasign[$id_user][$id_course] = 1;
        }
        //array user_reset
        $query = "SELECT DISTINCT idUser" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idMetaCertificate = '" . $id_meta . "'";
        $result = sql_query($query);
        while (list($id_user) = sql_fetch_row($result)) {
            $user_reset[$id_user] = $id_user;
        }
        //array course_reset
        $query = "SELECT DISTINCT idCourse" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idMetaCertificate = '" . $id_meta . "'";
        $result = sql_query($query);
        while (list($id_course) = sql_fetch_row($result)) {
            $course_reset[$id_course] = $id_course;
        }
        //finish array initialization
        $query_course = "INSERT INTO " . $GLOBALS['prefix_lms'] . "_certificate_meta_course (idMetaCertificate, idUser, idCourse)" . " VALUES ";
        $first = true;
        $array_user_flipped = array_flip($array_user);
        foreach ($user_reset as $id_user) {
            if (!isset($array_user_flipped[$id_user])) {
                $query = "DELETE FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $id_meta . "'";
                if (!sql_query($query)) {
                    $res = false;
                }
            }
        }
        if (!$res) {
            Util::jump_to('index.php?modname=meta_certificate&op=assign&id_certificate=' . $id_certificate . '&res=error_mod_assign');
        }
        foreach ($course_reset as $id_course) {
            if (!isset($_SESSION['meta_certificate']['course'][$id_course])) {
                $query = "DELETE FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idCourse = '" . $id_course . "'" . " AND idMetaCertificate = '" . $id_meta . "'";
                if (!sql_query($query)) {
                    $res = false;
                }
            }
        }
        if (!$res) {
            Util::jump_to('index.php?modname=meta_certificate&op=assign&id_certificate=' . $id_certificate . '&res=error_mod_assign');
        }
        reset($_SESSION['meta_certificate']['course']);
        foreach ($array_user as $id_user) {
            foreach ($_SESSION['meta_certificate']['course'] as $id_course) {
                if (isset($_POST['_' . $id_user . '_' . $id_course . '_'])) {
                    if (!isset($reasign[$id_user][$id_course])) {
                        if ($first) {
                            $query_course .= "('" . $id_meta . "', '" . $id_user . "', '" . $id_course . "')";
                            $first = false;
                        } else {
                            $query_course .= ", ('" . $id_meta . "', '" . $id_user . "', '" . $id_course . "')";
                        }
                    }
                } else {
                    if (isset($reasign[$id_user][$id_course])) {
                        $query = "DELETE FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idUser = '******'" . " AND idCourse = '" . $id_course . "'" . " AND idMetaCertificate = '" . $id_meta . "'";
                        if (!sql_query($query)) {
                            $res = false;
                        }
                    }
                }
            }
        }
        if (!$res) {
            Util::jump_to('index.php?modname=meta_certificate&op=assign&id_certificate=' . $id_certificate . '&res=error_mod_assign');
        }
        $res = sql_query($query_course);
        if ($res) {
            Util::jump_to('index.php?modname=meta_certificate&op=assign&id_certificate=' . $id_certificate . '&res=ok');
        } else {
            Util::jump_to('index.php?modname=meta_certificate&op=assign&id_certificate=' . $id_certificate . '&res=error_mod_assign');
        }
    } elseif ($step == 2) {
        YuiLib::load();
        Util::get_js(Get::rel_path('base') . '/lib/js_utils.js', true, true);
        $tb = new Table(0, $lang->def('_META_CERTIFICATE_NEW_ASSIGN_CAPTION'), $lang->def('_META_CERTIFICATE_NEW_ASSIGN_SUMMARY'));
        $tb->setLink('index.php?modname=meta_certificate&amp;op=modassignment');
        $out->add(getTitleArea($lang->def('_TITLE_META_CERTIFICATE_ASSIGN'), 'certificate') . '<div class="std_block">' . $form->openForm('new_assign_step_2', 'index.php?modname=meta_certificate&amp;op=modassignment') . $form->getHidden('id_certificate', 'id_certificate', $id_certificate) . $form->getHidden('idmeta', 'idmeta', $id_meta) . $form->getHidden('step', 'step', 2) . $form->getHidden('reasign', 'reasign', 1));
        $reasign = array();
        if (!isset($_POST['reasign'])) {
            $query = "SELECT idUser, idCourse" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idMetaCertificate = '" . $id_meta . "'";
            $result = sql_query($query);
            while (list($id_user, $id_course) = sql_fetch_row($result)) {
                $reasign[$id_user][$id_course] = 1;
            }
        }
        $form_name = 'new_assign_step_2';
        $type_h = array('', '');
        $cont_h = array($lang->def('_FULLNAME'), $lang->def('_USERNAME'));
        foreach ($_SESSION['meta_certificate']['course'] as $id_course) {
            $type_h[] = 'align_center';
            $course_info = $course_man->getCourseInfo($id_course);
            $cont_h[] = $course_info['code'] . ' - ' . $course_info['name'];
        }
        $type_h[] = 'image';
        $cont_h[] = $lang->def('_CHECKALL');
        $type_h[] = 'image';
        $cont_h[] = $lang->def('_UNCHECKALL');
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        reset($_SESSION['meta_certificate']['course']);
        $array_user =& $aclManager->getAllUsersFromIdst($_SESSION['meta_certificate']['users']);
        $array_user = array_unique($array_user);
        $query = "SELECT idst" . " FROM " . $GLOBALS['prefix_fw'] . "_user" . " WHERE idst IN (" . implode(',', $array_user) . ")" . " ORDER BY userid";
        $result = sql_query($query);
        $array_user = array();
        while (list($id_user) = sql_fetch_row($result)) {
            $array_user[] = $id_user;
        }
        foreach ($array_user as $id_user) {
            $cont = array();
            $user_info = $acl_man->getUser($id_user, false);
            $cont[] = $user_info[ACL_INFO_LASTNAME] . ' ' . $user_info[ACL_INFO_FIRSTNAME];
            $cont[] = $acl_man->relativeId($user_info[ACL_INFO_USERID]);
            foreach ($_SESSION['meta_certificate']['course'] as $id_course) {
                if (isset($_POST['_' . $id_user . '_' . $id_course . '_']) || isset($_POST['select_all']) || isset($reasign[$id_user][$id_course])) {
                    $checked = true;
                } else {
                    $checked = false;
                }
                $cont[] = $form->getCheckbox('', '_' . $id_user . '_' . $id_course . '_', '_' . $id_user . '_' . $id_course . '_', 1, $checked);
            }
            $cont[] = '<a href="javascript:;" onclick="checkall_fromback_meta(\'' . $form_name . '\', \'' . $id_user . '\', true); return false;">' . $lang->def('_CHECKALL') . '</a>';
            $cont[] = '<a href="javascript:;" onclick="checkall_fromback_meta(\'' . $form_name . '\', \'' . $id_user . '\', false); return false;">' . $lang->def('_UNCHECKALL') . '</a>';
            $tb->addBody($cont);
        }
        reset($_SESSION['meta_certificate']['course']);
        $cont = array();
        $cont[] = '';
        $cont[] = '';
        foreach ($_SESSION['meta_certificate']['course'] as $id_course) {
            $cont[] = '<a href="javascript:;" onclick="checkall_meta(\'' . $form_name . '\', \'' . $id_course . '\', true); return false;">' . $lang->def('_CHECKALL') . '</a><br/>' . '<a href="javascript:;" onclick="checkall_meta(\'' . $form_name . '\', \'' . $id_course . '\', false); return false;">' . $lang->def('_UNCHECKALL') . '</a>';
        }
        $cont[] = '';
        $cont[] = '';
        $tb->addBody($cont);
        $out->add($form->openElementSpace() . $tb->getTable() . $form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('select_all', 'select_all', $lang->def('_SELECT_ALL')) . $form->getButton('insert', 'insert', $lang->def('_INSERT')) . $form->getButton('undo_assign', 'undo_assign', $lang->def('_UNDO')) . $form->closeButtonSpace() . $form->closeForm());
    } elseif ($step == 1) {
        $sel->setLink('index.php?modname=meta_certificate&amp;op=modassignment');
        $out->add(getTitleArea($lang->def('_TITLE_META_CERTIFICATE_ASSIGN'), 'certificate') . '<div class="std_block">' . $form->openForm('new_assign_step_1', 'index.php?modname=meta_certificate&amp;op=modassignment') . $form->getHidden('id_certificate', 'id_certificate', $id_certificate) . $form->getHidden('idmeta', 'idmeta', $id_meta) . $form->getHidden('step', 'step', 1) . $form->getHidden('course_reload', 'course_reload', 1));
        if (!isset($_POST['course_reload'])) {
            $query = "SELECT DISTINCT idCourse" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idMetaCertificate = '" . $id_meta . "'";
            $result = sql_query($query);
            $course_reset = array();
            while (list($id_course) = sql_fetch_row($result)) {
                $course_reset[$id_course] = $id_course;
            }
            $sel->resetCourseSelection($course_reset);
        }
        $sel->loadSelector();
        $out->add(Form::getHidden('update_tempdata', 'update_tempdata', 1) . Form::openButtonSpace() . Form::getBreakRow() . Form::getButton('ok_filter', 'import_filter', $lang->def('_NEXT')) . Form::getButton('undo_filter', 'undo_filter', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>');
    } else {
        $user_select->show_orgchart_simple_selector = FALSE;
        $user_select->multi_choice = TRUE;
        $user_select->addFormInfo($form->getHidden('step', 'step', 0) . $form->getHidden('id_certificate', 'id_certificate', $id_certificate) . $form->getHidden('idmeta', 'idmeta', $id_meta) . $form->getHidden('user_reload', 'user_reload', 1));
        $user_select->setPageTitle(getTitleArea($lang->def('_TITLE_META_CERTIFICATE_ASSIGN'), 'certificate') . '<div class="std_block">');
        if (!isset($_POST['user_reload'])) {
            $query = "SELECT DISTINCT idUser" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idMetaCertificate = '" . $id_meta . "'";
            $result = sql_query($query);
            $user_reset = array();
            while (list($id_user) = sql_fetch_row($result)) {
                $user_reset[$id_user] = $id_user;
            }
            $user_select->resetSelection($user_reset);
        }
        $user_select->loadSelector('index.php?modname=meta_certificate&amp;op=modassignment', false, $lang->def('_USER_FOR_META_CERTIFICATE_ASSIGN'), true);
    }
}
Ejemplo n.º 5
0
function modreader()
{
    checkPerm('mod');
    require_once _base_ . '/lib/lib.userselector.php';
    $lang =& DoceboLanguage::createInstance('advice', 'lms');
    $out =& $GLOBALS['page'];
    $id_advice = importVar('id_advice', true, 0);
    $aclManager = new DoceboACLManager();
    $user_select = new UserSelector();
    $user_select->show_user_selector = TRUE;
    $user_select->show_group_selector = TRUE;
    $user_select->show_orgchart_selector = FALSE;
    $user_select->show_fncrole_selector = FALSE;
    $user_select->nFields = 0;
    $user_select->learning_filter = 'course';
    if (isset($_GET['load'])) {
        $query_reader = "\r\n\t\t\tSELECT idUser\r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_adviceuser\r\n\t\t\tWHERE idAdvice = '" . $id_advice . "'";
        $re_reader = sql_query($query_reader);
        $users = array();
        $all_reader = false;
        while (list($id_user) = sql_fetch_row($re_reader)) {
            if ($id_user == 'all') {
                $all_reader = true;
            }
            $users[] = $id_user;
        }
        if ($all_reader == true) {
            $query_reader = "\r\n\t\t\t\tSELECT idUser\r\n\t\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_courseuser\r\n\t\t\t\tWHERE idCourse = '" . $_SESSION['idCourse'] . "'";
            $re_reader = sql_query($query_reader);
            $users = array();
            while (list($id_user) = sql_fetch_row($re_reader)) {
                $users[] = $id_user;
            }
        }
        $user_select->resetSelection($users);
    }
    $arr_idstGroup = $aclManager->getGroupsIdstFromBasePath('/lms/course/' . (int) $_SESSION['idCourse'] . '/subscribed/');
    $me = array(getLogUserId());
    $user_select->setUserFilter('exclude', $me);
    $user_select->setUserFilter('group', $arr_idstGroup);
    $arr_idstUser = $aclManager->getAllUsersFromIdst($arr_idstGroup);
    $user_select->setUserFilter('user', $arr_idstUser);
    //$user_select->setGroupFilter('path', '/lms/course/'.$_SESSION['idCourse'].'/group');
    $user_select->setPageTitle(getTitleArea(array('index.php?modname=advice&amp;op=advice' => $lang->def('_ADVICE'), $lang->def('_VIEW_PERMISSION')), 'advice'));
    $user_select->loadSelector('index.php?modname=advice&amp;op=modreader&amp;id_advice=' . $id_advice, $lang->def('_ADVICE'), $lang->def('_CHOOSE_READER'), true);
}
Ejemplo n.º 6
0
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&amp;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');
}
Ejemplo n.º 7
0
function required()
{
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.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';
    $db = DbConn::getInstance();
    $lang =& DoceboLanguage::CreateInstance('public_coursepanel', 'lms');
    $sel_competence = Get::req('sel_competence_req', DOTY_INT, false);
    $sel_course = Get::req('sel_course_req', DOTY_INT, false);
    $back_url = "index.php?modname=public_coursepanel&op=coursepanel&sel_competence=" . (int) $sel_competence . "&sel_course=" . (int) $sel_course;
    $back_ui = getBackUi($back_url, $lang->def('_BACK'));
    $sel_comp = Get::req('required_selector', DOTY_INT, 0);
    if ($sel_comp) {
        $id_pa = getLogUserId();
        if (!$id_pa) {
            //...
        }
        $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)) {
            //error: no users to deal with
            cout($back_ui . $lang->def('_NO_USERS') . $back_ui, 'content');
            return;
        }
        cout(getTitleArea($lang->def('_REQUIRED_USERS'), 'coursepanel') . '<div class="std_block">', 'content');
        $table = new Table();
        $head_labels = array($lang->def('_USERNAME'), $lang->def('_NAME'));
        $head_style = array('', '', 'align_center', 'align_center');
        $table->addHead($head_labels, $head_style);
        //$date = date ("Y-m-d H:i:s", strtotime("+1 months"));
        //$now = date("Y-m-d H:i:s");
        $man_comp = new Competences_Manager();
        $comp_data = $man_comp->GetCompetence($sel_comp);
        $already = array();
        $query = "SELECT id_user, score_init, score_got FROM %lms_competence_user WHERE id_competence='" . (int) $sel_comp . "'";
        $res = $db->query($query);
        while (list($id_user, $score_init, $score_got) = $db->fetch_row($res)) {
            if ($comp_data['type'] == 'score') {
                //if the competence assignment exists in DB, but the total score is 0, then it's considered as non-assigned
                if ((int) $score_init + (int) $score_got > 0) {
                    $already[] = $id_user;
                }
            } else {
                $already[] = $id_user;
            }
        }
        $already = array_unique($already);
        $array_users = array_diff($array_users, $already);
        //get required competences not got from users
        $query = "";
        if ($comp_data['type'] == 'score') {
            $query = "SELECT u.idst, u.userid, u.lastname, u.firstname FROM %lms_competence_required as cr " . " JOIN %adm_user as u ON (cr.idst = u.idst)" . " WHERE cr.idst IN (" . implode(",", $array_users) . ") AND cr.id_competence=" . (int) $sel_comp . " ORDER BY u.userid";
        } else {
            $query = "SELECT u.idst, u.userid, u.lastname, u.firstname FROM %lms_competence_required as cr " . " JOIN %adm_user as u ON (cr.idst = u.idst) " . " WHERE cr.idst IN (" . implode(",", $array_users) . ") AND cr.id_competence=" . (int) $sel_comp . " ORDER BY u.userid";
        }
        $res = $db->query($query);
        if (sql_num_rows($res) > 0) {
            while (list($idst, $userid, $lastname, $firstname) = $db->fetch_row($res)) {
                $line = array();
                $line[] = $acl_man->relativeId($userid);
                $line[] = $lastname . " " . $firstname;
                $table->addBody($line);
            }
            //cout(getTitleArea($lang->def('_EXPIRING_USERS'), 'coursepanel').'<div class="std_block">', 'content');
            cout($lang->def('_COMPETENCE') . ': <b>' . $comp_data['name'] . '</b>', 'content');
            cout($back_ui . $table->getTable() . $back_ui, 'content');
        } else {
            cout($back_ui . $lang->def('_NO_REQUIRED_USER') . $back_ui, 'content');
        }
    } else {
        //error, no competence selected
        cout($back_ui . $lang->def('_NO_COMPETENCE_SELECTED') . $back_ui, 'content');
        return;
    }
}
Ejemplo n.º 8
0
 function addsubscription()
 {
     checkPerm('subscribe');
     require_once _base_ . '/lib/lib.form.php';
     require_once _adm_ . '/class.module/class.directory.php';
     require_once _lms_ . '/lib/lib.subscribe.php';
     require_once _lms_ . '/lib/lib.coursepath.php';
     $id_path = importVar('id_path', true, 0);
     $lang =& DoceboLanguage::createInstance('coursepath', 'lms');
     $out =& $GLOBALS['page'];
     $acl_man =& Docebo::user()->getAclManager();
     if (isset($_POST['cancelselector'])) {
         Util::jump_to('index.php?modname=coursepath&amp;op=pathlist');
     }
     $user_select = new UserSelector();
     $user_select->show_user_selector = TRUE;
     $user_select->show_group_selector = TRUE;
     $user_select->show_orgchart_selector = TRUE;
     $user_select->show_orgchart_simple_selector = TRUE;
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_tree = $adminManager->getAdminTree(Docebo::user()->getIdST());
         $admin_users = $acl_man->getAllUsersFromIdst($admin_tree);
         $user_select->setUserFilter('user', $admin_users);
         $user_select->setUserFilter('group', $admin_tree);
     }
     $query_pathlist = "\r\n\tSELECT path_name, subscribe_method\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_coursepath\r\n\tWHERE id_path = '" . $id_path . "'\r\n\tORDER BY path_name ";
     list($path_name, $subscribe_method) = sql_fetch_row(sql_query($query_pathlist));
     if (isset($_GET['load'])) {
         $cp_man = new CoursePath_Manager();
         $users = $cp_man->getSubscribed($id_path);
         $user_select->resetSelection($users);
     }
     if (isset($_POST['okselector'])) {
         $acl_manager = new DoceboACLManager();
         $user_selected = $user_select->getSelection($_POST);
         $user_selected =& $acl_manager->getAllUsersFromIdst($user_selected);
         $user_selected = array_unique($user_selected);
         $cp_man = new CoursePath_Manager();
         $users = $cp_man->getSubscribed($id_path);
         $user_selected = array_diff($user_selected, $users);
         if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
             require_once _base_ . '/lib/lib.preference.php';
             $adminManager = new AdminPreference();
             $admin_tree = $adminManager->getAdminTree(Docebo::user()->getIdST());
             $admin_users = $acl_man->getAllUsersFromIdst($admin_tree);
             $user_selected = array_intersect($user_selected, $admin_users);
         }
         if (empty($user_selected)) {
             Util::jump_to('index.php?modname=coursepath&amp;op=pathlist');
         }
         $cpath_man = new CoursePath_Manager();
         $subs_man = new CourseSubscribe_Management();
         $courses = $cpath_man->getAllCourses(array($id_path));
         require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php';
         $course_man = new Man_Course();
         $classroom = $course_man->getAllCourses(false, 'classroom', $courses);
         $edition = $course_man->getAllCourses(false, 'edition', $courses);
         if (!empty($classroom) || !empty($edition)) {
             $user_selected_post = urlencode(serialize($user_selected));
             cout(getTitleArea(array('index.php?modname=coursepath&amp;op=pathlist' => $lang->def('_COURSEPATH'), $path_name), 'coursepath') . '<div class="std_block">' . Form::openForm('edition_selection_form', 'index.php?modname=coursepath&amp;op=addsubscriptionedition&amp;id_path=' . $id_path) . Form::getHidden('users', 'users', $user_selected_post));
             if (!empty($classroom)) {
                 require_once _lms_ . '/lib/lib.date.php';
                 $date_man = new DateManager();
                 foreach ($classroom as $id_course => $info) {
                     $editions = $date_man->getCourseDate($id_course, true);
                     $edition_for_dropdown = array();
                     $edition_for_dropdown[0] = Lang::t('_NONE', 'coursepath');
                     foreach ($editions as $editions_info) {
                         $edition_for_dropdown[$editions_info['id_date']] = $editions_info['code'] . ' - ' . $editions_info['name'] . ' - ' . Format::date($editions_info['date_begin'], 'date') . ' - ' . Format::date($editions_info['date_end'], 'date');
                     }
                     cout(Form::getDropdown(Lang::t('_EDITION_SELECTION', 'coursepath') . ' : ' . $info['code'] . ' - ' . $info['name'], 'classroom_' . $id_course, 'classroom_' . $id_course, $edition_for_dropdown));
                 }
             }
             if (!empty($edition)) {
                 require_once _lms_ . '/lib/lib.edition.php';
                 $edition_man = new EditionManager();
                 foreach ($edition as $id_course => $info) {
                     $editions = $edition_man->getEditionsInfoByCourses($id_course);
                     $edition_for_dropdown = array();
                     $edition_for_dropdown[0] = Lang::t('_NONE', 'coursepath');
                     foreach ($editions[$id_course] as $editions_info) {
                         $edition_for_dropdown[$editions_info['id_edition']] = $editions_info['code'] . ' - ' . $editions_info['name'] . ' - ' . Format::date($editions_info['date_begin'], 'date') . ' - ' . Format::date($editions_info['date_end'], 'date');
                     }
                     cout(Form::getDropdown(Lang::t('_EDITION_SELECTION', 'coursepath') . ' : ' . $info['code'] . ' - ' . $info['name'], 'edition_' . $id_course, 'edition_' . $id_course, $edition_for_dropdown));
                 }
             }
             cout(Form::openButtonSpace() . Form::getButton('save', 'save', Lang::t('_SAVE', 'coursepath')) . Form::getButton('undo', 'undo', Lang::t('_UNDO', 'coursepath')) . Form::closeButtonSpace() . Form::closeForm() . '</div>');
         } else {
             $re = true;
             if ($subscribe_method != 1 && !checkPerm('moderate', true)) {
                 $waiting = 1;
             } else {
                 $waiting = 0;
             }
             $users_subsc = array();
             require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php';
             $course_man = new Man_Course();
             $assessment = $course_man->getAllCourses(false, 'assessment', $courses);
             while (list(, $id_user) = each($user_selected)) {
                 $text_query = "\r\n\t\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_coursepath_user\r\n\t\t\t\t( id_path, idUser, waiting, subscribed_by ) VALUES\r\n\t\t\t\t( '" . $id_path . "', '" . $id_user . "', '" . $waiting . "', '" . getLogUserId() . "' )";
                 $re_s = sql_query($text_query);
                 if ($re_s == true) {
                     $users_subsc[] = $id_user;
                 }
                 $re &= $re_s;
                 foreach ($assessment as $id_assessment => $assessment_info) {
                     sql_query("INSERT INTO %lms_assessment_user (id_assessment, id_user, type_of) VALUES ('" . $id_assessment . "', '" . $id_user . "', 'user')");
                 }
             }
             // now subscribe user to all the course
             if ($waiting == 0) {
                 $re &= $subs_man->multipleSubscribe($users_subsc, $courses, 3);
             }
             Util::jump_to('index.php?modname=coursepath&amp;op=pathlist&result=' . ($re ? 'ok' : 'err'));
         }
     } else {
         $user_select->setPageTitle(getTitleArea(array('index.php?modname=coursepath&amp;op=pathlist' => $lang->def('_COURSEPATH'), $path_name), 'coursepath'));
         $user_select->loadSelector('index.php?modname=coursepath&amp;op=addsubscription&amp;id_path=' . $id_path, $lang->def('_SUBSCRIBE'), false, true);
     }
 }