Example #1
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 #2
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('&', '&amp;', $object_glos->back_url) . '&amp;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');
 }
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');
    }
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 #5
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 #6
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 #7
0
function project()
{
    checkPerm('view');
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $lang =& DoceboLanguage::createInstance('project', "lms");
    require_once _base_ . '/lib/lib.table.php';
    $myprj = userProjectsList(Docebo::user()->getIdSt());
    $mod_perm = checkPerm('mod', true);
    $del_perm = checkPerm('del', true);
    //area title
    $out->add(getTitleArea($lang->def("_PROJECT_MANAGER"), "project") . '<div class="std_block">' . "\n");
    $tab = new Table(0, $lang->def("_MYPRJ"), $lang->def("_PROJECT_SUMMARY"));
    $content_h = array($lang->def("_TITLE"), $lang->def("_PROGRESS"), $lang->def("_PERCENTAGE"));
    $type_h = array('', '', 'image');
    if ($mod_perm) {
        $content_h[] = '<img src="' . getPathImage() . 'standard/moduser.png" ' . 'alt="' . $lang->def("_MODPROJECTADMIN") . '" title="' . $lang->def("_MODPROJECTADMIN") . '" />';
        $type_h[] = 'image';
        $content_h[] = '<img src="' . getPathImage() . 'standard/edit.png" ' . 'alt="' . $lang->def("_MOD") . '" title="' . $lang->def("_MOD") . '" />';
        $type_h[] = 'image';
    }
    if ($del_perm) {
        $content_h[] = '<img src="' . getPathImage() . 'standard/delete.png" ' . 'alt="' . $lang->def("_DEL") . '" title="' . $lang->def("_DEL") . '" />';
        $type_h[] = 'image';
    }
    $tab->setColsStyle($type_h);
    $tab->addHead($content_h);
    if (!empty($myprj)) {
        foreach ($myprj as $key => $row) {
            $val = $row["id"];
            $progtot = $row["pprog"];
            if ($progtot < 100) {
                $class = "prjprogbar_g";
                $img = "progbar_g";
            } else {
                $class = "prjprogbar_r";
                $img = "progbar_r";
            }
            $content = array('<a href="index.php?modname=project&amp;op=showprj&amp;id=' . $val . '">' . $row["ptitle"] . '</a>', renderProgress($progtot, 0, 100, false), $progtot . '%');
            if ($mod_perm) {
                if ($row["flag"] == 2) {
                    $content[] = '<a href="index.php?modname=project&amp;op=manprjadmin&amp;id=' . $val . '">' . '<img src="' . getPathImage() . 'standard/moduser.png" ' . 'alt="' . $lang->def("_MODPROJECTADMIN") . '" title="' . $lang->def("_MODPROJECTADMIN") . '" /></a>';
                    $content[] = '<a href="index.php?modname=project&amp;op=modprj&amp;id=' . $val . '">' . '<img src="' . getPathImage() . 'standard/edit.png" ' . 'alt="' . $lang->def("_MOD") . '" title="' . $lang->def("_MOD") . '" /></a>';
                } else {
                    $content[] = "&nbsp;";
                    $content[] = "&nbsp;";
                }
            }
            if ($del_perm) {
                if ($row["flag"] == 2) {
                    $content[] = '<a href="index.php?modname=project&amp;op=delprj&amp;id=' . $val . '" title="' . $lang->def("_DEL") . ' : ' . strip_tags($row["ptitle"]) . '">' . '<img src="' . getPathImage() . 'standard/delete.png" ' . 'alt="' . $lang->def("_DEL") . '" title="' . $lang->def("_DEL") . '" /></a>';
                } else {
                    $content[] = "&nbsp;";
                }
            }
            $tab->addBody($content);
        }
    }
    if ($del_perm) {
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=delprj]');
    }
    if (checkPerm('add', true)) {
        $tab->addActionAdd('<a href="index.php?modname=project&amp;op=addprj" title="' . $lang->def("_NEW_PROJECT") . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def("_NEW_PROJECT") . '" /> ' . $lang->def("_NEW_PROJECT") . '</a>');
    }
    $out->add($tab->getTable());
    $out->add('</div>');
}
Example #8
0
function get_schedulations_table($idrep = false)
{
    checkPerm('view');
    $can_mod = checkPerm('mod', true);
    require_once _base_ . '/lib/lib.table.php';
    Util::get_js(Get::rel_path('base') . '/widget/dialog/dialog.js', true, true);
    YuiLib::load('selector');
    $acl_man =& Docebo::user()->getACLManager();
    $level = Docebo::user()->getUserLevelId(getLogUserId());
    $admin_cond = '';
    switch ($level) {
        case ADMIN_GROUP_GODADMIN:
        case ADMIN_GROUP_ADMIN:
            break;
        case ADMIN_GROUP_PUBLICADMIN:
        case ADMIN_GROUP_USER:
        default:
            $admin_cond .= " AND t1.id_creator=" . getLogUserId();
            break;
    }
    $query = "SELECT t1.*, t3.userid as report_owner, t2.filter_name as report_name, " . "COUNT(t4.id_user) as num_users FROM " . $GLOBALS['prefix_lms'] . "_report_schedule as t1, " . $GLOBALS['prefix_lms'] . "_report_filter as t2, " . $GLOBALS['prefix_fw'] . "_user as t3, " . $GLOBALS['prefix_lms'] . "_report_schedule_recipient as t4 " . "WHERE t1.id_report_filter=t2.id_filter AND t3.idst=t1.id_creator " . "AND t4.id_report_schedule=t1.id_report_schedule " . $admin_cond . " " . ($idrep ? "AND t1.id_report_filter={$idrep} " : '') . "GROUP BY t1.id_report_schedule";
    $lang =& DoceboLanguage::createInstance('report', 'framework');
    $output = '';
    $tb = new Table(Get::sett('visu_course'));
    $tb->initNavBar('ini', 'button');
    $col_type = array('align_center', 'align_center', 'align_center', 'align_center', 'align_center', 'align_center');
    //,'image','image');
    $col_content = array($lang->def('_NAME'), $lang->def('_TAB_REP_CREATOR'), $lang->def('_CREATION_DATE'), $lang->def('_SEND'), $lang->def('_RECIPIENTS'), $lang->def('_ACTIVE'));
    if ($can_mod) {
        $col_type[] = 'image';
        $col_type[] = 'image';
        $col_content[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD', 'standard') . '" title="' . $lang->def('_MOD') . '" />';
        $col_content[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL', 'standard') . '" title="' . $lang->def('_DEL') . '" />';
    }
    $tb->setColsStyle($col_type);
    $tb->addHead($col_content);
    $res = sql_query($query);
    if ($res) {
        while ($row = mysql_fetch_assoc($res)) {
            $id = $row['id_report_schedule'];
            $recipients_link = "ajax.adm_server.php?mn=report&amp;plf=lms&amp;op=show_recipients_window&amp;idsched=" . $id;
            $mod_link = '<a href="index.php?modname=report&amp;op=sched_mod&amp;id_sched=' . $id . '&amp;idrep=' . $idrep . '" ' . ' title="' . $lang->def('_MOD') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />' . '</a>';
            $rem_link = '<a href="index.php?modname=report&amp;op=schedulelist&amp;idrep=' . $idrep . '&amp;action=sched_rem&amp;id_sched=' . $id . '" ' . ' title="' . $lang->def('_DEL') . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />' . '</a>';
            $enabled = '<image class="handover" src="' . getPathImage('lms') . 'standard/' . ($row['enabled'] == 1 ? 'publish.png' : 'unpublish.png') . '" ' . 'onclick="enable_schedulation(this, ' . $row['id_report_schedule'] . ');" />' . '<input type="hidden" id="enable_value_' . $row['id_report_schedule'] . '" ' . 'value="' . ($row['enabled'] == 1 ? '0' : '1') . '" />';
            $num_users = '<a href="' . $recipients_link . '" title="' . $lang->def('_RECIPIENTS') . '" ' . 'class="" id="show_recipients_' . $id . '">' . $row['num_users'] . '</a>';
            $tb_content = array(_SCHED_KEY_NAME => $row['name'], _SCHED_KEY_CREATOR => $acl_man->relativeId($row['report_owner']), _SCHED_KEY_CREATION => Format::date($row['creation_date']), _SCHED_KEY_PERIOD => get_period_text($row['period']), _SCHED_KEY_NUMUSER => $num_users, _SCHED_KEY_ENABLED => $enabled);
            if ($can_mod) {
                $tb_content[_SCHED_KEY_MOD] = $mod_link;
                $tb_content[_SCHED_KEY_REM] = $rem_link;
            }
            $tb->addBody($tb_content);
        }
    }
    $tb->addActionAdd('
		<a href="index.php?modname=report&amp;op=report_schedule&amp;idrep=' . $idrep . '">' . '<img src="' . getPathImage() . 'standard/add.png" ' . 'title="' . $lang->def('_ADD') . '" /> ' . $lang->def('_ADD') . '</a>');
    $output .= $tb->getTable();
    $output .= '<script type="text/javascript">
		YAHOO.util.Event.onDOMReady(function() {
			var links = YAHOO.util.Selector.query("a[id^=show_recipients_]");
			YAHOO.util.Event.addListener(links, "click", function(e) {
				CreateDialog("show_recipients_dialog", {
					width: "600px",
					modal: true,
					close: true,
					visible: false,
					fixedcenter: false,
					constraintoviewport: false,
					draggable: true,
					hideaftersubmit: true,
					isDynamic: true,
					confirmOnly: true,
					ajaxUrl: this.href
				}).call(this, e);
			});
		});
	</script>';
    return $output;
}
Example #9
0
function webpages()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $mod_perm = checkPerm('mod', true);
    $lang =& DoceboLanguage::createInstance('admin_webpages', 'lms');
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $tb = new Table(0, $lang->def('_WEBPAGES_CAPTION'));
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0, 'button');
    $ini = $nav_bar->getSelectedElement();
    //search query
    $query_pages = "\r\n\tSELECT idPages, title, publish, in_home, sequence \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_webpages \r\n\tORDER BY sequence \r\n\tLIMIT {$ini}," . Get::sett('visuItem');
    $num_query_pages = "\r\n\tSELECT COUNT(*) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_webpages ";
    //do query
    $re_pages = sql_query($query_pages);
    list($tot_pages) = sql_fetch_row(sql_query($num_query_pages));
    $nav_bar->setElementTotal($tot_pages);
    //-Table---------------------------------------------------------
    $cont_h = array($lang->def('_TITLE'), '<img src="' . getPathImage() . 'webpages/home.png" alt="' . $lang->def('_ALT_HOME') . '" title="' . $lang->def('_TITLE_HOME') . '" />', '<img src="' . getPathImage() . 'standard/publish.png" alt="' . $lang->def('_PUBLISH') . '" title="' . $lang->def('_STATUS') . '" />');
    $type_h = array('', 'image', 'image', 'image');
    if ($mod_perm) {
        $cont_h[] = '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . '" title="' . $lang->def('_MOVE_DOWN') . '" />';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . '" title="' . $lang->def('_MOVE_UP') . '" />';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '" />';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" title="' . $lang->def('_DEL') . '" />';
        $type_h[] = 'image';
    }
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    $i = 1;
    while (list($id, $title, $publish, $in_home) = sql_fetch_row($re_pages)) {
        $cont = array($title, $in_home ? '<img src="' . getPathImage() . 'webpages/home.png" alt="' . $lang->def('_ALT_HOME') . '" title="' . $lang->def('_TITLE_HOME') . '" />' : '');
        if ($publish) {
            $cont[] = '<a href="index.php?modname=webpages&amp;op=unpublish&amp;id_page=' . $id . '" title="' . $lang->def('_PUBLISH') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/publish.png" alt="' . $lang->def('_PUBLISH') . ' : ' . $title . '" /></a>';
        } else {
            $cont[] = '<a href="index.php?modname=webpages&amp;op=publish&amp;id_page=' . $id . '" title="' . $lang->def('_UNPUBLISH') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/unpublish.png" alt="' . $lang->def('_UNPUBLISH') . ' : ' . $title . '" /></a>';
        }
        if ($mod_perm) {
            if ($i != $tot_pages - $ini * Get::sett('visuItem')) {
                $cont[] = '<a href="index.php?modname=webpages&amp;op=movedown&amp;id_page=' . $id . '" title="' . $lang->def('_MOVE_DOWN') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . ' : ' . $title . '" /></a>';
            } else {
                $cont[] = '&nbsp;';
            }
            if ($i != 1 || $ini != 0) {
                $cont[] = '<a href="index.php?modname=webpages&amp;op=moveup&amp;id_page=' . $id . '" title="' . $lang->def('_MOVE_UP') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . ' : ' . $title . '" /></a>';
            } else {
                $cont[] = '&nbsp;';
            }
            $cont[] = '<a href="index.php?modname=webpages&amp;op=modpages&amp;id_page=' . $id . '" title="' . $lang->def('_MOD') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $title . '" /></a>';
            $cont[] = '<a href="index.php?modname=webpages&amp;op=delpages&amp;id_page=' . $id . '" title="' . $lang->def('_DEL') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $title . '" /></a>';
        }
        $tb->addBody($cont);
        ++$i;
    }
    if ($mod_perm) {
        $tb->addActionAdd('<a class="ico-wt-sprite subs_add" href="index.php?modname=webpages&amp;op=addpages" title="' . Lang::t('_ADD', 'webpages') . '"><span>' . Lang::t('_ADD', 'webpages') . '</span></a>');
    }
    //visualize result
    $out->add(getTitleArea($lang->def('_TITLE_WEBPAGES'), 'webpages') . '<div class="std_block">');
    if (isset($_GET['result'])) {
        switch ($_GET['result']) {
            case "ok":
                $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
            case "err":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
            case "err_del":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
        }
    }
    $out->add($tb->getTable() . Form::openForm('nav_webpages', 'index.php?modname=webpages&amp;op=webpages') . $nav_bar->getNavBar($ini) . Form::closeForm() . '</div>');
    if ($mod_perm) {
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=delpages]');
    }
}
Example #10
0
function assignMetaCertificate()
{
    checkPerm('mod');
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('certificate', 'lms');
    $id_certificate = importVar('id_certificate', true, 0);
    $_SESSION['meta_certificate'] = array();
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $tb = new Table(Get::sett('visuItem'), $lang->def('_META_CERTIFICATE_ASSIGN_CAPTION'), $lang->def('_META_CERTIFICATE_ASSIGN_CAPTION'));
    $tb->initNavBar('ini', 'link');
    $tb->setLink("index.php?modname=meta_certificate&amp;op=assign");
    $ini = $tb->getSelectedElement();
    $query = "SELECT idMetaCertificate, title, description" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta" . " WHERE idCertificate = '" . $id_certificate . "'";
    $result = sql_query($query);
    $type_h = array('', '', 'image', 'image', 'image', 'image');
    $cont_h = array($lang->def('_NAME'), $lang->def('_DESCRIPTION'), '<img src="' . getPathImage() . 'standard/view.png" alt="' . $lang->def('_DETAILS') . '" title="' . $lang->def('_DETAILS') . '" />', '<img src="' . getPathImage() . 'standard/modelem.png" alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '" />', '<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') . '"" />');
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    while (list($id_meta_certificate, $title, $description) = sql_fetch_row($result)) {
        $tb->addBody(array(stripslashes($title), stripslashes($description), '<a href="index.php?modname=meta_certificate&amp;op=viewdetails&amp;idmeta=' . $id_meta_certificate . '&amp;id_certificate=' . $id_certificate . '"><img src="' . getPathImage() . 'standard/view.png" alt="' . $lang->def('_DETAILS') . '" title="' . $lang->def('_DETAILS') . '" /></a>', '<a href="index.php?modname=meta_certificate&amp;op=modassignment&amp;idmeta=' . $id_meta_certificate . '&amp;id_certificate=' . $id_certificate . '"><img src="' . getPathImage() . 'standard/modelem.png" alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '" /></a>', '<a href="index.php?modname=meta_certificate&amp;op=modassignmetacertificate&amp;idmeta=' . $id_meta_certificate . '&amp;id_certificate=' . $id_certificate . '"><img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" /></a>', '<a href="index.php?modname=meta_certificate&amp;op=delassignmetacertificate&amp;idmeta=' . $id_meta_certificate . '&amp;id_certificate=' . $id_certificate . '"><img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" alt="' . $lang->def('_DEL') . '"" /></a>'));
    }
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=delassignmetacertificate]');
    $tb->addActionAdd('<a class="new_element_link" href="index.php?modname=meta_certificate&amp;op=new_assign&amp;id_certificate=' . $id_certificate . '" title="' . $lang->def('_NEW_ASSING_META_CERTIFICATE') . '">' . $lang->def('_NEW_ASSING_META_CERTIFICATE') . '</a>');
    $out->add(getTitleArea($lang->def('_TITLE_META_CERTIFICATE_ASSIGN'), 'certificate') . '<div class="std_block">');
    if (isset($_GET['result'])) {
        switch ($_GET['result']) {
            case "ok":
                $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
            case "err":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
            case "err_del":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
            case "err_info":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
            case "err_mod_info":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
            case "error_mod_assign":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
        }
    }
    $out->add($tb->getTable() . $tb->getNavBar($ini, sql_num_rows($result)) . getBackUi('index.php?modname=meta_certificate&amp;op=meta_certificate', $lang->def('_BACK')) . '</div>');
}
Example #11
0
 function pathelem()
 {
     checkPerm('view');
     require_once _base_ . '/lib/lib.table.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php';
     $lang =& DoceboLanguage::createInstance('coursepath', 'lms');
     $id_path = importVar('id_path', true, 0);
     $mod_perm = checkPerm('mod', true);
     $path_man = new CoursePath_Manager();
     $course_man = new Man_Course();
     $path = $path_man->getCoursepathInfo($id_path);
     // retriving id of the courses in this path
     $slots = $path_man->getPathSlot($id_path);
     $courses = $path_man->getPathElem($id_path);
     // retrive all i need about courses name
     if (isset($courses['course_list'])) {
         $course_info = $course_man->getAllCourses(false, 'all', $courses['course_list']);
     } else {
         $course_info = array();
     }
     $area_title = array('index.php?modname=coursepath&amp;op=pathlist' => $lang->def('_COURSEPATH'), $path['path_name']);
     $GLOBALS['page']->add(getTitleArea($area_title, 'coursepath') . '<div class="std_block">' . getBackUi('index.php?modname=coursepath&amp;op=pathlist', $lang->def('_BACK')), 'content');
     if (isset($_GET['result'])) {
         switch ($_GET['result']) {
             case "ok":
                 $GLOBALS['page']->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')), 'content');
                 break;
             case "err":
                 $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE')), 'content');
                 break;
         }
     }
     $tb_path = new Table(0, $lang->def('_COURSE_PATH_COURSES_CAPTION'), $lang->def('_COURSE_PATH_COURSES_CAPTION'));
     $cont_h = array($lang->def('_CODE'), $lang->def('_COURSE_NAME'), $lang->def('_PREREQUISITES'));
     $type_h = array('coursepath_code', 'coursepath_name', '', 'image');
     if ($mod_perm) {
         $cont_h[] = Get::img('standard/down.png', Lang::t('_DOWN', 'coursepath'));
         $type_h[] = 'image';
         $cont_h[] = Get::img('standard/up.png', Lang::t('_UP', 'coursepath'));
         $type_h[] = 'image';
         $cont_h[] = Get::img('standard/moderate.png', Lang::t('_MOD', 'coursepath'));
         $type_h[] = 'image';
         $cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />';
         $type_h[] = 'image';
     }
     $tb_path->setColsStyle($type_h);
     $tb_path->addHead($cont_h);
     $slot_number = 0;
     foreach ($slots as $id_slot => $slot_info) {
         $tb_path->emptyBody();
         $tb_path->emptyFoot();
         $i = 0;
         if (!isset($courses[$id_slot])) {
             $num_course = 0;
         } else {
             $num_course = count($courses[$id_slot]);
             $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());
                 $all_course = false;
                 if (isset($admin_courses['course'][0])) {
                     $all_course = 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 CoursePath_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);
                 }
             }
             while (list($id_item, $prerequisites) = each($courses[$id_slot])) {
                 $cont = array($course_info[$id_item]['code'], $course_info[$id_item]['name']);
                 if ($prerequisites != '') {
                     $cont[] = coursePathSubstPrer($prerequisites, $course_info);
                 } else {
                     $cont[] = '';
                 }
                 if ($mod_perm) {
                     if (in_array($id_item, $admin_courses['course']) || $all_courses) {
                         if ($i != $num_course - 1) {
                             $cont[] = '<a href="index.php?modname=coursepath&amp;op=downelem&amp;id_path=' . $id_path . '&amp;id_course=' . $id_item . '&amp;id_slot=' . $id_slot . '" ' . 'title="' . $lang->def('_MOVE_DOWN') . ' : ' . $course_info[$id_item]['name'] . '">' . Get::img('standard/down.png', Lang::t('_DOWN', 'coursepath')) . '</a>';
                         } else {
                             $cont[] = '';
                         }
                         if ($i != 0) {
                             $cont[] = '<a href="index.php?modname=coursepath&amp;op=upelem&amp;id_path=' . $id_path . '&amp;id_course=' . $id_item . '&amp;id_slot=' . $id_slot . '" ' . 'title="' . $lang->def('_MOVE_UP') . ' : ' . $course_info[$id_item]['name'] . '">' . Get::img('standard/up.png', Lang::t('_UP', 'coursepath')) . '</a>';
                         } else {
                             $cont[] = '';
                         }
                         $cont[] = '<a href="index.php?modname=coursepath&amp;op=modprerequisites&amp;id_path=' . $id_path . '&amp;id_course=' . $id_item . '&amp;id_slot=' . $id_slot . '" ' . 'title="' . $lang->def('_MOD') . ' : ' . $course_info[$id_item]['name'] . '">' . Get::img('standard/moderate.png', Lang::t('_MOD', 'coursepath') . ' : ' . $course_info[$id_item]['name']) . '</a>';
                         $cont[] = '<a href="index.php?modname=coursepath&amp;op=delcoursepath&amp;id_path=' . $id_path . '&amp;id_course=' . $id_item . '&amp;id_slot=' . $id_slot . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . $course_info[$id_item]['name'] . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $course_info[$id_item]['name'] . '" /></a>';
                     } else {
                         $cont[] = '';
                         $cont[] = '';
                         $cont[] = '';
                         $cont[] = '';
                     }
                 }
                 $tb_path->addBody($cont);
                 $i++;
             }
         }
         // add link
         if ($mod_perm) {
             $tb_path->addActionAdd('<a class="ico-wt-sprite subs_import" href="index.php?modname=coursepath&amp;op=importcourse&amp;load=1&amp;id_path=' . $id_path . '&amp;id_slot=' . $id_slot . '" ' . 'title="' . $lang->def('_IMPORT_COURSE') . '">' . '<span>' . $lang->def('_IMPORT_COURSE') . '</span>' . '</a>');
         }
         $GLOBALS['page']->add($tb_path->getTable() . '<br />', 'content');
         $slot_number++;
     }
     /*
     $GLOBALS['page']->add(
     	'<a href="index.php?modname=coursepath&amp;op=modslot&amp;id_path='.$id_path.'" '
     		.'title="'.$lang->def('_NEW_SLOT_TITLE').'">'
     		.'<img src="'.getPathimage().'standard/add.png" alt="'.$lang->def('_ADD').'" />'
     		.$lang->def('_NEW_SLOT')
     	.'</a>'
     ,'content');
     */
     $GLOBALS['page']->add(getBackUi('index.php?modname=coursepath&amp;op=pathlist', $lang->def('_BACK')) . '</div>', 'content');
 }
