Example #1
0
 function modglossarygui($object_glos = NULL)
 {
     checkPerm('view', false, 'storage');
     $lang =& DoceboLanguage::createInstance('glossary');
     require_once _base_ . '/lib/lib.table.php';
     $tableGlossary = new Table(Get::sett('visuItem'), '', $lang->def('_GLOSSARY_SUMMARY'));
     $tableGlossary->initNavBar('ini', 'link');
     $ini = $tableGlossary->getSelectedElement();
     $back_coded = htmlentities(urlencode($object_glos->back_url));
     list($title) = sql_fetch_row(sql_query("\r\n\tSELECT title\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_glossary \r\n\tWHERE idGlossary = '" . $object_glos->getId() . "'"));
     $reTerm = sql_query("\r\n\tSELECT idTerm, term \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_glossaryterm \r\n\tWHERE idGlossary = '" . $object_glos->getId() . "' \r\n\tORDER BY term \r\n\tLIMIT {$ini}," . Get::sett('visuItem'));
     list($num_of_term) = sql_fetch_row(sql_query("\r\n\tSELECT COUNT(*) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_glossaryterm\r\n\tWHERE idGlossary = '" . $object_glos->getId() . "'"));
     if ($title == '') {
         $_SESSION['last_error'] = $lang->def('_FILEUNSPECIFIED');
         Util::jump_to(Util::str_replace_once('&', '&', $object_glos->back_url) . '&create_result=0');
     }
     $GLOBALS['page']->add(getTitleArea($lang->def('_GLOSSARY'), 'glossary', $lang->def('_GLOSSARY')) . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&amp;', $object_glos->back_url) . '&amp;mod_result=0', $lang->def('_BACK')) . '<b>' . $lang->def('_GLOSSARY') . ' : ' . $title . '</b><br /><br />' . '<div class="mod_container">' . '<a href="index.php?modname=glossary&amp;op=modglossary&amp;idGlossary=' . $object_glos->getId() . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_MOD_TITLE') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" /> ' . $lang->def('_MOD_TITLE') . '</a>' . '</div><br />', 'content');
     $contentArray = array($lang->def('_TERM'), '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" alt="' . $lang->def('_DEL') . '" />');
     $typeArray = array('', 'image', 'image');
     $GLOBALS['page']->add($tableGlossary->addHead($contentArray, $typeArray));
     while (list($idTerm, $term) = sql_fetch_row($reTerm)) {
         $content = array($term, '<a href="index.php?modname=glossary&amp;op=modterm&amp;idTerm=' . $idTerm . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_MOD') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" /></a>', '<a href="index.php?modname=glossary&amp;op=delterm&amp;idTerm=' . $idTerm . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_DEL') . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" /></a>');
         $tableGlossary->addBody($content);
     }
     $tableGlossary->addActionAdd('<a href="index.php?modname=glossary&amp;op=addterm&amp;idGlossary=' . $object_glos->getId() . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_ADDTERM') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" /> ' . $lang->def('_ADDTERM') . '</a>');
     $tableGlossary->setLink('index.php?modname=glossary&amp;op=modglossarygui' . '&amp;idGlossary=' . $object_glos->getId() . '&amp;back_url=' . $back_coded);
     $GLOBALS['page']->add($tableGlossary->getTable() . $tableGlossary->getNavBar($ini, $num_of_term) . '</div>', 'content');
 }
 public function mod()
 {
     $id_trans = Get::req('id_trans', DOTY_INT, 0);
     if (isset($_POST['undo'])) {
         Util::jump_to('index.php?r=alms/transaction/show');
     }
     if (isset($_POST['save']) || isset($_POST['not_paid'])) {
         $product_to_activate = Get::req('product', DOTY_MIXED, array());
         $id_user = Get::req('id_user', DOTY_MIXED, 0);
         if ($this->model->saveTransaction($product_to_activate, $id_trans, $id_user)) {
             $this->model->controlActivation($id_trans, isset($_POST['not_paid']));
             Util::jump_to('index.php?r=alms/transaction/show&res=ok');
         }
         Util::jump_to('index.php?r=alms/transaction/show&res=err');
     }
     $transaction_info = $this->model->getTransactionInfo($id_trans);
     $user_info = $this->acl_man->getUser($transaction_info['id_user'], false);
     $user_info[ACL_INFO_USERID] = $this->acl_man->relativeId($user_info[ACL_INFO_USERID]);
     require_once _base_ . '/lib/lib.table.php';
     $tb = new Table(false, Lang::t('_DETAILS', 'transaction'), Lang::t('_DETAILS', 'transaction'));
     $ts = array('', '', 'min-cell', 'image');
     $th = array(Lang::t('_CODE', 'transaction'), Lang::t('_NAME', 'transaction'), Lang::t('_PRICE', 'transaction'), Lang::t('_MARK_AS_PAID', 'transaction'));
     $tb->setColsStyle($ts);
     $tb->addHead($th);
     foreach ($transaction_info['product'] as $product_info) {
         $tb->addBody(array($product_info['code'], $product_info['name'], $product_info['price'], Form::getInputCheckbox('product_' . $product_info['id_course'] . '_' . $product_info['id_date'] . '_' . $product_info['id_edition'], 'product[' . $product_info['id_course'] . '_' . $product_info['id_date'] . '_' . $product_info['id_edition'] . ']', 1, $product_info['activated'], $product_info['activated'] ? ' disabled="disabled"' : '')));
     }
     $this->render('mod', array('transaction_info' => $transaction_info, 'user_info' => $user_info, 'tb' => $tb, 'id_trans' => $id_trans));
 }
Example #3
0
    function notes()
    {
        checkPerm('view');
        require_once _base_ . '/lib/lib.table.php';
        $lang =& DoceboLanguage::createInstance('notes', 'lms');
        $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0);
        $ini = $nav_bar->getSelectedElement();
        $ord = importVar('ord');
        $inv = importVar('inv');
        switch ($ord) {
            case "tit":
                $ord = $order = 'title';
                if ($inv != 'y') {
                    $a_down = '&amp;inv=y';
                } else {
                    $order .= ' DESC';
                    $a_down = '';
                }
                break;
            default:
                $ord = $order = 'data';
                if ($inv == 'y') {
                    $a_down = '';
                } else {
                    $order .= ' DESC';
                    $a_down = '&amp;inv=y';
                }
        }
        $reNotes = sql_query("\r\n\tSELECT idNotes, data, title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_notes \r\n\tWHERE owner ='" . getLogUserId() . "' AND idCourse='" . $_SESSION['idCourse'] . "' \r\n\tORDER BY {$order} \r\n\tLIMIT {$ini}," . Get::sett('visuItem'));
        list($num_notes) = sql_fetch_row(sql_query("SELECT COUNT(*) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_notes \r\n\tWHERE owner ='" . getLogUserId() . "' AND idCourse='" . $_SESSION['idCourse'] . "' "));
        $nav_bar->setElementTotal($num_notes);
        $img_up = '<img class="valing-middle" src="' . getPathImage() . 'standard/up_arrow.png" alt="' . $lang->def('_UP') . '"/>';
        $img_down = '<img class="valing-middle" src="' . getPathImage() . 'standard/down_arrow.png" alt="' . $lang->def('_DOWN') . '"/>';
        $tb = new Table(Get::sett('visuItem'), $lang->def('_NOTES'), $lang->def('_NOTES'));
        $contentH = array(($ord == 'data' ? $inv == 'y' ? $img_up : $img_down : '') . '<a href="index.php?modname=notes&amp;op=notes' . $a_down . '"> ' . $lang->def('_DATE') . '</a>', ($ord == 'title' ? $inv == 'y' ? $img_up : $img_down : '') . '<a href="index.php?modname=notes&amp;op=notes&amp;ord=tit' . $a_down . '">' . $lang->def('_TITLE') . '</a>', '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" alt="' . $lang->def('_DEL') . '" />');
        $typeH = array('min-cell', '', 'image', 'image');
        $tb->setColsStyle($typeH);
        $tb->addHead($contentH);
        while (list($idNotes, $data, $title) = sql_fetch_row($reNotes)) {
            $content = array(Format::date($data), '<a href="index.php?modname=notes&amp;op=displaynotes&amp;idNotes=' . $idNotes . '" title="' . $lang->def('_MORET') . '">' . $title . '</a>', '<a href="index.php?modname=notes&amp;op=modnotes&amp;idNotes=' . $idNotes . '">
				<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" /></a>', '<a id="delnotes_' . $idNotes . '"' . ' href="index.php?modname=notes&amp;op=delnotes&amp;idNotes=' . $idNotes . '"' . ' title="' . $lang->def('_TITLE') . ' : ' . strip_tags(str_replace(array('"', "'"), '', $title)) . '">
				<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" /></a>');
            $tb->addBody($content);
        }
        $tb->addActionAdd('<a href="index.php?modname=notes&amp;op=addnotes">' . '<img src="' . getPathImage() . 'standard/add.png" title="' . $lang->def('_ADD') . '" alt="' . $lang->def('_ADD') . '" /> ' . $lang->def('_ADD_NOTES') . '</a>');
        $GLOBALS['page']->add(getTitleArea(array($lang->def('_NOTES')), 'notes') . '<div class="std_block">', 'content');
        if (isset($_POST['result'])) {
            switch ($_POST['result']) {
                case "ok":
                    $GLOBALS['page']->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')), 'content');
                case "err":
                    $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE')), 'content');
            }
        }
        $GLOBALS['page']->add($tb->getTable() . $nav_bar->getNavBar($ini), 'content');
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=delnotes]');
        $GLOBALS['page']->add('</div>', 'content');
    }
Example #4
0
function fileList(&$url)
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.tab.php';
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $file_man = new MyFile(getLogUserId());
    $tab_man = new TabView('myfiles', '');
    $lang =& DoceboLanguage::createInstance('myfiles');
    $areas = $file_man->getFilesAreas();
    while (list($id_page, $area_name) = each($areas)) {
        $new_tab = new TabElemDefault($id_page, $lang->def($area_name), getPathImage('fw') . 'myfiles/' . $id_page . '.gif');
        $tab_man->addTab($new_tab);
    }
    $tab_man->parseInput($_POST, $_SESSION);
    $active_tab = $tab_man->getActiveTab();
    if (!$active_tab) {
        $active_tab = importVar('working_area', false, $file_man->getDefaultArea());
        $tab_man->setActiveTab($active_tab);
    }
    $GLOBALS['page']->addStart(Form::openForm('tab_myfiles', $url->getUrl('op=myfiles')) . Form::getHidden('working_area', 'working_area', $active_tab) . $tab_man->printTabView_Begin('', false), 'content');
    $GLOBALS['page']->addEnd($tab_man->printTabView_End() . Form::closeForm(), 'content');
    $tb = new Table(0, $lang->def('_MYFILES_CAPTION'), $lang->def('_MYFILES_SUMMARY'));
    $cont_h = array($lang->def('_TITLE'), $lang->def('_FILE_POLICY'), '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_REM_FILE') . '" alt="' . $lang->def('_DEL') . '" />');
    $type_h = array('', 'image nowrap', 'image', 'image');
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    $re_files = $file_man->getFileList($active_tab, false, MYFILE_TITLE);
    while ($file_info = $file_man->fetch_row($re_files)) {
        $cont = array($file_info[MYFILE_TITLE]);
        switch ($file_info[MYFILE_POLICY]) {
            case MF_POLICY_FREE:
                $cont[] = $lang->def('_MF_POLICY_FREE');
                break;
            case MF_POLICY_TEACHER:
                $cont[] = $lang->def('_MF_POLICY_TEACHER');
                break;
            case MF_POLICY_FRIENDS:
                $cont[] = $lang->def('_MF_POLICY_FRIENDS');
                break;
            case MF_POLICY_TEACHER_AND_FRIENDS:
                $cont[] = $lang->def('_MF_POLICY_TEACHER_AND_FRIENDS');
                break;
            case MF_POLICY_NOONE:
                $cont[] = $lang->def('_MF_POLICY_NOONE');
                break;
        }
        $cont[] = '<a href="' . $url->getUrl('op=modfiles&working_area=' . $active_tab . '&id_file=' . $file_info[MYFILE_ID_FILE]) . '">' . '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . ' : ' . $file_info[MYFILE_TITLE] . '" alt="' . $lang->def('_MOD') . '" />' . '</a>';
        $cont[] = '<a href="' . $url->getUrl('op=delfiles&id_file=' . $file_info[MYFILE_ID_FILE]) . '">' . '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_REM_FILE') . ' : ' . $file_info[MYFILE_TITLE] . '" alt="' . $lang->def('_DEL') . '" />' . '</a>';
        $tb->addBody($cont);
    }
    $tb->addActionAdd('<p class="new_elem_link"><a href="' . $url->getUrl('op=modfiles&working_area=' . $active_tab) . '">' . $lang->def('_ADD_' . $active_tab) . '</a></p>');
    $tb->addActionAdd('<p>' . '<a href="' . $url->getUrl('modname=profile&op=profile&id_user='******'&ap=view_files&type=' . $active_tab . '&from=1') . '">' . '<img src="' . getPathImage('fw') . 'myfiles/' . $active_tab . '.gif" title="' . $lang->def($active_tab) . '" alt="' . $lang->def('_VIEW_' . $active_tab) . '" />' . '</a>' . '<a href="' . $url->getUrl('modname=profile&op=profile&id_user='******'&ap=view_files&type=' . $active_tab . '&from=1') . '">' . $lang->def('_VIEW_' . $active_tab) . '</a></p>');
    $GLOBALS['page']->add($tb->getTable(), 'content');
}
Example #5
0
 function getPermissionUi($form_name, $perm)
 {
     require_once _base_ . '/lib/lib.table.php';
     $lang =& DoceboLanguage::createInstance('manmenu');
     $lang_perm =& DoceboLanguage::createInstance('permission');
     $tokens = $this->getAllToken();
     $levels = CourseLevel::getLevels();
     $tb = new Table(0, $lang->def('_VIEW_PERMISSION'), $lang->def('_EDIT_SETTINGS'));
     $c_head = array($lang->def('_LEVELS'));
     $t_head = array('');
     foreach ($tokens as $k => $token) {
         if ($token['code'] != 'view') {
             if (isset($token['image'])) {
                 $c_head[] = '<img src="' . getPathImage() . $token['image'] . '" alt="' . $lang_perm->def($token['name']) . '"' . ' title="' . $lang_perm->def($token['name']) . '" />';
             } else {
                 $c_head[] = $lang_perm->def($token['name']);
             }
             $t_head[] = 'image';
         }
     }
     if (count($tokens) > 1) {
         $c_head[] = '<img src="' . getPathImage() . 'standard/checkall.png" alt="' . $lang->def('_CHECKALL') . '" />';
         $c_head[] = '<img src="' . getPathImage() . 'standard/uncheckall.png" alt="' . $lang->def('_UNCHECKALL') . '" />';
         $t_head[] = 'image';
         $t_head[] = 'image';
     }
     $tb->setColsStyle($t_head);
     $tb->addHead($c_head);
     while (list($lv, $levelname) = each($levels)) {
         $c_body = array($levelname);
         foreach ($tokens as $k => $token) {
             if ($token['code'] != 'view') {
                 $c_body[] = '<input class="check" type="checkbox" ' . 'id="perm_' . $lv . '_' . $token['code'] . '" ' . 'name="perm[' . $lv . '][' . $token['code'] . ']" value="1"' . (isset($perm[$lv][$token['code']]) ? ' checked="checked"' : '') . ' />' . '<label class="access-only" for="perm_' . $lv . '_' . $token['code'] . '">' . $lang_perm->def($token['name']) . '</label>' . "\n";
             }
         }
         if (count($tokens) > 1) {
             $c_body[] = '<img class="handover"' . ' onclick="checkall(\'' . $form_name . '\', \'perm[' . $lv . ']\', true); return false;"' . ' src="' . getPathImage() . 'standard/checkall.png" alt="' . $lang->def('_CHECKALL') . '" />';
             $c_body[] = '<img class="handover"' . ' onclick="checkall(\'' . $form_name . '\', \'perm[' . $lv . ']\', false); return false;"' . ' src="' . getPathImage() . 'standard/uncheckall.png" alt="' . $lang->def('_UNCHECKALL') . '" />';
         }
         $tb->addBody($c_body);
     }
     $c_select_all = array('');
     foreach ($tokens as $k => $token) {
         if ($token['code'] != 'view') {
             $c_select_all[] = '<img class="handover"' . ' onclick="checkall_fromback(\'' . $form_name . '\', \'[' . $token['code'] . ']\', true); return false;"' . ' src="' . getPathImage() . 'standard/checkall.png" alt="' . $lang->def('_CHECKALL') . '" />' . '<img class="handover"' . ' onclick="checkall_fromback(\'' . $form_name . '\', \'[' . $token['code'] . ']\', false); return false;"' . ' src="' . getPathImage() . 'standard/uncheckall.png" alt="' . $lang->def('_UNCHECKALL') . '" />';
         }
     }
     if (count($tokens) > 1) {
         $c_select_all[] = '';
         $c_select_all[] = '';
     }
     $tb->addBody($c_select_all);
     return $tb->getTable();
 }
