Esempio n. 1
0
 public function show()
 {
     $filter_text = Get::req('filter_text', DOTY_STRING, "");
     if (isset($_GET['error'])) {
         UIFeedback::error(Lang::t('_OPERATION_FAILURE', 'kb'));
     }
     if (isset($_GET['success'])) {
         UIFeedback::info(Lang::t('_OPERATION_SUCCESSFUL', 'kb'));
     }
     require_once _lms_ . '/lib/lib.kbres.php';
     $kbres = new KbRes();
     $res_type_arr = $kbres->getResourceTypeArr(true);
     $res_type_dd_arr = array(0 => Lang::t('_ALL', 'kb'));
     $res_type_dd_arr += $res_type_arr;
     $categorized_filter_arr = array('all' => Lang::t('_CATEGORIZED_AND_UNCATEGORIZED', 'kb'), 'categorized' => Lang::t('_CATEGORIZED_ONLY', 'kb'), 'uncategorized' => Lang::t('_UNCATEGORIZED_ONLY', 'kb'));
     $res = Get::req('res', DOTY_STRING, '');
     $result_message = "";
     switch ($res) {
         case 'ok':
             $result_message = UIFeedback::info(Lang::t('_OPERATION_SUCCESSFUL', 'standard'));
             break;
         case 'err':
             $result_message = UIFeedback::error(Lang::t('_OPERATION_FAILURE', 'standard'));
             break;
     }
     $this->render('show', array('selected_node' => $this->_getSelectedNode(), 'addfolder_markup' => $this->_getAddFolderDialogContent($this->_getSelectedNode()), 'filter_text' => $filter_text, 'res_type_dd_arr' => $res_type_dd_arr, 'categorized_filter_arr' => $categorized_filter_arr, 'result_message' => $result_message, 'permissions' => $this->permissions));
 }
 public function show()
 {
     Util::get_js(Get::rel_path('base') . '/lib/js_utils.js', true, true);
     $rmodel = new AdminrulesAdm();
     switch (Get::req('res', DOTY_ALPHANUM, "")) {
         case 'ok_ins':
             UIFeedback::info(Lang::t('_OPERATION_SUCCESSFUL', 'standard'));
             break;
         case 'err_ins':
             UIFeedback::error(Lang::t('_OPERATION_FAILURE', 'standard'));
             break;
         default:
             if ($rmodel->totalGroup() <= 0) {
                 UIFeedback::notice(Lang::t('_NO_PROFILE_SET', 'adminrules'));
             }
             break;
     }
     $rules_list_js = "";
     if ($this->permissions['assign_profile']) {
         $rules = $rmodel->getGroupForDropdown();
         $rules_list_js .= '[';
         $first = true;
         foreach ($rules as $idst => $label) {
             $rules_list_js .= ($first ? '' : ',') . '{"label":"' . $label . '","value":' . $idst . '}';
             if ($first) {
                 $first = false;
             }
         }
         $rules_list_js .= ']';
     }
     $this->render('show', array('filter_text' => $this->_getSessionValue('filter', ""), 'permissions' => $this->permissions, 'rules_list_js' => $rules_list_js));
 }
 public function showTask()
 {
     if (isset($_GET['res']) && $_GET['res'] !== '') {
         UIFeedback::info(Lang::t(strtoupper($_GET['res']), 'label'));
     }
     if (isset($_GET['err']) && $_GET['err'] !== '') {
         UIFeedback::error(Lang::t(strtoupper($_GET['err']), 'label'));
     }
     $params = array('model' => $this->model, 'permissions' => $this->permissions);
     $this->render('show', $params);
 }
 protected function show()
 {
     checkPerm('view', true, 'enrollrules', 'lms');
     if (isset($_GET['result'])) {
         if ($_GET['result'] == 'true') {
             UIFeedback::notice(Lang::t('_OPERATION_SUCCESSFUL', 'enrollrules'));
         } else {
             UIFeedback::error(Lang::t('_OPERATION_FAILURE', 'enrollrules'));
         }
     }
     $this->render('show', array('model' => $this->model));
 }
 public function show()
 {
     if (isset($_GET['res']) && $_GET['res'] !== '') {
         UIFeedback::info(Lang::t('_OPERATION_SUCCESSFUL', 'standard'));
     }
     if (isset($_GET['err']) && $_GET['err'] !== '') {
         UIFeedback::error(Lang::t('_OPERATION_FAILURE', 'standard'));
     }
     $params = array();
     if (!isset($_SESSION['course_filter'])) {
         $_SESSION['course_filter']['text'] = '';
         $_SESSION['course_filter']['classroom'] = false;
         $_SESSION['course_filter']['descendants'] = false;
         $_SESSION['course_filter']['waiting'] = false;
     }
     if (isset($_POST['c_filter_set'])) {
         $classroom = (bool) Get::req('classroom', DOTY_INT, false);
         $descendants = (bool) Get::req('descendants', DOTY_INT, false);
         $waiting = (bool) Get::req('waiting', DOTY_INT, false);
         $filter_text = Get::req('text', DOTY_STRING, '');
     } else {
         $classroom = $_SESSION['course_filter']['classroom'];
         $descendants = $_SESSION['course_filter']['descendants'];
         $waiting = $_SESSION['course_filter']['waiting'];
         $filter_text = $_SESSION['course_filter']['text'];
     }
     $filter_open = false;
     if ($descendants || $waiting) {
         $filter_open = true;
     }
     $filter = array('classroom' => $classroom, 'descendants' => $descendants, 'waiting' => $waiting, 'text' => $filter_text, 'open' => $filter_open, 'id_category' => $this->_getSessionTreeData('id_category', 0));
     $_SESSION['course_filter']['text'] = $filter_text;
     $_SESSION['course_filter']['classroom'] = $classroom;
     $_SESSION['course_filter']['descendants'] = $descendants;
     $_SESSION['course_filter']['waiting'] = $waiting;
     $params['initial_selected_node'] = $this->_getSessionTreeData('id_category', 0);
     $params['filter'] = $filter;
     $params['root_name'] = Lang::t('_CATEGORY', 'admin_course_managment');
     $params['permissions'] = $this->permissions;
     $params['base_link_course'] = $this->base_link_course;
     $params['base_link_classroom'] = $this->base_link_classroom;
     $params['base_link_edition'] = $this->base_link_edition;
     $params['base_link_subscription'] = $this->base_link_subscription;
     $smodel = new SubscriptionAlms();
     $params['unsubscribe_requests'] = $smodel->countPendingUnsubscribeRequests();
     $this->render('show', $params);
 }
 public function show()
 {
     if (isset($_GET['res'])) {
         $res = Get::req('res', DOTY_STRING, '');
         switch ($res) {
             case 'ok':
                 UIFeedback::info(Lang::t('_UPDATE_OK', 'catalogue'));
                 break;
             case 'err':
                 UIFeedback::error(Lang::t('_UPDATE_ERROR', 'catalogue'));
                 break;
             default:
                 break;
         }
     }
     $this->render('show', array());
 }
 /**
  * The main screen, show the policy text if it has not been acccepted yet,
  * otherwise show the mandatory fields to compile (if set) then jump to Lms
  */
 public function showTask()
 {
     require_once _adm_ . '/lib/lib.field.php';
     $fieldlist = new FieldList();
     $result_message = "";
     $res = Get::req('res', DOTY_ALPHANUM, "");
     switch ($res) {
         case "err":
             $result_message .= UIFeedback::notice(Lang::t('_SOME_MANDATORY_EMPTY', 'register'), true);
     }
     //$policy_checked = $this->model->getAcceptingPolicy($id_user);
     $fields_checked = $fieldlist->checkUserMandatoryFields(false);
     if ($this->model->compileRequired()) {
         $this->render('show', array('result_message' => $result_message, 'fields_checked' => $fields_checked, 'policy_text' => $this->model->getPrivacyPolicyText(), 'id_user' => Docebo::user()->getIdSt(), 'fieldlist' => $fieldlist));
     } else {
         Util::jump_to($this->jump_url);
     }
 }
 protected function classroom()
 {
     //Course info
     $id_course = Get::req('id_course', DOTY_INT, 0);
     $cmodel = new CourseAlms();
     $course_info = $cmodel->getInfo($id_course);
     $course_name = ($course_info['code'] !== '' ? '[' . $course_info['code'] . '] ' : '') . $course_info['name'];
     $result_message = Get::req('result', DOTY_MIXED, false);
     switch ($result_message) {
         case 'ok_mod':
         case 'ok_ins':
             UIFeedback::info(Lang::t('_OPERATION_SUCCESSFUL', 'standard'));
             break;
         case 'err_mod':
         case 'err_ins':
             UIFeedback::error(Lang::t('_OPERATION_FAILURE', 'standard'));
             break;
     }
     $model = new ClassroomAlms($id_course);
     $this->render('edition', array('model' => $model, 'permissions' => $this->permissions, 'base_link_course' => $this->base_link_course, 'base_link_classroom' => $this->base_link_classroom, 'course_name' => $course_name));
 }
