コード例 #1
0
ファイル: lib.edition.php プロジェクト: abhinay100/forma_app
 public function getTotalStudentsSubscribed($id_course, $id_edition, $filter = "")
 {
     $subscribed = $this->getEditionSubscribed($id_edition);
     if (count($subscribed) == 0) {
         return 0;
     }
     $query = "SELECT COUNT(*)" . " FROM " . $this->courseuser_table . " AS s" . " JOIN " . $this->user_table . " AS u ON s.idUser = u.idst" . " WHERE s.idCourse = " . (int) $id_course . " AND u.idst IN (" . implode(', ', $subscribed) . ")" . " AND s.level = 3";
     if (is_array($filter)) {
         if (isset($filter['text']) && $filter['text'] != "") {
             $query .= " AND (u.userid LIKE '%" . $filter['text'] . "%' OR u.firstname LIKE '%" . $filter['text'] . "%' OR u.lastname LIKE '%" . $filter['text'] . "%') ";
         }
         $arr_idst = array();
         if (isset($filter['orgchart']) && $filter['orgchart'] > 0) {
             $umodel = new UsermanagementAdm();
             $use_desc = isset($filter['descendants']) && $filter['descendants'];
             $ulist = $umodel->getFolderUsers($filter['orgchart'], $use_desc);
             if (!empty($ulist)) {
                 $arr_idst = $ulist;
             }
             unset($ulist);
         }
         if (!empty($arr_idst)) {
             $conditions[] = " AND u.idst IN (" . implode(",", $arr_idst) . ") ";
         }
         if (isset($filter['date_valid']) && strlen($filter['date_valid']) >= 10) {
             $query .= " AND (s.date_begin_validity <= '" . $filter['date_valid'] . "' OR s.date_begin_validity IS NULL OR s.date_begin_validity='0000-00-00 00:00:00') ";
             $query .= " AND (s.date_expire_validity >= '" . $filter['date_valid'] . "' OR s.date_expire_validity IS NULL OR s.date_expire_validity='0000-00-00 00:00:00') ";
         }
         if (isset($filter['show'])) {
             //validate values
             switch ($filter['show']) {
                 case 0:
                     //all
                     //no condition to check ...
                     break;
                 case 1:
                     //expired
                     $query .= " AND (s.date_expire_validity IS NOT NULL AND s.date_expire_validity < NOW())";
                     break;
                 case 2:
                     //not expired with expiring date
                     $query .= " AND (s.date_expire_validity IS NOT NULL AND s.date_expire_validity > NOW())";
                     break;
                 case 3:
                     //not expired without expiring date
                     $query .= " AND (s.date_expire IS NULL OR s.date_expire='' OR s.date_expire='0000-00-00 00:00:00') ";
                     break;
                 default:
                     //all ...
                     break;
             }
         }
     }
     list($res) = sql_fetch_row(sql_query($query));
     return $res;
 }
コード例 #2
0
 public function applyRulesMultiLang($log_action, $arr_users, $id_org, $id_entity = false, $user_temp = false)
 {
     $ent = array();
     if ($id_org != false) {
         $acl_man = Docebo::aclm();
         $oc_sn = $acl_man->getGroupST('oc_' . $id_org);
         $um_adm = new UsermanagementAdm();
         $ancestor = $um_adm->getAncestorInfoFolders($id_org);
         $ancestor['idst_ocd'][] = $oc_sn;
         $ent = $ancestor['idst_ocd'];
     }
     if ($id_entity != false) {
         $ent[] = $id_entity;
     }
     if (empty($ent)) {
         return false;
     }
     // FORMA: if we have the user_temp param we have to use user_temp table
     $user_table = "%adm_user";
     if ($user_temp) {
         $user_table = "%adm_user_temp";
     }
     $query = "SELECT DISTINCT u.idst, us.value " . " FROM " . $user_table . " AS u " . " LEFT JOIN %adm_setting_user AS us " . " ON ( u.idst = us.id_user AND us.path_name = 'ui.language' ) " . " WHERE u.idst IN ( " . implode(",", $arr_users) . " )";
     // END FORMA
     $re_query = $this->db->query($query);
     if (!$re_query) {
         return false;
     }
     $arr_users = array();
     $langs = array();
     $default_lang = getDefaultLanguage();
     while (list($idst_user, $value) = $this->db->fetch_row($re_query)) {
         if ($value == '') {
             $value = $default_lang;
         }
         $langs[$value] = $value;
         $arr_users[$value][] = $idst_user;
     }
     // find rules for evry language in the array
     require_once _lms_ . '/lib/lib.subscribe.php';
     $cs = new CourseSubscribe_Management();
     $applicable = $this->getApplicableRuleForEntityMultiLang($ent);
     $course_list = $applicable['course_list'];
     if (!isset($course_list['all'])) {
         $course_list['all'] = array();
     }
     $this->db->start_transaction();
     // create a entry log
     $id_log = $this->addLogEntry($log_action, $applicable['rules']);
     if (!$id_log) {
         return false;
     }
     foreach ($langs as $i => $lang_code) {
         if (!empty($course_list[$lang_code])) {
             $courses = array_unique(array_merge($course_list['all'], $course_list[$lang_code]));
         } else {
             $courses = array_unique($course_list['all']);
         }
         if (!empty($arr_users[$lang_code]) && !empty($courses)) {
             $re = $cs->multipleSubscribe($arr_users[$lang_code], $courses, 3, $id_log);
         }
     }
     $this->db->commit();
     return $re;
 }