function reportList()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('report', 'framework');
    $_SESSION['report_tempdata'] = array();
    $can_mod = checkPerm('mod', true);
    $acl_man = Docebo::aclm();
    $public_admin_mod = true;
    $query = "SELECT t1.*, t2.userid \r\n\tFROM %lms_report_filter as t1 \r\n\t\tLEFT JOIN %adm_user as t2 ON t1.author=t2.idst\r\n\tWHERE t1.is_public = 1 OR t1.author = " . Docebo::user()->getId();
    $tb = new Table();
    $tb->initNavBar('ini', 'button');
    $col_type = array('', 'align_center', 'align_center', 'image');
    $col_content = array($lang->def('_NAME'), $lang->def('_TAB_REP_CREATOR', 'report', 'framework'), $lang->def('_CREATION_DATE'), '<img src="' . getPathImage() . 'standard/view.png" alt="' . $lang->def('REPORT_SHOW_RESULTS') . '" title="' . $lang->def('REPORT_SHOW_RESULTS') . '" />');
    if ($public_admin_mod && $can_mod) {
        $col_type[] = 'image';
        $col_content[] = '<img src="' . getPathImage() . 'standard/edit.png"  alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '"/>';
        $col_type[] = 'image';
        $col_content[] = '<img src="' . getPathImage() . 'standard/delete.png"  alt="' . $lang->def('_DEL') . '" title="' . $lang->def('_DEL') . '"/>';
    }
    $tb->setColsStyle($col_type);
    $tb->addHead($col_content);
    $res = sql_query($query);
    if ($res) {
        while ($row = sql_fetch_assoc($res)) {
            $id = $row['id_filter'];
            $opn_link = '<a href="index.php?modname=public_report_admin&amp;op=view_report&amp;idrep=' . $id . '" ' . ' title="' . $lang->def('REPORT_SHOW_RESULTS', 'report', 'framework') . '">' . '<img src="' . getPathImage() . 'standard/view.png" alt="' . $lang->def('REPORT_SHOW_RESULTS', 'report', 'framework') . '" />' . '</a>';
            $tb_content = array($row['author'] == 0 ? $lang->def($row['filter_name']) : $row['filter_name'], $row['author'] == 0 ? '<div class="align_center">-</div>' : $acl_man->relativeId($row['userid']), Format::date($row['creation_date']), $opn_link);
            if ($public_admin_mod && $can_mod) {
                if ($row['author'] == Docebo::user()->getId()) {
                    $tb_content[] = '<a href="index.php?modname=public_report_admin&amp;op=modify_name&amp;modid=' . $id . '" ' . ' title="' . $lang->def('_MOD', 'report', 'framework') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD', 'report', 'framework') . '" />' . '</a>';
                } else {
                    $tb_content[] = '';
                }
                if ($row['author'] == Docebo::user()->getId()) {
                    $tb_content[] = '<a href="index.php?modname=public_report_admin&amp;op=del_public_report&amp;idrep=' . $id . '" ' . ' title="' . $lang->def('_DEL', 'report', 'framework') . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL', 'report', 'framework') . '" />' . '</a>';
                } else {
                    $tb_content[] = '';
                }
            }
            $tb->addBody($tb_content);
        }
    }
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=del_public_report]');
    if ($public_admin_mod && $can_mod) {
        $tb->addActionAdd('<a href="index.php?modname=public_report_admin&amp;op=create_name">' . '<img src="' . getPathImage() . 'standard/add.png" title="' . $lang->def('_NEW') . '" /> ' . $lang->def('_NEW') . '</a>');
    }
    cout(getTitleArea($lang->def('_REPORT')) . '<div class="std_block">' . $tb->getTable() . '</div>', 'content');
}
Example #7
0
 function listroom()
 {
     require_once _base_ . '/lib/lib.table.php';
     $lang =& DoceboLanguage::createInstance('admin_config', 'scs');
     $out =& $GLOBALS['page'];
     $mod_perm = checkPerm('mod', true);
     $out->setWorkingZone('content');
     $out->add(getTitleArea($lang->def('_ROOM_MAN'), 'admin_conf') . '<div class="std_block">');
     $tb_room = new Table(0, $lang->def('_ALL_ROOMS'), $lang->def('_ALL_ROOMS_SUMMARY'));
     $cont_h = array($lang->def('_ROOM_NAME'), $lang->def('_ROOM_TYPE'));
     $type_h = array('', 'align_center');
     if ($mod_perm) {
         $cont_h[] = '<img src="' . getPathImage('fw') . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />';
         $type_h[] = 'image';
         $cont_h[] = '<img src="' . getPathImage('fw') . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />';
         $type_h[] = 'image';
     }
     $tb_room->setColsStyle($type_h);
     $tb_room->addHead($cont_h);
     $query_rooms = "\r\n\tSELECT id_room, room_name, room_type \r\n\tFROM " . $GLOBALS['prefix_scs'] . "_rules_room ";
     $re_rooms = sql_query($query_rooms);
     while (list($id_room, $room_name, $room_type) = sql_fetch_row($re_rooms)) {
         $cont = array($room_name);
         switch ($room_type) {
             case "course":
                 $cont[] = $lang->def('_COURSE');
                 break;
             case "private":
                 $cont[] = $lang->def('_PRIVATE');
                 break;
             case "public":
                 $cont[] = $lang->def('_PUBLIC');
                 break;
         }
         if ($mod_perm) {
             $cont[] = '<a href="index.php?modname=room&amp;op=modroom&amp;id_room=' . $id_room . '"' . ' title="' . $lang->def('_MOD') . ' : ' . $room_name . '">' . '<img src="' . getPathImage('fw') . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $room_name . '" /></a>';
             $cont[] = '<a href="index.php?modname=room&amp;op=delroom&amp;id_room=' . $id_room . '"' . ' title="' . $lang->def('_DEL') . ' : ' . $room_name . '">' . '<img src="' . getPathImage('fw') . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $room_name . '" /></a>';
         }
         $tb_room->addBody($cont);
     }
     if ($mod_perm) {
         $tb_room->addActionAdd('<a href="index.php?modname=room&amp;op=newroom">' . '<img src="' . getPathImage('fw') . 'standard/add.png" alt="' . $lang->def('_NEW_ROOM') . '" />' . '&nbsp;' . $lang->def('_NEW_ROOM') . '</a>');
     }
     $out->add($tb_room->getTable());
     $out->add('</div>');
 }