Example #12
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 #13
0
function modrule(&$url)
{
    checkPerm('mod');
    YuiLib::load(array('animation' => 'animation-min.js', 'dragdrop' => 'dragdrop-min.js', 'button' => 'button-min.js', 'container' => 'container-min.js', 'my_window' => 'windows.js'), array('container/assets/skins/sam' => 'container.css', 'button/assets/skins/sam' => 'button.css'));
    addJs($GLOBALS['where_lms_relative'] . '/admin/modules/preassessment/', 'ajax.preassessment.js');
    $id_assessment = importVar('id_assess', true, 0);
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    $course_man = new Man_Course();
    require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php';
    $coursepath_man = new CoursePath_Manager();
    require_once $GLOBALS['where_lms'] . '/lib/lib.preassessment.php';
    $assess_man = new AssessmentList();
    $rule_man = new AssessmentRule();
    $lang =& DoceboLanguage::createInstance('preassessment');
    // recover assessment
    $assessment = $assess_man->getAssessment($id_assessment);
    $rule_list = $rule_man->getAllRule($id_assessment);
    // recover new type one
    require_once _base_ . '/lib/lib.table.php';
    $tb = new Table(0, $lang->def('_CAPTION_PREASSESSMENT_RULE'), $lang->def('_SUMMARY_PREASSESSMENT_RULE'));
    // table header --------------------------------------------------------------------------------------------
    $cont_h = array($lang->def('_RULE_TEXT'), $lang->def('_RULE_ACTION'), '<img src="' . getPathImage('lms') . 'standard/modelem.png" alt="' . $lang->def('_ALT_ADD_EFFECT') . '" />', '<img src="' . getPathImage('lms') . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage('lms') . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />');
    $type_h = array('nowrap', '', 'image', 'image', 'image');
    $usedef = 1;
    $tb->addHead($cont_h, $type_h);
    while ($rule = $rule_man->fetch_row($rule_list)) {
        $id = $rule[RULE_ID];
        if ($rule[RULE_TYPE] == RULE_DEFAULT) {
            $usedef = 0;
        }
        $rule_name = $rule_man->resolveRuleTypePhrase($lang, $rule);
        $cont = array($rule_name);
        $effect = '';
        $effects = $rule_man->parseEffects($rule[RULE_EFFECT]);
        if (count($effects['course']) > 0) {
            $effect .= $lang->def('_COURSES') . ': ' . $course_man->listCourseName($effects['course']);
        }
        if (count($effects['coursepath']) > 0) {
            if (count($effects['course']) > 0) {
                $effect .= '<br/>';
            }
            $path_list =& $coursepath_man->getNames($effects['coursepath']);
            $effect .= $lang->def('_COURSEPATH') . ': ' . implode(', ', $path_list);
        }
        if (count($effects['course']) == 0 && count($effects['coursepath']) == 0) {
            $effect = $lang->def('_DO_NOTHING');
        }
        $cont[] = $effect;
        $cont[] = '<a href="' . $url->getUrl('op=assignrule&id_rule=' . $id . '&load=1') . '" title=""' . $lang->def('_ADD_EFFECT') . '">' . '<img src="' . getPathImage('lms') . 'standard/modelem.png" alt="' . $lang->def('_ALT_ADD_EFFECT') . '" />' . '</a>';
        $cont[] = '<a href="' . $url->getUrl('op=modrulet&id_rule=' . $id) . '" title="' . $lang->def('_MOD_TITLE') . '"' . '" onclick="mod_rule_mask(\'' . $id_assessment . '\', \'' . $id . '\'); return false;"' . '>' . '<img src="' . getPathImage('lms') . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />' . '</a>';
        $cont[] = '<a href="' . $url->getUrl('op=delrule&id_rule=' . $id) . '" title="' . $lang->def('_DEL') . ': ' . $rule_name . '"' . '	onclick="del_assessment_rule(\'' . $id . '\', \'' . strip_tags($rule_name) . '\'); return false;"' . '>' . '<img src="' . getPathImage('lms') . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />' . '</a>';
        $tb->addBody($cont);
    }
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=delrule]');
    $tb->addActionAdd('<a class="new_element_link" ' . ' 	onclick="add_rule_mask(\'' . $id_assessment . '\', \'' . $usedef . '\'); return false;"' . ' id="add_rule" ' . 'href="#" ' . '>' . $lang->def('_ADD_RULE') . '</a>');
    $GLOBALS['page']->add('<script type="text/javascript">' . 'YAHOO.util.Event.onDOMReady( function(e) {' . ' setup_assessment(); ' . ' YAHOO.util.Event.addListener("add_rule", "click", function(e) { add_rule_mask(\'' . $id_assessment . '\', \'' . $usedef . '\'); });' . '});' . '</script>', 'page_head');
    $GLOBALS['page']->add(getTitleArea(array($url->getUrl() => $lang->def('_ASSESSMENT'), $lang->def('_RULES') . ': ' . $assessment['name']), 'preassessment') . '<div class="std_block">' . getInfoUi($lang->def('_RULE_OVERLAPPED')), 'content');
    if (isset($_GET['result'])) {
        $GLOBALS['page']->add(guiResultStatus($lang, $_GET['result']), 'content');
    }
    $GLOBALS['page']->add($tb->getTable(), 'content');
    $GLOBALS['page']->add(getBackUi($url->getUrl(), $lang->def('_BACK')) . '</div>', 'content');
}
Example #14
0
 function classroom()
 {
     checkPerm('view');
     require_once _base_ . '/lib/lib.form.php';
     require_once _base_ . '/lib/lib.table.php';
     $mod_perm = true;
     // create a language istance for module admin_classroom
     $lang =& DoceboLanguage::createInstance('admin_classroom', 'lms');
     $out =& $GLOBALS['page'];
     $out->setWorkingZone('content');
     $tb = new Table(Get::sett('visuItem'), $lang->def('_CLASSROOM_CAPTION'), $lang->def('_CLASSROOM_SUMMARY'));
     $tb->initNavBar('ini', 'link');
     $tb->setLink('index.php?modname=reservation&amp;op=classroom&amp;id_course=' . $_SESSION['idCourse']);
     $ini = $tb->getSelectedElement();
     //search query of classrooms
     $query_classroom = "\r\n\t\tSELECT idClassroom, name, description\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_classroom\r\n\t\tORDER BY name\r\n\t\tLIMIT {$ini}," . Get::sett('visuItem');
     $query_classroom_tot = "\r\n\t\tSELECT COUNT(*)\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_classroom";
     $re_classroom = sql_query($query_classroom);
     list($tot_classroom) = sql_fetch_row(sql_query($query_classroom_tot));
     $type_h = array('', 'news_short_td', "image", "image");
     $cont_h = array($lang->def('_NAME'), $lang->def('_DESCRIPTION'));
     if ($mod_perm) {
         $cont_h[] = '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_TITLE_MOD_CLASSROOM') . '" ' . 'alt="' . $lang->def('_MOD') . '" />';
         $type_h[] = 'image';
         $cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" ' . 'alt="' . $lang->def('_DEL') . '"" />';
         $type_h[] = 'image';
     }
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     while (list($idClassroom, $name, $descr) = sql_fetch_row($re_classroom)) {
         $cont = array($name, $descr);
         if ($mod_perm) {
             $cont[] = '<a href="index.php?modname=reservation&amp;op=modclassroom&amp;idClassroom=' . $idClassroom . '" ' . 'title="' . $lang->def('_TITLE_MOD_CLASSROOM') . ' : ' . $name . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $name . '" /></a>';
             $cont[] = '<a href="index.php?modname=reservation&amp;op=delclassroom&amp;idClassroom=' . $idClassroom . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . $name . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $name . '" /></a>';
         }
         $tb->addBody($cont);
     }
     if ($mod_perm) {
         $tb->addActionAdd('<a href="index.php?modname=reservation&amp;op=addclassroom" title="' . $lang->def('_TITLE_NEW_CLASSROOM') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_NEW_CLASSROOM') . '</a>');
     }
     $out->add(getTitleArea($lang->def('_TITLE_CLASSROOM'), 'classroom', $lang->def('_ALT_TITLE_CLASSROOM')) . '<div class="std_block">');
     if (isset($_GET['result'])) {
         switch ($_GET['result']) {
             case "ok":
                 $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                 break;
             case "err":
                 $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                 break;
             case "err_del":
                 $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                 break;
         }
     }
     $out->add(getBackUi('index.php?modname=reservation&amp;op=reservation&amp;active_tab=subscribed_user', $lang->def('_BACK')));
     $out->add($tb->getTable() . $tb->getNavBar($ini, $tot_classroom) . '</div>');
 }