コード例 #3
0
 function _step1()
 {
     $GLOBALS['page']->add($this->form->getLineBox($this->lang->def('_NAME'), $this->post_params['name']));
     // ---- the tree selector -----
     /* $GLOBALS['page']->add($this->lang->def('_TREE_INSERT'));
     		$this->directory->show_orgchart_selector = FALSE;
     		$this->directory->show_orgchart_simple_selector = TRUE;
     		$this->directory->multi_choice = FALSE;
     		$this->directory->selector_mode = TRUE;
     		$this->directory->loadOrgChartView(); */
     $umodel = new UsermanagementAdm();
     $out = $this->form->getDropdown(Lang::t('_DIRECTORY_MEMBERTYPETREE', 'admin_directory'), $this->_get_base_name() . '_org_chart_destination', $this->_get_base_name() . '[org_chart_destination]', $umodel->getOrgChartDropdownList(), $this->post_params['org_chart_destination']);
     // ---- add a button to reset selection -----
     /* $out = $this->form->getButton(	$this->_get_base_name().'_reset',
     			$this->_get_base_name().'[reset]', 
     			$this->lang->def('_RESET')); */
     return $out;
 }
コード例 #4
0
 public function getCourseSubscribedUserIdst($id_course, $no_flat = false, $filter = '')
 {
     if (is_numeric($id_course)) {
         $arr = array($id_course);
     } elseif (is_array($id_course) && count($id_course) > 0) {
         $arr =& $id_course;
     } else {
         return false;
     }
     $query = "SELECT s.idUser, s.idCourse " . " FROM " . $this->subscribe_table . " AS s " . " JOIN " . $this->user_table . " AS u ON u.idst = s.idUser " . " WHERE s.idCourse IN (" . implode(",", $arr) . ") ";
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $query .= " AND " . $adminManager->getAdminUsersQuery(Docebo::user()->getIdSt(), 's.idUser');
     }
     if (is_array($filter)) {
         if (isset($filter['text']) && $filter['text'] != "") {
             $query .= " AND (u.userid LIKE '%" . $filter['text'] . "%' OR u.firstname LIKE '%" . $filter['text'] . "%' OR u.lastname LIKE '%" . $filter['text'] . "%') ";
         }
         $arr_idst = array();
         if (isset($filter['orgchart']) && $filter['orgchart'] > 0) {
             $umodel = new UsermanagementAdm();
             $use_desc = isset($filter['descendants']) && $filter['descendants'];
             $ulist = $umodel->getFolderUsers($filter['orgchart'], $use_desc);
             if (!empty($ulist)) {
                 $arr_idst = $ulist;
             }
             unset($ulist);
         }
         if (!empty($arr_idst)) {
             $conditions[] = " AND u.idst IN (" . implode(",", $arr_idst) . ") ";
         }
         if (isset($filter['date_valid']) && strlen($filter['date_valid']) >= 10) {
             $query .= " AND (s.date_begin_validity <= '" . $filter['date_valid'] . "' OR s.date_begin_validity IS NULL OR s.date_begin_validity='0000-00-00 00:00:00') ";
             $query .= " AND (s.date_expire_validity >= '" . $filter['date_valid'] . "' OR s.date_expire_validity IS NULL OR s.date_expire_validity='0000-00-00 00:00:00') ";
         }
     }
     $result = $this->db->query($query);
     $res = array();
     while (list($id_user, $id_course) = $this->db->fetch_row($result)) {
         if ($no_flat) {
             $res[$id_course][$id_user] = $id_user;
         } else {
             $res[$id_user] = (int) $id_user;
         }
     }
     if (!$no_flat) {
         $res = array_unique($res);
     }
     return $res;
 }