Example #8
0
function mycompetences(&$url)
{
    checkPerm('view');
    $html = "";
    $html .= getTitleArea(Lang::t('_COMPETENCES'), 'competences');
    $html .= '<div class="std_block">';
    $cmodel = new CompetencesAdm();
    $fmodel = new FunctionalrolesAdm();
    $id_user = getLogUserId();
    $ucomps = $cmodel->getUserCompetences($id_user);
    $rcomps = $fmodel->getUserRequiredCompetences($id_user);
    $ucomps_info = $cmodel->getCompetencesInfo(array_keys($ucomps));
    $language = getLanguage();
    $_typologies = $cmodel->getCompetenceTypologies();
    $_types = $cmodel->getCompetenceTypes();
    $icon_actv = '<span class="ico-sprite subs_actv"><span>' . Lang::t('_COMPETENCE_OBTAINED', 'competences') . '</span></span>';
    $icon_req = '<span class="ico-sprite subs_actv"><span>' . Lang::t('_MANDATORY', 'competences') . '</span></span>';
    //*******************
    require_once _base_ . '/lib/lib.table.php';
    $table = new Table(Get::sett('visuItem'), Lang::t('_COMPETENCES'), Lang::t('_COMPETENCES'));
    $style_h = array('', '', 'image', 'image', 'image', 'image', 'image');
    $label_h = array(Lang::t('_NAME', 'competences'), Lang::t('_TYPOLOGY', 'competences'), Lang::t('_TYPE', 'standard'), Lang::t('_SCORE', 'competences'), Lang::t('_DATE_LAST_COMPLETE', 'subscribe'), Lang::t('_COMPETENCES_REQUIRED', 'competences'));
    $table->addHead($label_h, $style_h);
    foreach ($ucomps_info as $id_competence => $cinfo) {
        $line = array();
        $line[] = $cinfo->langs[$language]['name'];
        $line[] = $_typologies[$cinfo->typology];
        $line[] = $_types[$cinfo->type];
        $line[] = $cinfo->type == 'score' ? '<b>' . $ucomps[$id_competence]->score_got . '</b>' : $icon_actv;
        $line[] = Format::date($ucomps[$id_competence]->last_assign_date, 'datetime');
        $line[] = array_key_exists($id_competence, $rcomps) ? $icon_req : '';
        $table->addBody($line);
    }
    $html .= $table->getTable();
    $html .= '</div>';
    $html .= Form::openForm('beck_url', 'index.php');
    $html .= Form::openButtonSpace();
    $html .= Form::getButton('close', 'close', Lang::t('_CLOSE', 'standard'));
    $html .= Form::closeButtonSpace();
    $html .= Form::closeform();
    cout($html, 'content');
}
Example #9
0
 function loadMaterials($idCourse)
 {
     $mod_perm = checkPerm('mod', true);
     require_once _base_ . '/lib/lib.table.php';
     $lang =& DoceboLanguage::createInstance('course');
     $re_file = sql_query("\r\n\tSELECT id_file, title, path \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_course_file \r\n\tWHERE id_course='" . $idCourse . "'");
     if (!mysql_num_rows($re_file) && !$mod_perm) {
         return '';
     }
     $tb = new Table(0, $lang->def('_MATERIALS'), $lang->def('_MATERIALS_TABLE'));
     $cont_h = array($lang->def('_TITLE'));
     $type_h = array('');
     if ($mod_perm) {
         $cont_h[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />';
         $type_h[] = 'image';
         $cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />';
         $type_h[] = 'image';
     }
     //$tb->setTableStyle('');
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     $html = '<div class="floating_box">';
     if (mysql_num_rows($re_file)) {
         while (list($idFile, $title, $file) = sql_fetch_row($re_file)) {
             $cont = array('<a href="index.php?modname=course&amp;op=downloadcourse&amp;id=' . $idFile . '">' . '<img src="' . getPathImage('fw') . mimeDetect($file) . '" alt="mime-type" />&nbsp;' . $title . '</a>');
             if ($mod_perm) {
                 $cont[] = '<a href="index.php?modname=course&amp;op=modfiles&amp;id_file=' . $idFile . '" title="' . $lang->def('_MOD') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $title . '" /></a>';
                 $cont[] = '<a href="index.php?modname=course&amp;op=remfiles&amp;id_file=' . $idFile . '" title="' . $lang->def('_DEL') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $title . '" /></a>';
             }
             $tb->addBody($cont);
         }
         $html .= $tb->getTable();
         require_once _base_ . '/lib/lib.dialog.php';
         setupHrefDialogBox('a[href*=remfiles]');
     }
     if ($mod_perm) {
         $html .= '<br/>' . '<a class="ico-wt-sprite subs_add" href="index.php?modname=course&amp;op=addfiles">' . '<span>' . $lang->def('_ADDFILE') . '</span></a>';
     }
     $html .= '</div>';
     return $html;
 }
Example #10
0
 function modlinkgui($object_link)
 {
     checkPerm('view', false, 'storage');
     $lang =& DoceboLanguage::createInstance('link');
     require_once _base_ . '/lib/lib.table.php';
     $del_perm = checkPerm('view', false, 'storage');
     $back_coded = htmlentities(urlencode($object_link->back_url));
     $textQuery = "\r\n\tSELECT idLink, title, link_address, sequence \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_link \r\n\tWHERE idCategory = '" . $object_link->getId() . "' \r\n\tORDER BY sequence";
     $result = sql_query($textQuery);
     $num_link = mysql_num_rows($result);
     list($title_cat) = sql_fetch_row(sql_query("\r\n\tSELECT title\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_link_cat \r\n\tWHERE idCategory = '" . $object_link->getId() . "'"));
     $GLOBALS['page']->add(getTitleArea($lang->def('_SECT_LINK'), 'link') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&amp;', $object_link->back_url) . '&amp;mod_result=0', $lang->def('_BACK')) . '<b>' . $lang->def('_TITLE') . ' : ' . $title_cat . '</b><br /><br />' . '<div class="mod_container">' . '<a href="index.php?modname=link&amp;op=modlinkcat&amp;idCategory=' . $object_link->getId() . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_MOD_TITLE') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" /> ' . $lang->def('_MOD_TITLE') . '</a>' . '</div><br />', 'content');
     $tableCat = new Table(0, '', $lang->def('_SUMMARY_LINK'));
     $contentH = array($lang->def('_QUESTION'), $lang->def('_URL'), '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . '" title="' . $lang->def('_MOVE_DOWN') . '" />', '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . '" title="' . $lang->def('_MOVE_UP') . '" />', '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" title="' . $lang->def('_DEL') . '" />');
     $typeH = array('', 'image', 'image', 'image', 'image', 'image');
     $tableCat->setColsStyle($typeH);
     $tableCat->addHead($contentH);
     $i = 1;
     while (list($idLink, $title, $link_address, $seq) = sql_fetch_row($result)) {
         $rowContent = array($seq . ') ' . $title, $link_address);
         if ($i != $num_link) {
             $rowContent[] = '<a href="index.php?modname=link&amp;op=movedown&amp;idLink=' . $idLink . '&amp;back_url=' . $back_coded . '">' . '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . '" title="' . $lang->def('_MOVE_DOWN') . '" /></a>';
         } else {
             $rowContent[] = '&nbsp;';
         }
         if ($i != 1) {
             $rowContent[] = '<a href="index.php?modname=link&amp;op=moveup&amp;idLink=' . $idLink . '&amp;back_url=' . $back_coded . '">' . '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . '" title="' . $lang->def('_MOVE_UP') . '" /></a>';
         } else {
             $rowContent[] = '&nbsp;';
         }
         $rowContent[] = '<a href="index.php?modname=link&amp;op=modlink&amp;idLink=' . $idLink . '&amp;back_url=' . $back_coded . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '" /></a>';
         $rowContent[] = '<a href="index.php?modname=link&amp;op=dellink&amp;idLink=' . $idLink . '&amp;back_url=' . $back_coded . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" title="' . $lang->def('_DEL') . '" /></a>';
         $tableCat->addBody($rowContent);
         ++$i;
     }
     $tableCat->addActionAdd('<a href="index.php?modname=link&amp;op=newlink&amp;idCategory=' . $object_link->getId() . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_ADDLINKT') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" /> ' . $lang->def('_ADDLINK') . '</a>');
     $GLOBALS['page']->add($tableCat->getTable() . '<span class="text_bold text_little">[ ' . '<a href="index.php?modname=link&amp;op=fixsequence&amp;idCategory=' . $object_link->getId() . '&amp;back_url=' . $back_coded . '">' . $lang->def('_FIX_SEQUENCE') . '</a>' . ' ]</span>' . '</div>', 'content');
 }
Example #11
0
function mycertificate(&$url)
{
    checkPerm('view');
    require_once _lms_ . '/lib/lib.course.php';
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('profile', 'framework');
    $lang =& DoceboLanguage::createInstance('course', 'lms');
    $lang =& DoceboLanguage::createInstance('certificate', 'lms');
    $admin_level = Docebo::user()->getUserLevelId();
    $show_preview = true;
    //($admin_level == ADMIN_GROUP_ADMIN || $admin_level == ADMIN_GROUP_GODADMIN);
    $title = $lang->def('_MY_CERTIFICATE', 'certificate');
    $html = getTitleArea($title, 'mycertificate') . '<div class="std_block">';
    //--- draw time periods dropdown ---------------------------------------------
    $period_start = '';
    $period_end = '';
    //extract checking period
    $p_model = new TimeperiodsAlms();
    $year = date("Y");
    $p_list = array("0" => $lang->def('_ALL'));
    $p_selected = Get::req('selected_period', DOTY_INT, 0);
    $p_data = $p_model->getTimePeriods('', true);
    if (count($p_data) > 0) {
        foreach ($p_data as $obj) {
            $p_list[$obj->id_period] = Format::date($obj->start_date, 'date') . ' - ' . Format::date($obj->end_date, 'date');
            if ($p_selected == $obj->id_period) {
                $period_start = $obj->start_date;
                $period_end = $obj->end_date;
            }
        }
    }
    if (!array_key_exists($p_selected, $p_list)) {
        $p_selected = 0;
        $period_start = '';
        $period_end = '';
    }
    //date dropdown
    $onchange = ' onchange="javascript:this.form.submit();"';
    $html_filter_cert = '' . Form::openForm('selected_period_form_cert', $url->getUrl()) . Form::openElementSpace() . Form::getDropdown(Lang::t('_TIME_PERIODS', 'menu'), 'selected_period_cert', 'selected_period', $p_list, $p_selected, '', '', $onchange) . Form::closeElementSpace() . Form::getHidden('current_tab_cert', 'current_tab', Get::req('current_tab', DOTY_STRING, 'cert')) . Form::getHidden('is_filtering_cert', 'is_filtering_cert', 1) . Form::closeForm();
    $html_filter_meta = '' . Form::openForm('selected_period_form_meta', $url->getUrl()) . Form::openElementSpace() . Form::getDropdown(Lang::t('_TIME_PERIODS', 'menu'), 'selected_period_meta', 'selected_period', $p_list, $p_selected, '', '', $onchange) . Form::closeElementSpace() . Form::getHidden('current_tab_meta', 'current_tab', Get::req('current_tab', DOTY_STRING, 'meta')) . Form::getHidden('is_filtering_meta', 'is_filtering_meta', 1) . Form::closeForm();
    //----------------------------------------------------------------------------
    $cert = new Certificate();
    /*
     * Print certificates tables, subdivided by year and course type
     */
    $html_cert = '';
    $tb_cert = new Table(0);
    $cont_h = array($lang->def('_YEAR', 'standard'), $lang->def('_COURSE_CODE', 'course'), $lang->def('_COURSE', 'course'), $lang->def('_CERTIFICATE_NAME', 'course'), $lang->def('_DATE_END', 'course'));
    //if ($show_preview) $cont_h[] = '<img src="'.getPathImage('lms').'certificate/preview.gif" alt="'.$lang->def('_PREVIEW').'" />';
    //$cont_h[] = '<img src="'.getPathImage('lms').'certificate/certificate.gif" alt="'.$lang->def('_ALT_TAKE_A_COPY').'" />';
    if ($show_preview) {
        $cont_h[] = '<span class="ico-sprite subs_view"><span>' . $lang->def('_PREVIEW') . '"</span></span>';
    }
    $cont_h[] = '<span class="ico-sprite subs_pdf"><span>' . $lang->def('_ALT_TAKE_A_COPY') . '</span></span>';
    $type_h = array('img-cell', '', '', 'align-center', 'align-center', 'img-cell', 'img-cell');
    if ($show_preview) {
        $type_h[] = 'nowarp';
    }
    $type_h[] = 'nowarp';
    $tb_cert->setColsStyle($type_h);
    $tb_cert->addHead($cont_h);
    $available_cert = $cert->certificateForCourses(false, false);
    $released = $cert->certificateReleased(Docebo::user()->getIdST());
    $query_courses = "" . " SELECT c.idCourse, c.code, c.name, u.status AS user_status, c.course_type, c.permCloseLO " . " FROM %lms_course AS c JOIN %lms_courseuser AS u ON (c.idCourse = u.idCourse) " . " WHERE u.idUser = '******' " . ($period_start != '' ? " AND u.date_complete >= '" . $period_start . "' " : "") . ($period_end != '' ? " AND u.date_complete <= '" . $period_end . "' " : "") . " ORDER BY u.date_complete DESC, u.status DESC ";
    $course_list = sql_query($query_courses);
    $arr_courses = array();
    $arr_courses_ids = array();
    while ($obj = sql_fetch_object($course_list)) {
        $arr_courses[$obj->course_type][] = array($obj->idCourse, $obj->code, $obj->name, $obj->user_status, $obj->permCloseLO);
        $arr_courses_ids[] = $obj->idCourse;
    }
    $arr_course_types = getCourseTypes();
    $table_displayed = false;
    //extract certificates details and availability by courses ids
    $arr_courses_ids = array_unique($arr_courses_ids);
    $arr_certificates_availability = array();
    $arr_certificates_details = array();
    if (count($arr_courses_ids) > 0) {
        $query = "SELECT id_certificate, id_course, available_for_status " . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_course" . " WHERE id_course IN (" . implode(",", $arr_courses_ids) . ")";
        //." WHERE id_certificate = '".$id_cert."'"
        //." AND id_course IN (".implode(",", $arr_courses_ids).")";
        $res = sql_query($query);
        while (list($id_certificate, $id_course, $available_for_status) = sql_fetch_row($res)) {
            $arr_certificates_availability[$id_course][$id_certificate] = $available_for_status;
        }
        $cont = array();
        $query = "SELECT idCourse, date_inscr, date_first_access, date_complete, status" . " FROM %lms_courseuser WHERE idUser = '******'" . " AND idCourse IN (" . implode(",", $arr_courses_ids) . ") " . ($period_start != '' ? " AND date_complete >= '" . $period_start . "' " : "") . ($period_end != '' ? " AND date_complete <= '" . $period_end . "' " : "");
        $res = sql_query($query);
        while (list($id_course, $date_inscr, $date_begin, $date_end, $status) = sql_fetch_row($res)) {
            $arr_certificate_details[$id_course] = array($date_inscr, $date_begin, $date_end, $status);
        }
    }
    //order arr_courses by key
    ksort($arr_courses);
    $years = array();
    foreach ($arr_courses as $course_type => $course_data) {
        if (in_array($course_type, array_keys($arr_course_types))) {
            //$html .= '';
            $tb = new Table(0);
            $tb->setColsStyle($type_h);
            $tb->addHead($cont_h);
            //filter and organize data to display
            $display_data = array();
            foreach ($course_data as $k => $value) {
                list($id_course, $code, $name, $user_status, $perm_close_lo) = $value;
                if (isset($available_cert[$id_course])) {
                    $can_rel_exceptional = false;
                    while (list($id_cert, $certificate) = each($available_cert[$id_course])) {
                        if ($cert->certificateAvailableForUser($id_cert, $id_course, getLogUserId())) {
                            if ($certificate[CERT_AV_POINT_REQUIRED] > 0) {
                                $course_score_final = false;
                                if ($perm_close_lo == 0) {
                                    require_once $GLOBALS['where_lms'] . '/lib/lib.orgchart.php';
                                    $org_man = new OrganizationManagement(false);
                                    $score_final = $org_man->getFinalObjectScore(array(getLogUserId()), array($id_course));
                                    if (isset($score_final[$id_course][getLogUserId()]) && $score_final[$id_course][getLogUserId()]['max_score']) {
                                        $course_score_final = $score_final[$id_course][getLogUserId()]['score'];
                                        $course_score_final_max = $score_final[$id_course][getLogUserId()]['max_score'];
                                    }
                                } else {
                                    require_once $GLOBALS['where_lms'] . '/lib/lib.coursereport.php';
                                    $rep_man = new CourseReportManager();
                                    $score_course = $rep_man->getUserFinalScore(array(getLogUserId()), array($id_course));
                                    if (!empty($score_course)) {
                                        $course_score_final = isset($score_course[getLogUserId()][$id_course]) ? $score_course[getLogUserId()][$id_course]['score'] : false;
                                        $course_score_final_max = isset($score_course[getLogUserId()][$id_course]) ? $score_course[getLogUserId()][$id_course]['max_score'] : false;
                                    }
                                }
                                if ($course_score_final >= $certificate[CERT_AV_POINT_REQUIRED]) {
                                    $can_rel_exceptional = true;
                                }
                            }
                        }
                    }
                    reset($available_cert[$id_course]);
                    //count years for rowspans
                    while (list($id_cert, $certificate) = each($available_cert[$id_course])) {
                        //(aggiunto if prima dell'or)
                        if ($cert->certificateAvailableForUser($id_cert, $id_course, getLogUserId())) {
                            //$value[4] = $id_cert;
                            list($available_for_status) = $arr_certificates_availability[$id_course][$id_cert];
                            list($date_inscr, $date_begin, $date_end, $status) = $arr_certificate_details[$id_course];
                            if ($available_for_status == 3 && $status == 2 || $available_for_status == 2 && $status == 1 || $available_for_status == 1) {
                                //$year = substr($date_end, 0, 4);
                                switch ($available_for_status) {
                                    case 3:
                                        $cur_year = substr($date_end, 0, 4);
                                        break;
                                    case 2:
                                        $cur_year = substr($date_begin, 0, 4);
                                        break;
                                    case 1:
                                        $cur_year = substr($date_inscr, 0, 4);
                                        break;
                                    default:
                                        $cur_year = '-';
                                }
                                // (mi ricreo l'array value perchรจ manca di date_* BUG FIX)
                                $value = array($id_course, $code, $name, $date_begin, $date_end, $user_status, $perm_close_lo);
                                $value[6] = $id_cert;
                                $query = "SELECT name " . " FROM " . $GLOBALS['prefix_lms'] . "_certificate" . " WHERE id_certificate = " . $id_cert;
                                $res = sql_query($query);
                                list($cname) = sql_fetch_row($res);
                                $value[7] = $cname;
                                if ($can_rel_exceptional && $certificate[CERT_AV_POINT_REQUIRED] > 0) {
                                    if (isset($years[$course_type][$cur_year])) {
                                        $years[$course_type][$cur_year]++;
                                    } else {
                                        $years[$course_type][$cur_year] = 1;
                                    }
                                    $display_data[$cur_year][] = $value;
                                } elseif (!$can_rel_exceptional && $certificate[CERT_AV_POINT_REQUIRED] == 0) {
                                    if (isset($years[$course_type][$cur_year])) {
                                        $years[$course_type][$cur_year]++;
                                    } else {
                                        $years[$course_type][$cur_year] = 1;
                                    }
                                    $display_data[$cur_year][] = $value;
                                }
                            }
                        }
                    }
                }
            }
            if (count($display_data) > 0) {
                krsort($display_data);
            }
            $av_cert = 0;
            $prev_year = false;
            $rowspan_counter = 0;
            require_once $GLOBALS['where_lms'] . '/lib/lib.orgchart.php';
            $org_man = new OrganizationManagement(false);
            foreach ($display_data as $year => $rows) {
                $first = true;
                foreach ($rows as $row) {
                    // list($id_course, $code, $name, $user_status, $id_cert) = $row;
                    list($id_course, $code, $name, $date_begin, $date_end, $user_status, $id_cert, $cname) = $row;
                    $cont = array();
                    if ($first) {
                        $cont[] = array('rowspan' => isset($years[$course_type][$year]) ? $years[$course_type][$year] : 1, 'value' => $year, 'style' => $type_h[0] . ' mycertificate_rowspan' . ($rowspan_counter % 2 > 0 ? '_odd' : ''));
                        $rowspan_counter++;
                        $first = false;
                    }
                    // 2 - the code of the course
                    $cont[] = array('value' => $code, 'style' => $type_h[1]);
                    // 3 - the name of the course
                    $cont[] = array('value' => $name, 'style' => $type_h[2]);
                    // sostituito date_begin con certificate name
                    // 4 - starting date
                    //					$cont[] = array(
                    //						'value' => Format::date($date_begin, 'datetime'),
                    //						'style' => $type_h[3]
                    //					);
                    $cont[] = array('value' => $cname, 'style' => $type_h[3]);
                    // 5 - complete date
                    $cont[] = array('value' => Format::date($date_end, 'datetime'), 'style' => $type_h[4]);
                    //-- scores --
                    $score_start = $org_man->getStartObjectScore(array(Docebo::user()->getIdST()), array($id_course));
                    $score_final = $org_man->getFinalObjectScore(array(Docebo::user()->getIdST()), array($id_course));
                    $_value1 = isset($score_start[$id_course][Docebo::user()->getIdST()]) && $score_start[$id_course][Docebo::user()->getIdST()]['max_score'] ? $score_start[$id_course][Docebo::user()->getIdST()]['score'] . ' / ' . $score_start[$id_course][Docebo::user()->getIdST()]['max_score'] : '';
                    $_value2 = isset($score_final[$id_course][Docebo::user()->getIdST()]) && $score_final[$id_course][Docebo::user()->getIdST()]['max_score'] ? $score_final[$id_course][Docebo::user()->getIdST()]['score'] . ' / ' . $score_final[$id_course][Docebo::user()->getIdST()]['max_score'] : '';
                    /* hide course scores - remove comment to show
                    					// 6 - init score
                    					$cont[] = array(
                    						'value' => $_value1,
                    						'style' => $type_h[5]
                    					);
                    
                    					// 7 - end score
                    					$cont[] = array(
                    						'value' => $_value2,
                    						'style' => $type_h[6]
                    					);
                    					*/
                    if (isset($released[$id_course][$id_cert])) {
                        $av_cert++;
                        if ($show_preview) {
                            $cont[] = array('value' => '', 'style' => $type_h[7]);
                        }
                        $_value = '<a class="ico-wt-sprite subs_pdf" href="' . $url->getUrl('op=release_cert&id_certificate=' . $id_cert . '&id_course=' . $id_course) . '" ' . ' title="' . $lang->def('_TAKE_A_COPY') . '"><span>' . $lang->def('_TAKE_A_COPY') . '</span></a>';
                        $cont[] = array('value' => $_value, 'style' => $type_h[$show_preview ? 8 : 7]);
                    } else {
                        $av_cert++;
                        if ($show_preview) {
                            $_value = '<a class="ico-wt-sprite subs_view" href="' . $url->getUrl('op=preview_cert&id_certificate=' . $id_cert . '&id_course=' . $id_course) . '" ' . ' title="' . $lang->def('_PREVIEW') . '"><span>' . $lang->def('_PREVIEW') . '</span></a>';
                            $cont[] = array('value' => $_value, 'style' => $type_h[7]);
                        }
                        $_value = '<a class="ico-wt-sprite subs_pdf" href="' . $url->getUrl('op=release_cert&id_certificate=' . $id_cert . '&id_course=' . $id_course) . '" ' . ' title="' . $lang->def('_NEW_CERTIFICATE') . '"><span>' . $lang->def('_NEW_CERTIFICATE') . '</span></a>';
                        $cont[] = array('value' => $_value, 'style' => $type_h[$show_preview ? 8 : 7]);
                    }
                    $tb->addBody($cont);
                }
            }
            if ($av_cert > 0) {
                $table_displayed = true;
                $html_cert .= '<h2 class="mycertificate_title">' . $arr_course_types[$course_type] . '</h2>';
                $html_cert .= $tb->getTable();
            }
        }
    }
    //end course_type foreach
    if (!$table_displayed) {
        $is_filtering = Get::req('is_filtering_cert', DOTY_INT, 0);
        $html_cert .= '<p>' . ($is_filtering ? $html_filter_cert : '') . $lang->def('_NO_CONTENT') . '</p>';
    } else {
        $html_cert = $html_filter_cert . $html_cert;
    }
    //-------------------------------------------------------------------------------------------
    /*
     * Print meta-certificates table
     */
    $html_meta = '';
    $tb_meta_cert = new Table(0);
    $cont_h = array();
    $cont_h[] = $lang->def('_CODE');
    $cont_h[] = $lang->def('_NAME');
    $cont_h[] = $lang->def('_COURSE_LIST');
    //if ($show_preview) $cont_h[] = '<img src="'.getPathImage('lms').'certificate/preview.gif" alt="'.$lang->def('_PREVIEW').'" />';
    //$cont_h[] = '<img src="'.getPathImage('lms').'certificate/certificate.gif" alt="'.$lang->def('_ALT_TAKE_A_COPY').'" />';
    if ($show_preview) {
        $cont_h[] = '<span class="ico-sprite subs_view"><span>' . $lang->def('_PREVIEW') . '"</span></span>';
    }
    $cont_h[] = '<span class="ico-sprite subs_pdf"><span>' . $lang->def('_ALT_TAKE_A_COPY') . '</span></span>';
    $type_h = array();
    $type_h[] = '';
    $type_h[] = '';
    $type_h[] = '';
    if ($show_preview) {
        $type_h[] = 'img-cell';
    }
    //'nowrap';
    $type_h[] = 'img-cell';
    //'nowrap';
    $tb_meta_cert->setColsStyle($type_h);
    $tb_meta_cert->addHead($cont_h);
    $query = "SELECT c.idMetaCertificate, m.title, m.description, m.idCertificate" . " FROM %lms_certificate_meta_course as c" . " JOIN %lms_certificate_meta as m ON c.idMetaCertificate = m.idMetaCertificate" . " WHERE c.idUser = '******'" . " GROUP BY c.idMetaCertificate" . " ORDER BY m.title, m.description";
    $result = sql_query($query);
    $av_meta_cert = sql_num_rows($result);
    $cert_meta_html = '';
    while (list($id_meta, $name, $description, $id_certificate) = sql_fetch_row($result)) {
        $cont = array();
        $query = "SELECT code, name" . " FROM %lms_certificate" . " WHERE id_certificate = " . " (" . " SELECT idCertificate" . " FROM %lms_certificate_meta" . " WHERE idMetaCertificate = '" . $id_meta . "'" . " )";
        list($code, $name) = sql_fetch_row(sql_query($query));
        $cont[] = $code;
        $cont[] = $name;
        $query_released = "SELECT on_date" . " FROM %lms_certificate_meta_assign" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $id_meta . "'";
        $result_released = sql_query($query_released);
        $query = "SELECT user_release" . " FROM %lms_certificate" . " WHERE id_certificate = '" . $id_certificate . "'";
        list($user_release) = sql_fetch_row(sql_query($query));
        if (sql_num_rows($result_released)) {
            $course_list = '';
            $first = true;
            $query_course = "SELECT code, name" . " FROM %lms_course" . " WHERE idCourse IN " . "(" . "SELECT idCourse" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $id_meta . "'" . ")";
            $result_course = sql_query($query_course);
            while (list($code, $name) = sql_fetch_row($result_course)) {
                if ($first) {
                    $first = false;
                } else {
                    $course_list .= '<br/>';
                }
                $course_list .= '(' . $code . ') - ' . $name;
            }
            $cont[] = $course_list;
            if ($show_preview) {
                $cont[] = '';
            }
            list($date) = sql_fetch_row($result_released);
            $cont[] = '<a class="ico-wt-sprite subs_pdf" href="' . $url->getUrl('op=release_cert&id_certificate=' . $id_certificate . '&idmeta=' . $id_meta) . '" ' . ' title="' . $lang->def('_TAKE_A_COPY') . '"><span>' . $lang->def('_TAKE_A_COPY') . '</span></a>';
            $tb_meta_cert->addBody($cont);
        } elseif ($user_release == 0) {
            $av_meta_cert--;
        } else {
            $query = "SELECT idCourse" . " FROM %lms_certificate_meta_course" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $id_meta . "'";
            $result_int = sql_query($query);
            $control = true;
            while (list($id_course) = sql_fetch_row($result_int)) {
                $query = "SELECT COUNT(*)" . " FROM %lms_courseuser" . " WHERE idCourse = '" . $id_course . "'" . " AND idUser = '******'" . " AND status = '" . _CUS_END . "'";
                list($number) = sql_fetch_row(sql_query($query));
                if (!$number) {
                    $control = false;
                }
            }
            if ($control) {
                $course_list = '';
                $first = true;
                $query_course = "SELECT code, name" . " FROM %lms_course" . " WHERE idCourse IN " . "(" . "SELECT idCourse" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $id_meta . "'" . ")";
                $result_course = sql_query($query_course);
                while (list($code, $name) = sql_fetch_row($result_course)) {
                    if ($first) {
                        $first = false;
                    } else {
                        $course_list .= '<br/>';
                    }
                    $course_list .= '(' . $code . ') - ' . $name;
                }
                $cont[] = $course_list;
                if ($show_preview) {
                    $cont[] = '<a class="ico-wt-sprite subs_view" href="' . $url->getUrl('op=preview_cert&id_certificate=' . $id_certificate . '&idmeta=' . $id_meta) . '" ' . ' title="' . $lang->def('_PREVIEW') . '"><span>' . $lang->def('_PREVIEW') . '</span></a>';
                }
                $cont[] = '<a class="ico-wt-sprite subs_pdf" href="' . $url->getUrl('op=release_cert&id_certificate=' . $id_certificate . '&idmeta=' . $id_meta) . '" ' . ' title="' . $lang->def('_NEW_CERTIFICATE') . '"><span>' . $lang->def('_NEW_CERTIFICATE') . '</span></a>';
                $tb_meta_cert->addBody($cont);
            } else {
                $av_meta_cert--;
            }
        }
    }
    if ($av_meta_cert) {
        $html_meta .= $tb_meta_cert->getTable() . '<br/><br/>';
    } else {
        //$is_filtering = Get::req('is_filtering_meta', DOTY_INT, 0);
        //$html_meta .= '<p>'.($is_filtering>0 ? $html_filter_meta : '').$lang->def('_NO_CONTENT').'</p>';
        $html_meta .= '<p>' . $lang->def('_NO_CONTENT') . '</p>';
    }
    //-----------------------------------------------------------------------------
    $selected_tab = Get::req('current_tab', DOTY_STRING, 'cert');
    $html .= '<div id="mycertificate_tabs" class="yui-navset">
			<ul class="yui-nav">
					<li' . ($selected_tab == 'cert' ? ' class="selected"' : '') . '><a href="#cert"><em>' . Lang::t('_CERTIFICATE', 'menu') . '</em></a></li>
					<li' . ($selected_tab == 'meta' ? ' class="selected"' : '') . '><a href="#meta"><em>' . Lang::t('_TITLE_META_CERTIFICATE', 'certificate') . '</em></a></li>
			</ul>
			<div class="yui-content">
					<div>' . $html_cert . '</div>
					<div>' . $html_meta . '</div>
			</div>
		</div>';
    $html .= '</div>';
    //close std_block div
    cout($html, 'content');
    YuiLib::load('tabs');
    cout('<script type="text/javascript">var myTabs = new YAHOO.widget.TabView("mycertificate_tabs");</script>', 'scripts');
}
Example #12
0
 function loadCatalogueSelector($noprint = false)
 {
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('catalogue', 'lms');
     // Filter
     $this->filter['catalogue_name'] = isset($_POST['cat_filter_name']) ? $_POST['cat_filter_name'] : '';
     if ($this->show_filter === true) {
         $form = new Form();
         /*$GLOBALS['page']->add(
         			$form->getOpenFieldset($lang->def('_SEARCH'))
         			.Form::getTextfield($lang->def('_NAME'), 'cat_filter_name', 'cat_filter_name', '255',
         				( isset($_POST['cat_filter_name']) ? $_POST['cat_filter_name'] : '' ))
         			.$form->openButtonSpace()
         			.$form->getButton('catalogue_filter', 'catalogue_filter', $lang->def('_SEARCH'))
         			.$form->closeButtonSpace()
         			.$form->getCloseFieldset()
         		, 'content');
         		*/
         cout('<div class="quick_search_form">' . '<div>' . Form::getInputTextfield("search_t", "cat_filter_name", "cat_filter_name", Get::req('cat_filter_name', DOTY_MIXED, ''), '', 255, '') . Form::getButton("catalogue_filter", "catalogue_filter", Lang::t('_SEARCH', 'standard'), "search_b") . '</div>' . '</div>', 'content');
     }
     // End Filter
     $tb = new Table(Get::sett('visuItem'), $lang->def('_CATALOGUE'), $lang->def('_CATALOGUE_SUMMARY'));
     $tb->initNavBar('ini_cat', 'button');
     $ini = $tb->getSelectedElement();
     $select = "\r\n\t\tSELECT c.idCatalogue, c.name, c.description";
     $query_catalogue = "\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_catalogue AS c\r\n\t\tWHERE 1";
     // Retriving data
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         $all_courses = false;
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST());
         if (isset($admin_courses['course'][0])) {
             $all_courses = true;
         }
         if (isset($admin_courses['course'][-1])) {
             require_once _lms_ . '/lib/lib.catalogue.php';
             $cat_man = new Catalogue_Manager();
             $admin_courses['catalogue'] = $cat_man->getUserAllCatalogueId(Docebo::user()->getIdSt());
             if (count($admin_courses['catalogue']) == 0 && Get::sett('on_catalogue_empty', 'off') == 'on') {
                 $all_courses = true;
             }
         }
         if (!$all_courses) {
             if (empty($admin_courses['catalogue'])) {
                 $query_catalogue .= " AND 0 ";
             } else {
                 $query_catalogue .= " AND c.idCatalogue IN (0," . implode(',', $admin_courses['catalogue']) . ") ";
             }
         }
     }
     if ($this->filter['catalogue_name'] != '') {
         $query_catalogue .= " AND c.name LIKE '%" . $this->filter['catalogue_name'] . "%'";
     }
     list($tot_catalogue) = sql_fetch_row(sql_query("SELECT COUNT(*) " . $query_catalogue));
     $query_catalogue .= " ORDER BY c.name\r\n\t\t\t\t\t\t\tLIMIT " . $ini . "," . (int) Get::sett('visuItem');
     $re_catalogue = sql_query($select . $query_catalogue);
     $type_h = array('image', '', '', '');
     $cont_h = array('<span class="access-only">' . $lang->def('_CATALOGUE_SELECTION') . '</span>', $lang->def('_NAME'), $lang->def('_DESCRIPTION'));
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     while (list($id_catalogue, $name, $descr) = sql_fetch_row($re_catalogue)) {
         $tb_content = array(Form::getInputCheckbox('new_catalogue_selected_' . $id_catalogue, 'new_catalogue_selected[' . $id_catalogue . ']', $id_catalogue, isset($this->current_selection[$id_catalogue]), ''), '<label for="new_catalogue_selected_' . $id_catalogue . '">' . $name . '</label>', '<label for="new_catalogue_selected_' . $id_catalogue . '">' . $descr . '</label>');
         $tb->addBody($tb_content);
         if (isset($this->current_selection[$id_catalogue])) {
             unset($this->current_selection[$id_catalogue]);
         }
     }
     $output = $tb->getTable() . $tb->getNavBar($ini, $tot_catalogue) . $this->stateSelection();
     if ($noprint) {
         return $output;
     } else {
         cout($output, 'content');
     }
 }
Example #13
0
<?php

Get::title(array('index.php?r=alms/enrollrules/show' => Lang::t('_ENROLLRULES', 'enrollrules'), 'index.php?r=alms/enrollrules/showlog' => Lang::t('_SHOW_LOGS', 'enrollrules'), Lang::t('_DETAILS', 'enrollrules')));
?>
<div class="std_block">
<?php 
$tb = new Table();
$tb->addHead(array(Lang::t('_USERNAME', 'enrollrules'), Lang::t('_LASTNAME', 'enrollrules'), Lang::t('_FIRSTNAME', 'enrollrules'), Lang::t('_CODE', 'enrollrules'), Lang::t('_COURSE_NAME', 'enrollrules')), array('min-cell', '', '', 'min-cell', ''));
while (list(, $obj) = each($data)) {
    $row = array(Docebo::aclm()->relativeId($obj->userid), $obj->lastname, $obj->firstname, $obj->code, $obj->name);
    $tb->addBody($row);
}
echo $tb->getTable();
?>
</div>
Example #14
0
 function loadCoursepathSelector($noprint = false)
 {
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('coursepath', 'lms');
     $output = '';
     // Filter
     $this->filter['coursepath_name'] = isset($_POST['coursepath_filter_name']) ? $_POST['coursepath_filter_name'] : '';
     if ($this->show_filter === true) {
         /*
         			$form = new Form();
         			$output .= $form->getOpenFieldset($lang->def('_COURSEPATH_FILTER'))
         				.Form::getTextfield($lang->def('_NAME'), 'coursepath_filter_name', 'coursepath_filter_name', '255',
         					( isset($_POST['coursepath_filter_name']) ? $_POST['coursepath_filter_name'] : '' ))
         				.$form->openButtonSpace()
         				.$form->getButton('coursepath_filter', 'coursepath_filter', $lang->def('_SEARCH'))
         				.$form->closeButtonSpace()
         				.$form->getCloseFieldset();*/
         $output .= '<div class="quick_search_form">' . '<div>' . Form::getInputTextfield("search_t", "coursepath_filter_name", "coursepath_filter_name", Get::req('coursepath_filter_name', DOTY_MIXED, ''), '', 255, '') . Form::getButton("coursepath_filter", "coursepath_filter", Lang::t('_SEARCH', 'standard'), "search_b") . '</div>' . '</div>';
     }
     // End Filter
     $tb = new Table(Get::sett('visuItem'), $lang->def('_COURSE_PATH_CAPTION'), $lang->def('_COURSE_PATH_SUMMARY'));
     $tb->initNavBar('ini_cpath', 'button');
     $ini = $tb->getSelectedElement();
     $select = "\r\n\t\tSELECT id_path, path_name, path_descr ";
     $query_coursepath = "\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_coursepath\r\n\t\tWHERE 1 ";
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         $all_courses = false;
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST());
         if (isset($admin_courses['course'][0])) {
             $all_courses = true;
         }
         if (isset($admin_courses['course'][-1])) {
             $query = "SELECT id_path" . " FROM %lms_coursepath_user" . " WHERE idUser = '******'";
             $result = sql_query($query);
             $admin_courses['coursepath'] = array();
             while (list($id_path) = sql_fetch_row($result)) {
                 $admin_courses['coursepath'][$id_path] = $id_path;
             }
             if (!empty($admin_courses['coursepath']) && Get::sett('on_catalogue_empty', 'off') == 'on') {
                 $all_courses = true;
             }
         }
         if (!$all_courses) {
             if (empty($admin_courses['coursepath'])) {
                 $query_coursepath .= " AND 0 ";
             } else {
                 $query_coursepath .= " AND id_path IN (" . implode(',', $admin_courses['coursepath']) . ") ";
             }
         }
     }
     if ($this->filter['coursepath_name'] != '') {
         $query_coursepath .= " AND path_name LIKE '%" . $this->filter['coursepath_name'] . "%'";
     }
     list($tot_coursepath) = sql_fetch_row(sql_query("SELECT COUNT(*) " . $query_coursepath));
     $query_coursepath .= "\r\n\t\tORDER BY path_name\r\n\t\tLIMIT " . $ini . "," . (int) Get::sett('visuItem');
     $re_coursepath = sql_query($select . $query_coursepath);
     $type_h = array('image', '', '', '');
     $cont_h = array('<span class="access-only">' . $lang->def('_SELECT') . '</span>', $lang->def('_NAME'), $lang->def('_DESCRIPTION'));
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     while (list($id_path, $name, $descr) = sql_fetch_row($re_coursepath)) {
         $tb_content = array(Form::getInputCheckbox('new_coursepath_selected_' . $id_path, 'new_coursepath_selected[' . $id_path . ']', $id_path, isset($this->current_selection[$id_path]), ''), '<label for="new_coursepath_selected_' . $id_path . '">' . $name . '</label>', '<label for="new_coursepath_selected_' . $id_path . '">' . $descr . '</label>');
         $tb->addBody($tb_content);
         if (isset($this->current_selection[$id_path])) {
             unset($this->current_selection[$id_path]);
         }
     }
     $output .= $tb->getTable() . $tb->getNavBar($ini, $tot_coursepath) . $this->stateSelection();
     if ($noprint) {
         return $output;
     } else {
         cout($output, 'content');
     }
 }
    $cinfo_content_4 = $cinfo->role_expiration > 0 ? $cinfo->role_expiration . ' ' . Lang::t('_DAYS', 'standard') : Lang::t('_NEVER', 'standard');
    $num_courses = count($courses);
    if ($num_courses > 0) {
        $first = true;
        foreach ($courses as $course) {
            $line = array();
            if ($first) {
                $line[] = array('rowspan' => count($courses), 'value' => $cinfo_content_1, 'style' => 'yui-dt-rs-' . ($rs_counter % 2 > 0 ? 'odd' : 'even'));
                $line[] = array('rowspan' => count($courses), 'value' => $cinfo_content_2, 'style' => 'img-cell yui-dt-rs-' . ($rs_counter % 2 > 0 ? 'odd' : 'even'));
                $line[] = array('rowspan' => count($courses), 'value' => $cinfo_content_3, 'style' => 'img-cell yui-dt-rs-' . ($rs_counter % 2 > 0 ? 'odd' : 'even'));
                $line[] = array('rowspan' => count($courses), 'value' => $cinfo_content_4, 'style' => 'img-cell yui-dt-rs-' . ($rs_counter % 2 > 0 ? 'odd' : 'even'));
                $rs_counter++;
            }
            $line[] = $course['name'];
            $line[] = array('style' => 'img-cell', 'value' => $cinfo->type == 'score' ? '<b>' . (int) $course['score'] . '</b>' : '-');
            $table->addBody($line, $first ? 'borded-top' : false);
            $first = false;
        }
    } else {
        $line = array();
        $line[] = array('rowspan' => 1, 'value' => $cinfo_content_1, 'style' => 'yui-dt-rs-' . ($rs_counter % 2 > 0 ? 'odd' : 'even'));
        $line[] = array('rowspan' => 1, 'value' => $cinfo_content_2, 'style' => 'img-cell yui-dt-rs-' . ($rs_counter % 2 > 0 ? 'odd' : 'even'));
        $line[] = array('rowspan' => 1, 'value' => $cinfo_content_3, 'style' => 'img-cell yui-dt-rs-' . ($rs_counter % 2 > 0 ? 'odd' : 'even'));
        $line[] = array('rowspan' => 1, 'value' => $cinfo_content_4, 'style' => 'img-cell yui-dt-rs-' . ($rs_counter % 2 > 0 ? 'odd' : 'even'));
        $line[] = '<i>(' . Lang::t('_NO_COURSES_FOR_COMPETENCE', 'fncroles') . ')</i>';
        $line[] = array('style' => 'img-cell', 'value' => '<span class="ico-sprite fd_notice"><span></span></span>');
        $table->addBody($line, 'borded-top');
        $rs_counter++;
    }
}
echo '<br />';
Example #16
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 #17
0
function sessiondetails()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    $idst_user = importVar('id', true, 0);
    $id_enter = importVar('id_enter', true, 0);
    $p_ini = importVar('p_ini');
    $link = 'index.php?modname=statistic&amp;op=sessiondetails&amp;id=' . $idst_user . '&amp;id_enter=' . $id_enter;
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0, 'link');
    $nav_bar->setLink($link . '&amp;p_ini=' . $p_ini);
    $ini = $nav_bar->getSelectedElement();
    $lang =& DoceboLanguage::createInstance('statistic', 'lms');
    $acl_man = Docebo::user()->getAclManager();
    $user_info =& $acl_man->getUser($idst_user, false);
    $query_track = "\r\n\tSELECT g.function, g.type, g.timeof, UNIX_TIMESTAMP(g.timeof) AS unix_time \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_trackingeneral AS g\r\n\tWHERE g.idCourse = '" . (int) $_SESSION['idCourse'] . "' AND g.idUser = '******' AND " . " ( g.idEnter = '" . $id_enter . "' OR (  g.idEnter = 0 AND g.session_id = '" . importVar('sid') . "' ) ) " . " ORDER BY g.timeof \r\n\tLIMIT " . $ini . ", " . Get::sett('visuItem');
    $re_tracks = sql_query($query_track);
    $query_tot_track = "\r\n\tSELECT COUNT(*) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_trackingeneral \r\n\tWHERE idCourse = '" . (int) $_SESSION['idCourse'] . "' AND idUser = '******' AND idEnter = '" . $id_enter . "'";
    list($tot_elem) = sql_fetch_row(sql_query($query_tot_track));
    $nav_bar->setElementTotal($tot_elem);
    // Find modulename -> name int his course
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    $course_man = new Man_Course();
    $mods_names =& $course_man->getModulesName($_SESSION['idCourse']);
    $page_title = array('index.php?modname=statistic&amp;op=statistic' => $lang->def('_STATISTICS'), 'index.php?modname=statistic&amp;op=userdetails&amp;id=' . $idst_user . '&amp;p_ini=' . $p_ini => $user_info[ACL_INFO_LASTNAME] . $user_info[ACL_INFO_FIRSTNAME] ? $user_info[ACL_INFO_LASTNAME] . ' ' . $user_info[ACL_INFO_FIRSTNAME] : $acl_man->relativeId($user_info[ACL_INFO_USERID]), $lang->def('_VIEW_SESSION_DETAILS'));
    $GLOBALS['page']->add(getTitleArea($page_title, 'statistic') . '<div class="std_block">' . getBackUi('index.php?modname=statistic&amp;op=userdetails&amp;id=' . $idst_user . '&amp;p_ini=' . $p_ini, $lang->def('_BACK')), 'content');
    $tb = new Table(0, $lang->def('_VIEW_SESSION_DETAILS'), $lang->def('_VIEW_SESSION_DETAILS'));
    $type_h = array('', '', '');
    $cont_h = array($lang->def('_DATE'), $lang->def('_TYPE_OF_OPERATION'), $lang->def('_TIME_IN'));
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    $type_h[2] = 'align_right';
    $tb->setColsStyle($type_h);
    $total_sec = 0;
    $read_previous = false;
    while ($read = mysql_fetch_assoc($re_tracks)) {
        if ($read_previous !== false) {
            $time_in = $read['unix_time'] - $read_previous['unix_time'];
            $hours = (int) ($time_in / 3600);
            $minutes = (int) ($time_in % 3600 / 60);
            $seconds = (int) ($time_in % 60);
            if ($minutes < 10) {
                $minutes = '0' . $minutes;
            }
            if ($seconds < 10) {
                $seconds = '0' . $seconds;
            }
            $readable = $hours . 'h ' . $minutes . 'm ' . $seconds . 's ';
            $cont = array(Format::date($read_previous['timeof'], false, true), '<span class="text_bold">' . (isset($mods_names[$read_previous['function']]) ? $mods_names[$read_previous['function']] : $read_previous['function']) . '</span> [' . $read_previous['type'] . ']', $readable);
            $tb->addBody($cont);
        }
        $read_previous = $read;
    }
    $query_last_track = "\r\n\tSELECT g.function, g.type, g.timeof, UNIX_TIMESTAMP(g.timeof) AS unix_time \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_trackingeneral AS g\r\n\tWHERE g.idCourse = '" . (int) $_SESSION['idCourse'] . "' AND g.idUser = '******' AND g.idEnter = '" . $id_enter . "' \r\n\tLIMIT " . ($ini + Get::sett('visuItem')) . ", 1";
    $re_track = sql_query($query_last_track);
    if (mysql_num_rows($re_track) > 0) {
        $read = mysql_fetch_assoc($re_track);
        $time_in = $read['unix_time'] - $read_previous['unix_time'];
        $hours = (int) ($time_in / 3600);
        $minutes = (int) ($time_in % 3600 / 60);
        $seconds = (int) ($time_in % 60);
        if ($minutes < 10) {
            $minutes = '0' . $minutes;
        }
        if ($seconds < 10) {
            $seconds = '0' . $seconds;
        }
        $readable = $hours . 'h ' . $minutes . 'm ' . $seconds . 's ';
    } else {
        $readable = '';
    }
    $cont = array(Format::date($read_previous['timeof']), '<span class="text_bold">' . (isset($mods_names[$read_previous['function']]) ? $mods_names[$read_previous['function']] : $read_previous['function']) . '</span> [' . $read_previous['type'] . ']', $readable);
    $tb->addBody($cont);
    $GLOBALS['page']->add($tb->getTable() . $nav_bar->getNavBar() . getBackUi('index.php?modname=statistic&amp;op=userdetails&amp;id=' . $idst_user . '&amp;p_ini=' . $p_ini, $lang->def('_BACK')) . '</div>', 'content');
}
Example #18
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 #19
0
/**
 * The UI that list all the task
 * @param Module $module the caller module
 **/
