示例#1
0
     echo '<div id="tabs-1">';
     handle_plugins();
     echo '</div>';
     echo '<div id="tabs-2">';
     DashboardManager::handle_dashboard_plugins();
     echo '</div>';
     echo '<div id="tabs-3">';
     handle_extensions();
     echo '</div>';
     echo '</div>';
     break;
 case 'Stylesheets':
     // Displaying the extensions: Stylesheets.
     handle_stylesheets();
     if (isset($_POST)) {
         api_set_setting_last_update();
     }
     $form->display();
     break;
 case 'Search':
     handle_search();
     break;
 case 'Templates':
     handle_templates();
     break;
 case 'search_setting':
     search_setting($keyword);
     if (!empty($keyword)) {
         $form->display();
     }
     break;
/**
 * This function allows easy activating and inactivating of regions
 * @author Julio Montoya <*****@*****.**> Beeznest 2012
 */
function handle_regions()
{
    if (isset($_POST['submit_plugins'])) {
        store_regions();
        // Add event to the system log.
        $user_id = api_get_user_id();
        $category = $_GET['category'];
        api_set_setting_last_update();
        event_system(LOG_CONFIGURATION_SETTINGS_CHANGE, LOG_CONFIGURATION_SETTINGS_CATEGORY, $category, api_get_utc_datetime(), $user_id);
        Display::display_confirmation_message(get_lang('SettingsStored'));
    }
    $plugin_obj = new AppPlugin();
    $possible_plugins = $plugin_obj->read_plugins_from_path();
    $installed_plugins = $plugin_obj->get_installed_plugins();
    if (!empty($installed_plugins)) {
        $not_installed = array_diff($possible_plugins, $installed_plugins);
    } else {
        $not_installed = $possible_plugins;
    }
    echo '<form name="plugins" method="post" action="' . api_get_self() . '?category=' . Security::remove_XSS($_GET['category']) . '">';
    echo '<table class="data_table">';
    echo '<tr>';
    echo '<th width="400px">';
    echo get_lang('Plugin');
    echo '</th><th>';
    echo get_lang('Regions');
    echo '</th>';
    echo '</th>';
    echo '</tr>';
    /* We display all the possible plugins and the checkboxes */
    $plugin_region_list = array();
    $my_plugin_list = $plugin_obj->get_plugin_regions();
    foreach ($my_plugin_list as $plugin_item) {
        $plugin_region_list[$plugin_item] = $plugin_item;
    }
    //Removing course tool
    unset($plugin_region_list['course_tool_plugin']);
    foreach ($installed_plugins as $plugin) {
        $plugin_info_file = api_get_path(SYS_PLUGIN_PATH) . $plugin . '/plugin.php';
        if (file_exists($plugin_info_file)) {
            $plugin_info = array();
            require $plugin_info_file;
            if (isset($_GET['name']) && $_GET['name'] == $plugin) {
                echo '<tr class="row_selected">';
            } else {
                echo '<tr>';
            }
            echo '<td>';
            echo '<h4>' . $plugin_info['title'] . ' <small>v' . $plugin_info['version'] . '</small></h4>';
            echo '<p>' . $plugin_info['comment'] . '</p>';
            echo '</td><td>';
            $selected_plugins = $plugin_obj->get_areas_by_plugin($plugin);
            if (isset($plugin_info['is_course_plugin']) && $plugin_info['is_course_plugin']) {
                $region_list = array('course_tool_plugin' => 'course_tool_plugin');
            } else {
                $region_list = $plugin_region_list;
            }
            echo Display::select('plugin_' . $plugin . '[]', $region_list, $selected_plugins, array('multiple' => 'multiple', 'style' => 'width:500px'), true, get_lang('None'));
            echo '</td></tr>';
        }
    }
    echo '</table>';
    echo '<br />';
    echo '<button class="save" type="submit" name="submit_plugins">' . get_lang('EnablePlugins') . '</button></form>';
}