コード例 #5
0
 function getUserGroupsList($id_user)
 {
     if ($id_user <= 0) {
         return false;
     }
     $umodel = new UsermanagementAdm();
     return array('folders' => $umodel->getUserFolders($id_user), 'groups' => $umodel->getUserGroups($id_user));
 }
コード例 #6
0
 function _first_of_all($options, $platform)
 {
     $social = new Social();
     $lang =& DoceboLanguage::createInstance('register', $platform);
     $out = '';
     if ($options['use_advanced_form'] == 'off') {
         $out .= Form::getHidden('next_step', 'next_step', 'opt_in');
     } else {
         $out .= Form::getHidden('next_step', 'next_step', 'special_field');
     }
     $mand_sym = '<span class="mandatory">*</span>';
     $out .= '<div class="reg_note">' . $lang->def('_REG_NOTE') . '</div>' . '<ul class="reg_instruction">' . '<li>' . str_replace('[mandatory]', $mand_sym, $lang->def('_REG_MANDATORY')) . '</li>';
     if ($options['pass_min_char']) {
         $out .= '<li>' . str_replace('[min_char]', $options['pass_min_char'], $lang->def('_REG_PASS_MIN_CHAR')) . '</li>';
     }
     if ($options['pass_alfanumeric'] == 'on') {
         $out .= '<li>' . $lang->def('_REG_PASS_MUST_BE_ALPNUM') . '</li>';
     }
     //$out .= '<li>'.str_replace('[hour]', $options['hour_request_limit'], $lang->def('_REG_HOUR_REQUEST_LIMIT')).'</li>';
     if ($options['privacy_policy'] == 'on') {
         $out .= '<li>' . $lang->def('_REG_REMEMBER_PRIVACY') . '</li>';
     }
     $extra = '';
     // facebook register:
     if ($social->isActive('facebook')) {
         require_once _lms_ . "/modules/login/facebook.php";
         if (isset($_SESSION['fb_info']) && is_array($_SESSION['fb_info']) && !isset($_POST['register'])) {
             setFbRegData($_SESSION['fb_info']);
             $out .= '<li>' . $lang->def('_ACCOUNT_WILL_BE_CONNECTED_FB', 'login', 'cms') . '</li>';
         } else {
             $extra = getFbRegisterBox();
         }
     }
     // ----
     $out .= '</ul>' . $extra . Form::openElementSpace('reg_form');
     $out .= Form::getTextfield($lang->def('_USERNAME') . ' ' . $mand_sym, 'register_userid', 'register[userid]', 255, isset($_POST['register']['userid']) ? stripslashes($_POST['register']['userid']) : '') . Form::getTextfield($lang->def('_EMAIL') . ' ' . $mand_sym, 'register_email', 'register[email]', 255, isset($_POST['register']['email']) ? stripslashes($_POST['register']['email']) : '') . Form::getTextfield($lang->def('_FIRSTNAME') . ($options['lastfirst_mandatory'] == 'on' ? ' ' . $mand_sym : ''), 'register_firstname', 'register[firstname]', 255, isset($_POST['register']['firstname']) ? stripslashes($_POST['register']['firstname']) : '') . Form::getTextfield($lang->def('_LASTNAME') . ($options['lastfirst_mandatory'] == 'on' ? ' ' . $mand_sym : ''), 'register_lastname', 'register[lastname]', 255, isset($_POST['register']['lastname']) ? stripslashes($_POST['register']['lastname']) : '');
     if ($options['use_advanced_form'] == 'off') {
         $extra_field = new FieldList();
         $out .= $extra_field->playFieldsForUser(0, false, false);
     }
     $lang_sel = getLanguage();
     $full_langs = array();
     $langs = Docebo::langManager()->getAllLangCode();
     $full_langs = array();
     foreach ($langs as $v) {
         $full_langs[$v] = $v;
     }
     $out .= Form::getHidden('sop', 'sop', 'changelang');
     $out .= Form::getDropdown($lang->def('_LANGUAGE'), 'new_lang', 'new_lang', $full_langs, $lang_sel, '', '', ' onchange="submit();"');
     $out .= Form::getPassword($lang->def('_PASSWORD') . ' ' . $mand_sym, 'register_pwd', 'register[pwd]', 255, $lang->def('_PASSWORD')) . Form::getPassword($lang->def('_RETYPE_PASSWORD') . ' ' . $mand_sym, 'register_pwd_retype', 'register[pwd_retype]', 255, $lang->def('_RETYPE_PASSWORD'));
     $registration_code_type = Get::sett('registration_code_type', '0');
     $code_is_mandatory = Get::sett('mandatory_code', 'off');
     switch ($registration_code_type) {
         case "0":
             //nothin to do
             break;
         case "tree_course":
         case "code_module":
         case "tree_man":
             // we must ask the user to insert a manual code
             $out .= Form::getTextfield($lang->def('_CODE') . ($code_is_mandatory ? ' ' . $mand_sym : ''), 'reg_code', 'reg_code', 24, Get::req('reg_code', DOTY_MIXED, ''));
             break;
         case "tree_drop":
             // we must show to the user a selection of code
             $uma = new UsermanagementAdm();
             $tree_names = $uma->getAllFolderNames(true);
             $out .= Form::getDropdown($lang->def('_CODE') . ($code_is_mandatory ? ' ' . $mand_sym : ''), 'reg_code', 'reg_code', $tree_names, Get::req('reg_code', DOTY_MIXED, ''));
             break;
     }
     $out .= '<div class="reg_title_privacy">' . $lang->def('_REG_PRIVACY_POLICY_TILTE') . '</div>' . '<div class="privacy_box">' . $lang->def('_REG_PRIVACY_POLICY') . '</div>';
     if ($options['privacy_policy'] == 'on') {
         $out .= Form::getCheckbox($lang->def('_REG_PRIVACY_ACCEPT'), 'register_privacy', 'register[privacy]', 'ok', isset($_POST['register']['privacy']));
     }
     if ($options['use_advanced_form'] == 'on') {
         $acl_man =& Docebo::user()->getAclManager();
         $groups =& $acl_man->getAllGroupsId(array('free', 'moderate'));
         if (!empty($groups)) {
             $tb = new Table(0, $lang->def('_SELECT_GROUP'), $lang->def('_SELECT_GROUP_SUMMARY'));
             $type_h = array('image', 'nowrap', '');
             $cont_h = array('<span class="access-only">' . $lang->def('_SUBSCRIBE') . '</span>', $lang->def('_NAME'), $lang->def('_DESCRIPTION'));
             $tb->setColsStyle($type_h);
             $tb->addHead($cont_h);
             while (list($id, $info) = each($groups)) {
                 $cont = array(Form::getInputCheckbox('group_sel_' . $id, 'group_sel[]', $id, isset($_POST['group_sel'][$id]), ''), '<label for="group_sel_' . $id . '">' . $info['type_ico'] . ' ' . $info['groupid'] . '</label>', $info['description']);
                 $tb->addBody($cont);
             }
             $out .= $tb->getTable();
         }
     }
     $out .= Form::closeElementSpace() . Form::openButtonSpace('reg_form_button') . Form::getButton('reg_button', 'reg_button', $lang->def('_REGISTER')) . Form::closeButtonSpace();
     return $out;
 }