function ioTask_UITaskList(&$module)
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $connMgr =& $module->get_connMgr();
    $lang =& $module->get_lang();
    $out =& $module->get_out();
    $form = new Form();
    $tb_tasks = new Table(Get::sett('visuItem'), $lang->def('_TASKS'), $lang->def('_TASKS'));
    $content_h = array($lang->def('_NAME'), $lang->def('_DESCRIPTION'), $lang->def('_SOURCE'), $lang->def('_DESTINATION'), $lang->def('_SCHEDULE'), $lang->def('_LAST_EXECUTION'), '<img src="' . getPathImage() . '/standard/play.png" alt="' . $lang->def('_TASK_RUN') . '" title="' . $lang->def('_TASK_RUN') . '"/>', '<img src="' . getPathImage() . '/standard/edit.png" alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '"/>', '<img src="' . getPathImage() . '/standard/cancel.png" alt="' . $lang->def('_TASK_DEL') . '" title="' . $lang->def('_DEL') . '"/>');
    $type_h = array('', '', '', '', '', '', 'image', 'image', 'image');
    $tb_tasks->setColsStyle($type_h);
    $tb_tasks->addHead($content_h);
    $conn = $connMgr->get_first_task();
    while ($conn) {
        $cont = array();
        $cont[] = $conn[CONNMGR_TASK_NAME];
        $cont[] = $conn[CONNMGR_TASK_DESCRIPTION];
        $cont[] = $conn[CONNMGR_TASK_SOURCE];
        $cont[] = $conn[CONNMGR_TASK_DESTINATION];
        if ($conn[CONNMGR_TASK_SCHEDTYPE] == 'at') {
            $cont[] = str_replace('%time%', $conn[CONNMGR_TASK_SCHEDULE]['qt'], $lang->def('_SCHEDULE_TYPE_AT_DATA'));
        } else {
            if ($conn[CONNMGR_TASK_SCHEDULE]['um'] == 'hour') {
                $conn[CONNMGR_TASK_SCHEDULE]['um'] = $lang->def('_HOUR');
            } elseif ($conn[CONNMGR_TASK_SCHEDULE]['um'] == 'day') {
                $conn[CONNMGR_TASK_SCHEDULE]['um'] = $lang->def('_DAY');
            }
            $cont[] = str_replace(array('%interval%', '%unit%'), array_values($conn[CONNMGR_TASK_SCHEDULE]), $lang->def('_SCHEDULE_TYPE_INTERVAL_DATA'));
        }
        if ($conn[CONNMGR_TASK_LAST_EXECUTION] !== null) {
            //$last_execution = strtotime($conn[CONNMGR_TASK_LAST_EXECUTION]);
            $cont[] = $conn[CONNMGR_TASK_LAST_EXECUTION];
        } else {
            $cont[] = '';
        }
        $cont[] = '<input type="image" ' . 'id="run_' . $conn[CONNMGR_TASK_NAME] . '" ' . 'name="action[run_task][' . $conn[CONNMGR_TASK_NAME] . ']" ' . 'src="' . getPathImage() . '/standard/play.png"' . 'alt="' . $lang->def('_TASK_RUN') . '"' . 'title="' . $lang->def('_TASK_RUN') . ': ' . $conn[CONNMGR_TASK_NAME] . '" />';
        $cont[] = '<input type="image" ' . 'id="modifiy_' . $conn[CONNMGR_TASK_NAME] . '" ' . 'name="action[edit_task][' . $conn[CONNMGR_TASK_NAME] . ']" ' . 'src="' . getPathImage() . '/standard/edit.png"' . 'alt="' . $lang->def('_MOD') . '"' . 'title="' . $lang->def('_MOD') . ': ' . $conn[CONNMGR_TASK_NAME] . '" />';
        $cont[] = '<input type="image" ' . 'id="delete_' . $conn[CONNMGR_TASK_NAME] . '" ' . 'name="action[delete_task][' . $conn[CONNMGR_TASK_NAME] . ']" ' . 'src="' . getPathImage() . '/standard/cancel.png"' . 'alt="' . $lang->def('_TASK_DEL') . '"' . 'title="' . $lang->def('_TASK_DEL') . ': ' . $conn[CONNMGR_TASK_NAME] . '" />';
        $tb_tasks->addBody($cont);
        $conn = $connMgr->get_next_task();
    }
    $tb_tasks->addActionAdd('<label for="new_task">' . '<img class="valing-middle" src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . ' ' . $lang->def('_ADD_NEW_TASK') . '</label> ' . $form->getButton('new_task', 'action[new_task]', $lang->def('_CREATE'), 'button_nowh'));
    $out->add($tb_tasks->getTable());
}
Example #20
0
function showgrade()
{
    checkPerm('view');
    require_once $GLOBALS['where_lms'] . '/lib/lib.test.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.coursereport.php';
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('gradebook', 'lms');
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $test_man = new GroupTestManagement();
    $report_man = new CourseReportManager();
    // XXX: update if needed
    $org_tests =& $report_man->getTest();
    $tests_info =& $test_man->getTestInfo($org_tests);
    $i_test = array();
    $i_test_report_id = array();
    // XXX: Info for updates
    $query_tot_report = "\r\n\tSELECT COUNT(*)\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_coursereport\r\n\tWHERE id_course = '" . $_SESSION['idCourse'] . "'";
    list($tot_report) = sql_fetch_row(sql_query($query_tot_report));
    $query_tests = "\r\n\tSELECT id_report, id_source\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_coursereport\r\n\tWHERE id_course = '" . $_SESSION['idCourse'] . "' AND source_of = 'test'";
    $re_tests = sql_query($query_tests);
    while (list($id_r, $id_t) = sql_fetch_row($re_tests)) {
        $i_test[$id_t] = $id_t;
        $i_test_report_id[$id_r] = $id_r;
    }
    // XXX: Update if needed
    if ($tot_report == 0) {
        $report_man->initializeCourseReport($org_tests);
    } else {
        if (is_array($i_test)) {
            $test_to_add = array_diff($org_tests, $i_test);
        } else {
            $test_to_add = $org_tests;
        }
        if (is_array($i_test)) {
            $test_to_del = array_diff($i_test, $org_tests);
        } else {
            $test_to_del = $org_tests;
        }
        if (!empty($test_to_add) || !empty($test_to_del)) {
            $report_man->addTestToReport($test_to_add, 1);
            $report_man->delTestToReport($test_to_del);
            $included_test = $org_tests;
        }
    }
    $report_man->updateTestReport($org_tests);
    $reports = array();
    $id_test = array();
    $id_report = array();
    // XXX: retrive all report info
    $query_report = "\r\n\tSELECT id_report, title, max_score, required_score, weight, show_to_user, use_for_final, source_of, id_source\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_coursereport\r\n\tWHERE id_course = '" . $_SESSION['idCourse'] . "' AND show_to_user = '******'\r\n\tORDER BY sequence ";
    $re_report = sql_query($query_report);
    while ($info_report = mysql_fetch_assoc($re_report)) {
        $reports[$info_report['id_report']] = $info_report;
        switch ($info_report['source_of']) {
            case "test":
                $id_test[] = $info_report['id_source'];
                break;
            case "activity":
            case "final_vote":
                $id_report[] = $info_report['id_report'];
                break;
        }
    }
    // XXX: retrive report and test score
    $report_score =& $report_man->getReportsScores($id_report, getLogUserId());
    $tests_score =& $test_man->getTestsScores($id_test, array(getLogUserId()));
    // XXX: create table
    $table = new Table(0, $lang->def('_GRADEBOOK_CAPTION'), $lang->def('_GRADEBOOK_SUMMARY'));
    $type_h = array('', 'align_center', 'align_center', '', '');
    $cont_h = array($lang->def('_TITLE'), $lang->def('_SCORE'), $lang->def('_REQUIRED_SCORE'), $lang->def('_DATE'), $lang->def('_COMMENTS'), $lang->def('_SHOW_RESULTS'));
    $table->setColsStyle($type_h);
    $table->addHead($cont_h);
    $id_user = getLogUserId();
    // XXX: construct table data
    if (!empty($reports)) {
        while (list($id_report, $report_info) = each($reports)) {
            $id_source = $report_info['id_source'];
            $title = strip_tags($report_info['title']);
            $score = '';
            $required = $report_info['required_score'];
            $maxscore = $report_info['max_score'];
            $date = '';
            $comment = '';
            switch ($report_info['source_of']) {
                case "scorm_item":
                    $query_report = "\r\n\t\t\t\t\t\tSELECT *\r\n\t\t\t\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_scorm_tracking\r\n\t\t\t\t\t\tWHERE idscorm_item = '" . $report_info['id_source'] . "' and idUser='******'";
                    $query2 = sql_query($query_report);
                    $query = sql_fetch_assoc($query2);
                    $score = $query['score_raw'];
                    $date = Format::date($query['last_completed'], 'datetime');
                    $comment = "";
                    break;
                case "test":
                    $title = $tests_info[$id_source]['title'];
                    if (isset($tests_score[$id_source][$id_user])) {
                        switch ($tests_score[$id_source][$id_user]['score_status']) {
                            case "not_checked":
                                $score = '<span class="cr_not_check">' . $lang->def('_NOT_CHECKED') . '</span>';
                                break;
                            case "passed":
                                //$score = '<span class="cr_passed">'.$lang->def('_PASSED').'</span>';
                                $score = '<img src="' . getPathImage('fw') . 'emoticons/thumbs_up.gif" alt="' . $lang->def('_PASSED') . '" />&nbsp;' . $tests_score[$id_source][$id_user]['score'];
                                $date = Format::date($tests_score[$id_source][$id_user]['date_attempt']);
                                $comment = $tests_score[$id_source][$id_user]['comment'];
                                break;
                            case "not_passed":
                                //$score = '<span class="cr_not_passed">'.$lang->def('_NOT_PASSED').'</span>';
                                $score = '<img src="' . getPathImage('fw') . 'emoticons/thumbs_down.gif" alt="' . $lang->def('_NOT_PASSED') . '" />&nbsp;' . $tests_score[$id_source][$id_user]['score'];
                                $date = Format::date($tests_score[$id_source][$id_user]['date_attempt']);
                                $comment = $tests_score[$id_source][$id_user]['comment'];
                                break;
                            case "valid":
                                $score = $tests_score[$id_source][$id_user]['score'];
                                if ($score == $report_info['max_score']) {
                                    $score = '<span class="cr_max_score">' . $score . '</span>';
                                } elseif ($score < $report_info['required_score']) {
                                    $score = '<span class="cr_not_passed">' . $score . '</span>';
                                }
                                $date = Format::date($tests_score[$id_source][$id_user]['date_attempt']);
                                $comment = $tests_score[$id_source][$id_user]['comment'];
                                break;
                        }
                    }
                    $link_result = '<a href="index.php?modname=organization&op=test_track&id_user='******'&id_org=' . $id_source . '&back=gradebook">' . '<img src="' . getPathImage() . 'standard/report.png" /></a>';
                    break;
                case "activity":
                    if (isset($report_score[$id_report][$id_user]) && $report_score[$id_report][$id_user]['score_status'] == 'valid') {
                        $score = $report_score[$id_report][$id_user]['score'];
                        if ($score == $report_info['max_score']) {
                            $score = '<span class="cr_max_score">' . $score . '</span>';
                        } elseif ($score < $report_info['required_score']) {
                            $score = '<span class="cr_not_passed">' . $score . '</span>';
                        }
                        $date = Format::date($report_score[$id_report][$id_user]['date_attempt']);
                        $comment = $report_score[$id_report][$id_user]['comment'];
                    }
                    break;
                case "final_vote":
                    $title = strip_tags($lang->def('_FINAL_SCORE'));
                    if (isset($report_score[$id_report][$id_user]) && $report_score[$id_report][$id_user]['score_status'] == 'valid') {
                        $score = $report_score[$id_report][$id_user]['score'];
                        if ($score == $report_info['max_score']) {
                            $score = '<span class="cr_max_score">' . $score . '</span>';
                        } elseif ($score < $report_info['required_score']) {
                            $score = '<span class="cr_not_passed">' . $score . '</span>';
                        }
                        $date = Format::date($report_score[$id_report][$id_user]['date_attempt']);
                        $comment = $report_score[$id_report][$id_user]['comment'];
                    }
                    break;
            }
            $table->addBody(array($title, $score == '' ? $lang->def('_NOT_ASSIGNED') : $score . ' ' . $lang->def('_MAX_DIVISOR') . ' ' . $maxscore, $report_info['source_of'] === 'scorm_item' ? "-" : $required, $date, $comment, $link_result));
        }
    }
    $out->add(getTitleArea($lang->def('_GRADEBOOK_AREATITLE'), 'gradebook') . '<div class="std_block">' . $table->getTable() . '</div>');
}
Example #21
0
 function entrylist()
 {
     checkPerm('view');
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.form.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
     $lang =& DoceboLanguage::createInstance('catalogue', 'lms');
     $out =& $GLOBALS['page'];
     $id_cat = Get::req('id', DOTY_INT, 0);
     $cat_name = getCatalogueName($id_cat);
     $mod_perm = checkPerm('mod', true);
     $title_area = array('index.php?modname=catalogue&amp;op=catlist' => $lang->def('_CATALOGUE'), $cat_name);
     $tb_entry = new Table();
     $query_entry = "\r\n\tSELECT idEntry, type_of_entry\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_catalogue_entry\r\n\tWHERE idCatalogue = '" . $id_cat . "'";
     $re_entry = sql_query($query_entry);
     $courses = array();
     $coursepath = array();
     while (list($id, $t_o_entry) = sql_fetch_row($re_entry)) {
         if ($t_o_entry == 'course') {
             $courses[$id] = $id;
         } else {
             $coursepath[$id] = $id;
         }
     }
     $coursepath_man = new CoursePath_Manager();
     $coursespath_name =& $coursepath_man->getNames($coursepath);
     $course_name =& getCoursesInfo($courses);
     $cont_h = array($lang->def('_CODE'), $lang->def('_NAME'), $lang->def('_TYPE'));
     $type_h = array('', '', '');
     if ($mod_perm) {
         $type_h[] = 'image';
         $cont_h[] = '<img src="' . getPathImage('fw') . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />';
     }
     $tb_entry->setColsStyle($type_h);
     $tb_entry->addHead($cont_h);
     $all_courses = true;
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         $all_courses = false;
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST());
         if (isset($admin_courses['course'][0])) {
             $all_courses = true;
         } elseif (isset($admin_courses['course'][-1])) {
             require_once _lms_ . '/lib/lib.catalogue.php';
             $cat_man = new Catalogue_Manager();
             $user_catalogue = $cat_man->getUserAllCatalogueId(Docebo::user()->getIdSt());
             if (count($user_catalogue) > 0) {
                 $courses = array(0);
                 foreach ($user_catalogue as $id_cat) {
                     $catalogue_course =& $cat_man->getCatalogueCourse($id_cat, true);
                     $courses = array_merge($courses, $catalogue_course);
                 }
                 foreach ($courses as $id_course) {
                     if ($id_course != 0) {
                         $admin_courses['course'][$id_course] = $id_course;
                     }
                 }
             } elseif (Get::sett('on_catalogue_empty', 'off') == 'on') {
                 $all_courses = true;
             }
         } else {
             $array_courses = array();
             $array_courses = array_merge($array_courses, $admin_courses['course']);
             if (!empty($admin_courses['coursepath'])) {
                 require_once _lms_ . '/lib/lib.coursepath.php';
                 $path_man = new Catalogue_Manager();
                 $coursepath_course =& $path_man->getAllCourses($admin_courses['coursepath']);
                 $array_courses = array_merge($array_courses, $coursepath_course);
             }
             if (!empty($admin_courses['catalogue'])) {
                 require_once _lms_ . '/lib/lib.catalogue.php';
                 $cat_man = new Catalogue_Manager();
                 foreach ($admin_courses['catalogue'] as $id_cat) {
                     $catalogue_course =& $cat_man->getCatalogueCourse($id_cat, true);
                     $array_courses = array_merge($array_courses, $catalogue_course);
                 }
             }
             $admin_courses['course'] = array_merge($admin_courses['course'], $array_courses);
         }
     }
     if (is_array($course_name)) {
         foreach ($course_name as $course) {
             $cont = array($course['code'], $course['name'], $lang->def('_COURSE'));
             if ($mod_perm) {
                 if (isset($admin_courses['course'][$course['id']]) || $all_courses) {
                     $cont[] = '<a href="index.php?modname=catalogue&amp;op=delentry&amp;id_cat=' . $id_cat . '&amp;type=course&amp;id_entry=' . $course['id'] . '" ' . 'title="' . $lang->def('_REMOVE_ENTRY') . ' : ' . strip_tags($course['name']) . '">' . '<img src="' . getPathImage('fw') . 'standard/delete.png" ' . 'alt="' . $lang->def('_DEL') . ' : ' . strip_tags($course['name']) . '" /></a>';
                 } else {
                     $cont[] = '';
                 }
             }
             $tb_entry->addBody($cont);
         }
     }
     if (is_array($coursespath_name)) {
         while (list($id, $coursepath) = each($coursespath_name)) {
             $cont = array($coursepath, $lang->def('_COURSEPATH'));
             // #bugfix 1141
             $tmp_code = $coursepath_man->getCoursepathInfo($id);
             $path_code = $tmp_code['path_code'];
             array_unshift($cont, $path_code);
             // end bugfix
             if ($mod_perm) {
                 if (isset($admin_courses['coursepath'][$id]) || $all_courses) {
                     $cont[] = '<a href="index.php?modname=catalogue&amp;op=delentry&amp;id_cat=' . $id_cat . '&amp;type=coursepath&amp;id_entry=' . $id . '" ' . 'title="' . $lang->def('_REMOVE_ENTRY') . ' : ' . strip_tags($coursepath) . '">' . '<img src="' . getPathImage('fw') . 'standard/delete.png" ' . 'alt="' . $lang->def('_DEL') . ' : ' . strip_tags($coursepath) . '" /></a>';
                 } else {
                     $cont[] = '';
                 }
             }
             $tb_entry->addBody($cont);
         }
     }
     $select_entry = array('course' => $lang->def('_COURSE'), 'coursepath' => $lang->def('_COURSEPATH'));
     if ($mod_perm) {
         $tb_entry->addActionAdd('<a href="index.php?modname=catalogue&amp;op=import&amp;id_cat=' . $id_cat . '&amp;load=1" class="ico-wt-sprite subs_import" ' . ' title="' . Lang::t('_IMPORT', 'catalogue') . '"><span>' . Lang::t('_IMPORT', 'catalogue') . '</span></a>');
     }
     switch (Get::req('result', DOTY_ALPHANUM, '')) {
         case "ok":
             UIFeedback::info(Lang::t('_OPERATION_SUCCESSFUL', 'standard'));
             break;
         case "err":
             UIFeedback::error(Lang::t('_OPERATION_ERROR', 'standard'));
             break;
     }
     $out->add(getTitleArea($title_area, 'catalogue') . '<div class="std_block">' . getBackUi('index.php?modname=catalogue&amp;op=catlist', $lang->def('_BACK')) . $tb_entry->getTable() . getBackUi('index.php?modname=catalogue&amp;op=catlist', $lang->def('_BACK')) . '</div>', 'content');
     if ($mod_perm) {
         require_once _base_ . '/lib/lib.dialog.php';
         setupHrefDialogBox('a[href*=delentry]');
     }
 }
