function getNodeOptions($id_category, $is_leaf)
{
    $lang =& DoceboLanguage::CreateInstance('course', 'lms');
    $node_options = array();
    $node_options[] = array('id' => 'mod_' . $id_category, 'command' => 'modify', 'icon' => 'standard/edit.png', 'alt' => $lang->def('_MOD'));
    if ($is_leaf) {
        $node_options[] = array('id' => 'del_' . $id_category, 'command' => 'delete', 'icon' => 'standard/delete.png', 'alt' => $lang->def('_DEL'));
    } else {
        $node_options[] = array('id' => 'del_' . $id_category, 'command' => false, 'icon' => 'blank.png');
    }
    return $node_options;
}
Example #2
0
 public function __construct()
 {
     $this->course_table = $GLOBALS['prefix_lms'] . '_course';
     $this->subscribe_table = $GLOBALS['prefix_lms'] . '_courseuser';
     $this->user_table = $GLOBALS['prefix_fw'] . '_user';
     $this->db = DbConn::getInstance();
     $this->acl_man = $acl_man =& Docebo::user()->getAclManager();
     $this->lang =& DoceboLanguage::CreateInstance('levels', 'lms');
     $this->lang =& DoceboLanguage::CreateInstance('subscribe', 'lms');
     $this->array_user_status = array(_CUS_WAITING_LIST => $this->lang->def('_WAITING_USERS'), _CUS_CONFIRMED => $this->lang->def('_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $this->lang->def('_USER_STATUS_SUBS'), _CUS_BEGIN => $this->lang->def('_USER_STATUS_BEGIN'), _CUS_END => $this->lang->def('_USER_STATUS_END'), _CUS_SUSPEND => $this->lang->def('_USER_STATUS_SUSPEND'), _CUS_OVERBOOKING => $this->lang->def('_USER_STATUS_OVERBOOKING'));
     $this->array_user_level = array(1 => $this->lang->def('_LEVEL_1', 'levels', 'lms'), 2 => $this->lang->def('_LEVEL_2', 'levels', 'lms'), 3 => $this->lang->def('_LEVEL_3', 'levels', 'lms'), 4 => $this->lang->def('_LEVEL_4', 'levels', 'lms'), 5 => $this->lang->def('_LEVEL_5', 'levels', 'lms'), 6 => $this->lang->def('_LEVEL_6', 'levels', 'lms'), 7 => $this->lang->def('_LEVEL_7', 'levels', 'lms'));
 }
 function Report_Courses()
 {
     $this->lang =& DoceboLanguage::createInstance('report', 'framework');
     $this->usestandardtitle_rows = true;
     //$this->usestandardtitle_cols = false;
     $lang =& DoceboLanguage::CreateInstance('course', 'lms');
     $this->_set_columns_category(_RCS_CATEGORY_USERS, $this->lang->def('_RCS_CAT_USER'), 'get_user_filter', 'show_report_user', '_get_users_query', false);
     $this->_set_columns_category(_RCS_CATEGORY_DOC_VAL, $this->lang->def('_RCS_CAT_DOC_VAL'), 'get_doc_val_filter', 'show_report_doc_val', '_get_doc_val_query', false);
     $this->_set_columns_category(_RCS_CATEGORY_COURSE_VAL, $this->lang->def('_RCS_CAT_COURSE_VAL'), 'get_course_val_filter', 'show_report_course_val', '_get_course_val_query', false);
     $this->status_c = 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'));
     $lang =& DoceboLanguage::CreateInstance('course', 'lms');
     $this->status_u = array(_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('_USER_STATUS_SUSPEND'));
 }
Example #4
0
 public function __construct()
 {
     require_once _lms_ . '/lib/lib.subscribe.php';
     $this->date_table = $GLOBALS['prefix_lms'] . '_course_date';
     $this->day_date_table = $GLOBALS['prefix_lms'] . '_course_date_day';
     $this->user_date_table = $GLOBALS['prefix_lms'] . '_course_date_user';
     $this->presence_date_table = $GLOBALS['prefix_lms'] . '_course_date_presence';
     $this->classroom_table = $GLOBALS['prefix_lms'] . '_classroom';
     $this->location_table = $GLOBALS['prefix_lms'] . '_class_location';
     $this->course_table = $GLOBALS['prefix_lms'] . '_course';
     $this->courseuser_table = $GLOBALS['prefix_lms'] . '_courseuser';
     $this->user_table = $GLOBALS['prefix_fw'] . '_user';
     $this->lang =& DoceboLanguage::CreateInstance('admin_date', 'lms');
     $this->acl_man = $acl_man =& Docebo::user()->getAclManager();
     $this->subscribe_man = new CourseSubscribe_Manager();
 }
 public function __construct($id, $initFromSession = false)
 {
     parent::__construct($id);
     $this->jsClassName = 'CourseFolderTree';
     $this->serverUrl = 'ajax.adm_server.php?plf=lms&file=category_tree&sf=folder_tree';
     Util::get_js(Get::rel_path('base') . '/widget/dialog/dialog.js', true, true);
     require_once _base_ . '/lib/lib.dialog.php';
     initDialogs();
     $initialShowedNodes = array();
     if ($initFromSession) {
         if (isset($_SESSION['course_category']['tree_status'])) {
             $tree_status =& $_SESSION['course_category']['tree_status'];
             //if (isset($tree_status['showed_nodes'])) {}
         }
         if (isset($_SESSION['course_category']['filter_status'])) {
             $filter_status =& $_SESSION['course_category']['filter_status'];
             if (isset($filter_status['c_category'])) {
                 $this->setOption('initialSelectedNode', $filter_status['c_category']);
             }
         }
     }
     $lang =& DoceboLanguage::CreateInstance('course', 'lms');
     //$this->setOption('langs', array('_ROOT'=>def('_CATEGORY', 'course', 'lms')));
     $this->addLangKey('_ROOT', $lang->def('_CATEGORY'));
     $this->addLangKey('_YES', $lang->def('_CONFIRM'));
     $this->addLangKey('_NO', $lang->def('_UNDO'));
     $this->addLangKey('_NEW_FOLDER_NAME', $lang->def('_NEW_CATEGORY'));
     $this->addLangKey('_MOD', $lang->def('_MOD'));
     $this->addLangKey('_AREYOUSURE', $lang->def('_AREYOUSURE'));
     $this->addLangKey('_NAME', $lang->def('_NAME'));
     $this->addLangKey('_MOD', $lang->def('_MOD'));
     $this->addLangKey('_DEL', $lang->def('_DEL'));
     //$this->addLangKey('_', $lang->def(''));
     //$selected_node = (isset($_SESSION['course_category']['filter_status']) ? $_SESSION['course_category']['filter_status']['c_category'] : 0); //0 = root node
     $tree_status = $this->_getCourseTreeStatus();
     //0 = root node
     $this->setOption('iconPath', Get::tmpl_path() . 'images/');
     $this->setOption('dragdrop', true);
     //$this->setOption('initNodes', $initialShowedNodes);
     $this->setOption('useCheckboxes', false);
     $this->setOption('addFolderButton', 'add_folder_button');
     //$this->setOption('initialTreeStatus', $tree_status);
     //$this->setOption('options', '');
     //$this->setOption('options', '');
 }
Example #6
0
function login()
{
    die;
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.usermanager.php';
    $lang =& DoceboLanguage::CreateInstance('login', 'framework');
    $out =& $GLOBALS['page'];
    $user_manager = new UserManager();
    $out->setWorkingZone('content');
    $extra = false;
    if (isset($GLOBALS['logout'])) {
        $extra = array('style' => 'logout_action', 'content' => $lang->def('_UNLOGGED'));
    }
    if (isset($GLOBALS['access_fail'])) {
        $extra = array('style' => 'noaccess', 'content' => $lang->def('_NOACCESS'));
    }
    $out->add(Form::openForm('admin_box_login', 'index.php?modname=login&op=confirm') . $user_manager->getLoginMask('index.php?modname=login&op=login', $extra) . Form::closeForm());
}
Example #7
0
function getHistoryTable($id_user, $id_org, $idscorm_item, $idReference)
{
    require_once _base_ . '/lib/lib.table.php';
    $tb = new Table(Get::sett('visu_course'));
    $lang = DoceboLanguage::CreateInstance('organization', 'lms');
    $h_type = array('', '', '', '', '');
    $h_content = array($lang->def('_ATTEMPT'), $lang->def('_STATUS'), $lang->def('_SCORE'), $lang->def('_DATE'), $lang->def('_TIME'));
    $tb->setColsStyle($h_type);
    $tb->addHead($h_content);
    $qry = "SELECT t1.* FROM " . $GLOBALS['prefix_lms'] . "_scorm_tracking_history as t1 JOIN " . $GLOBALS['prefix_lms'] . "_scorm_tracking as t2 ON (t1.idscorm_tracking=t2.idscorm_tracking) " . " WHERE t2.idscorm_item={$idscorm_item} AND t2.idUser={$id_user} " . " ORDER BY t1.date_action ASC ";
    $res = sql_query($qry);
    $i = 1;
    while ($row = mysql_fetch_assoc($res)) {
        $line = array();
        $line[] = $lang->def('_ATTEMPT') . ' ' . $i;
        $line[] = $row['lesson_status'];
        $line[] = $row['score_raw'];
        $line[] = Format::date($row['date_action']);
        $line[] = decodeSessionTime($row['session_time']);
        $tb->addBody($line);
        $i++;
    }
    //title
    cout($tb->getTable(), 'content');
}
Example #8
0
function view_report_certificate()
{
    checkPerm('view');
    require_once _lms_ . '/lib/lib.certificate.php';
    require_once _lms_ . '/lib/lib.course.php';
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $lang =& DoceboLanguage::createInstance('certificate', 'lms');
    $deletion = importVar('deletion', true, 0);
    if ($deletion) {
        switch ($deletion) {
            case 1:
                $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
            case 2:
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
            case 3:
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
        }
    }
    $certificate = new Certificate();
    $id_certificate = importVar('id_certificate', true, 0);
    $id_course = importVar('id_course', true, 0);
    $selection = importVar('selection', false, array());
    //all possible selected values
    $selected = importVar('selected', false, array());
    //effectively selected values with checkbox
    $sel = importVar('old_selection', false, '');
    //selected values from previous table pages
    if ($sel != '') {
        $total_selection = explode(',', $sel);
    } else {
        $total_selection = array();
    }
    //update total selection
    foreach ($selection as $key => $val) {
        if (in_array($val, $selected)) {
            if (!in_array($val, $total_selection)) {
                $total_selection[] = $val;
            }
        } else {
            $index = array_search($val, $total_selection);
            if ($index !== false) {
                array_splice($total_selection, $index, 1);
            }
        }
    }
    $search_filter = importVar('filter', false, '');
    $only_released = importVar('only_released', true, 0);
    //which command?
    if (importVar('search_button', false, false) !== false) {
    }
    if (importVar('reset_button', false, false) !== false) {
        $search_filter = '';
        $only_released = 0;
    }
    if (importVar('print_button', false, false) !== false) {
    }
    $numtablerows = $GLOBALS['framework']['visuItem'];
    $tb = new Table($numtablerows, $lang->def('_CERTIFICATE_VIEW_CAPTION'), $lang->def('_CERTIFICATE_VIEW_CAPTION'));
    $tb->initNavBar('ini', 'button');
    $ini = $tb->getSelectedElement();
    $tca = $GLOBALS['prefix_lms'] . "_certificate_assign as ca";
    $tcc = $GLOBALS['prefix_lms'] . "_certificate_course as cc";
    $tcu = $GLOBALS['prefix_lms'] . "_courseuser as cu";
    $tu = $GLOBALS['prefix_fw'] . "_user as u";
    $where = "";
    if ($search_filter != '') {
        $where .= " AND (u.userid LIKE '%" . $search_filter . "%' OR u.lastname LIKE '%" . $search_filter . "%' OR u.firstname LIKE '%" . $search_filter . "%') ";
    }
    if ($only_released > 0) {
        $where = " AND ca.on_date " . ($only_released == 1 ? "IS NOT" : "IS") . " NULL ";
    }
    //$where .= " AND ".$aval_status." ".($only_released==1 ? "<" : ">=")." cu.status ";
    list($aval_status) = sql_fetch_row(sql_query("SELECT available_for_status FROM " . $tcc . " " . " WHERE id_certificate='" . (int) $id_certificate . "' AND id_course='" . (int) $id_course . "'"));
    switch ($aval_status) {
        case AVS_ASSIGN_FOR_ALL_STATUS:
            $aval_status = " 1 ";
            break;
        case AVS_ASSIGN_FOR_STATUS_INCOURSE:
            $aval_status = " cu.status = " . _CUS_BEGIN . " ";
            break;
        case AVS_ASSIGN_FOR_STATUS_COMPLETED:
            $aval_status = " cu.status = " . _CUS_END . " ";
            break;
    }
    list($totalrows) = sql_fetch_row(sql_query("SELECT COUNT(*) " . " FROM ( " . $tu . " JOIN " . $tcu . " ON (u.idst = cu.idUser) ) LEFT JOIN " . $tca . " " . " ON ( ca.id_course = cu.idCourse AND ca.id_user=cu.idUser ) " . " WHERE (ca.id_certificate='" . (int) $id_certificate . "' OR ca.id_certificate IS NULL) AND " . $aval_status . " " . " AND cu.idCourse='" . (int) $id_course . "' " . $where));
    $query = "SELECT u.userid, u.firstname, u.lastname, cu.date_complete, ca.on_date, cu.idUser as id_user, cu.status " . " FROM ( " . $tu . " JOIN " . $tcu . " ON (u.idst = cu.idUser) ) LEFT JOIN " . $tca . " " . " ON ( ca.id_course = cu.idCourse AND ca.id_user=cu.idUser ) " . " WHERE (ca.id_certificate='" . (int) $id_certificate . "' OR ca.id_certificate IS NULL) AND " . $aval_status . " " . " AND cu.idCourse='" . (int) $id_course . "' " . $where . " ORDER BY u.userid LIMIT " . $ini . ", " . $numtablerows;
    $res = sql_query($query);
    $from = Get::req('from', DOTY_MIXED, '');
    $back_ui = getBackUi('index.php?r=lms/pcourse/certificate&amp;id_course=' . (int) $id_course, $lang->def('_BACK'));
    $out->add(getTitleArea(array('index.php?r=lms/pcourse/certificate&amp;id_course=' . (int) $id_course => $lang->def('_CERTIFICATE_ASSIGN_STATUS', 'course'), $lang->def('_CERTIFICATE_REPORT_COURSE_CERT')), 'certificate'));
    $out->add('<div class="std_block">' . $back_ui);
    $numrows = sql_num_rows($res);
    $downloadables = array();
    if ($numrows > 0) {
        $clang =& DoceboLanguage::CreateInstance('course', 'lms');
        $type_h = array('image', '', '', '', '', '', '', 'image', 'image');
        $cont_h = array('', $lang->def('_USERNAME'), $lang->def('_LASTNAME'), $lang->def('_FIRSTNAME'), $clang->def('_STATUS'), $lang->def('_DATE'), $lang->def('_RELASE_DATE'), Get::img('course/certificate.png', Lang::t('_TITLE_VIEW_CERT', 'certificate')), Get::img('standard/delete.png', Lang::t('_DEL', 'certificate')));
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        $acl_man =& $GLOBALS['current_user']->getAclManager();
        $arr_status = array(_CUS_CONFIRMED => $clang->def('_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $clang->def('_USER_STATUS_SUBS'), _CUS_BEGIN => $clang->def('_USER_STATUS_BEGIN'), _CUS_END => $clang->def('_USER_STATUS_END'), _CUS_SUSPEND => $clang->def('_USER_STATUS_SUSPEND'));
        //foreach($report_info as $info_report)
        while ($info = sql_fetch_assoc($res)) {
            $cont = array();
            $can_assign = (bool) ($info['on_date'] == '');
            $input_id = $info['id_user'];
            $sel_cell_content = '';
            $label_open = '';
            $label_close = '';
            if ($can_assign) {
                $input = '<input type="hidden" id="selection_' . $input_id . '" name="selection[' . $input_id . ']" value="' . $input_id . '"/> ';
                if (in_array($input_id, $total_selection)) {
                    $checked = ' checked="checked"';
                } else {
                    $checked = '';
                }
                $sel_cell_content .= $input . '<input type="checkbox" id="selected_' . $input_id . '" name="selected[' . $input_id . ']" value="' . $input_id . '"' . $checked . '/>';
                $label_open = '<label for="selected_' . $input_id . '">';
                $label_close = '</label>';
            }
            $userid = $acl_man->relativeId($info['userid']);
            $cont[] = $sel_cell_content;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($userid, $search_filter) : $userid) . $label_close;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($info['lastname'], $search_filter) : $info['lastname']) . $label_close;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($info['firstname'], $search_filter) : $info['firstname']) . $label_close;
            $cont[] = $arr_status[$info['status']];
            $cont[] = $info['date_complete'];
            $cont[] = $info['on_date'];
            $url = 'index.php?modname=pcertificate&amp;certificate_id=' . $id_certificate . '&amp;course_id=' . $id_course . '&amp;user_id=' . $info['id_user'];
            $dl_url = $url . "&amp;op=send_certificate";
            if ($can_assign) {
                $downloadables[] = 'dl_single_' . $input_id;
            }
            $cont[] = '<a href="' . ($can_assign ? "javascript:;" : $dl_url) . '" id="dl_single_' . $input_id . '">' . Get::img('course/certificate.png', Lang::t('_TITLE_VIEW_CERT', 'certificate')) . ($can_assign ? $lang->def('_GENERATE') : $lang->def('_DOWNLOAD')) . '</a>';
            $cont[] = $can_assign ? "" : '<a href="' . $url . '&amp;op=del_report_certificate">' . Get::img('standard/delete.png', Lang::t('_DEL', 'certificate')) . '</a>';
            $tb->addBody($cont);
        }
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=del_report_certificate]');
        $form = new Form();
        $form_url = "index.php?modname=pcertificate&amp;op=view_report_certificate&amp;id_certificate=" . (int) $id_certificate . "&amp;id_course=" . (int) $id_course;
        $out->add($form->openForm("certificates_emission", $form_url));
        $out->add($form->getHidden('old_selection', 'old_selection', implode(',', $total_selection)));
        //search filter ...
        $release_options = array($lang->def('_ALL') => 0, $lang->def('_ONLY_RELEASED') => 1, $lang->def('_ONLY_TO_RELEASE') => 2);
        /*
        		$out->add($form->getOpenFieldset($lang->def('_SEARCH_FILTER')));
        		$out->add($form->getTextfield($lang->def('_FILTER'), "filter", "filter", 255, $search_filter));
        		$out->add($form->getRadioSet($lang->def('_RELEASE_OPTIONS'), 'only_released', 'only_released', $release_options, $only_released).'<div class="no_float"></div>');
        		$out->add($form->openButtonSpace());
        		$out->add($form->getButton("search_button", "search_button", $lang->def('_SEARCH')));
        		$out->add($form->getButton("reset_button", "reset_button", $lang->def('_UNDO')));
        		$out->add($form->closeButtonSpace());
        		$out->add($form->getCloseFieldset());
        */
        $print_button_1 = '<div><a id="print_selected_button_1" href="javascript:;">' . Get::img('course/certificate.png', Lang::t('_GENERATE_ALL_SELECTED', 'certificate')) . Lang::t('_GENERATE_ALL_SELECTED', 'certificate') . '</a></div>';
        $print_button_2 = '<div><a id="print_selected_button_2" href="javascript:;">' . Get::img('course/certificate.png', Lang::t('_GENERATE_ALL_SELECTED', 'certificate')) . Lang::t('_GENERATE_ALL_SELECTED', 'certificate') . '</a></div>';
        cout('<div class="quick_search_form">' . Form::getInputTextfield("_FILTER", "filter", "filter", $search_filter, '', 255, '') . Form::getButton("search_button", "search_button", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("reset_button", "reset_button", Lang::t('_RESET', 'standard'), "reset_b") . '<br />' . '<br />' . $lang->def('_RELEASE_OPTIONS') . ': ' . Form::getInputRadio('only_released_0', 'only_released', '0', $only_released == 0, '') . ' <label class="label_normal" for="only_released_0">' . Lang::t('_ALL', 'certificate') . '</label>' . '&nbsp;&nbsp;&nbsp;&nbsp;' . Form::getInputRadio('only_released_1', 'only_released', '1', $only_released == 1, '') . ' <label class="label_normal" for="only_released_1">' . Lang::t('_ONLY_RELEASED', 'certificate') . '</label>' . '&nbsp;&nbsp;&nbsp;&nbsp;' . Form::getInputRadio('only_released_2', 'only_released', '2', $only_released == 2, '') . ' <label class="label_normal" for="only_released_2">' . Lang::t('_ONLY_TO_RELEASE', 'certificate') . '</label>' . Form::closeForm() . '</div>', 'content');
        $navbar = $tb->getNavBar($ini, $totalrows);
        $out->add($print_button_1 . '<br />' . $navbar . $tb->getTable() . $navbar . '<br />' . $print_button_2);
        $out->add($form->closeForm());
    } else {
        $out->add($lang->def('_NO_USER_FOR_CERTIFICATE'));
    }
    $out->add($back_ui . '</div>');
    addCss('style_menu', 'lms');
    Util::get_js(Get::rel_path('lms') . '/modules/pcertificate/pcertificate.js', true, true);
    $script = 'var ajax_url="ajax.server.php?plf=lms&mn=pcertificate"; var _STOP="' . $lang->def('_STOP') . '"; ' . 'var glob_id_certificate = ' . (int) $id_certificate . ', glob_id_course = ' . (int) $id_course . ';' . 'var single_list = [' . (count($downloadables) ? '"' . implode('","', $downloadables) . '"' : '') . ']; ' . 'var reload_url = "' . str_replace('&amp;', '&', isset($form_url) ? $form_url : '') . '", _ERROR_PARSE = "' . $lang->def('_OPERATION_FAILURE') . '", _SUCCESS = "' . $lang->def('_OPERATION_SUCCESSFUL') . '";';
    $out->add('<script type="text/javascript">' . $script . '</script>', 'page_head');
}
Example #9
0
 function printOut()
 {
     YuiLib::load();
     //addJs($GLOBALS['where_framework_relative'].'/modules/directory/', 'ajax.directory.js');
     Util::get_js(Get::rel_path('adm') . '/modules/directory/ajax.directory.js', true, true);
     require_once _base_ . '/lib/lib.user_profile.php';
     $profile = new UserProfile(getLogUserId());
     $profile->init('profile', 'framework', 'modname=directory&op=org_chart', 'ap');
     $profile->addStyleSheet('lms');
     $GLOBALS['page']->add('<script type="text/javascript">' . ' setup_directory(); ' . '</script>', 'page_head');
     $out = '';
     if ($this->select_all) {
         // This is not a beautiful position for this operation but at this point
         // I'm sure that all filter was applied
         $rs_all = $this->data->getAllRowsIdst();
         if ($rs_all !== FALSE) {
             $this->itemSelectedMulti = array();
             while (list($all_idst) = sql_fetch_row($rs_all)) {
                 $this->itemSelectedMulti[] = $all_idst;
             }
         }
         $this->itemSelected = $this->itemSelectedMulti;
     }
     if ($this->deselect_all) {
         // This is not a beautiful position for this operation but at this point
         // I'm sure that all filter was applied
         $this->itemSelectedMulti = array();
         $this->itemSelected = array();
     }
     require_once _base_ . '/lib/lib.form.php';
     $ord = importVar('ord', false, 'trans');
     $flip = importVar('flip', true, 0);
     $filter = new Form();
     $out .= $filter->getOpenFieldset($this->lang->def('_SEARCH'));
     $out .= $filter->getHidden('ord', 'ord', $ord);
     $out .= $filter->getHidden('flip', 'flip', $flip);
     if ($this->lms_editions_filter === true) {
         if (isset($GLOBALS['course_descriptor']) && $GLOBALS['course_descriptor']->hasEdition()) {
             // add editions filter ============================================================
             $ed_list = array();
             if ($this->editions == false) {
                 $this->editions = $GLOBALS['course_descriptor']->getEditionsSimpleList(getLogUserId(), true);
             }
             $sel = isset($_POST[$this->id]['edition_filter']) ? (int) $_POST[$this->id]['edition_filter'] : $GLOBALS['course_descriptor']->getActualEditionsForUser(getLogUserId());
             if (!empty($this->editions)) {
                 $out .= $filter->getDropdown($this->lang->def('_FILTER_BY_EDITION'), $this->id . '_edition_filter', $this->id . '[edition_filter]', $this->editions, $sel);
             }
         }
     }
     // end lms editions filter
     if ($this->show_simple_filter === TRUE) {
         // show simple filter ============================================================
         $out .= $filter->getTextfield($this->lang->def('_SIMPLE_FILTER'), $this->id . '_simple_fulltext_search', $this->id . '[simple_fulltext_search]', 255, isset($_POST[$this->id]['simple_fulltext_search']) ? strip_tags(html_entity_decode($_POST[$this->id]['simple_fulltext_search'])) : '', strip_tags($this->lang->def('_SIMPLE_FILTER')));
         $out .= '<div class="align_right">' . $filter->getButton($this->id . '_search', $this->id . '[search]', $this->lang->def('_SEARCH'), 'button_nowh') . '</div>';
     } else {
         // show complex filter ===========================================================
         $out .= '<h2 id="customize_filter">' . $this->lang->def('_CUSTOMIZE_FILTERS') . '</h2>';
         // --- print check box for flat mode
         if ($this->show_flat_mode_flag) {
             $out .= $filter->getCheckbox($this->lang->def('_DIRECTORY_FILTER_FLATMODE'), $this->id . '_flat_mode', $this->id . '[flat_mode]', 'flat_mode', $this->flat_mode, "onclick=\"window.document.forms['directory_org_chart'].submit();\"");
         } else {
             $out .= $filter->getHidden($this->id . '_flat_mode', $this->id . '[flat_mode]', $this->flat_mode ? 'flat_mode' : '');
         }
         // line for add a field filter
         $out .= $filter->openFormLine();
         foreach ($this->add_nat_fields as $nat_id => $nat_info) {
             $local_arr_fields_translation[$nat_id] = $this->lang->def('_DIRECTORY_FILTER_' . $nat_id);
         }
         $filter_to_show = $this->arr_fields_translation;
         if (is_array($this->arr_fields_filter)) {
             foreach ($this->arr_fields_filter as $filter_info) {
                 if (isset($filter_info['fieldname'])) {
                     unset($filter_to_show[$filter_info['fieldname']]);
                 } else {
                     unset($filter_to_show[$filter_info[0]]);
                 }
             }
         }
         if (is_array($filter_to_show) && !empty($filter_to_show)) {
             $out .= $filter->getInputDropdown('new_filter', $this->id . '_add_field_filter', $this->id . '[add_field_filter]', $filter_to_show, '', '');
             $out .= $filter->getButton($this->id . '_add_filter', $this->id . '[add_filter]', $this->lang->def('_NEW_FILTER'), 'button_nowh');
         }
         $out .= $filter->getButton($this->id . '_del_filter', $this->id . '[del_filter]', $this->lang->def('_RESET'), 'button_nowh');
         $out .= $filter->closeFormLine();
         if (is_array($this->arr_fields_filter)) {
             foreach ($this->arr_fields_filter as $field_id => $field_prop) {
                 if (!isset($field_prop['fieldname'])) {
                     // custom field
                     $arr_field_info = $this->field_list->getBaseFieldInfo($field_prop[FIELD_INFO_TYPE]);
                     require_once $GLOBALS['where_framework'] . '/modules/field/' . $arr_field_info[FIELD_BASEINFO_FILE];
                     $field_obj = new $arr_field_info[FIELD_BASEINFO_CLASS]($field_id);
                     $del_spot = '<input type="image" class="cancel_filter" ' . ' src="' . getPathImage('framework') . 'standard/cancel.png"' . ' id="' . $this->id . '_del_filter_' . $field_id . '"' . ' name="' . $this->id . '[del_filter][' . $field_id . ']"' . ' title="' . $this->lang->def('_DEL') . '"' . ' alt="' . $this->lang->def('_DEL') . '" />';
                     $out .= $field_obj->play_filter($field_id, isset($field_prop['value']) ? $field_prop['value'] : false, $field_prop[FIELD_INFO_TRANSLATION], $this->id, $del_spot, '', $field_prop[FIELD_INFO_ID]);
                     //play_filter( $id_field, $value = FALSE, $label = FALSE, $field_prefix = FALSE, $other_after = '', $other_before = '', $field_special = FALSE )
                 } else {
                     // base field
                     $arr_field_info = $this->field_list->getBaseFieldInfo($field_prop['field_type']);
                     require_once $GLOBALS['where_framework'] . '/modules/field/' . $arr_field_info[FIELD_BASEINFO_FILE];
                     $field_obj = new $arr_field_info[FIELD_BASEINFO_CLASS](0);
                     $del_spot = '<input type="image" class="cancel_filter" ' . ' src="' . getPathImage('framework') . 'standard/cancel.png"' . ' id="' . $this->id . '_del_filter_' . $field_id . '"' . ' name="' . $this->id . '[del_filter][' . $field_id . ']"' . ' title="' . $this->lang->def('_DEL') . '"' . ' alt="' . $this->lang->def('_DEL') . '" />';
                     $out .= $field_obj->play_filter($field_id, isset($field_prop['value']) ? $field_prop['value'] : false, $this->lang->def('_DIRECTORY_FILTER_' . $field_prop['fieldname']), $this->id, $del_spot, '', '');
                 }
             }
         }
         $out .= $filter->openButtonSpace();
         $out .= $filter->getButton('search', 'search', $this->lang->def('_SEARCH'));
         $out .= $filter->closeButtonSpace();
     }
     // end else for filter
     $out .= $filter->getCloseFieldset();
     // ---------------------------------------------------------------------------------------
     // set order rows
     if (is_array($this->arr_fields_order)) {
         foreach ($this->arr_fields_order as $ordFieldName => $isDesc) {
             $this->data->setOrderCol($ordFieldName, $isDesc);
         }
     }
     $this->getRows($this->_getStartRow(), $this->_getRowsPage());
     $totRow = $this->getTotalRows();
     if ($totRow == -1) {
         $totRow = $this->getLoadedRows();
     }
     $colInfo = $this->_getCols();
     $colData = $colInfo;
     $this->rend->setCaption($this->_getTitle());
     $type_h = array();
     $cont_h = array();
     while (list($key, $contentCell) = each($colInfo)) {
         if ($contentCell['toDisplay']) {
             $type_h[] = $contentCell['hClass'];
             $cont_h[] = $contentCell['hLabel'];
         }
     }
     reset($colInfo);
     $this->rend->addHead($cont_h, $type_h);
     while ($values = $this->fetchRecord()) {
         $colData = array();
         foreach ($colInfo as $key => $fieldInfo) {
             $colData[] = $values[$colInfo[$key]['data']];
         }
         $this->rend->addBody($colData, false, false, 'user_row_' . $values['idst']);
         if ($this->_expand_user == $values['idst']) {
             // extra user info if requested
             $this->rend->addBodyExpanded($this->userExtraData($this->_expand_user), 'user_more_info');
         }
     }
     if ($this->insNew) {
         $this->rend->addActionAdd('<input type="submit" class="transparent_add_button"' . ' id="' . $this->id . '_' . $this->_getOpCreateItemId() . '" ' . ' name="' . $this->id . '[' . $this->_getOpCreateItemId() . '][0]" ' . ' value="' . $this->lang->def('_ADD') . '"' . ' title="' . $this->_getCreateLabel() . '" ' . ' alt="' . $this->_getCreateAlt() . '" />');
     }
     $this->rend->initNavBar($this->_getIdInitRowId(), 'button');
     $out .= $this->rend->getTable() . $this->rend->getNavBar($this->_getStartRow(), $totRow) . $this->printState();
     //prepare delete confirm popups [id format: "usersmembersdirectory__listview_opdeleteitem__" ]
     $lang =& DoceboLanguage::CreateInstance('standard');
     require_once _base_ . '/lib/lib.dialog.php';
     setupFormDialogBox('directory_org_chart', 'index.php?modname=directory&op=org_chart', 'input[name*=_listview_opdeleteitem_]', $lang->def('_AREYOUSURE'), $lang->def('_CONFIRM'), $lang->def('_UNDO'), 'function(o) { return o.title; }', 'usersmembersdirectory__listview_opdeleteitem__', 'idst', 'deleteperson');
     //tree remove user from branch confirm popup
     setupSimpleFormDialogBox('directory_org_chart', 'input[name*=_listview_opremoveitem_]');
     // ---------------------------------------------------------------------------------------
     if ($this->select_all) {
         $arr_notPrint = array_diff($this->itemSelectedMulti, $this->printedItems);
         foreach ($arr_notPrint as $id_notPrint) {
             $out .= '<input type="checkbox" ' . ' id="' . DIRECTORY_ID . DIRECTORY_OP_SELECTITEM . '_' . $id_notPrint . '" ' . 'name="' . DIRECTORY_ID . '[' . DIRECTORY_OP_SELECTITEM . '][' . $id_notPrint . ']" ' . 'value="" checked="checked" style="display:none;" />';
         }
     }
     return $out;
 }
Example #10
0
function view_report_certificate()
{
    checkPerm('view');
    require_once _lms_ . '/lib/lib.certificate.php';
    require_once _lms_ . '/lib/lib.course.php';
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $lang =& DoceboLanguage::createInstance('certificate', 'lms');
    $deletion = importVar('deletion', true, 0);
    if ($deletion) {
        switch ($deletion) {
            case 1:
                $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
            case 2:
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
            case 3:
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
        }
    }
    $certificate = new Certificate();
    $id_certificate = importVar('id_certificate', true, 0);
    $id_course = importVar('id_course', true, 0);
    $selection = importVar('selection', false, array());
    //all possible selected values
    $selected = importVar('selected', false, array());
    //effectively selected values with checkbox
    $sel = importVar('old_selection', false, '');
    //selected values from previous table pages
    if ($sel != '') {
        $total_selection = explode(',', $sel);
    } else {
        $total_selection = array();
    }
    //update total selection
    foreach ($selection as $key => $val) {
        if (in_array($val, $selected)) {
            if (!in_array($val, $total_selection)) {
                $total_selection[] = $val;
            }
        } else {
            $index = array_search($val, $total_selection);
            if ($index !== false) {
                array_splice($total_selection, $index, 1);
            }
        }
    }
    $search_filter = importVar('filter', false, '');
    $only_released = importVar('only_released', true, 0);
    //which command?
    if (importVar('search_button', false, false) !== false) {
    }
    if (importVar('reset_button', false, false) !== false) {
        $search_filter = '';
        $only_released = 0;
    }
    if (importVar('print_button', false, false) !== false) {
    }
    $numtablerows = Get::sett('visuItem', 25);
    $tb = new Table($numtablerows, $lang->def('_CERTIFICATE_VIEW_CAPTION'), $lang->def('_CERTIFICATE_VIEW_CAPTION'));
    $tb->initNavBar('ini', 'button');
    $ini = $tb->getSelectedElement();
    $ini_param = Get::req('ini', DOTY_MIXED, array());
    //floor($ini / Get::sett('visuItem', 25));
    if (empty($ini_param)) {
        $ini_param = 1;
    } else {
        list($ini_param) = each($ini_param);
    }
    $tca = $GLOBALS['prefix_lms'] . "_certificate_assign as ca";
    $tcc = $GLOBALS['prefix_lms'] . "_certificate_course as cc";
    $tcu = $GLOBALS['prefix_lms'] . "_courseuser as cu";
    $tu = $GLOBALS['prefix_fw'] . "_user as u";
    $where = "";
    if ($search_filter != '') {
        $where .= " AND (u.userid LIKE '%" . $search_filter . "%' OR u.lastname LIKE '%" . $search_filter . "%' OR u.firstname LIKE '%" . $search_filter . "%') ";
    }
    if ($only_released > 0) {
        $where = " AND ca.on_date " . ($only_released == 1 ? "IS NOT" : "IS") . " NULL ";
    }
    //$where .= " AND ".$aval_status." ".($only_released==1 ? "<" : ">=")." cu.status ";
    list($aval_status) = sql_fetch_row(sql_query("SELECT available_for_status FROM " . $tcc . " " . " WHERE id_certificate='" . (int) $id_certificate . "' AND id_course='" . (int) $id_course . "'"));
    switch ($aval_status) {
        case AVS_ASSIGN_FOR_ALL_STATUS:
            $aval_status = " 1 ";
            break;
        case AVS_ASSIGN_FOR_STATUS_INCOURSE:
            $aval_status = " cu.status = " . _CUS_BEGIN . " ";
            break;
        case AVS_ASSIGN_FOR_STATUS_COMPLETED:
            $aval_status = " cu.status = " . _CUS_END . " ";
            break;
    }
    list($totalrows) = sql_fetch_row(sql_query("SELECT COUNT(*) " . " FROM ( " . $tu . " JOIN " . $tcu . " ON (u.idst = cu.idUser) ) LEFT JOIN " . $tca . " " . " ON ( ca.id_course = cu.idCourse AND ca.id_user=cu.idUser ) " . " WHERE (ca.id_certificate='" . (int) $id_certificate . "' OR ca.id_certificate IS NULL) AND " . $aval_status . " " . " AND cu.idCourse='" . (int) $id_course . "' " . $where));
    $query = "SELECT u.userid, u.firstname, u.lastname, cu.date_complete, ca.on_date, cu.idUser as id_user, cu.status " . " FROM ( " . $tu . " JOIN " . $tcu . " ON (u.idst = cu.idUser) ) LEFT JOIN " . $tca . " " . " ON ( ca.id_course = cu.idCourse AND ca.id_user=cu.idUser ) " . " WHERE (ca.id_certificate='" . (int) $id_certificate . "' OR ca.id_certificate IS NULL) AND " . $aval_status . " " . " AND cu.idCourse='" . (int) $id_course . "' " . $where . " ORDER BY u.userid LIMIT " . $ini . ", " . $numtablerows;
    //cout('<pre>'.print_r($_POST, true).'</pre>');
    //cout($query);
    $res = sql_query($query);
    $from = Get::req('from', DOTY_MIXED, '');
    if ($from === 'course') {
        $back_ui = getBackUi('index.php?r=alms/course/certificate&amp;id_course=' . (int) $id_course, $lang->def('_BACK'));
        $out->add(getTitleArea(array('index.php?r=alms/course/certificate&amp;id_course=' . (int) $id_course => $lang->def('_CERTIFICATE_ASSIGN_STATUS', 'course'), $lang->def('_COURSES')), 'certificate'));
    } else {
        $back_ui = getBackUi('index.php?modname=certificate&amp;op=report_certificate&amp;id_certificate=' . (int) $id_certificate, $lang->def('_BACK'));
        $out->add(getTitleArea(array('index.php?modname=certificate&amp;op=certificate' => $lang->def('_TITLE_CERTIFICATE'), 'index.php?modname=certificate&amp;op=report_certificate&amp;id_certificate=' . (int) $id_certificate => $lang->def('_COURSES'), $lang->def('_CERTIFICATE_VIEW_CAPTION')), 'certificate'));
    }
    $out->add('<div class="std_block">' . $back_ui);
    $numrows = sql_num_rows($res);
    $downloadables = array();
    if ($numrows > 0) {
        $clang =& DoceboLanguage::CreateInstance('course', 'lms');
        $type_h = array('image', '', '', '', '', '', '', 'image', 'image');
        $cont_h = array('', $lang->def('_USERNAME'), $lang->def('_LASTNAME'), $lang->def('_FIRSTNAME'), $clang->def('_STATUS'), $lang->def('_DATE'), $lang->def('_RELASE_DATE'), Get::sprite('subs_pdf', Lang::t('_TITLE_VIEW_CERT', 'certificate')), Get::sprite('subs_del', Lang::t('_DEL', 'certificate')));
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        $acl_man =& $GLOBALS['current_user']->getAclManager();
        $arr_status = array(_CUS_CONFIRMED => $clang->def('_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $clang->def('_USER_STATUS_SUBS'), _CUS_BEGIN => $clang->def('_USER_STATUS_BEGIN'), _CUS_END => $clang->def('_USER_STATUS_END'), _CUS_SUSPEND => $clang->def('_USER_STATUS_SUSPEND'));
        //foreach($report_info as $info_report)
        while ($info = sql_fetch_assoc($res)) {
            $cont = array();
            $can_assign = (bool) ($info['on_date'] == '');
            $input_id = $info['id_user'];
            $sel_cell_content = '';
            $label_open = '';
            $label_close = '';
            if ($can_assign) {
                $input = '<input type="hidden" id="selection_' . $input_id . '" name="selection[' . $input_id . ']" value="' . $input_id . '"/> ';
                if (in_array($input_id, $total_selection)) {
                    $checked = ' checked="checked"';
                } else {
                    $checked = '';
                }
                $sel_cell_content .= $input . '<input type="checkbox" id="selected_' . $input_id . '" name="selected[' . $input_id . ']" value="' . $input_id . '"' . $checked . '/>';
                $label_open = '<label for="selected_' . $input_id . '">';
                $label_close = '</label>';
            }
            $userid = $acl_man->relativeId($info['userid']);
            $cont[] = $sel_cell_content;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($userid, $search_filter) : $userid) . $label_close;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($info['lastname'], $search_filter) : $info['lastname']) . $label_close;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($info['firstname'], $search_filter) : $info['firstname']) . $label_close;
            $cont[] = $arr_status[$info['status']];
            $cont[] = $info['date_complete'];
            $cont[] = $info['on_date'];
            $url = 'index.php?modname=certificate&amp;certificate_id=' . $id_certificate . '&amp;course_id=' . $id_course . '&amp;user_id=' . $info['id_user'];
            $dl_url = $url . "&amp;op=send_certificate";
            if ($can_assign) {
                $downloadables[] = 'dl_single_' . $input_id;
            }
            $cont[] = $can_assign ? '<a id="dl_single_' . $input_id . '" class="ico-wt-sprite subs_pdf" href="javascript:;" title="' . $lang->def('_GENERATE') . '"><span>' . $lang->def('_GENERATE') . '</span></a>' : '<a id="dl_single_' . $input_id . '" class="ico-wt-sprite subs_pdf" href="' . $dl_url . '" title="' . $lang->def('_DOWNLOAD') . '"><span>' . $lang->def('_DOWNLOAD') . '</span></a>';
            $cont[] = $can_assign ? '' : Get::sprite_link('subs_del', $url . '&amp;op=del_report_certificate', Lang::t('_DEL', 'certificate'));
            $tb->addBody($cont);
        }
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=del_report_certificate]');
        //search filter ...
        $release_options = array($lang->def('_ALL') => 0, $lang->def('_RELEASED') => 1, $lang->def('_TO_RELEASE') => 2);
        //search and store all non-available certificates
        $all_selection = array();
        $query = "SELECT cu.idUser as id_user " . " FROM ( " . $tu . " JOIN " . $tcu . " ON (u.idst = cu.idUser) ) LEFT JOIN " . $tca . " " . " ON ( ca.id_course = cu.idCourse AND ca.id_user=cu.idUser ) " . " WHERE (ca.id_certificate='" . (int) $id_certificate . "' OR ca.id_certificate IS NULL) AND " . $aval_status . " " . " AND cu.idCourse='" . (int) $id_course . "' " . ($search_filter != '' ? " AND (u.userid LIKE '%" . $search_filter . "%' OR u.lastname LIKE '%" . $search_filter . "%' OR u.firstname LIKE '%" . $search_filter . "%') " : "") . " AND ca.on_date IS NULL ";
        $res = sql_query($query);
        while (list($id_user) = sql_fetch_row($res)) {
            $all_selection[] = $id_user;
        }
        //---
        $form = new Form();
        $submit_url = "index.php?modname=certificate&amp;op=view_report_certificate&amp;id_certificate=" . (int) $id_certificate . "&amp;id_course=" . (int) $id_course;
        $out->add($form->openForm("certificates_emission", $submit_url) . $form->getHidden('old_selection', 'old_selection', implode(',', $total_selection)) . $form->getHidden('all_selection', 'all_selection', implode(',', $all_selection)) . $form->getHidden('active_text_filter', 'active_text_filter', $search_filter) . $form->getHidden('active_only_released', 'active_only_released', $only_released) . $form->getHidden('active_ini', 'active_ini', $ini_param) . '<div class="quick_search_form">' . '<div class="simple_search_box">' . Form::getInputTextfield("search_t", "filter", "filter", $search_filter, '', 255, '') . Form::getButton("search_button", "search_button", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("reset_button", "reset_button", Lang::t('_RESET', 'standard'), "reset_b") . '</div>' . '<a id="advanced_search" class="advanced_search" href="javascript:;">' . Lang::t("_ADVANCED_SEARCH", 'standard') . '</a>' . '<div id="certificate_release_as" class="advanced_search_options" style="display: ' . ($only_released != 0 ? 'block' : 'none') . '">' . Form::getRadioHoriz(Lang::t('_FILTER', 'certificate'), 'only_released', 'only_released', $release_options, $only_released) . '</div>' . '</div>' . '<script type="text/javascript">' . 'YAHOO.util.Event.addListener("advanced_search", "click", function(e){
				var el = YAHOO.util.Dom.get("certificate_release_as");
				if (el.style.display != \'block\') el.style.display = \'block\';
				else el.style.display = \'none\';
			});' . '</script>', 'content');
        $delgen_url = 'index.php?modname=certificate&amp;op=del_gen_certificate' . '&amp;id_certificate=' . (int) $id_certificate . '&amp;id_course=' . (int) $id_course;
        $delgen_txt = Lang::t('_DELETE_ALL_GENERATED', 'certificate');
        $print_button_1 = '<div>' . '<a id="print_selected_button_1" href="javascript:;">' . Get::img('course/certificate.png', Lang::t('_GENERATE_ALL_SELECTED', 'certificate')) . Lang::t('_GENERATE_ALL_SELECTED', 'certificate') . '</a>' . '</div>';
        $print_button_2 = '<div><a id="print_selected_button_2" href="javascript:;">' . Get::img('course/certificate.png', Lang::t('_GENERATE_ALL_SELECTED', 'certificate')) . Lang::t('_GENERATE_ALL_SELECTED', 'certificate') . '</a>' . '</div>';
        $print_button_1 .= Lang::t('_SELECT', 'directory') . ': ';
        $print_button_2 .= Lang::t('_SELECT', 'directory') . ': ';
        /*	
        		$print_button_1 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="select_page_1">'.Lang::t('_SELECT_PAGE', 'standard').'</a>';
        		$print_button_2 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="select_page_2">'.Lang::t('_SELECT_PAGE', 'standard').'</a>';
        		$print_button_1 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="unselect_page_1">'.Lang::t('_UNSELECT_PAGE', 'standard').'</a>';
        		$print_button_2 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="unselect_page_2">'.Lang::t('_UNSELECT_PAGE', 'standard').'</a>';
        */
        $print_button_1 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="select_all_1">' . Lang::t('_ALL_PAGES', 'directory') . '</a>';
        $print_button_2 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="select_all_2">' . Lang::t('_ALL_PAGES', 'directory') . '</a>';
        $print_button_1 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="unselect_all_1">' . Lang::t('_NONE', 'directory') . '</a>';
        $print_button_2 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="unselect_all_2">' . Lang::t('_NONE', 'directory') . '</a>';
        $navbar = $tb->getNavBar($ini, $totalrows);
        $out->add($print_button_1 . '<br />' . $navbar . $tb->getTable() . $navbar . '<br />' . $print_button_2);
        $out->add($form->closeForm());
    } else {
        $out->add($lang->def('_NO_CONTENT'));
    }
    $out->add($back_ui . '</div>');
    addCss('style_menu', 'lms');
    Util::get_js(Get::rel_path('base') . '/widget/dialog/dialog.js', true, true);
    Util::get_js(Get::rel_path('lms') . '/admin/modules/certificate/certificate.js?rnd=' . time(), true, true);
    //addJs($GLOBALS['where_lms_relative'].'/admin/modules/certificate/', 'certificate.js');
    $script = 'var ajax_url="ajax.adm_server.php?plf=lms&mn=certificate"; var _STOP="' . $lang->def('_STOP') . '"; ' . 'var glob_id_certificate = ' . (int) $id_certificate . ', glob_id_course = ' . (int) $id_course . ';' . 'var single_list = [' . (count($downloadables) ? '"' . implode('","', $downloadables) . '"' : '') . ']; ' . 'var reload_url = "' . str_replace('&amp;', '&', isset($submit_url) ? $submit_url : '') . '", ' . '_ERROR_PARSE = "' . $lang->def('_OPERATION_FAILURE') . '", _SUCCESS = "' . $lang->def('_OPERATION_SUCCESSFUL') . '", ' . '_AREYOUSURE="' . Lang::t('_AREYOUSURE', 'standard') . '";';
    $out->add('<script type="text/javascript">' . $script . '</script>', 'page_head');
}
|   License  http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt           |
|                                                                           |
|   from docebo 4.0.5 CE 2008-2012 (c) docebo                               |
|   License http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt            |
\ ======================================================================== */
require_once _lms_ . '/lib/category/class.categorytree.php';
$treecat = new Categorytree();
require_once _base_ . '/lib/lib.json.php';
$json = new Services_JSON();
//checkPerm('view', true, 'course', 'lms');
require_once _lms_ . '/lib/folder_tree/lib.category_tree.php';
// Resolve the requested action
$command = Get::req('command', DOTY_STRING, false);
switch ($command) {
    case "expand":
        $lang =& DoceboLanguage::CreateInstance('course', 'lms');
        $node_id = Get::req('node_id', DOTY_INT, 0);
        $initial = Get::req('initial', DOTY_INT, 0);
        //$initial = 0;
        $result = array();
        if ($initial == 1) {
            if (!isset($_SESSION['course_category']['filter_status']['c_category'])) {
                $_SESSION['course_category']['filter_status']['c_category'] = 0;
            }
            $treestatus =& $_SESSION['course_category']['filter_status']['c_category'];
            $result = array();
            $folders = $treecat->getOpenedFolders($treestatus);
            $ref =& $result;
            foreach ($folders as $folder) {
                if ($folder > 0) {
                    for ($i = 0; $i < count($ref); $i++) {
 public function __construct($id)
 {
     parent::__construct($id);
     $lang =& DoceboLanguage::CreateInstance('course', 'lms');
     if (Docebo::user()->getUserLevelId() == ADMIN_GROUP_PUBLICADMIN) {
         $this->serverUrl = Get::rel_path('lms') . '/ajax.server.php?plf=lms&file=coursetableview&sf=table_view';
         $this->addFormatter("man_subscr", 'courseFormatters.p_man_subscr');
     } else {
         $this->serverUrl = Get::rel_path('lms') . '/ajax.adm_server.php?plf=lms&file=coursetableview&sf=table_view';
         $this->addFormatter("man_subscr", 'courseFormatters.man_subscr');
     }
     $this->addFormatter("classroom", 'courseFormatters.classroom');
     $this->addFormatter("certificate", 'courseFormatters.certificate');
     $this->addFormatter("competence", 'courseFormatters.competence');
     $this->addFormatter("menu", 'courseFormatters.menu');
     $this->addFormatter("mod", 'courseFormatters.mod');
     $array_columns = array();
     if (checkPerm('mod', true, 'course', 'lms') || checkPerm('mod', true, 'public_course_admin', 'lms')) {
         $array_columns[] = array("key" => "code", "label" => $lang->def("_CODE"), "sortable" => true, "className" => 'min-cell', 'editor' => 'new YAHOO.widget.TextboxCellEditor({asyncSubmitter: saveData})');
         $array_columns[] = array("key" => "name", "label" => $lang->def("_COURSE_NAME"), "sortable" => true, 'editor' => 'new YAHOO.widget.TextboxCellEditor({asyncSubmitter: saveData})');
     } else {
         $array_columns[] = array("key" => "code", "label" => $lang->def("_CODE"), "sortable" => true, "className" => 'min-cell');
         $array_columns[] = array("key" => "name", "label" => $lang->def("_COURSE_NAME"), "sortable" => true);
     }
     //if(checkPerm('moderate', true, 'course', 'lms') || checkPerm('moderate', true, 'public_course_admin', 'lms'))
     $array_columns[] = array("key" => "waiting", "label" => $lang->def("_WAITING_USERS"), "className" => 'img-cell');
     if (checkPerm('subscribe', true, 'course', 'lms') || checkPerm('subscribe', true, 'public_course_admin', 'lms')) {
         $array_columns[] = array("key" => "subscriptions", "label" => Get::img('course/subscribe.png', $lang->def('_SUBSCRIBE')), "sortable" => true, "className" => 'img-cell', "formatter" => $this->getCellFormatter("man_subscr"));
     }
     if (checkPerm('mod', true, 'course', 'lms') || checkPerm('mod', true, 'public_course_admin', 'lms')) {
         $array_columns[] = array("key" => "classroom", "label" => Get::img('course/classroom-cal.png', $lang->def('_CLASSROOM')), "className" => 'img-cell');
         $array_columns[] = array("key" => "certificate", "label" => Get::img('course/certificate.png', Lang::t('_CERTIFICATE', 'certificate', 'lms')), "className" => 'img-cell', "formatter" => $this->getCellFormatter("certificate"));
         $array_columns[] = array("key" => "competence", "label" => Get::img('course/competences.png', Lang::t('_COMPETENCES', 'competences', 'lms')), "className" => 'img-cell', "formatter" => $this->getCellFormatter("competence"));
         $array_columns[] = array("key" => "menu", "label" => Get::img('course/menu.png', $lang->def('_ASSIGN_MENU')), "className" => 'img-cell', "formatter" => $this->getCellFormatter("menu"));
     }
     if (checkPerm('add', true, 'course', 'lms') || checkPerm('add', true, 'public_course_admin', 'lms')) {
         $array_columns[] = array("key" => "dup", "label" => Get::img('standard/dup.png', $lang->def('_MAKE_A_COPY')), "className" => 'img-cell');
     }
     if (checkPerm('mod', true, 'course', 'lms') || checkPerm('mod', true, 'public_course_admin', 'lms')) {
         $array_columns[] = array("key" => "mod", "label" => Get::img('standard/edit.png', $lang->def('_MOD')), "className" => 'img-cell', "formatter" => $this->getCellFormatter("mod"));
     }
     if (checkPerm('del', true, 'course', 'lms') || checkPerm('del', true, 'public_course_admin', 'lms')) {
         $array_columns[] = array("key" => "del", "label" => Get::img('standard/delete.png', $lang->def('_DEL')), "className" => 'img-cell', "formatter" => $this->getCellFormatter('delete'));
     }
     $this->columns = $array_columns;
     $this->fields = array("idCourse", "code", "name", "status", "waiting", "subscriptions", "classroom", "certificate", "competence", "menu", "dup", "mod", "del");
     $this->addOption('langs', array('_START' => $lang->def('_START'), '_PREV' => $lang->def('_PREV'), '_NEXT' => $lang->def('_NEXT'), '_END' => $lang->def('_END'), '_OF' => $lang->def('_OF'), 'MSG_EMPTY' => $lang->def('_EMPTY'), 'MSG_ERROR' => $lang->def('_SERVER_CONNECTION_ERROR'), 'MSG_LOADING' => $lang->def('_LOADING'), '_YES' => $lang->def('_CONFIRM'), '_NO' => $lang->def('_UNDO'), '_AREYOUSURE' => $lang->def('_AREYOUSURE'), '_DEL' => $lang->def('_DEL'), '_SERVER_CONNECTION_ERROR' => $lang->def('_SERVER_CONNECTION_ERROR')));
     if (!isset($_SESSION['course_category']['filter_status'])) {
         $_SESSION['course_category']['filter_status'] = array('c_category' => 0, 'c_filter' => '', 'c_flatview' => true, 'c_waiting' => false);
     } else {
         $filter =& $_SESSION['course_category']['filter_status'];
         if (!isset($filter['c_category'])) {
             $_SESSION['course_category']['filter_status']['c_category'] = 0;
         }
         if (!isset($filter['c_filter'])) {
             $_SESSION['course_category']['filter_status']['c_filter'] = '';
         }
         if (!isset($filter['c_flatview'])) {
             $_SESSION['course_category']['filter_status']['c_flatview'] = true;
         }
         if (!isset($filter['c_waiting'])) {
             $_SESSION['course_category']['filter_status']['c_waiting'] = '';
         }
     }
     $filter =& $_SESSION['course_category']['filter_status'];
     $this->addOption('baseUrl', 'index.php');
     $this->addOption('imageUrl', Get::tmpl_path('base') . 'images/');
     $this->addOption('initialFilter', array('c_category' => array('operator' => '', 'value' => $filter['c_category']), 'c_filter' => array('operator' => '', 'value' => $filter['c_filter']), 'c_flatview' => array('operator' => '', 'value' => $filter['c_flatview']), 'c_waiting' => array('operator' => '', 'value' => $filter['c_waiting'])));
     $this->addOption('deleteDialog', array('id' => 'idCourse', 'name' => 'name'));
 }
Example #13
0
 /**
  * retrive the user statistic in the lms
  */
 function getUserCourseStat($id_user)
 {
     require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
     $stats = array();
     $c_lang =& DoceboLanguage::CreateInstance('course', 'lms');
     $lang =& DoceboLanguage::createInstance('course', 'lms');
     $id_courses = array();
     $query_course_user = "******" . $GLOBALS['prefix_lms'] . "_courseuser AS cu\r\n\t\t\tJOIN " . $GLOBALS['prefix_lms'] . "_course AS c\r\n\t\tWHERE cu.idCourse = c.idCourse\r\n\t\t\tAND cu.idUser = '******'";
     $re_course_user = sql_query($query_course_user);
     while (list($id_c, $code, $name, $status, $status_user, $date_inscr, $date_first_access, $date_complete) = sql_fetch_row($re_course_user)) {
         $id_courses[] = $id_c;
         $stats[$id_c]['course_name'] = $name;
         $stats[$id_c]['course_code'] = $code;
         $course_status = array(CST_PREPARATION => $c_lang->def('_CST_PREPARATION', 'course', 'lms'), CST_AVAILABLE => $c_lang->def('_CST_AVAILABLE', 'course', 'lms'), CST_EFFECTIVE => $c_lang->def('_CST_CONFIRMED', 'course', 'lms'), CST_CONCLUDED => $c_lang->def('_CST_CONCLUDED', 'course', 'lms'), CST_CANCELLED => $c_lang->def('_CST_CANCELLED', 'course', 'lms'));
         $stats[$id_c]['course_status'] = $course_status[$status];
         $cman = new CourseSubscribe_Manager();
         $arr_status = $cman->getUserStatus();
         $stats[$id_c]['user_status'] = isset($arr_status[$status_user]) ? $arr_status[$status_user] : "";
         $stats[$id_c]['date_inscr'] = $date_inscr;
         $stats[$id_c]['date_first_access'] = $date_first_access;
         $stats[$id_c]['date_complete'] = $date_complete;
         $stats[$id_c]['score_init'] = '';
         $stats[$id_c]['score_final'] = '';
         $stats[$id_c]['access_count'] = '';
         $stats[$id_c]['access_time'] = '';
         $stats[$id_c]['access_last'] = '';
         $stats[$id_c]['point_do'] = '';
     }
     //recover start and final score
     require_once $GLOBALS['where_lms'] . '/lib/lib.orgchart.php';
     $org_man = new OrganizationManagement(false);
     require_once $GLOBALS['where_lms'] . '/lib/lib.coursereport.php';
     $rep_man = new CourseReportManager();
     $score_course = $rep_man->getUserFinalScore(array($id_user));
     $score_start = $org_man->getStartObjectScore(array($id_user), $id_courses);
     $score_final = $org_man->getFinalObjectScore(array($id_user), $id_courses);
     while (list(, $id_c) = each($id_courses)) {
         if (isset($stats[$id_c])) {
             $stats[$id_c]['score_init'] = isset($score_start[$id_c][$id_user]) && $score_start[$id_c][$id_user]['max_score'] ? $score_start[$id_c][$id_user]['score'] . ' / ' . $score_start[$id_c][$id_user]['max_score'] : '';
             $stats[$id_c]['score_final'] = isset($score_final[$id_c][$id_user]) && $score_final[$id_c][$id_user]['max_score'] ? $score_final[$id_c][$id_user]['score'] . ' / ' . $score_final[$id_c][$id_user]['max_score'] : '';
         }
         $point_do = isset($score_course[$id_user][$id_c]) ? $score_course[$id_user][$id_c]['score'] : '';
         $point_max = isset($score_course[$id_user][$id_c]) ? $score_course[$id_user][$id_c]['max_score'] : '';
         $stats[$id_c]['point_do'] = $point_do !== '' ? number_format($point_do, 2) . ' / ' . number_format($point_max, 2) : '';
     }
     $query = "\r\n\t\tSELECT idCourse, COUNT(*), SUM(UNIX_TIMESTAMP(lastTime) - UNIX_TIMESTAMP(enterTime)), MAX(lastTime)\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_tracksession\r\n\t\tWHERE idUser = '******'\r\n\t\tGROUP BY idCourse ";
     $re_time = sql_query($query);
     while (list($id_c, $session_num, $time_num, $last_num) = sql_fetch_row($re_time)) {
         if (isset($stats[$id_c])) {
             $stats[$id_c]['access_count'] = $session_num;
             $stats[$id_c]['access_time'] = $time_num;
             $stats[$id_c]['access_last'] = $last_num;
         }
     }
     return $stats;
 }
Example #14
0
function presence()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    YuiLib::load();
    Util::get_js(Get::rel_path('lms') . '/admin/views/classroom/classroom.js', true, true);
    $id_date = Get::req('id_date', DOTY_INT, 0);
    $lang =& DoceboLanguage::CreateInstance('admin_date', 'lms');
    $date_man = new DateManager();
    $user_date = $date_man->getUserDateForCourse(getLogUserId(), $_SESSION['idCourse']);
    $date_info = $date_man->getDateInfoForPublicPresence($user_date);
    foreach ($date_info as $info_date) {
        $date_for_dropdown[$info_date['id_date']] = $info_date['code'] . ' - ' . $info_date['name'] . ' (' . Format::date($info_date['date_begin'], 'date') . ')';
    }
    if ($id_date == 0) {
        $id_date = isset($date_info[0]['id_date']) ? $date_info[0]['id_date'] : 0;
    }
    cout(getTitleArea(Lang::t('_ATTENDANCE')) . '<div class="std_block">', 'content');
    if (isset($_POST['save'])) {
        require_once $GLOBALS['where_lms'] . '/lib/lib.date.php';
        $date_man = new DateManager();
        $id_date = Get::req('id_date', DOTY_INT, 0);
        $score_min = Get::req('score_min', DOTY_INT, 0);
        $user = $date_man->getUserForPresence($id_date);
        $day = $date_man->getDateDay($id_date);
        $test_type = $date_man->getTestType($id_date);
        foreach ($user as $id_user => $user_info) {
            $user[$id_user]['score'] = Get::req('score_' . $id_user, DOTY_INT, 0);
            $user[$id_user]['note'] = Get::req('note_' . $id_user, DOTY_MIXED, '');
            $user[$id_user]['day_presence'] = array();
            for ($i = 0; $i < count($day); $i++) {
                $user[$id_user]['day_presence'][$day[$i]['id_day']] = Get::req('date_' . $day[$i]['id_day'] . '_' . $id_user, DOTY_INT, 0);
            }
        }
        if ($date_man->insDatePresence($_SESSION['id_course_date'], $id_date, $user, $day, $score_min)) {
            UIFeedback::info(Lang::t('_ATTENDANCE_SAVED', 'admin_date'));
        } else {
            UIFeedback::error(Lang::t('_ATTENDANCE_SAVED_ERROR', 'admin_date'));
        }
    }
    if ($id_date == 0) {
        cout(Lang::t('_NO_CONTENT', 'admin_date'), 'content');
    } else {
        $user = $date_man->getUserForPresence($id_date);
        $day = $date_man->getDateDay($id_date);
        $test_type = $date_man->getTestType($id_date);
        $user_presence = $date_man->getUserPresenceForDate($id_date);
        $tb = new Table(0, Lang::t('_ATTENDANCE', 'admin_date'), Lang::t('_ATTENDANCE', 'admin_date'));
        $cont_h = array(Lang::t('_USERNAME', 'admin_date'), Lang::t('_FULLNAME', 'admin_date'));
        $type_h = array('', '');
        foreach ($day as $id_day => $day_info) {
            $cont_h[] = Format::date($day_info['date_begin'], 'date') . '<br />' . '<a href="javascript:;" onClick="checkAllDay(' . $id_day . ')">' . Get::img('standard/checkall.png', Lang::t('_CHECK_ALL_DAY', 'presence') . '</a>') . ' ' . '<a href="javascript:;" onClick="unCheckAllDay(' . $id_day . ')">' . Get::img('standard/uncheckall.png', Lang::t('_UNCHECK_ALL_DAY', 'presence') . '</a>');
            $type_h[] = 'align_center';
        }
        $cont_h[] = '';
        $type_h[] = 'img-cell';
        if ($test_type == _DATE_TEST_TYPE_PAPER) {
            $cont_h[] = Lang::t('_SCORE', 'admin_date');
            $type_h[] = 'align_center';
        }
        $cont_h[] = Lang::t('_NOTES', 'admin_date');
        $type_h[] = 'align_center';
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        cout(Form::openForm('presence_form', 'index.php?modname=presence&amp;op=presence') . Form::openElementSpace() . Form::getDropdown(Lang::t('_SELECT_EDITION', 'admin_date'), 'id_date', 'id_date', $date_for_dropdown, $id_date) . Form::closeElementSpace() . Form::openElementSpace() . ($test_type == 1 ? Form::getTextfield(Lang::t('_MIN_SCORE', 'admin_date'), 'score_min', 'score_min', 255, '') : ''), 'content');
        $array_user_id = array();
        foreach ($user as $id_user => $user_info) {
            reset($day);
            $array_user_id[] = $id_user;
            $cont = array();
            $cont[] = $user_info['userid'];
            $cont[] = $user_info['lastname'] . ' ' . $user_info['firstname'];
            foreach ($day as $id_day => $day_info) {
                if (isset($user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]) && $user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]['presence'] == 1) {
                    $presence = true;
                } elseif (isset($user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]) && $user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]['presence'] == 0) {
                    $presence = false;
                } else {
                    $presence = false;
                }
                $cont[] = Form::getInputCheckbox('date_' . $id_day . '_' . $id_user, 'date_' . $id_day . '_' . $id_user, 1, $presence, false);
            }
            $cont[] = '<a href="javascript:;" onClick="checkAllUser(' . $id_user . ')">' . Get::img('standard/checkall.png', Lang::t('_CHECK_ALL_USER', 'presence') . '</a>') . '<br />' . '<a href="javascript:;" onClick="unCheckAllUser(' . $id_user . ')">' . Get::img('standard/uncheckall.png', Lang::t('_UNCHECK_ALL_USER', 'presence') . '</a>');
            if ($test_type == _DATE_TEST_TYPE_PAPER) {
                if (isset($user_presence[$id_user]['0000-00-00']) && $user_presence[$id_user]['0000-00-00']['presence'] == 1) {
                    $passed = true;
                } else {
                    $passed = false;
                }
                $cont[] = Form::getTextfield('', 'score_' . $id_user, 'score_' . $id_user, 255, isset($user_presence[$id_user]['0000-00-00']['score']) ? $user_presence[$id_user]['0000-00-00']['score'] : '0');
            }
            $cont[] = Form::getSimpleTextarea('', 'note_' . $id_user, 'note_' . $id_user, isset($user_presence[$id_user]['0000-00-00']['note']) ? $user_presence[$id_user]['0000-00-00']['note'] : '', false, false, false, 2);
            $tb->addBody($cont);
        }
        cout($tb->getTable() . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', Lang::t('_SAVE', 'admin_date')) . Form::closeElementSpace() . Form::closeForm() . '</div>', 'content');
        cout('<script type="text/javascript">' . 'var _MIN_SCORE_NOT_SET = "' . Lang::t('_MIN_SCORE_NOT_SET', 'admin_date') . '";' . 'YAHOO.util.Event.addListener("save", "click", controlMinScore);' . 'YAHOO.util.Event.addListener("id_date", "change", formSubmit);' . 'function checkAllDay(id_day)
{
	var days = YAHOO.util.Selector.query(\'input[id*=_\' + id_day + \'_]\');
	var i;

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

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

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

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

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

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

	for(i = 0; i < days.length; i++)
		days[i].checked = false;
}' . '</script>', 'content');
    }
    cout('</div>', 'content');
}
Example #15
0
function classroomToEdition()
{
    require_once _base_ . '/lib/lib.form.php';
    //require_once(_i18n_.'/lib.lang.php');
    require_once _base_ . '/lib/lib.table.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    if (isset($_POST['classroom_to_edition'])) {
        list($edition_id) = each($_POST['classroom_to_edition']);
    } else {
        $edition_id = importVar('edition_id', true, 0);
    }
    $of_loc = importVar('of_loc', false, '');
    $of_name = importVar('of_name', false, '');
    $form = new Form();
    $query_course_name = "SELECT idCourse, name\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_course_edition\r\n\tWHERE idCourseEdition = '" . $edition_id . "'";
    list($idCourse, $edition_name) = sql_fetch_row(sql_query($query_course_name));
    $lang =& DoceboLanguage::CreateInstance('course', 'lms');
    $tb = new Table(Get::sett('visuItem'), $lang->def('_CLASSROOMTOCOURSE_CAPTION'), $lang->def('_CLASSROOMTOCOURSE_CAPTION'));
    $tb->initNavBar('ini', 'link');
    $tb->setLink("index.php?modname=course&amp;op=classroom_to_edition&amp;edition_id={$edition_id}" . '&amp;of_loc=' . $of_loc . '&amp;of_name=' . $of_name);
    $ini = $tb->getSelectedElement();
    $checked_class = checkAvailableClass($idCourse, $edition_id);
    $classroom_order = "l.location, c.name ";
    if ($of_loc == 'loc') {
        $classroom_order = "l.location, c.name ";
    }
    if ($of_loc == 'locd') {
        $classroom_order = "l.location DESC, c.name ";
    }
    if ($of_name == 'name') {
        $classroom_order = "c.name, l.location ";
    }
    if ($of_name == 'namec') {
        $classroom_order = "c.name DESC, l.location ";
    }
    if ($of_loc == '' && $of_name == '') {
        $of_loc = 'loc';
    }
    //search query of classrooms ---------------------------------
    $query_classroom = "\r\n\tSELECT c.idClassroom, c.name, c.description, l.location\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_classroom AS c\r\n\t\tJOIN " . $GLOBALS['prefix_lms'] . "_class_location AS l\r\n\tWHERE l.location_id = c.location_id\r\n\tORDER BY " . $classroom_order . "\r\n\tLIMIT {$ini}," . Get::sett('visuItem');
    $re_classroom = sql_query($query_classroom);
    // search classrooms assigned --------------------------------
    $query_class_assigned = "\r\n\tSELECT classrooms\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_course_edition\r\n\twhere idCourseEdition= " . $edition_id . "";
    list($assigned_classroom) = sql_fetch_row(sql_query($query_class_assigned));
    $query_classroom_tot = "\r\n\tSELECT COUNT(*)\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_classroom ";
    list($tot_classroom) = sql_fetch_row(sql_query($query_classroom_tot));
    // table intestation
    $type_h = array('', '', '', 'image');
    $cont_h = array('<a href="' . "index.php?modname=course&amp;op=classroom_to_edition&amp;edition_id=" . $edition_id . "&amp;of_loc=" . ($of_loc == 'loc' ? 'locd' : 'loc') . '">' . ($of_loc == 'loc' ? '<img src="' . getPathImage() . '/standard/1downarrow.png" alt="' . $lang->def('_DEF_DOWN') . '" />' : ($of_loc == 'locd' ? '<img src="' . getPathImage() . '/standard/1uparrow.png" alt="' . $lang->def('_DEF_UP') . '" />' : '<img src="' . getPathImage() . '/standard/sort.png" alt="' . $lang->def('_DEF_SORT') . '" />')) . $lang->def('_LOCATION') . '</a>', '<a href="' . "index.php?modname=course&amp;op=classroom_to_edition&amp;edition_id=" . $edition_id . "&amp;of_name=" . ($of_name == 'name' ? 'named' : 'name') . '">' . ($of_name == 'name' ? '<img src="' . getPathImage() . '/standard/1downarrow.png" alt="' . $lang->def('_DEF_DOWN') . '" />' : ($of_name == 'named' ? '<img src="' . getPathImage() . '/standard/1uparrow.png" alt="' . $lang->def('_DEF_UP') . '" />' : '<img src="' . getPathImage() . '/standard/sort.png" alt="' . $lang->def('_DEF_SORT') . '" />')) . $lang->def('_CLASSROOM', 'course') . '</a>', $lang->def('_STATUS'), $lang->def('_USETHIS'));
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    $class_room_to_edition = array();
    while (list($idClassroom, $name, $descr, $location) = sql_fetch_row($re_classroom)) {
        $cont = array('<label for="class_room_to_edition_' . $idClassroom . '">' . $location . '</label>', '<label for="class_room_to_edition_' . $idClassroom . '">' . $name . '</label>');
        if (isset($checked_class[$idClassroom])) {
            $cont[] = $lang->def('_CLASSROOM_OCCUPATED_YES');
        } else {
            $cont[] = '';
        }
        $cont[] = $form->getRadio('', 'class_room_to_edition_' . $idClassroom . '', 'class_room_to_edition', $idClassroom, $assigned_classroom == $idClassroom);
        $tb->addBody($cont);
    }
    $page_title = array('index.php?modname=course&amp;op=course_list' => $lang->def('_CLASSROOM'), $edition_name);
    $GLOBALS['page']->add(getTitleArea($page_title, 'classroomtocourse', $lang->def('_CLASSROOM')) . '<div class="std_block">' . ($checked_class !== false ? getResultUi($lang->def('_CLASSROOM_OCCUPATED')) : '') . getBackUi('index.php?modname=course&amp;op=course_list', $lang->def('_BACK')) . $form->openForm('assignEditionClassroom', 'index.php?modname=course&amp;op=assignEditionClassroom', false, false, 'multipart/form-data') . $form->getHidden('edition_id', 'edition_id', $edition_id) . $form->getHidden('idCourse', 'idCourse', $idCourse) . $tb->getTable() . $tb->getNavBar($ini, $tot_classroom) . $form->openButtonSpace() . $form->getButton('assignEditionClassroom', 'assignEditionClassroom', $lang->def('_SAVE')) . $form->getButton('course_undo', 'course_undo', $lang->def('_UNDO')) . $form->closeButtonSpace() . $form->closeForm() . '</div>', 'content');
}
function required()
{
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    require_once _adm_ . '/lib/lib.publicadminmanager.php';
    require_once _lms_ . '/lib/lib.course.php';
    require_once _lms_ . '/lib/lib.date.php';
    require_once _lms_ . '/lib/lib.competences.php';
    $db = DbConn::getInstance();
    $lang =& DoceboLanguage::CreateInstance('public_coursepanel', 'lms');
    $sel_competence = Get::req('sel_competence_req', DOTY_INT, false);
    $sel_course = Get::req('sel_course_req', DOTY_INT, false);
    $back_url = "index.php?modname=public_coursepanel&op=coursepanel&sel_competence=" . (int) $sel_competence . "&sel_course=" . (int) $sel_course;
    $back_ui = getBackUi($back_url, $lang->def('_BACK'));
    $sel_comp = Get::req('required_selector', DOTY_INT, 0);
    if ($sel_comp) {
        $id_pa = getLogUserId();
        if (!$id_pa) {
            //...
        }
        $acl_man = new DoceboACLManager();
        $admin_manager = new PublicAdminManager();
        $array_users = array();
        $idst_associated = $admin_manager->getAdminTree($id_pa);
        $array_users =& $acl_man->getAllUsersFromIdst($idst_associated);
        $array_users = array_unique($array_users);
        if (empty($array_users)) {
            //error: no users to deal with
            cout($back_ui . $lang->def('_NO_USERS') . $back_ui, 'content');
            return;
        }
        cout(getTitleArea($lang->def('_REQUIRED_USERS'), 'coursepanel') . '<div class="std_block">', 'content');
        $table = new Table();
        $head_labels = array($lang->def('_USERNAME'), $lang->def('_NAME'));
        $head_style = array('', '', 'align_center', 'align_center');
        $table->addHead($head_labels, $head_style);
        //$date = date ("Y-m-d H:i:s", strtotime("+1 months"));
        //$now = date("Y-m-d H:i:s");
        $man_comp = new Competences_Manager();
        $comp_data = $man_comp->GetCompetence($sel_comp);
        $already = array();
        $query = "SELECT id_user, score_init, score_got FROM %lms_competence_user WHERE id_competence='" . (int) $sel_comp . "'";
        $res = $db->query($query);
        while (list($id_user, $score_init, $score_got) = $db->fetch_row($res)) {
            if ($comp_data['type'] == 'score') {
                //if the competence assignment exists in DB, but the total score is 0, then it's considered as non-assigned
                if ((int) $score_init + (int) $score_got > 0) {
                    $already[] = $id_user;
                }
            } else {
                $already[] = $id_user;
            }
        }
        $already = array_unique($already);
        $array_users = array_diff($array_users, $already);
        //get required competences not got from users
        $query = "";
        if ($comp_data['type'] == 'score') {
            $query = "SELECT u.idst, u.userid, u.lastname, u.firstname FROM %lms_competence_required as cr " . " JOIN %adm_user as u ON (cr.idst = u.idst)" . " WHERE cr.idst IN (" . implode(",", $array_users) . ") AND cr.id_competence=" . (int) $sel_comp . " ORDER BY u.userid";
        } else {
            $query = "SELECT u.idst, u.userid, u.lastname, u.firstname FROM %lms_competence_required as cr " . " JOIN %adm_user as u ON (cr.idst = u.idst) " . " WHERE cr.idst IN (" . implode(",", $array_users) . ") AND cr.id_competence=" . (int) $sel_comp . " ORDER BY u.userid";
        }
        $res = $db->query($query);
        if (sql_num_rows($res) > 0) {
            while (list($idst, $userid, $lastname, $firstname) = $db->fetch_row($res)) {
                $line = array();
                $line[] = $acl_man->relativeId($userid);
                $line[] = $lastname . " " . $firstname;
                $table->addBody($line);
            }
            //cout(getTitleArea($lang->def('_EXPIRING_USERS'), 'coursepanel').'<div class="std_block">', 'content');
            cout($lang->def('_COMPETENCE') . ': <b>' . $comp_data['name'] . '</b>', 'content');
            cout($back_ui . $table->getTable() . $back_ui, 'content');
        } else {
            cout($back_ui . $lang->def('_NO_REQUIRED_USER') . $back_ui, 'content');
        }
    } else {
        //error, no competence selected
        cout($back_ui . $lang->def('_NO_COMPETENCE_SELECTED') . $back_ui, 'content');
        return;
    }
}
Example #17
0
 public function run()
 {
     //validate parameters
     if (!$this->id) {
         return false;
     }
     if (!is_numeric($this->rowsPerPage) || $this->rowsPerPage <= 0) {
         $this->rowsPerPage = Get::sett('visu_item', 25);
     }
     if (!is_numeric($this->startIndex)) {
         $this->startIndex = 0;
     }
     if (!is_numeric($this->results) || $this->results <= 0) {
         $this->results = $this->rowsPerPage;
     }
     if (!$this->sort) {
         $this->sort = "";
     }
     if ($this->dir != _YUITABLE_ASC && $this->dir != _YUITABLE_DESC) {
         $this->dir = _YUITABLE_ASC;
     }
     if (!is_array($this->paginator)) {
         $lang =& DoceboLanguage::CreateInstance('standard', 'framework');
         $this->paginator = array('template' => "{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} " . "{RangeRecords} " . $lang->def('_OF') . " <strong>{TotalRecords}</strong>" . " {RowsPerPageDropdown}", 'rowsPerPageOptions' => '[' . Get::sett('rows_per_page_options', '10, 25, 50, 100') . ']', 'containers' => array($this->id . '_pag_over', $this->id . '_pag_below'), 'pageLinks' => 5, 'firstPageLinkLabel' => "&laquo; " . $lang->def('_START'), 'previousPageLinkLabel' => "&lsaquo; " . $lang->def('_PREV'), 'nextPageLinkLabel' => $lang->def('_NEXT') . " &rsaquo;", 'lastPageLinkLabel' => $lang->def('_END') . " &raquo;");
     }
     //set parameters
     $params = array('id' => $this->id, 'ajaxUrl' => $this->ajaxUrl, 'rowsPerPage' => $this->rowsPerPage, 'startIndex' => $this->startIndex, 'results' => $this->results, 'sort' => $this->sort, 'dir' => $this->dir, 'columns' => $this->_getColumns(), 'fields' => $this->_getFields(), 'languages' => $this->_getLanguages(), 'rel_actions' => $this->rel_actions, 'generateRequest' => $this->generateRequest, 'use_paginator' => $this->use_paginator, 'caption' => $this->caption, 'summary' => $this->summary, 'print_table_over' => $this->print_table_over && !empty($this->rel_actions) || $this->use_paginator, 'print_table_below' => $this->print_table_below && !empty($this->rel_actions) || $this->use_paginator, 'styles' => $this->styles, 'header' => $this->header, 'data' => $this->data);
     $params['filter'] = $this->_getFilter();
     if ($this->_useStdSelectFormatter()) {
         $params['useStdSelectFormatter'] = true;
         if (is_array($this->initialSelection) && count($this->initialSelection) > 0) {
             $params['initialSelection'] = $this->json->encode($this->initialSelection);
         }
         if ($this->selectAllAdditionalFilter != false) {
             $params['selectAllAdditionalFilter'] = $this->selectAllAdditionalFilter;
         }
     } else {
         $params['useStdSelectFormatter'] = false;
     }
     if ($this->_useStdModifyFormatter()) {
         $params['useStdModifyFormatter'] = true;
         if ($this->stdModifyRenderEvent) {
             $params['stdModifyRenderEvent'] = $this->stdModifyRenderEvent;
         }
         if ($this->stdModifyDestroyEvent) {
             $params['stdModifyDestroyEvent'] = $this->stdModifyDestroyEvent;
         }
     } else {
         $params['useStdModifyFormatter'] = false;
     }
     if ($this->_useEditor()) {
         $this->events['rowMouseoverEvent'] = 'oDt.onEventHighlightCell';
         $this->events['rowMouseoutEvent'] = 'oDt.onEventUnhighlightCell';
         $this->events['cellClickEvent'] = 'oDt.onEventShowCellEditor';
     }
     if ($this->_useStdDeleteFormatter()) {
         $params['useStdDeleteFormatter'] = true;
         if ($this->stdDeleteCallbackEvent) {
             $params['stdDeleteCallbackEvent'] = $this->stdDeleteCallbackEvent;
         }
     } else {
         $params['useStdDeleteFormatter'] = false;
     }
     if ($this->_useStdDialogFormatter()) {
         $params['useStdDialogFormatter'] = true;
     } else {
         $params['useStdDialogFormatter'] = false;
     }
     if ($this->_useDupFormatter()) {
         $params['useDupFormatter'] = true;
     } else {
         $params['useDupFormatter'] = false;
     }
     if (is_array($this->paginator)) {
         $paginatorConfig = "";
         if (isset($this->paginator['template'])) {
             $paginatorConfig .= ', template: "' . $this->paginator['template'] . '"';
         }
         if (isset($this->paginator['rowsPerPageOptions'])) {
             $paginatorConfig .= ', rowsPerPageOptions: ' . ($this->row_per_page_select == false ? $this->paginator['rowsPerPageOptions'] : $this->row_per_page_select) . '';
         }
         if (isset($this->paginator['containers'])) {
             $paginatorConfig .= ', containers: ["' . implode('","', $this->paginator['containers']) . '"]';
         }
         if (isset($this->paginator['pageLinks'])) {
             $paginatorConfig .= ', pageLinks: ' . $this->paginator['pageLinks'];
         }
         if (isset($this->paginator['firstPageLinkLabel'])) {
             $paginatorConfig .= ', firstPageLinkLabel: "' . $this->paginator['firstPageLinkLabel'] . '"';
         }
         if (isset($this->paginator['previousPageLinkLabel'])) {
             $paginatorConfig .= ', previousPageLinkLabel: "' . $this->paginator['previousPageLinkLabel'] . '"';
         }
         if (isset($this->paginator['nextPageLinkLabel'])) {
             $paginatorConfig .= ', nextPageLinkLabel: "' . $this->paginator['nextPageLinkLabel'] . '"';
         }
         if (isset($this->paginator['lastPageLinkLabel'])) {
             $paginatorConfig .= ', lastPageLinkLabel: "' . $this->paginator['lastPageLinkLabel'] . '"';
         }
         $params['paginatorConfig'] = $paginatorConfig;
     }
     //events handler
     $params['editorSaveEvent'] = $this->editorSaveEvent;
     //choose a view by table specification
     switch ($this->show) {
         default:
             $view = $this->ajaxUrl ? 'dynamic' : 'static';
             break;
     }
     $params['events'] = is_array($this->events) ? $this->events : array();
     if ($this->delDisplayField) {
         $params['delDisplayField'] = $this->delDisplayField;
     }
     if ($this->scroll_x) {
         $params['scroll_x'] = $this->scroll_x;
     }
     if ($this->scroll_y) {
         $params['scroll_y'] = $this->scroll_y;
     }
     if (is_array($this->stdDialogIcons) && !empty($this->stdDialogIcons)) {
         $params['stdDialogIcons'] = $this->stdDialogIcons;
     }
     //render the view
     $this->render($view, $params);
 }
Example #18
0
function dispatch($op)
{
    switch ($op) {
        case "tab":
            YuiLib::load(array('tabview' => 'tabview-min.js'), array('tabview/assets/skins/sam/' => 'tabview.css'));
            require_once $GLOBALS['where_framework'] . '/lib/user_selector/lib.basetree.php';
            require_once $GLOBALS['where_framework'] . '/lib/user_selector/lib.groupselectortable.php';
            require_once $GLOBALS['where_framework'] . '/lib/user_selector/lib.userselectortable.php';
            require_once $GLOBALS['where_framework'] . '/lib/user_selector/lib.dynamicuserfilter.php';
            cout(getTitleArea(array('Test manager e selettore utenti')));
            cout('<div class="std_block">');
            $bt = new BaseTree('user_orgchart', false, false, _TREE_COLUMNS_TYPE_RADIO);
            $bt->init();
            $bt->setInitialSelection();
            $bt_out = $bt->get();
            $gst = new GroupSelectorTable('group_table');
            $gst->init();
            $gst_out = $gst->get();
            $ust = new UserSelectorTable('user_table');
            $ust->init();
            $ust_out = $ust->get();
            $duf = new DynamicUserFilter('user_rules');
            $duf->init();
            $duf_out = $duf->get();
            cout($bt_out['js'], 'page_head');
            cout($gst_out['js'], 'page_head');
            cout($ust_out['js'], 'page_head');
            cout($duf_out['js'], 'page_head');
            cout('<div id="' . $this->id . '" class="yui-navset">
				<ul class="yui-nav">
					<li><a href="#tab1"><em>Organigramma</em></a></li>
					<li class="selected"><a href="#tab2"><em>Utenti</em></a></li>
					<li><a href="#tab3"><em>Gruppi</em></a></li>
					<li><a href="#tab4"><em>Regole</em></a></li>
				</ul>
				<div class="yui-content">
					<div id="tab1">' . $bt_out['html'] . '</div>
					<div id="tab2">' . $ust_out['html'] . '</div>
					<div id="tab3"><p>' . $gst_out['html'] . '</p></div>
					<div id="tab4">' . $duf_out['html'] . '</div>
				</div>
			</div>');
            cout('<script type="text/javascript">
				var tabView = new YAHOO.widget.TabView(\'demo\');
			</script>');
            cout('</div>');
            break;
        case "final":
            require_once _base_ . '/lib/lib.form.php';
            require_once $GLOBALS['where_framework'] . '/lib/user_selector/lib.fulluserselector.php';
            $selector = new FullUserSelector('selector');
            $selector->init();
            $temp = $selector->get();
            cout(getTitleArea(array('Selettore utenti completo')));
            cout('<div class="std_block">');
            cout(Form::openForm('test', 'index.php?modname=_test_module&op=resp_to_form'));
            cout($temp['js'], 'page_head');
            cout($temp['html']);
            cout(Form::openButtonSpace() . Form::getButton('save', 'save', 'SALVA') . Form::getButton('undo', 'undo', 'ANNULLA') . Form::closeButtonSpace());
            cout(Form::closeForm());
            cout('</div>');
            break;
            //------------------------------------------------------------------------------
        //------------------------------------------------------------------------------
        case 'dataexport':
            require_once _base_ . '/lib/dataexport/lib.dataexport.php';
            $lang =& DoceboLanguage::CreateInstance('standard', 'framework');
            $query = "SELECT * FROM core_user ORDER BY lastname LIMIT 0,20 ";
            $source = new DataSource_Query($query);
            $nameGroup = array();
            $nameGroup[] = new DataColumn('lastname', $lang->def('_LASTNAME'));
            $nameGroup[] = new DataColumn('firstname', $lang->def('_FIRSTNAME'));
            $columns = array();
            $columns[] = new DataColumn('idst', $lang->def('_ID'));
            $columns[] = new DataColumnGroup('name', $lang->def('_NAME'), $nameGroup);
            $columns[] = new DataColumn('userid', $lang->def('_USERNAME'), 'formatter_userid');
            $columns[] = new DataColumn('email', $lang->def('_EMAIL'));
            //$columns[] = new DataColumn();
            $export = new DataExport(DATATYPE_HTM, 'users', $columns, $source);
            cout($export->render());
            cout('<br /><br /><a href="index.php?modname=_test_module&amp;op=dataexportcsv">SCARICA IN CSV</a>');
            break;
        case 'dataexportcsv':
            require_once _base_ . '/lib/lib.download.php';
            require_once _base_ . '/lib/dataexport/lib.dataexport.php';
            $lang =& DoceboLanguage::CreateInstance('standard', 'framework');
            $query = "SELECT * FROM core_user ORDER BY lastname LIMIT 0,20 ";
            $source = new DataSource_Query($query);
            $nameGroup = array();
            $nameGroup[] = new DataColumn('lastname', $lang->def('_LASTNAME'));
            $nameGroup[] = new DataColumn('firstname', $lang->def('_FIRSTNAME'));
            $columns = array();
            $columns[] = new DataColumn('idst', $lang->def('_ID'));
            $columns[] = new DataColumnGroup('name', $lang->def('_NAME'), $nameGroup);
            $columns[] = new DataColumn('userid', $lang->def('_USERNAME'), 'formatter_userid');
            $columns[] = new DataColumn('email', $lang->def('_EMAIL'));
            //$columns[] = new DataColumn();
            $export = new DataExport(DATATYPE_XLS, 'users', $columns, $source);
            sendStrAsFile($export->render(), "export_utenti.xls");
            break;
        case 'sample':
            $libs = YuiLib::load(false, false, true);
            $GLOBALS['page']->add($libs, 'page_head');
            $GLOBALS['page']->add(Util::get_css('../yui-skin/datatable.css'), 'page_head');
            Util::get_js(Get::rel_path('base') . '/docebocore/modules/_test_module/sample.js', true, true);
            $script = 'YAHOO.util.Event.onDOMReady(function(e) {
					initTable();
				});';
            //$GLOBALS['page']->add('<p>TITLE</p>');
            $GLOBALS['page']->add('<div id="datatable"></div>');
            $GLOBALS['page']->add('<script type="text/javascript">' . $script . '</script>');
            break;
        case 'datatable':
            require_once _lms_ . '/lib/table_view/class.coursetableview.php';
            $_temp_ = array(array("idCourse" => 0, "code" => "codice_001", "name" => "nome_001", "status" => "ok", "subscriptions" => 10), array("idCourse" => 1, "code" => "codice_002", "name" => "nome_002", "status" => "ok", "subscriptions" => 20), array("idCourse" => 2, "code" => "codice_003", "name" => "nome_003", "status" => "ok", "subscriptions" => 30), array("idCourse" => 3, "code" => "codice_004", "name" => "nome_004", "status" => "no", "subscriptions" => 40), array("idCourse" => 4, "code" => "codice_005", "name" => "nome_005", "status" => "ok", "subscriptions" => 50));
            require_once _lms_ . '/lib/table_view/class.coursetableview.php';
            $tableView = new CourseTableView("courses_table");
            $tableView->useDOMReady = true;
            //to change
            $tableView->isGlobalVariable = true;
            //just for debug purpose
            $tableView->initLibraries();
            $tableView->setInitialData($_temp_);
            $temp = $tableView->get();
            cout($temp['js'], 'page_head');
            cout('<div style="border:solid 1px black; padding:8px;"><p>DATATABLE:</p>' . $temp['html'] . '</div>');
            break;
        case "catalogue":
            YuiLib::load();
            cout('<div class="area_block"><h1 class="main_title_dashboard" id="main_area_title">Catalogo corsi</h1></div>', 'content');
            cout('<div class="std_block">', 'content');
            cout('<div id="course_cat" class="">', 'content');
            cout('<ul class="">
					<li class="selected"><a href="#tab1"><em>Inviti</em></a></li>
					<li><a href="#tab2"><em>Nuovi</em></a></li>
					<li><a href="#tab3"><em>Consigliati</em></a></li>
					<li><a href="#tab4"><em>Completo</em></a></li>
					<li><a href="#tab5"><em>Calendario</em></a></li>
				</ul>
				<div class="yui-content">
					<div>' . Get::img(Get::rel_path('base') . '/mycourses.jpg', false, false, false, true) . '</div>
					<div>
						<p>Lorem ipsum dolor sit amet consectetuer accumsan enim tempor neque urna. Tempus interdum euismod felis mauris Aliquam et vitae elit vel leo. Accumsan Phasellus sit natoque rutrum nibh auctor eu neque porta tincidunt. Ipsum enim ut felis nunc Pellentesque sed malesuada justo nec nec. Sem justo dolor mattis porta Quisque.</p>
						<p>Interdum ut diam convallis Sed hendrerit est augue eget ipsum lacinia. Et at montes Sed est nec arcu cursus congue neque quis. Sagittis nec dictum nibh urna non urna justo consectetuer accumsan pretium. A risus velit ante id Donec nibh eros vitae at amet. Enim et hac Nam mus tellus consequat sapien eros nec sapien. Wisi Integer sapien suscipit tincidunt et tincidunt eu et neque et. Semper nisl et.</p>
						<p>Justo nunc et Maecenas dictum Vestibulum vel a neque libero non. Hendrerit metus Vestibulum Pellentesque consectetuer augue malesuada Ut Vestibulum Vestibulum scelerisque. Elit tellus enim purus nascetur Cum condimentum est vitae pellentesque pellentesque. Nisl pretium vel dolor Integer et pharetra elit nulla et nonummy. Phasellus tempus malesuada cursus ipsum urna consectetuer ut quis condimentum consequat. Parturient pretium convallis accumsan.</p>
						<p>Turpis vitae turpis lorem dignissim quis lorem rutrum pede mus justo. Morbi dictumst interdum ut dui elit faucibus ac tempor eget a. Pede penatibus urna mus id pellentesque commodo amet porta risus pede. Sapien semper congue nibh sit tortor enim nibh amet quis in. Vivamus condimentum egestas dictumst vel auctor ut Aenean malesuada mattis convallis. Ipsum Pellentesque libero Nullam Donec nec at enim faucibus sit orci. </p>
					</div>
					<div>' . Get::img(Get::rel_path('base') . '/mycourses.jpg', false, false, false, true) . '</div>
					<div>' . Get::img(Get::rel_path('base') . '/mycourses.jpg', false, false, false, true) . '</div>
					<div>' . Get::img(Get::rel_path('base') . '/calendar.jpg', false, false, false, true) . '</div>
				</div>', 'content');
            cout('</div>', 'content');
            cout('' . '<script type="text/javascript">' . "\n" . '</script>' . "\n", 'scripts');
            break;
        default:
            YuiLib::load();
            //cout('<div class="area_block">PROVA ALBERO</div>', 'content');
            cout('<div style="margin: 2em">', 'content');
            cout('<div id="course_tag" class="yui-navset">', 'content');
            cout('<style>
.subcatbox {
	margin-bottom: 20px;
	font-size: 86%;
}

.subcatbox dt {
	font-weight: bold;
	font-size: 108%;
	margin-bottom: 4px;
}

.subcatbox dd {
	margin-left: 10px;
	margin-bottom: 4px;
}


</style>', 'page_head');
            cout('
    <ul class="yui-nav">
        <li><a href="#tab1"><em>Corsi</em></a></li>
        <li class="selected"><a href="#tab2"><em>Documenti e multimedia</em></a></li>
        <li><a href="#tab3"><em>Videconferenze</em></a></li>
    </ul>            
    <div class="yui-content yui-nopadding">
		<div>
        	<div class="subtab_list">
				<ul class="">
					<li class="selected"><a href="#tab1"><em>In itinere</em></a></li>
					<li><a href="#tab1"><em>Completati</em></a></li>

					<li><a href="#tab1"><em>Inviti</em></a></li>
					<li><a href="#"><em>Nuovi</em></a></li>
					<li><a href="#"><em>Consigliati</em></a></li>
					<li><a href="#"><em>Tutti</em></a></li>
					<li><a href="#"><em>Calendario</em></a></li>
				</ul>
			</div>
			' . Get::img(Get::rel_path('base') . '/mycourses.jpg', false, false, false, true) . '
		</div>
		<div>
        	<div class="subtab_list">
				<ul class="">
					<li class="selected"><a href="#tab1"><em>Ricerca</em></a></li>
					<li><a href="#tab1"><em>Gestione</em></a></li>
				</ul>
			</div>
			<br />
			<br />
			<div style="text-align: center; position:relative;">
			 
			<input type="text" size="40" id="c_filter" name="c_filter" value="Cerca ..." class="" maxlength="255" alt="Cerca" onclick="this.value=\'\';" /><input type="submit" id="c_filter" name="c_filter" value="Cerca" class="search_b" maxlength="255" alt="Cerca" />
			<br/><br/>
			<input type="radio" name="searchin" value="2" checked="checked" /> Nei documenti e nei corsi &nbsp;&nbsp;
			<input type="radio" name="searchin" value="0" /> Nei documenti &nbsp;&nbsp;
			<input type="radio" name="searchin" value="1" /> Nei corsi
			</div>

			<br />
			<br />
			<br />
			<div class="yui-gb" style="margin: 0 22px">
				<div class="yui-u first">

					<!-- sample code from ciao.it-->

					<dl class="subcatbox"><dt> <a href="http://www.ciao.it/Portatili_206481_2" id="Node_Category_197256" class="hdl">Portatili</a></dt><dd> <a href="http://www.ciao.it/Portatili_206481_2-apple" class="subnr">Portatili Apple</a> <span class="subnr">(104)</span></dd><dd> <a href="http://www.ciao.it/Portatili_206481_2-sony" class="subnr">Portatili Sony</a> <span class="subnr">(383)</span></dd><dd> <a href="http://www.ciao.it/Portatili_206481_2-dell" class="subnr">Portatili Dell</a> <span class="subnr">(81)</span></dd><dd> <a href="http://www.ciao.it/Portatili_206481_2-fujitsu_siemens" class="subnr">Portatili Fujitsu-Siemens</a> <span class="subnr">(400)</span></dd><dd> <a href="http://www.ciao.it/Portatili_206481_2-hp" class="subnr">Portatili HP</a> <span class="subnr">(799)</span></dd><dd> <a href="http://www.ciao.it/Portatili_206481_2-asus" class="subnr">Portatili Asus</a> <span class="subnr">(663)</span></dd><dd> <a href="http://www.ciao.it/Portatili_206481_2-acer" class="subnr">Portatili Acer</a>
					<span class="subnr">(713)</span></dd><dd> <a href="http://www.ciao.it/Portatili_206481_2-toshiba" class="subnr">Portatili Toshiba</a> <span class="subnr">(737)</span></dd><dd> <a href="http://www.ciao.it/Portatili_206481_2-samsung" class="subnr">Portatili Samsung</a> <span class="subnr">(43)</span></dd></dl><dl class="subcatbox"><dt> <a href="http://www.ciao.it/PC_178183_2" id="Node_Category_168457" class="hdl">PC</a></dt><dd> <a href="http://www.ciao.it/PC_178183_2-hp" class="subnr">PC HP</a> <span class="subnr">(1643)</span></dd><dd> <a href="http://www.ciao.it/PC_178183_2-acer" class="subnr">PC Acer</a> <span class="subnr">(649)</span></dd><dd> <a href="http://www.ciao.it/PC_178183_2-packard_bell" class="subnr">PC Packard Bell</a> <span class="subnr">(864)</span></dd><dd> <a href="http://www.ciao.it/PC_178183_2-apple" class="subnr">PC Apple</a> <span class="subnr">(227)</span></dd><dd> <a href="http://www.ciao.it/PC_178183_2-olidata" class="subnr">PC Olidata</a> <span class="subnr">(574)</span></dd><dd>
					<a href="http://www.ciao.it/PC_178183_2-compaq" class="subnr">PC Compaq</a> <span class="subnr">(627)</span></dd></dl><dl class="subcatbox"><dt> <a href="http://www.ciao.it/Stampanti_178158_2" id="Node_Category_168459" class="hdl">Stampanti</a></dt><dd> <a href="http://www.ciao.it/Stampanti_178158_2-hp" class="subnr">Stampanti HP</a> <span class="subnr">(55)</span></dd><dd> <a href="http://www.ciao.it/Stampanti_178158_2-epson" class="subnr">Stampanti Espson</a> <span class="subnr">(466)</span></dd><dd> <a href="http://www.ciao.it/Stampanti_178158_2-lexmark_international" class="subnr">Stampanti Lexmark</a> <span class="subnr">(301)</span></dd><dd> <a href="http://www.ciao.it/Stampanti_178158_2-canon" class="subnr">Stampanti Canon</a> <span class="subnr">(239)</span></dd><dd> <a href="http://www.ciao.it/Stampanti_178158_2-brother" class="subnr">Stampanti Brother</a> <span class="subnr">(99)</span></dd><dd> <a href="http://www.ciao.it/Stampanti_178158_2-xerox" class="subnr">Stampanti Xerox</a>
					<span class="subnr">(182)</span></dd></dl><dl class="subcatbox"><dt> <a href="http://www.ciao.it/Stampanti_Multifunzione_205569_2" id="Node_Category_196265" class="hdl">Stampanti Multifunzione</a></dt><dd> <a href="http://www.ciao.it/Stampanti_Multifunzione_205569_2-xerox" class="subnr">Stampanti Multifunzione Xerox</a> <span class="subnr">(340)</span></dd><dd> <a href="http://www.ciao.it/Stampanti_Multifunzione_205569_2-canon" class="subnr">Stampanti Multifunzione Canon</a> <span class="subnr">(182)</span></dd><dd> <a href="http://www.ciao.it/Stampanti_Multifunzione_205569_2-brother" class="subnr">Stampanti Multifunzione Brother</a> <span class="subnr">(138)</span></dd><dd> <a href="http://www.ciao.it/Stampanti_Multifunzione_205569_2-lexmark_international" class="subnr">Stampanti Multifunzione Lexmark</a> <span class="subnr">(97)</span></dd><dd> <a href="http://www.ciao.it/Stampanti_Multifunzione_205569_2-epson" class="subnr">Stampanti Multifunzione Epson</a> <span class="subnr">(76)</span></dd><dd>
					<a href="http://www.ciao.it/Stampanti_Multifunzione_205569_2-samsung" class="subnr">Stampanti Multifunzione Samsung</a> <span class="subnr">(59)</span></dd></dl>
					<!-- end of sample code from ciao.it-->

				</div>
				<div class="yui-u">

					<!-- sample code from ciao.it-->

					<dl class="subcatbox"><dt> <a href="http://www.ciao.it/Componenti_Hardware_178057_2" id="Node_Category_168463" class="hdl">Componenti Hardware</a></dt><dd> <a href="http://www.ciao.it/Schede_Madri_205459_3" class="subnr">Schede Madri</a> <span class="subnr">(1877)</span></dd><dd> <a href="http://www.ciao.it/Hard_Disk_178068_3" class="subnr">Hard Disk</a> <span class="subnr">(3568)</span></dd><dd> <a href="http://www.ciao.it/Drive_178061_3" class="subnr">Drive</a> <span class="subnr">(158)</span></dd><dd> <a href="http://www.ciao.it/Floppy_178067_3" class="subnr">Floppy</a> <span class="subnr">(169)</span></dd><dd> <a href="http://www.ciao.it/Alimentatori_178074_3" class="subnr">Alimentatori</a> <span class="subnr">(3207)</span></dd><dd> <a href="http://www.ciao.it/Componenti_Hardware_178057_2" id="Node_Category_More_168463" class="hdl">continua</a>
					</dd></dl><dl class="subcatbox"><dt> <a href="http://www.ciao.it/Monitor_LCD_178159_2" id="Node_Category_168460" class="hdl">Monitor LCD</a></dt><dd> <a href="http://www.ciao.it/Monitor_LCD_178159_2-samsung" class="subnr">Monitor Samsung</a> <span class="subnr">(394)</span></dd><dd> <a href="http://www.ciao.it/Monitor_LCD_178159_2-lg" class="subnr">Monitor LG</a> <span class="subnr">(315)</span></dd><dd> <a href="http://www.ciao.it/Monitor_LCD_178159_2-sony" class="subnr">Monitor Sony</a> <span class="subnr">(181)</span></dd><dd> <a href="http://www.ciao.it/Monitor_LCD_178159_2-philips" class="subnr">Monitor Philips</a> <span class="subnr">(275)</span></dd><dd> <a href="http://www.ciao.it/Monitor_LCD_178159_2-acer" class="subnr">Monitor Acer</a> <span class="subnr">(323)</span></dd><dd> <a href="http://www.ciao.it/Monitor_LCD_178159_2-hp" class="subnr">Monitor HP</a> <span class="subnr">(127)</span></dd></dl><dl class="subcatbox"><dt>
					<a href="http://www.ciao.it/Monitor_CRT_206455_2" id="Node_Category_197225" class="hdl">Monitor CRT</a></dt><dd> <a href="http://www.ciao.it/Monitor_CRT_206455_2-philips" class="subnr">Monitor CRT Philips</a> <span class="subnr">(120)</span></dd><dd> <a href="http://www.ciao.it/Monitor_CRT_206455_2-hp" class="subnr">Monitor CRT HP</a> <span class="subnr">(41)</span></dd><dd> <a href="http://www.ciao.it/Monitor_CRT_206455_2-samsung" class="subnr">Monitor CRT Samsung</a> <span class="subnr">(80)</span></dd><dd> <a href="http://www.ciao.it/Monitor_CRT_206455_2-ibm" class="subnr">Monitor CRT IBM</a> <span class="subnr">(67)</span></dd><dd> <a href="http://www.ciao.it/Monitor_CRT_206455_2-compaq" class="subnr">Monitor CRT Compaq</a> <span class="subnr">(61)</span></dd><dd> <a href="http://www.ciao.it/Monitor_CRT_206455_2-nec" class="subnr">Monitor CRT NEC</a> <span class="subnr">(64)</span></dd></dl><dl class="subcatbox"><dt>
					<a href="http://www.ciao.it/Processori_206294_2" id="Node_Category_197039" class="hdl">Processori</a></dt><dd> <a href="http://www.ciao.it/Processori_206294_2-hewlett_packard" class="subnr">Processori HP</a> <span class="subnr">(379)</span></dd><dd> <a href="http://www.ciao.it/Processori_206294_2-intel" class="subnr">Processori Intel</a> <span class="subnr">(311)</span></dd><dd> <a href="http://www.ciao.it/Processori_206294_2-ibm" class="subnr">Processori IBM</a> <span class="subnr">(141)</span></dd><dd> <a href="http://www.ciao.it/Processori_206294_2-fujitsu_siemens_computers" class="subnr">Processori Fujitsu Siemens</a> <span class="subnr">(43)</span></dd><dd> <a href="http://www.ciao.it/Processori_206294_2-compaq" class="subnr">Processori Compaq</a> <span class="subnr">(14)</span></dd><dd> <a href="http://www.ciao.it/Processori_206294_2-acer" class="subnr">Processori Acer</a> <span class="subnr">(24)</span></dd></dl>
					<!-- end of sample code from ciao.it-->

				</div>

				<div class="yui-u">

					<!-- sample code from ciao.it-->

					<dl class="subcatbox"><dt> <a href="http://www.ciao.it/Componenti_di_Rete_178049_2" id="Node_Category_168462" class="hdl">Componenti di Rete</a></dt><dd> <a href="http://www.ciao.it/Modem_178051_3" class="subnr">Modem</a> <span class="subnr">(1428)</span></dd><dd> <a href="http://www.ciao.it/Schede_di_Rete_178050_3" class="subnr">Schede di Rete</a> <span class="subnr">(3191)</span></dd><dd> <a href="http://www.ciao.it/Router_e_Bridge_178053_3" class="subnr">Router e Bridge</a> <span class="subnr">(1176)</span></dd><dd> <a href="http://www.ciao.it/Hub_e_Switch_178052_3" class="subnr">Hub e Switch</a> <span class="subnr">(2739)</span></dd><dd> <a href="http://www.ciao.it/Dispositivi_di_Rete_205570_3" class="subnr">Dispositivi di Rete</a> <span class="subnr">(1791)</span></dd><dd> <a href="http://www.ciao.it/Componenti_di_Rete_178049_2" id="Node_Category_More_168462" class="hdl">continua</a></dd></dl><dl class="subcatbox"><dt>
					<a href="http://www.ciao.it/Palmari_Smartphone_206480_2" id="Node_Category_197255" class="hdl">Palmari &amp; Smartphone</a></dt><dd> <a href="http://www.ciao.it/Palmari_Smartphone_206480_2-htc" class="subnr">Palmari HTC</a> <span class="subnr">(26)</span></dd><dd> <a href="http://www.ciao.it/Palmari_Smartphone_206480_2-nokia" class="subnr">Palmari Nokia</a> <span class="subnr">(22)</span></dd><dd> <a href="http://www.ciao.it/Palmari_Smartphone_206480_2-hp" class="subnr">Palmari HP</a> <span class="subnr">(85)</span></dd><dd> <a href="http://www.ciao.it/Palmari_Smartphone_206480_2-i_mate" class="subnr">Palmari i-mate</a> <span class="subnr">(19)</span></dd><dd> <a href="http://www.ciao.it/Palmari_Smartphone_206480_2-samsung" class="subnr">Palmari Samsung</a> <span class="subnr">(10)</span></dd><dd> <a href="http://www.ciao.it/Palmari_Smartphone_206480_2-palm" class="subnr">Palmari Palm</a> <span class="subnr">(89)</span></dd></dl>
					<dd> <a href="http://www.ciao.it/Mouse_178035_3" class="subnr">Mouse</a> <span class="subnr">(3589)</span></dd><dd> <a href="http://www.ciao.it/Tastiere_178036_3" class="subnr">Tastiere</a> <span class="subnr">(2826)</span></dd><dd> <a href="http://www.ciao.it/Scanner_178040_3" class="subnr">Scanner</a> <span class="subnr">(879)</span></dd><dd> <a href="http://www.ciao.it/Webcam_206484_3" class="subnr">Webcam</a> <span class="subnr">(578)</span></dd><dd> <a href="http://www.ciao.it/USB_Flash_Drive_205463_3" class="subnr">USB Flash Drive</a> <span class="subnr">(1086)</span></dd><dd> <a href="http://www.ciao.it/Periferiche_178035_2" id="Node_Category_More_168461" class="hdl">continua</a></dd></dl><dl class="subcatbox"><dt> <a href="http://www.ciao.it/Storage_Media_178080_2" id="Node_Category_168465" class="hdl">Storage Media</a></dt><dd>
					<a href="http://www.ciao.it/CD_Registrabili_178080_3" class="subnr">CD Registrabili</a> <span class="subnr">(2340)</span></dd><dd> <a href="http://www.ciao.it/DVD_Registrabili_178081_3" class="subnr">DVD Registrabili</a> <span class="subnr">(2490)</span></dd></dl><dl class="subcatbox"><dt> <a href="http://www.ciao.it/Accessori_178161_2" id="Node_Category_168466" class="hdl">Accessori</a></dt><dd> <a href="http://www.ciao.it/Supporti_Cartacei_per_Stampanti_205643_3" class="subnr">Supporti Cartacei per Stampanti</a> <span class="subnr">(1891)</span></dd><dd> <a href="http://www.ciao.it/Accessori_per_Stampanti_205472_3" class="subnr">Accessori per Stampanti</a> <span class="subnr">(20111)</span></dd><dd> <a href="http://www.ciao.it/Cartucce_per_Stampanti_e_Toner_206282_3" class="subnr">Cartucce per Stampanti e Toner</a></dd><dd> <a href="http://www.ciao.it/Accessori_per_Portatili_197962_3" class="subnr">Accessori per Portatili</a> <span class="subnr">(42)</span></dd><dd>
					<a href="http://www.ciao.it/Accessori_per_Palmari_178161_3" class="subnr">Accessori per Palmari</a> <span class="subnr">(41)</span></dd><dd> <a href="http://www.ciao.it/Accessori_178161_2" id="Node_Category_More_168466" class="hdl">continua</a></dd></dl><dl class="subcatbox"><dt> <a href="http://www.ciao.it/Servizi_e_Consigli_178181_2" id="Node_Category_168467" class="hdl">Servizi e Consigli</a></dt></dl>

					<!-- end of sample code from ciao.it-->

				</div>
			</div>
		</div>
		<div>
        	<div class="subtab_list">
				<ul class="">
					<li><a href="#tab1"><em>Attive ora</em></a></li>
					<li><a href="#tab1"><em>Programmate</em></a></li>
					<li class="selected"><a href="#tab1"><em>Calendario</em></a></li>
				</ul>
				
			</div>
				' . Get::img(Get::rel_path('base') . '/calendar.jpg', false, false, false, true) . '

		</div>
		', 'content');
            cout('</div>', 'content');
            cout('</div>', 'content');
            cout('' . '<script type="text/javascript">' . "\n" . "\tvar myTabs = new YAHOO.widget.TabView('course_tag'); " . "\n" . '</script>' . "\n", 'scripts');
            /*
            
            
            cout('<script type="text/javascript">
            		var temp;
            		YAHOO.util.Event.onDOMReady(function(e) {
            		  var oConfig = {
            	dragdrop: false,
            	initNodes: '.$nodes.',
            	ajax_url: "ajax.adm_server.php?plf=framework&file=category_tree&sf=folder_tree'.'"
            };
            		  temp = new FolderTree("tree", oConfig);
            		});
            	  </script>', 'page_head');
            
            cout('<div class="area_block">PROVA ALBERO</div>', 'content');
            cout('<div class="std_block">', 'content');
            cout('<div style="border:solid 1px" class="folder_tree">', 'content');
            cout('<div id="tree"></div>', 'content');
            cout('</div>', 'content');
            cout('<br /><br />DEBUG:&nbsp;<button onclick="alert(temp.getCurrentSelection());">SELEZIONE</button>', 'content');
            
            cout('</div>', 'content');
            require_once(_lms_.'/lib/folder_tree/class.category_tree.php');
            $tree = new CategoryTree('categorytree');
            
            $tree->initLibraries();
            $tree->useDOMready = true;
            $temp = $tree->get();
            
            cout($temp['js'], 'page_head');
            cout('<div class="area_block">PROVA ALBERO</div>', 'content');
            cout('<div class="std_block">', 'content');
            cout('<div style="border:solid 1px" class="folder_tree">', 'content');
            cout($temp['html'], 'content');
            cout('</div>', 'content');
            cout('<br /><br />DEBUG:&nbsp;<button onclick="alert(temp.getCurrentSelection());">SELEZIONE</button>', 'content');
            
            cout('</div>', 'content');
            */
            break;
    }
}
 function waitinguser()
 {
     if (!$this->permissions['moderate']) {
         die("You can't access");
     }
     require_once _lms_ . '/lib/lib.course.php';
     require_once _adm_ . '/lib/lib.field.php';
     require_once _base_ . '/lib/lib.form.php';
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.user_profile.php';
     $id_course = Get::req('id_course', DOTY_INT, 0);
     $man_course = new Man_Course();
     $course_info = $man_course->getCourseInfo($id_course);
     $is_classroom = $course_info['course_type'] == 'classroom';
     $edition_id = Get::req('id_edition', DOTY_INT, 0);
     $ed_url_param = '&id_edition=' . $edition_id;
     $out =& $GLOBALS['page'];
     $lang =& DoceboLanguage::CreateInstance('course', 'lms');
     $lang =& DoceboLanguage::CreateInstance('subscribe', 'lms');
     $acl_man =& Docebo::user()->getAclManager();
     $levels = CourseLevel::getLevels();
     $waiting_users =& $man_course->getWaitingSubscribed($id_course, $edition_id);
     $users_name =& $acl_man->getUsers($waiting_users['all_users_id']);
     $arr_status = array(_CUS_WAITING_LIST => $lang->def('_WAITING_USERS'), _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'));
     $page_title = array('index.php?r=' . $this->link_course . '/show' => Lang::t('_COURSES', 'course'), Lang::t('_USERWAITING', 'course') . ': ' . $course_info['name']);
     $GLOBALS['page']->add(getTitleArea($page_title, 'subscribe') . '<div class="std_block">' . Form::openForm('approve users', 'index.php?r=' . $this->link . '/approveusers') . Form::getHidden('id_course', 'id_course', $id_course) . Form::getHidden('edition_id', 'edition_id', $edition_id), 'content');
     $tb = new Table(0, $lang->def('_SELECT_WHO_CONFIRM'), $lang->def('_SUMMARY_SELECT_WHO_CONFIRM'));
     $type_h = array();
     $type_h[] = '';
     $type_h[] = '';
     $type_h[] = '';
     if ($is_classroom) {
         $type_h[] = '';
     }
     $type_h[] = '';
     $type_h[] = '';
     $type_h[] = 'image';
     $type_h[] = 'image';
     $type_h[] = 'image';
     $content_h = array();
     $content_h[] = $lang->def('_USERNAME');
     $content_h[] = $lang->def('_FULLNAME');
     $content_h[] = $lang->def('_LEVEL');
     if ($is_classroom) {
         $content_h[] = $lang->def('_CLASSROOM');
     }
     $content_h[] = $lang->def('_SUBSCRIBED_BY');
     $content_h[] = $lang->def('_STATUS');
     $content_h[] = $lang->def('_APPROVE');
     $content_h[] = $lang->def('_DENY');
     $content_h[] = $lang->def('_WAIT');
     $tb->addHead($content_h, $type_h);
     if (is_array($waiting_users['users_info'])) {
         reset($waiting_users['users_info']);
         while (list($id_user, $info) = each($waiting_users['users_info'])) {
             $id_sub_by = $info['subscribed_by'];
             $subscribed = $users_name[$id_sub_by][ACL_INFO_LASTNAME] . '' . $users_name[$id_sub_by][ACL_INFO_FIRSTNAME] != '' ? $users_name[$id_sub_by][ACL_INFO_LASTNAME] . ' ' . $users_name[$id_sub_by][ACL_INFO_FIRSTNAME] : $acl_man->relativeId($users_name[$id_sub_by][ACL_INFO_USERID]);
             $more = isset($_GET['id_user']) && $_GET['id_user'] == $id_user ? '<a href="index.php?r=' . $this->link . '/waitinguser&amp;id_course=' . $id_course . $ed_url_param . '"><img src="' . getPathImage() . 'standard/menu_open.png"></a> ' : '<a href="index.php?r=' . $this->link . '/waitinguser&amp;id_course=' . $id_course . $ed_url_param . '&amp;id_user='******'"><img src="' . getPathImage() . 'standard/menu_closed.png"></a> ';
             $is_overbooking = FALSE;
             if ($is_classroom) {
                 $is_overbooking = $info['overbooking'];
             } else {
                 $is_overbooking = FALSE;
                 //$info['status'] == _CUS_OVERBOOKING
             }
             $content = array();
             $content[] = $more . $acl_man->relativeId($users_name[$id_user][ACL_INFO_USERID]);
             $content[] = $users_name[$id_user][ACL_INFO_LASTNAME] . ' ' . $users_name[$id_user][ACL_INFO_FIRSTNAME];
             $content[] = $levels[$info['level']];
             if ($is_classroom) {
                 $content[] = ($info['code'] != '' ? '[' . $info['code'] . '] ' : '') . $info['name'];
             }
             $content[] = $subscribed . ' [' . $users_name[$id_sub_by][ACL_INFO_EMAIL] . ']';
             $content[] = $is_overbooking ? $lang->def('_OVERBOOKING') : $arr_status[$info['status']];
             if ($is_overbooking) {
                 $content[] = '';
                 $content[] = '';
                 $content[] = '';
             } else {
                 $content[] = Form::getInputRadio('waiting_user_0_' . $id_user, 'waiting_user[' . $id_user . ']', '0', false, '') . '<label class="access-only" for="waiting_user_0_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
                 $content[] = Form::getInputRadio('waiting_user_1_' . $id_user, 'waiting_user[' . $id_user . ']', '1', false, '') . '<label class="access-only" for="waiting_user_1_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
                 $content[] = Form::getInputRadio('waiting_user_2_' . $id_user, 'waiting_user[' . $id_user . ']', '2', true, '') . '<label class="access-only" for="waiting_user_1_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
             }
             $tb->addBody($content);
             if (isset($_GET['id_user']) && $id_user == $_GET['id_user']) {
                 $field = new FieldList();
                 $info = $field->playFieldsForUser($id_user, false, true);
                 $tb->addBodyExpanded($info != '' ? $info : $lang->def('_NO_EXTRAINFO_AVAILABLE'), 'user_specific_info');
             }
         }
     }
     $GLOBALS['page']->add($tb->getTable() . '<br />' . Form::openElementSpace() . Form::getSimpleTextarea($lang->def('_SUBSCRIBE_ACCEPT'), 'subscribe_accept', 'subscribe_accept') . Form::getSimpleTextarea($lang->def('_SUBSCRIBE_REFUSE'), 'subscribe_refuse', 'subscribe_refuse') . Form::closeElementSpace() . Form::openButtonSpace() . '<br />' . Form::getButton('subscribe', 'subscribe', $lang->def('_SAVE')) . Form::getButton('cancelselector', 'cancelselector', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm(), 'content');
     $GLOBALS['page']->add('</div>', 'content');
 }
Example #20
0
 function sendRegistration()
 {
     checkPerm('view');
     require_once _base_ . '/lib/lib.userselector.php';
     $id_course = importVar('id_course', true, 0);
     $id_event = importVar('id_event', true, 0);
     $lang =& DoceboLanguage::CreateInstance('reservation');
     $out =& $GLOBALS['page'];
     $man_res = new Man_Reservation();
     $id_category = $man_res->getEventCategory($id_event);
     $user_select = new UserSelector();
     $user_subscribed = array();
     $user_subscribed = $man_res->getSubscribedUserIdst($id_event);
     $user_selected = array();
     $user_selected = $user_select->getSelection($_POST);
     $wrong_result = false;
     $user_deleted = array_diff($user_subscribed, $user_selected);
     foreach ($user_deleted as $del) {
         $result = $man_res->delSubscription($del, $id_event);
         if (!$result) {
             $wrong_result = true;
         }
     }
     foreach ($user_selected as $user) {
         if ($man_res->controlMaxSubscriptionForCategory($id_category, $user)) {
             $result = $man_res->addSubscription($user, $id_event);
             if (!$result) {
                 $wrong_result = true;
             }
         } else {
             $wrong_result = true;
         }
     }
     if ($wrong_result) {
         Util::jump_to('index.php?modname=reservation&op=reservation&active_tab=subscribed_user&error=insert');
     }
     Util::jump_to('index.php?modname=reservation&op=reservation&active_tab=subscribed_user');
 }
Example #21
0
function controlCourse($course_info, $page, $id_catalogue, $id_category, $ini)
{
    require_once _lms_ . '/lib/lib.course.php';
    $acl_manger = Docebo::user()->getAclManager();
    $lang =& DoceboLanguage::CreateInstance('catalogue', 'cms');
    if ($course_info['course_type'] !== 'elearning') {
        if (!isset($course_info['dates'])) {
            return '<p class="cannot_subscribe">' . $lang->def('_NO_EDITIONS') . '</p>';
        } elseif (count($course_info['dates']) == 0) {
            return '<p class="cannot_subscribe">' . $lang->def('_NO_EDITIONS') . '</p>';
        }
        require_once _lms_ . '/lib/lib.date.php';
        $man_date = new DateManager();
        $user_date = $man_date->getUserDates(getLogUserId());
        $date_id = array();
        $date_full = $man_date->getFullDateForCourse($course_info['idCourse']);
        $date_not_confirmed = $man_date->getNotConfirmetDateForCourse($course_info['idCourse']);
        foreach ($course_info['dates'] as $date_info) {
            $date_id[] = $date_info['id_date'];
        }
        reset($course_info['dates']);
        $control = array_diff($date_id, $user_date, $date_full, $date_not_confirmed);
        if (count($control) == 0) {
            return '<p class="cannot_subscribe">' . $lang->def('_NO_EDITIONS') . '</p>';
        }
        if ($course_info['selling'] == 0) {
            if (Docebo::user()->isAnonymous()) {
                return '<p class="cannot_subscribe">' . $lang->def('_NEED_TO_LOGIN') . '</p>';
            } else {
                return '<a href="javascript:;" onClick="datePrenotationPopUp(\'' . $course_info['idCourse'] . '\', \'' . $lang->def('_CHART_EDITION_FOR') . ' : ' . addslashes($course_info['name']) . '\')"><p class="can_subscribe">' . $lang->def('_CAN_SUBSCRIBE') . '</p></a>';
            }
        } else {
            $date_in_chart = array();
            if (isset($_SESSION['chart'][$course_info['idCourse']])) {
                $date_in_chart = $_SESSION['chart'][$course_info['idCourse']]['dates'];
            }
            $control = array_diff($control, $date_in_chart);
            if (count($control) == 0) {
                return '<p class="subscribed">' . $lang->def('_ALL_EDITION_BUYED') . '</p>';
            }
            $query = "SELECT id_date" . " FROM " . $GLOBALS['prefix_lms'] . "_transaction_info" . " WHERE id_course = " . $course_info['idCourse'] . " AND id_transaction IN" . " (" . " SELECT id_transaction" . " FROM " . $GLOBALS['prefix_lms'] . "_transaction" . " WHERE id_user = "******" AND status = 0" . " )";
            $res = sql_query($query);
            if (sql_num_rows($res)) {
                $waiting_payment = array();
                while (list($id_date) = sql_fetch_row($query)) {
                    $waiting_payment[$id_date] = $id_date;
                }
                $control = array_diff($control, $waiting_payment);
                if (count($control) == 0) {
                    return '<p class="subscribed">' . $lang->def('_WAITING_PAYMENT_FOL_LAST_EDITION') . '</p>';
                }
            }
            return '<a href="javascript:;" onClick="datePrenotationPopUp(\'' . $course_info['idCourse'] . '\', \'' . $lang->def('_CHART_EDITION_FOR') . ' : ' . addslashes($course_info['name']) . '\')"><p class="can_subscribe">' . $lang->def('_CAN_SUBSCRIBE') . '</p></a>';
        }
    } else {
        $course_in_chart = array_keys($_SESSION['chart']);
        if (array_search($course_info['idCourse'], $course_in_chart) !== false) {
            return '<p class="subscribed">' . $lang->def('_COURSE_IN_CART') . '</p>';
        }
        $query = "SELECT status, waiting" . " FROM " . $GLOBALS['prefix_lms'] . "_courseuser" . " WHERE idCourse = " . $course_info['idCourse'] . " AND idUser = "******"subscribed">' . $lang->def('_WAITING') . '</p>';
            } else {
                return '<p class="subscribed">' . $lang->def('_USER_STATUS_SUBS') . '</p>';
            }
        }
        if ($course_info['max_num_subscribe'] !== 0) {
            $query = "SELECT COUNT(*)" . " FROM " . $GLOBALS['prefix_lms'] . "courseuser" . " WHERE idCourse = " . $course_info['idCourse'];
            list($control) = sql_fetch_row(sql_query($query));
            if ($control >= $course_info['max_num_subscribe']) {
                return '<p class="cannot_subscribe">' . $lang->def('_MAX_NUM_SUBSCRIBE') . '</p>';
            }
        }
        if ($course_info['selling'] == 0) {
            if (Docebo::user()->isAnonymous()) {
                return '<p class="cannot_subscribe">' . $lang->def('_NEED_TO_LOGIN') . '</p>';
            } else {
                return '<a href="index.php?pag=' . $page . '&amp;id_catalogue=' . $id_catalogue . ($id_category != 0 ? '&amp;id_cat=' . $id_category : '') . '&amp;id_course=' . $course_info['idCourse'] . '&amp;ini=' . $ini . '&amp;action=subscribe"><p class="can_subscribe">' . $lang->def('_CAN_SUBSCRIBE') . '</p></a>';
            }
        } else {
            $query = "SELECT COUNT(*)" . " FROM " . $GLOBALS['prefix_lms'] . "_transaction_info" . " WHERE id_date = 0" . " AND id_course = " . $course_info['idCourse'] . " AND id_transaction IN" . " (" . " SELECT id_transaction" . " FROM " . $GLOBALS['prefix_lms'] . "_transaction" . " WHERE id_user = "******" AND status = 0" . " )";
            list($control) = sql_fetch_row(sql_query($query));
            if ($control > 0) {
                return '<p class="subscribed">' . $lang->def('_WAITING_PAYMENT') . '</p>';
            }
            return '<a href="index.php?pag=' . $page . '&amp;id_catalogue=' . $id_catalogue . ($id_category != 0 ? '&amp;id_cat=' . $id_category : '') . '&amp;id_course=' . $course_info['idCourse'] . '&amp;ini=' . $ini . '"><p class="can_subscribe">' . $lang->def('_CAN_SUBSCRIBE') . '</p></a>';
        }
    }
}
Example #22
0
function getInteractionsTable($id_user, $idtrack)
{
    require_once _base_ . '/lib/lib.domxml.php';
    require_once _base_ . '/lib/lib.table.php';
    $tb = new Table(Get::sett('visu_course'));
    $lang = DoceboLanguage::CreateInstance('organization', 'lms');
    $id_org = Get::req('id_org', DOTY_INT, 0);
    $h_type = array('', '', '');
    $h_content = array($lang->def('_DESCRIPTION'), $lang->def('_TYPE'), $lang->def('_RESULT'));
    $tb->setColsStyle($h_type);
    $tb->addHead($h_content);
    $qry = "SELECT xmldata FROM " . $GLOBALS['prefix_lms'] . "_scorm_tracking WHERE idscorm_tracking={$idtrack} AND idUser={$id_user}";
    $res = sql_query($qry);
    $row = mysql_fetch_array($res);
    $doc = new DoceboDOMDocument();
    $doc->loadXML($row['xmldata']);
    $context = new DoceboDOMXPath($doc);
    $root = $doc->documentElement;
    $temp = $context->query('//interactions');
    $lines = array();
    for ($i = 0; $i < $temp->length; $i++) {
        $arr = array();
        $node =& $temp->item($i);
        //interaction index
        //$arr['index'] = $node->getAttribute('index');
        //get description
        $elem = $context->query('description/text()', $node);
        $elemNode =& $elem->item(0);
        if ($elemNode && isset($elemNode->textContent)) {
            $arr['description'] = $elemNode->textContent;
            //get type
            $elem = $context->query('type/text()', $node);
            $elemNode =& $elem->item(0);
            $arr['type'] = $elemNode->textContent;
            //get result
            $elem = $context->query('result/text()', $node);
            $elemNode =& $elem->item(0);
            $arr['result'] = $elemNode->textContent;
            //get id
            $elem = $context->query('id/text()', $node);
            $elemNode =& $elem->item(0);
            $id = $elemNode->textContent;
            if ($arr['result'] == '1') {
                $arr['result'] = 'true';
            } else {
                $arr['result'] = 'false';
            }
            $lines[$id] = array($arr['description'], $arr['type'], $arr['result']);
        }
    }
    foreach ($lines as $key => $line) {
        $tb->addBody($line);
    }
    //title
    cout(getTitleArea($lang->def('_SCORM_INTERACTIONS_TABLE')), 'content');
    cout('<div class="std_block">', 'content');
    //back button, back to treeview
    $back = getBackUi('index.php?modname=organization&amp;op=scorm_track&amp;id_user='******'&amp;id_org=' . $id_org, $lang->def('_BACK_TO_TRACK'));
    //'index.php?modname=organization&amp;op=history&amp;id_user='******'&amp;id_org='.$org , $lang->def('_BACK_TO_TRACK') );
    //back button, back to treeview
    cout($back, 'content');
    cout($tb->getTable(), 'content');
    cout($back, 'content');
    cout('</div>', 'content');
}
Example #23
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>');
}
 function _get_delay_query($type = 'html', $report_data = NULL, $other = '')
 {
     if ($report_data == NULL) {
         $report_data =& $_SESSION['report_tempdata'];
     }
     $rdata =& $report_data['rows_filter'];
     $cdata =& $report_data['columns_filter'];
     $acl_man = new DoceboACLManager();
     $acl_man->include_suspended = TRUE;
     $course_man = new Man_Course();
     $alluser = $rdata['all_users'];
     $jump_url = '';
     $org_chart_subdivision = isset($cdata['org_chart_subdivision']) ? $cdata['org_chart_subdivision'] : false;
     $day_from_subscription = $cdata['day_from_subscription'] != "" ? $cdata['day_from_subscription'] : false;
     $day_until_course_end = $cdata['day_until_course_end'] != "" ? $cdata['day_until_course_end'] : false;
     $date_until_course_end = $cdata['date_until_course_end'] != "" ? $cdata['date_until_course_end'] : false;
     $report_type_completed = isset($cdata['report_type_completed']) ? $cdata['report_type_completed'] : false;
     $report_type_started = isset($cdata['report_type_started']) ? $cdata['report_type_started'] : false;
     $course_selected = $cdata['selected_courses'];
     $all_courses = $cdata['all_courses'];
     $order_by = isset($cdata['order_by']) ? $cdata['order_by'] : 'userid';
     $order_dir = isset($cdata['order_dir']) ? $cdata['order_dir'] : 'asc';
     $show_suspended = isset($cdata['show_suspended']) ? (bool) $cdata['show_suspended'] : false;
     if (!$alluser) {
         $user_selected =& $acl_man->getAllUsersFromIdst($rdata['users']);
     } else {
         $user_selected =& $acl_man->getAllUsersIdst();
     }
     $lang =& DoceboLanguage::createInstance('report', 'framework');
     $lang_u =& DoceboLanguage::CreateInstance('stats', 'lms');
     if (empty($user_selected)) {
         return $lang->def('_NULL_SELECTION');
     }
     if (empty($course_selected) && !$all_courses) {
         return $lang->def('_NULL_COURSE_SELECTION');
     }
     if (1 == 1) {
         $date_now = Format::date(date("Y-m-d H:i:s"));
         //set query suspended users condition
         $query_show_suspended = "u.valid = 1";
         //default condition
         switch ($show_suspended) {
             case "all":
                 $query_show_suspended = "";
                 break;
             case "suspended_only":
                 $query_show_suspended = " AND u.valid = 0 ";
                 break;
             case "active_only":
                 $query_show_suspended = " AND u.valid = 1 ";
                 break;
         }
         //set query order by param
         $_dir = "ASC";
         switch ($order_dir) {
             case "desc":
                 $_dir = "DESC";
                 break;
         }
         $query_order_by = "u.lastname, u.firstname, u.userid";
         switch ($order_by) {
             case 'firstname':
                 $query_order_by = "u.firstname " . $_dir . ", u.userid " . $_dir;
                 break;
             case 'lastname':
                 $query_order_by = "u.lastname " . $_dir . ", u.userid " . $_dir;
                 break;
             case 'email':
                 $query_order_by = "u.email " . $_dir . ", u.userid " . $_dir;
                 break;
             case 'status':
                 $query_order_by = "cu.status " . $_dir . ", u.userid " . $_dir . ", u.lastname " . $_dir;
                 break;
                 //case 'level': $query_order_by = "cu.level ".$_dir.", u.userid ".$_dir.", c.code ".$_dir.""; break;
             //case 'level': $query_order_by = "cu.level ".$_dir.", u.userid ".$_dir.", c.code ".$_dir.""; break;
             case 'date_subscription':
                 $query_order_by = "cu.date_inscr " . $_dir . ", u.userid " . $_dir . ", u.lastname " . $_dir;
                 break;
             case 'date_first_access':
                 $query_order_by = "cu.date_first_access " . $_dir . ", u.userid " . $_dir . ", u.lastname " . $_dir;
                 break;
             case 'date_last_access':
                 $query_order_by = "cu.date_last_access " . $_dir . ", u.userid " . $_dir . ", u.lastname " . $_dir;
                 break;
             case 'date_complete':
                 $query_order_by = "cu.date_complete " . $_dir . ", u.userid " . $_dir . ", u.lastname " . $_dir;
                 break;
         }
         $query_course_user = "******" . $GLOBALS['prefix_lms'] . "_courseuser AS cu " . " JOIN " . $GLOBALS['prefix_fw'] . "_user as u ON cu.idUser = u.idst\r\n\t\t\t\tWHERE cu.idCourse > 0 " . $query_show_suspended . ($alluser ? "" : " AND cu.idUser IN ( " . implode(',', $user_selected) . " ) ") . ($all_courses ? '' : " AND cu.idCourse IN (" . implode(',', $course_selected) . ")") . " ORDER BY " . $query_order_by;
         $re_course_user = sql_query($query_course_user);
         $element_to_print = array();
         $courses_codes = array();
         while (list($id_u, $id_c, $id_e, $date_inscr, $date_first_access, $date_complete, $status, $level, $date_last_access, $u_userid, $u_firstname, $u_lastname, $u_email, $u_valid) = sql_fetch_row($re_course_user)) {
             if ($level == '3') {
                 //$report_type === 'course_started' && $level == '3') {
                 $user_check = false;
                 $now_timestamp = mktime('0', '0', '0', date('m'), date('d'), date('Y'));
                 //check the condition on status (course started and/or completed)
                 $status_condition = $status != _CUS_END;
                 //&& $status != _CUS_SUSPEND;
                 if ($report_type_completed && !$report_type_started) {
                     $status_condition = $status_condition && $status == _CUS_BEGIN;
                 }
                 if ($report_type_started && !$report_type_completed) {
                     $status_condition = $status_condition && $status != _CUS_BEGIN;
                 }
                 if ($day_from_subscription) {
                     if ($status_condition) {
                         $user_timestamp = mktime('0', '0', '0', $date_inscr[5] . $date_inscr[6], $date_inscr[8] . $date_inscr[9] + $day_from_subscription, $date_inscr[0] . $date_inscr[1] . $date_inscr[2] . $date_inscr[3]);
                         if ($user_timestamp < $now_timestamp) {
                             $user_check = true;
                         }
                     }
                 }
                 if ($day_until_course_end) {
                     if ($status_condition) {
                         if ($id_e > 0) {
                             $query = "SELECT date_end" . " FROM " . $GLOBALS['prefix_lms'] . "_course_edition" . " WHERE idCourseEdition = '" . $id_e . "'";
                             list($date_end) = sql_fetch_row(sql_query($query));
                             $user_timestamp = mktime('0', '0', '0', $date_end[5] . $date_end[6], $date_end[8] . $date_end[9] - $day_until_course_end, $date_end[0] . $date_end[1] . $date_end[2] . $date_end[3]);
                             if ($user_timestamp < $now_timestamp) {
                                 $user_check = true;
                             }
                         } else {
                             $query = "SELECT date_end" . " FROM " . $GLOBALS['prefix_lms'] . "_course" . " WHERE idCourse = '" . $id_c . "'";
                             list($date_end) = sql_fetch_row(sql_query($query));
                             $user_timestamp = mktime('0', '0', '0', $date_end[5] . $date_end[6], $date_end[8] . $date_end[9] - $day_until_course_end, $date_end[0] . $date_end[1] . $date_end[2] . $date_end[3]);
                             if ($user_timestamp < $now_timestamp) {
                                 $user_check = true;
                             }
                         }
                     }
                 }
                 if ($date_until_course_end) {
                     if ($status_condition) {
                         if ($id_e > 0) {
                             $query = "SELECT COUNT(*)" . " FROM " . $GLOBALS['prefix_lms'] . "_course_edition" . " WHERE idCourseEdition = '" . $id_e . "'" . " AND date_end < '" . Format::dateDb($date_until_course_end, 'date') . "'";
                             list($control) = sql_fetch_row(sql_query($query));
                             if ($control) {
                                 $user_check = true;
                             }
                         } else {
                             $query = "SELECT COUNT(*)" . " FROM " . $GLOBALS['prefix_lms'] . "_course" . " WHERE idCourse = '" . $id_c . "'" . " AND date_end < '" . Format::dateDb($date_until_course_end, 'date') . "'";
                             list($control) = sql_fetch_row(sql_query($query));
                             if ($control) {
                                 $user_check = true;
                             }
                         }
                     }
                 }
                 if (!$date_until_course_end && !$day_from_subscription && !$date_until_course_end) {
                     if ($status_condition) {
                         $user_check = true;
                     }
                 }
                 if ($user_check) {
                     $course_info = $course_man->getCourseInfo($id_c);
                     //$user_detail = $acl_man->getUser($id_u, false);
                     $element_to_print[$id_c]['name'] = $course_info['name'];
                     $element_to_print[$id_c]['code'] = $course_info['code'];
                     $element_to_print[$id_c]['data'][] = array('idUser' => $id_u, 'idCourse' => $id_c, 'idCourseEdition' => $id_e, 'status' => $status, 'level' => $level, 'userid' => Docebo::aclm()->relativeId($u_userid), 'firstname' => $u_firstname, 'lastname' => $u_lastname, 'mail' => $u_email, 'suspended' => $u_valid <= 0, 'date_subscription' => $date_inscr, 'date_first_access' => $date_first_access, 'date_completed' => $date_complete, 'date_last_access' => $date_last_access);
                 }
             }
         }
         //backward compatibility
         $showed_columns = array();
         foreach ($cdata['showed_columns'] as $_column_key) {
             $showed_columns[] = $this->_check_delay_column($_column_key);
         }
         //print course table
         $this->_printTable_delay($type, $element_to_print, $showed_columns);
         if ($this->use_mail) {
             $this->_loadEmailActions();
         }
     }
 }
Example #25
0
function moveThread($id_thread, $id_forum)
{
    require_once _base_ . '/lib/lib.form.php';
    $lang =& DoceboLanguage::CreateInstance('forum');
    $mod_perm = checkPerm('mod', true);
    $moderate = checkPerm('moderate', true);
    $action = importVar('action', true, 0);
    if (isset($_GET['confirm'])) {
        $id_new_forum = importVar('new_forum', true, 0);
        $id_thread = importVar('id_thread', true, 0);
        $id_forum = importVar('id_forum', true, 0);
        $confirm = importVar('confirm', true, 0);
        if ($confirm) {
            // Move the thread to the new forum
            $query = "UPDATE " . $GLOBALS['prefix_lms'] . "_forumthread" . " SET idForum = '" . $id_new_forum . "'" . " WHERE idThread = '" . $id_thread . "'";
            $result = sql_query($query);
            // Select thenumber of the post in the thread
            $query_2 = "SELECT num_post" . " FROM " . $GLOBALS['prefix_lms'] . "_forumthread" . " WHERE idThread = '" . $id_thread . "'";
            list($num_post) = sql_fetch_row(sql_query($query_2));
            // Update the forum info
            $query_3 = "SELECT idForum, num_thread, num_post" . " FROM " . $GLOBALS['prefix_lms'] . "_forum" . " WHERE idForum = '" . $id_forum . "'" . " OR idForum = '" . $id_new_forum . "'";
            $result_3 = sql_query($query_3);
            $num_post_update = array();
            $num_thread_update = array();
            while (list($idForum, $num_thread_3, $num_post_3) = sql_fetch_row($result_3)) {
                if ($idForum == $id_forum) {
                    $num_post_update[$idForum] = $num_post_3 - $num_post;
                    $num_thread_update[$idForum] = $num_thread_3 - 1;
                } else {
                    $num_post_update[$idForum] = $num_post_3 + $num_post;
                    $num_thread_update[$idForum] = $num_thread_3 + 1;
                }
            }
            $last_message_update = array();
            $query_4 = "SELECT idMessage" . " FROM " . $GLOBALS['prefix_lms'] . "_forummessage" . " WHERE idThread IN" . "(" . " SELECT idThread" . " FROM " . $GLOBALS['prefix_lms'] . "_forumthread" . " WHERE idForum = '" . $id_forum . "'" . ")" . " ORDER BY posted DESC" . " LIMIT 0,1";
            list($last_message_update[$id_forum]) = sql_fetch_row(sql_query($query_4));
            $query_5 = "SELECT idMessage" . " FROM " . $GLOBALS['prefix_lms'] . "_forummessage" . " WHERE idThread IN" . "(" . " SELECT idThread" . " FROM " . $GLOBALS['prefix_lms'] . "_forumthread" . " WHERE idForum = '" . $id_new_forum . "'" . ")" . " ORDER BY posted DESC" . " LIMIT 0,1";
            list($last_message_update[$id_new_forum]) = sql_fetch_row(sql_query($query_5));
            $query_update_1 = "UPDATE " . $GLOBALS['prefix_lms'] . "_forum" . " SET num_post = '" . $num_post_update[$id_forum] . "'," . " num_thread='" . $num_thread_update[$id_forum] . "'," . " last_post = '" . $last_message_update[$id_forum] . "'" . " WHERE idForum = '" . $id_forum . "'";
            $result_update_1 = sql_query($query_update_1);
            $query_update_2 = "UPDATE " . $GLOBALS['prefix_lms'] . "_forum" . " SET num_post = '" . $num_post_update[$id_new_forum] . "'," . " num_thread='" . $num_thread_update[$id_new_forum] . "'," . " last_post = '" . $last_message_update[$id_new_forum] . "'" . " WHERE idForum = '" . $id_new_forum . "'";
            $result_update_2 = sql_query($query_update_2);
        }
        Util::jump_to('index.php?modname=forum&amp;op=thread&idForum=' . $id_forum);
    }
    if ($action) {
        $id_new_forum = importVar('new_forum', true, 0);
        $id_thread = importVar('id_thread', true, 0);
        $id_forum = importVar('id_forum', true, 0);
        list($title) = sql_fetch_row(sql_query("SELECT title" . " FROM " . $GLOBALS['prefix_lms'] . "_forumthread" . " WHERE idThread = '" . $id_thread . "'"));
        list($from_forum) = sql_fetch_row(sql_query("SELECT title" . " FROM " . $GLOBALS['prefix_lms'] . "_forum" . " WHERE idForum = '" . $id_forum . "'"));
        list($to_forum) = sql_fetch_row(sql_query("SELECT title" . " FROM " . $GLOBALS['prefix_lms'] . "_forum" . " WHERE idForum = '" . $id_new_forum . "'"));
        $GLOBALS['page']->add(getTitleArea($lang->def('_MOVE'), 'forum') . '<div class="std_block">' . getModifyUi($lang->def('_AREYOUSURE_MOVE'), '<span>' . $lang->def('_TITLE') . ' : </span> "' . $title . '"' . ' ' . $lang->def('_FROM_FORUM') . ' "' . $from_forum . '" ' . $lang->def('_TO_FORUM') . ' "' . $to_forum . '"', true, 'index.php?modname=forum&amp;op=movethread&amp;new_forum=' . $id_new_forum . '&amp;id_thread=' . $id_thread . '&amp;id_forum=' . $id_forum . '&amp;confirm=1', 'index.php?modname=forum&amp;op=movethread&amp;id_forum=' . $id_forum . '&amp;confirm=0') . '</div>', 'content');
    } else {
        $id_course = (int) $_SESSION['idCourse'];
        $id_forum = importVar('id_forum', true, 0);
        $list_forum = array();
        $query = "SELECT idForum, title" . " FROM " . $GLOBALS['prefix_lms'] . "_forum" . " WHERE idCourse = '" . $id_course . "'" . " AND idForum <> '" . $id_forum . "'";
        $result = sql_query($query);
        while (list($id_forum_b, $title) = sql_fetch_row($result)) {
            $list_forum[$id_forum_b] = $title;
        }
        $GLOBALS['page']->add(getTitleArea($lang->def('_MOVE'), 'forum') . '<div class="std_block">' . Form::openForm('search_forum', 'index.php?modname=forum&amp;op=movethread&amp;id_thread=' . $id_thread . '&amp;id_forum=' . $id_forum . '&amp;action=1') . '<div class="form_line_l">' . Form::getDropdown($lang->def('_MOVE_TO_FORUM'), 'new_forum', 'new_forum', $list_forum) . '<input class="search_b" type="submit" id="move_thread" name="move_thread" value="' . $lang->def('_MOVE') . '" />' . '</div>' . Form::closeForm() . '</div>', 'content');
    }
}
Example #26
0
 function loadRenameFolder()
 {
     $lang =& DoceboLanguage::CreateInstance('course', 'lms');
     $tdb = $this->tdb;
     $folder = $tdb->getFolderById($this->getSelectedFolderId());
     return Form::openElementSpace() . $this->printState() . Form::getTextfield($lang->def('_NAME'), $this->_getFolderNameId(), $this->_getFolderNameId(), 255, $this->getFolderPrintName($folder)) . Form::closeElementSpace() . Form::openButtonSpace() . ' <img src="' . $this->_getRenameImage() . '" alt="' . $this->_getRenameAlt() . '" /> ' . '<input type="submit" class="TreeViewAction" value="' . $lang->def('_MOD') . '"' . ' name="' . $this->_getRenameFolderId() . '" id="' . $this->_getRenameFolderId() . '" />' . ' <img src="' . $this->_getCancelImage() . '" alt="' . $this->_getCancelAlt() . '" /> ' . '<input type="submit" class="TreeViewAction" value="' . $lang->def('_UNDO', 'standard') . '"' . ' name="' . $this->_getCancelId() . '" id="' . $this->_getCancelId() . '" />' . Form::closeButtonSpace();
 }
Example #27
0
function storage_display()
{
    $tv = create_TabView($GLOBALS['op']);
    $repo =& create_activeTab($tv);
    $repo->initialize();
    $GLOBALS['page']->setWorkingZone('content');
    if (!$repo->hideTab()) {
        $GLOBALS['page']->add($tv->printTabView_Begin($repo->getUrlParams()));
        $GLOBALS['page']->addEnd($tv->printTabView_End());
    }
    if ($repo->isFindingDestination()) {
        $repo->setOptions(TRUE);
    }
    $GLOBALS['page']->add($repo->getExtraTop());
    $repo->loadBody();
    $GLOBALS['page']->add($repo->getExtraBottom());
    //setup dialog popups
    $lang =& DoceboLanguage::CreateInstance('standard', 'framework');
    require_once _base_ . '/lib/lib.dialog.php';
    switch ($tv->getActiveTab()) {
        case 'storage_course':
            setupFormDialogBox('orgshow', 'index.php?modname=storage&op=organization', 'input[name*=treeview_opdeletefolder_organization]', $lang->def('_AREYOUSURE'), $lang->def('_CONFIRM'), $lang->def('_UNDO'), 'function(o) { return o.title; }', 'organization_treeview_opdeletefolder_organization_', 'treeview_selected_organization', 'treeview_delete_folder_organization');
            break;
        case 'storage_home':
            setupFormDialogBox('homereposhow', 'index.php?modname=storage&op=homerepo', 'input[name*=treeview_opdeletefolder_homerepo]', $lang->def('_AREYOUSURE'), $lang->def('_CONFIRM'), $lang->def('_UNDO'), 'function(o) { return o.title; }', 'homerepo_treeview_opdeletefolder_homerepo_', 'treeview_selected_homerepo', 'treeview_delete_folder_homerepo');
            break;
        case 'storage_pubrepo':
            setupFormDialogBox('pubreposhow', 'index.php?modname=storage&op=pubrepo', 'input[name*=treeview_opdeletefolder_pubrepo]', $lang->def('_AREYOUSURE'), $lang->def('_CONFIRM'), $lang->def('_UNDO'), 'function(o) { return o.title; }', 'pubrepo_treeview_opdeletefolder_pubrepo_', 'treeview_selected_pubrepo', 'treeview_delete_folder_pubrepo');
            break;
    }
    //if( !$repo->hideTab() )
    //	$GLOBALS['page']->add( $tv->printTabView_End() );
    destroy_TabView($tv);
}