コード例 #7
0
 public function getCoursePathSubscriptionsList($id_path, $filter = false)
 {
     require_once _lms_ . '/lib/lib.coursepath.php';
     $cman = new CoursePath_Manager();
     $courses = $cman->getAllCourses(array($id_path));
     if (empty($courses)) {
         //...
     }
     $query = "SELECT DISTINCT s.idUser " . " FROM (%lms_courseuser as s JOIN %lms_coursepath_user as p " . " ON (s.idUser = p.idUser)) " . " JOIN %adm_user as u " . " ON (s.idUser = u.idst) " . " WHERE p.id_path = " . (int) $id_path . " AND s.idCourse IN (" . implode(",", array_values($courses)) . ") ";
     //." GROUP BY s.idUser";
     if (is_array($filter)) {
         if (isset($filter['text']) && $filter['text'] != "") {
             $query .= " AND (u.userid LIKE '%" . $filter['text'] . "%' OR u.firstname LIKE '%" . $filter['text'] . "%' OR u.lastname LIKE '%" . $filter['text'] . "%') ";
         }
         $arr_idst = array();
         if (isset($filter['orgchart']) && $filter['orgchart'] > 0) {
             $umodel = new UsermanagementAdm();
             $use_desc = isset($filter['descendants']) && $filter['descendants'];
             $ulist = $umodel->getFolderUsers($filter['orgchart'], $use_desc);
             if (!empty($ulist)) {
                 $arr_idst = $ulist;
             }
             unset($ulist);
         }
         if (!empty($arr_idst)) {
             $conditions[] = " AND u.idst IN (" . implode(",", $arr_idst) . ") ";
         }
         if (isset($filter['date_valid']) && strlen($filter['date_valid']) >= 10) {
             $query .= " AND (s.date_begin_validity <= '" . $filter['date_valid'] . "' OR s.date_begin_validity IS NULL OR s.date_begin_validity='0000-00-00 00:00:00') ";
             $query .= " AND (s.date_expire_validity >= '" . $filter['date_valid'] . "' OR s.date_expire_validity IS NULL OR s.date_expire_validity='0000-00-00 00:00:00') ";
         }
         if (isset($filter['show'])) {
             //validate values
             switch ($filter['show']) {
                 case 0:
                     //all
                     //no condition to check ...
                     break;
                 case 1:
                     //expired
                     $query .= " AND (s.date_expire_validity IS NOT NULL AND s.date_expire_validity < NOW())";
                     break;
                 case 2:
                     //not expired with expiring date
                     $query .= " AND (s.date_expire_validity IS NOT NULL AND s.date_expire_validity > NOW())";
                     break;
                 case 3:
                     //not expired without expiring date
                     $query .= " AND (s.date_expire IS NULL OR s.date_expire='' OR s.date_expire='0000-00-00 00:00:00') ";
                     break;
                 default:
                     //all ...
                     break;
             }
         }
     }
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         require_once _base_ . '/lib/lib.preference.php';
         $acl_man = new DoceboACLManager();
         $adminManager = new AdminPreference();
         $admin_tree = $adminManager->getAdminTree(getLogUserId());
         $admin_users = $acl_man->getAllUsersFromSelection($admin_tree);
         $query .= " AND s.idUser IN (" . implode(',', $admin_users) . ")";
     }
     $output = array();
     $res = sql_query($query);
     if ($res) {
         while (list($idst) = sql_fetch_row($res)) {
             $output[] = $idst;
         }
     }
     return $output;
 }