Example #22
0
 function _maskTemplateManager()
 {
     require_once _base_ . '/lib/lib.form.php';
     require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
     require_once _base_ . '/lib/lib.table.php';
     $lang =& DoceboLanguage::createInstance('configuration', 'framework');
     $field_man = new FieldList();
     $html = '';
     if (isset($_POST['save_and_refresh'])) {
         if (!sql_query("\r\n\t\t\tUPDATE " . $this->table . "\r\n\t\t\tSET param_value = '" . $_POST['templ_use_field'] . "'\r\n\t\t\tWHERE pack = 'main' AND param_name = 'templ_use_field'")) {
             $html .= getErrorUi('_ERROR_WHILE_SAVING_NEW_FIELD');
         } else {
             setTemplate($_POST['templ_use_field']);
         }
     }
     $drop_field = array();
     $drop_field = $field_man->getFlatAllFields(false, 'dropdown');
     $drop_field[0] = $lang->def('_NO');
     $html .= Form::getDropdown($lang->def('_TEMPL_USE_FIELD'), 'templ_use_field', 'templ_use_field', $drop_field, Get::sett('templ_use_field'));
     $html .= Form::getButton('save_and_refresh', 'save_and_refresh', $lang->def('_SAVE_AND_REFRESH'));
     if (Get::sett('templ_use_field') != 0) {
         $field_obj =& $field_man->getFieldInstance(Get::sett('templ_use_field'));
         if ($field_obj === NULL) {
             return $html . getErrorUi('_ERROR_WITH_THIS_FIELD');
         }
         $assignement = array();
         $query_template_assigned = "\r\n\t\t\tSELECT ref_id, template_code\r\n\t\t\tFROM " . $GLOBALS['prefix_fw'] . "_field_template\r\n\t\t\tWHERE id_common = '" . Get::sett('templ_use_field') . "'";
         $re_templ_assigned = sql_query($query_template_assigned);
         while (list($ref_id, $template_code) = sql_fetch_row($re_templ_assigned)) {
             $assignement[$ref_id] = $template_code;
         }
         $son_value = $field_obj->getAllSon();
         $template_list = getTemplateList(true);
         $default_template = getDefaultTemplate();
         $tb_son = new Table(0, $lang->def('_ASSIGN_DROPDOWN_VALUE_TEMPLATE'), $lang->def('_ASSIGN_DROPDOWN_VALUE_TEMPLATE_SUMMARY'));
         $cont_h = array($lang->def('_VALUE'), $lang->def('_TEMPLATE_VALUE'));
         $type_h = array('', '');
         $tb_son->setColsStyle($type_h);
         $tb_son->addHead($cont_h);
         while (list($id_son, $drop_son_name) = each($son_value)) {
             $cont = array('<label for="template_selected_' . $id_son . '">' . $drop_son_name . '</label>', Form::getInputDropdown('dropdown', 'template_selected_' . $id_son, 'template_selected[' . $id_son . ']', $template_list, isset($assignement[$id_son]) && isset($template_list[$assignement[$id_son]]) ? $assignement[$id_son] : $default_template, ''));
             $tb_son->addBody($cont);
         }
         $html .= $tb_son->getTable();
     }
     return $html;
 }
