Exemplo n.º 1
0
function view_area()
{
    checkPerm('view');
    require_once _lms_ . '/lib/lib.middlearea.php';
    $lang =& DoceboLanguage::createInstance('middlearea', 'lms');
    $lc =& DoceboLanguage::createInstance('menu_course', 'lms');
    $query_menu = "SELECT mo.idModule, mo.default_name, under.my_name\r\n\tFROM %lms_module AS mo\r\n\t\tJOIN %lms_menucourse_under AS under\r\n\tWHERE mo.idModule = under.idModule\r\n\t\tAND mo.module_info IN ('all','user')\r\n\t\tAND mvc_path <> 'elearning/show'\r\n\tORDER BY under.sequence";
    $re_menu_voice = sql_query($query_menu);
    $base_url = 'index.php?modname=middlearea&amp;op=select_permission&amp;load=1&amp;obj_index=';
    $second_url = 'index.php?modname=middlearea&amp;op=switch_active&amp;obj_index=';
    $ma = new Man_MiddleArea();
    $disabled_list = $ma->getDisabledList();
    // Main men
    $main_menu = '';
    while (list($id_m, $default_name, $my_name) = sql_fetch_row($re_menu_voice)) {
        $main_menu .= '<li>' . '<span>' . Lang::t($default_name, 'menu_over', false, false, $default_name) . '</span>' . ' <a class="ico-sprite subs_users" href="' . $base_url . 'mo_' . $id_m . '"><span>' . Lang::t('_VIEW_PERMISSION', 'standard') . '</span></a>' . ' <a class="ico-sprite subs_' . (isset($disabled_list['mo_' . $id_m]) ? 'noac' : 'actv') . '" href="' . $second_url . 'mo_' . $id_m . '"><span>' . Lang::t('_ENABLE_AREA', 'middlearea') . '</span></a>' . '</li>';
    }
    $main_menu .= '<li>' . '<span>' . Lang::t('_MESSAGES', 'menu_over') . '</span>' . ' <a class="ico-sprite subs_users" href="' . $base_url . 'mo_message' . '"><span>' . Lang::t('_VIEW_PERMISSION', 'standard') . '</span></a>' . ' <a class="ico-sprite subs_' . (isset($disabled_list['mo_message']) ? 'noac' : 'actv') . '" href="' . $second_url . 'mo_message' . '"><span>' . Lang::t('_ENABLE_AREA', 'middlearea') . '</span></a>' . '</li>';
    $main_menu .= '<li>' . '<span>' . Lang::t('_CUSTOMER_HELP', 'customer_help') . '</span>' . ' <a class="ico-sprite subs_users" href="' . $base_url . 'mo_help' . '"><span>' . Lang::t('_VIEW_PERMISSION', 'standard') . '</span></a>' . ' <a class="ico-sprite subs_' . (isset($disabled_list['mo_help']) ? 'noac' : 'actv') . '" href="' . $second_url . 'mo_help' . '"><span>' . Lang::t('_ENABLE_AREA', 'middlearea') . '</span></a>' . '</li>';
    // Tab list
    $tab_list = '';
    $tab = array('tb_elearning' => Lang::t('_ELEARNING', 'middlearea'), 'tb_home' => Lang::t('_HOME', 'middlearea'), 'tb_label' => Lang::t('_LABELS', 'label'), 'tb_classroom' => Lang::t('_CLASSROOM', 'middlearea'), 'tb_catalog' => Lang::t('_CATALOGUE', 'middlearea'), 'tb_assessment' => Lang::t('_ASSESSMENT', 'middlearea'), 'tb_coursepath' => Lang::t('_COURSEPATH', 'coursepath'), 'tb_games' => Lang::t('_CONTEST', 'middlearea'), 'tb_communication' => Lang::t('_COMMUNICATIONS', 'middlearea'), 'tb_videoconference' => Lang::t('_VIDEOCONFERENCE', 'middlearea'), 'tb_kb' => Lang::t('_CONTENT_LIBRARY', 'middlearea'));
    if (Get::cfg('enable_plugins', false)) {
        require_once _adm_ . "/models/PluginAdm.php";
        $pluginAdm = new PluginAdm();
        $plugins = $pluginAdm->getInstalledPlugins();
        foreach ($plugins as $plugin_name) {
            $tab["tb_" . strtolower($plugin_name)] = ucfirst($plugin_name);
        }
    }
    $query_menu = "SELECT obj_index from %lms_middlearea where obj_index like 'tb_%' ORDER BY sequence";
    $re_tablist = sql_query($query_menu);
    while (list($obj_index) = sql_fetch_row($re_tablist)) {
        $id = $obj_index;
        $name = $tab[$id];
        $tab_list .= '<li id="' . $id . '">' . '<span>' . $name . '</span>' . ' <a class="ico-sprite subs_users" href="' . $base_url . $id . '"><span>' . Lang::t('_VIEW_PERMISSION', 'standard') . '</span></a>' . ' <a class="ico-sprite subs_' . (isset($disabled_list[$id]) ? 'noac' : 'actv') . '" href="' . $second_url . $id . '"><span>' . Lang::t('_ENABLE_AREA', 'middlearea') . '</span></a>' . '</li>';
    }
    // Block List
    $block_list = '';
    $block = array('user_details_full' => Lang::t('_PROFILE', 'profile'), 'credits' => Lang::t('_CREDITS', 'middlearea'), 'career' => Lang::t('_CAREER', 'middlearea'), 'course' => Lang::t('_SUBSCRIBE_COURSE', 'middlearea'), 'news' => Lang::t('_NEWS', 'middlearea'));
    while (list($id, $name) = each($block)) {
        $block_list .= '<div class="direct_block">' . '<span>' . $name . '</span>' . ' <a class="ico-sprite subs_users" href="' . $base_url . $id . '"><span>' . Lang::t('_VIEW_PERMISSION', 'standard') . '</span></a>' . ' <a class="ico-sprite subs_' . (isset($disabled_list[$id]) ? 'noac' : 'actv') . '" href="' . $second_url . $id . '"><span>' . Lang::t('_ENABLE_AREA', 'middlearea') . '</span></a>' . '</div><br/>';
    }
    cout(getTitleArea($lang->def('_MIDDLE_AREA'), 'middlearea') . '<div class="std_block">');
    cout('<h2>' . Lang::t('_MAN_MENU', 'menu') . '</h2>' . '<ul class="action-list">' . $main_menu . '</ul>');
    cout('<div id="lms_main_container" class="yui-t5">' . '<div class="yui-b">' . '<h2>' . Lang::t('_BLOCKS', 'middlearea') . '</h2>' . $block_list . '</div>' . '<div id="yui-main">' . '<div class="yui-b" id="tablist">' . '<h2>' . Lang::t('_TABS', 'middlearea') . '</h2>' . '<ul class="action-list">' . $tab_list . '</ul>' . '</div>' . '</div>' . '<div class="nofloat"></div>' . '</div>');
    cout('</div>');
    $js = "\r\n\t<script src=\"http://yui.yahooapis.com/3.9.1/build/yui/yui-min.js\"></script>\r\n\t<script>\r\n\tYUI().use('sortable', function (Y) {\r\n\t    var sortable;\r\n\t    sortable = new Y.Sortable({\r\n\t        container: '#tablist ul',\r\n\t        nodes    : 'li',\r\n\t        opacity  : '0.1'\r\n\t    });\r\n\r\n        sortable.delegate.after('drag:end', function (e) {\r\n\t        var node = sortable.delegate.get('currentNode');\r\n\r\n\t            // rewind\r\n\t            while(node.previous()) {\r\n\t            \tnode = node.previous();\r\n}\r\n\t            // ciclo\r\n\t            a = node.get('id');\r\n\t            while(node.next()) {\r\n\t            \tnode = node.next();\r\n\t            \ta += ','+node.get('id');\r\n\t            }\r\n\r\n\t            sUrl = 'ajax.adm_server.php?r=middlearea/order&list='+a;\r\n\r\n\t\t        var callback = {\r\n\t\t                success: function(o) {\r\n\t\t                },\r\n\t\t                failure:function(o) {\r\n\t\t                }\r\n\t\t        };\r\n\t\t        YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);\r\n\r\n\r\n\t    });\r\n    });\r\n\r\n\r\n    </script>";
    cout($js);
}