コード例 #8
0
 public function show_coursepathTask()
 {
     $id_path = Get::req('id_path', DOTY_INT, 0);
     if ($id_path <= 0) {
         //...
         return;
     }
     Util::get_js(Get::rel_path('base') . '/lib/lib.elem_selector.js', true, true);
     $res = Get::req('res', DOTY_STRING, "");
     $message = false;
     switch ($res) {
         case 'ok':
             $message = UIFeedback::info(Lang::t(strtoupper($_GET['res']), 'subscription'));
             break;
         case 'err':
             $message = UIFeedback::error(Lang::t(strtoupper($_GET['err']), 'subscription'));
             break;
     }
     Form::loadDatefieldScript();
     //some dialogs use date inputs
     $umodel = new UsermanagementAdm();
     $params = array('back_link' => 'index.php?modname=coursepath&op=pathlist&of_platform=lms', 'id_path' => $id_path, 'message' => $message, 'orgchart_list' => $umodel->getOrgChartDropdownList(), 'is_active_advanced_filter' => false, 'filter_text' => "", 'filter_orgchart' => 0, 'filter_descendants' => false, 'filter_date_valid' => "", 'filter_show' => 0, 'path_name' => $this->model->getCoursepathNameForSubscription($id_path));
     $this->render('show_coursepath', $params);
 }