Esempio n. 9
0
function updatepoint()
{
    checkPerm('view', false, 'storage');
    $lang =& DoceboLanguage::createInstance('test');
    $idTest = importVar('idTest', true, 0);
    $back_url = urldecode(importVar('back_url'));
    $url_coded = htmlentities(urlencode($back_url));
    $max_score = _getTestMaxScore($idTest);
    if (!sql_query("\r\n\tUPDATE " . $GLOBALS['prefix_lms'] . "_test \r\n\tSET point_required = '" . $_POST['point_required'] . "',\r\n\t\tpoint_type = '" . ($_POST['point_type'] ? $_POST['point_type'] : 0) . "' ,\r\n\t\tscore_max = " . (int) $max_score . "\r\n\tWHERE idTest = '{$idTest}'")) {
        UIFeedback::error($lang->def('_OPERATION_FAILURE'));
        defpoint();
        return;
    }
    Util::jump_to('index.php?modname=test&op=modtestgui&idTest=' . $idTest . '&back_url=' . $url_coded);
}
Esempio n. 10
0
function codeList()
{
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('code');
    $id_code_group = Get::req('id_code_group', DOTY_INT, '0');
    $code_manager = new CodeManager();
    $acl_man = Docebo::user()->getAclManager();
    cout(getTitleArea(array('index.php?modname=code&amp;op=list' => $lang->def('_CODE'), $lang->def('_CODE_LIST'))) . '<div class="std_block">');
    if (isset($_POST['undo_filter'])) {
        unset($_POST['code_filter']);
    }
    cout('<div class="quick_search_form">' . Form::openForm('code_list_filter', 'index.php?modname=code&amp;op=code_list&amp;id_code_group=' . $id_code_group) . Form::getInputTextfield("search_t", "code_filter", "code_filter", isset($_POST['code_filter']) ? $_POST['code_filter'] : '', '', 255, '') . Form::getButton("filter", "filter", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("undo_filter", "undo_filter", Lang::t('_RESET', 'standard'), "reset_b") . Form::closeForm() . '</div>');
    $result = Get::req('result', DOTY_STRING, '');
    switch ($result) {
        case 'ok':
            UIFeedback::info($lang->def('_OPERATION_SUCCESSFUL'));
            break;
        case 'err':
            UIFeedback::error($lang->def('_OPERATION_FAILURE'));
            break;
        case 'err_dup':
            UIFeedback::error($lang->def('_DUPLICATED_CODE'));
            break;
    }
    $tot_code = $code_manager->getCodeNumber($id_code_group, isset($_POST['undo_filter']) ? $_POST['undo_filter'] : false);
    if ($tot_code) {
        $tb = new Table('20');
        $tb->initNavBar('ini', 'link');
        $tb->setLink('index.php?modname=code&amp;op=code_list&amp;id_code_group=' . $id_code_group);
        $ini = $tb->getSelectedElement();
        $cont_h = array($lang->def('_CODE'), $lang->def('_USED'), $lang->def('_USERNAME'), $lang->def('_UNLIMITED_USE'), '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />');
        $type_h = array('', 'image', '', 'image', 'image', 'image');
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        $array_code = $code_manager->getCodeList($id_code_group, $ini);
        foreach ($array_code as $code_info) {
            $cont = array();
            $cont[] = $code_info['code'];
            if ($code_info['used']) {
                $cont[] = '<img src="' . getPathImage() . 'standard/status_active.png" alt="' . $lang->def('_USED') . '" />';
                $user_info = $acl_man->getUser($code_info['id_user'], false);
                if ($user_info) {
                    $cont[] = $acl_man->relativeId($user_info[ACL_INFO_USERID]);
                } else {
                    $user_info = $acl_man->getTempUserInfo($code_info['id_user'], false);
                    $cont[] = $acl_man->relativeId($user_info['userid']);
                }
                if ($code_info['unlimited_use'] == '1') {
                    $cont[] = '<img src="' . getPathImage() . 'standard/status_active.png" alt="' . $lang->def('_UNLIMITED_USE') . '" />';
                } else {
                    $cont[] = '-';
                }
                $cont[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />';
            } else {
                $cont[] = '-';
                $cont[] = $lang->def('_NONE');
                if ($code_info['unlimited_use'] == '1') {
                    $cont[] = '<img src="' . getPathImage() . 'standard/status_active.png" alt="' . $lang->def('_UNLIMITED_USE') . '" />';
                } else {
                    $cont[] = '-';
                }
                $cont[] = '<a href="index.php?modname=code&amp;op=mod_code&amp;id_code_group=' . $id_code_group . '&amp;code=' . $code_info['code'] . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />';
            }
            $cont[] = '<a href="index.php?modname=code&amp;op=del_code&amp;id_code_group=' . $id_code_group . '&amp;code=' . $code_info['code'] . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />';
            $tb->addBody($cont);
        }
        $tb->addActionAdd('<a href="index.php?modname=code&amp;op=add_code&amp;id_code_group=' . $id_code_group . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_ADD') . '</a>');
        $tb->addActionAdd('<a class="ico-wt-sprite subs_xls" title="' . Lang::t('_EXPORT_XLS', 'report') . '" ' . 'href="index.php?modname=code&amp;op=export&amp;id_code_group=' . $id_code_group . '&amp;format=xls">' . '<span>' . Lang::t('_EXPORT_XLS', 'report') . '</span></a>');
        $tb->addActionAdd('<a class="ico-wt-sprite subs_csv" title="' . Lang::t('_EXPORT_CSV', 'report') . '" ' . 'href="index.php?modname=code&amp;op=export&amp;id_code_group=' . $id_code_group . '&amp;format=csv">' . '<span>' . Lang::t('_EXPORT_CSV', 'report') . '</span></a>');
        cout($tb->getTable() . $tb->getNavBar($ini, $tot_code));
        setupHrefDialogBox('a[href*=del_code]');
    } else {
        cout($lang->def('_NO_CODE_FOUND') . '<br/>' . '<a href="index.php?modname=code&amp;op=add_code&amp;id_code_group=' . $id_code_group . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_ADD') . '</a>');
    }
    cout('<br/><br/>' . getBackUi('index.php?modname=code&amp;op=list', $lang->def('_BACK')) . '</div>');
}
 public function menu()
 {
     require_once _base_ . '/lib/lib.platform.php';
     if (isset($_POST['back'])) {
         Util::jump_to('index.php?r=adm/adminrules/show');
     }
     $idst = Get::req('idst', DOTY_INT, 0);
     $active_tab = Get::req('active_tab', DOTY_MIXED, 'framework');
     $pm =& PlatformManager::createInstance();
     $platform_list = $pm->getPlatformList();
     if (isset($platform_list['scs'])) {
         unset($platform_list['scs']);
     }
     if (isset($platform_list['ecom'])) {
         unset($platform_list['ecom']);
     }
     $result_message = "";
     if (isset($_POST['save'])) {
         $adm_perm = array();
         if (isset($_POST['adm_perm'])) {
             $adm_perm = array_keys($_POST['adm_perm']);
         }
         $res = $this->model->saveAdminPerm($idst, $adm_perm);
         $result_message = $res ? UIFeedback::info(Lang::t('_OPERATION_SUCCESSFUL', 'standard')) : UIFeedback::error(Lang::t('_OPERATION_FAILURE', 'standard'));
         Util::jump_to('index.php?r=adm/adminrules/show&res=' . ($res ? 'ok' : 'err'));
     }
     $this->render('menu', array('idst' => $idst, 'platform_list' => $platform_list, 'active_tab' => $active_tab, 'model' => $this->model, 'save_res' => $result_message));
 }
 public function delete_waitingTask()
 {
     //check permissions
     if (!$this->permissions['approve_waiting_user']) {
         $output = array('success' => false, 'message' => $this->_getErrorMessage('no permission'));
         echo $this->json->encode($output);
         return;
     }
     $arr_users = array();
     $id_user = Get::req('id_user', DOTY_INT, -1);
     if ($id_user > 0) {
         $arr_users = array($id_user);
     } else {
         $str_users = trim(Get::Req('users', DOTY_STRING, ""));
         $arr_users = $str_users != "" ? explode(",", $str_users) : array();
     }
     $output = array();
     if (!is_array($arr_users) || empty($arr_users)) {
         $output['success'] = false;
         $output['message'] = UIFeedback::pnotice(Lang::t('_NO_USERS_SPECIFIED', 'admin_directory'));
         echo $this->json->encode($output);
         return;
     }
     $res = $this->model->deleteWaitingUsers($arr_users);
     if ($res) {
         $output['success'] = true;
     } else {
         $output['success'] = false;
         $output['message'] = UIFeedback::perror(Lang::t('_OPERATION_FAILURE', 'standard'));
     }
     echo $this->json->encode($output);
 }
Esempio n. 13
0
 function entrylist()
 {
     checkPerm('view');
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.form.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
     $lang =& DoceboLanguage::createInstance('catalogue', 'lms');
     $out =& $GLOBALS['page'];
     $id_cat = Get::req('id', DOTY_INT, 0);
     $cat_name = getCatalogueName($id_cat);
     $mod_perm = checkPerm('mod', true);
     $title_area = array('index.php?modname=catalogue&amp;op=catlist' => $lang->def('_CATALOGUE'), $cat_name);
     $tb_entry = new Table();
     $query_entry = "\r\n\tSELECT idEntry, type_of_entry\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_catalogue_entry\r\n\tWHERE idCatalogue = '" . $id_cat . "'";
     $re_entry = sql_query($query_entry);
     $courses = array();
     $coursepath = array();
     while (list($id, $t_o_entry) = sql_fetch_row($re_entry)) {
         if ($t_o_entry == 'course') {
             $courses[$id] = $id;
         } else {
             $coursepath[$id] = $id;
         }
     }
     $coursepath_man = new CoursePath_Manager();
     $coursespath_name =& $coursepath_man->getNames($coursepath);
     $course_name =& getCoursesInfo($courses);
     $cont_h = array($lang->def('_CODE'), $lang->def('_NAME'), $lang->def('_TYPE'));
     $type_h = array('', '', '');
     if ($mod_perm) {
         $type_h[] = 'image';
         $cont_h[] = '<img src="' . getPathImage('fw') . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />';
     }
     $tb_entry->setColsStyle($type_h);
     $tb_entry->addHead($cont_h);
     $all_courses = true;
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         $all_courses = false;
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST());
         if (isset($admin_courses['course'][0])) {
             $all_courses = true;
         } elseif (isset($admin_courses['course'][-1])) {
             require_once _lms_ . '/lib/lib.catalogue.php';
             $cat_man = new Catalogue_Manager();
             $user_catalogue = $cat_man->getUserAllCatalogueId(Docebo::user()->getIdSt());
             if (count($user_catalogue) > 0) {
                 $courses = array(0);
                 foreach ($user_catalogue as $id_cat) {
                     $catalogue_course =& $cat_man->getCatalogueCourse($id_cat, true);
                     $courses = array_merge($courses, $catalogue_course);
                 }
                 foreach ($courses as $id_course) {
                     if ($id_course != 0) {
                         $admin_courses['course'][$id_course] = $id_course;
                     }
                 }
             } elseif (Get::sett('on_catalogue_empty', 'off') == 'on') {
                 $all_courses = true;
             }
         } else {
             $array_courses = array();
             $array_courses = array_merge($array_courses, $admin_courses['course']);
             if (!empty($admin_courses['coursepath'])) {
                 require_once _lms_ . '/lib/lib.coursepath.php';
                 $path_man = new Catalogue_Manager();
                 $coursepath_course =& $path_man->getAllCourses($admin_courses['coursepath']);
                 $array_courses = array_merge($array_courses, $coursepath_course);
             }
             if (!empty($admin_courses['catalogue'])) {
                 require_once _lms_ . '/lib/lib.catalogue.php';
                 $cat_man = new Catalogue_Manager();
                 foreach ($admin_courses['catalogue'] as $id_cat) {
                     $catalogue_course =& $cat_man->getCatalogueCourse($id_cat, true);
                     $array_courses = array_merge($array_courses, $catalogue_course);
                 }
             }
             $admin_courses['course'] = array_merge($admin_courses['course'], $array_courses);
         }
     }
     if (is_array($course_name)) {
         foreach ($course_name as $course) {
             $cont = array($course['code'], $course['name'], $lang->def('_COURSE'));
             if ($mod_perm) {
                 if (isset($admin_courses['course'][$course['id']]) || $all_courses) {
                     $cont[] = '<a href="index.php?modname=catalogue&amp;op=delentry&amp;id_cat=' . $id_cat . '&amp;type=course&amp;id_entry=' . $course['id'] . '" ' . 'title="' . $lang->def('_REMOVE_ENTRY') . ' : ' . strip_tags($course['name']) . '">' . '<img src="' . getPathImage('fw') . 'standard/delete.png" ' . 'alt="' . $lang->def('_DEL') . ' : ' . strip_tags($course['name']) . '" /></a>';
                 } else {
                     $cont[] = '';
                 }
             }
             $tb_entry->addBody($cont);
         }
     }
     if (is_array($coursespath_name)) {
         while (list($id, $coursepath) = each($coursespath_name)) {
             $cont = array($coursepath, $lang->def('_COURSEPATH'));
             // #bugfix 1141
             $tmp_code = $coursepath_man->getCoursepathInfo($id);
             $path_code = $tmp_code['path_code'];
             array_unshift($cont, $path_code);
             // end bugfix
             if ($mod_perm) {
                 if (isset($admin_courses['coursepath'][$id]) || $all_courses) {
                     $cont[] = '<a href="index.php?modname=catalogue&amp;op=delentry&amp;id_cat=' . $id_cat . '&amp;type=coursepath&amp;id_entry=' . $id . '" ' . 'title="' . $lang->def('_REMOVE_ENTRY') . ' : ' . strip_tags($coursepath) . '">' . '<img src="' . getPathImage('fw') . 'standard/delete.png" ' . 'alt="' . $lang->def('_DEL') . ' : ' . strip_tags($coursepath) . '" /></a>';
                 } else {
                     $cont[] = '';
                 }
             }
             $tb_entry->addBody($cont);
         }
     }
     $select_entry = array('course' => $lang->def('_COURSE'), 'coursepath' => $lang->def('_COURSEPATH'));
     if ($mod_perm) {
         $tb_entry->addActionAdd('<a href="index.php?modname=catalogue&amp;op=import&amp;id_cat=' . $id_cat . '&amp;load=1" class="ico-wt-sprite subs_import" ' . ' title="' . Lang::t('_IMPORT', 'catalogue') . '"><span>' . Lang::t('_IMPORT', 'catalogue') . '</span></a>');
     }
     switch (Get::req('result', DOTY_ALPHANUM, '')) {
         case "ok":
             UIFeedback::info(Lang::t('_OPERATION_SUCCESSFUL', 'standard'));
             break;
         case "err":
             UIFeedback::error(Lang::t('_OPERATION_ERROR', 'standard'));
             break;
     }
     $out->add(getTitleArea($title_area, 'catalogue') . '<div class="std_block">' . getBackUi('index.php?modname=catalogue&amp;op=catlist', $lang->def('_BACK')) . $tb_entry->getTable() . getBackUi('index.php?modname=catalogue&amp;op=catlist', $lang->def('_BACK')) . '</div>', 'content');
     if ($mod_perm) {
         require_once _base_ . '/lib/lib.dialog.php';
         setupHrefDialogBox('a[href*=delentry]');
     }
 }
Esempio n. 14
0
function presence()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    YuiLib::load();
    Util::get_js(Get::rel_path('lms') . '/admin/views/classroom/classroom.js', true, true);
    $id_date = Get::req('id_date', DOTY_INT, 0);
    $lang =& DoceboLanguage::CreateInstance('admin_date', 'lms');
    $date_man = new DateManager();
    $user_date = $date_man->getUserDateForCourse(getLogUserId(), $_SESSION['idCourse']);
    $date_info = $date_man->getDateInfoForPublicPresence($user_date);
    foreach ($date_info as $info_date) {
        $date_for_dropdown[$info_date['id_date']] = $info_date['code'] . ' - ' . $info_date['name'] . ' (' . Format::date($info_date['date_begin'], 'date') . ')';
    }
    if ($id_date == 0) {
        $id_date = isset($date_info[0]['id_date']) ? $date_info[0]['id_date'] : 0;
    }
    cout(getTitleArea(Lang::t('_ATTENDANCE')) . '<div class="std_block">', 'content');
    if (isset($_POST['save'])) {
        require_once $GLOBALS['where_lms'] . '/lib/lib.date.php';
        $date_man = new DateManager();
        $id_date = Get::req('id_date', DOTY_INT, 0);
        $score_min = Get::req('score_min', DOTY_INT, 0);
        $user = $date_man->getUserForPresence($id_date);
        $day = $date_man->getDateDay($id_date);
        $test_type = $date_man->getTestType($id_date);
        foreach ($user as $id_user => $user_info) {
            $user[$id_user]['score'] = Get::req('score_' . $id_user, DOTY_INT, 0);
            $user[$id_user]['note'] = Get::req('note_' . $id_user, DOTY_MIXED, '');
            $user[$id_user]['day_presence'] = array();
            for ($i = 0; $i < count($day); $i++) {
                $user[$id_user]['day_presence'][$day[$i]['id_day']] = Get::req('date_' . $day[$i]['id_day'] . '_' . $id_user, DOTY_INT, 0);
            }
        }
        if ($date_man->insDatePresence($_SESSION['id_course_date'], $id_date, $user, $day, $score_min)) {
            UIFeedback::info(Lang::t('_ATTENDANCE_SAVED', 'admin_date'));
        } else {
            UIFeedback::error(Lang::t('_ATTENDANCE_SAVED_ERROR', 'admin_date'));
        }
    }
    if ($id_date == 0) {
        cout(Lang::t('_NO_CONTENT', 'admin_date'), 'content');
    } else {
        $user = $date_man->getUserForPresence($id_date);
        $day = $date_man->getDateDay($id_date);
        $test_type = $date_man->getTestType($id_date);
        $user_presence = $date_man->getUserPresenceForDate($id_date);
        $tb = new Table(0, Lang::t('_ATTENDANCE', 'admin_date'), Lang::t('_ATTENDANCE', 'admin_date'));
        $cont_h = array(Lang::t('_USERNAME', 'admin_date'), Lang::t('_FULLNAME', 'admin_date'));
        $type_h = array('', '');
        foreach ($day as $id_day => $day_info) {
            $cont_h[] = Format::date($day_info['date_begin'], 'date') . '<br />' . '<a href="javascript:;" onClick="checkAllDay(' . $id_day . ')">' . Get::img('standard/checkall.png', Lang::t('_CHECK_ALL_DAY', 'presence') . '</a>') . ' ' . '<a href="javascript:;" onClick="unCheckAllDay(' . $id_day . ')">' . Get::img('standard/uncheckall.png', Lang::t('_UNCHECK_ALL_DAY', 'presence') . '</a>');
            $type_h[] = 'align_center';
        }
        $cont_h[] = '';
        $type_h[] = 'img-cell';
        if ($test_type == _DATE_TEST_TYPE_PAPER) {
            $cont_h[] = Lang::t('_SCORE', 'admin_date');
            $type_h[] = 'align_center';
        }
        $cont_h[] = Lang::t('_NOTES', 'admin_date');
        $type_h[] = 'align_center';
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        cout(Form::openForm('presence_form', 'index.php?modname=presence&amp;op=presence') . Form::openElementSpace() . Form::getDropdown(Lang::t('_SELECT_EDITION', 'admin_date'), 'id_date', 'id_date', $date_for_dropdown, $id_date) . Form::closeElementSpace() . Form::openElementSpace() . ($test_type == 1 ? Form::getTextfield(Lang::t('_MIN_SCORE', 'admin_date'), 'score_min', 'score_min', 255, '') : ''), 'content');
        $array_user_id = array();
        foreach ($user as $id_user => $user_info) {
            reset($day);
            $array_user_id[] = $id_user;
            $cont = array();
            $cont[] = $user_info['userid'];
            $cont[] = $user_info['lastname'] . ' ' . $user_info['firstname'];
            foreach ($day as $id_day => $day_info) {
                if (isset($user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]) && $user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]['presence'] == 1) {
                    $presence = true;
                } elseif (isset($user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]) && $user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]['presence'] == 0) {
                    $presence = false;
                } else {
                    $presence = false;
                }
                $cont[] = Form::getInputCheckbox('date_' . $id_day . '_' . $id_user, 'date_' . $id_day . '_' . $id_user, 1, $presence, false);
            }
            $cont[] = '<a href="javascript:;" onClick="checkAllUser(' . $id_user . ')">' . Get::img('standard/checkall.png', Lang::t('_CHECK_ALL_USER', 'presence') . '</a>') . '<br />' . '<a href="javascript:;" onClick="unCheckAllUser(' . $id_user . ')">' . Get::img('standard/uncheckall.png', Lang::t('_UNCHECK_ALL_USER', 'presence') . '</a>');
            if ($test_type == _DATE_TEST_TYPE_PAPER) {
                if (isset($user_presence[$id_user]['0000-00-00']) && $user_presence[$id_user]['0000-00-00']['presence'] == 1) {
                    $passed = true;
                } else {
                    $passed = false;
                }
                $cont[] = Form::getTextfield('', 'score_' . $id_user, 'score_' . $id_user, 255, isset($user_presence[$id_user]['0000-00-00']['score']) ? $user_presence[$id_user]['0000-00-00']['score'] : '0');
            }
            $cont[] = Form::getSimpleTextarea('', 'note_' . $id_user, 'note_' . $id_user, isset($user_presence[$id_user]['0000-00-00']['note']) ? $user_presence[$id_user]['0000-00-00']['note'] : '', false, false, false, 2);
            $tb->addBody($cont);
        }
        cout($tb->getTable() . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', Lang::t('_SAVE', 'admin_date')) . Form::closeElementSpace() . Form::closeForm() . '</div>', 'content');
        cout('<script type="text/javascript">' . 'var _MIN_SCORE_NOT_SET = "' . Lang::t('_MIN_SCORE_NOT_SET', 'admin_date') . '";' . 'YAHOO.util.Event.addListener("save", "click", controlMinScore);' . 'YAHOO.util.Event.addListener("id_date", "change", formSubmit);' . 'function checkAllDay(id_day)
{
	var days = YAHOO.util.Selector.query(\'input[id*=_\' + id_day + \'_]\');
	var i;

	for(i = 0; i < days.length; i++)
		days[i].checked = true;
}

function unCheckAllDay(id_day)
{
	var days = YAHOO.util.Selector.query(\'input[id*=_\' + id_day + \'_]\');
	var i;

	for(i = 0; i < days.length; i++)
		days[i].checked = false;
}

function checkAllUser(id_user)
{
	var days = YAHOO.util.Selector.query(\'input[id*=_\' + id_user + \']\');
	var i;

	for(i = 0; i < days.length; i++)
		days[i].checked = true;
}

function unCheckAllUser(id_user)
{
	var days = YAHOO.util.Selector.query(\'input[id*=_\' + id_user + \']\');
	var i;

	for(i = 0; i < days.length; i++)
		days[i].checked = false;
}' . '</script>', 'content');
    }
    cout('</div>', 'content');
}
Esempio n. 15
0
<?php

Get::title(array('index.php?r=' . $base_link_course . '/show' => Lang::t('_COURSE', 'course'), 'index.php?r=' . $base_link_classroom . '/classroom&id_course=' . $model->getIdCourse() => Lang::t('_CLASSROOM', 'course'), Lang::t('_ADD', 'course')));
if (isset($err_avail)) {
    echo UIFeedback::error(Lang::t($err_avail, 'course'));
}
?>
<div class="std_block">

<?php 
echo Form::openForm('add_date', 'index.php?r=' . $base_link_classroom . '/addclassroom&amp;id_course=' . $model->getIdCourse()) . Form::getHidden('step', 'step', '2') . Form::openElementSpace() . Form::getTextfield(Lang::t('_CODE', 'course'), 'code', 'code', 255, isset($_POST['code']) ? $_POST['code'] : $course_info['code']) . Form::getTextfield(Lang::t('_NAME', 'course'), 'name', 'name', 255, isset($_POST['name']) ? $_POST['name'] : $course_info['name']) . Form::getTextarea(Lang::t('_DESCRIPTION', 'course'), 'description', 'description', isset($_POST['description']) ? stripslashes(stripslashes($_POST['description'])) : stripslashes($course_info['description'])) . Form::getTextfield(Lang::t('_MEDIUM_TIME', 'course'), 'medium_time', 'medium_time', 255, isset($_POST['medium_time']) ? $_POST['medium_time'] : $course_info['mediumTime']) . Form::getTextfield(Lang::t('_MAX_NUM_SUBSCRIBE', 'course'), 'max_par', 'max_par', 255, isset($_POST['max_par']) ? $_POST['max_par'] : '') . Form::getTextfield(Lang::t('_COURSE_PRIZE', 'course'), 'price', 'price', 255, isset($_POST['price']) ? $_POST['price'] : '') . Form::getDropdown(Lang::t('_STATUS', 'course'), 'status', 'status', $model->getStatusForDropdown(), isset($_POST['status']) ? $_POST['status'] : '') . Form::getDropdown(Lang::t('_FINAL_SCORE', 'course'), 'test', 'test', $model->getTestTypeForDropdown(), isset($_POST['test']) ? $_POST['test'] : '') . '<div class="form_line_l">' . '<p><label for="overbooking" class="floating">' . Lang::t('_ALLOW_OVERBOOKING', 'course') . '</label></p>' . Form::getInputCheckbox('overbooking', 'overbooking', 1, isset($_POST['overbooking']) && $_POST['overbooking'] == 1 ? true : false, false) . '</div>' . Form::getDatefield(Lang::t('_SUBSCRIPTION_DATE_BEGIN', 'course'), 'sub_start_date', 'sub_start_date', isset($_POST['sub_start_date']) ? $_POST['sub_start_date'] === '00-00-0000' ? '' : $_POST['sub_start_date'] : '') . Form::getDatefield(Lang::t('_SUBSCRIPTION_DATE_END', 'course'), 'sub_end_date', 'sub_end_date', isset($_POST['sub_end_date']) ? $_POST['sub_end_date'] === '00-00-0000' ? '' : $_POST['sub_end_date'] : '') . Form::getDatefield(Lang::t('_UNSUBSCRIBE_DATE_LIMIT', 'course'), 'unsubscribe_date_limit', 'unsubscribe_date_limit', isset($_POST['unsubscribe_date_limit']) ? $_POST['unsubscribe_date_limit'] === '00-00-0000' ? '' : $_POST['unsubscribe_date_limit'] : '') . '<div id="date_container">';
?>

<div id="calendar_container" class="form_line_l"></div>

<?php 
$date_string = '';
$start_mounth = '';
if (isset($_POST['date_selected']) && !empty($_POST['date_selected'])) {
    $array_day = explode(',', $_POST['date_selected']);
    $first = true;
    if (count($array_day) > 0) {
        for ($i = 0; $i < count($array_day); $i++) {
            if ($first) {
                $first = false;
                $start_mounth = (int) substr($array_day[$i], 5, 2) . '/' . substr($array_day[$i], 0, 4);
                $date_string .= (int) substr($array_day[$i], 5, 2) . '/' . (int) substr($array_day[$i], 8, 2) . '/' . substr($array_day[$i], 0, 4);
            } else {
                $date_string .= ',' . (int) substr($array_day[$i], 5, 2) . '/' . (int) substr($array_day[$i], 8, 2) . '/' . substr($array_day[$i], 0, 4);
            }
        }
Esempio n. 16
0
 function loadBody()
 {
     global $op, $modname;
     if ($this->treeView === NULL) {
         $this->initialize();
     }
     // tree indipendent play lo -----------------------------------------------
     if ($GLOBALS['op'] == 'scorm_track') {
         require_once $GLOBALS['where_lms'] . '/modules/organization/orgresults.php';
         $user = Get::req('id_user', DOTY_INT, false);
         $org = Get::req('id_org', DOTY_INT, false);
         getTrackingTable($user, $org);
         return;
     }
     if ($GLOBALS['op'] == 'scorm_history') {
         require_once _lms_ . '/modules/organization/orgresults.php';
         $user = Get::req('id_user', DOTY_INT, false);
         $obj = Get::req('id_obj', DOTY_INT, false);
         getHistoryTable($user, $obj);
         return;
     }
     if ($GLOBALS['op'] == 'scorm_interactions') {
         require_once _lms_ . '/modules/organization/orgresults.php';
         //__FILE__.'/appLms/modules/organization/orgresults.php');
         $user = Get::req('id_user', DOTY_INT, false);
         $track = Get::req('id_track', DOTY_INT, false);
         getInteractionsTable($user, $track);
         return;
     }
     if ($GLOBALS['op'] === 'test_track') {
         require_once _lms_ . '/modules/organization/orgresults.php';
         $user = Get::req('id_user', DOTY_INT, false);
         $org = Get::req('id_org', DOTY_INT, false);
         getCompilationTable($user, $org);
         return;
     }
     if ($GLOBALS['op'] == 'custom_playitem') {
         require_once $GLOBALS['where_framework'] . '/lib/lib.sessionsave.php';
         $saveObj = new Session_Save();
         $saveName = $saveObj->getName('organization' . $_SESSION['idCourse'], true);
         $saveObj->save($saveName, $this->treeView->getState());
         $id_item = importVar('id_item');
         $folder = $this->repoDb->getFolderById($id_item);
         $lo = createLO($folder->otherValues[REPOFIELDOBJECTTYPE]);
         $idItem = $folder->otherValues[REPOFIELDIDRESOURCE];
         if (isset($_GET['edit']) && $_GET['edit']) {
             $back_url = 'index.php?modname=' . $modname . '&op=custom_enditem&edit=1&id_item=' . $id_item;
         } else {
             $back_url = 'index.php?modname=' . $modname . '&op=custom_enditem&id_item=' . $id_item;
         }
         $lo->play($idItem, $folder->otherValues[ORGFIELDIDPARAM], $back_url);
         return;
     }
     // tree indipendent play end --------------------------------------------
     if ($GLOBALS['op'] == 'custom_enditem') {
         $lang =& DoceboLanguage::createInstance('organization', 'lms');
         require_once $GLOBALS['where_lms'] . '/class.module/track.object.php';
         require_once $GLOBALS['where_lms'] . '/lib/lib.stats.php';
         $id_item = importVar('id_item');
         $folder = $this->repoDb->getFolderById($id_item);
         $objectType = $folder->otherValues[REPOFIELDOBJECTTYPE];
         $idResource = $folder->otherValues[REPOFIELDIDRESOURCE];
         $idParams = $folder->otherValues[ORGFIELDIDPARAM];
         $isTerminator = $folder->otherValues[ORGFIELDISTERMINATOR];
         /*With this direct_play courses was set as finished if is passed the object automatically without needing to set it as finish course object
         		$isTerminator = ( isset($_SESSION['direct_play']) ? true : $folder->otherValues[ORGFIELDISTERMINATOR] );*/
         $idCourse = $_SESSION['idCourse'];
         if ($isTerminator) {
             require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
             $idTrack = Track_Object::getIdTrackFromCommon($id_item, getLogUserId());
             $track = createLOTrack($idTrack, $objectType, $idResource, $idParams, "");
             if ($track->getStatus() == 'completed' || $track->getStatus() == 'passed') {
                 if (!saveTrackStatusChange((int) getLogUserId(), (int) $idCourse, _CUS_END)) {
                     errorCommunication($lang->def('_OPERATION_FAILURE'));
                     return;
                 }
             }
         }
         if (Get::req('edit', DOTY_INT, 0) > 0) {
             Util::jump_to('index.php?modname=storage&op=display');
         }
         if (isset($_SESSION['direct_play'])) {
             $from = Get::req('from', DOTY_ALPHANUM, '');
             //reset cache for the notication
             UpdatesLms::resetCache();
             // autoplay with more than an object and the first one is completed
             require_once _lms_ . '/lib/lib.orgchart.php';
             $orgman = new OrganizationManagement($_SESSION['idCourse']);
             $first_lo =& $orgman->getInfoWhereType(false, $_SESSION['idCourse']);
             if (count($first_lo) >= 2) {
                 // if we have more than an object we need to play the first one until it's completed
                 $obj = array_shift($first_lo);
                 $query = "SELECT status FROM %lms_commontrack WHERE idReference = " . (int) $obj['id_org'] . " AND idUser = "******"catalogue":
                     Util::jump_to('index.php?r=lms/catalog/show&sop=unregistercourse');
                     break;
                 case "lo_plan":
                     Util::jump_to('index.php?r=' . _after_login_ . '&sop=unregistercourse');
                     break;
                 case "lo_history":
                     Util::jump_to('index.php?r=' . _after_login_ . '&current_tab=lo_history&sop=unregistercourse');
                     break;
                 default:
                     Util::jump_to('index.php?r=' . _after_login_ . '&sop=unregistercourse');
                     break;
             }
         }
     }
     //--- direct edit item -----------------------------------------------------
     if ($GLOBALS['op'] == 'direct_edit_item') {
         $id_item = Get::req('id_item', DOTY_INT, 0);
         $this->treeView->op = 'editLO';
     }
     // normal tree function --------------------------------------------
     $this->treeView->playOnly = $modname == 'organization';
     switch ($this->treeView->op) {
         case 'import':
             import($this->treeView);
             break;
         case 'createLO':
             global $modname;
             // save state
             require_once $GLOBALS['where_framework'] . '/lib/lib.sessionsave.php';
             $saveObj = new Session_Save();
             $saveName = $saveObj->getName('organization' . $_SESSION['idCourse'], true);
             $saveObj->save($saveName, $this->treeView->getState());
             $GLOBALS['page']->add($this->treeView->LOSelector($modname, 'index.php?modname=' . $modname . '&op=display&sor=' . $saveName . '&' . $this->treeView->_getOpCreateLOEnd() . '=1'), 'content');
             break;
         case 'createLOSel':
             global $modname;
             // save state
             require_once $GLOBALS['where_framework'] . '/lib/lib.sessionsave.php';
             $saveObj = new Session_Save();
             $saveName = $saveObj->getName('organization' . $_SESSION['idCourse'], true);
             $saveObj->save($saveName, $this->treeView->getState());
             // start learning object creation
             $lo = createLO($_POST['radiolo']);
             if ($lo !== false) {
                 $lo->create('index.php?modname=' . $modname . '&op=display&sor=' . $saveName . '&' . $this->treeView->_getOpCreateLOEnd() . '=1');
             } else {
                 $GLOBALS['page']->addStart(getTitleArea(def('_ORGANIZATION', 'organization', 'lms'), 'organization') . '<div class="std_block">', 'content');
                 $GLOBALS['page']->addEnd('</div>', 'content');
                 if (isset($_SESSION['last_error'])) {
                     if ($_SESSION['last_error'] != "") {
                         //$GLOBALS['page']->add( $_SESSION['last_error'], 'content' );
                         UIFeedback::error($_SESSION['last_error']);
                         unset($_SESSION['last_error']);
                     }
                 }
                 organization($this->treeView);
             }
             break;
         case 'editLO':
             global $modname;
             // save state
             require_once $GLOBALS['where_framework'] . '/lib/lib.sessionsave.php';
             $saveObj = new Session_Save();
             $saveName = $saveObj->getName('organization' . $_SESSION['idCourse'], true);
             $saveObj->save($saveName, $this->treeView->getState());
             $folder = $this->repoDb->getFolderById($this->treeView->getSelectedFolderId());
             $lo = createLO($folder->otherValues[REPOFIELDOBJECTTYPE]);
             $lo->edit($folder->otherValues[REPOFIELDIDRESOURCE], 'index.php?modname=' . $modname . '&op=display&sor=' . $saveName . '&' . $this->treeView->_getOpEditLOEnd() . '=1');
             break;
         case 'playitem':
             global $modname;
             // save state
             require_once $GLOBALS['where_framework'] . '/lib/lib.sessionsave.php';
             $saveObj = new Session_Save();
             $saveName = $saveObj->getName('organization' . $_SESSION['idCourse'], true);
             $saveObj->save($saveName, $this->treeView->getState());
             $folder = $this->repoDb->getFolderById($this->treeView->getItemToPlay());
             $lo = createLO($folder->otherValues[REPOFIELDOBJECTTYPE]);
             $idItem = $folder->otherValues[REPOFIELDIDRESOURCE];
             $back_url = 'index.php?modname=' . $modname . '&op=organization&sor=' . $saveName . '&' . $this->treeView->_getOpPlayEnd() . '=' . $folder->id;
             $lo->play($idItem, $folder->otherValues[ORGFIELDIDPARAM], $back_url);
             break;
         case 'copyLOSel':
             $GLOBALS['page']->add($this->treeView->load());
             break;
         case 'copyLOEndOk':
         case 'copyLOEndCancel':
             global $modname;
             require_once $GLOBALS['where_framework'] . '/lib/lib.sessionsave.php';
             $saveObj = new Session_Save();
             $saveName = $_GET['crepo'];
             if ($saveObj->nameExists($saveName)) {
                 $saveData =& $saveObj->load($saveName);
                 $saveObj->delete($saveName);
                 Util::jump_to(' index.php?modname=' . $modname . '&op=' . $saveData['repo']);
             }
             Util::jump_to(' index.php?modname=' . $modname . '&op=display');
             break;
         case 'copyLO':
             global $modname;
             // save state
             require_once $GLOBALS['where_framework'] . '/lib/lib.sessionsave.php';
             $saveObj = new Session_Save();
             $saveName = $saveObj->getName('crepo', true);
             $folder = $this->treeView->tdb->getFolderById($this->treeView->selectedFolder);
             $saveData = array('repo' => 'organization', 'id' => $this->treeView->getSelectedFolderId(), 'objectType' => $folder->otherValues[REPOFIELDOBJECTTYPE], 'name' => $folder->otherValues[REPOFIELDTITLE], 'idResource' => $folder->otherValues[REPOFIELDIDRESOURCE]);
             $saveObj->save($saveName, $saveData);
             Util::jump_to(' index.php?modname=' . $modname . '&op=display&crepo=' . $saveName . '&' . $this->treeView->_getOpCopyLOSel() . '=1');
         case 'createLOEnd':
             // insertion managed by extendParsing
         // insertion managed by extendParsing
         case "display":
         case "organization":
         default:
             /*$GLOBALS['page']->addStart(
             			getTitleArea(def('_ORGANIZATION', 'organization', 'lms'), 'organization')
             			.'<div class="std_block">', 'content');
             		$GLOBALS['page']->addEnd('</div>', 'content');*/
             if (isset($_SESSION['last_error'])) {
                 if ($_SESSION['last_error'] != "") {
                     //$GLOBALS['page']->add( $_SESSION['last_error'], 'content' );
                     UIFeedback::error($_SESSION['last_error']);
                     unset($_SESSION['last_error']);
                 }
             }
             organization($this->treeView);
             break;
     }
 }
 /**
  * produces the form to load into modify dialog
  */
 public function modTask()
 {
     //check permissions
     if (!$this->permissions['mod']) {
         $output = array('success' => false, 'message' => $this->_getErrorMessage('no permission'));
         echo $this->json->encode($output);
         return;
     }
     $id_policy = Get::req('id', DOTY_INT, -1);
     if ($id_policy <= 0) {
         $output = array('success' => false, 'message' => UIFeedback::perror($this->_getErrorMessage("failure")));
         echo $this->json->encode($output);
         return;
     }
     //retrieve category info (name and translations
     $info = $this->model->getPolicyInfo($id_policy);
     $this->render('policy_editmask', array('id_policy' => $id_policy, 'name' => $info->name, 'translations' => $info->translations));
     $params = array('success' => true, 'header' => Lang::t('_MOD', 'standard'), 'body' => ob_get_clean());
     @ob_start();
     echo $this->json->encode($params);
 }
Esempio n. 18
0
 public function importTask()
 {
     $error = Get::req('error', DOTY_INT, 0);
     if ($error) {
         UIFeedback::error(Lang::t('_ERROR_UPLOAD', 'standard'));
     }
     $this->render('import_mask', array());
 }
Esempio n. 19
0
function repoMyDetails(&$url, $passed_repo = 0)
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('light_repo');
    $file_man = new LightRepoManager(getLogUserId(), $_SESSION['idCourse']);
    $acl_man =& Docebo::user()->getAclManager();
    $id_repo = importVar('id_repo', true, $passed_repo);
    // recovering file repository information
    $repo = $file_man->getRepoDetails($id_repo);
    $file_man->setUserLastEnterInRepo($id_repo);
    $of_user = getLogUserId();
    $page_title = array($url->getUrl() => $lang->def('_TITLE_LIGHT_REPO'), $repo[LR_TITLE]);
    $file_list = $file_man->getRepoFileListOfAuthor($id_repo, $of_user);
    cout(getTitleArea($page_title, 'light_repo') . '<div class="std_block" id="light_repo_block">', 'content');
    if (isset($_GET['result'])) {
        switch ($_GET['result']) {
            case "file_ok":
                UIFeedback::info(Lang::t('_OPERATION_SUCCESSFUL', 'light_repo'));
                break;
            case "file_err":
                UIFeedback::error(Lang::t('_FILE_ERR', 'light_repo'));
                break;
        }
    }
    $table = new Table(0, $lang->def('_CAPTION_USER_FILE_LIST'), $lang->def('_SUMMARY_USER_FILE_LIST'));
    $content_h = array($lang->def('_FILENAME'), $lang->def('_DESCRIPTION'), $lang->def('_DATE'), '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />');
    $type_h = array('', '', '', 'image', 'image');
    $table->addHead($content_h, $type_h);
    $url->addToStdQuery('id_repo=' . $id_repo);
    while ($file = sql_fetch_row($file_list)) {
        // convert filename
        $file[LR_FILE_NAME] = implode('_', array_slice(explode('_', $file[LR_FILE_NAME]), 3));
        $content = array();
        $content[] = '' . '<a href="' . $url->getUrl('op=download_file&id_repo=' . $id_repo . '&id_file=' . $file[LR_FILE_ID]) . '" title="' . $lang->def('_DOWNLOAD') . '' . strip_tags($file[LR_FILE_NAME]) . '">' . '<img src="' . getPathImage() . 'standard/download.png" alt="' . $lang->def('_DOWNLOAD') . '" /> ' . $file[LR_FILE_NAME] . '</a>';
        $content[] = $file[LR_FILE_DESCR];
        $content[] = Format::date($file[LR_FILE_POSTDATE], 'datetime');
        //$content[] = $file[LR_FILE_DESCR];
        $content[] = '' . '<a href="' . $url->getUrl('op=mod_file&id_repo=' . $id_repo . '&id_file=' . $file[LR_FILE_ID]) . '"' . ' title="' . $lang->def('_MOD') . '' . strip_tags($file[LR_FILE_NAME]) . '">' . '<img src="' . getPathImage('fw') . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . strip_tags($file[LR_FILE_NAME]) . '" />' . '</a>';
        $content[] = '' . '<a href="' . $url->getUrl('op=del_file&id_repo=' . $id_repo . '&id_file=' . $file[LR_FILE_ID]) . '"' . ' title="' . $lang->def('_DEL') . '' . strip_tags($file[LR_FILE_NAME]) . '">' . '<img src="' . getPathImage('fw') . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . strip_tags($file[LR_FILE_NAME]) . '" />' . '</a>';
        $table->addBody($content, false, false, 'file_container_' . $file[LR_FILE_ID]);
    }
    $table->addActionAdd('<a class="dd_link" href="' . $url->getUrl('op=mod_file&id_repo=' . $id_repo) . '" title="' . $lang->def('_ADD_FILE') . '">' . $lang->def('_UPLOAD') . '</a>');
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=del_file]');
    cout($table->getTable(), 'content');
    cout('</div>', 'content');
}
 public function del_course_competenceTask()
 {
     $id_course = Get::req('id_course', DOTY_INT, 0);
     $id_competence = Get::req('id_competence', DOTY_INT, 0);
     $output = array();
     if ($id_course <= 0 || $id_competence <= 0) {
         $message_text = $id_course <= 0 ? $this->_getErrorMessage("invalid course") : $this->_getErrorMessage("invalid competence");
         $output['success'] = false;
         $output['message'] = UIFeedback::perror($message_text);
     } else {
         $res = $this->model->deleteCourseCompetences((int) $id_course, (int) $id_competence);
         $output['success'] = $res ? true : false;
         if (!$res) {
             $output['message'] = UIFeedback::perror($this->_getErrorMessage("remove course competence"));
         }
     }
     echo $this->json->encode($output);
 }
Esempio n. 21
0
        $msg .= $br_char . "----------------------------------" . $br_char;
        /** Getting client info */
        $result = parse_user_agent();
        $msg .= $br_char . "---------- CLIENT INFO -----------" . $br_char;
        $msg .= "IP: " . $_SERVER['REMOTE_ADDR'] . $br_char;
        $msg .= "USER AGENT: " . $_SERVER['HTTP_USER_AGENT'] . $br_char;
        $msg .= "OS: " . $result['platform'] . $br_char;
        $msg .= "BROWSER: " . $result['browser'] . " " . $result['version'] . $br_char;
        $msg .= "RESOLUTION: " . Get::req("help_req_resolution", DOTY_STRING, "") . $br_char;
        $msg .= "FLASH: " . Get::req("help_req_flash_installed", DOTY_STRING, "") . $br_char;
        $mailer = new DoceboMailer();
        $mailer->IsHTML(true);
        $res = $mailer->SendMail($user_email, $help_email, $subject, $msg);
        $output = array('success' => $res);
        if (!$res) {
            $output['message'] = UIFeedback::perror(Lang::t('_OPERATION_FAILURE', 'menu'));
        }
        $json = new Services_JSON();
        aout($json->encode($output));
        break;
    default:
        break;
}
/**
 * Parses a user agent string into its important parts
 *
 * @author Jesse G. Donat <*****@*****.**>
 * @link https://github.com/donatj/PhpUserAgent
 * @link http://donatstudios.com/PHP-Parser-HTTP_USER_AGENT
 * @param string|null $u_agent User agent string to parse or null. Uses $_SERVER['HTTP_USER_AGENT'] on NULL
 * @return array an array with browser, version and platform keys
 public function showTask()
 {
     $model = new ElearningLms();
     if (Get::sett('on_usercourse_empty') === 'on') {
         $conditions_t = array('cu.iduser = :id_user');
         $params_t = array(':id_user' => (int) Docebo::user()->getId());
         $cp_courses = $model->getUserCoursePathCourses(Docebo::user()->getIdst());
         if (!empty($cp_courses)) {
             $conditions_t[] = "cu.idCourse NOT IN (" . implode(",", $cp_courses) . ")";
         }
         $courselist_t = $model->findAll($conditions_t, $params_t);
         if (empty($courselist_t)) {
             Util::jump_to('index.php?r=lms/catalog/show&sop=unregistercourse');
         }
     }
     require_once _lms_ . '/lib/lib.middlearea.php';
     $ma = new Man_MiddleArea();
     $block_list = array();
     //if($ma->currentCanAccessObj('user_details_short')) $block_list['user_details_short'] = true;
     if ($ma->currentCanAccessObj('user_details_full')) {
         $block_list['user_details_full'] = true;
     }
     if ($ma->currentCanAccessObj('credits')) {
         $block_list['credits'] = true;
     }
     if ($ma->currentCanAccessObj('news')) {
         $block_list['news'] = true;
     }
     $tb_label = $ma->currentCanAccessObj('tb_label');
     if (!$tb_label) {
         $_SESSION['id_common_label'] = 0;
     } else {
         $id_common_label = Get::req('id_common_label', DOTY_INT, -1);
         if ($id_common_label >= 0) {
             $_SESSION['id_common_label'] = $id_common_label;
         } elseif ($id_common_label == -2) {
             $_SESSION['id_common_label'] = -1;
         }
         $block_list['labels'] = true;
     }
     if ($tb_label && $_SESSION['id_common_label'] == -1) {
         require_once _lms_ . '/admin/models/LabelAlms.php';
         $label_model = new LabelAlms();
         $user_label = $label_model->getLabelForUser(Docebo::user()->getId());
         $this->render('_labels', array('block_list' => $block_list, 'label' => $user_label));
     } else {
         if (!empty($block_list)) {
             $this->render('_tabs_block', array('block_list' => $block_list));
         } else {
             $this->render('_tabs', array());
         }
     }
     // add feedback:
     // - feedback_type: [err|inf] display error feedback or info feedback
     // - feedback_code: translation code of message
     // - feedback_extra: extrainfo concat at end message
     $feedback_code = Get::req('feedback_code', DOTY_STRING, "");
     $feedback_type = Get::req('feedback_type', DOTY_STRING, "");
     $feedback_extra = Get::req('feedback_extra', DOTY_STRING, "");
     switch ($feedback_type) {
         case "err":
             $msg = Lang::t($feedback_code, 'login') . " " . $feedback_extra;
             UIFeedback::error($msg);
             break;
         case "inf":
             $msg = Lang::t($feedback_code, 'login') . " " . $feedback_extra;
             UIFeedback::info($msg);
             break;
     }
 }
 public function man_competencesTask()
 {
     $back_url = 'index.php?r=adm/functionalroles/show';
     $id_fncrole = Get::req('id', DOTY_INT, -1);
     if ($id_fncrole <= 0) {
         $this->render('invalid', array('message' => $this->_getErrorMessage('invalid fncrole'), 'back_url' => $back_url));
         return;
     }
     $title_arr = array($back_url => Lang::t('_FUNCTIONAL_ROLE', 'fncroles'), Lang::t('_COMPETENCES', 'fncroles') . ': ' . $this->model->getFunctionalRoleName($id_fncrole));
     $result = Get::req('res', DOTY_ALPHANUM, '');
     $result_message = "";
     switch ($result) {
         case "ok_competences":
             $result_message = UIFeedback::info(Lang::t('_OPERATION_SUCCESSFUL', 'fncroles'), true);
             break;
         case "err_competences":
             $result_message = UIFeedback::error(Lang::t('_OPERATION_FAILURE', 'fncroles'), true);
             break;
     }
     $this->render('show_competences', array('id_fncrole' => $id_fncrole, 'title_arr' => $title_arr, 'filter_text' => "", 'result_message' => $result_message, 'count' => $this->model->getManageCompetencesTotal($id_fncrole, false), 'permissions' => $this->permissions));
 }
Esempio n. 24
0
/**
 * @param string $message the information message
 *
 * @return string 	the code for a graceful information user interface
 */
function getInfoUi($message, $return = false)
{
    return UIFeedback::info($message, $return);
    return '<p class="information_container">' . '<strong>' . $message . '</strong>' . '</p>';
}
Esempio n. 25
0
function intro($object_test, $id_param)
{
    if (!checkPerm('view', true, 'organization') && !checkPerm('view', true, 'storage')) {
        die("You can't access");
    }
    require_once _base_ . '/lib/lib.form.php';
    require_once $GLOBALS['where_lms'] . '/class.module/track.test.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.param.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.test.php';
    $lang =& DoceboLanguage::createInstance('test');
    $id_test = $object_test->getId();
    $id_reference = getLoParam($id_param, 'idReference');
    $url_coded = urlencode(serialize($object_test->back_url));
    $id_track = retriveTrack($id_reference, $id_test, Docebo::user()->getIdst());
    if ($id_track === false) {
        $GLOBALS['page']->add(getErrorUi($lang->def('_TEST_TRACK_FAILURE') . getBackUi(Util::str_replace_once('&', '&amp;', $object_test->back_url), $lang->def('_BACK'))), 'content');
    }
    $track_info = Track_Test::getTrackInfoById($id_track);
    $test_man = new TestManagement($id_test);
    $play_man = new PlayTestManagement($id_test, Docebo::user()->getIdst(), $id_track, $test_man);
    $test_info = $test_man->getTestAllInfo();
    $prerequisite = $test_man->getPrerequisite();
    $group_test_man = new GroupTestManagement();
    $tests_score =& $group_test_man->getTestsScores(array($id_test), array(Docebo::user()->getIdst()));
    if ($test_info['time_dependent'] && $test_info['time_assigned']) {
        $minute_assigned = (int) ($test_info['time_assigned'] / 60);
        $second_assigned = (int) ($test_info['time_assigned'] % 60);
        if (strlen($second_assigned) == 1) {
            $second_assigned = '0' . $second_assigned;
        }
        $time_readable = str_replace('[time_assigned]', $minute_assigned . ':' . $second_assigned . '', $lang->def('_TEST_TIME_ASSIGNED'));
        $time_readable = str_replace('[second_assigned]', '' . $second_assigned, str_replace('[minute_assigned]', '' . $minute_assigned, $time_readable));
    }
    $page_title = array(Util::str_replace_once('&', '&amp;', $object_test->back_url) => $lang->def('_TITLE'), $test_info['title']);
    $GLOBALS['page']->add(getTitleArea($page_title, 'test', $lang->def('_TEST_INFO')) . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&amp;', $object_test->back_url), $lang->def('_BACK')) . '<span class="text_bold">' . $lang->def('_TITLE') . ' : </span>' . $test_info['title'] . '<br /><br />' . ($test_info['description'] != '' ? '<span class="text_bold">' . $lang->def('_DESCRIPTION') . ' : </span>' . $test_info['description'] . '<br /><br />' : '') . (isset($track_info['score']) && $track_info['score'] >= $test_info['point_required'] ? '<span class="text_bold">' . str_replace('[score]', $track_info['score'], $lang->def('_RESTART_INFO')) . '</span><br /><br />' : ''), 'content');
    if ($test_info['hide_info'] == 0) {
        $GLOBALS['page']->add('<span class="text_bold">' . $lang->def('_TEST_INFO') . ' : </span><br />' . '<ul class="test_info_list">', 'content');
        if ($test_info['order_type'] != 2) {
            $GLOBALS['page']->add('<li>' . str_replace('[max_score]', '' . ($test_info['point_type'] != 1 ? $test_man->getMaxScore() : 100), $lang->def('_TEST_MAXSCORE')) . '</li>', 'content');
        }
        $GLOBALS['page']->add('<li>' . str_replace('[question_number]', '' . $test_man->getNumberOfQuestion(), $lang->def('_TEST_QUESTION_NUMBER')) . '</li>', 'content');
        if ($test_info['point_required'] != 0) {
            $GLOBALS['page']->add('<li>' . str_replace('[score_req]', '' . $test_info['point_required'], $lang->def('_TEST_REQUIREDSCORE')) . '</li>', 'content');
        }
        $GLOBALS['page']->add('<li>' . ($test_info['save_keep'] ? $lang->def('_TEST_SAVEKEEP') : $lang->def('_TEST_SAVEKEEP_NO')) . '</li>' . '<li>' . ($test_info['mod_doanswer'] ? $lang->def('_TEST_MOD_DOANSWER') : $lang->def('_TEST_MOD_DOANSWER_NO')) . '</li>' . '<li>' . ($test_info['can_travel'] ? $lang->def('_TEST_CAN_TRAVEL') : $lang->def('_TEST_CAN_TRAVEL_NO')) . '</li>' . '<li>' . ($test_info['show_score'] || $test_info['show_score_cat'] ? $lang->def('_TEST_SHOW_SCORE') : $lang->def('_TEST_SHOW_SCORE_NO')) . '</li>' . '<li>' . ($test_info['show_solution'] ? $lang->def('_TEST_SHOW_SOLUTION') : $lang->def('_TEST_SHOW_SOLUTION_NO')) . '</li>' . '<li>', 'content');
        switch ($test_info['time_dependent']) {
            case 0:
                $GLOBALS['page']->add($lang->def('_TEST_TIME_ASSIGNED_NO'), 'content');
                break;
            case 1:
                $GLOBALS['page']->add($time_readable, 'content');
                break;
            case 2:
                $GLOBALS['page']->add($lang->def('_TEST_TIME_ASSIGNED_QUEST'), 'content');
                break;
        }
        if ($test_info['max_attempt'] > 0) {
            $GLOBALS['page']->add('<li>' . str_replace('[remaining_attempt]', $test_info['max_attempt'] - $track_info['number_of_attempt'], Lang::t('_NUMBER_OF_ATTEMPT', 'test')) . '</li>', 'content');
        }
        $GLOBALS['page']->add('</ul>' . '<br />', 'content');
    }
    if ($tests_score[$id_test][Docebo::user()->getIdst()]['comment'] !== '') {
        $GLOBALS['page']->add('<span class="text_bold">' . $lang->def('_COMMENTS') . ' : </span>' . $tests_score[$id_test][Docebo::user()->getIdst()]['comment'] . '<br /><br />', 'content');
    }
    // Actions
    $score_status = $play_man->getScoreStatus();
    $show_result = $test_info['show_score'] || $test_info['show_score_cat'] || $test_info['show_solution'];
    $is_end = $score_status == 'valid' || $score_status == 'not_checked' || $score_status == 'passed' || $score_status == 'not_passed';
    $GLOBALS['page']->add(Form::openForm('test_intro', 'index.php?modname=test&amp;op=play') . Form::getHidden('id_test', 'id_test', $id_test) . Form::getHidden('id_param', 'id_param', $id_param) . Form::getHidden('idTrack', 'idTrack', $id_track) . Form::getHidden('back_url', 'back_url', $url_coded) . Form::getHidden('next_step', 'next_step', 'play'), 'content');
    if ($test_info['max_attempt'] > 0) {
        if ($test_info['max_attempt'] - $track_info['number_of_attempt'] <= 0) {
            //$GLOBALS['page']->add($lang->def('_MAX_ATTEMPT_REACH'), 'content');
            $GLOBALS['page']->add(Lang::t('_MAX_ATTEMPT_REACH', 'test'), 'content');
            if ($show_result) {
                $GLOBALS['page']->add('<div class="align_right">' . Form::getHidden('show_result', 'show_result', 1) . Form::getButton('show_review', 'show_review', $lang->def('_TEST_SHOW_REVIEW')) . '</div>', 'content');
            }
            $GLOBALS['page']->add(Form::closeForm() . '</div>', 'content');
            return;
        }
        if ($is_end && $track_info['score'] >= $test_info['point_required']) {
            $GLOBALS['page']->add($lang->def('_YOU_HAVE_PASS_THIS_TEST'), 'content');
            if ($show_result) {
                $GLOBALS['page']->add('<div class="align_right">' . Form::getHidden('show_result', 'show_result', 1) . Form::getButton('show_review', 'show_review', $lang->def('_TEST_SHOW_REVIEW')) . '</div>', 'content');
            }
            $GLOBALS['page']->add(Form::closeForm() . '</div>', 'content');
            return;
        }
    }
    //--- check for suspension condition -------------------------------------------
    if ($test_info['use_suspension']) {
        $attempts_until_now = $track_info['attempts_for_suspension'];
        $last_suspension_date = $track_info['suspended_until'];
        if ($last_suspension_date == "") {
            $last_suspension_date = '0000-00-00 00:00:00';
        }
        $now = date("Y-m-d H:i:s");
        //check remaining attempts
        $diff_attempts = $test_info['suspension_num_attempts'] - $attempts_until_now;
        if ($diff_attempts > 0 && ($last_suspension_date < $now || $test_info['suspension_num_hours'] <= 0)) {
            //warning: $diff_attempts remaining before suspesion
            cout(UIFeedback::pnotice($lang->def('_ATTEMPTS_REMAINING_BEFORE_SUSPENSION') . ' : ' . $diff_attempts) . '<br /><br />', 'content');
        } else {
            if ($test_info['suspension_num_hours'] <= 0) {
                cout(UIFeedback::pnotice($lang->def('_TEST_SUSPENDED')) . '<br /><br />', 'content');
                cout(Form::closeForm() . '</div>', 'content');
                return;
            } else {
                //check if last suspension date is prior to now
                if ($last_suspension_date > $now) {
                    //user is suspended for this test until "last_suspension_date"
                    cout(UIFeedback::pnotice($lang->def('_TEST_SUSPENDED_UNTIL') . ' : ' . Format::date($last_suspension_date, "datetime")) . '<br /><br />', 'content');
                    cout(Form::closeForm() . '</div>', 'content');
                    return;
                } else {
                    //we shouldn't get here, except if test options about suspension have been modified
                    //in a second time: in this case update test track data and go on
                    $suspend_info = array('attempts_for_suspension' => 0);
                    $re = Track_Test::updateTrack($id_track, $suspend_info);
                    $diff_attempts = $test_info['suspension_num_attempts'];
                    cout(UIFeedback::pnotice($lang->def('_ATTEMPTS_REMAINING_BEFORE_SUSPENSION') . ' : ' . $diff_attempts) . '<br /><br />', 'content');
                }
            }
        }
        //check if the user should re-play LO in prerequisites
        if ($test_info['suspension_prerequisites']) {
            if ($prerequisite != "") {
                //check all prerequisites conditions
                $query = "SELECT idOrg FROM " . $GLOBALS['prefix_lms'] . "_organization WHERE objectType='test' AND idResource=" . (int) $test_info['idTest'];
                list($idOrg) = sql_fetch_row(sql_query($query));
                $conditions = explode(",", $prerequisite);
                $req_arr = array();
                foreach ($conditions as $condition) {
                    if (is_numeric($condition) && (int) $condition != $idOrg) {
                        $req_arr[] = $condition;
                    }
                }
                if (count($req_arr) > 0) {
                    $query = "SELECT * FROM " . $GLOBALS['prefix_lms'] . "_commontrack WHERE idReference IN (" . implode(",", $req_arr) . ") " . " AND dateAttempt>'" . $last_suspension_date . "' AND status IN ('completed','passed')";
                    $res = sql_query($query);
                    if (sql_num_rows($res) < count($req_arr)) {
                        cout(UIFeedback::pnotice($lang->def('_UNREACHED_PREREQUISITES')) . '<br /><br />', 'content');
                        cout(Form::closeForm() . '</div>', 'content');
                        return;
                    }
                }
            }
        }
    }
    //--- end suspension check -----------------------------------------------------
    if ($score_status == 'passed') {
        $incomplete = FALSE;
    } elseif ($score_status == 'valid') {
        $track_info = $play_man->getTrackAllInfo();
        if ($track_info['score'] >= $test_info['point_required']) {
            $incomplete = FALSE;
        } else {
            $incomplete = TRUE;
        }
    } else {
        $incomplete = TRUE;
    }
    if ($score_status == 'not_complete') {
        $GLOBALS['page']->add(Form::getHidden('page_continue', 'page_continue', $play_man->getLastPageSeen()), 'content');
    }
    if ($is_end) {
        $GLOBALS['page']->add(Form::getHidden('show_result', 'show_result', 1), 'content');
    }
    if ($test_info['save_keep'] && $score_status == 'not_complete') {
        $GLOBALS['page']->add('<span class="text_bold">' . $lang->def('_TEST_SAVED') . '</span><br /><br />', 'content');
    }
    $GLOBALS['page']->add('<div class="align_right">', 'content');
    if ($is_end && $show_result) {
        $GLOBALS['page']->add(Form::getButton('show_review', 'show_review', $lang->def('_TEST_SHOW_REVIEW')), 'content');
    } elseif ($test_info['save_keep'] && $score_status == 'not_complete') {
        $GLOBALS['page']->add(Form::getButton('continue', 'continue', $lang->def('_TEST_CONTINUE')), 'content');
    }
    if ($score_status == 'not_complete') {
        $GLOBALS['page']->add(Form::getButton('restart', 'restart', $lang->def('_TEST_BEGIN')), 'content');
    } elseif ($is_end) {
        if ($_SESSION['levelCourse'] > '3') {
            $GLOBALS['page']->add(Form::getButton('restart', 'restart', $lang->def('_TEST_RESTART')), 'content');
        } elseif (str_replace('incomplete', '', $prerequisite) !== $prerequisite) {
            $incomplete ? $GLOBALS['page']->add(Form::getButton('restart', 'restart', $lang->def('_TEST_RESTART')), 'content') : $GLOBALS['page']->add($lang->def('_TEST_COMPLETED'), 'content');
        } elseif (str_replace('NULL', '', $prerequisite) !== $prerequisite) {
            $score_status !== 'valid' && $score_status !== 'passed' ? $GLOBALS['page']->add(Form::getButton('restart', 'restart', $lang->def('_TEST_RESTART')), 'content') : $GLOBALS['page']->add($lang->def('_TEST_COMPLETED'), 'content');
        } else {
            $GLOBALS['page']->add(Form::getButton('restart', 'restart', $lang->def('_TEST_RESTART')), 'content');
        }
    } else {
        resetTrack($id_test, $id_track);
        $GLOBALS['page']->add(Form::getButton('begin', 'begin', $lang->def('_TEST_BEGIN')), 'content');
    }
    $GLOBALS['page']->add('</div>' . Form::closeForm() . '</div>', 'content');
}
 public function move_categoryTask()
 {
     //check permissions
     if (!$this->permissions['mod']) {
         $output = array('success' => false, 'message' => $this->_getMessage('no permission'));
         echo $this->json->encode($output);
         return;
     }
     $src = Get::req('src', DOTY_INT, -1);
     $dest = Get::req('dest', DOTY_INT, -1);
     $output = array();
     if ($src <= 0 || $dest < 0) {
         $output['success'] = false;
         $output['message'] = UIFeedback::perror($this->_getMessage("invalid category"));
         echo $this->json->encode($output);
         return;
     }
     $res = $this->model->moveCategory($src, $dest);
     $output['success'] = $res ? true : false;
     if (!$res) {
         $output['message'] = UIFeedback::perror($this->_getMessage("move category"));
     }
     echo $this->json->encode($output);
 }
Esempio n. 27
0
function socialConnectLogin($uid = false, $network_code = false)
{
    require_once _base_ . '/lib/lib.usermanager.php';
    $res = '';
    $lang = DoceboLanguage::createInstance('login');
    $user_manager = new UserManager();
    if (!empty($uid) && !empty($network_code)) {
        session_regenerate_id();
        $_SESSION['connect_social']['uid'] = $uid;
        $_SESSION['connect_social']['network_code'] = $network_code;
    }
    $can_connect = false;
    if (isset($_SESSION['connect_social']) && isset($_SESSION['connect_social']['uid']) && !empty($_SESSION['connect_social']['uid'])) {
        // read data from session, in case we are on the second step (login attempt)
        $uid = $_SESSION['connect_social']['uid'];
        $network_code = $_SESSION['connect_social']['network_code'];
        $can_connect = true;
    }
    // check form submission:
    if (isset($_POST['undo'])) {
        // go back to index
        Util::jump_to('index.php');
    } else {
        if (isset($_POST['login']) && !$can_connect) {
            // we don't have the social uid to be connected with user account..
            Util::jump_to('index.php?modname=login&amp;op=social_connect_login&amp;err=2');
        } else {
            if (isset($_POST['login'])) {
                // login and connect account
                $user = DoceboUser::createDoceboUserFromLogin(Get::pReq('login_userid', DOTY_STRING), Get::pReq('login_pwd', DOTY_STRING), 'public_area');
                if ($user) {
                    DoceboUser::setupUser($user);
                    $social = new Social();
                    $social->connectAccount($network_code, $uid);
                    unset($_SESSION['connect_social']);
                    Util::jump_to('index.php?r=lms/elearning/show');
                } else {
                    Util::jump_to('index.php?modname=login&amp;op=social_connect_login&amp;err=1');
                }
            }
        }
    }
    switch (Get::gReq('err', DOTY_INT, 0)) {
        case 1:
            $res .= UIFeedback::error(Lang::t('_NOACCESS', 'login'), true);
            break;
        case 2:
            $res .= UIFeedback::error(Lang::t('_NO_SOCIAL_ACCOUNT_TO_CONNECT', 'login') . '&nbsp;<a href="index.php">' . Lang::t('_TRY_AGAIN', 'login') . '</a>', true);
            break;
    }
    $GLOBALS['page']->add(getTitleArea($lang->def('_LOGIN'), 'login') . '<div class="std_block">' . getBackUi('index.php', $lang->def('_BACK')), 'content');
    if ($can_connect) {
        $res .= Get::img('social/' . $network_code . '-24.png') . '&nbsp;';
        $res .= str_replace('[network_code]', Lang::t($network_code, 'social'), Lang::t('_YOU_ARE_CONNECTING_SOCIAL_ACCOUNT', 'social')) . " <b>" . $uid . "</b>";
    }
    $res .= Form::openForm('scl_form', 'index.php?modname=login&amp;op=social_connect_login') . Form::openElementSpace() . Form::getTextfield(Lang::t('_USERNAME', 'login'), 'login_userid', 'login_userid', 255) . Form::getPassword(Lang::t('_PASSWORD', 'login'), 'login_pwd', 'login_pwd', 255) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('login', 'login', Lang::t('_LOGIN', 'login')) . Form::getButton('undo', 'undo', Lang::t('_UNDO', 'login')) . Form::closeButtonSpace() . Form::closeForm();
    $GLOBALS['page']->add($res, 'content');
    // std_block
    $GLOBALS['page']->add('</div>', 'content');
    // std_block
}
 public function show_user_objectTask()
 {
     $id_course = isset($_SESSION['idCourse']) && $_SESSION['idCourse'] > 0 ? $_SESSION['idCourse'] : false;
     if ((int) $id_course <= 0) {
         //...
         return;
     }
     $id_user = Get::req('id_user', DOTY_INT, -1);
     if ($id_user <= 0) {
         //...
         return;
     }
     $id_lo = Get::req('id_lo', DOTY_INT, -1);
     if ($id_lo <= 0) {
         //...
         return;
     }
     $result_message = "";
     $res = Get::req('res', DOTY_STRING, "");
     switch ($res) {
         case 'ok_reset':
             $result_message = UIFeedback::info($this->_getErrorMessage('reset success'));
             break;
         case 'err_reset':
             $result_message = UIFeedback::error($this->_getErrorMessage('reset error'));
             break;
     }
     $acl_man = Docebo::user()->getACLManager();
     $user_info = $acl_man->getUser($id_user, false);
     $lo_info = $this->model->getLOInfo($id_lo);
     $course_info = $this->model->getUserCourseInfo($id_course, $id_user);
     $track_info = $this->model->getUserTrackInfo($id_user, $id_lo);
     $smodel = new SubscriptionAlms();
     $arr_statust = $smodel->getUserStatusList();
     $info = new stdClass();
     $info->userid = $acl_man->relativeId($user_info[ACL_INFO_USERID]);
     $info->firstname = $user_info[ACL_INFO_FIRSTNAME];
     $info->lastname = $user_info[ACL_INFO_LASTNAME];
     $info->course_status = isset($arr_status[$course_info->status]) ? $arr_status[$course_info->status] : "";
     $info->course_first_access = $course_info->date_first_access != "" ? Format::date($course_info->date_first_access, 'datetime') : Lang::t('_NEVER', '');
     $info->course_last_access = '';
     $info->course_date_complete = $course_info->date_complete != "" ? Format::date($course_info->date_complete, 'datetime') : Lang::t('_NONE', '');
     $tracked = is_object($track_info);
     $never = Lang::t('_NEVER', 'standard');
     $info->LO_name = $lo_info->title;
     $info->LO_type = $lo_info->objectType;
     $info->status = $tracked ? $track_info->status : "not attempted";
     $info->score = '-';
     //$track_info->score.' / '.$track_info->max_score;
     $info->first_access = $tracked ? Format::date($track_info->first_access, 'datetime') : $never;
     $info->last_access = $tracked ? Format::date($track_info->last_access, 'datetime') : $never;
     $info->first_complete = $tracked ? Format::date($track_info->first_complete, 'datetime') : $never;
     $info->last_complete = $tracked ? Format::date($track_info->last_complete, 'datetime') : $never;
     $id_track = $this->model->getTrackId($id_lo, $id_user);
     $params = array('id_course' => $id_course, 'id_user' => $id_user, 'id_lo' => $id_lo, 'result_message' => $result_message, 'from_user' => Get::req('from_user', DOTY_INT, 0) > 0, 'tracked' => $tracked, 'info' => $info, 'object_lo' => $this->model->getLOTrackObject($id_track, $lo_info->objectType), 'permissions' => $this->permissions);
     $this->render('show_user_object', $params);
 }
Esempio n. 29
0
 protected function update()
 {
     if (!$this->permissions['mod']) {
         $this->render('invalid', array('message' => $this->_getMessage('no permission'), 'back_url' => 'index.php?r=alms/games/show'));
         return;
     }
     $data = array();
     $data['id_game'] = Get::req('id_game', DOTY_MIXED, '');
     $data['title'] = Get::req('title', DOTY_MIXED, '');
     $data['start_date'] = Get::req('start_date', DOTY_MIXED, Format::date(date('Y-m-d'), 'date'));
     $data['end_date'] = Get::req('end_date', DOTY_MIXED, Format::date(date('Y-m-d'), 'date'));
     $data['play_chance'] = Get::req('play_chance', DOTY_STRING, '');
     $data['description'] = Get::req('description', DOTY_MIXED, '');
     $data['type_of'] = Get::req('type_of', DOTY_STRING, '');
     $data['start_date'] = Format::dateDb($data['start_date'], 'date');
     $data['end_date'] = Format::dateDb($data['end_date'], 'date');
     $id_game = $this->model->save($data);
     if (!$id_game) {
         UIFeedback::error(Lang::t('_OPERATION_FAILURE', 'games'));
         $this->add($data);
     } elseif ($data['type_of'] != 'none') {
         Util::jump_to('index.php?r=alms/games/mod_obj&id_game=' . $id_game);
     } else {
         Util::jump_to('index.php?r=alms/games/show&success=1');
     }
 }
 public function multimod_coursepath()
 {
     $id_path = Get::req('id_path', DOTY_INT, 0);
     if ($id_path <= 0) {
         //...
         return;
     }
     $output = array();
     $users = Get::req('users', DOTY_STRING, '');
     if ($users == '') {
         $output['success'] = false;
         $output['message'] = Lang::t('_NO_USER_SELECTED', 'subscribe');
     } else {
         $set_date_begin = Get::req('multimod_date_begin_set', DOTY_INT, 0);
         $set_date_expire = Get::req('multimod_date_expire_set', DOTY_INT, 0);
         if ($set_date_begin <= 0 && $set_date_expire <= 0) {
             $output['success'] = false;
             $output['message'] = UIFeedback::info($this->_getMessage('no options selected'), true);
         } else {
             $users_list = explode(',', $users);
             require_once _lms_ . '/lib/lib.coursepath.php';
             $sman = new CoursePath_Manager();
             $res1 = true;
             if ($set_date_begin > 0) {
                 $new_date_begin = Get::req('multimod_date_begin', DOTY_STRING, "");
                 $res3 = $sman->updateUserDateBeginValidityInCourse($users_list, $id_path, Format::dateDb($new_date_begin, 'date'));
             }
             $res2 = true;
             if ($set_date_expire > 0) {
                 $new_date_expire = Get::req('multimod_date_expire', DOTY_STRING, "");
                 $res4 = $sman->updateUserDateExpireValidityInCourse($users_list, $id_path, Format::dateDb($new_date_expire, 'date'));
             }
             $success = $res1 && $res2;
             $output['success'] = $success;
             if (!$success) {
                 $message = "";
                 if (!$res1) {
                     $message .= 'Unable to change date begin;';
                 }
                 //TO DO: make translation
                 if (!$res2) {
                     $message .= 'Unable to change date expire;';
                 }
                 //TO DO: make translation
                 $output['message'] = $message;
             }
         }
     }
     echo $this->json->encode($output);
 }