Example #1
0
function getprofile($id_user)
{
    require_once _base_ . '/lib/lib.form.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
    $acl_man =& Docebo::user()->getAClManager();
    $lang =& DoceboLanguage::createInstance('profile', 'framework');
    $user_info = $acl_man->getUser($id_user, false);
    $txt = '<div>';
    $txt .= '<div class="boxinfo_title">' . $lang->def('_USERPARAM') . '</div>' . Form::getLineBox($lang->def('_USERNAME'), $acl_man->relativeId($user_info[ACL_INFO_USERID])) . Form::getLineBox($lang->def('_LASTNAME'), $user_info[ACL_INFO_LASTNAME]) . Form::getLineBox($lang->def('_NAME'), $user_info[ACL_INFO_FIRSTNAME]) . Form::getLineBox($lang->def('_EMAIL'), $user_info[ACL_INFO_EMAIL]) . Form::getBreakRow() . '<div class="boxinfo_title">' . $lang->def('_USERFORUMPARAM') . '</div>' . '<table class="profile_images">' . '<tr><td>';
    // NOTE: avatar
    if ($user_info[ACL_INFO_AVATAR] != "") {
        $img_size = getimagesize($path . $user_info[ACL_INFO_AVATAR]);
        $txt .= '<img class="profile_image' . ($img_size[0] > 150 || $img_size[1] > 150 ? ' image_limit' : '') . '" src="' . $path . $user_info[ACL_INFO_AVATAR] . '" alt="' . $lang->def('_AVATAR') . '" /><br />';
    } else {
        $txt .= '<div class="text_italic">' . $lang->def('_NOAVATAR', 'profile') . '</div>';
    }
    // NOTE: signature
    $txt .= '</td></tr></table>' . '<div class="title">' . $lang->def('_SIGNATURE') . '</div>' . '<div class="profile_signature">' . $user_info[ACL_INFO_SIGNATURE] . '</div><br />' . "\n";
    $txt .= '</div>';
    return $txt;
}
 /**
  * function create()
  *
  * @param $back_url	the url where the function retutn at the end of the operation
  * @return nothing
  */
 function create($id_poll, $back_poll)
 {
     $lang =& DoceboLanguage::createInstance('poll');
     require_once _base_ . '/lib/lib.form.php';
     $url_encode = htmlentities(urlencode($back_poll));
     if (isset($_POST['add_question'])) {
         if (!sql_query("\r\n\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_pollquest \r\n\t\t\t( id_poll, id_category, type_quest, title_quest, sequence, page ) VALUES \r\n\t\t\t( \t'" . $id_poll . "',\r\n\t\t\t\t'" . '' . "',\r\n\t\t\t\t'" . $this->getQuestionType() . "', \r\n\t\t\t\t'" . $_POST['title_quest'] . "', \r\n\t\t\t\t'" . $this->_getNextSequence($id_poll) . "', \r\n\t\t\t\t'" . $this->_getPageNumber($id_poll) . "') ")) {
             errorCommunication($lang->def('_OPERATION_FAILURE') . getBackUi('index.php?modname=question_poll&amp;op=create&amp;type_quest=' . $this->getQuestionType() . '&amp;id_poll=' . $id_poll . '&amp;back_poll=' . $url_encode, $lang->def('_BACK')));
         }
         list($id_poll) = sql_fetch_row(sql_query("SELECT LAST_INSERT_ID()"));
         if (!sql_query("\r\n\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_pollquestanswer \r\n\t\t\t( id_quest, score_correct, is_correct ) VALUES \r\n\t\t\t( \t'" . $id_poll . "', \r\n\t\t\t\t'" . $this->_checkScore($_POST['max_score']) . "',\r\n\t\t\t\t'1') ")) {
             errorCommunication($lang->def('_OPERATION_FAILURE') . getBackUi('index.php?modname=question_pool&amp;op=create&amp;type_quest=' . $this->getQuestionType() . '&amp;id_poll=' . $id_poll . '&amp;back_poll=' . $url_encode, $lang->def('_BACK')));
         }
         Util::jump_to('' . $back_poll);
     }
     //finding categories
     require_once $GLOBALS['where_lms'] . '/lib/lib.questcategory.php';
     $categories = Questcategory::getCategory();
     //create array of difficult
     $arr_dufficult = array(5 => '5 - ' . $lang->def('_VERY_HARD'), 4 => '4 - ' . $lang->def('_HARD'), 3 => '3 - ' . $lang->def('_DIFFICULT_MEDIUM'), 2 => '2 - ' . $lang->def('_DIFFICULT_EASY'), 1 => '1 - ' . $lang->def('_DIFFICULT_VERYEASY'));
     $GLOBALS['page']->add(getTitleArea($lang->def('_POLL_SECTION'), 'poll') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&amp;', $back_poll), $lang->def('_BACK')) . '<div class="title_big">' . $lang->def('_QUEST_ACRN_' . strtoupper($this->getQuestionType())) . ' - ' . $lang->def('_QUEST_' . strtoupper($this->getQuestionType())) . '</div><br />' . Form::openForm('form_add_quest', 'index.php?modname=question_poll&amp;op=create') . Form::openElementSpace() . Form::getHidden('type_quest', 'type_quest', $this->getQuestionType()) . Form::getHidden('id_poll', 'id_poll', $id_poll) . Form::getHidden('back_poll', 'back_poll', $url_encode) . Form::getTextarea($lang->def('_POLL_QUEST_TITLE'), 'title_quest', 'title_quest') . Form::getBreakRow() . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('add_question', 'add_question', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
 }
 function get_rows_filter()
 {
     $back_url = $this->back_url;
     $jump_url = $this->jump_url;
     $next_url = $this->next_url;
     require_once _base_ . '/lib/lib.form.php';
     require_once $GLOBALS['where_framework'] . '/lib/lib.directory.php';
     require_once _base_ . '/lib/lib.userselector.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.course_managment.php';
     $lang =& DoceboLanguage::createInstance('report', 'framework');
     //update session
     $ref =& $_SESSION['report_tempdata'];
     if (!isset($ref['rows_filter'])) {
         $ref['rows_filter'] = array('select_all' => false, 'selection_type' => 'users', 'selection' => array());
     } else {
         //already resolved in switch block
     }
     $step = Get::req('step', DOTY_ALPHANUM, 'sel_type');
     switch ($step) {
         case 'sel_type':
             $values = array('users' => $this->lang->def('_USERS'), 'groups' => $this->lang->def('_GROUPS'));
             $sel_val = isset($ref['rows_filter']['selection_type']) ? $ref['rows_filter']['selection_type'] : 'users';
             $out = Form::openForm('selection_type_form', $jump_url);
             $out .= Form::getRadioSet($this->lang->def('_AGGREGATE_ON'), 'selection_type', 'selection_type', array_flip($values), $sel_val) . '<div class="nofloat"></div>';
             $out .= Form::openButtonSpace();
             $out .= Form::getButton('ok_selection', 'ok_selection', $this->lang->def('_CONFIRM'));
             $out .= Form::getButton('undo', 'undo', $this->lang->def('_UNDO'));
             $out .= Form::closeButtonSpace();
             $out .= Form::getHidden('step', 'step', 'sel_data');
             $out .= Form::closeForm();
             cout($out);
             break;
         case 'sel_data':
             $type = Get::req('selection_type', DOTY_ALPHANUM, 'users');
             //$aclManager = new DoceboACLManager();
             $user_select = new UserSelector();
             if (Get::req('is_updating', DOTY_INT, 0) > 0) {
                 $ref['rows_filter']['select_all'] = Get::req('select_all', DOTY_INT, 0) > 0 ? true : false;
                 $ref['rows_filter']['selection_type'] = $type;
                 //$ref['rows_filter']['selection'] = $user_select->getSelection($_POST);
             } else {
                 //maybe redoundant
                 if (!isset($ref['rows_filter']['select_all'])) {
                     $ref['rows_filter']['select_all'] = false;
                 }
                 if (!isset($ref['rows_filter']['selection_type'])) {
                     $ref['rows_filter']['selection_type'] = 'groups';
                 }
                 if (!isset($ref['rows_filter']['selection'])) {
                     $ref['rows_filter']['selection'] = array();
                 }
                 $user_select->resetSelection($ref['rows_filter']['selection']);
                 //$ref['users'] = array(); it should already have been set to void array, if non existent
             }
             if (isset($_POST['cancelselector'])) {
                 Util::jump_to($back_url);
             } elseif (isset($_POST['okselector'])) {
                 $ref['rows_filter']['selection'] = $user_select->getSelection($_POST);
                 Util::jump_to($next_url);
             }
             //set page
             switch ($type) {
                 case 'groups':
                     $user_select->show_user_selector = FALSE;
                     $user_select->show_group_selector = TRUE;
                     $user_select->show_orgchart_selector = TRUE;
                     break;
                 case 'users':
                     $user_select->show_user_selector = TRUE;
                     $user_select->show_group_selector = TRUE;
                     $user_select->show_orgchart_selector = TRUE;
                     break;
             }
             //$user_select->show_orgchart_simple_selector = FALSE;
             //$user_select->multi_choice = TRUE;
             $user_select->addFormInfo(($type == 'users' ? Form::getCheckbox($lang->def('_REPORT_FOR_ALL'), 'select_all', 'select_all', 1, $ref['rows_filter']['select_all']) : '') . Form::getBreakRow() . Form::getHidden('selection_type', 'selection_type', $type) . Form::getHidden('step', 'step', 'sel_data') . Form::getHidden('is_updating', 'is_updating', 1) . Form::getHidden('substep', 'substep', 'user_selection') . Form::getHidden('second_step', 'second_step', 1));
             $user_select->setPageTitle('');
             $user_select->loadSelector(Util::str_replace_once('&', '&amp;', $jump_url), false, $this->lang->def('_CHOOSE_USER_FOR_REPORT'), true);
             break;
     }
 }
function modAssignmentAssignMetaCertificate()
{
    checkPerm('mod');
    require_once _base_ . '/lib/lib.form.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.directory.php';
    require_once _base_ . '/lib/lib.userselector.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.course_managment.php';
    $lang =& DoceboLanguage::createInstance('certificate', 'lms');
    $id_certificate = importVar('id_certificate', true, 0);
    $id_meta = Get::req('idmeta', DOTY_INT, 0);
    $step = Get::req('step', DOTY_INT, 0);
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $acl_man =& Docebo::user()->getAclManager();
    $aclManager = new DoceboACLManager();
    $user_select = new UserSelector();
    $form = new Form();
    $sel = new Course_Manager();
    $course_man = new Man_Course();
    if (isset($_POST['okselector'])) {
        $user_selected = $user_select->getSelection($_POST);
        $_SESSION['meta_certificate']['users'] = $user_selected;
        $step++;
    }
    if (isset($_POST['import_filter'])) {
        $_SESSION['meta_certificate']['course'] = $sel->getCourseSelection($_POST);
        $step++;
    }
    if (isset($_POST['insert'])) {
        $step++;
    }
    if ($step == 3) {
        $array_user =& $aclManager->getAllUsersFromIdst($_SESSION['meta_certificate']['users']);
        $array_user = array_unique($array_user);
        $res = true;
        $user_reset = array();
        $course_reset = array();
        $reasign = array();
        //array reasign
        $query = "SELECT idUser, idCourse" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idMetaCertificate = '" . $id_meta . "'";
        $result = sql_query($query);
        while (list($id_user, $id_course) = sql_fetch_row($result)) {
            $reasign[$id_user][$id_course] = 1;
        }
        //array user_reset
        $query = "SELECT DISTINCT idUser" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idMetaCertificate = '" . $id_meta . "'";
        $result = sql_query($query);
        while (list($id_user) = sql_fetch_row($result)) {
            $user_reset[$id_user] = $id_user;
        }
        //array course_reset
        $query = "SELECT DISTINCT idCourse" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idMetaCertificate = '" . $id_meta . "'";
        $result = sql_query($query);
        while (list($id_course) = sql_fetch_row($result)) {
            $course_reset[$id_course] = $id_course;
        }
        //finish array initialization
        $query_course = "INSERT INTO " . $GLOBALS['prefix_lms'] . "_certificate_meta_course (idMetaCertificate, idUser, idCourse)" . " VALUES ";
        $first = true;
        $array_user_flipped = array_flip($array_user);
        foreach ($user_reset as $id_user) {
            if (!isset($array_user_flipped[$id_user])) {
                $query = "DELETE FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $id_meta . "'";
                if (!sql_query($query)) {
                    $res = false;
                }
            }
        }
        if (!$res) {
            Util::jump_to('index.php?modname=meta_certificate&op=assign&id_certificate=' . $id_certificate . '&res=error_mod_assign');
        }
        foreach ($course_reset as $id_course) {
            if (!isset($_SESSION['meta_certificate']['course'][$id_course])) {
                $query = "DELETE FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idCourse = '" . $id_course . "'" . " AND idMetaCertificate = '" . $id_meta . "'";
                if (!sql_query($query)) {
                    $res = false;
                }
            }
        }
        if (!$res) {
            Util::jump_to('index.php?modname=meta_certificate&op=assign&id_certificate=' . $id_certificate . '&res=error_mod_assign');
        }
        reset($_SESSION['meta_certificate']['course']);
        foreach ($array_user as $id_user) {
            foreach ($_SESSION['meta_certificate']['course'] as $id_course) {
                if (isset($_POST['_' . $id_user . '_' . $id_course . '_'])) {
                    if (!isset($reasign[$id_user][$id_course])) {
                        if ($first) {
                            $query_course .= "('" . $id_meta . "', '" . $id_user . "', '" . $id_course . "')";
                            $first = false;
                        } else {
                            $query_course .= ", ('" . $id_meta . "', '" . $id_user . "', '" . $id_course . "')";
                        }
                    }
                } else {
                    if (isset($reasign[$id_user][$id_course])) {
                        $query = "DELETE FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idUser = '******'" . " AND idCourse = '" . $id_course . "'" . " AND idMetaCertificate = '" . $id_meta . "'";
                        if (!sql_query($query)) {
                            $res = false;
                        }
                    }
                }
            }
        }
        if (!$res) {
            Util::jump_to('index.php?modname=meta_certificate&op=assign&id_certificate=' . $id_certificate . '&res=error_mod_assign');
        }
        $res = sql_query($query_course);
        if ($res) {
            Util::jump_to('index.php?modname=meta_certificate&op=assign&id_certificate=' . $id_certificate . '&res=ok');
        } else {
            Util::jump_to('index.php?modname=meta_certificate&op=assign&id_certificate=' . $id_certificate . '&res=error_mod_assign');
        }
    } elseif ($step == 2) {
        YuiLib::load();
        Util::get_js(Get::rel_path('base') . '/lib/js_utils.js', true, true);
        $tb = new Table(0, $lang->def('_META_CERTIFICATE_NEW_ASSIGN_CAPTION'), $lang->def('_META_CERTIFICATE_NEW_ASSIGN_SUMMARY'));
        $tb->setLink('index.php?modname=meta_certificate&amp;op=modassignment');
        $out->add(getTitleArea($lang->def('_TITLE_META_CERTIFICATE_ASSIGN'), 'certificate') . '<div class="std_block">' . $form->openForm('new_assign_step_2', 'index.php?modname=meta_certificate&amp;op=modassignment') . $form->getHidden('id_certificate', 'id_certificate', $id_certificate) . $form->getHidden('idmeta', 'idmeta', $id_meta) . $form->getHidden('step', 'step', 2) . $form->getHidden('reasign', 'reasign', 1));
        $reasign = array();
        if (!isset($_POST['reasign'])) {
            $query = "SELECT idUser, idCourse" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idMetaCertificate = '" . $id_meta . "'";
            $result = sql_query($query);
            while (list($id_user, $id_course) = sql_fetch_row($result)) {
                $reasign[$id_user][$id_course] = 1;
            }
        }
        $form_name = 'new_assign_step_2';
        $type_h = array('', '');
        $cont_h = array($lang->def('_FULLNAME'), $lang->def('_USERNAME'));
        foreach ($_SESSION['meta_certificate']['course'] as $id_course) {
            $type_h[] = 'align_center';
            $course_info = $course_man->getCourseInfo($id_course);
            $cont_h[] = $course_info['code'] . ' - ' . $course_info['name'];
        }
        $type_h[] = 'image';
        $cont_h[] = $lang->def('_CHECKALL');
        $type_h[] = 'image';
        $cont_h[] = $lang->def('_UNCHECKALL');
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        reset($_SESSION['meta_certificate']['course']);
        $array_user =& $aclManager->getAllUsersFromIdst($_SESSION['meta_certificate']['users']);
        $array_user = array_unique($array_user);
        $query = "SELECT idst" . " FROM " . $GLOBALS['prefix_fw'] . "_user" . " WHERE idst IN (" . implode(',', $array_user) . ")" . " ORDER BY userid";
        $result = sql_query($query);
        $array_user = array();
        while (list($id_user) = sql_fetch_row($result)) {
            $array_user[] = $id_user;
        }
        foreach ($array_user as $id_user) {
            $cont = array();
            $user_info = $acl_man->getUser($id_user, false);
            $cont[] = $user_info[ACL_INFO_LASTNAME] . ' ' . $user_info[ACL_INFO_FIRSTNAME];
            $cont[] = $acl_man->relativeId($user_info[ACL_INFO_USERID]);
            foreach ($_SESSION['meta_certificate']['course'] as $id_course) {
                if (isset($_POST['_' . $id_user . '_' . $id_course . '_']) || isset($_POST['select_all']) || isset($reasign[$id_user][$id_course])) {
                    $checked = true;
                } else {
                    $checked = false;
                }
                $cont[] = $form->getCheckbox('', '_' . $id_user . '_' . $id_course . '_', '_' . $id_user . '_' . $id_course . '_', 1, $checked);
            }
            $cont[] = '<a href="javascript:;" onclick="checkall_fromback_meta(\'' . $form_name . '\', \'' . $id_user . '\', true); return false;">' . $lang->def('_CHECKALL') . '</a>';
            $cont[] = '<a href="javascript:;" onclick="checkall_fromback_meta(\'' . $form_name . '\', \'' . $id_user . '\', false); return false;">' . $lang->def('_UNCHECKALL') . '</a>';
            $tb->addBody($cont);
        }
        reset($_SESSION['meta_certificate']['course']);
        $cont = array();
        $cont[] = '';
        $cont[] = '';
        foreach ($_SESSION['meta_certificate']['course'] as $id_course) {
            $cont[] = '<a href="javascript:;" onclick="checkall_meta(\'' . $form_name . '\', \'' . $id_course . '\', true); return false;">' . $lang->def('_CHECKALL') . '</a><br/>' . '<a href="javascript:;" onclick="checkall_meta(\'' . $form_name . '\', \'' . $id_course . '\', false); return false;">' . $lang->def('_UNCHECKALL') . '</a>';
        }
        $cont[] = '';
        $cont[] = '';
        $tb->addBody($cont);
        $out->add($form->openElementSpace() . $tb->getTable() . $form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('select_all', 'select_all', $lang->def('_SELECT_ALL')) . $form->getButton('insert', 'insert', $lang->def('_INSERT')) . $form->getButton('undo_assign', 'undo_assign', $lang->def('_UNDO')) . $form->closeButtonSpace() . $form->closeForm());
    } elseif ($step == 1) {
        $sel->setLink('index.php?modname=meta_certificate&amp;op=modassignment');
        $out->add(getTitleArea($lang->def('_TITLE_META_CERTIFICATE_ASSIGN'), 'certificate') . '<div class="std_block">' . $form->openForm('new_assign_step_1', 'index.php?modname=meta_certificate&amp;op=modassignment') . $form->getHidden('id_certificate', 'id_certificate', $id_certificate) . $form->getHidden('idmeta', 'idmeta', $id_meta) . $form->getHidden('step', 'step', 1) . $form->getHidden('course_reload', 'course_reload', 1));
        if (!isset($_POST['course_reload'])) {
            $query = "SELECT DISTINCT idCourse" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idMetaCertificate = '" . $id_meta . "'";
            $result = sql_query($query);
            $course_reset = array();
            while (list($id_course) = sql_fetch_row($result)) {
                $course_reset[$id_course] = $id_course;
            }
            $sel->resetCourseSelection($course_reset);
        }
        $sel->loadSelector();
        $out->add(Form::getHidden('update_tempdata', 'update_tempdata', 1) . Form::openButtonSpace() . Form::getBreakRow() . Form::getButton('ok_filter', 'import_filter', $lang->def('_NEXT')) . Form::getButton('undo_filter', 'undo_filter', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>');
    } else {
        $user_select->show_orgchart_simple_selector = FALSE;
        $user_select->multi_choice = TRUE;
        $user_select->addFormInfo($form->getHidden('step', 'step', 0) . $form->getHidden('id_certificate', 'id_certificate', $id_certificate) . $form->getHidden('idmeta', 'idmeta', $id_meta) . $form->getHidden('user_reload', 'user_reload', 1));
        $user_select->setPageTitle(getTitleArea($lang->def('_TITLE_META_CERTIFICATE_ASSIGN'), 'certificate') . '<div class="std_block">');
        if (!isset($_POST['user_reload'])) {
            $query = "SELECT DISTINCT idUser" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idMetaCertificate = '" . $id_meta . "'";
            $result = sql_query($query);
            $user_reset = array();
            while (list($id_user) = sql_fetch_row($result)) {
                $user_reset[$id_user] = $id_user;
            }
            $user_select->resetSelection($user_reset);
        }
        $user_select->loadSelector('index.php?modname=meta_certificate&amp;op=modassignment', false, $lang->def('_USER_FOR_META_CERTIFICATE_ASSIGN'), true);
    }
}
Example #5
0
function maskModCourse(&$course, $new = false, $name_category = '')
{
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $form = new Form();
    $classroom = false;
    if (isset($_GET['type']) && $_GET['type'] === 'classroom') {
        $classroom = true;
    }
    //addAjaxJs();
    YuiLib::load();
    $lang =& DoceboLanguage::CreateInstance('course', 'lms');
    $levels = CourseLevel::getLevels();
    $array_lang = Docebo::langManager()->getAllLangCode();
    $array_lang[] = 'none';
    //status of course -----------------------------------------------------
    $status = array(CST_PREPARATION => $lang->def('_CST_PREPARATION'), CST_AVAILABLE => $lang->def('_CST_AVAILABLE'), CST_EFFECTIVE => $lang->def('_CST_CONFIRMED'), CST_CONCLUDED => $lang->def('_CST_CONCLUDED'), CST_CANCELLED => $lang->def('_CST_CANCELLED'));
    //difficult ------------------------------------------------------------
    $difficult_lang = array('veryeasy' => $lang->def('_DIFFICULT_VERYEASY'), 'easy' => $lang->def('_DIFFICULT_EASY'), 'medium' => $lang->def('_DIFFICULT_MEDIUM'), 'difficult' => $lang->def('_DIFFICULT_DIFFICULT'), 'verydifficult' => $lang->def('_DIFFICULT_VERYDIFFICULT'));
    //type of course -------------------------------------------------------
    $course_type = array('elearning' => $lang->def('_COURSE_TYPE_ELEARNING'), 'blended' => $lang->def('_COURSE_TYPE_BLENDED'), 'classroom' => $lang->def('_CLASSROOM'));
    // points policy -------------------------------------------------------
    $show_who_online = array(0 => $lang->def('_DONT_SHOW'), _SHOW_COUNT => $lang->def('_SHOW_COUNT'), _SHOW_INSTMSG => $lang->def('_SHOW_INSTMSG'));
    if ($new == true) {
        // menu availables -----------------------------------------------------
        $menu_custom = getAllCustom();
        list($sel_custom) = current($menu_custom);
        reset($menu_custom);
    }
    $out->add($form->openElementSpace());
    if ($new == true) {
        $out->add($form->getLineBox($lang->def('_CATEGORY_SELECTED'), $name_category));
    } else {
        $out->add($form->getDropdown($lang->def('_CATGORY'), 'idCategory', 'idCategory', getCategoryForDropdown(), $course['idCategory']));
    }
    require_once _lms_ . '/admin/models/LabelAlms.php';
    $label_model = new LabelAlms();
    $out->add($form->getTextfield($lang->def('_CODE'), 'course_code', 'course_code', '50', $course['code']) . $form->getTextfield($lang->def('_COURSE_NAME'), 'course_name', 'course_name', '255', $course['name']) . $form->getDropdown($lang->def('_COURSE_LANG_METHOD'), 'course_lang', 'course_lang', $array_lang, array_search($course['lang_code'], $array_lang)) . $form->getDropdown($lang->def('_DIFFICULTY'), 'course_difficult', 'course_difficult', $difficult_lang, $course['difficult']) . ($classroom ? $form->getHidden('course_type', 'course_type', 'classroom') : $form->getDropdown($lang->def('_COURSE_TYPE'), 'course_type', 'course_type', $course_type, $course['course_type'])) . $form->getDropdown($lang->def('_STATUS'), 'course_status', 'course_status', $status, $course['status']) . $form->getDropdown($lang->def('_LABEL'), 'label', 'label', $label_model->getLabelFromDropdown(true), $new ? false : $label_model->getCourseLabel($course['idCourse'])) . ($classroom ? '' : $form->getCheckbox($lang->def('_COURSE_EDITION'), 'course_edition_yes', 'course_edition', 1, $course['course_edition'] == 1)) . ($new == true ? $form->getDropdown($lang->def('_COURSE_MENU_TO_ASSIGN'), 'selected_menu', 'selected_menu', $menu_custom, $sel_custom) : '') . $form->getCheckbox($lang->def('_DIRECT_PLAY'), 'direct_play', 'direct_play', '1', $course['direct_play'] == 1) . $form->getCheckbox($lang->def('_SHOW_RESULTS'), 'show_result', 'show_result', '1', $course['show_result'] == 1) . $form->getTextarea($lang->def('_DESCRIPTION'), 'course_descr', 'course_descr', $course['description']) . '<div class="align_center">' . str_replace('[down]', '', $lang->def('_COURSE_MORE_OPTION')) . '</div>' . (!$new && !$classroom ? $form->getCheckbox($lang->def('_CASCADE_MOD_ON_EDITION'), 'cascade_on_ed', 'cascade_on_ed', 1) : '') . $form->closeElementSpace() . $form->openElementSpace() . $form->getOpenFieldset($lang->def('_COURSE_SUBSCRIPTION')) . $form->getOpenCombo($lang->def('_USER_CAN_SUBSCRIBE')) . $form->getRadio($lang->def('_SUBSCRIPTION_CLOSED'), 'subscription_closed', 'can_subscribe', '0', $course['can_subscribe'] == 0) . $form->getRadio($lang->def('_SUBSCRIPTION_OPEN'), 'subscription_open', 'can_subscribe', '1', $course['can_subscribe'] == 1) . $form->getRadio($lang->def('_SUBSCRIPTION_IN_PERIOD') . ":", 'subscription_period', 'can_subscribe', '2', $course['can_subscribe'] == 2) . $form->getCloseCombo() . $form->getDatefield($lang->def('_SUBSCRIPTION_DATE_BEGIN') . ":", 'sub_start_date', 'sub_start_date', $course['sub_start_date']) . $form->getDatefield($lang->def('_SUBSCRIPTION_DATE_END') . ":", 'sub_end_date', 'sub_end_date', $course['sub_end_date']) . $form->getBreakRow() . $form->getTextfield($lang->def('_COURSE_AUTOREGISTRATION_CODE'), 'course_autoregistration_code', 'course_autoregistration_code', '255', $course['autoregistration_code']) . $form->getCheckbox($lang->def('_RANDOM_COURSE_AUTOREGISTRATION_CODE'), 'random_course_autoregistration_code', 'random_course_autoregistration_code', 0) . $form->getCloseFieldset() . $form->getOpenFieldset($lang->def('_COURSE_DISPLAY_MODE')) . $form->getOpenCombo($lang->def('_WHERE_SHOW_COURSE')) . $form->getRadio($lang->def('_SC_EVERYWHERE'), 'course_show_rules_every', 'course_show_rules', '0', $course['show_rules'] == 0) . $form->getRadio($lang->def('_SC_ONLY_IN'), 'course_show_rules_only_in', 'course_show_rules', '1', $course['show_rules'] == 1) . $form->getRadio($lang->def('_SC_ONLYINSC_USER'), 'course_show_rules_onlyinsc_user', 'course_show_rules', '2', $course['show_rules'] == 2) . $form->getCloseCombo() . $form->getOpenCombo($lang->def('_WHAT_SHOW')) . $form->getCheckbox($lang->def('_SHOW_PROGRESS'), 'course_progress', 'course_progress', '1', $course['show_progress'] == 1) . $form->getCheckbox($lang->def('_SHOW_TIME'), 'course_time', 'course_time', '1', $course['show_time'] == 1) . $form->getCheckbox($lang->def('_SHOW_ADVANCED_INFO'), 'course_advanced', 'course_advanced', '1', $course['show_extra_info'] == 1) . $form->getCloseCombo() . $form->getDropdown($lang->def('_SHOW_WHOISONLINE'), 'show_who_online', 'show_who_online', $show_who_online, $course['show_who_online']) . $form->getOpenCombo($lang->def('_SHOW_USER_OF_LEVEL')), 'content');
    while (list($level, $level_name) = each($levels)) {
        $out->add($form->getCheckbox($level_name, 'course_show_level_' . $level, 'course_show_level[' . $level . ']', $level, $course['level_show_user'] & 1 << $level));
    }
    $out->add($form->getCloseCombo() . $form->getCloseFieldset() . $form->getOpenFieldset($lang->def('_USER_INTERACTION_OPTION')) . $form->getOpenCombo($lang->def('_COURSE_SUBSRIBE')) . $form->getRadio($lang->def('_COURSE_S_GODADMIN'), 'course_subs_godadmin', 'course_subs', '0', $course['subscribe_method'] == 0) . $form->getRadio($lang->def('_COURSE_S_MODERATE'), 'course_subs_moderate', 'course_subs', '1', $course['subscribe_method'] == 1) . $form->getRadio($lang->def('_COURSE_S_FREE'), 'course_subs_free', 'course_subs', '2', $course['subscribe_method'] == 2) . $form->getCloseCombo());
    $pl_man =& PlatformManager::CreateInstance();
    if ($pl_man->isLoaded('ecom') || 1) {
        $out->add($form->getCheckbox($lang->def('_COURSE_SELL'), 'course_sell', 'course_sell', '1', $course['selling'] == 1) . $form->getTextfield($lang->def('_COURSE_PRIZE'), 'course_prize', 'course_prize', '11', $course['prize']) . $form->getTextfield($lang->def('_COURSE_ADVANCE'), 'advance', 'advance', '11', $course['advance']));
    } else {
        $out->add($form->getHidden('course_prize', 'course_prize', '0') . $form->getHidden('advance', 'advance', '0'));
    }
    // mode for course end--------------------------------------------
    $out->add($form->getHidden('course_em', 'course_em', '0') . $form->getOpenCombo($lang->def('_COURSE_STATUS_CANNOT_ENTER')) . $form->getCheckbox($lang->def('_USER_STATUS_SUBS'), 'user_status_' . _CUS_SUBSCRIBED, 'user_status[' . _CUS_SUBSCRIBED . ']', _CUS_SUBSCRIBED, $course['userStatusOp'] & 1 << _CUS_SUBSCRIBED) . $form->getCheckbox($lang->def('_USER_STATUS_BEGIN'), 'user_status_' . _CUS_BEGIN, 'user_status[' . _CUS_BEGIN . ']', _CUS_BEGIN, $course['userStatusOp'] & 1 << _CUS_BEGIN) . $form->getCheckbox($lang->def('_USER_STATUS_END'), 'user_status_' . _CUS_END, 'user_status[' . _CUS_END . ']', _CUS_END, $course['userStatusOp'] & 1 << _CUS_END) . $form->getCheckbox($lang->def('_USER_STATUS_SUSPEND'), 'user_status_' . _CUS_SUSPEND, 'user_status[' . _CUS_SUSPEND . ']', _CUS_SUSPEND, $course['userStatusOp'] & 1 << _CUS_SUSPEND) . $form->getCloseCombo() . $form->getCloseFieldset());
    //-expiration---------------------------------------------------------
    $hours = array('-1' => '- -', '0' => '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23');
    $quarter = array('-1' => '- -', '00' => '00', '15' => '15', '30' => '30', '45' => '45');
    if ($course['hour_begin'] != '-1') {
        $hb_sel = (int) substr($course['hour_begin'], 0, 2);
        $qb_sel = substr($course['hour_begin'], 3, 2);
    } else {
        $hb_sel = $qb_sel = '-1';
    }
    if ($course['hour_end'] != '-1') {
        $he_sel = (int) substr($course['hour_end'], 0, 2);
        $qe_sel = substr($course['hour_end'], 3, 2);
    } else {
        $he_sel = $qe_sel = '-1';
    }
    /*
    	$out->add(
    		'<script type="text/javascript">'
    		."
    		alert(cal_course_date_begin);
    		cal_course_date_begin.onUpdate = function() {
    			var new_date = \$F('course_date_begin');
    			\$('course_date_end').value = new_date;
    		}
    
    
    		"
    		.'</script>'
    	, 'footer');*/
    $out->add($form->getOpenFieldset($lang->def('_COURSE_TIME_OPTION')) . $form->getDatefield($lang->def('_DATE_BEGIN'), 'course_date_begin', 'course_date_begin', $course['date_begin']) . $form->getDatefield($lang->def('_DATE_END'), 'course_date_end', 'course_date_end', $course['date_end']) . $form->getLineBox('<label for="hour_begin_hour">' . $lang->def('_HOUR_BEGIN') . '</label>', $form->getInputDropdown('dropdown_nw', 'hour_begin_hour', 'hour_begin[hour]', $hours, $hb_sel, '') . ' : ' . $form->getInputDropdown('dropdown_nw', 'hour_begin_quarter', 'hour_begin[quarter]', $quarter, $qe_sel, '')) . $form->getLineBox('<label for="hour_end_hour">' . $lang->def('_HOUR_END') . '</label>', $form->getInputDropdown('dropdown_nw', 'hour_end_hour', 'hour_end[hour]', $hours, $he_sel, '') . ' : ' . $form->getInputDropdown('dropdown_nw', 'hour_end_quarter', 'hour_end[quarter]', $quarter, $qe_sel, '')) . $form->getTextfield($lang->def('_DAY_OF_VALIDITY'), 'course_day_of', 'course_day_of', '10', $course['valid_time']) . $form->getTextfield($lang->def('_MEDIUM_TIME'), 'course_medium_time', 'course_medium_time', '10', $course['mediumTime']) . $form->getCloseFieldset());
    //sponsor-and-logo----------------------------------------------------
    $out->add($form->getOpenFieldset($lang->def('_COURSE_SPECIAL_OPTION')) . $form->getTextfield($lang->def('_MIN_NUM_SUBSCRIBE'), 'min_num_subscribe', 'min_num_subscribe', '11', $course['min_num_subscribe']) . $form->getTextfield($lang->def('_MAX_NUM_SUBSCRIBE'), 'max_num_subscribe', 'max_num_subscribe', '11', $course['max_num_subscribe']) . $form->getCheckbox($lang->def('_ALLOW_OVERBOOKING'), 'allow_overbooking', 'allow_overbooking', '1', $course['allow_overbooking'] == 1) . $form->getTextfield($lang->def('_COURSE_QUOTA'), 'course_quota', 'course_quota', '11', $course['course_quota'] != COURSE_QUOTA_INHERIT ? $course['course_quota'] : 0) . $form->getCheckbox($lang->def('_INHERIT_QUOTA'), 'inherit_quota', 'inherit_quota', '1', $course['course_quota'] == COURSE_QUOTA_INHERIT) . $form->getCloseFieldset() . $form->getOpenFieldset($lang->def('_DOCUMENT_UPLOAD')));
    if ($new == true) {
        $out->add($form->getFilefield($lang->def('_USER_MATERIAL'), 'course_user_material', 'course_user_material') . $form->getFilefield($lang->def('_OTHER_USER_MATERIAL'), 'course_otheruser_material', 'course_otheruser_material') . $form->getTextfield($lang->def('_SPONSOR_LINK'), 'course_sponsor_link', 'course_sponsor_link', '255', $course['linkSponsor']) . $form->getFilefield($lang->def('_SPONSOR_LOGO'), 'course_sponsor_logo', 'course_sponsor_logo') . $form->getFilefield($lang->def('_COURSE_LOGO'), 'course_logo', 'course_logo') . $form->getFilefield($lang->def('_COURSE_DEMO'), 'course_demo', 'course_demo'));
    } else {
        $out->add($form->getExtendedFilefield($lang->def('_USER_MATERIAL'), 'course_user_material', 'course_user_material', $course["img_material"]) . $form->getExtendedFilefield($lang->def('_OTHER_USER_MATERIAL'), 'course_otheruser_material', 'course_otheruser_material', $course["img_othermaterial"]) . $form->getTextfield($lang->def('_SPONSOR_LINK'), 'course_sponsor_link', 'course_sponsor_link', '255', $course['linkSponsor']) . $form->getExtendedFilefield($lang->def('_SPONSOR_LOGO'), 'course_sponsor_logo', 'course_sponsor_logo', $course["imgSponsor"]) . $form->getExtendedFilefield($lang->def('_COURSE_LOGO'), 'course_logo', 'course_logo', $course["img_course"]) . $form->getExtendedFilefield($lang->def('_COURSE_DEMO'), 'course_demo', 'course_demo', $course["course_demo"]));
    }
    $out->add($form->getCheckbox($lang->def('_USE_LOGO_IN_COURSELIST'), 'use_logo_in_courselist', 'use_logo_in_courselist', 1, $course["use_logo_in_courselist"]) . $form->getCloseFieldset() . $form->closeElementSpace());
}
Example #6
0
<?php

$body = "";
$languages = Docebo::langManager()->getAllLanguages(true);
//getAllLangCode();
$std_lang = getLanguage();
$body .= Form::openForm('addfolder_form', "ajax.adm_server.php?r=" . $this->link . "/createfolder");
$body .= Form::getHidden('addfolder_id_parent', 'id_parent', $id_parent);
$body .= Form::getTextfield(Lang::t('_CODE', 'organization_chart'), 'org_code', 'org_code', 50);
$body .= Form::getDropdown(Lang::t('_DEFAULTTEMPLATE', 'configuration'), 'associated_template', 'associated_template', getTemplateList(), $default_template);
$body .= Form::getBreakRow();
foreach ($languages as $language) {
    $lang_code = $language['code'];
    $lang_name = $language['description'];
    $body .= Form::getTextfield($lang_code, 'newfolder_' . $lang_code, 'langs[' . $lang_code . ']', 255);
}
$body .= Form::closeForm();
if (isset($json)) {
    $output['header'] = $title;
    $output['body'] = $body;
    echo $json->encode($output);
} else {
    echo '<h2>' . $title . '</h2>';
    echo $body;
}
Example #7
0
    function play($object_faq, $id_param)
    {
        !checkPerm('view', true, 'organization') && !checkPerm('view', true, 'storage');
        require_once _base_ . '/lib/lib.form.php';
        require_once $GLOBALS['where_lms'] . '/lib/lib.param.php';
        $lang =& DoceboLanguage::createInstance('faq');
        $idCategory = $object_faq->getId();
        $mode = importVar('mode', false, 'faq');
        $back_coded = htmlentities(urlencode($object_faq->back_url));
        $search = importVar('search');
        if (isset($_POST['empty'])) {
            $search = '';
        }
        $idReference = getLOParam($id_param, 'idReference');
        $link = 'index.php?modname=faq&amp;op=play&amp;idCategory=' . $idCategory . '&amp;id_param=' . $id_param . '&amp;back_url=' . $back_coded;
        // NOTE: Track only if $idReference is present
        if ($idReference !== FALSE) {
            require_once $GLOBALS['where_lms'] . '/class.module/track.faq.php';
            list($exist, $idTrack) = Track_Faq::getIdTrack($idReference, getLogUserId(), $idCategory, TRUE);
            if ($exist) {
                $ti = new Track_Faq($idTrack);
                $ti->setDate(date('Y-m-d H:i:s'));
                $ti->status = 'completed';
                $ti->update();
            } else {
                $ti = new Track_Faq(false);
                $ti->createTrack($idReference, $idTrack, getLogUserId(), date('Y-m-d H:i:s'), 'completed', 'faq');
            }
        }
        list($title) = sql_fetch_row(sql_query("\r\n\tSELECT title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_faq_cat \r\n\tWHERE idCategory = '" . (int) $idCategory . "'"));
        //$GLOBALS['page']->add('<div id="top" class="std_block">', 'content');
        cout('<div class="yui-navset yui-navset-top tab_block">
			<ul class="yui-nav">
				<li class="first' . ($mode == 'faq' ? ' selected' : '') . '">
					<a href="' . $link . '&amp;mode=faq">
						<em>' . Lang::t('_SWITCH_TO_FAQ', 'faq') . '</em>
					</a>
				</li>
				<li' . ($mode == 'help' ? ' class="selected"' : '') . '>
					<a href="' . $link . '&amp;mode=help">
						<em>' . Lang::t('_SWITCH_TO_HELP', 'faq') . '</em>
					</a>
				</li>
			</ul>
			<div class="yui-content">', 'content');
        $GLOBALS['page']->add(getBackUi(Util::str_replace_once('&', '&amp;', $object_faq->back_url), $lang->def('_BACK')));
        $GLOBALS['page']->add('<b>' . $lang->def('_TITLE') . ' : ' . $title . '</b><br />' . '<br />', 'content');
        if ($mode == 'help') {
            $link .= '&amp;mode=help';
            $letter = importVar('letter', true, '');
            $search = urldecode(importVar('search'));
            // Display as help
            $textQuery = "\r\n\t\tSELECT keyword \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_faq \r\n\t\tWHERE idCategory = '" . importVar('idCategory', true) . "'";
            if ($search != '' && !isset($_POST['empty'])) {
                $textQuery .= " AND ( question LIKE '%" . $search . "%' OR answer LIKE '%" . $search . "%' ) ";
            }
            $result = sql_query($textQuery);
            $GLOBALS['page']->add(Form::openForm('glossary_play', 'index.php?modname=faq&amp;op=play') . Form::getOpenFieldset($lang->def('_FILTER')) . Form::getHidden('idCategory', 'idCategory', $idCategory) . Form::getHidden('id_param', 'id_param', $id_param) . Form::getHidden('back_url', 'back_url', $back_coded) . Form::getHidden('mode', 'mode', $mode) . Form::getTextfield($lang->def('_SEARCH'), 'search', 'search', 255, $search != '' && !isset($_POST['empty']) ? $search : ''), 'content');
            $GLOBALS['page']->add('[ ', 'content');
            //letter selection
            for ($i = 97; $i < 123; $i++) {
                if ($letter == $i) {
                    $GLOBALS['page']->add('<span class="text_bold">(', 'content');
                }
                $GLOBALS['page']->add('<a href="' . $link . '&amp;letter=' . $i . '">' . chr($i) . '</a>', 'content');
                if ($letter == $i) {
                    $GLOBALS['page']->add(')</span>', 'content');
                }
                if ($i < 122) {
                    $GLOBALS['page']->add('-', 'content');
                }
            }
            $GLOBALS['page']->add('&nbsp;]&nbsp;[&nbsp;', 'content');
            for ($i = 48; $i < 58; $i++) {
                if ($letter == $i) {
                    $GLOBALS['page']->add('<span class="text_bold">(', 'content');
                }
                $GLOBALS['page']->add('<a href="' . $link . '&amp;letter=' . $i . '">' . chr($i) . '</a>', 'content');
                if ($letter == $i) {
                    $GLOBALS['page']->add(')</span>', 'content');
                }
                if ($i < 57) {
                    $GLOBALS['page']->add('-', 'content');
                }
            }
            $GLOBALS['page']->add(' ] ', 'content');
            $GLOBALS['page']->add(Form::getBreakRow() . Form::openButtonSpace() . Form::getButton('do_search', 'do_search', $lang->def('_SEARCH')) . Form::getButton('empty', 'empty', $lang->def('_RESET')) . Form::closeButtonSpace() . Form::getCloseFieldset() . Form::closeForm(), 'content');
            //analyze keyword
            $keyword_help = array();
            while (list($keyword) = sql_fetch_row($result)) {
                $keyword_split = explode(',', $keyword);
                if (is_array($keyword_split)) {
                    while (list(, $value) = each($keyword_split)) {
                        $value = trim($value);
                        if ($value != '') {
                            if ($letter == 0) {
                                if (isset($keyword_help[$value])) {
                                    ++$keyword_help[$value];
                                } else {
                                    $keyword_help[$value] = 1;
                                }
                            } elseif (substr($value, 0, 1) == chr($letter)) {
                                if (isset($keyword_help[$value])) {
                                    ++$keyword_help[$value];
                                } else {
                                    $keyword_help[$value] = 1;
                                }
                            }
                        }
                    }
                }
            }
            ksort($keyword_help);
            reset($keyword_help);
            $GLOBALS['page']->add('<div class="yui-gf">' . '<div class="yui-u first" >' . '<div class="boxinfo_title">' . $lang->def('_TERM') . '</div>' . '<div class="boxinfo_container">' . '<ul class="link_list">', 'content');
            while (list($key, $value) = each($keyword_help)) {
                $GLOBALS['page']->add('<li><a class="href_block" href="' . $link . '&amp;letter=' . $letter . '&amp;search=' . urlencode($search) . '&amp;word=' . $key . '">' . $key . ' (' . $value . ')</a></li>', 'content');
            }
            $GLOBALS['page']->add('</ul>' . '</div></div>' . '<div class="yui-u">', 'content');
            if (isset($_GET['word'])) {
                $reDef = sql_query("\r\n\t\t\tSELECT title, answer \r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_faq \r\n\t\t\tWHERE keyword LIKE '%" . $_GET['word'] . "%' AND idCategory = '" . (int) $_GET['idCategory'] . "'\r\n\t\t\tORDER BY title");
                while (list($title, $answer) = sql_fetch_row($reDef)) {
                    $GLOBALS['page']->add('<div class="boxinfo_title">' . $title . '</div>' . '<div class="boxinfo_container">' . ($search == '' ? $answer : eregi_replace($search, '<span class="highlight">' . $search . '</span>', $answer)) . '</div><br />', 'content');
                }
            }
            $GLOBALS['page']->add('</div>' . '<div class="nofloat"></div>' . '</div>', 'content');
        } else {
            // Display as faq
            $textQuery = "\r\n\t\tSELECT question, answer \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_faq \r\n\t\tWHERE idCategory = '" . (int) $idCategory . "' " . (isset($_POST['search']) && !isset($_POST['empty']) ? " AND ( question LIKE '%" . $search . "%' OR answer LIKE '%" . $search . "%' ) " : '') . "ORDER BY sequence";
            $result = sql_query($textQuery);
            $GLOBALS['page']->add(Form::openForm('glossary_play', 'index.php?modname=faq&amp;op=play') . Form::getOpenFieldset($lang->def('_FILTER')) . Form::getHidden('idCategory', 'idCategory', $idCategory) . Form::getHidden('id_param', 'id_param', $id_param) . Form::getHidden('back_url', 'back_url', $back_coded) . Form::getTextfield($lang->def('_SEARCH'), 'search', 'search', 255, $search != '' && !isset($_POST['empty']) ? $search : '') . Form::getBreakRow() . Form::openButtonSpace() . Form::getButton('do_search', 'do_search', $lang->def('_SEARCH')) . Form::getButton('empty', 'empty', $lang->def('_RESET')) . Form::closeButtonSpace() . Form::getCloseFieldset() . Form::closeForm(), 'content');
            while (list($question, $answer) = sql_fetch_row($result)) {
                $GLOBALS['page']->add('<div class="boxinfo_title">' . ($search == '' ? $question : eregi_replace($search, '<span class="highlight">' . $search . '</span>', $question)) . '</div>' . '<div class="boxinfo_container">' . ($search == '' ? $answer : eregi_replace($search, '<span class="highlight">' . $search . '</span>', $answer)) . '</div><br />', 'content');
            }
        }
        $GLOBALS['page']->add('<div class="align_center">' . '<a href="#top">' . '<img src="' . getPathImage() . 'standard/upcheck.gif" title="' . $lang->def('_BACKTOTOP') . '" />' . $lang->def('_BACKTOTOP') . '</a>' . getBackUi(Util::str_replace_once('&', '&amp;', $object_faq->back_url), $lang->def('_BACK')), 'content');
        cout('<div class="nofloat"></div>
		</div><!-- yui content -->
		</div></div>', 'content');
    }
function create_report_cols()
{
    checkPerm('mod');
    require_once _base_ . '/lib/lib.form.php';
    $ref =& $_SESSION['report_tempdata']['columns_filter_category'];
    if (isset($_POST['columns_filter'])) {
        $ref = $_POST['columns_filter'];
    }
    $lang =& DoceboLanguage::createInstance('report');
    $obj_report = openreport();
    $obj_report->back_url = 'index.php?modname=public_report_admin&op=create_type';
    $obj_report->jump_url = 'index.php?modname=public_report_admin&op=create_cols';
    $obj_report->next_url = 'index.php?modname=public_report_admin&op=create_save';
    //page title
    $page_title = getTitleArea(array('index.php?modname=public_report_admin&amp;op=reportlist' => $lang->def('_REPORT'), 'index.php?modname=public_report_admin&amp;op=create_name' => $lang->def('_NEW'), 'index.php?modname=public_report_admin&amp;op=create_rows' => $lang->def('_REPORT_SEL_ROWS'), 'index.php?modname=public_report_admin&amp;op=create_type' => $lang->def('_REPORT_SEL_COLUMNS'), $lang->def('_REPORT_COLUMNS'))) . '<div class="std_block">';
    //.  	getBackUi($obj_report->back_url, $lang->def('_BACK'), 'content');
    if ($obj_report->useStandardTitle_Columns()) {
        $GLOBALS['page']->add($page_title, 'content');
        $GLOBALS['page']->add(Form::openForm('report_columns_form', str_replace('&', '&amp;', $obj_report->jump_url)), 'content');
    } else {
        //this is used just to pass std title string to object functions, who may use it
        $obj_report->page_title = $page_title;
    }
    $output = $obj_report->get_columns_filter($_SESSION['report_tempdata']['columns_filter_category']);
    $GLOBALS['page']->add($output, 'content');
    if ($obj_report->useStandardTitle_Columns()) {
        $GLOBALS['page']->add(Form::openButtonSpace() . Form::getBreakRow() . Form::getButton('pre_filter', 'pre_filter', $lang->def('_SHOW_NOSAVE', 'report')) . Form::getButton('ok_filter', 'import_filter', $lang->def('_SAVE_BACK', 'report')) . Form::getButton('show_filter', 'show_filter', $lang->def('_SAVE_SHOW', 'report')) . Form::getButton('undo_filter', 'undo_filter', $lang->def('_UNDO', 'report')) . Form::closeButtonSpace() . Form::closeForm(), 'content');
        $GLOBALS['page']->add('</div>', 'content');
        //close std_block div
    }
}
Example #9
0
 function importcourse()
 {
     checkPerm('mod');
     require_once _base_ . '/lib/lib.form.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php';
     $out =& $GLOBALS['page'];
     $lang =& DoceboLanguage::createInstance('coursepath', 'lms');
     $id_path = importVar('id_path', true, 0);
     $id_slot = importVar('id_slot', true, 0);
     $selector = new Selector_Course();
     $selector->parseForState($_POST);
     $path_man = new CoursePath_Manager();
     if (isset($_GET['load'])) {
         $initial_selection = $path_man->getSlotElem($id_path, $id_slot);
         if (isset($_GET['load'])) {
             $selector->resetSelection($initial_selection);
         }
     }
     if (isset($_POST['import'])) {
         $initial_selection = $path_man->getSlotElem($id_path, $id_slot);
         $selected_courses = $selector->getSelection();
         $to_add = array_diff($selected_courses, $initial_selection);
         $to_del = array_diff($initial_selection, $selected_courses);
         $re = true;
         $added_courses = array();
         $removed_courses = array();
         while (list(, $id_c) = each($to_add)) {
             $re_s = $path_man->addToSlot($id_path, $id_slot, $id_c);
             if ($re_s) {
                 $added_courses[] = $id_c;
             }
             $re &= $re_s;
         }
         while (list(, $id_c) = each($to_del)) {
             $re_s = $path_man->delFromSlot($id_path, $id_slot, $id_c);
             if ($re_s) {
                 $removed_courses[] = $id_c;
             }
             $re &= $re_s;
         }
         // update users course subscription
         require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php';
         require_once $GLOBALS['where_lms'] . '/lib/lib.subscribe.php';
         $cpath_man = new CoursePath_Manager();
         $subs_man = new CourseSubscribe_Management();
         $users = $cpath_man->getSubscribed($id_path);
         if (!empty($added_courses) && !empty($users)) {
             $re &= $subs_man->multipleSubscribe($users, $added_courses, 3);
         }
         if (!$re) {
             die('<a href="index.php?modname=coursepath&op=pathelem&id_path=' . $id_path . '">waths happen in insert ???</a>');
         }
         if (!empty($removed_courses) && !empty($users)) {
             $re &= $subs_man->multipleUnsubscribe($users, $removed_courses);
         }
         $cpath_man->fixSequence($id_path, $id_slot);
         Util::jump_to('index.php?modname=coursepath&op=pathelem&id_path=' . $id_path . '&result=' . ($re ? 'ok' : 'err'));
     }
     $query_pathlist = "\r\n\tSELECT path_name, path_descr\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_coursepath\r\n\tWHERE id_path = '" . (int) $id_path . "'\r\n\tORDER BY path_name";
     list($path_name, $path_descr) = sql_fetch_row(sql_query($query_pathlist));
     $page_title = array('index.php?modname=coursepath&amp;op=pathlist' => $lang->def('_COURSEPATH'), 'index.php?modname=coursepath&amp;op=pathelem&amp;id_path=' . $id_path => $path_name, $lang->def('_IMPORT_COURSE'));
     $out->add(getTitleArea($page_title, 'coursepath') . '<div class="std_block">' . Form::openForm('mancoursepath', 'index.php?modname=coursepath&amp;op=importcourse') . Form::getHidden('id_path', 'id_path', $id_path) . Form::getHidden('id_slot', 'id_slot', $id_slot), 'content');
     $selector->loadCourseSelector(false, true);
     $out->add(Form::openButtonSpace() . Form::getBreakRow() . Form::getButton('import', 'import', $lang->def('_IMPORT')) . Form::getButton('undoelem', 'undoelem', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
 }
Example #10
0
 function getRenderedProfile($user_info)
 {
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('profile', 'framework');
     $path = Get::sett('url') . $GLOBALS['where_files_relative'] . '/appCore/' . Get::sett('pathphoto');
     $txt = '<div>' . '<div class="boxinfo_title">' . $lang->def('_USERPARAM') . '</div>' . Form::getLineBox($lang->def('_USERNAME'), $user_info[ACL_INFO_USERID]) . Form::getLineBox($lang->def('_LASTNAME'), $user_info[ACL_INFO_LASTNAME]) . Form::getLineBox($lang->def('_NAME'), $user_info[ACL_INFO_FIRSTNAME]) . Form::getLineBox($lang->def('_EMAIL'), $user_info[ACL_INFO_EMAIL]) . Form::getBreakRow() . '<div class="boxinfo_title">' . $lang->def('_USERFORUMPARAM') . '</div>' . '<table class="profile_images">' . '<tr><td>';
     // NOTE: avatar
     if ($user_info[ACL_INFO_AVATAR] != "") {
         $txt .= '<img class="profile_image" src="' . $path . $user_info[ACL_INFO_AVATAR] . '" alt="' . $lang->def('_AVATAR') . '" /><br />';
     } else {
         $txt .= '<div class="text_italic">' . $lang->def('_NOAVATAR') . '</div>';
     }
     // NOTE: signature
     $txt .= '</td></tr></table>' . '<div class="title">' . $lang->def('_SIGNATURE') . '</div>' . '<div class="profile_signature">' . $user_info[ACL_INFO_SIGNATURE] . '</div><br />' . "\n" . '</div>';
     return $txt;
 }
Example #11
0
 function savesel()
 {
     checkPerm('view');
     require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('register', 'lms');
     $mand_sym = '<span class="mandatory">*</span>';
     $extra_field = new FieldList();
     $GLOBALS['page']->add(getTitleArea($lang->def('_MYGROUP'), 'mygroup') . '<div class="std_block">', 'content');
     $selected = array();
     if (isset($_POST['group_sel'])) {
         $selected = $_POST['group_sel'];
     } elseif (isset($_POST['group_sel_implode'])) {
         $selected = explode(',', $_POST['group_sel_implode']);
     }
     $play_field = $extra_field->playFieldsForUser(getLogUserId(), $selected, false, false, array('readonly'));
     if (isset($_POST['save_field']) || $play_field === false || $play_field == '') {
         $re_filled = $extra_field->isFilledFieldsForUser(getLogUserId(), $selected);
         if (!$re_filled) {
             $GLOBALS['page']->add(getErrorUi($lang->def('_SOME_MANDATORY_EMPTY')), 'content');
         } else {
             $acl =& Docebo::user()->getAcl();
             $acl_man =& Docebo::user()->getAclManager();
             $groups =& $acl_man->getAllGroupsId(array('free', 'moderate'));
             $groups_id = array_keys($groups);
             $user_group = $acl->getSTGroupsST(getLogUserId());
             $add_groups = array_diff($selected, $user_group);
             $del_groups = array_diff($groups_id, $selected);
             $moderate_add = false;
             if (!empty($add_groups)) {
                 while (list(, $idst) = each($add_groups)) {
                     if ($groups[$idst]['type'] == 'free') {
                         $acl_man->addToGroup($idst, getLogUserId());
                     } elseif ($groups[$idst]['type'] == 'moderate') {
                         $acl_man->addToWaitingGroup($idst, getLogUserId());
                         $moderate_add = true;
                     }
                 }
             }
             if ($moderate_add === true) {
                 require_once _base_ . '/lib/lib.eventmanager.php';
                 // message to user that is odified
                 $msg_composer = new EventMessageComposer();
                 $msg_composer->setSubjectLangText('email', '_TO_APPROVE_GROUP_USER_SBJ', false);
                 $msg_composer->setBodyLangText('email', '_TO_APPROVE_GROUP_USER_TEXT', array('[url]' => Get::sett('url')));
                 $msg_composer->setBodyLangText('sms', '_TO_APPROVE_GROUP_USER_TEXT_SMS', array('[url]' => Get::sett('url')));
                 $idst_approve = $acl->getRoleST('/framework/admin/directory/editgroup');
                 $recipients = $acl_man->getAllRoleMembers($idst_approve);
                 createNewAlert('UserGroupModerated', 'directory', 'moderate', '1', 'User group subscription to moderate', $recipients, $msg_composer);
             }
             if (!empty($del_groups)) {
                 while (list(, $idst_group) = each($del_groups)) {
                     $extra_field->removeUserEntry(getLogUserId(), $idst_group);
                     $acl_man->removeFromGroup($idst_group, getLogUserId());
                 }
             }
             // Save fields
             $extra_field->storeFieldsForUser(getLogUserId());
             Util::jump_to('index.php?modname=mygroup&amp;op=group');
         }
     }
     $GLOBALS['page']->add('<div class="reg_note">' . $lang->def('_GROUPS_FIELDS') . '<ul class="reg_instruction">' . '<li>' . str_replace('[mandatory]', $mand_sym, $lang->def('_REG_MANDATORY')) . '</li>' . '</ul>' . '</div>' . Form::openForm('group_subscription', 'index.php?modname=mygroup&amp;op=savesel') . Form::openElementSpace() . Form::getHidden('group_sel_implode', 'group_sel_implode', isset($_POST['group_sel_implode']) ? $_POST['group_sel_implode'] : implode(',', $selected)) . $play_field . Form::getBreakRow() . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save_field', 'save_field', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
 }
        $rule_man = new AssessmentRule();
        $use_default = importVar('usedef', false, 1);
        $id_rule = importVar('id_rule', true, 0);
        if ($id_rule != 0) {
            // load old data ------------------------------------
            $rule = $rule_man->getRule($id_rule);
            $rule_type = $rule[RULE_TYPE];
            $setting = $rule_man->parseRuleSetting($rule[RULE_TYPE], $rule[RULE_SETTING]);
            $score_type_one = isset($setting[0]) ? $setting[0] : '';
            $score_type_two = isset($setting[1]) ? $setting[1] : '';
        } else {
            $rule_type = $use_default ? RULE_DEFAULT : RULE_GREATER;
            $score_type_one = '';
            $score_type_two = '';
        }
        $arr_question = array();
        $arr_question[RULE_GREATER] = strip_tags(str_replace('[score]', $lang->def('_SCORE'), $lang->def('_RULE_GREATER')));
        $arr_question[RULE_LESSER] = strip_tags(str_replace('[score]', $lang->def('_SCORE'), $lang->def('_RULE_LESSER')));
        $arr_question[RULE_BETWEEN] = strip_tags(str_replace(array('[score_1]', '[score_2]'), array($lang->def('_SCORE'), $lang->def('_SCORE_2')), $lang->def('_RULE_BETWEEN')));
        if ($use_default || $id_rule != 0) {
            $arr_question[RULE_DEFAULT] = $lang->def('_RULE_DEFAULT');
        }
        aout(Form::getHidden('id_assessment', 'id_assessment', importVar('id_assessment', true, 0)));
        aout(Form::getHidden('id_rule', 'id_rule', $id_rule));
        aout('<b><label for="rule_type">' . $lang->def('_RULE_TEXT') . '</label>:&nbsp;</b>' . Form::getInputDropdown('dropdown_nowh', 'rule_type', 'rule_type', $arr_question, $rule_type, ' onChange="rule_type_change(\'rule_type\', \'score_type_one\', \'score_type_two\');"') . '<br />' . '<br />');
        aout(Form::getTextfield($lang->def('_SCORE') . ':&nbsp;', 'score_type_one', 'score_type_one', 255, $score_type_one));
        aout(Form::getTextfield($lang->def('_SCORE_2') . ':&nbsp;', 'score_type_two', 'score_type_two', 255, $score_type_two));
        aout(Form::getBreakRow());
        aout('<script type="text/javascript">' . 'rule_type_change(\'rule_type\', \'score_type_one\', \'score_type_two\');' . '</script>');
        break;
}
/**
 * COURSE PANEL
 * 
 * This module is a facilitator for the users re-training maded by the public administrators.
 * The public administrator will be informed of the users that are approching the expiration date for theirs
 * competences and allow the administrator to re-enroll them to courses that refresh those competences in order to keep
 * the final users up to date.
 */
function coursePanel()
{
    //check permissions
    checkPerm('view');
    $can_mod = checkPerm('mod', true);
    //required libraries
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    require_once _adm_ . '/lib/lib.publicadminmanager.php';
    require_once _lms_ . '/lib/lib.course.php';
    require_once _lms_ . '/lib/lib.date.php';
    require_once _lms_ . '/lib/lib.competences.php';
    //back page link
    $lang =& DoceboLanguage::CreateInstance('public_coursepanel', 'lms');
    $back_ui = getBackUi('index.php', $lang->def('_BACK'));
    $db = DbConn::getInstance();
    $man_competences = new Competences_Manager();
    //check the admin level of the current user, if it's not an admin or the idst is invalid, return an error
    $id_pa = getLogUserId();
    if (!$id_pa) {
        //error: the user is invalid
        cout($back_ui . $lang->def('_INVALID_ADMIN') . $back_ui, 'content');
        return;
    }
    /*
    	//months considered
    	$this_month = (int)date("m");
    	$month_1 = ((int)$this_month-1+1) % 12; $month_1++;
    	$month_2 = ((int)$this_month-1+2) % 12; $month_2++;
    
    	$months = array(
    		$lang->def('MONTH_'.((int)$this_month<10 ? '0' : '').(int)$this_month),
    		$lang->def('MONTH_'.((int)$month_1<10 ? '0' : '').(int)$month_1),
    		$lang->def('MONTH_'.((int)$month_2<10 ? '0' : '').(int)$month_2)
    	);
    */
    $acl_man = Docebo::user()->getAclManager();
    $admin_manager = new PublicAdminManager();
    $array_users = array();
    $idst_associated = $admin_manager->getAdminTree($id_pa);
    $array_users =& $acl_man->getAllUsersFromIdst($idst_associated);
    $array_users = array_unique($array_users);
    if (empty($array_users)) {
        //error: no users to deal with
        cout($back_ui . $lang->def('_NO_USERS') . $back_ui, 'content');
        return;
    }
    //already selected competence and course, if exist
    $sel_competence = Get::req('sel_competence', DOTY_INT, false);
    $sel_course = Get::req('sel_course', DOTY_INT, false);
    //$lang_code = Get::req('language', DOTY_ALPHANUM, getLanguage());
    $comps_1 = array();
    $comps_2 = array();
    //retrieve competences list for dropdown menu -- two steps filter
    //retrieve competences by users
    $query_competences_1 = "SELECT c.id_competence, cu.id_user FROM " . " %lms_competence as c JOIN " . " %lms_competence_user as cu ON " . " (c.id_competence=cu.id_competence AND cu.id_user IN (" . implode(",", $array_users) . "))";
    $res_competences_1 = $db->query($query_competences_1);
    while (list($id_comp, $id_user) = $db->fetch_row($res_competences_1)) {
        $comps_1[$id_comp] = $id_user;
    }
    if (empty($comps_1)) {
        //error, no competences
        cout($back_ui . $lang->def('_NO_COMPETENCES') . $back_ui, 'content');
        return;
    }
    //get number of days in which check if a course or a edition is starting
    $course_check_time = Docebo::user()->preference->getAdminPreference('admin_rules.course_check_time');
    //days from today
    //retrieve competences by courses
    $courses_dropdown = array();
    $query_competences_2 = "(SELECT c.id_competence, t.idCourse, t.name, t.course_type, cc.retraining FROM " . " %lms_competence as c JOIN " . " %lms_competence_course as cc JOIN " . " %lms_course as t ON " . "(c.id_competence=cc.id_competence AND cc.id_course=t.idCourse) " . "WHERE t.course_type IN ('classroom', 'elearning') AND c.id_competence IN (" . implode(",", array_keys($comps_1)) . ")" . ")";
    /*." UNION (SELECT c.id_competence, t.idCourse, t.name, t.course_type, cc.retraining FROM ".
    		$GLOBALS['prefix_lms']."_competence as c JOIN ".
    		$GLOBALS['prefix_lms']."_competence_course as cc JOIN ".
    		$GLOBALS['prefix_lms']."_course as t ON ".
    		"(c.id_competence=cc.id_competence AND cc.id_course=t.idCourse) ".
    		"WHERE t.course_type IN ('classroom', 'elearning') AND c.id_competence IN (".implode(",", array_keys($comps_1)).")".
    		")";*/
    $res_competences_2 = $db->query($query_competences_2);
    while (list($id_comp, $id_course, $course_name, $c_type, $retraining) = $db->fetch_row($res_competences_2)) {
        $comps_2[$id_comp] = $id_course;
        if (!isset($courses_dropdown[$id_comp])) {
            $courses_dropdown[$id_comp] = array();
        }
        $courses_dropdown[$id_comp][$id_course] = $course_name . ' (' . $c_type . ')' . ($retraining > 0 ? ' [' . $lang->def('_RETRAINING') . ']' : '');
    }
    if (empty($comps_2)) {
        //error, no competences
        cout($back_ui . $lang->def('_NO_COMPETENCES') . $back_ui, 'content');
        return;
    }
    $comps = array_keys($comps_2);
    unset($comps_1);
    unset($comps_2);
    $comps_names = $man_competences->getCompetencesName($comps);
    //----------------------------------------------------------------------------
    //retrieve courses for competences
    //$courses_dropdown = array();
    //check if selection for competence and course is valid
    if (!$sel_competence || !array_key_exists($sel_competence, $comps)) {
        $arr = array_keys($courses_dropdown);
        $sel_competence = $arr[0];
        //$comps[0];
    }
    if (!$sel_course || !isset($courses_dropdown[$sel_competence][$sel_course])) {
        foreach ($courses_dropdown as $key => $val) {
            if (count($val) > 0) {
                $sel_competence = $key;
                $arr = array_keys($val);
                $sel_course = $arr[0];
                break;
            }
        }
    }
    //check the course type (base or retraining)
    $is_retraining = $man_competences->isRetrainingCourse($sel_course, $sel_competence);
    //make script for courses dropdown auto-updating
    require_once _base_ . '/lib/lib.json.php';
    $json = new Services_JSON();
    $var = array();
    foreach ($courses_dropdown as $id_comp => $courses_list) {
        $content = "{id_competence: " . (int) $id_comp . ", courses: [";
        $clist = array();
        foreach ($courses_list as $id_course => $name) {
            $clist[] = '{id_course: ' . (int) $id_course . ', name: ' . $json->encode($name) . '}';
        }
        $content .= implode(',', $clist) . "]}";
        $var[] = $content;
    }
    //addYahooJs(array('dom'=>'dom-min.js', 'event'=>'event-min.js', 'selector'=>'selector-beta-min.js'));
    YuiLib::load('selector');
    cout('<script type="text/javascript">
			var sel_options = [' . implode(',', $var) . '];
			YAHOO.util.Event.onDOMReady(function() {
				var s1 = YAHOO.util.Dom.get("competence_selector");
				var s2 = YAHOO.util.Dom.get("course_selector");
				YAHOO.util.Event.addListener(s1, "change", function(e) {
					var opt, id_comp = this.value;
					for (var i=0; i<sel_options.length; i++) {
						if (sel_options[i].id_competence == id_comp) {
							s2.innerHTML = "";
							for (var j=0; j<sel_options[i].courses.length; j++) {
								opt = new Option(sel_options[i].courses[j].name, sel_options[i].courses[j].id_course);
								s2.add(opt, null);
							}
							break;
						}
					}
				});
			});
		</script>', 'page_head');
    //----------------------------------------------------------------------------
    $table_head_style = array('', 'image', 'align_center');
    $table_head_content = array($lang->def('_USERNAME'), $lang->def('_MANDATORY'), $lang->def('_DATE_EXPIRE'));
    $man_course = new Man_Course();
    $date_man = new DateManager();
    $course_info = $man_course->getCourseInfo($sel_course);
    //echo '<pre>'.print_r($course_info, true).'</pre>';
    if ($course_info['course_type'] == 'elearning') {
        $editions[] = (int) $sel_course;
        $subscribed[$sel_course] = getSubscribed($sel_course);
        $table_head_content[] = $course_info['name'];
        $table_head_style[] = 'align_center';
    } elseif ($course_info['course_type'] == 'classroom') {
        //retrieve editions for table columns and subscribed users
        $subscribed = array();
        $editions = array();
        if ($course_check_time > 0) {
            $id_list = array();
            $query_begindates = "SELECT dy.id_date, MIN(dy.date_begin) as date_begin " . " FROM %lms_course_date as dt " . " JOIN %lms_course_date_day as dy ON (dy.id_date = dt.id_date) " . " WHERE dt.id_course='" . (int) $sel_course . "' GROUP BY dy.id_date ORDER BY dy.date_begin";
            $res = $db->query($query_begindates);
            while (list($id_date, $date_begin) = $db->fetch_row($res)) {
                if ($date_begin >= date("Y-m-d") && $date_begin <= date("Y-m-d", strtotime("+" . $course_check_time . " days"))) {
                    $id_list[] = $id_date;
                }
            }
            /*
            			$query_editions = "SELECT dt.id_date, dt.id_course, dt.code, dt.name, MIN(dy.date_begin) as min "
            				." FROM %lms_course_date as dt "
            				." JOIN %lms_course_date_day as dy ON (dy.id_date = dt.id_date) "
            				." WHERE dt.id_course='".(int)$sel_course."' AND dy.date_begin BETWEEN NOW() AND '"
            				.date("Y-m-d", strtotime("+".$course_check_time." days"))."' GROUP BY dt.id_date ORDER BY dy.date_begin";
            */
            $query_editions = "SELECT id_date, id_course, code, name FROM %lms_course_date WHERE " . (count($id_list) > 0 ? "id_date IN (" . implode(",", $id_list) . ") " : "0");
        } else {
            $query_editions = "SELECT id_date, id_course, code, name FROM %lms_course_date WHERE id_course='" . (int) $sel_course . "' ";
        }
        $res_editions = $db->query($query_editions);
        if (sql_num_rows($res_editions) > 0) {
            while (list($id_edition, $id_course, $code, $name) = $db->fetch_row($res_editions)) {
                $table_head_style[] = 'align_center';
                $date_info = $date_man->getDateInfo($id_edition);
                $table_head_content[] = $name . '<br />' . $lang->def('_DATE_BEGIN') . ': ' . Format::date($date_info['date_begin'], 'date') . '<br />' . $lang->def('_DATE_END') . ': ' . Format::date($date_info['date_end'], 'date') . '<br />' . $lang->def('_AVAIL_PLACES') . ': <span id="available_places_count_' . $id_edition . '">' . (int) ($date_info['max_par'] - $date_info['user_subscribed']) . '</span> (' . $date_info['max_par'] . ')';
                $editions[] = $id_edition;
                $subscribed[$id_edition] = $date_man->getDateSubscribed($id_edition);
            }
        } else {
        }
    }
    //retrieve expiration time for every user
    $expiries = array();
    $query_check = "SELECT id_user, date_expire " . " FROM %lms_competence_user " . " WHERE id_user IN (" . implode(",", $array_users) . ") AND id_competence='" . (int) $sel_competence . "'";
    $res_check = $db->query($query_check);
    while (list($id_user, $date_expire) = $db->fetch_row($res_check)) {
        $expiries[$id_user] = $date_expire;
    }
    //filter array of user ids by competence
    $filtered_users = array();
    //------------------------------------------------------------------------------
    $required_filter = Get::req('required_filter', DOTY_INT, 0);
    $expire_duration = $man_competences->getCompetenceExpirationCheckTime($id_comp);
    if ($is_retraining || $required_filter > 0) {
        $query_filter_time = "";
        if ($expire_duration > 0) {
            //if a time for checking expiration has been set, then filter on a time period
            $date_begin = date("Y-m-d", strtotime("-" . $expire_duration . " days"));
            $date_end = date("Y-m-d", strtotime("+" . $expire_duration . " days"));
            $query_filter_time = " AND date_expire>'" . $date_begin . "' AND date_expire<'" . $date_end . "'";
        }
        $query_filter = "SELECT id_user FROM %lms_competence_user WHERE id_user IN (" . implode(",", $array_users) . ") AND id_competence='" . (int) $sel_competence . "' " . $query_filter_time;
        $res_filter = $db->query($query_filter);
        while (list($idst) = $db->fetch_row($res_filter)) {
            $filtered_users[] = $idst;
        }
    }
    if (!$is_retraining || $required_filter > 0) {
        //get user with required competence which is not yet obtained
        $required_users = array();
        $req_data = $man_competences->GetCompetence($sel_competence);
        $already = array();
        $query = "SELECT id_user, score_init, score_got FROM %lms_competence_user WHERE id_competence='" . (int) $sel_competence . "'";
        $res = $db->query($query);
        while (list($id_user, $score_init, $score_got) = $db->fetch_row($res)) {
            if ($req_data['type'] == 'score') {
                //if the competence assignment exists in DB, but the total score is 0, then it's considered as non-assigned
                if ((int) $score_init + (int) $score_got > 0) {
                    $already[] = $id_user;
                }
            } else {
                $already[] = $id_user;
            }
        }
        $already = array_unique($already);
        $req_users = array_diff($array_users, $already);
        //get required competences not got from users
        $query = "";
        if ($req_data['type'] == 'score') {
            $query = "SELECT u.idst FROM %lms_competence_required as cr " . " JOIN %adm_user as u ON (cr.idst = u.idst)" . " WHERE cr.idst IN (" . implode(",", $req_users) . ") AND cr.id_competence=" . (int) $sel_competence . "";
        } else {
            $query = "SELECT u.idst FROM %lms_competence_required as cr " . " JOIN %adm_user as u ON (cr.idst = u.idst) " . " WHERE cr.idst IN (" . implode(",", $req_users) . ") AND cr.id_competence=" . (int) $sel_competence . "";
        }
        $res = $db->query($query);
        if (sql_num_rows($res) > 0) {
            while (list($idst) = $db->fetch_row($res)) {
                $required_users[] = $idst;
            }
        }
        //get users expired from too long time
        if ($expire_duration > 0) {
            $query = "SELECT id_user FROM %lms_competence_user " . " WHERE date_expire<'" . date("Y-m-d", strtotime("-" . $expire_duration . " days")) . "' AND date_expire<>'0000-00-00 00:00:00' " . " AND id_competence=" . (int) $sel_competence;
            $res = $db->query($query);
            while (list($idst) = $db->fetch_row($res)) {
                $required_users[] = $idst;
            }
        }
        //merge results
        if (count($required_users) > 0) {
            if (count($filtered_users) > 0) {
                $filtered_users = array_merge($filtered_users, $required_users);
            } else {
                $filtered_users = $required_users;
            }
        }
    }
    //------------------------------------------------------------------------------
    $filtered_users = array_unique($filtered_users);
    //draw table
    $table = new Table(0);
    $form = new Form();
    $table->addHead($table_head_content, $table_head_style);
    $totals = array();
    for ($i = 0; $i < count($editions); $i++) {
        $totals[$i] = 0;
    }
    //check the expiration time  of the current competence
    list($expiry_time) = $db->fetch_row($db->query("SELECT expiration FROM %lms_competence WHERE id_competence='" . (int) $sel_competence . "'"));
    if ($expiry_time === false) {
        //error, we need a number (it should never enter this branch though)
        //error, no competences
        cout($back_ui . $lang->def('_NO_EXPIRATION_TIME') . $back_ui, 'content');
        return;
    }
    $checkbox_list_script = array();
    foreach ($editions as $id_edition) {
        $checkbox_list_script[$id_edition] = array();
    }
    $expiring_users_count = 0;
    $req_count = 0;
    //filtered data to consider in saving operation
    $to_consider = array('users' => array(), 'editions' => array());
    for ($i = 0; $i < count($editions); $i++) {
        $to_consider['editions'][] = $editions[$i];
    }
    //retrieve users' data for table rows (little fast query)
    if (count($filtered_users) > 0) {
        $query_users = "SELECT idst, userid, lastname, firstname FROM %adm_user WHERE idst IN (" . implode(",", $filtered_users) . ") ORDER BY userid, lastname, firstname";
        $res_users = $db->query($query_users);
        //retrieve users with required competence
        $just_required = array();
        $query_req = "SELECT idst FROM %lms_competence_required " . " WHERE id_competence=" . (int) $sel_competence . " AND idst IN (" . implode(",", $filtered_users) . ")";
        $res_req = $db->query($query_req);
        while (list($idst) = $db->fetch_row($res_req)) {
            $just_required[] = $idst;
        }
        while (list($idst, $userid, $firstname, $lastname) = $db->fetch_row($res_users)) {
            $line = array();
            //filtered users to consider in saving operations
            $to_consider['users'][] = $idst;
            //check if the expiring date of the competence is less than 30 days from now or it's already expired (change bg color then)
            $user_expiring = false;
            $background = "";
            if ($expiry_time > 0) {
                if (isset($expiries[$idst])) {
                    //$time1 = fromDateTimeToTimestamp($expiries[$idst]) + $expiry_time * 24 * 3600;
                    //$time2 = time();
                    //if (($time2-$time1) < 2592000) $user_expiring = true;
                    if ($expiries[$idst] < date("Y-m-d H:i:s")) {
                        $user_expiring = true;
                    }
                }
            }
            if ($user_expiring) {
                $background .= 'bg_highlight';
                $expiring_users_count++;
            }
            $line[] = $acl_man->relativeId($userid) . "&nbsp;(" . $firstname . "&nbsp;" . $lastname . ")";
            //swap these
            $is_req = in_array($idst, $just_required);
            if ($is_req) {
                $req_count++;
            }
            $line[] = $is_req ? '<image src="' . getPathImage('framework') . 'standard/flag.gif" />' : '';
            $line[] = '<div class="' . $background . '">' . (isset($expiries[$idst]) ? Format::date($expiries[$idst], "date") : '-') . '</div>';
            for ($i = 0; $i < count($editions); $i++) {
                //check if the actual considered user is subscribed to this class' edition (then flag the checkbox)
                $is_subscribed = false;
                if (isset($subscribed[$editions[$i]][$idst])) {
                    $is_subscribed = true;
                    $totals[$i]++;
                    //update total subscriptions
                }
                if ($course_info['course_type'] == 'elearning') {
                    $line[] = '<div class="align_center">' . $form->getInputCheckbox('subscriptions_' . $idst, 'subscriptions[' . $idst . '][' . $editions[$i] . ']', 1, $is_subscribed, false) . '</div>';
                    $checkbox_list_script[$editions[$i]][] = '"subscriptions_' . $idst . '"';
                } elseif ($course_info['course_type'] == 'classroom') {
                    $line[] = '<div class="align_center">' . $form->getInputCheckbox('subscriptions_' . $idst . '_' . $editions[$i], 'subscriptions[' . $idst . '][' . $editions[$i] . ']', 1, $is_subscribed, false) . '</div>';
                    $checkbox_list_script[$editions[$i]][] = '"subscriptions_' . $idst . '_' . $editions[$i] . '"';
                }
            }
            $table->addBody($line);
        }
    }
    //totals line
    $line = array();
    $line[] = $lang->def('_TOTAL');
    $line[] = '<div class="align_center">' . (int) $req_count . '</div>';
    $line[] = '<div class="align_center">' . (int) $expiring_users_count . '</div>';
    for ($i = 0; $i < count($editions); $i++) {
        $line[] = '<div class="align_center">' . (int) $totals[$i] . '</div>';
    }
    $table->addFoot($line);
    //echo '<pre class="align_left">'.print_r($checkbox_list_script, true).'</pre>';
    //script to check available places in real-time
    $avail_script = '<script type="text/javascript">
			function setupAvailablePlaces() {';
    foreach ($editions as $id_edition) {
        $date_info = $date_man->getDateInfo($id_edition);
        $avail_script .= '
				YAHOO.util.Event.addListener([' . implode(',', $checkbox_list_script[$id_edition]) . '], "click", function(e, o) {
					max_avail_places_' . $id_edition . ' = ' . (int) ($date_info['max_par'] - $date_info['user_subscribed']) . ';
					var i, edition_boxes = YAHOO.util.Dom.get([' . implode(',', $checkbox_list_script[$id_edition]) . ']);
					var edition_count = 0, edition_max = ' . (int) $date_info['max_par'] . ';
					for (i=0; i<edition_boxes.length; i++) {
						if (edition_boxes[i].checked) edition_count++;
					}
					YAHOO.util.Dom.get("available_places_count_' . $id_edition . '").innerHTML = ""+(edition_max - edition_count);
					if (edition_count >= edition_max) {
						for (i=0; i<edition_boxes.length; i++) {
							if (!edition_boxes[i].checked) edition_boxes[i].disabled = true;
						}
					} else {
						for (i=0; i<edition_boxes.length; i++) {
							if (edition_boxes[i].disabled) edition_boxes[i].disabled = false;
						}
					}
				});';
    }
    $avail_script .= '}
			setupAvailablePlaces();
		</script>';
    cout($avail_script, 'page_head');
    //any error message from previous operations?
    $message = "";
    $err = Get::req('err', DOTY_MIXED, false);
    switch ($err) {
        case 'invalid':
            $message .= getErrorUi($lang->def('_ERROR_WHILE_SUBSCRIBING') . '.');
            break;
        case 'ok':
            $content = $lang->def('_SUBSCRIBE_SUCCESSFULL');
            $count = Get::req('count', DOTY_MIXED, false);
            if ($count !== false && is_numeric($count)) {
                $content .= "&nbsp;(" . $lang->def('_NUM_SUBSCRIBED') . ":&nbsp;" . $count . ")";
            }
            $message .= getResultUi($content);
            break;
    }
    //print page
    cout(getTitleArea($lang->def('_COURSEPANEL'), 'coursepanel') . '<div class="std_block">' . $message . $back_ui, 'content');
    cout('<link rel="stylesheet" type="text/css" href="' . Get::rel_path('base') . '/addons/yui/grids/grids-min.css">', 'page_head');
    $comps_list = $man_competences->GetCompetencesList();
    //write period of checking for expiration, from beginning date to ending date
    $date_1 = $expire_duration > 0 ? date("Y-m-d H:i:s", strtotime("-" . $expire_duration . " days")) : "";
    $date_2 = $expire_duration > 0 ? date("Y-m-d H:i:s", strtotime("+" . $expire_duration . " days")) : "";
    if ($date_1 != "" && $date_2 != "") {
        $date_period = Format::date($date_1, "date") . ' - ' . Format::date($date_2, "date");
    } else {
        $date_period = '(' . $lang->def('_ALL') . ')';
    }
    $selector = "";
    //$selector .= $form->openElementSpace();
    $selector .= '<div class="yui-g"><div id="select_1" class="yui-u first align_left">';
    $selector .= $form->openForm('action_panel', "index.php?modname=public_coursepanel&op=coursepanel");
    $selector .= $form->openElementSpace();
    $selector .= '<p class="align_left">' . $lang->def('_EXPIRING_USERS_FOR_PERIOD') . ':&nbsp;<b>' . $date_period . '</b>;</p>';
    //$selector .= $lang->def('_FOR_COMPETENCE').':&nbsp;';
    $selector .= $form->getDropDown($lang->def('_FOR_COMPETENCE') . ':&nbsp;', 'competence_selector', 'sel_competence', $comps_names, $sel_competence, '');
    $selector .= $form->getDropDown($lang->def('_FOR_COURSE') . ':&nbsp;', 'course_selector', 'sel_course', $courses_dropdown[$sel_competence], $sel_course, '');
    $selector .= $form->openButtonSpace();
    $selector .= $form->getButton('update', 'update', $lang->def('_UPDATE'));
    $selector .= $form->closeButtonSpace();
    $selector .= $form->closeElementSpace();
    $selector .= $form->closeForm();
    $selector .= '</div><div id="select_2" class="yui-u align_left">';
    //if (count($comps_list)>0) { ...
    $selector .= $form->openElementSpace();
    $selector .= $form->openForm('action_panel', "index.php?modname=public_coursepanel&op=expired");
    $selector .= $form->getHidden('expire_sel_competence', 'sel_competence', $sel_competence);
    $selector .= $form->getHidden('expire_sel_course', 'sel_course', $sel_course);
    $selector .= $form->getDropdown($lang->def('_CHOOSE_COMPETENCE_TO_SEE_EXPIRED'), 'expired_selector', 'expired_selector', $comps_list);
    $selector .= $form->openButtonSpace();
    $selector .= $form->getButton('update_expired', 'update_expired', $lang->def('_UPDATE'));
    $selector .= $form->closeButtonSpace();
    $selector .= $form->closeForm();
    $selector .= $form->getBreakRow();
    $selector .= $form->openForm('action_panel', "index.php?modname=public_coursepanel&op=required");
    $selector .= $form->getHidden('expire_sel_competence_req', 'sel_competence_req', $sel_competence);
    $selector .= $form->getHidden('expire_sel_course_req', 'sel_course_req', $sel_course);
    $selector .= $form->getDropDown($lang->def('_CHOOSE_REQUIRED_COMPETENCES'), 'required_selector', 'required_selector', $comps_list);
    $selector .= $form->openButtonSpace();
    $selector .= $form->getButton('update_required', 'update_required', $lang->def('_UPDATE'));
    $selector .= $form->closeButtonSpace();
    $selector .= $form->closeForm();
    $selector .= $form->closeElementSpace();
    $selector .= '</div></div><div class="no_float"></div>';
    //$selector .= $form->closeElementSpace();
    //legend which explains what highlighted users mean
    $legend = '<div class="align_left"><div style="display:inline-block;width:12px;height:12px;" class="bg_highlight"></div> = ' . $lang->def('_EXPIRED_COMPETENCE') . '</div>';
    cout('<div class="align_center">' . $selector . '</div>', 'content');
    cout($form->openForm('comp_panel', "index.php?modname=public_coursepanel&op=savepanel"), 'content');
    cout($form->getHidden('sel_competence', 'sel_competence', $sel_competence), 'content');
    cout($form->getHidden('sel_course', 'sel_course', $sel_course), 'content');
    cout($form->openElementSpace(), 'content');
    cout('<div class="align_left">', 'content');
    if ($is_retraining) {
        cout($form->getCheckbox($lang->def('_SHOW_REQUIRED'), 'required_filter', 'required_filter', 1, $required_filter), 'content');
    } else {
        cout($form->getCheckbox($lang->def('_SHOW_EXPIRED'), 'required_filter', 'required_filter', 1, $required_filter), 'content');
    }
    cout('</div>', 'content');
    cout($form->closeElementSpace(), 'content');
    cout('<div class="align_left">', 'content');
    cout('<p>' . ($is_retraining ? $lang->def('_IS_RETRAINING_COURSE') : $lang->def('_IS_TRAINING_COURSE')) . '</p>', 'content');
    if ($course_info['course_type'] == 'classroom' && $course_check_time > 0) {
        $check_date_1 = Format::date(date("Y-m-d"), "date");
        $check_date_2 = Format::date(date("Y-m-d H:i:s", strtotime("+" . $course_check_time . " days")), "date");
        cout('<p>' . $lang->def('_COURSE_CHECKING_PERIOD') . ': ' . $check_date_1 . ' - ' . $check_date_2 . '</p>', 'content');
    }
    cout('</div>', 'content');
    if (empty($editions)) {
        //no editions to display (it should have been pre-selected only courses with available editions)
        cout('<p>' . $lang->def('_NO_CONTENT') . '</p>', 'content');
    } else {
        cout($table->getTable(), 'content');
    }
    cout($legend, 'content');
    cout($form->getHidden('to_consider', 'to_consider', base64_encode($json->encode($to_consider))), 'content');
    cout($form->openButtonSpace() . $form->getButton('save', 'save', $lang->def('_SAVE')) . $form->getButton('undo', 'undo', $lang->def('_UNDO')) . $form->closeButtonSpace(), 'content');
    cout($form->closeForm() . $back_ui . '</div>', 'content');
    cout('<script type="text/javascript">
			YAHOO.util.Event.addListener("required_filter", "click", function(e) {
				var show_required = this.checked, comp_form = YAHOO.util.Dom.get("comp_panel");
				comp_form.action = comp_form.action.replace("&op=savepanel", "&op=coursepanel");
				comp_form.submit();
			});
		</script>', 'page_head');
}
Example #14
0
function report_modify_columns()
{
    checkPerm('mod');
    require_once _base_ . '/lib/lib.form.php';
    $ref =& $_SESSION['report_tempdata']['columns_filter_category'];
    if (isset($_POST['columns_filter'])) {
        $ref = $_POST['columns_filter'];
    }
    $idrep = Get::req('modid', DOTY_INT, false);
    $lang =& DoceboLanguage::createInstance('report');
    $obj_report = openreport();
    $obj_report->back_url = 'index.php?modname=report&op=modify_rows&modid=' . $idrep;
    $obj_report->jump_url = 'index.php?modname=report&op=modify_cols&modid=' . $idrep;
    $obj_report->next_url = 'index.php?modname=report&op=report_save&modid=' . $idrep;
    //page title
    $page_title = getTitleArea(array('index.php?modname=report&amp;op=reportlist' => $lang->def('_REPORT'), 'index.php?modname=report&op=modify_name&modid=' . $idrep => $lang->def('_MOD'), 'index.php?modname=report&op=modify_rows&modid=' . $idrep => $lang->def('_REPORT_MOD_ROWS'), $lang->def('_REPORT_MOD_COLUMNS'))) . '<div class="std_block">';
    /*$info = get_update_info();
    	if($info) cout( getInfoUi($info) );*/
    if ($obj_report->useStandardTitle_Columns()) {
        cout($page_title);
        $info = get_update_info();
        if ($info) {
            cout(getInfoUi($info));
        }
        cout(Form::openForm('user_report_columns_courses_mod', $obj_report->jump_url));
    } else {
        //this is used just to pass std title string to object functions, who may use it
        $obj_report->page_title = $page_title;
    }
    $obj_report->get_columns_filter($_SESSION['report_tempdata']['columns_filter_category']);
    if ($obj_report->useStandardTitle_Columns()) {
        cout(Form::openButtonSpace());
        cout(Form::getBreakRow() . Form::getButton('pre_filter', 'pre_filter', $lang->def('_SHOW_NOSAVE', 'report')) . Form::getButton('ok_filter', 'import_filter', $lang->def('_SAVE_BACK', 'report')) . Form::getButton('show_filter', 'show_filter', $lang->def('_SAVE_SHOW', 'report')) . Form::getButton('undo_filter', 'undo_filter', $lang->def('_UNDO', 'report')));
        cout(Form::closeButtonSpace());
        cout(Form::closeForm());
        cout('</div>');
        //close std_block div
    }
}
Example #15
0
function editmodule($load = false)
{
    checkPerm('mod');
    require_once _base_ . '/lib/lib.form.php';
    Util::get_js(Get::rel_path('base') . '/lib/js_utils.js', true, true);
    $lang =& DoceboLanguage::createInstance('manmenu', 'framework');
    $menu_lang =& DoceboLanguage::createInstance('menu_course', 'lms');
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $id_main = Get::req('id_main', DOTY_INT, 0);
    $id_module = Get::req('id_module', DOTY_INT, 0);
    $acl_man =& Docebo::user()->getAclManager();
    $perm = array();
    // Load module info
    $query_module = "\r\n\tSELECT module_name, default_name, file_name, class_name \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_module \r\n\tWHERE idModule = '" . $id_module . "'";
    list($module_name, $name_db, $file_name, $class_name) = sql_fetch_row(sql_query($query_module));
    $module_obj =& createModule($module_name);
    // Standard name
    $name = Lang::t($name_db, 'menu_course', false, false, $name_db);
    $my_name = '';
    $query_module = "\r\n\tSELECT default_op \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_module \r\n\tWHERE idModule = '" . $id_module . "'";
    list($module_op) = sql_fetch_row(sql_query($query_module));
    // Load info
    if ($load) {
        // Find personalized name
        $query_seq = "\r\n\t\tSELECT u.my_name, m.default_op \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_menucourse_under AS u JOIN\r\n\t\t\t" . $GLOBALS['prefix_lms'] . "_module AS m \r\n\t\tWHERE u.idModule = m.idModule AND u.idMain = '" . $id_main . "' AND u.idModule = '" . $id_module . "'";
        list($my_name, $def_op) = sql_fetch_row(sql_query($query_seq));
        // Load actual module permission
        $levels = CourseLevel::getLevels();
        $tokens = $module_obj->getAllToken($module_op);
        $map_level_idst =& getCourseLevelSt($_SESSION['idCourse']);
        $map_all_role =& getModuleRoleSt($module_name, $tokens, TRUE);
        $group_idst_roles =& getAllModulesPermissionSt($map_level_idst, $map_all_role);
        $perm =& fromStToToken($group_idst_roles, $map_all_role);
    }
    $query_mains = "\r\n\tSELECT idMain, name \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_menucourse_main \r\n\tWHERE idCourse = '" . $_SESSION['idCourse'] . "'\r\n\tORDER BY sequence";
    $re_mains = sql_query($query_mains);
    while (list($id_db_main, $main_name) = sql_fetch_row($re_mains)) {
        $mains[$id_db_main] = $main_name;
        if ($id_db_main == $id_main) {
            $title_main = $main_name;
        }
    }
    // Form
    $page_title = array('index.php?modname=manmenu&amp;op=manmenu' => $lang->def('_TITLE_MANMENU'), 'index.php?modname=manmenu&amp;op=manmodule&amp;id_main=' . $id_main => $title_main, $my_name != '' ? $my_name : $name);
    $out->add(getTitleArea($page_title, 'manmenu') . '<div class="std_block">' . getBackUi('index.php?modname=manmenu&amp;op=manmodule&amp;id_main=' . $id_main, $lang->def('_BACK')) . Form::openForm('module_permission', 'index.php?modname=manmenu&amp;op=upmodule&amp;id_main=' . $id_main . '&amp;id_module=' . $id_module) . Form::getHidden('id_main', 'id_main', $id_main) . Form::getHidden('id_module', 'id_module', $id_module) . ($load ? Form::getHidden('load', 'load', '1') : '') . Form::getTextfield($lang->def('_MY_NAME'), 'my_name', 'my_name', 255, $load ? $my_name : '') . Form::getDropdown($lang->def('_TITLE_MENUVOICE'), 'new_id_main', 'new_id_main', $mains, $id_main) . Form::getBreakRow() . $module_obj->getPermissionUi('module_permission', $perm, $module_op) . Form::getBreakRow() . Form::openButtonSpace() . Form::getButton('saveperm', 'saveperm', $load ? $lang->def('_SAVE') : $lang->def('_IMPORT')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>');
}
 public function gettreedata()
 {
     $command = Get::req('command', DOTY_ALPHANUM, "");
     switch ($command) {
         case "expand":
             //check permissions
             if (!$this->permissions['view_org']) {
                 $output = array('success' => false, 'message' => $this->_getErrorMessage('no permission'));
                 echo $this->json->encode($output);
                 return;
             }
             $idOrg = Get::req('node_id', DOTY_INT, -1);
             $initial = Get::req('initial', DOTY_INT, 0) > 0 ? true : false;
             if ($initial) {
                 //get selected node from session and set the expanded tree
                 $idOrg = $this->_getSessionValue('selected_node', 0);
                 //$this->_getSelectedNode();
                 $nodes = $this->model->getOrgChartInitialNodes($idOrg, true);
                 //create actions for every node
                 $this->_assignActions($nodes);
                 //set output
                 if (is_array($nodes)) {
                     $output = array('success' => true, 'nodes' => $nodes, 'initial' => $initial);
                 } else {
                     $output = array('success' => false);
                 }
             } else {
                 //extract node data
                 $nodes = $this->model->getOrgChartNodes($idOrg, false, false, true);
                 //create actions for every node
                 for ($i = 0; $i < count($nodes); $i++) {
                     $nodes[$i]['options'] = $this->_getNodeActions($nodes[$i]);
                 }
                 //set output
                 $output = array('success' => true, 'nodes' => $nodes, 'initial' => $initial);
             }
             echo $this->json->encode($output);
             break;
         case "set_selected_node":
             $idOrg = Get::req('node_id', DOTY_INT, -1);
             $this->_setSessionValue('selected_node', $idOrg);
             //_setSelectedNode($idOrg);
             break;
         case "delete":
             //check permissions
             if (!$this->permissions['del_org']) {
                 $output = array('success' => false, 'message' => $this->_getErrorMessage('no permission'));
                 echo $this->json->encode($output);
                 return;
             }
             $this->delfolder();
             break;
         case "getmodform":
             //check permissions
             if (!$this->permissions['mod_org']) {
                 $output = array('success' => false, 'message' => $this->_getErrorMessage('no permission'));
                 echo $this->json->encode($output);
                 return;
             }
             $output = array();
             $id = Get::req('node_id', DOTY_INT, -1);
             if ($id < 0) {
                 $output = array('success' => false, 'message' => Lang::t('_INVALID_INPUT'));
             } else {
                 if ($id == 0) {
                     $root_name = Get::sett('title_organigram_chart', Lang::t('_ORG_CHART', 'organization_chart'));
                     $body = Form::openForm('modfolder_form', "ajax.adm_server.php?r=" . $this->link . "/modrootfolder") . '<p id="addfolder_error_message"></p>' . Form::getTextfield(Lang::t('_ROOT_RENAME', 'organization_chart'), 'modfolder_root', 'modfolder_root', 50, $root_name) . Form::closeForm();
                 } else {
                     $folder_info = $this->model->getFolderById($id);
                     $languages = Docebo::langManager()->getAllLanguages(true);
                     //getAllLangCode();
                     $std_lang = getLanguage();
                     $template = !empty($folder_info->associated_template) ? $folder_info->associated_template : getDefaultTemplate();
                     $template_arr = getTemplateList();
                     $template_tmp_arr = array_flip($template_arr);
                     $template_id = $template_tmp_arr[$template];
                     unset($template_tmp_arr);
                     $form_content = Form::getHidden('modfolder_id', 'node_id', $id);
                     $form_content .= Form::getTextfield(Lang::t('_CODE', 'organization_chart'), 'org_code', 'org_code', 50, $folder_info->code);
                     $form_content .= Form::getDropdown(Lang::t('_DEFAULTTEMPLATE', 'configuration'), 'associated_template', 'associated_template', $template_arr, $template_id);
                     $form_content .= Form::getBreakRow();
                     $translations = $this->model->getFolderTranslations($id, true);
                     foreach ($languages as $language) {
                         $lang_code = $language['code'];
                         $lang_name = $language['description'];
                         $translation = isset($translations[$lang_code]) ? $translations[$lang_code] : "";
                         $form_content .= Form::getTextfield($lang_name, 'modfolder_' . $lang_code, 'modfolder[' . $lang_code . ']', 255, $translation);
                     }
                     $body = Form::openForm('modfolder_form', "ajax.adm_server.php?r=" . $this->link . "/modfolder") . '<p id="addfolder_error_message"></p>' . $form_content . Form::closeForm();
                 }
                 $output = array('success' => true, 'body' => $body);
             }
             echo $this->json->encode($output);
             break;
         case "assignfields":
             //check permissions
             if (!$this->permissions['mod_org']) {
                 $output = array('success' => false, 'message' => $this->_getErrorMessage('no permission'));
                 echo $this->json->encode($output);
                 return;
             }
             $this->assignfields();
             break;
         case "options":
             //check permissions
             if (!$this->permissions['view_org']) {
                 $output = array('success' => false, 'message' => $this->_getErrorMessage('no permission'));
                 echo $this->json->encode($output);
                 return;
             }
             $id = Get::req('node_id', DOTY_INT, -1);
             $output = array();
             if ($id <= 0) {
                 $output['success'] = false;
             } else {
                 $output['success'] = true;
                 $output['options'] = $this->_getNodeActions($id);
             }
             echo $this->json->encode($output);
             break;
         case "movefolder":
             //check permissions
             if (!$this->permissions['mod_org']) {
                 $output = array('success' => false, 'message' => $this->_getErrorMessage('no permission'));
                 echo $this->json->encode($output);
                 return;
             }
             $src_folder = Get::req('src', DOTY_INT, -1);
             $dest_folder = Get::req('dest', DOTY_INT, -1);
             $output = array();
             if ($this->model->moveFolder($src_folder, $dest_folder)) {
                 $output['success'] = true;
             } else {
                 $output['success'] = false;
             }
             echo $this->json->encode($output);
             break;
         default:
             $output = array();
             $output['success'] = false;
             echo $this->json->encode($output);
     }
     // end switch
 }
 function get_delay_filter()
 {
     $back_url = $this->back_url;
     $jump_url = $this->jump_url;
     $next_url = $this->next_url;
     require_once _base_ . '/lib/lib.form.php';
     require_once _lms_ . '/lib/lib.course.php';
     //back to columns category selection
     if (isset($_POST['undo_filter'])) {
         //go back at the previous step
         Util::jump_to($back_url);
     }
     //set $_POST data in $_SESSION['report_tempdata']
     $ref =& $_SESSION['report_tempdata']['columns_filter'];
     $selector = new Selector_Course();
     if (isset($_POST['update_tempdata'])) {
         $selector->parseForState($_POST);
         $temp = array('report_type_completed' => $_POST['report_type'] == "course_completed" || $_POST['report_type'] == "both" ? true : false, 'report_type_started' => $_POST['report_type'] == "course_started" || $_POST['report_type'] == "both" ? true : false, 'day_from_subscription' => $_POST['day_from_subscription'], 'day_until_course_end' => $_POST['day_until_course_end'], 'date_until_course_end' => Format::dateDb($_POST['date_until_course_end'], 'date'), 'org_chart_subdivision' => isset($_POST['org_chart_subdivision']) ? 1 : 0, 'all_courses' => $_POST['all_courses'] == 1 ? true : false, 'selected_courses' => $selector->getSelection(), 'showed_columns' => isset($_POST['cols']) ? $_POST['cols'] : array(), 'order_by' => Get::req('order_by', DOTY_STRING, 'userid'), 'order_dir' => Get::req('order_dir', DOTY_STRING, 'asc'), 'show_suspended' => Get::req('show_suspended', DOTY_INT, 0) > 0);
         $_SESSION['report_tempdata']['columns_filter'] = $temp;
         //$ref = $temp;
     } else {
         //first loading of this page -> prepare $_SESSION data structure
         //if (isset($_SESSION['report_update']) /* && is equal to id_report */) break;
         if (!isset($_SESSION['report_tempdata']['columns_filter'])) {
             $_SESSION['report_tempdata']['columns_filter'] = array('report_type_completed' => false, 'report_type_started' => false, 'day_from_subscription' => '', 'day_until_course_end' => '', 'date_until_course_end' => '', 'org_chart_subdivision' => 0, 'all_users' => false, 'all_courses' => true, 'selected_courses' => array(), 'showed_columns' => array(), 'order_by' => 'userid', 'order_dir' => 'asc', 'show_suspended' => false);
         }
     }
     //filter setting done, go to next step
     if (isset($_POST['import_filter']) || isset($_POST['show_filter']) || isset($_POST['pre_filter'])) {
         $temp_url = $next_url;
         if (isset($_POST['pre_filter'])) {
             $temp_url .= '&show=1&nosave=1';
         }
         if (isset($_POST['show_filter'])) {
             $temp_url .= '&show=1';
         }
         Util::jump_to($temp_url);
     }
     $lang = $this->lang;
     cout(Form::getHidden('update_tempdata', 'update_tempdata', 1), 'content');
     $array_report_type = array($lang->def('_COURSE_COMPLETED') => "course_completed", $lang->def('_COURSE_STARTED') => "course_started", $lang->def('_FILTER_ALL_CONDS') => "both");
     //box for rpeort options
     $box = new ReportBox('delay_options_box');
     $box->title = $lang->def('_REPORT_USER_TITLE_TIMEBELT');
     $box->description = $lang->def('_REPORT_USER_TITLE_TIMEBELT_DESC');
     $selected_radio = "both";
     if (!$ref['report_type_completed'] || !$ref['report_type_started']) {
         if ($ref['report_type_completed']) {
             $selected_radio = 'course_completed';
         }
         if ($ref['report_type_started']) {
             $selected_radio = 'course_started';
         }
     }
     $box->body = Form::getRadioSet('', 'report_type', 'report_type', $array_report_type, $selected_radio) . Form::getTextfield($lang->def('_DAY_FROM_SUBSCRIPTION'), 'day_from_subscription', 'day_from_subscription', 20, $ref['day_from_subscription']) . Form::getTextfield($lang->def('_DAY_UNTIL_COURSE_END'), 'day_until_course_end', 'day_until_course_end', 20, $ref['day_until_course_end']) . Form::getDatefield($lang->def('_DATE_UNTIL_COURSE_END'), 'date_until_course_end', 'date_until_course_end', Format::date($ref['date_until_course_end'], 'date')) . Form::getBreakRow();
     cout($box->get());
     YuiLib::load('datasource');
     Util::get_js(Get::rel_path('lms') . '/admin/modules/report/courses_filter.js', true, true);
     //box for direct course selection
     $selection =& $ref['selected_courses'];
     $selector->parseForState($_POST);
     $selector->resetSelection($selection);
     $temp = count($selection);
     $box = new ReportBox('course_selector');
     $box->title = $lang->def('_REPORT_COURSE_SELECTION');
     $box->description = false;
     $box->body .= '<div class="fc_filter_line filter_corr">';
     $box->body .= '<input id="all_courses" name="all_courses" type="radio" value="1" ' . ($ref['all_courses'] ? 'checked="checked"' : '') . ' />';
     $box->body .= ' <label for="all_courses">' . $lang->def('_ALL_COURSES') . '</label>';
     $box->body .= ' <input id="sel_courses" name="all_courses" type="radio" value="0" ' . ($ref['all_courses'] ? '' : 'checked="checked"') . ' />';
     $box->body .= ' <label for="sel_courses">' . $lang->def('_SEL_COURSES') . '</label>';
     $box->body .= '</div>';
     $box->body .= '<div id="selector_container"' . ($ref['all_courses'] ? ' style="display:none"' : '') . '>';
     //$box->body .= Form::openElementSpace();
     $box->body .= $selector->loadCourseSelector(true);
     //$box->body .= Form::closeElementSpace();
     $box->body .= '</div>';
     $box->footer = $lang->def('_CURRENT_SELECTION') . ':&nbsp;<span id="csel_foot">' . ($ref['all_courses'] ? $lang->def('_ALL') : ($temp != '' ? $temp : '0')) . '</span>';
     cout($box->get());
     cout('<script type="text/javascript">courses_count=' . ($temp == '' ? '0' : $temp) . ';' . 'courses_all="' . $lang->def('_ALL') . '";' . "\n" . 'YAHOO.util.Event.addListener(window, "load", courses_selector_init);</script>');
     $box = new ReportBox('columns_selector');
     $box->title = $lang->def('_SELECT_THE_DATA_COL_NEEDED');
     $box->description = false;
     $box->body = Form::getOpenFieldset($lang->def('_SHOWED_COLUMNS'));
     //backward compatibility
     $arr_check_columns = array();
     foreach ($ref['showed_columns'] as $_column_key) {
         $arr_check_columns[] = $this->_check_delay_column($_column_key);
     }
     foreach ($this->delay_columns as $delay_row) {
         if ($delay_row['select']) {
             //column is selectable
             $box->body .= Form::getCheckBox($delay_row['label'], 'col_' . $delay_row['key'], 'cols[]', $delay_row['key'], in_array($delay_row['key'], $arr_check_columns) ? true : false);
         }
     }
     $box->body .= Form::getCloseFieldset();
     cout($box->get());
     //other options
     $box = new ReportBox('other_options');
     $box->title = Lang::t('_OTHER_OPTION', 'course');
     $box->description = false;
     $sort_list = array('userid' => Lang::t('_USERID', 'standard'), 'firstname' => Lang::t('_FIRSTNAME', 'standard'), 'lastname' => Lang::t('_LASTNAME', 'standard'), 'email' => Lang::t('_EMAIL', 'standard'), 'status' => Lang::t('_STATUS', 'standard'), 'date_subscription' => Lang::t('_DATE_INSCR', 'report'), 'date_first_access' => Lang::t('_DATE_FIRST_ACCESS', 'standard'), 'date_last_access' => Lang::t('_DATE_LAST_ACCESS', 'standard'), 'date_complete' => Lang::t('_DATE_END', 'standard'));
     $dir_list = array('asc' => Lang::t('_ORD_ASC_TITLE', 'standard'), 'desc' => Lang::t('_ORD_DESC_TITLE', 'standard'));
     $sort_selected = array_key_exists($ref['order_by'], $sort_list) ? $ref['order_by'] : 'userid';
     $dir_selected = array_key_exists($ref['order_dir'], $dir_list) ? $ref['order_dir'] : 'asc';
     $sort_dir_dropdown = Form::getInputDropdown('', 'order_dir', 'order_dir', $dir_list, $dir_selected, '');
     $box->body .= Form::getDropdown(Lang::t('_ORDER_BY', 'standard'), 'order_by', 'order_by', $sort_list, $sort_selected, $sort_dir_dropdown);
     $box->body .= Form::getCheckbox(Lang::t('_SHOW_SUSPENDED', 'organization_chart'), 'show_suspended', 'show_suspended', 1, (bool) $ref['show_suspended']);
     cout($box->get());
 }
Example #18
0
Get::title(array('index.php?r=' . $base_link_course . '/show' => Lang::t('_COURSE', 'course'), $id_course === false ? Lang::t('_NEW_COURSE', 'course') : Lang::t('_MOD', 'course') . ': ' . ($course['code'] !== '' ? '[' . $course['code'] . '] ' : '') . $course['name']));
?>
<div class="std_block">
	<?php 
echo Form::openForm('maskcourse_form', 'index.php?r=' . $base_link_course . '/' . ($id_course === false ? 'newcourse' : 'modcourse'), false, 'post', 'multipart/form-data') . Form::getHidden('id_course', 'id_course', $id_course) . Form::openElementSpace() . ($id_course === false ? Form::getLineBox(Lang::t('_CATEGORY_SELECTED', 'course'), $name_category) . Form::getHidden('idCategory', 'idCategory', $_SESSION['course_category']['filter_status']['id_category']) : Form::getDropdown(Lang::t('_CATEGORY_SELECTED', 'course'), 'idCategory', 'idCategory', $model->getCategoryForDropdown(), $course['idCategory'])) . Form::getTextfield(Lang::t('_CODE', 'course'), 'course_code', 'course_code', '50', $course['code']) . Form::getTextfield(Lang::t('_COURSE_NAME', 'course'), 'course_name', 'course_name', '255', $course['name']);
if ($course['course_type'] == 'classroom' && $has_editions_or_classrooms) {
    //this is a classroom course with editions
    echo Form::getLineBox(Lang::t('_COURSE_TYPE', 'course'), $course_type['classroom']) . Form::getHidden('course_type', 'course_type', 'classroom');
} elseif ($course['course_edition'] > 0 && $has_editions_or_classrooms) {
    //this is a classroom course with editions
    echo Form::getLineBox(Lang::t('_COURSE_TYPE', 'course'), $course_type['edition']) . Form::getHidden('course_type', 'course_type', 'edition');
} else {
    //echo Form::getDropdown(Lang::t('_COURSE_TYPE', 'course'), 'course_type', 'course_type', $course_type, $course['course_type']);
    echo Form::getDropdown(Lang::t('_COURSE_TYPE', 'course'), 'course_type', 'course_type', $course_type, $id_course === false ? 'elearning' : $course['course_type']);
}
echo Form::getDropdown(Lang::t('_STATUS', 'course'), 'course_status', 'course_status', $status, $course['status']) . Form::getCheckbox(Lang::t('_DIRECT_PLAY', 'course'), 'direct_play', 'direct_play', '1', $course['direct_play'] == 1) . Form::getTextarea(Lang::t('_DESCRIPTION', 'course'), 'course_descr', 'course_descr', $course['description']) . ($id_course !== false && $course['course_type'] != 'elearning' ? Form::getCheckbox(Lang::t('_CASCADE_MOD_ON_EDITION', 'course'), 'cascade_on_ed', 'cascade_on_ed', 1) : '') . Form::closeElementSpace() . Form::openElementSpace() . Form::openCollasableFieldset(Lang::t('_DETAILS', 'course')) . ($id_course === false ? Form::getDropdown(Lang::t('_COURSE_MENU_TO_ASSIGN', 'course'), 'selected_menu', 'selected_menu', $menu_custom, $sel_custom) : '') . Form::getDropdown(Lang::t('_COURSE_LANG_METHOD', 'course'), 'course_lang', 'course_lang', $array_lang, array_search($course['lang_code'], $array_lang)) . Form::getDropdown(Lang::t('_DIFFICULTY', 'course'), 'course_difficult', 'course_difficult', $difficult_lang, $course['difficult']) . Form::getTextfield(Lang::t('_CREDITS', 'course'), 'credits', 'credits', '50', $course['credits']) . Form::getDropdown(Lang::t('_LABELS', 'label'), 'label', 'label', $label_model->getLabelFromDropdown(true), $id_course === false ? false : $label_model->getCourseLabel($course['idCourse'])) . Form::getCloseFieldset() . Form::openCollasableFieldset(Lang::t('_COURSE_SUBSCRIPTION', 'course')) . Form::getOpenCombo(Lang::t('_COURSE_SUBSRIBE', 'course')) . Form::getRadio(Lang::t('_COURSE_S_GODADMIN', 'course'), 'course_subs_godadmin', 'course_subs', '0', $course['subscribe_method'] == 0) . Form::getRadio(Lang::t('_COURSE_S_MODERATE', 'course'), 'course_subs_moderate', 'course_subs', '1', $course['subscribe_method'] == 1) . Form::getRadio(Lang::t('_COURSE_S_FREE', 'course'), 'course_subs_free', 'course_subs', '2', $course['subscribe_method'] == 2) . Form::getCloseCombo() . Form::getOpenCombo(Lang::t('_USER_CAN_SUBSCRIBE', 'course')) . Form::getRadio(Lang::t('_SUBSCRIPTION_CLOSED', 'course'), 'subscription_closed', 'can_subscribe', '0', $course['can_subscribe'] == 0) . Form::getRadio(Lang::t('_SUBSCRIPTION_OPEN', 'course'), 'subscription_open', 'can_subscribe', '1', $course['can_subscribe'] == 1) . Form::getRadio(Lang::t('_SUBSCRIPTION_IN_PERIOD', 'course') . ":", 'subscription_period', 'can_subscribe', '2', $course['can_subscribe'] == 2) . Form::getCloseCombo() . Form::getDatefield(Lang::t('_SUBSCRIPTION_DATE_BEGIN', 'course') . ":", 'sub_start_date', 'sub_start_date', $course['sub_start_date']) . Form::getDatefield(Lang::t('_SUBSCRIPTION_DATE_END', 'course') . ":", 'sub_end_date', 'sub_end_date', $course['sub_end_date']) . Form::getBreakRow() . Form::getOpenCombo(Lang::t('_USER_CAN_UNSUBSCRIBE', 'course')) . Form::getRadio(Lang::t('_COURSE_S_GODADMIN', 'course'), 'no_user_unsubscription', 'auto_unsubscribe', '0', $course['auto_unsubscribe'] == 0) . Form::getRadio(Lang::t('_COURSE_S_MODERATE', 'course'), 'moderated_user_unsubscription', 'auto_unsubscribe', '1', $course['auto_unsubscribe'] == 1) . Form::getRadio(Lang::t('_COURSE_S_FREE', 'course'), 'yes_user_unsubscription', 'auto_unsubscribe', '2', $course['auto_unsubscribe'] == 2) . Form::getCloseCombo() . Form::getDatefield(Lang::t('_UNSUBSCRIBE_DATE_LIMIT', 'course'), 'unsubscribe_date_limit', 'unsubscribe_date_limit', $unsubscribe_date_limit, FALSE, FALSE, '', '', Form::getInputCheckbox('use_unsubscribe_date_limit', 'use_unsubscribe_date_limit', 1, $use_unsubscribe_date_limit, '') . ' ') . Form::getBreakRow() . Form::getTextfield(Lang::t('_COURSE_AUTOREGISTRATION_CODE', 'course'), 'course_autoregistration_code', 'course_autoregistration_code', '255', $course['autoregistration_code']) . Form::getCheckbox(Lang::t('_RANDOM_COURSE_AUTOREGISTRATION_CODE', 'course'), 'random_course_autoregistration_code', 'random_course_autoregistration_code', 0) . Form::getBreakRow() . Form::getCheckbox(Lang::t('_COURSE_SELL', 'course'), 'course_sell', 'course_sell', '1', $course['selling'] == 1) . Form::getTextfield(Lang::t('_COURSE_PRIZE', 'course'), 'course_prize', 'course_prize', '11', $course['prize']) . Form::getTextfield(Lang::t('_COURSE_ADVANCE', 'course'), 'advance', 'advance', '11', $course['advance']) . Form::getHidden('course_em', 'course_em', '0') . Form::getCloseFieldset() . Form::openCollasableFieldset(Lang::t('_COURSE_DISPLAY_MODE', 'course')) . Form::getOpenCombo(Lang::t('_WHERE_SHOW_COURSE', 'course')) . Form::getRadio(Lang::t('_SC_EVERYWHERE', 'course'), 'course_show_rules_every', 'course_show_rules', '0', $course['show_rules'] == 0) . Form::getRadio(Lang::t('_SC_ONLY_IN', 'course'), 'course_show_rules_only_in', 'course_show_rules', '1', $course['show_rules'] == 1) . Form::getRadio(Lang::t('_SC_ONLYINSC_USER', 'course'), 'course_show_rules_onlyinsc_user', 'course_show_rules', '2', $course['show_rules'] == 2) . Form::getCloseCombo() . Form::getOpenCombo(Lang::t('_WHAT_SHOW', 'course')) . Form::getCheckbox(Lang::t('_SHOW_PROGRESS', 'course'), 'course_progress', 'course_progress', '1', $course['show_progress'] == 1) . Form::getCheckbox(Lang::t('_SHOW_TIME', 'course'), 'course_time', 'course_time', '1', $course['show_time'] == 1) . Form::getCheckbox(Lang::t('_SHOW_ADVANCED_INFO', 'course'), 'course_advanced', 'course_advanced', '1', $course['show_extra_info'] == 1) . Form::getCloseCombo() . Form::getDropdown(Lang::t('_SHOW_WHOISONLINE', 'course'), 'show_who_online', 'show_who_online', $show_who_online, $course['show_who_online']) . Form::getOpenCombo(Lang::t('_SHOW_USER_OF_LEVEL', 'course'));
while (list($level, $level_name) = each($levels)) {
    echo Form::getCheckbox($level_name, 'course_show_level_' . $level, 'course_show_level[' . $level . ']', $level, $course['level_show_user'] & 1 << $level);
}
echo Form::getCloseCombo() . Form::getOpenCombo(Lang::t('_COURSE_STATUS_CANNOT_ENTER', 'course')) . Form::getCheckbox(Lang::t('_USER_STATUS_SUBS', 'course'), 'user_status_' . _CUS_SUBSCRIBED, 'user_status[' . _CUS_SUBSCRIBED . ']', _CUS_SUBSCRIBED, $course['userStatusOp'] & 1 << _CUS_SUBSCRIBED) . Form::getCheckbox(Lang::t('_USER_STATUS_BEGIN', 'course'), 'user_status_' . _CUS_BEGIN, 'user_status[' . _CUS_BEGIN . ']', _CUS_BEGIN, $course['userStatusOp'] & 1 << _CUS_BEGIN) . Form::getCheckbox(Lang::t('_USER_STATUS_END', 'course'), 'user_status_' . _CUS_END, 'user_status[' . _CUS_END . ']', _CUS_END, $course['userStatusOp'] & 1 << _CUS_END) . Form::getCheckbox(Lang::t('_USER_STATUS_SUSPEND', 'course'), 'user_status_' . _CUS_SUSPEND, 'user_status[' . _CUS_SUSPEND . ']', _CUS_SUSPEND, $course['userStatusOp'] & 1 << _CUS_SUSPEND) . Form::getCloseCombo() . Form::getCloseFieldset() . Form::openCollasableFieldset(Lang::t('_COURSE_TIME_OPTION', 'course')) . Form::getDatefield(Lang::t('_DATE_BEGIN', 'course'), 'course_date_begin', 'course_date_begin', $course['date_begin']) . Form::getDatefield(Lang::t('_DATE_END', 'course'), 'course_date_end', 'course_date_end', $course['date_end']) . Form::getLineBox('<label for="hour_begin_hour">' . Lang::t('_HOUR_BEGIN', 'course') . '</label>', Form::getInputDropdown('dropdown_nw', 'hour_begin_hour', 'hour_begin[hour]', $hours, $hb_sel, '') . ' : ' . Form::getInputDropdown('dropdown_nw', 'hour_begin_quarter', 'hour_begin[quarter]', $quarter, $qe_sel, '')) . Form::getLineBox('<label for="hour_end_hour">' . Lang::t('_HOUR_END', 'course') . '</label>', Form::getInputDropdown('dropdown_nw', 'hour_end_hour', 'hour_end[hour]', $hours, $he_sel, '') . ' : ' . Form::getInputDropdown('dropdown_nw', 'hour_end_quarter', 'hour_end[quarter]', $quarter, $qe_sel, '')) . Form::getTextfield(Lang::t('_DAY_OF_VALIDITY', 'course'), 'course_day_of', 'course_day_of', '10', $course['valid_time']) . Form::getTextfield(Lang::t('_MEDIUM_TIME', 'course'), 'course_medium_time', 'course_medium_time', '10', $course['mediumTime']) . Form::getCloseFieldset() . Form::openCollasableFieldset(Lang::t('_COURSE_SPECIAL_OPTION', 'course')) . Form::getTextfield(Lang::t('_MIN_NUM_SUBSCRIBE', 'course'), 'min_num_subscribe', 'min_num_subscribe', '11', $course['min_num_subscribe']) . Form::getTextfield(Lang::t('_MAX_NUM_SUBSCRIBE', 'course'), 'max_num_subscribe', 'max_num_subscribe', '11', $course['max_num_subscribe']) . Form::getCheckbox(Lang::t('_ALLOW_OVERBOOKING', 'course'), 'allow_overbooking', 'allow_overbooking', '1', $course['allow_overbooking'] == 1) . Form::getTextfield(Lang::t('_COURSE_QUOTA', 'course'), 'course_quota', 'course_quota', '11', $course['course_quota'] != COURSE_QUOTA_INHERIT ? $course['course_quota'] : 0) . Form::getCheckbox(Lang::t('_INHERIT_QUOTA', 'course'), 'inherit_quota', 'inherit_quota', '1', $course['course_quota'] == COURSE_QUOTA_INHERIT) . Form::getCloseFieldset() . Form::openCollasableFieldset(Lang::t('_DOCUMENT_UPLOAD', 'course')) . Form::getTextfield(Lang::t('_SPONSOR_LINK', 'course'), 'course_sponsor_link', 'course_sponsor_link', '255', $course['linkSponsor']) . Form::getExtendedFilefield(Lang::t('_PATHSPONSOR', 'configuration'), 'course_sponsor_logo', 'course_sponsor_logo', $course["imgSponsor"]) . Form::getExtendedFilefield(Lang::t('_COURSE_LOGO', 'course'), 'course_logo', 'course_logo', $course["img_course"]) . Form::getExtendedFilefield(Lang::t('_COURSE_DEMO', 'course'), 'course_demo', 'course_demo', $course["course_demo"]) . Form::getCheckbox(Lang::t('_USE_LOGO_IN_COURSELIST', 'course'), 'use_logo_in_courselist', 'use_logo_in_courselist', 1, $course["use_logo_in_courselist"]) . Form::getCloseFieldset() . Form::closeElementSpace() . Form::openButtonSpace() . ($_REQUEST['r'] == 'alms/course/newcourse' || $_REQUEST['r'] == 'alms/course/modcourse' && $row[0] == 0 ? Form::getCheckbox(Lang::t('_AUTO_SUBSCRIPTION'), 'auto_subscription', 'auto_subscription', '1', true) : '') . Form::getButton('save', 'save', Lang::t('_SAVE')) . Form::getButton('undo', 'undo', Lang::t('_UNDO')) . Form::closeButtonSpace() . Form::closeForm();
?>
</div>
<script type="text/javascript">
var D = YAHOO.util.Dom, E = YAHOO.util.Event;
E.onDOMReady(function() {
	var c = D.get("use_unsubscribe_date_limit"), d = D.get("unsubscribe_date_limit");
	E.addListener("no_user_unsubscription", "click", function(e) {
		var checked = this.checked;
		c.disabled = checked;
		d.disabled = checked;
	});
 function edit($back_test)
 {
     $lang =& DoceboLanguage::createInstance('test');
     require_once _base_ . '/lib/lib.form.php';
     $url_encode = htmlentities(urlencode($back_test));
     if (isset($_POST['add_question'])) {
         if (!sql_query("\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_testquest \r\n\t\t\tSET idCategory = '" . (int) $_POST['idCategory'] . "', \r\n\t\t\t\ttitle_quest = '" . $_POST['title_quest'] . "', \r\n\t\t\t\tdifficult = '" . (int) $_POST['difficult'] . "', \r\n\t\t\t\ttime_assigned = '" . (int) $_POST['time_assigned'] . "' \r\n\t\t\tWHERE idQuest = '" . $this->id . "'")) {
             errorCommunication($lang->def('_ERR_INS_QUEST') . getBackUi('index.php?modname=question&amp;op=edit&amp;type_quest=' . $this->getQuestionType() . '&amp;idQuest=' . $this->id . '&amp;back_test=' . $url_encode, $lang->def('_BACK')));
         }
         if (!sql_query("\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_testquestanswer \r\n\t\t\tSET score_correct = '" . $this->_checkScore($_POST['max_score']) . "'\r\n\t\t\tWHERE idQuest = '" . $this->id . "'")) {
             errorCommunication($lang->def('_ERR_INS_QUEST') . getBackUi('index.php?modname=question&amp;op=edit&amp;type_quest=' . $this->getQuestionType() . '&amp;idQuest=' . $this->id . '&amp;back_test=' . $url_encode, $lang->def('_BACK')));
         }
         Util::jump_to('' . $back_test);
     }
     //finding categories
     require_once $GLOBALS['where_lms'] . '/lib/lib.questcategory.php';
     $categories = Questcategory::getCategory();
     //create array of difficult
     $arr_dufficult = array(5 => '5 - ' . $lang->def('_VERY_HARD'), 4 => '4 - ' . $lang->def('_HARD'), 3 => '3 - ' . $lang->def('_DIFFICULT_MEDIUM'), 2 => '2 - ' . $lang->def('_DIFFICULT_EASY'), 1 => '1 - ' . $lang->def('_DIFFICULT_VERYEASY'));
     list($title_quest, $cat_sel, $diff_sel, $sel_time) = sql_fetch_row(sql_query("\r\n\t\tSELECT title_quest, idCategory, difficult, time_assigned \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquest \r\n\t\tWHERE idQuest = '" . $this->id . "'"));
     list($max_score) = sql_fetch_row(sql_query("\r\n\t\tSELECT score_correct\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquestanswer \r\n\t\tWHERE idQuest = '" . $this->id . "'"));
     $GLOBALS['page']->add(getTitleArea($lang->def('_TEST_SECTION'), 'test') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&amp;', $back_test), $lang->def('_BACK')) . '<div class="title_big">' . $lang->def('_QUEST_ACRN_' . strtoupper($this->getQuestionType())) . ' - ' . $lang->def('_QUEST_' . strtoupper($this->getQuestionType())) . '</div><br />' . Form::openForm('form_mod_quest', 'index.php?modname=question&amp;op=edit') . Form::openElementSpace() . Form::getHidden('type_quest', 'type_quest', $this->getQuestionType()) . Form::getHidden('idQuest', 'idQuest', $this->id) . Form::getHidden('back_test', 'back_test', $url_encode) . Form::getTextarea($lang->def('_QUESTION'), 'title_quest', 'title_quest', $title_quest), 'content');
     if (count($categories) > 1) {
         $GLOBALS['page']->add(Form::getDropdown($lang->def('_TEST_QUEST_CATEGORY'), 'idCategory', 'idCategory', $categories, isset($_POST['idCategory']) ? $_POST['idCategory'] : $cat_sel), 'content');
     }
     $GLOBALS['page']->add(Form::getDropdown($lang->def('_DIFFICULTY'), 'difficult', 'difficult', $arr_dufficult, $diff_sel) . Form::getTextfield($lang->def('_TEST_QUEST_TIMEASS'), 'time_assigned', 'time_assigned', 5, isset($_POST['time_assigned']) ? $_POST['time_assigned'] : $sel_time, $lang->def('_TEST_QUEST_TIMEASS'), $lang->def('_SECONDS')) . Form::getBreakRow() . Form::getTextfield($lang->def('_MAX_SCORE'), 'max_score', 'max_score', 255, isset($_POST['max_score']) ? $_POST['max_score'] : $max_score, $lang->def('_MAX_SCORE')) . Form::getBreakRow() . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('add_question', 'add_question', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
 }
 function get_course_val_filter()
 {
     $back_url = $this->back_url;
     $jump_url = $this->jump_url;
     $next_url = $this->next_url;
     require_once _base_ . '/lib/lib.form.php';
     require_once _adm_ . '/lib/lib.directory.php';
     require_once _adm_ . '/class.module/class.directory.php';
     require_once _lms_ . '/lib/lib.course.php';
     $lang =& DoceboLanguage::createInstance('report', 'framework');
     $glang =& DoceboLanguage::createInstance('admin_course_managment', 'lms');
     if (!isset($_SESSION['report_tempdata']['columns_filter'])) {
         $_SESSION['report_tempdata']['columns_filter'] = array();
     }
     $ref =& $_SESSION['report_tempdata']['columns_filter'];
     if (Get::req('is_updating', DOTY_INT, 0) > 0) {
         $ref['showed_cols'] = Get::req('cols', DOTY_MIXED, array());
     }
     function is_showed($which, &$arr)
     {
         if (isset($arr['showed_cols'])) {
             return in_array($which, $arr['showed_cols']);
         } else {
             return false;
         }
     }
     if (isset($_POST['import_filter']) || isset($_POST['show_filter']) || isset($_POST['pre_filter'])) {
         $temp_url = $next_url;
         if (isset($_POST['pre_filter'])) {
             $temp_url .= '&show=1&nosave=1';
         }
         if (isset($_POST['show_filter'])) {
             $temp_url .= '&show=1';
         }
         Util::jump_to($temp_url);
     }
     cout($this->page_title . Form::openForm('user_report_rows_courses', $jump_url) . Form::getHidden('update_tempdata', 'update_tempdata', 1) . Form::getHidden('is_updating', 'is_updating', 1) . Form::getOpenFieldset($lang->def('_COURSE_FIELDS'), 'fieldset_course_fields') . Form::getCheckBox($lang->def('_COURSE_CODE'), 'col_sel_coursecode', 'cols[]', '_CODE_COURSE', is_showed('_CODE_COURSE', $ref)) . Form::getCheckBox($glang->def('_COURSE_NAME'), 'col_sel_coursename', 'cols[]', '_NAME_COURSE', is_showed('_NAME_COURSE', $ref)) . Form::getCheckBox($glang->def('_CATEGORY'), 'col_sel_category', 'cols[]', '_COURSE_CATEGORY', is_showed('_COURSE_CATEGORY', $ref)) . Form::getCheckBox($glang->def('_STATUS'), 'col_sel_status', 'cols[]', '_COURSESTATUS', is_showed('_COURSESTATUS', $ref)) . Form::getCheckBox($glang->def('_CREATION_DATE', 'report'), 'col_sel_publication', 'cols[]', '_PUBLICATION_DATE', is_showed('_PUBLICATION_DATE', $ref)) . Form::getCloseFieldset() . Form::getOpenFieldset($lang->def('_COURSE', 'levels'), 'fieldset_course_fields') . Form::getCheckBox($lang->def('_MAX_SCORE'), 'col_hight_vote', 'cols[]', '_HIGH_VOTE', is_showed('_HIGH_VOTE', $ref)) . Form::getCheckBox($lang->def('_MIN_SCORE'), 'col_less_vote', 'cols[]', '_LESS_VOTE', is_showed('_LESS_VOTE', $ref)) . Form::getCheckBox($lang->def('_SCORE'), 'show_medium_vote', 'cols[]', '_MEDIUM_VOTE', is_showed('_MEDIUM_VOTE', $ref)) . Form::getCloseFieldset() . Form::openButtonSpace() . Form::getBreakRow() . Form::getButton('pre_filter', 'pre_filter', $lang->def('_SHOW_NOSAVE', 'report')) . Form::getButton('ok_filter', 'import_filter', $lang->def('_SAVE_BACK')) . Form::getButton('show_filter', 'show_filter', $lang->def('_SAVE_SHOW')) . Form::getButton('undo_filter', 'undo_filter', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>');
 }
Example #21
0
function subscribeFromCourse()
{
    require_once _base_ . '/lib/lib.form.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.directory.php';
    require_once _base_ . '/lib/lib.userselector.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.course_managment.php';
    $lang =& DoceboLanguage::CreateInstance('subscribe', 'lms');
    $back_url = 'index.php?modname=course&op=course_list';
    $acl_man =& Docebo::user()->getAclManager();
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $id_course = Get::req('id_course', DOTY_INT, 0);
    $edition_id = Get::req('edition_id', DOTY_INT, 0);
    $alert = Get::req('alert', DOTY_INT, 0);
    $delete_prev = Get::req('delete_from_prev', DOTY_INT, 0);
    $sel = new Course_Manager();
    if (isset($_POST['subscribe_import'])) {
        $course_info = Man_Course::getCourseInfo($id_course);
        $level_idst =& getCourseLevel($id_course);
        if (count($level_idst) == 0) {
            $level_idst =& DoceboCourse::createCourseLevel($id_course);
        }
        $course_selected = $sel->getCourseSelection($_POST);
        if (empty($course_selected)) {
            Util::jump_to('index.php?modname=course&op=course_list&result=err');
        }
        $id_course = Get::req('id_course', DOTY_INT, 0);
        $level = Get::req('level', DOTY_INT, 0);
        $status = Get::req('status', DOTY_INT, 0);
        $gsel = array();
        foreach ($course_selected as $trash => $id) {
            $gsel[$id] = getCourseLevel($id);
        }
        $query = "SELECT idUser, idCourse, level" . " FROM " . $GLOBALS['prefix_lms'] . "_courseuser" . " WHERE idCourse IN (" . implode(',', $course_selected) . ")";
        if ($level) {
            $query .= " AND level = '" . $level . "'";
        }
        if ($status != '-2') {
            $query .= " AND status = '" . $status . "'";
        }
        $result = sql_query($query);
        $array_user = array();
        $user_subscribed = array();
        while (list($id_user, $id_prev_course, $lv_sel) = sql_fetch_row($result)) {
            if ($delete_prev) {
                removeSubscription($id_prev_course, $id_user, $gsel[$id_prev_course][$lv_sel]);
            }
            // Add in group for permission
            $acl_man->addToGroup($level_idst[$lv_sel], $id_user);
            // Add in table
            $re = sql_query("\r\n\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_courseuser\r\n\t\t\t( idUser, idCourse, edition_id, level, waiting, subscribed_by, date_inscr )\r\n\t\t\tVALUES\r\n\t\t\t( '" . $id_user . "', '" . $id_course . "', '" . $edition_id . "', '" . $lv_sel . "', '0', '" . getLogUserId() . "', '" . date("Y-m-d H:i:s") . "' )\t");
            if ($re) {
                $user_subscribed[] = $id_user;
                addUserToTimeTable($id_user, $id_course, $edition_id);
            }
        }
        Docebo::user()->loadUserSectionST('/lms/course/private/');
        Docebo::user()->SaveInSession();
        require_once _base_ . '/lib/lib.eventmanager.php';
        $array_subst = array('[url]' => Get::sett('url'), '[course]' => $course_info['name'], '[medium_time]' => $course_info['mediumTime'], '[course_name]' => $course_info['name'], '[course_code]' => $course['code']);
        if (!empty($user_subscribed) && $alert) {
            // message to user that is subscribed
            $msg_composer = new EventMessageComposer();
            $msg_composer->setSubjectLangText('email', '_NEW_USER_SUBSCRIBED_SUBJECT', false);
            $msg_composer->setBodyLangText('email', '_NEW_USER_SUBSCRIBED_TEXT', $array_subst);
            $msg_composer->setBodyLangText('sms', '_NEW_USER_SUBSCRIBED_TEXT_SMS', $array_subst);
            // send message to the user subscribed
            createNewAlert('UserCourseInserted', 'subscribe', 'insert', '1', 'User subscribed', $user_subscribed, $msg_composer);
        }
        Util::jump_to('index.php?modname=course&op=course_list&result=ok');
    }
    $sel->setLink('index.php?modname=meta_certificate&amp;op=new_assign');
    $sel->show_coursepath_selector = false;
    $sel->show_catalogue_selector = false;
    $array_level = CourseLevel::getLevels();
    $array_level['0'] = $lang->def('_ALL');
    $arr_status = array('-2' => $lang->def('_ALL'), _CUS_CONFIRMED => $lang->def('_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $lang->def('_USER_STATUS_SUBS'), _CUS_BEGIN => $lang->def('_USER_STATUS_BEGIN'), _CUS_END => $lang->def('_USER_STATUS_END'), _CUS_SUSPEND => $lang->def('_SUSPENDED'), _CUS_CANCELLED => $lang->def('_USER_STATUS_CANCELLED'));
    $out->add(getTitleArea($lang->def('_IMPORT_FROM_COURSE')) . '<div class="std_block">' . Form::openForm('course_selection', 'index.php?modname=subscribe&amp;op=subscribe_from_course') . Form::openElementSpace() . Form::getDropdown($lang->def('_LEVEL_TO_IMPORT'), 'level', 'level', $array_level, isset($_POST['level']) ? $_POST['level'] : '0') . Form::getDropdown($lang->def('_STATUS_TO_IMPORT'), 'status', 'status', $arr_status, isset($_POST['status']) ? $_POST['status'] : '-2') . Form::getCheckbox($lang->def('_SEND_ALERT'), 'alert', 'alert', '1', $delete_prev) . Form::getCheckbox($lang->def('_DELETE'), 'delete_from_prev', 'delete_from_prev', '1', $delete_prev) . Form::closeElementSpace());
    $sel->loadSelector(false);
    $out->add(Form::getHidden('id_course', 'id_course', $id_course) . Form::getHidden('edition_id', 'edition_id', $edition_id) . Form::openButtonSpace() . Form::getBreakRow() . Form::getButton('subscribe_import', 'subscribe_import', $lang->def('_SUBSCRIBE')) . Form::getButton('undo_course', 'undo_course', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>');
}
Example #22
0
function editmodule($load = false)
{
    if ($load) {
        checkPerm('mod');
    } else {
        checkPerm('mod');
    }
    require_once _base_ . '/lib/lib.form.php';
    Util::get_js(Get::rel_path('base') . '/lib/js_utils.js', true, true);
    $lang =& DoceboLanguage::createInstance('manmenu');
    $menu_lang =& DoceboLanguage::createInstance('menu_course', 'lms');
    $out =& $GLOBALS['page'];
    $id_main = importVar('id_main', true, 0);
    $id_module = importVar('id_module', true, 0);
    $acl_man =& Docebo::user()->getAclManager();
    $perm = array();
    // Load module info
    $query_module = "\r\n\tSELECT module_name, default_name, file_name, class_name \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_module \r\n\tWHERE idModule = '" . $id_module . "'";
    list($module_name, $name_db, $file_name, $class_name) = sql_fetch_row(sql_query($query_module));
    $module_obj =& createLmsModule($module_name);
    // Standard name
    //$name = ( Lang::isDef($name_db, 'menu_course') ? Lang::t($name_db, 'menu_course') : $name_db );
    $name = Lang::t($name_db, 'menu_course', false, false, $name_db);
    // Load info
    $query_module = "\r\n\tSELECT default_op \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_module \r\n\tWHERE idModule = '" . $id_module . "'";
    list($module_op) = sql_fetch_row(sql_query($query_module));
    if ($load) {
        // Find personalized name
        $query_seq = "\r\n\t\tSELECT idCustom, my_name\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_menucustom_under \r\n\t\tWHERE idMain = '" . $id_main . "' AND idModule = '" . $id_module . "'";
        list($id_custom, $my_name) = sql_fetch_row(sql_query($query_seq));
        // Load actual module permission
        $levels = CourseLevel::getLevels();
        $tokens = $module_obj->getAllToken($module_op);
        $map_level_idst =& getCustomLevelSt($id_custom);
        $map_all_role =& getModuleRoleSt($module_name, $tokens, TRUE);
        $group_idst_roles =& getAllModulesPermissionSt($map_level_idst, $map_all_role);
        $perm =& fromStToToken($group_idst_roles, $map_all_role);
    } else {
        if (method_exists($module_obj, 'getPermissionsForMenu')) {
            $perm = $module_obj->getPermissionsForMenu($module_op);
        }
    }
    // Find personalized name
    $id_custom = getIdCustomFromMain($id_main);
    $query_custom = "\r\n\tSELECT title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_menucustom \r\n\tWHERE idCustom = '" . $id_custom . "'";
    list($custom_name) = sql_fetch_row(sql_query($query_custom));
    $query_mains = "\r\n\tSELECT idMain, name \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_menucustom_main \r\n\tWHERE idCustom = '" . $id_custom . "'\r\n\tORDER BY sequence";
    $re_mains = sql_query($query_mains);
    while (list($id_db_main, $main_name) = sql_fetch_row($re_mains)) {
        $mains[$id_db_main] = $main_name;
        if ($id_db_main == $id_main) {
            $title_main = $main_name;
        }
    }
    $page_title = array('index.php?modname=amanmenu&amp;op=mancustom' => $lang->def('_TITLE_MANMENU'), 'index.php?modname=amanmenu&amp;op=manmenu&amp;id_custom=' . $id_custom => $custom_name, 'index.php?modname=amanmenu&amp;op=manmodule&amp;id_main=' . $id_main => $title_main, ($load ? $lang->def('_YOURE_WORKING_ON_MODULE') : $lang->def('_YOURE_IMPORTING')) . ' : ' . $name);
    // Form
    $out->add(getTitleArea($page_title, 'manmenu') . '<div class="std_block">' . getBackUi('index.php?modname=amanmenu&amp;op=manmodule&amp;id_main=' . $id_main, $lang->def('_BACK')) . '<div class="box_evidence">' . '<span class="text_bold">' . ($load ? $lang->def('_YOURE_WORKING_ON_MODULE') : $lang->def('_YOURE_IMPORTING')) . ' : </span>' . $name . '</div>' . Form::openForm('module_permission', 'index.php?modname=amanmenu&amp;op=upmodule&amp;id_main=' . $id_main . '&amp;id_module=' . $id_module) . Form::getHidden('id_main', 'id_main', $id_main) . Form::getHidden('id_module', 'id_module', $id_module) . ($load ? Form::getHidden('load', 'load', '1') : '') . Form::getTextfield($lang->def('_MY_NAME'), 'my_name', 'my_name', 255, $load ? $my_name : $lang->def('_DEFAULT_MY_NAME')) . Form::getDropdown($lang->def('_TITLE_MENUVOICE'), 'new_id_main', 'new_id_main', $mains, $id_main) . Form::getBreakRow() . $module_obj->getPermissionUi('module_permission', $perm, $module_op) . Form::getBreakRow() . Form::openButtonSpace() . Form::getButton('saveperm', 'saveperm', $load ? $lang->def('_SAVE') : $lang->def('_IMPORT')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>');
}
Example #23
0
<?php

echo getTitleArea(Lang::t('_PRECOMPILE', 'standard'));
?>
<div class="std_block">
<?php 
echo $result_message;
echo Form::openForm('precompile_form', 'index.php?r=precompile/set');
if (!$fields_checked) {
    foreach ($fieldlist->getUserMandatoryFields(Docebo::user()->getIdSt()) as $id_field => $m_field) {
        echo $fieldlist->playFieldForUser(Docebo::user()->getIdSt(), $id_field, false, true);
    }
}
echo Form::getBreakRow();
echo '<div class="boxed">';
echo '<p class="privacy_policy">';
echo $policy_text;
echo '</p>';
echo Form::getBreakRow();
echo '<div class="align-center">';
echo Form::getCheckbox(Lang::t('_ACCEPT', 'register'), 'accept_policy', 'accept_policy', 1, FALSE);
echo '</div>';
echo '</div>';
echo Form::openButtonSpace();
echo Form::getButton('save', 'save', Lang::t('_SAVE', 'standard'));
echo Form::getButton('undo', 'undo', Lang::t('_UNDO', 'standard'));
echo Form::closeButtonSpace();
echo Form::closeForm();
?>
</div>
Example #24
0
    function message()
    {
        //checkPerm('view');
        require_once _base_ . '/lib/lib.tab.php';
        require_once _lms_ . '/lib/lib.course.php';
        YuiLib::load('tabview');
        $send_perm = true;
        //checkPerm('send_all', true) || checkPerm('send_upper', true);
        $output = "";
        $um =& UrlManager::getInstance("message");
        $active_tab = Get::req('active_tab', DOTY_STRING, 'inbox');
        if ($active_tab != 'inbox' && $active_tab != 'outbox') {
            $active_tab = 'inbox';
        }
        $form_url = $this->mvc_urls ? "index.php?r=message/show" : $um->getUrl();
        //$output .= Form::openForm('tab_advice', $form_url);
        $course_man = new Man_Course();
        $all_value = array(0 => Lang::t('_ALL_COURSES'));
        $all_courses = $course_man->getUserCourses(getLogUserId());
        $all_value = $all_value + $all_courses;
        $_filter_inbox = Get::req('msg_course_filter_inbox', DOTY_INT, 0);
        $_filter_outbox = Get::req('msg_course_filter_outbox', DOTY_INT, 0);
        if ($_filter_inbox == '') {
            if (isset($_SESSION['idCourse'])) {
                $_filter_inbox = $_SESSION['idCourse'];
            } else {
                $_filter_inbox = 0;
            }
        }
        if ($_filter_outbox == '') {
            if (isset($_SESSION['idCourse'])) {
                $_filter_outbox = $_SESSION['idCourse'];
            } else {
                $_filter_outbox = 0;
            }
        }
        if (count($all_value) > 0) {
            $form_filter_inbox = Form::getLineDropdown('form_line_l', 'label_padded', Lang::t('_FILTER'), 'dropdown_nowh', 'msg_course_filter_inbox', 'msg_course_filter_inbox', $all_value, $_filter_inbox, ' onchange="form.submit();"', '', '') . Form::getHidden('msg_course_filter_outbox', 'msg_course_filter_outbox', $_filter_outbox) . Form::getBreakRow();
            $form_filter_outbox = Form::getLineDropdown('form_line_l', 'label_padded', Lang::t('_FILTER'), 'dropdown_nowh', 'msg_course_filter_outbox', 'msg_course_filter_outbox', $all_value, $_filter_outbox, ' onchange="form.submit();"', '', '') . Form::getHidden('msg_course_filter_inbox', 'msg_course_filter_inbox', $_filter_inbox) . Form::getBreakRow();
        } else {
            $form_filter_inbox = $form_filter_outbox = Form::getHidden("msg_course_filter_outbox", "msg_course_filter_outbox", 0) . Form::getHidden("msg_course_filter_inbox", "msg_course_filter_inbox", 0);
        }
        $output .= '
			<div class="std_block">
				<div id="tab_message" class="yui-navset">
					<ul class="yui-nav">
							<li' . ($active_tab == 'inbox' ? ' class="selected"' : '') . '>
								<a href="#tab_inbox"><em>' . Lang::t('_INBOX', 'message') . '</em></a>
							</li>
							<li' . ($active_tab == 'outbox' ? ' class="selected"' : '') . '>
								<a href="#tab_outbox"><em>' . Lang::t('_OUTBOX', 'message') . '</em></a>
							</li>
					</ul>
					<div class="yui-content">
							<div id="tab_inbox">
								' . Form::openForm('inbox_tab_advice', $form_url) . Form::getHidden('active_tab', 'active_tab', 'inbox') . $form_filter_inbox . $this->inbox($all_courses, true) . Form::closeForm() . '
							</div>
							<div id="tab_outbox">
								' . Form::openForm('outbox_tab_advice', $form_url) . Form::getHidden('active_tab', 'active_tab', 'outbox') . $form_filter_outbox . $this->outbox($all_courses, true) . Form::closeForm() . '
							</div>
					</div>
				</div>
				<script type="text/javascript">
						YAHOO.util.Event.onDOMReady(function() {
							var tabview = new YAHOO.widget.TabView("tab_message");
						});
				</script>
			</div>';
        cout($output, 'content');
    }