コード例 #9
0
 public function getCourseStatsTotal($id_course, $filter)
 {
     $query = "SELECT COUNT(*) " . " FROM " . $this->tables['courseuser'] . " as cu " . " JOIN " . $this->tables['user'] . " as u " . " ON (cu.idUser = u.idst AND cu.idCourse=" . (int) $id_course . ") ";
     if (is_array($filter)) {
         $condition = array();
         if (isset($filter['text']) && $filter['text'] != "") {
             $conditions[] = " (u.userid LIKE '%" . $filter['text'] . "%' OR u.firstname LIKE '%" . $filter['text'] . "%' OR u.lastname LIKE '%" . $filter['text'] . "%') ";
         }
         if (isset($filter['selection']) && $filter['selection'] > 0) {
             switch ($filter['selection']) {
                 //begin only
                 case 1:
                     $conditions[] = " cu.status = 0 ";
                     break;
                     //itinere only
                 //itinere only
                 case 2:
                     $conditions[] = " cu.status = 1 ";
                     break;
                     //complete only
                 //complete only
                 case 3:
                     $conditions[] = " cu.status = 2 ";
                     break;
             }
         }
         $arr_idst = array();
         if (isset($filter['orgchart']) && $filter['orgchart'] > 0) {
             $umodel = new UsermanagementAdm();
             $use_desc = isset($filter['descendants']) && $filter['descendants'];
             $ulist = $umodel->getFolderUsers($filter['orgchart'], $use_desc);
             if (!empty($ulist)) {
                 $arr_idst = $ulist;
             }
             unset($ulist);
         }
         if (isset($filter['groups']) && $filter['groups'] > 0) {
             $gmodel = new GroupmanagementAdm();
             $ulist = $gmodel->getGroupAllUsers($filter['groups']);
             if (!empty($ulist)) {
                 if (!empty($arr_idst)) {
                     $arr_idst = array_merge($arr_idst, $ulist);
                 } else {
                     $arr_idst = $ulist;
                 }
             }
         }
         if (!empty($arr_idst)) {
             $conditions[] = " u.idst IN (" . implode(",", $arr_idst) . ") ";
         }
         if (!empty($conditions)) {
             $query .= " WHERE " . implode(" AND ", $conditions) . " ";
         }
     }
     $res = $this->db->query($query);
     if ($res) {
         list($count) = $this->db->fetch_row($res);
     } else {
         $count = false;
     }
     return $count;
 }
コード例 #10
0
 protected function _getNodeActions($node)
 {
     if (is_numeric($node)) {
         //if we have the id of the node, extract data
         require_once _base_ . '/lib/lib.json.php';
         $model = new UsermanagementAdm();
         $nodedata = $model->getFolderById($node);
         $node = array('id' => $nodedata->idOrg, 'label' => $model->getFolderTranslation($nodedata->idOrg, getLanguage()), 'is_leaf' => $nodedata->iRight - $nodedata->iLeft == 1, 'count_content' => (int) (($nodedata->iRight - $nodedata->iLeft - 1) / 2));
     }
     if (!is_array($node)) {
         return false;
     }
     //unrecognized type for node data
     $actions = array();
     $id_action = $node['id'];
     if (!$this->model->isFolderEnabled($id_action)) {
         return false;
     }
     $is_root = $id_action == 0;
     //assign users to folder action
     if ($this->permissions['associate_user']) {
         if (!$is_root) {
             $actions[] = array('id' => 'moduser_' . $id_action, 'command' => 'moduser', 'icon' => 'standard/moduser.png', 'href' => 'index.php?r=' . $this->link . '/assignuser&id=' . $id_action, 'alt' => Lang::t('_ASSIGN_USERS', 'organization_chart'));
         } else {
             $actions[] = array('id' => 'moduser_' . $id_action, 'command' => false, 'icon' => 'blank.png');
         }
     }
     //assign custom fields action
     if ($this->permissions['mod_org']) {
         $actions[] = array('id' => 'assignfields_' . $id_action, 'command' => 'assignfields', 'icon' => 'standard/database.png', 'alt' => Lang::t('_ASSIGNED_EXTRAFIELD', 'organization_chart'));
     }
     //rename action
     if ($this->permissions['mod_org']) {
         $actions[] = array('id' => 'mod_' . $id_action, 'command' => 'modify', 'icon' => 'standard/edit.png', 'alt' => Lang::t('_MOD', 'standard'));
     }
     //delete action
     if ($this->permissions['del_org']) {
         if ($node['is_leaf'] && !$is_root) {
             $actions[] = array('id' => 'del_' . $id_action, 'command' => 'delete', 'icon' => 'standard/delete.png', 'alt' => Lang::t('_DEL', 'standard'));
         } else {
             $actions[] = array('id' => 'del_' . $id_action, 'command' => false, 'icon' => 'blank.png');
         }
     }
     return $actions;
 }