Example #23
0
?>
<br/>
					<?php 
echo Lang::t('_NUM_ATTEMPTS', 'standard') . ': ' . $track['num_attempts'];
?>
<br/>
				</p>
				<div class="nofloat"></div>
				<br/>
				<h3><?php 
echo Lang::t('_FIRST_PLACES', 'standard');
?>
</h3>
				<?php 
$tb = new Table(30);
$tb->addHead(array(Lang::t('_POSITION', 'games'), Lang::t('_USERNAME', 'standard'), Lang::t('_FULLNAME', 'standard'), Lang::t('_CURRENT_SCORE', 'standard'), Lang::t('_MAX_SCORE', 'standard')), array('image', '', '', 'image', 'image'));
$i = 1;
foreach ($standings as $row) {
    $tb->addBody(array($i++, Docebo::aclm()->relativeID($row['userid']), $row['lastname'] . ' ' . $row['firstname'], $row['current_score'], $row['max_score']));
}
echo $tb->getTable();
?>
				<div class="nofloat"></div>
			</div>
		</div>
	</div>
	<?php 
// close the tab structure
$lmstab->endWidget();
?>
</div>
Example #24
0
function showLog()
{
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('conference', 'lms');
    $id = Get::req('id', DOTY_INT, 0);
    $conference = new Conference_Manager();
    $room_info = $conference->roomInfo($id);
    $acl_man =& Docebo::user()->getAclManager();
    cout(getTitleArea('') . '<div class="std_block">', 'content');
    $room_log = array();
    switch ($room_info['room_type']) {
        case 'teleskill':
            require_once $GLOBALS['where_scs'] . '/lib/lib.teleskill.php';
            $teleskill = new Teleskill_Management();
            $roomid = $teleskill->getRoomId($id);
            if (isset($_POST['update_log'])) {
                $teleskill->updateRoomLog($roomid);
            }
            $room_log = $teleskill->getRoomLog($roomid);
            break;
    }
    $tb = new Table(0, $lang->def('_ROOM_LOG'), $lang->def('_ROOM_LOG'));
    $cont_h = array($lang->def('_FULLNAME'), $lang->def('_ROLE'), $lang->def('_DATE'), $lang->def('_TOTAL_TIME'), $lang->def('_NUMBER_OF_ACCESS'));
    $type_h = array('', '', '', '', '');
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    foreach ($room_log as $log_row) {
        $user_info = $acl_man->getUser($log_row['idUser'], false);
        $cont = array();
        if ($user_info[ACL_INFO_FIRSTNAME] !== '' && $user_info[ACL_INFO_LASTNAME]) {
            $cont[] = $user_info[ACL_INFO_FIRSTNAME] . ' ' . $user_info[ACL_INFO_LASTNAME] . ' (' . $acl_man->relativeId($user_info[ACL_INFO_USERID]) . ')';
        } elseif ($user_info[ACL_INFO_FIRSTNAME] !== '') {
            $cont[] = $user_info[ACL_INFO_FIRSTNAME] . ' (' . $acl_man->relativeId($user_info[ACL_INFO_USERID]) . ')';
        } elseif ($user_info[ACL_INFO_LASTNAME] !== '') {
            $cont[] = $user_info[ACL_INFO_LASTNAME] . ' (' . $acl_man->relativeId($user_info[ACL_INFO_USERID]) . ')';
        } else {
            $cont[] = $acl_man->relativeId($user_info[ACL_INFO_USERID]);
        }
        $cont[] = $log_row['role'] == 1 ? $lang->def('_USER_ROLE') : $lang->def('_TUTOR_ROLE');
        $cont[] = Format::date($log_row['date'], 'datetime');
        $duration_s = 0;
        $duration_m = 0;
        $duration_h = 0;
        $duration = $log_row['duration'];
        $duration_s = $duration % 60;
        $duration -= $duration_s;
        if ($duration) {
            $duration_m = $duration % 3600 / 60;
            $duration -= $duration_m * 60;
            if ($duration) {
                $duration_h = $duration / 3600;
            }
        }
        $cont[] = $duration_h . ' ' . $lang->def('_HOURS') . ' ' . $duration_m . ' ' . $lang->def('_MINUTS') . ' ' . $duration_s . ' ' . $lang->def('_SECONDS');
        $cont[] = $log_row['access'];
        $tb->addBody($cont);
    }
    $tb->addActionAdd(Form::getButton('update_log', 'update_log', $lang->def('_UPDATE_LOG')));
    cout(Form::openForm('log_table', 'index.php?modname=conference&amp;op=log&amp;id=' . $id) . $tb->getTable() . Form::closeForm() . '<br/>' . getBackUi('index.php?modname=conference&amp;op=history', $lang->def('_BACK')), 'content');
    cout('</div>', 'content');
}
Example #25
0
function modTransaction()
{
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.dialog.php';
    require_once _lms_ . '/lib/lib.course.php';
    require_once _lms_ . '/lib/lib.date.php';
    $lang =& DoceboLanguage::createInstance('transaction');
    $acl_man = Docebo::user()->getAclManager();
    $man_transaction = new Man_Transaction();
    $course_man = new Man_Course();
    $date_man = new DateManager();
    $id_transaction = Get::req('id', DOTY_INT, 0);
    $transaction_info = $man_transaction->getTransactionInfo($id_transaction);
    if (isset($_POST['update'])) {
        $payment_status = Get::req('payment_status', DOTY_INT, 0);
        $course_status = Get::req('course_status', DOTY_INT, 0);
        $note = Get::req('note', DOTY_MIXED, '');
        if ($man_transaction->updateTransaction($id_transaction, $payment_status, $course_status, $note)) {
            if (isset($_POST['confirm'])) {
                $activations = array();
                foreach ($_POST['confirm'] as $id => $n) {
                    list($id_course, $id_date) = explode('_', $id);
                    if ($id_date != 0) {
                        $activations[$id_course]['dates'][$id_date] = $id_date;
                    } else {
                        $activations[$id_course] = $id_course;
                    }
                }
                if ($man_transaction->activateCourses($id_transaction, $transaction_info['id_user'], $activations)) {
                    Util::jump_to('index.php?modname=transaction&op=transaction&res=ok');
                }
            } else {
                Util::jump_to('index.php?modname=transaction&op=transaction&res=ok');
            }
        }
        Util::jump_to('index.php?modname=transaction&op=transaction&res=err_up');
    }
    $array_title = array('index.php?modname=transaction&amp;op=transaction' => $lang->def('_TRANSACTION'), $lang->def('_MOD_TRANSACTION'));
    //Status info & note
    $array_payment_status = array('-1' => $lang->def('_CANCELLED'), '0' => $lang->def('_WAITING_PAYMENT'), '1' => $lang->def('_PARTIAL_PAID'), '2' => $lang->def('_PAID'));
    $array_course_status = array('-1' => $lang->def('_CANCELLED'), '0' => $lang->def('_NO_COURSE_ACTIVATED'), '1' => $lang->def('_SOME_COURSE_ACTIVATED'), '2' => $lang->def('_ALL_COURSE_ACTIVATED'));
    cout(getTitleArea($array_title) . '<div class="std_block">' . Form::openForm('transaction_info', 'index.php?modname=transaction&amp;op=mod&amp;id=' . $id_transaction) . Form::openElementSpace() . Form::getDropdown($lang->def('_PAYMENT_STATUS_FILTER'), 'payment_status', 'payment_status', $array_payment_status, $transaction_info['payment_status']) . Form::getDropdown($lang->def('_COURSE_STATUS_FILTER'), 'course_status', 'course_status', $array_course_status, $transaction_info['course_status']) . Form::getSimpleTextarea($lang->def('_NOTES'), 'note', 'note', $transaction_info['note']) . Form::closeElementSpace());
    //User info
    $user_info = $acl_man->getUser($transaction_info['id_user'], false);
    $tb_user = new Table(0, $lang->def('_USER_INFO'), $lang->def('_USER_INFO'));
    $cont_h = array($lang->def('_USERNAME'), $lang->def('_FIRSTNAME'), $lang->def('_LASTNAME'), $lang->def('_EMAIL'));
    $type_h = array('', '', '', '');
    $tb_user->setColsStyle($type_h);
    $tb_user->addHead($cont_h);
    $tb_user->addBody(array($acl_man->relativeId($user_info[ACL_INFO_USERID]), $user_info[ACL_INFO_FIRSTNAME], $user_info[ACL_INFO_LASTNAME], $user_info[ACL_INFO_EMAIL]));
    cout('<br />' . $tb_user->getTable());
    //Payment info if we need it
    //Product info
    $tb_product = new Table(0, $lang->def('_PRODUCT_INFO'), $lang->def('_PRODUCT_INFO'));
    $cont_h = array($lang->def('_CODE'), $lang->def('_NAME'), $lang->def('_DATE_BEGIN'), $lang->def('_DATE_END'), $lang->def('_COURSE_PRIZE'), $lang->def('_CONFIRM_COURSE'));
    $type_h = array('', '', '', '', '', '');
    $tb_product->setColsStyle($type_h);
    $tb_product->addHead($cont_h);
    $transaction_course = $man_transaction->getTransactionCourses($id_transaction);
    foreach ($transaction_course as $id_course => $details) {
        if (is_array($details)) {
            foreach ($details['dates'] as $id_date) {
                $date_info = $date_man->getDateInfo($id_date);
                $checked = false;
                $other = '';
                if ($man_transaction->controlActivation($id_transaction, $id_course, $id_date)) {
                    $checked = true;
                    $other = 'disabled="disabled"';
                }
                $tb_product->addBody(array($date_info['code'], $date_info['name'], Format::date($date_info['date_begin']), Format::date($date_info['date_end']), $date_info['price'], Form::getInputCheckbox($id_course . '_' . $id_date, 'confirm[' . $id_course . '_' . $id_date . ']', 1, $checked, $other)));
            }
        } else {
            $course_info = $course_man->getCourseInfo($id_course);
            $checked = false;
            $other = '';
            if ($man_transaction->controlActivation($id_transaction, $id_course)) {
                $checked = true;
                $other = 'disabled="disabled"';
            }
            $tb_product->addBody(array($course_info['code'], $course_info['name'], $course_info['date_begin'] !== '0000-00-00' ? Format::date($course_info['date_begin'], 'date') . ($course_info['hour_begin'] !== '-1' ? $course_info['hour_begin'] : '') : '', $course_info['date_end'] !== '0000-00-00' ? Format::date($course_info['date_end'], 'date') . ($course_info['hour_end'] !== '-1' ? $course_info['hour_end'] : '') : '', $course_info['prize'] == '' ? '0' : $course_info['prize'], Form::getInputCheckbox($id_course . '_0', 'confirm[' . $id_course . '_0]', 1, $checked, $other)));
        }
    }
    cout('<br />' . $tb_product->getTable() . Form::openButtonSpace() . Form::getButton('update', 'update', $lang->def('_UPDATE')) . Form::getButton('back_mod', 'back_mod', $lang->def('_BACK')) . Form::closeButtonSpace() . Form::closeForm());
    cout('</div>');
}
Example #26
0
 function getUserFunctionalRoles(&$fncroles_data)
 {
     $tb = new Table(0, Lang::t('_FUNCTIONAL_ROLE', 'profile'), Lang::t('_FUNCTIONAL_ROLE', 'profile'));
     $tb->addHead(array(Lang::t('_NAME', 'fncroles'), Lang::t('_SCORE', 'fncroles'), '<img src="' . Get::tmpl_path('base') . 'images/blank.png" />'), array('', 'img-cell', 'img-cell'));
     $icon_flag_ok = '<span class="ico-sprite subs_actv"><span>' . Lang::t('_MEET', 'fncroles') . '</span></span>';
     $icon_flag_no = '<span class="ico-sprite fd_notice"><span>' . Lang::t('_NOT_SATISFIED', 'fncroles') . '</span></span>';
     if (count($fncroles_data) > 0) {
         foreach ($fncroles_data as $id_fncrole => $value) {
             $obt = (int) $value->competences_obtained;
             $req = (int) $value->competences_required;
             $line = array();
             $line[] = $value->name;
             $line[] = '<b' . ($obt < $req ? ' class="red"' : '') . '>' . $obt . ' / ' . $req . '</b>';
             $line[] = $obt < $req ? $icon_flag_no : $icon_flag_ok;
             $tb->addBody($line);
         }
     } else {
         $line = array(array('colspan' => 3, 'value' => Lang::t('_NO_CONTENT', 'fncroles')));
         $tb->addBody($line);
     }
     return $tb->getTable();
 }