Example #15
0
function news()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.navbar.php';
    $mod_perm = checkPerm('mod', true);
    $lang =& DoceboLanguage::createInstance('admin_news', 'lms');
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $tb = new Table(Get::sett('visuItem'), $lang->def('_NEWS'), $lang->def('_NEWS_SUMMARY'));
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0, 'link');
    $ini = $nav_bar->getSelectedElement();
    //search query
    $query_news = "\r\n\tSELECT idNews, publish_date, title, short_desc, important\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_news_internal\r\n\tORDER BY important DESC, publish_date DESC\r\n\tLIMIT {$ini}," . Get::sett('visuItem');
    $query_news_tot = "\r\n\tSELECT COUNT(*)\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_news_internal ";
    $re_news = sql_query($query_news);
    list($tot_news) = sql_fetch_row(sql_query($query_news_tot));
    $nav_bar->setElementTotal($tot_news);
    $impo_gif = '<img src="' . getPathImage('lms') . 'standard/important.png" ' . 'title="' . $lang->def('_TITLE_IMPORTANT') . '" ' . 'alt="' . $lang->def('_IMPORTANT') . '" />';
    $type_h = array('image', '', '', 'news_short_td');
    $cont_h = array($impo_gif, $lang->def('_DATE'), $lang->def('_TITLE'), $lang->def('_SHORTDESC'));
    if ($mod_perm) {
        $cont_h[] = '<img src="' . getPathImage() . 'standard/moduser.png" title="' . $lang->def('_RECIPIENTS') . '" ' . 'alt="' . $lang->def('_RECIPIENTS') . '" />';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" ' . 'alt="' . $lang->def('_MOD') . '" />';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" ' . 'alt="' . $lang->def('_DEL') . '"" />';
        $type_h[] = 'image';
    }
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    while (list($id_news, $publish_date, $title, $short_desc, $impo) = sql_fetch_row($re_news)) {
        $cont = array($impo ? $impo_gif : '', Format::date($publish_date), $title, Util::cut($short_desc));
        if ($mod_perm) {
            $cont[] = '<a href="index.php?modname=internal_news&amp;op=editviewer&amp;load=1&amp;id_news=' . $id_news . '" ' . 'title="' . $lang->def('_RECIPIENTS') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/moduser.png" alt="' . $lang->def('_RECIPIENTS') . ' : ' . $title . '" /></a>';
            $cont[] = '<a href="index.php?modname=internal_news&amp;op=modnews&amp;id_news=' . $id_news . '" ' . 'title="' . $lang->def('_MOD') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $title . '" /></a>';
            $cont[] = '<a href="index.php?modname=internal_news&amp;op=delnews&amp;id_news=' . $id_news . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $title . '" /></a>';
        }
        $tb->addBody($cont);
    }
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=delnews]');
    if ($mod_perm) {
        $tb->addActionAdd('<a href="index.php?modname=internal_news&amp;op=addnews" title="' . $lang->def('_NEW') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_NEW') . '</a>');
    }
    $out->add(getTitleArea($lang->def('_NEWS'), 'news') . '<div class="std_block">');
    if (isset($_GET['result'])) {
        switch ($_GET['result']) {
            case "ok":
                $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
            case "err":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
            case "err_del":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
        }
    }
    if ($mod_perm) {
        $form = new Form();
        $how_much = Get::sett('visuNewsHomePage');
        if (isset($_POST['save_homepage'])) {
            $query_how_news = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_setting\r\n\t\t\tSET param_value = '" . abs((int) $_POST['howmuch']) . "'\r\n\t\t\tWHERE param_name = 'visuNewsHomePage'";
            if (sql_query($query_how_news)) {
                $how_much = abs((int) $_POST['howmuch']);
            }
        }
    }
    $out->add($tb->getTable() . $nav_bar->getNavBar($ini) . '</div>');
}
Example #16
0
function get_report_table($url = '')
{
    checkPerm('view');
    $can_mod = checkPerm('mod', true);
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $acl_man =& Docebo::user()->getACLManager();
    $level = Docebo::user()->getUserLevelId(Docebo::user()->getIdst());
    $lang =& DoceboLanguage::createInstance('report');
    $output = '';
    $is_admin = $level == ADMIN_GROUP_GODADMIN || $level == ADMIN_GROUP_ADMIN ? true : false;
    if ($is_admin || $can_mod) {
        //if ($can_mod) {
        cout('<script type="text/javascript">
		var _FAILURE = "error";
		var ajax_path = "' . Get::rel_path('lms') . '/ajax.adm_server.php?mn=report&plf=lms";

		function public_report(o, id_rep) {
			o.disabled=true; //no more operations allowed on the checkbox while ajaxing

			var val_el=document.getElementById("enable_value_"+id_rep);
			var value=val_el.value;

			var data = "&op=public_rep&id="+id_rep+"&val="+value;
			var objAjax = YAHOO.util.Connect.asyncRequest("POST", ajax_path+data, {
			success:function(t) {
				var temp=o.src;
				if (value==1)	{ o.src=temp.replace("unpublish.png", "publish.png"); val_el.value=0; }
				if (value==0)	{ o.src=temp.replace("publish.png", "unpublish.png"); val_el.value=1; }
					o.disabled=false;
				},
			failure:function(t) {
					o.disabled=false;
					alert(_FAILURE); //...
				} });
			}

			function setReportFilter() {
				var el = document.createElement("INPUT");
				el.type = "hidden";
				el.name = "search";
				el.value = "1";
				var form = YAHOO.util.Dom.get("report_searchbox_form");
				if (form) {
					form.appendChild(el);
					form.submit();
				}
			}
		</script>', 'page_head');
    }
    //filter by author
    YuiLib::load();
    $current_user = $acl_man->getUser(Docebo::user()->getIdst(), false);
    //dropdown data arrays
    $authors = array(0 => '(' . $lang->def('_ALL') . ')', $current_user[ACL_INFO_IDST] => $acl_man->relativeId($current_user[ACL_INFO_USERID]));
    $query = "SELECT u.idst, u.userid FROM %lms_report_filter as r JOIN %adm_user as u ON (r.author=u.idst) WHERE u.idst<>" . Docebo::user()->getIdst() . " ORDER BY u.userid";
    $res = sql_query($query);
    while ($row = sql_fetch_assoc($res)) {
        $authors[$row['idst']] = $acl_man->relativeId($row['userid']);
    }
    $arr_report_types = array(0 => '(' . $lang->def('_ALL') . ')');
    //initializa session variable for filters
    if (!isset($_SESSION['report_admin_filter'])) {
        $_SESSION['report_admin_filter'] = array('author' => 0, 'name' => '', 'type' => 0);
    }
    if (Get::req('search', DOTY_MIXED, false) !== false) {
        $_SESSION['report_admin_filter']['author'] = Get::req('filter_author', DOTY_INT, (int) $_SESSION['report_admin_filter']['author']);
        $_SESSION['report_admin_filter']['name'] = Get::req('filter_name', DOTY_STRING, $_SESSION['report_admin_filter']['name']);
        $_SESSION['report_admin_filter']['type'] = Get::req('filter_type', DOTY_INT, (int) $_SESSION['report_admin_filter']['type']);
    }
    if (Get::req('reset', DOTY_MIXED, false) !== false) {
        $_SESSION['report_admin_filter']['author'] = 0;
        $_SESSION['report_admin_filter']['name'] = '';
        $_SESSION['report_admin_filter']['type'] = 0;
    }
    $dropdown_onclick = 'onchange="javascript:setReportFilter();"';
    $output .= Form::openForm('report_searchbox_form', 'index.php?modname=report&op=reportlist&of_platform=lms', false, 'POST');
    $output .= Form::getHidden('op', 'op', 'reportlist');
    $output .= Form::getHidden('modname', 'modname', 'report');
    $output .= '<div class="quick_search_form">
			<div>
				<div class="simple_search_box" id="report_searchbox_simple_filter_options" style="display: block;">' . Form::getInputDropdown('dropdown', 'report_searchbox_filter_author', 'filter_author', $authors, $_SESSION['report_admin_filter']['author'], $dropdown_onclick) . "&nbsp;&nbsp;&nbsp;" . Form::getInputTextfield("search_t", "report_searchbox_filter_name", "filter_name", $_SESSION['report_admin_filter']['name'], '', 255, '') . Form::getButton("report_searchbox_filter_set", "search", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("report_searchbox_filter_reset", "reset", Lang::t('_RESET', 'standard'), "reset_b") . '</div>
			</div>
		</div>';
    $output .= Form::closeForm();
    //end filter
    //compose search query
    $qconds = array();
    $query = "SELECT t1.*, t2.userid FROM %lms_report_filter as t1 LEFT JOIN %adm_user as t2 ON t1.author=t2.idst ";
    switch ($level) {
        case ADMIN_GROUP_GODADMIN:
            if ($_SESSION['report_admin_filter']['author'] > 0) {
                $qconds[] = " t1.author = " . $_SESSION['report_admin_filter']['author'] . " ";
            }
            break;
        case ADMIN_GROUP_ADMIN:
        case ADMIN_GROUP_PUBLICADMIN:
        case ADMIN_GROUP_USER:
        default:
            if ($_SESSION['report_admin_filter']['author'] > 0) {
                $qconds[] = " ( t1.author = " . $_SESSION['report_admin_filter']['author'] . " AND t1.is_public = 1 ) ";
            } else {
                $qconds[] = " ( t1.author = " . Docebo::user()->getIdst() . " OR t1.is_public = 1 ) ";
            }
            break;
    }
    if (trim($_SESSION['report_admin_filter']['name']) != "") {
        $qconds[] = " t1.filter_name LIKE '%" . $_SESSION['report_admin_filter']['name'] . "%' ";
    }
    if (trim($_SESSION['report_admin_filter']['type']) > 0) {
        //$qconds[] = " t1.filter_name LIKE '".$_SESSION['report_admin_filter']['name']."' ";
    }
    if (!empty($qconds)) {
        $query .= " WHERE " . implode(" AND ", $qconds);
    }
    //$_SESSION['report_admin_filter']['type']
    //end query
    $tb = new Table(Get::sett('visu_course'));
    $tb->initNavBar('ini', 'button');
    $col_type = array('', '', 'align_center', 'image', 'image', 'img-cell', 'img-cell', 'image');
    //,'image','image');
    $col_content = array($lang->def('_NAME'), $lang->def('_TAB_REP_CREATOR'), $lang->def('_CREATION_DATE'), $lang->def('_TAB_REP_PUBLIC'), '<img src="' . getPathImage() . 'standard/view.png" alt="' . $lang->def('_VIEW') . '" title="' . $lang->def('_VIEW') . '" />', '<span class="ico-sprite subs_csv"><span>' . Lang::t('_EXPORT_CSV', 'report') . '</span></span>', '<span class="ico-sprite subs_xls"><span>' . Lang::t('_EXPORT_XLS', 'report') . '</span></span>', '<img src="' . getPathImage() . 'standard/wait_alarm.png" alt="' . $lang->def('_SCHEDULE') . '" title="' . $lang->def('_SCHEDULE') . '" />');
    if ($is_admin || $can_mod) {
        $col_type[] = 'image';
        $col_type[] = 'image';
        $col_content[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '" />';
        $col_content[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" title="' . $lang->def('_DEL') . '" />';
    }
    $tb->setColsStyle($col_type);
    $tb->addHead($col_content);
    if ($res = sql_query($query)) {
        while ($row = sql_fetch_assoc($res)) {
            $id = $row['id_filter'];
            $opn_link = '<a href="index.php?modname=report&amp;op=show_results&amp;idrep=' . $id . '" ' . ' title="' . $lang->def('_VIEW') . '">' . '<img src="' . getPathImage() . 'standard/view.png" alt="' . $lang->def('_VIEW') . '" />' . '</a>';
            $sch_link = '<a href="index.php?modname=report&amp;op=schedulelist&amp;idrep=' . $id . '" ' . ' title="' . $lang->def('_SCHEDULE') . '">' . '<img src="' . getPathImage() . 'standard/wait_alarm.png" alt="' . $lang->def('_SCHEDULE') . '" />' . '</a>';
            $mod_link = '<a href="' . $url . '&amp;action=modify&amp;idrep=' . $id . '" ' . ' title="' . $lang->def('_MOD') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />' . '</a>';
            $rem_link = '<a href="' . $url . '&amp;action=delete&amp;idrep=' . $id . '" ' . ' title="' . $lang->def('_DEL') . ' : ' . ($row['author'] == 0 ? $lang->def($row['filter_name']) : $row['filter_name']) . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />';
            //.
            '</a>';
            $can_public = $can_mod ? true : ($is_admin && $row['author'] == Docebo::user()->getIdst() ? true : false);
            $public = '<image ' . ($can_public ? 'class="handover"' : '') . ' src="' . getPathImage('lms') . 'standard/' . ($row['is_public'] == 1 ? '' : 'un') . 'publish.png' . '" ' . ($is_admin || $can_mod ? 'onclick="public_report(this, ' . $row['id_filter'] . ');" ' : '') . ' />' . '<input type="hidden" id="enable_value_' . $row['id_filter'] . '" ' . 'value="' . ($row['is_public'] == 1 ? '0' : '1') . '" />';
            $export_url = 'index.php?modname=report&op=show_results&idrep=' . (int) $id;
            $export_link_csv = '<a class="ico-sprite subs_csv" href="' . $export_url . '&dl=csv" title="' . Lang::t('_EXPORT_CSV', 'report') . '"><span></span>' . Lang::t('_EXPORT_CSV', 'report') . '</a>';
            $export_link_xls = '<a class="ico-sprite subs_xls" href="' . $export_url . '&dl=xls" title="' . Lang::t('_EXPORT_XLS', 'report') . '"><span></span>' . Lang::t('_EXPORT_XLS', 'report') . '</a>';
            $_name = $row['author'] == 0 ? $lang->def($row['filter_name']) : $row['filter_name'];
            if (trim($_SESSION['report_admin_filter']['name']) != "") {
                $_name = Layout::highlight($_name, $_SESSION['report_admin_filter']['name']);
            }
            $tb_content = array(_REP_KEY_NAME => $_name, _REP_KEY_CREATOR => $row['author'] == 0 ? '<div class="align_center">-</div>' : $acl_man->relativeId($row['userid']), _REP_KEY_CREATION => Format::date($row['creation_date']), _REP_KEY_PUBLIC => $public, _REP_KEY_OPEN => $opn_link, $export_link_csv, $export_link_xls, _REP_KEY_SCHED => $sch_link);
            if ($is_admin || $can_mod) {
                if ($row['author'] == Docebo::user()->getIdst() || $can_mod) {
                    $tb_content[_REP_KEY_MOD] = $mod_link;
                    $tb_content[_REP_KEY_REM] = $rem_link;
                } else {
                    $tb_content[_REP_KEY_MOD] = '&nbsp;';
                    $tb_content[_REP_KEY_REM] = '&nbsp;';
                }
            }
            $tb->addBody($tb_content);
        }
    }
    if ($is_admin || $can_mod) {
        //if ($can_mod) {
        $tb->addActionAdd('
			<a href="index.php?modname=report&amp;op=report_category">' . '<img src="' . getPathImage() . 'standard/add.png" ' . 'title="' . $lang->def('_NEW') . '" /> ' . $lang->def('_NEW') . '</a>');
    }
    $output .= $tb->getTable();
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=delete]');
    return $output;
}
Example #17
0
function manmenu()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $lang =& DoceboLanguage::createInstance('manmenu', 'framework');
    $mo_lang =& DoceboLanguage::createInstance('menu', 'lms');
    $mod_perm = checkPerm('mod', true);
    $query_voice = "\r\n\tSELECT idMain, name, image, sequence \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_menucourse_main \r\n\tWHERE idCourse = '" . (int) $_SESSION['idCourse'] . "'\r\n\tORDER BY sequence";
    $re_voice = sql_query($query_voice);
    $tot_voice = mysql_num_rows($re_voice);
    $tb = new Table(0, $lang->def('_TB_MANMENU_CAPTION'), $lang->def('_TB_MANMENU_SUMMARY'));
    $content_h = array($lang->def('_ORDER'), $lang->def('_TITLE_MENUVOICE'), '<img src="' . getPathImage() . 'standard/down.png" title="' . $lang->def('_MOVE_DOWN') . '" alt="' . $lang->def('_DOWN') . '" />', '<img src="' . getPathImage() . 'standard/up.png" title="' . $lang->def('_MOVE_UP') . '" alt="' . $lang->def('_UP') . '" />', '<img src="' . getPathImage() . 'standard/modelem.png" title="' . $lang->def('_MODMODULE') . '" alt="' . $lang->def('_MOD') . '" />');
    $type_h = array('image', '', 'image', 'image', 'image');
    if ($mod_perm) {
        $content_h[] = '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" />';
        $type_h[] = 'image';
        $content_h[] = '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" alt="' . $lang->def('_DEL') . '" />';
        $type_h[] = 'image';
    }
    $tb->setColsStyle($type_h);
    $tb->addHead($content_h);
    $i = 0;
    while (list($id_m, $name, $image, $sequence) = sql_fetch_row($re_voice)) {
        $strip_name = strip_tags(Lang::t($name, 'menu', false, false, $name));
        $content = array($sequence, '<a href="index.php?modname=manmenu&amp;op=manmodule&amp;id_main=' . $id_m . '"' . ' title="' . $lang->def('_MODMODULE') . '">' . Lang::t($name, 'menu', false, false, $name) . '</a>');
        // Up and Down action
        $content[] = $i != $tot_voice - 1 ? '<a href="index.php?modname=manmenu&amp;op=mdmenuvoice&amp;id_main=' . $id_m . '"' . ' title="' . $lang->def('_MOVE_DOWN') . ' : ' . $strip_name . '">' . '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . ' : ' . $strip_name . '" /></a>' : '';
        $content[] = $i != 0 ? '<a href="index.php?modname=manmenu&amp;op=mumenuvoice&amp;id_main=' . $id_m . '"' . ' title="' . $lang->def('_MOVE_UP') . ' : ' . $strip_name . '">' . '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . ' : ' . $strip_name . '" /></a>' : '';
        // Modify module
        $content[] = '<a href="index.php?modname=manmenu&amp;op=manmodule&amp;id_main=' . $id_m . '"' . ' title="' . $lang->def('_MODMODULE') . ' : ' . $strip_name . '">' . '<img src="' . getPathImage() . 'standard/modelem.png" alt="' . $lang->def('_MOD') . ' : ' . $strip_name . '" /></a>';
        if ($mod_perm) {
            // Modify voice
            $content[] = '<a href="index.php?modname=manmenu&amp;op=modmenuvoice&amp;id_main=' . $id_m . '"' . ' title="' . $lang->def('_MOD') . ' : ' . $strip_name . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $strip_name . '" /></a>';
            // Delete voice
            $content[] = '<a href="index.php?modname=manmenu&amp;op=delmenuvoice&amp;id_main=' . $id_m . '"' . ' title="' . $lang->def('_DEL') . ' : ' . $strip_name . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $strip_name . '" /></a>';
        }
        $tb->addBody($content);
        $i++;
    }
    if ($mod_perm) {
        $tb->addActionAdd('<a class="ico-wt-sprite subs_add" href="index.php?modname=manmenu&amp;op=addmenuvoice"' . ' title="' . $lang->def('_NEW') . '">' . '<span>' . $lang->def('_NEW') . '</span></a>');
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=delmenuvoice]');
    }
    // print out
    $page_title = array($lang->def('_TITLE_MANMENU'));
    $out->setWorkingZone('content');
    $out->add(getTitleArea($page_title, 'manmenu') . '<div class="std_block">');
    if (isset($_GET['result'])) {
        switch ($_GET['result']) {
            case 0:
                $out->add(getResultUi($lang->def('_OPERATION_FAILURE')));
                break;
            case 1:
                $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
        }
    }
    $out->add($tb->getTable() . '[ <a href="index.php?modname=manmenu&amp;op=fixmenuvoice" ' . 'title="' . $lang->def('_FIX_SEQUENCE') . '">' . $lang->def('_FIX_SEQUENCE') . '</a> ]' . '</div>');
}
Example #18
0
 function showCatItems($cat_id, $vis_item)
 {
     $res = "";
     require_once _base_ . '/lib/lib.table.php';
     $table_caption = $this->lang->def("_TABLE_FAQ_CAP");
     $table_summary = $this->lang->def("_TABLE_FAQ_SUM");
     $um =& UrlManager::getInstance();
     $tab = new Table($vis_item, $table_caption, $table_summary);
     if ($this->getTableStyle() !== FALSE) {
         $tab->setTableStyle($this->getTableStyle());
     }
     $head = array($this->lang->def("_TITLE"));
     $img = "<img src=\"" . getPathImage('fw') . "standard/down.png\" alt=\"" . $this->lang->def("_MOVE_DOWN") . "\" ";
     $img .= "title=\"" . $this->lang->def("_MOVE_DOWN") . "\" />";
     $head[] = $img;
     $img = "<img src=\"" . getPathImage('fw') . "standard/up.png\" alt=\"" . $this->lang->def("_MOVE_UP") . "\" ";
     $img .= "title=\"" . $this->lang->def("_MOVE_UP") . "\" />";
     $head[] = $img;
     $img = "<img src=\"" . getPathImage('fw') . "standard/edit.png\" alt=\"" . $this->lang->def("_MOD") . "\" ";
     $img .= "title=\"" . $this->lang->def("_MOD") . "\" />";
     $head[] = $img;
     $img = "<img src=\"" . getPathImage('fw') . "standard/delete.png\" alt=\"" . $this->lang->def("_DEL") . "\" ";
     $img .= "title=\"" . $this->lang->def("_DEL") . "\" />";
     $head[] = $img;
     $head_type = array("", "image", "image", "image", "image");
     $tab->setColsStyle($head_type);
     $tab->addHead($head);
     $tab->initNavBar('ini', 'link');
     $tab->setLink($um->getUrl());
     $ini = $tab->getSelectedElement();
     $data_info = $this->wikiManager->getCategoryItems($cat_id, $ini, $vis_item);
     $data_arr = $data_info["data_arr"];
     $db_tot = $data_info["data_tot"];
     $tot = count($data_arr);
     for ($i = 0; $i < $tot; $i++) {
         $id = $data_arr[$i]["faq_id"];
         $rowcnt = array();
         $rowcnt[] = $data_arr[$i]["title"];
         if ($ini + $i < $db_tot - 1) {
             $img = "<img src=\"" . getPathImage('fw') . "standard/down.png\" alt=\"" . $this->lang->def("_MOVE_DOWN") . "\" ";
             $img .= "title=\"" . $this->lang->def("_MOVE_DOWN") . "\" />";
             $url = $um->getUrl("op=movefaqdown&catid=" . $cat_id . "&faqid=" . $id);
             $rowcnt[] = "<a href=\"" . $url . "\">" . $img . "</a>\n";
         } else {
             $rowcnt[] = "&nbsp;";
         }
         if ($ini + $i > 0) {
             $img = "<img src=\"" . getPathImage('fw') . "standard/up.png\" alt=\"" . $this->lang->def("_MOVE_UP") . "\" ";
             $img .= "title=\"" . $this->lang->def("_MOVE_UP") . "\" />";
             $url = $um->getUrl("op=movefaqup&catid=" . $cat_id . "&faqid=" . $id);
             $rowcnt[] = "<a href=\"" . $url . "\">" . $img . "</a>\n";
         } else {
             $rowcnt[] = "&nbsp;";
         }
         $img = "<img src=\"" . getPathImage('fw') . "standard/edit.png\" alt=\"" . $this->lang->def("_MOD") . "\" ";
         $img .= "title=\"" . $this->lang->def("_MOD") . "\" />";
         $url = $um->getUrl("op=editfaq&catid=" . $cat_id . "&faqid=" . $id);
         $rowcnt[] = "<a href=\"" . $url . "\">" . $img . "</a>\n";
         $img = "<img src=\"" . getPathImage('fw') . "standard/delete.png\" alt=\"" . $this->lang->def("_DEL") . "\" ";
         $img .= "title=\"" . $this->lang->def("_DEL") . "\" />";
         $url = $um->getUrl("op=deletefaq&catid=" . $cat_id . "&faqid=" . $id);
         $rowcnt[] = "<a href=\"" . $url . "\">" . $img . "</a>\n";
         $tab->addBody($rowcnt);
     }
     $url = $um->getUrl("op=addfaq&catid=" . $cat_id);
     $tab->addActionAdd("<a class=\"new_element_link\" href=\"" . $url . "\">" . $this->lang->def('_ADD') . "</a>\n");
     $res = $tab->getTable() . $tab->getNavBar($ini, $db_tot);
     return $res;
 }
Example #19
0
function repoMyDetails(&$url, $passed_repo = 0)
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('light_repo');
    $file_man = new LightRepoManager(getLogUserId(), $_SESSION['idCourse']);
    $acl_man =& Docebo::user()->getAclManager();
    $id_repo = importVar('id_repo', true, $passed_repo);
    // recovering file repository information
    $repo = $file_man->getRepoDetails($id_repo);
    $file_man->setUserLastEnterInRepo($id_repo);
    $of_user = getLogUserId();
    $page_title = array($url->getUrl() => $lang->def('_TITLE_LIGHT_REPO'), $repo[LR_TITLE]);
    $file_list = $file_man->getRepoFileListOfAuthor($id_repo, $of_user);
    cout(getTitleArea($page_title, 'light_repo') . '<div class="std_block" id="light_repo_block">', 'content');
    if (isset($_GET['result'])) {
        switch ($_GET['result']) {
            case "file_ok":
                UIFeedback::info(Lang::t('_OPERATION_SUCCESSFUL', 'light_repo'));
                break;
            case "file_err":
                UIFeedback::error(Lang::t('_FILE_ERR', 'light_repo'));
                break;
        }
    }
    $table = new Table(0, $lang->def('_CAPTION_USER_FILE_LIST'), $lang->def('_SUMMARY_USER_FILE_LIST'));
    $content_h = array($lang->def('_FILENAME'), $lang->def('_DESCRIPTION'), $lang->def('_DATE'), '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />');
    $type_h = array('', '', '', 'image', 'image');
    $table->addHead($content_h, $type_h);
    $url->addToStdQuery('id_repo=' . $id_repo);
    while ($file = sql_fetch_row($file_list)) {
        // convert filename
        $file[LR_FILE_NAME] = implode('_', array_slice(explode('_', $file[LR_FILE_NAME]), 3));
        $content = array();
        $content[] = '' . '<a href="' . $url->getUrl('op=download_file&id_repo=' . $id_repo . '&id_file=' . $file[LR_FILE_ID]) . '" title="' . $lang->def('_DOWNLOAD') . '' . strip_tags($file[LR_FILE_NAME]) . '">' . '<img src="' . getPathImage() . 'standard/download.png" alt="' . $lang->def('_DOWNLOAD') . '" /> ' . $file[LR_FILE_NAME] . '</a>';
        $content[] = $file[LR_FILE_DESCR];
        $content[] = Format::date($file[LR_FILE_POSTDATE], 'datetime');
        //$content[] = $file[LR_FILE_DESCR];
        $content[] = '' . '<a href="' . $url->getUrl('op=mod_file&id_repo=' . $id_repo . '&id_file=' . $file[LR_FILE_ID]) . '"' . ' title="' . $lang->def('_MOD') . '' . strip_tags($file[LR_FILE_NAME]) . '">' . '<img src="' . getPathImage('fw') . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . strip_tags($file[LR_FILE_NAME]) . '" />' . '</a>';
        $content[] = '' . '<a href="' . $url->getUrl('op=del_file&id_repo=' . $id_repo . '&id_file=' . $file[LR_FILE_ID]) . '"' . ' title="' . $lang->def('_DEL') . '' . strip_tags($file[LR_FILE_NAME]) . '">' . '<img src="' . getPathImage('fw') . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . strip_tags($file[LR_FILE_NAME]) . '" />' . '</a>';
        $table->addBody($content, false, false, 'file_container_' . $file[LR_FILE_ID]);
    }
    $table->addActionAdd('<a class="dd_link" href="' . $url->getUrl('op=mod_file&id_repo=' . $id_repo) . '" title="' . $lang->def('_ADD_FILE') . '">' . $lang->def('_UPLOAD') . '</a>');
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=del_file]');
    cout($table->getTable(), 'content');
    cout('</div>', 'content');
}
Example #20
0
function field_list()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    //require_once(_i18n_.'/lib.lang.php');
    $back_coded = htmlentities(urlencode('index.php?modname=field_manager&op=field_list'));
    $std_lang =& DoceboLanguage::createInstance('standard', 'framework');
    $lang =& DoceboLanguage::createInstance('field', 'framework');
    $out =& $GLOBALS['page'];
    $filter = new Form();
    //find available field type
    $re_field = sql_query("\r\n\tSELECT type_field FROM " . $GLOBALS['prefix_fw'] . "_field_type ORDER BY type_field");
    $field_av = array();
    $field_select = array('all_field' => $lang->def('_ALL_FIELD_TYPE'));
    while (list($type_field) = sql_fetch_row($re_field)) {
        $field_av[] = $type_field;
        $field_select[] = $lang->def('_' . strtoupper($type_field));
    }
    $out->setWorkingZone('content');
    $out->add(getTitleArea($lang->def('_FIELD_MANAGER'), 'field_manager'));
    $out->add('<div class="std_block">');
    //catch possible operation result
    if (isset($_GET['result'])) {
        if ($_GET['result'] == 'success') {
            $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
        }
        if ($_GET['result'] == 'fail') {
            $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
        }
    }
    $ord = importVar('ord', false, 'trans');
    $flip = importVar('flip', true, 0);
    //filter------------------------------------------------------------
    $filter_type_field = importVar('filter_type_field', false, 'all_field');
    $filter_name_field = importVar('filter_name_field', false, $lang->def('_SEARCH'));
    $out->add($filter->openForm('field_filter', 'index.php?modname=field_manager&amp;op=field_list') . $filter->getOpenFieldset($lang->def('_SEARCH')) . $filter->getHidden('ord', 'ord', $ord) . $filter->getHidden('flip', 'flip', $flip) . $filter->getDropdown($lang->def('_FIELD_TYPE'), 'filter_type_field', 'filter_type_field', $field_select, $filter_type_field) . $filter->getTextfield($lang->def('_NAME'), 'filter_name_field', 'filter_name_field', '255', $filter_name_field) . $filter->openButtonSpace() . $filter->getButton('search', 'search', $std_lang->def('_SEARCH')) . $filter->closeButtonSpace() . $filter->getCloseFieldset() . $filter->closeForm());
    //display inserted field--------------------------------------------
    $tb_field = new Table(Get::sett('visuItem'));
    $query_field_display = "\r\n\tSELECT id_common, type_field, translation\r\n\tFROM " . $GLOBALS['prefix_fw'] . "_field\r\n\tWHERE lang_code = '" . getLanguage() . "'\r\n\t\t" . (isset($_POST['filter_type_field']) && $_POST['filter_type_field'] != 'all_field' ? " AND type_field = '" . $field_av[$_POST['filter_type_field']] . "' " : "") . "\r\n\t\t" . (isset($_POST['filter_name_field']) && $_POST['filter_name_field'] != $lang->def('_SEARCH') ? " AND translation LIKE '%" . $filter_name_field . "%'" : "") . "\r\n\tORDER BY sequence";
    $re_field_display = sql_query($query_field_display);
    $all_fields = mysql_num_rows($re_field_display);
    $img_up = '<img class="valing-middle" src="' . getPathImage() . 'standard/up.png" alt="' . $std_lang->def('_MOVE_UP') . '" />';
    $img_down = '<img class="valing-middle" src="' . getPathImage() . 'standard/down.png" alt="' . $std_lang->def('_MOVE_DOWN') . '" />';
    $content_h = array('<a href="index.php?modname=field_manager&amp;op=field_list">' . $lang->def('_FIELD_NAME') . '</a>', '<a href="index.php?modname=field_manager&amp;op=field_list">' . $lang->def('_FIELD_TYPE') . '</a>');
    $type_h = array('', 'align_center');
    $mod_perm = checkPerm('mod', true);
    $del_perm = checkPerm('del', true);
    if ($mod_perm) {
        $content_h[] = $img_down;
        $content_h[] = $img_up;
        $content_h[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $std_lang->def('_MOD') . '" />';
        $type_h[] = 'image';
        $type_h[] = 'image';
        $type_h[] = 'image';
    }
    if ($del_perm) {
        $content_h[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $std_lang->def('_DEL') . '" />';
        $type_h[] = 'image';
    }
    $tb_field->setColsStyle($type_h);
    $tb_field->addHead($content_h);
    $lat_type = 'textfield';
    $i = 1;
    while (list($id_common, $type_field, $translation) = sql_fetch_row($re_field_display)) {
        $cont = array($translation, $lang->def('_' . strtoupper($type_field)));
        if ($mod_perm) {
            if ($i != $all_fields) {
                $cont[] = '<a href="index.php?modname=field_manager&amp;op=movedown&amp;type_field=' . $type_field . '&amp;id_common=' . $id_common . '&amp;back=' . $back_coded . '"' . ' title="' . $lang->def('_MOVE_DOWN') . '">' . $img_down . '</a>';
            } else {
                $cont[] = '';
            }
            if ($i != 1) {
                $cont[] = '<a href="index.php?modname=field_manager&amp;op=moveup&amp;type_field=' . $type_field . '&amp;id_common=' . $id_common . '&amp;back=' . $back_coded . '"' . ' title="' . $lang->def('_MOVE_UP') . '">' . $img_up . '</a>';
            } else {
                $cont[] = '';
            }
            $cont[] = '<a href="index.php?modname=field&amp;op=manage&amp;fo=edit&amp;type_field=' . $type_field . '&amp;id_common=' . $id_common . '&amp;back=' . $back_coded . '"' . ' title="' . $lang->def('_MOD') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $std_lang->def('_MOD') . '" /></a>';
        }
        if ($del_perm) {
            /*
            $cont[] = '<a href="index.php?modname=field_manager&amp;op=field_del&amp;id_common='.$id_common.'"'
            	.' title="'.$lang->def('_DEL').'">'
            	.'<img src="'.getPathImage().'standard/delete.png" alt="'.$std_lang->def('_DEL').'" /></a>';
            */
            $cont[] = '<a href="index.php?modname=field&amp;op=manage&amp;fo=del&amp;type_field=' . $type_field . '&amp;id_common=' . $id_common . '&amp;back=index.php%3Fmodname%3Dfield_manager%26op%3Dfield_list"' . ' title="' . $lang->def('_DEL') . ' : ' . $translation . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $std_lang->def('_DEL') . '" /></a>';
        }
        $tb_field->addBody($cont);
        $lat_type = $type_field;
        $i++;
    }
    $create_form = new Form();
    $select = '';
    foreach ($field_av as $k => $type_field) {
        $select .= '<option value="' . $type_field . '"' . ($type_field == $lat_type ? ' selected="selected"' : '') . '>' . $lang->def('_' . strtoupper($type_field)) . '</option>';
    }
    if ($del_perm) {
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=fo=del]');
    }
    //add form----------------------------------------------------------
    if (checkPerm('add', true)) {
        $tb_field->addActionAdd($create_form->openForm('field_add', 'index.php?modname=field&amp;op=manage&amp;fo=create') . $create_form->getHidden('back', 'back', $back_coded) . '<label for="type_field">' . '<img class="valing-middle" src="' . getPathImage() . 'standard/add.png" alt="' . $std_lang->def('_ADD') . '" />' . ' ' . $lang->def('_ADD_NEW_FIELD') . '</label> ' . '<select id="type_field" name="type_field">' . $select . '</select> ' . $filter->getButton('new_field', 'new_field', $std_lang->def('_CREATE'), 'button_nowh') . $filter->closeForm());
    }
    $out->add($tb_field->getTable());
    $out->add('<a href="index.php?modname=field_manager&amp;op=fixsequence&amp;back=' . $back_coded . '"' . ' title="' . $lang->def('_FIX_SEQUENCE') . '">' . $lang->def('_FIX_SEQUENCE') . '</a>');
    $out->add('</div>');
}
Example #21
0
 function _show_son()
 {
     $std_lang =& DoceboLanguage::createInstance('standard');
     $lang =& DoceboLanguage::createInstance('field');
     $out =& $GLOBALS['page'];
     $out->setWorkingZone('content');
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.form.php';
     $counter = 0;
     $img_up = '<img class="valing-middle" src="' . getPathImage() . 'standard/up.png" alt="' . $std_lang->def('_MOVE_UP') . '" />';
     $img_down = '<img class="valing-middle" src="' . getPathImage() . 'standard/down.png" alt="' . $std_lang->def('_MOVE_DOWN') . '" />';
     $id_son = Get::req('idSon', DOTY_INT, 0);
     $iop = Get::req('iop', DOTY_STRING, '');
     if ($iop == 'moveup') {
         $this->_move_up($id_son);
     } elseif ($iop == 'movedown') {
         $this->_move_down($id_son);
     } elseif ($iop == 'fixsequence') {
         $this->_fix_sequence();
     }
     list($total_son) = sql_fetch_row(sql_query("\r\n\t\tSELECT COUNT(*)\r\n\t\tFROM " . $this->_getElementTable() . "\r\n\t\tWHERE idField = '" . $this->id_common . "' AND lang_code = '" . getLanguage() . "'"));
     $re_main = sql_query("\r\n\t\tSELECT translation\r\n\t\tFROM " . $this->_getMainTable() . "\r\n\t\tWHERE id_common = '" . $this->id_common . "' AND lang_code = '" . getLanguage() . "'\r\n\t\tORDER BY sequence");
     list($translation) = sql_fetch_row($re_main);
     //find available son
     $re_field = sql_query("\r\n\t\tSELECT id_common_son, translation\r\n\t\tFROM " . $this->_getElementTable() . "\r\n\t\tWHERE idField = '" . $this->id_common . "' AND lang_code = '" . getLanguage() . "'\r\n\t\tORDER BY sequence");
     $base_path = $this->getUrl() . '&amp;id_common=' . $this->id_common . '&amp;type_field=' . $this->getFieldType() . '&amp;back=' . $this->back_coded;
     $out->add('<div class="std_block">' . getBackUi($this->back, $std_lang->def('_BACK')) . '<div class="title"><b>' . $lang->def('_TITLE') . ' :</b> ' . '<a class="ico-wt-sprite subs_mod" href="' . $base_path . '&amp;iop=modmain"><span>' . $translation . '</span></a>' . '</div><br />');
     $tb_son = new Table(0, $lang->def('_DROPDOWN_SON_CAPTION'));
     $content_h = array($lang->def('_DROPDOWN_ELEMENT'), $img_up, $img_down, '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $std_lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $std_lang->def('_DEL') . '" />');
     $type_h = array('', 'image', 'image', 'image', 'image');
     $tb_son->addHead($content_h, $type_h);
     while (list($idSon, $elem) = sql_fetch_row($re_field)) {
         $counter++;
         $content = array();
         $content[] = $elem;
         if ($counter != 1 && $counter != $total_son) {
             $content[] = '<a href="' . $base_path . '&amp;iop=moveup&amp;idSon=' . $idSon . '" title="' . $std_lang->def('_MOVE_UP') . '">' . $img_up . '</a>';
             $content[] = '<a href="' . $base_path . '&amp;iop=movedown&amp;idSon=' . $idSon . '" title="' . $std_lang->def('_MOVE_DOWN') . '">' . $img_down . '</a>';
         } elseif ($counter == 1) {
             $content[] = '';
             $content[] = '<a href="' . $base_path . '&amp;iop=movedown&amp;idSon=' . $idSon . '" title="' . $std_lang->def('_MOVE_DOWN') . '">' . $img_down . '</a>';
         } else {
             $content[] = '<a href="' . $base_path . '&amp;iop=moveup&amp;idSon=' . $idSon . '" title="' . $std_lang->def('_MOVE_UP') . '">' . $img_up . '</a>';
             $content[] = '';
         }
         $content[] = '<a href="' . $base_path . '&amp;iop=mod&amp;idSon=' . $idSon . '" title="' . $std_lang->def('_MOD') . ' : ' . $elem . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $std_lang->def('_MOD') . ' : ' . $elem . '" /></a>';
         $content[] = '<a href="' . $base_path . '&amp;iop=del&amp;idSon=' . $idSon . '" title="' . $std_lang->def('_DEL') . ' : ' . $elem . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $std_lang->def('_DEL') . ' : ' . $elem . '" /></a>';
         $tb_son->addBody($content);
     }
     $tb_son->addActionAdd('<a class="ico-wt-sprite subs_add" href="' . $this->getUrl() . '&amp;id_common=' . $this->id_common . '&amp;type_field=' . $this->getFieldType() . '&amp;back=' . $this->back_coded . '&amp;iop=add"><span>' . $lang->def('_DROPDOWN_SON_ADD') . '</span></a>');
     $out->add($tb_son->getTable());
     $out->add('<a href="' . $base_path . '&amp;iop=fixsequence"' . ' title="' . $lang->def('_FIX_SEQUENCE') . '">' . $lang->def('_FIX_SEQUENCE') . '</a>');
     $out->add(getBackUi($this->back, $std_lang->def('_BACK')) . '</div>');
 }
Example #22
0
    function viewUserEvent()
    {
        checkPerm('view');
        require_once _base_ . '/lib/lib.navbar.php';
        require_once _base_ . '/lib/lib.table.php';
        $lang =& DoceboLanguage::createInstance('reservation');
        $id_event = importVar('id_event', true, 0);
        $mod_perm = checkPerm('mod', true);
        $out = $GLOBALS['page'];
        $out->setWorkingZone('content');
        $man_res = new Man_Reservation();
        $acl =& Docebo::user()->getAcl();
        $acl_man =& Docebo::user()->getAclManager();
        $user_idst = getLogUserId();
        $user_subscribed = array();
        $user_sunscribed = $man_res->getSubscribedUserIdst($id_event);
        $user_info = array();
        $user_info =& $acl_man->getUsers($user_sunscribed);
        $out->add(getTitleArea($lang->def('_VIEW_EVENT_USER'), '', $lang->def('_EVENT')) . '<div class="std_block">');
        $error = importVar('error', false, '');
        if ($error !== '') {
            switch ($error) {
                case 'del_registration':
                    $out->add(getErrorUi($lang->def('_DEL_REGISTRATION_ERROR')));
                    break;
            }
        }
        if ($user_info) {
            $tb = new Table(10, $lang->def('_RESERVATION_CAPTION'), $lang->def('_RESERVATION_SUMMARY'));
            $tb->initNavBar('ini', 'button');
            $ini = $tb->getSelectedElement();
            $cont_h = array($lang->def('_USERNAME'), $lang->def('_FIRSTNAME'), $lang->def('_LASTNAME'), $lang->def('_EMAIL'));
            $type_h = array('', '', '', '');
            if ($mod_perm) {
                $cont_h = array($lang->def('_USERNAME'), $lang->def('_FIRSTNAME'), $lang->def('_LASTNAME'), $lang->def('_EMAIL'), '<img src="' . getPathImage() . '/standard/delete.png" title="' . $lang->def('_REM_USER') . '" alt="' . $lang->def('_REM_USER') . '" />');
                $type_h = array('', '', '', '', 'img');
            }
            $tb->setColsStyle($type_h);
            $tb->addHead($cont_h);
            if ($user_info) {
                foreach ($user_info as $info_user) {
                    $count = array();
                    $count[] = $acl_man->relativeId($info_user[ACL_INFO_USERID]);
                    $count[] = $info_user[ACL_INFO_FIRSTNAME];
                    $count[] = $info_user[ACL_INFO_LASTNAME];
                    $count[] = $info_user[ACL_INFO_EMAIL];
                    $count[] = '<a href="index.php?modname=reservation&amp;op=del_registration&amp;id_user='******'&amp;id_event=' . $id_event . '"><img src="' . getPathImage() . '/standard/delete.png" title="' . $lang->def('_REM_USER') . '" alt="' . $lang->def('_REM_USER') . '" /></a>';
                    $tb->addBody($count);
                }
            }
            if ($mod_perm) {
                $tb->addActionAdd('<a href="index.php?modname=reservation&amp;op=add_event">
					<img src="' . getPathImage() . 'standard/add.png" title="' . $lang->def('_NEW_EVENT') . '" alt="' . $lang->def('_NEW_EVENT') . '" /> ' . $lang->def('_NEW_EVENT') . '</a>');
            }
            $out->add($tb->getTable() . $tb->getNavBar($ini, count($user_info)));
            $out->add('<a href="index.php?modname=reservation&amp;op=excel&amp;id_event=' . $id_event . '" target="_blank">' . $lang->def('_EXPORT_XLS') . '</a>', 'content');
        } else {
            $out->add($lang->def('_NO_USERS_FOUND'), 'content');
        }
        $out->add(getBackUi('index.php?modname=reservation&amp;op=view_registration', $lang->def('_BACK')), 'content');
        $out->add('</div>', 'content');
    }
Example #23
0
function groups()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('groups', 'lms');
    $acl_man =& Docebo::user()->getAclManager();
    $mod_perm = checkPerm('mod', true);
    $subs_perm = checkPerm('subscribe', true);
    // Retrive groups
    $acl_man->setContext('/lms/course/' . $_SESSION['idCourse'] . '/group');
    $id_groups = $acl_man->getGroupsIdstFromBasePath('/lms/course/' . $_SESSION['idCourse'] . '/group', array('course'));
    if (!empty($id_groups)) {
        $groups = $acl_man->getGroups($id_groups);
    } else {
        $groups = array();
    }
    // compose table
    $tb = new Table(0, $lang->def('_GROUP_CAPTION'), $lang->def('_GROUP_CAPTION'));
    $type_h = array('', '');
    $cont_h = array($lang->def('_NAME'), $lang->def('_DESCRIPTION'));
    if ($subs_perm) {
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/moduser.png" alt="' . $lang->def('_ALT_SUBSCRIBE') . '" ' . 'title="' . $lang->def('_SUBSCRIBE_USER') . '" />';
    }
    if ($mod_perm) {
        $type_h[] = 'image';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" ' . 'title="' . $lang->def('_MOD') . '" />';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" ' . 'title="' . $lang->def('_DEL') . '" />';
    }
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    if (!empty($groups)) {
        while (list(, $group) = each($groups)) {
            $id_group = $group[ACL_INFO_IDST];
            $group_id = $acl_man->relativeId($group[ACL_INFO_GROUPID]);
            if ($group_id != 'alluser') {
                $cont = array($group_id, $group[ACL_INFO_GROUPDESCRIPTION]);
                if ($subs_perm) {
                    $cont[] = '<a href="index.php?modname=groups&amp;op=subscribe&amp;id_group=' . $id_group . '&amp;load=1" ' . 'title="' . $lang->def('_ASSIGN_USERS') . ' : ' . strip_tags($group_id) . '">' . '<img src="' . getPathImage() . 'standard/moduser.png" alt="' . $lang->def('_ASSIGN_USERS') . '"  /></a>';
                }
                if ($mod_perm) {
                    $cont[] = '<a href="index.php?modname=groups&amp;op=editgroup&amp;id_group=' . $id_group . '" ' . 'title="' . $lang->def('_MOD') . ' : ' . strip_tags($group_id) . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '"  /></a>';
                    $cont[] = '<a href="index.php?modname=groups&amp;op=delgroup&amp;id_group=' . $id_group . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . strip_tags($group_id) . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" /></a>';
                }
                $tb->addBody($cont);
            }
        }
    }
    if ($mod_perm) {
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=delgroup]');
        $tb->addActionAdd('<a href="index.php?modname=groups&amp;op=editgroup">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '"  /> ' . $lang->def('_NEW') . '</a>');
    }
    // output
    $GLOBALS['page']->add(getTitleArea($lang->def('_GROUPS'), 'groups') . '<div class="std_block">', 'content');
    if (isset($_GET['result'])) {
        switch ($_GET['result']) {
            case "ok":
                $GLOBALS['page']->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')), 'content');
                break;
            case "err":
                $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE')), 'content');
                break;
        }
    }
    $GLOBALS['page']->add($tb->getTable() . '</div>', 'content');
}
Example #24
0
function forumsearchmessage()
{
    checkPerm('view');
    $search_arg = $_SESSION['forum']['search_arg'];
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $lang =& DoceboLanguage::createInstance('forum', 'lms');
    $id_thread = importVar('idThread', true, 0);
    $ini_thread = importVar('ini_thread');
    $sema_perm = checkPerm('sema', true);
    $moderate = checkPerm('moderate', true);
    $mod_perm = checkPerm('mod', true);
    $acl_man =& Docebo::user()->getAclManager();
    $tb = new Table(Get::sett('visuItem'), $lang->def('_CAPTION_FORUM_MESSAGE'), $lang->def('_CAPTION_FORUM_MESSAGE'));
    $tb->initNavBar('ini', 'link');
    $tb->setLink('index.php?modname=forum&amp;op=searchmessage&amp;idThread=' . $id_thread . '&amp;ini_thread=' . $ini_thread);
    $ini = $tb->getSelectedElement();
    $ini_page = $tb->getSelectedPage();
    // Some info about forum and thread
    $thread_query = "\r\n\tSELECT idForum, title, num_post, locked, erased\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\tWHERE idThread = '" . $id_thread . "'";
    list($id_forum, $thread_title, $tot_message, $locked_t, $erased_t) = sql_fetch_row(sql_query($thread_query));
    $forum_query = "\r\n\tSELECT title, locked\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum\r\n\tWHERE idForum = '" . $id_forum . "'";
    list($forum_title, $locked_f) = sql_fetch_row(sql_query($forum_query));
    ++$tot_message;
    //set as readed if needed
    if (isset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$id_thread])) {
        unset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$id_thread]);
    }
    if ($ini == 0 && !isset($_GET['result'])) {
        sql_query("\r\n\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\t\tSET num_view = num_view + 1\r\n\t\tWHERE idThread = '" . $id_thread . "'");
    }
    $page_title = array('index.php?modname=forum&amp;op=forum' => $lang->def('_FORUM'), 'index.php?modname=forum&amp;op=search&amp;ini=' . $ini_thread => $thread_title, $lang->def('_SEARCH_RESULT_FOR') . ' : ' . $search_arg);
    if ($erased_t && !$mod_perm && !$moderate) {
        $GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . $lang->def('_CANNOTENTER') . '</div>', 'content');
        return;
    }
    // Who have semantic evaluation
    $re_sema = sql_query("\r\n\tSELECT DISTINCT idmsg\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum_sema");
    while (list($msg_sema) = sql_fetch_row($re_sema)) {
        $forum_sema[$msg_sema] = 1;
    }
    // Find post
    $messages = array();
    $authors = array();
    $authors_names = array();
    $authors_info = array();
    $re_message = sql_query("\r\n\tSELECT idMessage, posted, title, textof, attach, locked, author, modified_by, modified_by_on\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage\r\n\tWHERE idThread = '" . $id_thread . "'\r\n\tORDER BY posted\r\n\tLIMIT {$ini}, " . Get::sett('visuItem'));
    while ($record = mysql_fetch_assoc($re_message)) {
        $messages[$record['idMessage']] = $record;
        $authors[$record['author']] = $record['author'];
        if ($record['modified_by'] != 0) {
            $authors[$record['modified_by']] = $record['modified_by'];
        }
    }
    $authors_names =& $acl_man->getUsers($authors);
    $level_name = CourseLevel::getLevels();
    // Retriving level and number of post of th authors
    $re_num_post = sql_query("\r\n\tSELECT u.idUser, u.level, COUNT(*)\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage AS m, " . $GLOBALS['prefix_lms'] . "_courseuser AS u\r\n\tWHERE u.idCourse = '" . (int) $_SESSION['idCourse'] . "' AND m.author = u.idUser AND m.author IN ( " . implode($authors, ',') . " )\r\n\tGROUP BY u.idUser, u.level");
    while (list($id_u, $level_u, $num_post_a) = sql_fetch_row($re_num_post)) {
        $authors_info[$id_u] = array('num_post' => $num_post_a, 'level' => $level_name[$level_u]);
    }
    $type_h = array('forum_sender', 'forum_text');
    $cont_h = array($lang->def('_AUTHOR'), $lang->def('_TEXTOF'));
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    // Compose messagges display
    $path = $GLOBALS['where_files_relative'] . '/appCore/' . Get::sett('pathphoto');
    while (list($id_message, $message_info) = each($messages)) {
        // sender info
        $m_author = $message_info['author'];
        if (isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_AVATAR] != '') {
            $img_size = @getimagesize($path . $authors_names[$m_author][ACL_INFO_AVATAR]);
        }
        $sender = '<div class="forum_author">' . (isset($authors_names[$m_author]) ? $authors_names[$m_author][ACL_INFO_LASTNAME] . $authors_names[$m_author][ACL_INFO_FIRSTNAME] == '' ? $acl_man->relativeId($authors_names[$m_author][ACL_INFO_USERID]) : $authors_names[$m_author][ACL_INFO_LASTNAME] . ' ' . $authors_names[$m_author][ACL_INFO_FIRSTNAME] : $lang->def('_UNKNOWN_AUTHOR')) . '</div>' . '<div class="forum_level">' . $lang->def('_LEVEL') . ' : ' . $authors_info[$m_author]['level'] . '</div>' . (isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_AVATAR] != '' ? '<img class="forum_avatar' . ($img_size[0] > 150 || $img_size[1] > 150 ? ' image_limit' : '') . '" src="' . $path . $authors_names[$m_author][ACL_INFO_AVATAR] . '" alt="' . $lang->def('_AVATAR') . '" />' : '') . '<div class="forum_numpost">' . $lang->def('_NUMPOST') . ' : ' . (isset($authors_info[$m_author]['num_post']) ? $authors_info[$m_author]['num_post'] : 0) . '</div>' . '<img src="' . getPathImage() . 'standard/identity.png" alt="&gt;" />&nbsp;' . '<a href="index.php?modname=forum&amp;op=viewprofile&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '&amp;idThread=' . $id_thread . '">' . $lang->def('_VIEW_PROFILE') . '</a>';
        // msg info
        $msgtext = '';
        $msgtext .= '<div class="forum_post_posted">' . $lang->def('_DATE') . ' : ' . Format::date($message_info['posted']) . ' ( ' . loadDistance($message_info['posted']) . ' )' . '</div>';
        if ($message_info['locked']) {
            $msgtext .= '<div class="forum_post_locked">' . $lang->def('_LOCKEDMESS') . '</div>';
        } else {
            if ($message_info['attach'] != '') {
                $msgtext .= '<div class="forum_post_attach">' . '<a href="index.php?modname=forum&amp;op=download&amp;id=' . $id_message . '">' . $lang->def('_ATTACHMENT') . ' : ' . '<img src="' . getPathImage() . mimeDetect($message_info['attach']) . '" alt="' . $lang->def('_ATTACHMENT') . '" /></a>' . '</div>';
            }
            $textof = str_replace('[quote]', '<blockquote class="forum_quote">', str_replace('[/quote]', '</blockquote>', $message_info['textof']));
            $msgtext .= '<div class="forum_post_title">' . $lang->def('_SUBJECT') . ' : ' . ($search_arg !== '' ? eregi_replace($search_arg, '<span class="filter_evidence">' . $search_arg . '</span>', $message_info['title']) : $message_info['title']) . '</div>';
            $msgtext .= '<div class="forum_post_text">' . ($search_arg !== '' ? eregi_replace($search_arg, '<span class="filter_evidence">' . $search_arg . '</span>', $textof) : $textof) . '</div>';
            if ($message_info['modified_by'] != 0) {
                $modify_by = $message_info['modified_by'];
                $msgtext .= '<div class="forum_post_modified_by">' . $lang->def('_MODIFY_BY') . ' : ' . (isset($authors_names[$modify_by]) ? $authors_names[$modify_by][ACL_INFO_LASTNAME] . $authors_names[$modify_by][ACL_INFO_FIRSTNAME] == '' ? $acl_man->relativeId($authors_names[$modify_by][ACL_INFO_USERID]) : $authors_names[$modify_by][ACL_INFO_LASTNAME] . ' ' . $authors_names[$modify_by][ACL_INFO_FIRSTNAME] : $lang->def('_UNKNOWN_AUTHOR')) . ' ' . $lang->def('_ON') . ' : ' . Format::date($message_info['modified_by_on']) . '</div>';
            }
            if (isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_SIGNATURE] != '') {
                $msgtext .= '<div class="forum_post_sign_separator"></div>' . '<div class="forum_post_sign">' . $authors_names[$m_author][ACL_INFO_SIGNATURE] . '</div>';
            }
        }
        $content = array($sender, $msgtext);
        $tb->addBody($content);
        // some action that you can do with this message
        $action = '';
        if ($moderate || $mod_perm) {
            if ($message_info['locked']) {
                $action .= '<a href="index.php?modname=forum&amp;op=moderatemessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_DEMODERATE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/demoderate.png" alt="' . $lang->def('_DEMODERATE') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_DEMODERATE') . '</a> ';
            } else {
                $action .= '<a href="index.php?modname=forum&amp;op=moderatemessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_MODERATE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_MODERATE') . '</a> ';
            }
        }
        if (!$locked_t && !$locked_f || $mod_perm || $moderate) {
            $action .= '<a href="index.php?modname=forum&amp;op=addmessage&amp;idThread=' . $id_thread . '&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_REPLY') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/reply.png" alt="' . $lang->def('_REPLY') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_QUOTE') . '</a>';
        }
        if ($moderate || $mod_perm || $m_author == getLogUserId()) {
            $action .= '<a href="index.php?modname=forum&amp;op=modmessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_MOD_MESSAGE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_MOD') . '</a>' . '<a href="index.php?modname=forum&amp;op=delmessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_DEL') . '</a> ';
        }
        $tb->addBodyExpanded($action, 'forum_action');
    }
    if (!$locked_t && !$locked_f || $mod_perm || $moderate) {
        $tb->addActionAdd('<a href="index.php?modname=forum&amp;op=addmessage&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '" title="' . $lang->def('_REPLY') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" /> ' . $lang->def('_REPLY') . '</a>');
    }
    $GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . Form::openForm('search_forum', 'index.php?modname=forum&amp;op=search&amp;idThread=' . $id_thread) . '<div class="quick_search_form">' . '<label for="search_arg">' . $lang->def('_SEARCH_LABEL') . '</label> ' . Form::getInputTextfield('search_t', 'search_arg', 'search_arg', $search_arg, $lang->def('_SEARCH'), 255, '') . '<input class="search_b" type="submit" id="search_button" name="search_button" value="' . $lang->def('_SEARCH') . '" />' . '</div>' . Form::closeForm(), 'content');
    if ($moderate || $mod_perm) {
        $GLOBALS['page']->add('<div class="forum_action_top">' . '<a href="index.php?modname=forum&amp;op=modstatusthread&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($locked_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_FREE') . '" /> ' . $lang->def('_FREETHREAD') : '<img src="' . getPathImage() . 'standard/locked.png" alt="' . $lang->def('_LOCKTHREAD') . '" /> ' . $lang->def('_LOCKTHREAD')) . '</a> ' . '<a href="index.php?modname=forum&amp;op=changeerased&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($erased_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_UNERASE') . '" /> ' . $lang->def('_UNERASE') : '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . '" /> ' . $lang->def('_MODERATE')) . '</a>' . '</div>', 'content');
    }
    $GLOBALS['page']->add($tb->getTable(), 'content');
    if ($moderate || $mod_perm) {
        $GLOBALS['page']->add('<div class="forum_action_bottom">' . '<a href="index.php?modname=forum&amp;op=modstatusthread&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($locked_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_FREE') . '" /> ' . $lang->def('_FREETHREAD') : '<img src="' . getPathImage() . 'standard/locked.png" alt="' . $lang->def('_LOCKTHREAD') . '" /> ' . $lang->def('_LOCKTHREAD')) . '</a> ' . '<a href="index.php?modname=forum&amp;op=changeerased&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($erased_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_UNERASE') . '" /> ' . $lang->def('_UNERASE') : '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . '" /> ' . $lang->def('_MODERATE')) . '</a>' . '</div>', 'content');
    }
    $GLOBALS['page']->add($tb->getNavBar($ini, $tot_message) . '</div>', 'content');
}
Example #25
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 #26
0
function certificate()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    $mod_perm = checkPerm('mod', true);
    // create a language istance for module admin_certificate
    $lang =& DoceboLanguage::createInstance('certificate', 'lms');
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $tb = new Table(Get::sett('visuItem'), $lang->def('_CERTIFICATE_CAPTION'), $lang->def('_CERTIFICATE_SUMMARY'));
    $tb->initNavBar('ini', 'link');
    $tb->setLink("index.php?modname=certificate&amp;op=certificate");
    $ini = $tb->getSelectedElement();
    $form = new Form();
    if (isset($_POST['filter_reset'])) {
        unset($_POST['filter_text']);
    }
    //search query of certificates
    $query_certificate = "\r\n\tSELECT id_certificate, code, name, description\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_certificate" . " WHERE meta = 0";
    if (isset($_POST['filter_text'])) {
        $query_certificate .= " AND (name LIKE '%" . $_POST['filter_text'] . "%'" . " OR code LIKE '%" . $_POST['filter_text'] . "%')";
    }
    $query_certificate .= " ORDER BY id_certificate\r\n\tLIMIT {$ini}," . Get::sett('visuItem');
    $query_certificate_tot = "\r\n\tSELECT COUNT(*)\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_certificate";
    $re_certificate = sql_query($query_certificate);
    list($tot_certificate) = sql_fetch_row(sql_query($query_certificate_tot));
    $type_h = array('', '', '');
    $cont_h = array($lang->def('_CODE'), $lang->def('_NAME'), $lang->def('_DESCRIPTION'));
    if ($mod_perm) {
        $cont_h[] = $lang->def('_TEMPLATE');
        $type_h[] = 'image';
    }
    $cont_h[] = Get::sprite('subs_view', Lang::t('_PREVIEW', 'certificate'));
    $type_h[] = 'image';
    if ($mod_perm) {
        $cont_h[] = Get::sprite('subs_print', Lang::t('_CERTIFICATE_VIEW_CAPTION', 'certificate'));
        $type_h[] = 'image';
        $cont_h[] = Get::sprite('subs_mod', Lang::t('_MOD', 'certificate'));
        $type_h[] = 'image';
        $cont_h[] = Get::sprite('subs_del', Lang::t('_DEL', 'certificate'));
        $type_h[] = 'image';
    }
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    while (list($id_certificate, $code, $name, $descr) = sql_fetch_row($re_certificate)) {
        $title = strip_tags($name);
        $cont = array($code, $name, Util::cut($descr));
        if ($mod_perm) {
            $cont[] = '<a href="index.php?modname=certificate&amp;op=elemcertificate&amp;id_certificate=' . $id_certificate . '" title="' . Lang::t('_TEMPLATE', 'certificate') . '">' . Lang::t('_TEMPLATE', 'certificate') . '</a>';
        }
        $cont[] = Get::sprite_link('subs_view', 'index.php?modname=certificate&amp;op=preview&amp;id_certificate=' . $id_certificate, Lang::t('_PREVIEW', 'certificate'));
        if ($mod_perm) {
            $cont[] = Get::sprite_link('subs_print', 'index.php?modname=certificate&amp;op=report_certificate&amp;id_certificate=' . $id_certificate, Lang::t('_CERTIFICATE_VIEW_CAPTION', 'certificate'));
            $cont[] = Get::sprite_link('subs_mod', 'index.php?modname=certificate&amp;op=modcertificate&amp;id_certificate=' . $id_certificate, Lang::t('_MOD', 'certificate'));
            $cont[] = Get::sprite_link('subs_del', 'index.php?modname=certificate&amp;op=delcertificate&amp;id_certificate=' . $id_certificate, Lang::t('_DEL', 'certificate'));
        }
        $tb->addBody($cont);
    }
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=delcertificate]');
    if ($mod_perm) {
        $tb->addActionAdd('<a class="ico-wt-sprite subs_add" href="index.php?modname=certificate&amp;op=addcertificate" title="' . $lang->def('_ADD') . '">' . '<span>' . $lang->def('_ADD') . '</span></a>');
    }
    $out->add(getTitleArea($lang->def('_TITLE_CERTIFICATE'), 'certificate') . '<div class="std_block">' . $form->openForm('certificate_filter', 'index.php?modname=certificate&amp;op=certificate') . '<div class="quick_search_form">
			<div>
				<div class="simple_search_box">' . Form::getInputTextfield("search_t", "filter_text", "filter_text", Get::req('filter_text', DOTY_MIXED, ''), '', 255, '') . Form::getButton("filter_set", "filter_set", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("filter_reset", "filter_reset", Lang::t('_RESET', 'standard'), "reset_b") . '</div>
			</div>
		</div>' . $form->closeForm());
    if (isset($_GET['result'])) {
        switch ($_GET['result']) {
            case "ok":
                $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
            case "err":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
            case "err_del":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
        }
    }
    $out->add($tb->getTable() . $tb->getNavBar($ini, $tot_certificate) . '</div>');
}
Example #27
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 #28
0
function codeList()
{
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('code');
    $id_code_group = Get::req('id_code_group', DOTY_INT, '0');
    $code_manager = new CodeManager();
    $acl_man = Docebo::user()->getAclManager();
    cout(getTitleArea(array('index.php?modname=code&amp;op=list' => $lang->def('_CODE'), $lang->def('_CODE_LIST'))) . '<div class="std_block">');
    if (isset($_POST['undo_filter'])) {
        unset($_POST['code_filter']);
    }
    cout('<div class="quick_search_form">' . Form::openForm('code_list_filter', 'index.php?modname=code&amp;op=code_list&amp;id_code_group=' . $id_code_group) . Form::getInputTextfield("search_t", "code_filter", "code_filter", isset($_POST['code_filter']) ? $_POST['code_filter'] : '', '', 255, '') . Form::getButton("filter", "filter", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("undo_filter", "undo_filter", Lang::t('_RESET', 'standard'), "reset_b") . Form::closeForm() . '</div>');
    $result = Get::req('result', DOTY_STRING, '');
    switch ($result) {
        case 'ok':
            UIFeedback::info($lang->def('_OPERATION_SUCCESSFUL'));
            break;
        case 'err':
            UIFeedback::error($lang->def('_OPERATION_FAILURE'));
            break;
        case 'err_dup':
            UIFeedback::error($lang->def('_DUPLICATED_CODE'));
            break;
    }
    $tot_code = $code_manager->getCodeNumber($id_code_group, isset($_POST['undo_filter']) ? $_POST['undo_filter'] : false);
    if ($tot_code) {
        $tb = new Table('20');
        $tb->initNavBar('ini', 'link');
        $tb->setLink('index.php?modname=code&amp;op=code_list&amp;id_code_group=' . $id_code_group);
        $ini = $tb->getSelectedElement();
        $cont_h = array($lang->def('_CODE'), $lang->def('_USED'), $lang->def('_USERNAME'), $lang->def('_UNLIMITED_USE'), '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />');
        $type_h = array('', 'image', '', 'image', 'image', 'image');
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        $array_code = $code_manager->getCodeList($id_code_group, $ini);
        foreach ($array_code as $code_info) {
            $cont = array();
            $cont[] = $code_info['code'];
            if ($code_info['used']) {
                $cont[] = '<img src="' . getPathImage() . 'standard/status_active.png" alt="' . $lang->def('_USED') . '" />';
                $user_info = $acl_man->getUser($code_info['id_user'], false);
                if ($user_info) {
                    $cont[] = $acl_man->relativeId($user_info[ACL_INFO_USERID]);
                } else {
                    $user_info = $acl_man->getTempUserInfo($code_info['id_user'], false);
                    $cont[] = $acl_man->relativeId($user_info['userid']);
                }
                if ($code_info['unlimited_use'] == '1') {
                    $cont[] = '<img src="' . getPathImage() . 'standard/status_active.png" alt="' . $lang->def('_UNLIMITED_USE') . '" />';
                } else {
                    $cont[] = '-';
                }
                $cont[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />';
            } else {
                $cont[] = '-';
                $cont[] = $lang->def('_NONE');
                if ($code_info['unlimited_use'] == '1') {
                    $cont[] = '<img src="' . getPathImage() . 'standard/status_active.png" alt="' . $lang->def('_UNLIMITED_USE') . '" />';
                } else {
                    $cont[] = '-';
                }
                $cont[] = '<a href="index.php?modname=code&amp;op=mod_code&amp;id_code_group=' . $id_code_group . '&amp;code=' . $code_info['code'] . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />';
            }
            $cont[] = '<a href="index.php?modname=code&amp;op=del_code&amp;id_code_group=' . $id_code_group . '&amp;code=' . $code_info['code'] . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />';
            $tb->addBody($cont);
        }
        $tb->addActionAdd('<a href="index.php?modname=code&amp;op=add_code&amp;id_code_group=' . $id_code_group . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_ADD') . '</a>');
        $tb->addActionAdd('<a class="ico-wt-sprite subs_xls" title="' . Lang::t('_EXPORT_XLS', 'report') . '" ' . 'href="index.php?modname=code&amp;op=export&amp;id_code_group=' . $id_code_group . '&amp;format=xls">' . '<span>' . Lang::t('_EXPORT_XLS', 'report') . '</span></a>');
        $tb->addActionAdd('<a class="ico-wt-sprite subs_csv" title="' . Lang::t('_EXPORT_CSV', 'report') . '" ' . 'href="index.php?modname=code&amp;op=export&amp;id_code_group=' . $id_code_group . '&amp;format=csv">' . '<span>' . Lang::t('_EXPORT_CSV', 'report') . '</span></a>');
        cout($tb->getTable() . $tb->getNavBar($ini, $tot_code));
        setupHrefDialogBox('a[href*=del_code]');
    } else {
        cout($lang->def('_NO_CODE_FOUND') . '<br/>' . '<a href="index.php?modname=code&amp;op=add_code&amp;id_code_group=' . $id_code_group . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_ADD') . '</a>');
    }
    cout('<br/><br/>' . getBackUi('index.php?modname=code&amp;op=list', $lang->def('_BACK')) . '</div>');
}
Example #29
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 #30
0
    function message($tk, $perm, $url, $pb)
    {
        if (!$perm["can_read"]) {
            die("You can't access!");
        }
        require_once _base_ . '/lib/lib.mimetype.php';
        require_once _base_ . '/lib/lib.table.php';
        $ini = importVar('ini', true, 0);
        $acl_man =& Docebo::user()->getAclManager();
        $path = $GLOBALS['where_files_relative'] . '/appCore/' . Get::sett('pathphoto');
        $mod_perm = $perm["can_moderate"];
        $read_perm = $perm["can_read"];
        $write_perm = $perm["can_write"];
        $upload_perm = $perm["can_upload"];
        $res = "";
        if ((int) $pb != 0) {
            $pbtxt = "&amp;pb={$pb}";
        } else {
            $pbtxt = "";
        }
        // find message
        $qtxt = "\r\n\t\tSELECT idMessage, author, posted, title, textof, attach, locked\r\n\t\tFROM " . $this->prefix . "_sysforum AS t1\r\n\t\tWHERE " . get_sql_tk_str($tk, "t1") . "\r\n\t\tORDER BY posted";
        $reMessage = sql_query($qtxt);
        // find info about authors
        $reNumPost = sql_query("\r\n\t\tSELECT author, COUNT(*)\r\n\t\tFROM " . $this->prefix . "_sysforum\r\n\t\tWHERE author <> '1'\r\n\t\tGROUP BY author");
        $authors = array();
        while (list($id_a, $num_post_a) = sql_fetch_row($reNumPost)) {
            $authors[$id_a] = $id_a;
            $user_post[$id_a] = $num_post_a;
        }
        $authors_info =& $acl_man->getUsers($authors);
        $tab = new Table(0);
        $contentH = array($this->lang->def("_AUTHOR"), $this->lang->def("_TEXTOF"));
        $typeH = array('forum_sender', 'forum_text');
        $tab->setColsStyle($typeH);
        $tab->addHead($contentH);
        while (list($idM, $author, $posted, $title, $textof, $attach, $locked_m) = sql_fetch_row($reMessage)) {
            // message author
            if (isset($authors_info[$author]) && $authors_info[$author][ACL_INFO_AVATAR] != '') {
                $img_size = @getimagesize($path . $authors_info[$author][ACL_INFO_AVATAR]);
            }
            $who = '<div class="forum_author">' . (isset($authors_info[$author]) ? $this->getAuthorName($acl_man->relativeId($authors_info[$author][ACL_INFO_USERID]), $authors_info[$author][ACL_INFO_FIRSTNAME], $authors_info[$author][ACL_INFO_LASTNAME]) : Lang::t('_UNKNOWN_AUTHOR', 'sysforum')) . '</div>' . ($authors_info[$author][ACL_INFO_AVATAR] != '' ? '<img class="forum_avatar' . ($img_size[0] > 150 || $img_size[1] > 150 ? ' image_limit' : '') . '" src="' . $path . $authors_info[$author][ACL_INFO_AVATAR] . '" alt="' . $this->lang->def('_AVATAR') . '" />' : '');
            /*.'<div class="forum_numpost">'.$this->lang->def('_NUMPOST').' : '
            		.( isset($user_post[$author]) ? $user_post[$author] : 0 )
            		.'</div>';*/
            // message text------------------------------------------------
            $posted_datetime = Format::date($posted);
            $posted_time = time();
            //$GLOBALS["regset"]->ddate->getTimeStamp();
            $mess = '';
            $mess .= '<div class="forum_post_posted">' . $this->lang->def("_DATE") . ' : ' . $posted_datetime . ' ' . $this->loadDistance($posted_time) . '</div>';
            if ($attach) {
                $mess .= '<div class="forum_post_attach">' . '<a href="' . $url . '&amp;sf_op=download&amp;sf_fileid=' . $idM . $this->getUrlExtra() . '">' . $this->lang->def("_ATTACHMENT") . ' : ' . '<img src="' . getPathImage('fw') . mimeDetect($attach) . '" alt="' . $this->lang->def("_ATTACHMENT") . '" /></a>' . '</div>';
            }
            if (!$locked_m) {
                $mess .= '<div class="forum_post_title">' . $this->lang->def("_SUBJECT") . ' : ' . $title . '</div>' . '<div class="forum_post_text">' . $textof . '</div>';
                if (isset($authors_info[$author]) && $authors_info[$author][ACL_INFO_SIGNATURE] != '') {
                    $mess .= '<div class="forum_post_sign_separator"></div>' . '<div class="forum_post_sign">' . $authors_info[$author][ACL_INFO_SIGNATURE] . '</div>';
                }
            } else {
                $mess .= '<div class="forum_post_locked">' . $this->lang->def("_LOCKEDMESS") . '</div>';
            }
            // action-------------------------------------------------------
            $action = "\n" . '<div class="forumAction">&nbsp;';
            if ($mod_perm) {
                $action .= '<a href="' . $url . '&amp;sf_op=lockmessage' . $pbtxt . '&amp;idMessage=' . $idM . $this->getUrlExtra() . '">';
                if ($locked_m) {
                    $action .= '<img src="' . getPathImage() . 'forum/demoderate.gif" alt="' . $this->lang->def("_FREEMESS") . '" />';
                } else {
                    $action .= '<img src="' . getPathImage() . 'forum/moderate.gif" alt="' . $this->lang->def("_LOCKMESS") . '" />';
                }
                $action .= '</a>';
            }
            if ($author == Docebo::user()->getIdSt() && ($write_perm || $mod_perm) && !$locked_m && $author != "1") {
                $action .= ' <a href="' . $url . '&amp;sf_op=modmessage' . $pbtxt . '&amp;idMessage=' . $idM . $this->getUrlExtra() . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $this->lang->def("_MOD") . '" title="' . $this->lang->def("_MOD") . '" /></a>';
            }
            $action .= '</div>';
            $tab->addBody(array($who, $mess));
            $tab->addBody(array('', $action));
        }
        $action_row = '';
        if (!$locked_m && $write_perm || $mod_perm) {
            $url_add = $url . '&amp;sf_op=addmessage' . $pbtxt . $this->getUrlExtra();
            $this->out->add($tab->addActionAdd('<div class="forumAdd"><a href="' . $url_add . '">
				<img src="' . getPathImage() . 'standard/add.png" title="' . $this->lang->def("_ADDMESSAGE") . '" alt="' . $this->lang->def("_ADDMESSAGE") . '" /> ' . $this->lang->def("_ADDMESSAGE") . '</a></div>'));
        }
        $res .= $tab->getTable();
        return $res;
    }