コード例 #11
0
 public function view_competence_reportTask()
 {
     $id_competence = Get::req('id', DOTY_INT, -1);
     if ($id_competence <= 0) {
         //invalid competence
         $this->render('invalid', array('message' => $this->_getErrorMessage("invalid competence"), 'back_url' => 'index.php?r=' . $this->base_link_competence . '/show'));
         return;
     }
     $filter_text = "";
     $filter_set = Get::req('filter_set', DOTY_INT, -1);
     $filter_reset = Get::req('filter_reset', DOTY_INT, -1);
     if ($filter_set != -1) {
         $filter_text = Get::req('filter_text', DOTY_STRING, "");
     }
     if ($filter_reset != -1) {
         $filter_text = "";
     }
     $userdata = $this->model->getCompetenceUsers($id_competence, true, $filter_text);
     $umodel = new UsermanagementAdm();
     $uinfo = $umodel->getUsersDetails(array_keys($userdata), true, true);
     $icon_history = '<span class="ico-sprite subs_elem"><span>' . Lang::t('_HISTORY', 'standard') . '</span></span>';
     $table = new Table();
     $label_h = array(Lang::t('_USERNAME', 'standard'), Lang::t('_LASTNAME', 'standard'), Lang::t('_FIRSTNAME', 'standard'), Lang::t('_SCORE', 'competences'), Lang::t('_DATE_LAST_COMPLETE', 'subscribe'), $icon_history);
     $style_h = array('', '', '', 'img-cell', 'img-cell', 'img-cell');
     $table->addHead($label_h, $style_h);
     $type = $this->model->getCompetenceType($id_competence);
     $acl_man = Docebo::user()->getACLManager();
     foreach ($userdata as $id_user => $record) {
         $line = array();
         $line[] = Layout::highlight($acl_man->relativeId($uinfo[$id_user]->userid), $filter_text);
         $line[] = Layout::highlight($uinfo[$id_user]->lastname, $filter_text);
         $line[] = Layout::highlight($uinfo[$id_user]->firstname, $filter_text);
         $line[] = $type == 'score' ? $userdata[$id_user]->score_got : '-';
         $line[] = Format::date($userdata[$id_user]->last_assign_date, 'datetime');
         $line[] = $icon_history;
         $table->addBody($line);
     }
     $this->render('competence_users', array('id_competence' => $id_competence, 'filter_text' => $filter_text, 'table' => $table));
 }
コード例 #12
0
 public function showTask()
 {
     $id_course = isset($_SESSION['idCourse']) && $_SESSION['idCourse'] > 0 ? $_SESSION['idCourse'] : false;
     if ((int) $id_course <= 0) {
         //...
         return;
     }
     Util::get_js(Get::rel_path("base") . '/lib/js_utils.js', true, true);
     Util::get_js(Get::rel_path("lms") . '/views/coursestats/coursestats.js', true, true);
     $total_users = $this->model->getCourseStatsTotal($id_course, false);
     $lo_totals = $this->model->getLOsTotalCompleted($id_course);
     $_arr_js = array();
     foreach ($lo_totals as $id_lo => $total_lo) {
         $_arr_js[] = '{id:"lo_totals_' . $id_lo . '", total:"' . $total_lo . ' / ' . $total_users . '", ' . 'percent:"' . number_format($total_lo / $total_users, 2) . ' %"}';
     }
     $lo_totals_js = implode(",", $_arr_js);
     //WARNING: lo_list and lo_totals must have the same keys order
     $umodel = new UsermanagementAdm();
     $gmodel = new GroupmanagementAdm();
     $params = array('id_course' => $id_course, 'lo_list' => $this->model->getCourseLOs($id_course), 'filter_text' => "", 'filter_selection' => 0, 'filter_orgchart' => 0, 'filter_groups' => 0, 'filter_descendants' => false, 'is_active_advanced_filter' => false, 'orgchart_list' => $umodel->getOrgChartDropdownList(), 'groups_list' => $gmodel->getGroupsDropdownList(), 'total_users' => (int) $total_users, 'lo_totals_js' => $lo_totals_js, 'status_list' => $this->_getJsArrayStatus(), 'permissions' => $this->permissions);
     $this->render('show', $params);
 }
