Exemplo n.º 1
0
foreach ($moduleList as $module) {
    $module_dock[$module['id']] = array();
    $module_dock[$module['id']] = get_module_dock_list($module['id']);
    if (!file_exists(get_module_path($module['label']))) {
        $dialogBox->warning(get_lang('<b>Warning : </b>') . get_lang('There is a module installed in DB : <b><i>%module_name</i></b> for which there is no folder on the server.', array('%module_name' => $module['label'])));
    }
}
//do a check of modules to see if there is anyhting to install
$modules_found = check_module_repositories();
foreach ($modules_found['folder'] as $module_folder) {
    $urlTryInstall = $_SERVER['PHP_SELF'] . '?cmd=exLocalInstall&amp;moduleDir=' . rawurlencode($module_folder);
    $urlDelete = $_SERVER['PHP_SELF'] . '?cmd=exLocalRemove&amp;moduleDir=' . rawurlencode($module_folder);
    $dialogBox->warning(get_lang('There is a folder called <b><i>%module_name</i></b> for which there is no module installed.', array('%module_name' => $module_folder)) . '<ul>' . "\n" . '<li>' . "\n" . '<a href="' . $urlTryInstall . '">' . get_lang('Install this module') . '</a>' . '</li>' . "\n" . '<li>' . "\n" . '<a href="' . $urlDelete . '">' . get_lang('Remove this module') . '</a>' . '</li>' . "\n" . '</ul>' . "\n");
}
//needed info for reorder buttons to known if we must display action (or not)
$course_tool_min_rank = get_course_tool_min_rank();
$course_tool_max_rank = get_course_tool_max_rank();
// Command list
$cmdList = array();
$cmdList[] = array('name' => get_lang('Install module'), 'url' => 'module_list.php?cmd=rqInstall');
//----------------------------------
// DISPLAY
//----------------------------------
$noQUERY_STRING = true;
$out = '';
// Title
$out .= claro_html_tool_title($nameTools, null, $cmdList) . $dialogBox->render() . '<div>' . "\n" . '<ul id="navlist">' . "\n";
// Display the module type tabbed naviguation bar
foreach ($moduleTypeList as $type) {
    if ($typeReq == $type) {
        $out .= '<li><a href="module_list.php?typeReq=' . $type . '" class="current">' . $typeLabel[$type] . '</a></li>' . "\n";
Exemplo n.º 2
0
/**
 * Move the place of the module in the module list
 * (it changes the value of def_rank in the course_tool table)
 * @param $moduleId id of the module tool to move
 * @param $sense should either 'up' or 'down' to know in which direction the module has to move in the list
 */
function move_module_tool($toolId, $sense)
{
    $tbl_mdb_names = claro_sql_get_main_tbl();
    $tbl_tool_list = $tbl_mdb_names['tool'];
    $current_rank = get_course_tool_rank($toolId);
    switch ($sense) {
        case 'up':
            $min_rank = get_course_tool_min_rank();
            if ($current_rank == $min_rank) {
                return false;
            } else {
                $before_rank = get_before_course_tool($current_rank);
                //SWAP the two ranks
                $sql = "UPDATE `" . $tbl_tool_list . "`\n                        SET def_rank = '" . $current_rank . "' WHERE def_rank = '" . $before_rank . "'";
                claro_sql_query($sql);
                $sql = "UPDATE `" . $tbl_tool_list . "`\n                        SET def_rank = '" . $before_rank . "' WHERE id = '" . $toolId . "'";
                claro_sql_query($sql);
            }
            break;
        case 'down':
            $max_rank = get_course_tool_max_rank();
            if ($current_rank == $max_rank) {
                return false;
            } else {
                $next_rank = get_next_course_tool($current_rank);
                //SWAP the two ranks
                $sql = "UPDATE `" . $tbl_tool_list . "`\n                        SET def_rank = " . $current_rank . " WHERE def_rank = " . $next_rank;
                claro_sql_query($sql);
                $sql = "UPDATE `" . $tbl_tool_list . "`\n                        SET def_rank = " . $next_rank . " WHERE id = " . $toolId;
                claro_sql_query($sql);
            }
            break;
    }
    return true;
}