function publicAdminManager_edit_menu()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.publicadminmanager.php';
    $lang =& DoceboLanguage::createInstance('public_admin_manager', 'framework');
    $aclManager =& Docebo::user()->getAclManager();
    $adminidst = importVar('adminidst', true, 0);
    $out =& $GLOBALS['page'];
    $admin_manager = new PublicAdminManager();
    $role_list = $admin_manager->getPublicUserAdminRole();
    $out->setWorkingZone('content');
    $out->add(getTitleArea($lang->def('_ADMIN_MANAGMENT'), 'admin_managmer', $lang->def('_ADMIN_MANAGMENT')) . '<div class="std_block">' . Form::openForm('admin_menu_editing', '') . Form::getHidden('adminidst', 'adminidst', $adminidst));
    $table = new Table(0, $lang->def('_ADMIN_MANAGMENT'), $lang->def('_ADMIN_MANAGMENT'));
    $head = array('', $lang->def('_ACTION'));
    $style = array('image', '');
    $table->addHead($head, $style);
    foreach ($role_list as $role) {
        if (isset($_POST['save_permission'])) {
            if (isset($_POST[$role['roleid']]) && $_POST[$role['roleid']] == $role['idst']) {
                if (!$admin_manager->controlPublicUserAdminRole($adminidst, $role['idst'])) {
                    $admin_manager->addPublicAdminRole($adminidst, $role['idst']);
                }
            } else {
                if ($admin_manager->controlPublicUserAdminRole($adminidst, $role['idst'])) {
                    $admin_manager->delPublicAdminRole($adminidst, $role['idst']);
                }
            }
        }
        $lang_string = $role['roleid'];
        $lang_string = str_replace('/lms/course/public/public_user_admin/', '_USER_', $lang_string);
        $lang_string = str_replace('/lms/course/public/public_course_admin/', '_COURSE_', $lang_string);
        $lang_string = str_replace('/lms/course/public/public_subscribe_admin/', '_SUBSCRIBE_', $lang_string);
        $lang_string = str_replace('/lms/course/public/public_report_admin/', '_REPORT_', $lang_string);
        $lang_string = str_replace('/lms/course/public/public_newsletter_admin/', '_NEWSLETTER_', $lang_string);
        $lang_string = str_replace('/lms/course/public/public_certificate_release/', '_CERTIFICATES_', $lang_string);
        $lang_string = str_replace('/lms/course/public/public_coursepanel/', '_COURSEPANEL_COMPETENCES', $lang_string);
        $lang_string = strtoupper($lang_string);
        $content = array();
        $content[] = '<input class="check" type="checkbox" ' . 'id="' . $role['roleid'] . '" ' . 'name="' . $role['roleid'] . '" value="' . $role['idst'] . '"' . ($admin_manager->controlPublicUserAdminRole($adminidst, $role['idst']) ? ' checked="checked"' : '') . ' />';
        $content[] = $lang->def($lang_string);
        $table->addBody($content);
    }
    $out->add($table->getTable() . Form::openButtonSpace() . Form::getButton('save_permission', 'save_permission', $lang->def('_SAVE')) . Form::getButton('undo_pref', 'undo_pref', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>');
}
Example #28
0
function show_personal_media(&$out, &$lang)
{
    if (!canAccessPersonalMedia()) {
        die("You can't access!");
    }
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.mimetype.php';
    require_once _base_ . '/lib/lib.multimedia.php';
    $url = getPopupBaseUrl();
    $tab = new Table();
    $user_id = (int) Docebo::user()->getIdSt();
    //if(Get::sett('hteditor') == 'tinymce') {
    $GLOBALS['page']->add('' . '<script type="text/javascript" type="text/javascript" src="' . Get::rel_path('base') . '/addons/tiny_mce/tiny_mce_popup.js"></script>', 'page_head');
    $GLOBALS['page']->add('<script type="text/javascript">' . 'var FileBrowserDialogue = {
		    init : function () {
		        // Here goes your code for setting your custom things onLoad.
				var allLinks = document.getElementsByTagName("link");
				allLinks[allLinks.length-1].parentNode.removeChild(allLinks[allLinks.length-1]);
		    },
		    mySubmit : function (url) {
		        var URL = url;
		        var win = tinyMCEPopup.getWindowArg("window");

		        // insert information now
		        win.document.getElementById(tinyMCEPopup.getWindowArg("input")).value = URL;

		        // for image browsers: update image dimensions
		        if(win.ImageDialog) {
			        if (win.ImageDialog.getImageData) win.ImageDialog.getImageData();
			        if (win.ImageDialog.showPreviewImage) win.ImageDialog.showPreviewImage(URL);
		        }
		        // close popup window
		        tinyMCEPopup.close();
		    }
		}
			tinyMCEPopup.onInit.add(FileBrowserDialogue.init, FileBrowserDialogue);
		' . '</script>', 'page_head');
    //}
    $head = array($lang->def("_PREVIEW"), $lang->def("_TYPE"), $lang->def("_FILENAME"));
    $head[] = "<img src=\"" . getPathImage() . "standard/download.png\" alt=\"" . $lang->def("_ATTACHMENT") . "\" title=\"" . $lang->def("_ATTACHMENT") . "\" />";
    $head[] = "<img src=\"" . getPathImage() . "standard/delete.png\" alt=\"" . $lang->def("_DEL") . "\" title=\"" . $lang->def("_DEL") . "\" />";
    $head_type = array('preview80', 'image', '', 'image', 'image');
    $tab->setColsStyle($head_type);
    $tab->addHead($head);
    $path = (strlen(dirname($_SERVER['PHP_SELF'])) != 1 ? dirname($_SERVER['PHP_SELF']) : '') . '/';
    $path .= $GLOBALS["where_files_relative"];
    $site_url = "http://" . $_SERVER['HTTP_HOST'] . $path . '/common/users/';
    $qtxt = "\r\n\tSELECT *\r\n\tFROM " . $GLOBALS["prefix_fw"] . "_user_file\r\n\tWHERE user_idst='" . $user_id . "'";
    $q = sql_query($qtxt);
    if ($q && mysql_num_rows($q) > 0) {
        while ($row = mysql_fetch_array($q)) {
            $rowcnt = array();
            if (!empty($row["media_url"])) {
                $rowcnt[] = "&nbsp;";
            } else {
                $file = _USER_FPATH . rawurlencode($row["real_fname"]);
                $rowcnt[] = "<div style=\"text-align: center;\">" . '<a href="#" onclick="javascript:window.open(\'' . $file . '\',\'\');return false;">' . "<img height=\"120\" src=\"" . $file . "\" alt=\"" . $row["fname"] . "\" title=\"" . $row["fname"] . "\" /></a></div>";
            }
            $img = "<img src=\"" . getPathImage('fw') . mimeDetect($file) . "\" alt=\"" . $row["fname"] . "\" title=\" ";
            $img .= $row["fname"] . "\" />\n";
            $rowcnt[] = $img;
            $rowcnt[] = $row["fname"];
            if (!empty($row["media_url"])) {
                $type = getMediaType($row["media_url"]);
            } else {
                $type = getMediaType($row["fname"]);
            }
            $sel_url = $url . "&amp;op=select&amp;from=personal&amp;type=" . $type . "&amp;item_id=" . $row["id"];
            $img = "<img src=\"" . getPathImage() . "standard/download.png\" alt=\"" . $lang->def("_ATTACHMENT") . "\" title=\"" . $lang->def("_ATTACHMENT") . "\" />\n";
            $rowcnt[] = '<a href="' . $sel_url . '" ' . (Get::sett('hteditor') == 'tinymce' ? 'onclick="FileBrowserDialogue.mySubmit(\'' . $site_url . $row["real_fname"] . '\'); return false;"' : '') . '>' . $img . "</a>\n";
            $img = "<img src=\"" . getPathImage('fw') . "standard/delete.png\" alt=\"" . $lang->def("_DEL") . "\" title=\"" . $lang->def("_DEL") . "\" />\n";
            $rowcnt[] = "<a href=\"" . $url . "&amp;op=delpersonal&amp;item_id=" . $row["id"] . "\">" . $img . "</a>\n";
            $tab->addBody($rowcnt);
        }
    }
    $url = getPopupBaseUrl() . "&amp;op=addpersonal";
    $tab->addActionAdd("<a href=\"" . $url . "\">" . $lang->def("_ADD") . "</a>");
    if (isset($_GET['result'])) {
        switch ($_GET['result']) {
            case "invalid_ext":
                $GLOBALS['page']->add(getErrorUi($lang->def('_INVALID_EXTENSION')));
                break;
            case "upload_err":
                $GLOBALS['page']->add(getErrorUi($lang->def('_ERROR_UPLOAD')));
                break;
            case "upload_ok":
                $GLOBALS['page']->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
        }
    }
    $GLOBALS['page']->add($tab->getTable());
}
Example #29
0
function adminManager_list()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('adminrules', 'framework');
    $aclManager = new DoceboACLManager();
    // get users to show --------------------------------------------------
    $admin_group_idst = $aclManager->getGroupST(ADMIN_GROUP_ADMIN);
    $arr_admin_idst = $aclManager->getGroupUMembers($admin_group_idst);
    $arr_admin_id = array_flip($aclManager->getArrUserST($arr_admin_idst));
    $usres_info =& $aclManager->getUsers($arr_admin_idst);
    $pm =& PlatformManager::createInstance();
    $lms_is_active = $pm->isLoaded("lms");
    $cms_is_active = $pm->isLoaded("cms");
    // print table --------------------------------------------------------
    $table = new Table(Get::sett('visuItem'), $lang->def('_ADMIN_USER'), $lang->def('_ADMIN_USER'));
    $table->initNavBar('ini', 'link');
    $table->setLink('index.php?modname=admin_manager&amp;op=view&amp;ini=');
    $ini = $table->getSelectedElement();
    $GLOBALS['page']->add(getTitleArea($lang->def('_ADMIN_MANAGMENT'), 'admin_managmer', $lang->def('_ADMIN_MANAGMENT')) . '<div class="std_block">', 'content');
    $contentH = array($lang->def('_USERNAME'), $lang->def('_EMAIL'), '<img src="' . getPathImage() . 'admin_manager/man_pref.gif" alt="' . $lang->def('_ADMIN_PREFERENCES_TITLE') . '" ' . 'title="' . $lang->def('_ADMIN_PREFERENCES_TITLE') . '" />', '<img src="' . getPathImage() . 'admin_manager/man_menu.gif" alt="' . $lang->def('_ASSIGN_USERS') . '" ' . 'title="' . $lang->def('_ADMIN_MENU_TITLE') . '" />', '<img src="' . getPathImage() . 'directory/tree.gif" alt="' . $lang->def('_ASSIGN_USERS') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS') . '" />', '<img src="' . getPathImage() . 'admin_manager/lang_lang.gif" alt="' . $lang->def('_ASSIGN_USERS') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS') . '" />');
    $typeH = array('', '', 'image', 'image', 'image', 'image');
    if ($lms_is_active) {
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/man_course.gif" alt="' . $lang->def('_ASSIGN_USERS') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS') . '" />';
        $typeH[] = 'image';
    }
    if ($cms_is_active) {
        // Cms Pages
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/pagetree.png" alt="' . $lang->def('_ASSIGN_CMS_PAGES') . '" ' . 'title="' . $lang->def('_ASSIGN_CMS_PAGES') . '" />';
        $typeH[] = 'image';
        // Cms News
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/newstree.png" alt="' . $lang->def('_NEWS') . '" ' . 'title="' . $lang->def('_NEWS') . '" />';
        $typeH[] = 'image';
        // Cms Documents
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/docstree.png" alt="' . $lang->def('_ASSIGN_CMS_DOCS') . '" ' . 'title="' . $lang->def('_ASSIGN_CMS_DOCS') . '" />';
        $typeH[] = 'image';
        // Cms Media
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/mediatree.png" alt="' . $lang->def('_ASSIGN_CMS_MEDIA') . '" ' . 'title="' . $lang->def('_ASSIGN_CMS_MEDIA') . '" />';
        $typeH[] = 'image';
        // Cms Contents
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/contenttree.png" alt="' . $lang->def('_ASSIGN_CMS_CONTENT') . '" ' . 'title="' . $lang->def('_ASSIGN_CMS_CONTENT') . '" />';
        $typeH[] = 'image';
    }
    $table->setColsStyle($typeH);
    $table->addHead($contentH);
    $maxItem = count($arr_admin_id) < $ini + Get::sett('visuItem') ? count($arr_admin_id) : $ini + Get::sett('visuItem');
    for ($index = $ini; $index < $maxItem; $index++) {
        $admin_userid = substr($arr_admin_id[$arr_admin_idst[$index]], 1);
        $rowContent = array($admin_userid, $usres_info[$arr_admin_idst[$index]][ACL_INFO_EMAIL]);
        // Edit preferences
        $rowContent[] = '<a href="index.php?modname=admin_manager&amp;op=edit_preferences&amp;adminidst=' . $arr_admin_idst[$index] . '"
						 title="' . $lang->def('_ADMIN_PREFERENCES_TITLE') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_pref.gif"' . ' alt="' . $lang->def('_ADMIN_PREFERENCES_TITLE') . ' : ' . $admin_userid . '" /></a>';
        // Edit menu
        $rowContent[] = '<a href="index.php?modname=admin_manager&amp;op=edit_menu&amp;adminidst=' . $arr_admin_idst[$index] . '"
						 title="' . $lang->def('_ADMIN_MENU_TITLE') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_menu.gif"' . ' alt="' . $lang->def('_ADMIN_MENU_TITLE') . ' : ' . $admin_userid . '" /></a>';
        // Edit user
        $rowContent[] = '<a href="index.php?modname=admin_manager&amp;op=assign_tree&amp;adminidst=' . $arr_admin_idst[$index] . '"
		 					title="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'directory/tree.gif" ' . 'alt="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '" /></a>';
        // Edit lang
        $rowContent[] = '<a href="index.php?modname=admin_manager&amp;op=edit_lang&amp;adminidst=' . $arr_admin_idst[$index] . '"
						 	title="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/lang_lang.gif"' . ' alt="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '" /></a>';
        // Edit course
        if ($lms_is_active) {
            $rowContent[] = '<a href="index.php?modname=admin_manager&amp;op=edit_course&amp;adminidst=' . $arr_admin_idst[$index] . '&amp;load=1"
								 title="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_course.gif"' . ' alt="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '" /></a>';
        }
        // Assign cms trees permissions
        if ($cms_is_active) {
            // Cms Pages
            $img = "<img src=\"" . getPathImage() . "admin_manager/pagetree.png\" alt=\"" . $lang->def("_ASSIGN_CMS_PAGES") . "\" ";
            $img .= "title=\"" . $lang->def("_ASSIGN_CMS_PAGES") . "\" />";
            $url = "index.php?modname=admin_manager&amp;op=assign_cmspag&amp;adminidst=" . $arr_admin_idst[$index];
            $rowContent[] = "<a href=\"" . $url . "\">" . $img . "</a>\n";
            // Cms News
            $img = "<img src=\"" . getPathImage() . "admin_manager/newstree.png\" alt=\"" . $lang->def("_NEWS") . "\" ";
            $img .= "title=\"" . $lang->def("_NEWS") . "\" />";
            $url = "index.php?modname=admin_manager&amp;op=assign_cmsnews&amp;adminidst=" . $arr_admin_idst[$index];
            $rowContent[] = "<a href=\"" . $url . "\">" . $img . "</a>\n";
            // Cms Documents
            $img = "<img src=\"" . getPathImage() . "admin_manager/docstree.png\" alt=\"" . $lang->def("_ASSIGN_CMS_DOCS") . "\" ";
            $img .= "title=\"" . $lang->def("_ASSIGN_CMS_DOCS") . "\" />";
            $url = "index.php?modname=admin_manager&amp;op=assign_cmsdocs&amp;adminidst=" . $arr_admin_idst[$index];
            $rowContent[] = "<a href=\"" . $url . "\">" . $img . "</a>\n";
            // Cms Media
            $img = "<img src=\"" . getPathImage() . "admin_manager/mediatree.png\" alt=\"" . $lang->def("_ASSIGN_CMS_MEDIA") . "\" ";
            $img .= "title=\"" . $lang->def("_ASSIGN_CMS_MEDIA") . "\" />";
            $url = "index.php?modname=admin_manager&amp;op=assign_cmsmedia&amp;adminidst=" . $arr_admin_idst[$index];
            $rowContent[] = "<a href=\"" . $url . "\">" . $img . "</a>\n";
            // Cms Contents
            $img = "<img src=\"" . getPathImage() . "admin_manager/contenttree.png\" alt=\"" . $lang->def("_ASSIGN_CMS_CONTENT") . "\" ";
            $img .= "title=\"" . $lang->def("_ASSIGN_CMS_CONTENT") . "\" />";
            $url = "index.php?modname=admin_manager&amp;op=assign_cmscontent&amp;adminidst=" . $arr_admin_idst[$index];
            $rowContent[] = "<a href=\"" . $url . "\">" . $img . "</a>\n";
        }
        $table->addBody($rowContent);
    }
    $GLOBALS['page']->add($table->getTable() . $table->getNavBar($ini, count($arr_admin_id)), 'content');
    $GLOBALS['page']->add('</div>', 'content');
}
Example #30
0
 public function printPageWithElement($id, $idst)
 {
     $adm_old_perm = $this->preference->getAdminPerm($idst);
     $array_image = array('add_category' => 'ico-sprite subs_view', 'mod_category' => 'ico-sprite subs_view', 'del_category' => 'ico-sprite subs_view', 'view' => 'ico-sprite subs_view', 'add' => 'ico-sprite subs_add', 'mod' => 'ico-sprite subs_mod', 'del' => 'ico-sprite subs_del', 'associate_user' => 'ico-sprite subs_users', 'approve_waiting_user' => 'ico-sprite subs_user', 'subscribe' => 'ico-sprite subs_users', 'moderate' => 'ico-sprite subs_user');
     switch ($id) {
         case 'framework':
             require_once _base_ . '/lib/lib.table.php';
             $query = "SELECT idMenu, name, collapse" . " FROM %adm_menu" . " ORDER BY sequence";
             $result = sql_query($query);
             while (list($id_menu, $name, $collapse) = sql_fetch_row($result)) {
                 $query = "SELECT module_name, default_name, class_file, class_name, mvc_path" . " FROM %adm_menu_under" . " WHERE idMenu = '" . $id_menu . "'";
                 $result_under = sql_query($query);
                 if (sql_num_rows($result_under) > 0) {
                     $tb = new Table(NULL);
                     $th = array(Lang::t($name, 'menu'));
                     $ts = array('');
                     $total_perm = array();
                     $module_perm = array();
                     while (list($module_name, $default_name, $class_file, $class_name, $mvc_path) = sql_fetch_row($result_under)) {
                         if ($mvc_path !== '') {
                             $tmp = explode('/', $mvc_path);
                             $mvc_name = ucwords($tmp[1]);
                             $perm_path = '/framework/admin/' . strtolower($mvc_name) . '/';
                             require_once _adm_ . '/models/' . $mvc_name . 'Adm.php';
                             $class_name = $mvc_name . 'Adm';
                             $tmp_class = new $class_name();
                             $perm = $tmp_class->getPerm();
                             if (!empty($perm)) {
                                 foreach ($perm as $perm_name => $img) {
                                     if (array_search($perm_name, array_keys($total_perm)) == false) {
                                         $total_perm[$perm_name] = $img;
                                         if ($collapse === 'true') {
                                             $th = array(Lang::t($default_name, 'menu'));
                                         }
                                     }
                                     list($perm_idst) = sql_fetch_row(sql_query("SELECT idst FROM %adm_role WHERE roleid = '" . $perm_path . $perm_name . "'"));
                                     $module_perm[$mvc_name][$perm_name] = $perm_idst;
                                 }
                             }
                         } else {
                             require_once _adm_ . '/class.module/' . $class_file;
                             $tmp_class = new $class_name();
                             $perm_path = '/framework/admin/' . strtolower($module_name) . '/';
                             $perm = $tmp_class->getAllToken('lang');
                             if (!empty($perm)) {
                                 foreach ($perm as $perm_name => $info) {
                                     if (array_search($perm_name, array_keys($total_perm)) == false) {
                                         $total_perm[$perm_name] = $info['image'];
                                         if ($collapse === 'true') {
                                             $th = array(Lang::t($default_name, 'menu'));
                                         }
                                     }
                                     list($perm_idst) = sql_fetch_row(sql_query("SELECT idst FROM %adm_role WHERE roleid = '" . $perm_path . $perm_name . "'"));
                                     $module_perm[$class_name][$perm_name] = $perm_idst;
                                 }
                             }
                         }
                     }
                     //End while 1
                     if (!empty($total_perm)) {
                         foreach ($total_perm as $perm => $img) {
                             $classname = isset($array_image[$perm]) ? $array_image[$perm] : "ico-sprite";
                             $th[] = '<span class="' . $classname . '" title="' . Lang::t('_' . strtoupper($perm), 'menu') . '"><span>' . Lang::t('_' . strtoupper($perm), 'menu') . '</span></span>';
                             $ts[] = 'image';
                         }
                         $tb->addHead($th);
                         $tb->setColsStyle($ts);
                         $result_under = sql_query($query);
                         while (list($module_name, $default_name, $class_file, $class_name, $mvc_path) = sql_fetch_row($result_under)) {
                             if ($mvc_path !== '') {
                                 $tmp = explode('/', $mvc_path);
                                 $mvc_name = ucwords($tmp[1]);
                                 $content = array(Lang::t($default_name, 'menu'));
                                 foreach ($total_perm as $perm => $img) {
                                     if (isset($module_perm[$mvc_name][$perm])) {
                                         $content[] = Form::getInputCheckbox('adm_perm_' . $module_perm[$mvc_name][$perm], 'adm_perm[' . $module_perm[$mvc_name][$perm] . ']', '1', isset($adm_old_perm[$module_perm[$mvc_name][$perm]]), '');
                                     } else {
                                         $content[] = '';
                                     }
                                 }
                                 reset($total_perm);
                                 $tb->addBody($content);
                             } else {
                                 $content = array(Lang::t($default_name, 'menu'));
                                 foreach ($total_perm as $perm => $img) {
                                     if (isset($module_perm[$class_name][$perm])) {
                                         $content[] = Form::getInputCheckbox('adm_perm_' . $module_perm[$class_name][$perm], 'adm_perm[' . $module_perm[$class_name][$perm] . ']', '1', isset($adm_old_perm[$module_perm[$class_name][$perm]]), '');
                                     } else {
                                         $content[] = '';
                                     }
                                 }
                                 reset($total_perm);
                                 $tb->addBody($content);
                             }
                         }
                         //End while 2
                         echo $tb->getTable() . '<br/><br/>';
                     }
                 }
             }
             //End while
             break;
         case 'lms':
             require_once _base_ . '/lib/lib.table.php';
             $query = "SELECT idMenu, name, collapse" . " FROM %lms_menu" . " ORDER BY sequence";
             $result = sql_query($query);
             while (list($id_menu, $name, $collapse) = sql_fetch_row($result)) {
                 $query = "SELECT module_name, default_name, class_file, class_name, mvc_path" . " FROM %lms_menu_under" . " WHERE idMenu = '" . $id_menu . "'";
                 $result_under = sql_query($query);
                 if (sql_num_rows($result_under) > 0) {
                     $tb = new Table(NULL);
                     $th = array(Lang::t($name, 'menu'));
                     $ts = array('');
                     $total_perm = array();
                     $module_perm = array();
                     while (list($module_name, $default_name, $class_file, $class_name, $mvc_path) = sql_fetch_row($result_under)) {
                         if ($mvc_path !== '') {
                             $tmp = explode('/', $mvc_path);
                             $mvc_name = ucwords($tmp[1]);
                             $perm_path = '/lms/admin/' . strtolower($mvc_name) . '/';
                             require_once _lms_ . '/admin/models/' . $mvc_name . 'Alms.php';
                             $class_name = $mvc_name . 'Alms';
                             $tmp_class = new $class_name();
                             $perm = $tmp_class->getPerm();
                             if (!empty($perm)) {
                                 foreach ($perm as $perm_name => $img) {
                                     if (array_search($perm_name, array_keys($total_perm)) == false) {
                                         $total_perm[$perm_name] = $img;
                                         if ($collapse === 'true') {
                                             $th = array(Lang::t($default_name, 'menu'));
                                         }
                                     }
                                     list($perm_idst) = sql_fetch_row(sql_query("SELECT idst FROM %adm_role WHERE roleid = '" . $perm_path . $perm_name . "'"));
                                     $module_perm[$mvc_name][$perm_name] = $perm_idst;
                                 }
                             }
                         } else {
                             require_once _lms_ . '/admin/class.module/' . $class_file;
                             $tmp_class = new $class_name();
                             $perm_path = '/lms/admin/' . strtolower($module_name) . '/';
                             $perm = $tmp_class->getAllToken('lang');
                             if (!empty($perm)) {
                                 foreach ($perm as $perm_name => $info) {
                                     if (array_search($perm_name, array_keys($total_perm)) == false) {
                                         $total_perm[$perm_name] = $info['image'];
                                         if ($collapse === 'true') {
                                             $th = array(Lang::t($default_name, 'menu'));
                                         }
                                     }
                                     list($perm_idst) = sql_fetch_row(sql_query("SELECT idst FROM %adm_role WHERE roleid = '" . $perm_path . $perm_name . "'"));
                                     $module_perm[$class_name][$perm_name] = $perm_idst;
                                 }
                             }
                         }
                     }
                     //End while 1
                     if (!empty($total_perm)) {
                         foreach ($total_perm as $perm => $img) {
                             $th[] = '<span class="' . $array_image[$perm] . '" title="' . Lang::t('_' . strtoupper($perm), 'menu') . '"><span>' . Lang::t('_' . strtoupper($perm), 'menu') . '</span></span>';
                             $ts[] = 'image';
                         }
                         $tb->addHead($th);
                         $tb->setColsStyle($ts);
                         $result_under = sql_query($query);
                         while (list($module_name, $default_name, $class_file, $class_name, $mvc_path) = sql_fetch_row($result_under)) {
                             if ($mvc_path !== '') {
                                 $tmp = explode('/', $mvc_path);
                                 $mvc_name = ucwords($tmp[1]);
                                 $content = array(Lang::t($default_name, 'menu'));
                                 foreach ($total_perm as $perm => $img) {
                                     if (isset($module_perm[$mvc_name][$perm])) {
                                         $content[] = Form::getInputCheckbox('adm_perm_' . $module_perm[$mvc_name][$perm], 'adm_perm[' . $module_perm[$mvc_name][$perm] . ']', '1', isset($adm_old_perm[$module_perm[$mvc_name][$perm]]), '');
                                     } else {
                                         $content[] = '';
                                     }
                                 }
                                 reset($total_perm);
                                 $tb->addBody($content);
                             } else {
                                 $content = array(Lang::t($default_name, 'menu'));
                                 foreach ($total_perm as $perm => $img) {
                                     if (isset($module_perm[$class_name][$perm])) {
                                         $content[] = Form::getInputCheckbox('adm_perm_' . $module_perm[$class_name][$perm], 'adm_perm[' . $module_perm[$class_name][$perm] . ']', '1', isset($adm_old_perm[$module_perm[$class_name][$perm]]), '');
                                     } else {
                                         $content[] = '';
                                     }
                                 }
                                 reset($total_perm);
                                 $tb->addBody($content);
                             }
                         }
                         //End while 2
                         echo $tb->getTable() . '<br/><br/>';
                     }
                 }
             }
             //End while
             break;
         case 'scs':
             echo 'scs';
             break;
         case 'cms':
             require_once _base_ . '/lib/lib.table.php';
             $query = "SELECT idMenu, name, collapse" . " FROM %cms_menu" . " ORDER BY sequence";
             $result = sql_query($query);
             while (list($id_menu, $name, $collapse) = sql_fetch_row($result)) {
                 $query = "SELECT module_name, default_name, class_file, class_name, mvc_path" . " FROM %cms_menu_under" . " WHERE idMenu = '" . $id_menu . "'";
                 $result_under = sql_query($query);
                 if (sql_num_rows($result_under) > 0) {
                     $tb = new Table(NULL);
                     $th = array(Lang::t($name, 'adminrules'));
                     $ts = array('');
                     $total_perm = array();
                     $module_perm = array();
                     while (list($module_name, $default_name, $class_file, $class_name, $mvc_path) = sql_fetch_row($result_under)) {
                         if ($mvc_path !== '') {
                             $tmp = explode('/', $mvc_path);
                             $mvc_name = ucwords($tmp[1]);
                             $perm_path = '/cms/admin/' . strtolower($mvc_name) . '/';
                             require_once _cms_ . '/admin/models/' . $mvc_name . '.php';
                             $class_name = $mvc_name . '';
                             $tmp_class = new $class_name();
                             $perm = $tmp_class->getPerm();
                             if (!empty($perm)) {
                                 foreach ($perm as $perm_name => $img) {
                                     if (array_search($perm_name, array_keys($total_perm)) == false) {
                                         $total_perm[$perm_name] = $img;
                                         if ($collapse === 'true') {
                                             $th = array(Lang::t($default_name, 'adminrules'));
                                         }
                                     }
                                     list($perm_idst) = sql_fetch_row(sql_query("SELECT idst FROM %adm_role WHERE roleid = '" . $perm_path . $perm_name . "'"));
                                     $module_perm[$mvc_name][$perm_name] = $perm_idst;
                                 }
                             }
                         } else {
                             require_once _cms_ . '/class.module/' . $class_file;
                             $tmp_class = new $class_name();
                             $perm_path = '/cms/admin/' . strtolower($module_name) . '/';
                             $perm = $tmp_class->getAllToken('lang');
                             if (!empty($perm)) {
                                 foreach ($perm as $perm_name => $info) {
                                     if (array_search($perm_name, array_keys($total_perm)) == false) {
                                         $total_perm[$perm_name] = $info['image'];
                                         if ($collapse === 'true') {
                                             $th = array(Lang::t($default_name, 'adminrules'));
                                         }
                                     }
                                     list($perm_idst) = sql_fetch_row(sql_query("SELECT idst FROM %adm_role WHERE roleid = '" . $perm_path . $perm_name . "'"));
                                     $module_perm[$class_name][$perm_name] = $perm_idst;
                                 }
                             }
                         }
                     }
                     //End while 1
                     foreach ($total_perm as $perm => $img) {
                         $th[] = '<span class="' . $array_image[$perm] . '" title="' . Lang::t('_' . strtoupper($perm), 'menu') . '"><span>' . Lang::t('_' . strtoupper($perm), 'menu') . '</span></span>';
                         $ts[] = 'image';
                     }
                     $tb->addHead($th);
                     $tb->setColsStyle($ts);
                     $result_under = sql_query($query);
                     while (list($module_name, $default_name, $class_file, $class_name, $mvc_path) = sql_fetch_row($result_under)) {
                         if ($mvc_path !== '') {
                             $tmp = explode('/', $mvc_path);
                             $mvc_name = ucwords($tmp[1]);
                             $content = array(Lang::t($default_name, 'adminrules'));
                             foreach ($total_perm as $perm => $img) {
                                 if (isset($module_perm[$mvc_name][$perm])) {
                                     $content[] = Form::getInputCheckbox('adm_perm_' . $module_perm[$mvc_name][$perm], 'adm_perm[' . $module_perm[$mvc_name][$perm] . ']', '1', isset($adm_old_perm[$module_perm[$mvc_name][$perm]]), '');
                                 } else {
                                     $content[] = '';
                                 }
                             }
                             reset($total_perm);
                             $tb->addBody($content);
                         } else {
                             $content = array(Lang::t($default_name, 'adminrules'));
                             foreach ($total_perm as $perm => $img) {
                                 if (isset($module_perm[$class_name][$perm])) {
                                     $content[] = Form::getInputCheckbox('adm_perm_' . $module_perm[$class_name][$perm], 'adm_perm[' . $module_perm[$class_name][$perm] . ']', '1', isset($adm_old_perm[$module_perm[$class_name][$perm]]), '');
                                 } else {
                                     $content[] = '';
                                 }
                             }
                             reset($total_perm);
                             $tb->addBody($content);
                         }
                     }
                     //End while 2
                     echo $tb->getTable() . '<br/><br/>';
                 }
             }
             //End while
             break;
         case 'ecom':
             echo 'ecom';
             break;
     }
 }