コード例 #13
0
 function get_userlevel_subscription($idu)
 {
     $level = 3;
     // default subscription level = Student
     $reg_code = '';
     $reg_code = Get::cfg('registration_code_gu', '');
     if (Get::cfg('register_type_guestuser') && $reg_code != '') {
         $uma = new UsermanagementAdm();
         $array_folder = $uma->getFoldersFromCode($reg_code);
         $userfolders = $uma->getUserFoldersCode($idu);
         if (in_array($reg_code, $userfolders)) {
             // it's a guest user , register to guest level
             $level = 1;
             // Guest user level subscription = Guest
         }
     }
     return $level;
 }
コード例 #14
0
 function connect()
 {
     require_once _adm_ . '/lib/lib.field.php';
     require_once _base_ . '/lib/lib.eventmanager.php';
     // Load language for fields names
     $lang_dir =& DoceboLanguage::createInstance('admin_directory', 'framework');
     $acl =& Docebo::user()->getACL();
     $acl_manager = Docebo::user()->getAclManager();
     $this->fl = new FieldList();
     $this->idst_group = $acl_manager->getGroupST('oc_' . (int) $this->tree);
     $this->idst_desc = $acl_manager->getGroupST('ocd_' . (int) $this->tree);
     $this->arr_fields = $this->fl->getAllFields();
     $this->cols_descriptor = NULL;
     if ($this->dbconn === NULL) {
         $this->last_error = Lang::t('_ORG_IMPORT_ERR_DBCONNISNULL');
         return FALSE;
     }
     $query = "SHOW FIELDS FROM " . $GLOBALS['prefix_fw'] . "_user";
     $rs = sql_query($query, $this->dbconn);
     if ($rs === FALSE) {
         $this->last_error = Lang::t('_ORG_IMPORT_ERR_ERRORONQUERY') . $query . ' [' . mysql_error($this->dbconn) . ']';
         return FALSE;
     }
     $this->cols_descriptor = array();
     while ($field_info = mysql_fetch_array($rs)) {
         if (!in_array($field_info['Field'], $this->ignore_cols)) {
             $mandatory = in_array($field_info['Field'], $this->mandatory_cols);
             if (isset($this->default_cols[$field_info['Field']])) {
                 $this->cols_descriptor[] = array(DOCEBOIMPORT_COLNAME => $lang_dir->def('_DIRECTORY_FILTER_' . $field_info['Field']), DOCEBOIMPORT_COLID => $field_info['Field'], DOCEBOIMPORT_COLMANDATORY => $mandatory, DOCEBOIMPORT_DATATYPE => $field_info['Type'], DOCEBOIMPORT_DEFAULT => $this->default_cols[$field_info['Field']]);
             } else {
                 $this->cols_descriptor[] = array(DOCEBOIMPORT_COLNAME => $lang_dir->def('_DIRECTORY_FILTER_' . $field_info['Field']), DOCEBOIMPORT_COLID => $field_info['Field'], DOCEBOIMPORT_COLMANDATORY => $mandatory, DOCEBOIMPORT_DATATYPE => $field_info['Type']);
             }
         }
     }
     $this->cols_descriptor[] = array(DOCEBOIMPORT_COLNAME => Lang::t('_FOLDER_NAME', 'standard'), DOCEBOIMPORT_COLID => 'tree_name', DOCEBOIMPORT_COLMANDATORY => false, DOCEBOIMPORT_DATATYPE => 'text');
     mysql_free_result($rs);
     foreach ($this->arr_fields as $field_id => $field_info) {
         if (in_array($field_info[FIELD_INFO_TYPE], $this->valid_filed_type)) {
             $this->cols_descriptor[] = array(DOCEBOIMPORT_COLNAME => $field_info[FIELD_INFO_TRANSLATION], DOCEBOIMPORT_COLID => $field_id, DOCEBOIMPORT_COLMANDATORY => FALSE, DOCEBOIMPORT_DATATYPE => 'text', DOCEBOIMPORT_DEFAULT => false);
         }
     }
     $this->userlevel = $acl_manager->getGroupST(ADMIN_GROUP_USER);
     $idst_oc = $acl_manager->getGroup(false, '/oc_0');
     $this->idst_oc = $idst_oc[ACL_INFO_IDST];
     $idst_ocd = $acl_manager->getGroup(false, '/ocd_0');
     $this->idst_ocd = $idst_ocd[ACL_INFO_IDST];
     // cache orgchart
     $um = new UsermanagementAdm();
     $this->orgchart = $um->getAllFolders('both', $this->tree != 0 ? $this->tree : false);
     return TRUE;
 }