Exemplo n.º 1
0
function moodbile_get_theme_css()
{
    global $CFG, $Moodbile;
    $info = moodbile_get_theme_info($CFG['theme']);
    $device = moodbile_device();
    $css[] = "misc/reset.css";
    foreach ($info['css'] as $themecss) {
        $css[] = 'themes/' . $CFG['theme'] . '/' . $themecss;
        $css_device = explode(".", $themecss);
        $css_device = 'themes/' . $CFG['theme'] . '/' . $css_device[0] . '.' . strtolower($device) . '.' . $css_device[1];
        if (file_exists($css_device)) {
            $css[] = $css_device;
        }
    }
    if ($CFG['cache'] !== FALSE) {
        $css = moodbile_performance($CFG['cache'], $css, 'css');
    }
    $Moodbile['css'] = $css;
    return $css;
}
Exemplo n.º 2
0
/**
 * Get all JS libs
 *
 * @return array with Moodbile libraries
 */
function moodbile_get_client_scripts()
{
    //Se encargara de unificar los js tanto de los modulos como del sistema
    global $CFG, $Moodbile;
    $basepath = $CFG['basepath'];
    $active_modules = $CFG['active_modules'];
    $js = array();
    //client scripts
    $js_jq[] = 'misc/jquery/jquery.js';
    $js_jq[] = 'misc/jquery/jquery.cooquery.min.js';
    $js_jq[] = 'misc/jquery/jquery.json.min.js';
    $js_jq[] = 'misc/jquery/jquery.md5.js';
    if ($CFG['cache'] !== FALSE) {
        $js[] = moodbile_performance($CFG['cache'], $js_jq, 'js', 'moodbile.jq');
    } else {
        $js = array_merge_recursive($js, $js_jq);
    }
    //client libs
    $js_lib[] = 'lib/js/core.lib.js';
    $js_lib[] = 'lib/js/authentication.lib.js';
    $js_lib[] = 'lib/js/ajax.lib.js';
    $js_lib[] = 'lib/js/alert.lib.js';
    $js_lib[] = 'lib/js/notifications.lib.js';
    $js_lib[] = 'lib/js/webdb.lib.js';
    $js_lib[] = 'lib/js/templates.lib.js';
    $js_lib[] = 'lib/js/fx.lib.js';
    $js_lib[] = 'lib/js/infoviewer.lib.js';
    $js_lib[] = 'lib/js/filter.lib.js';
    $js_lib[] = 'lib/js/toolbar.lib.js';
    $js_lib[] = 'lib/js/breadcrumb.lib.js';
    $js_lib[] = 'lib/js/footer.lib.js';
    if ($CFG['cache'] !== FALSE) {
        $js[] = moodbile_performance($CFG['cache'], $js_lib, 'js', 'moodbile.lib');
    } else {
        $js = array_merge_recursive($js, $js_lib);
    }
    //lang str library
    $js_lang[] = moodbile_i18n();
    if (moodbile_is_loged()) {
        $cookie = json_decode($_COOKIE['Moodbile']);
        $lang = $cookie->lang;
        $filename = 'moodbile.lang.' . $lang;
    } else {
        $filename = 'moodbile.lang';
    }
    if ($CFG['cache'] !== FALSE) {
        $js[] = moodbile_performance($CFG['cache'], $js_lang, 'js', $filename);
    } else {
        $js = array_merge_recursive($js, $js_lang);
    }
    //module scripts
    foreach ($active_modules as $module) {
        $module_files = moodbile_get_module($module);
        $file = array_intersect($module_files, array($module . '.mod.js'));
        $key = array_keys($file);
        $js_mod[] = 'modules/' . $module . '/' . $file[$key[0]];
    }
    if ($CFG['cache'] !== FALSE) {
        $js[] = moodbile_performance($CFG['cache'], $js_mod, 'js', 'moodbile.mod');
    } else {
        $js = array_merge_recursive($js, $js_mod);
    }
    //Solucionar problemas a la hora de abrir la directorios y meterlo en cache
    if ($themejs = moodbile_get_theme_scripts()) {
        foreach ($themejs as $themejs) {
            $js_thm[] = 'themes/' . $CFG['theme'] . '/' . $themejs;
        }
        if ($CFG['cache'] !== FALSE) {
            $js[] = moodbile_performance($CFG['cache'], $js_thm, 'js', 'moodbile.thm');
        } else {
            $js = array_merge_recursive($js, $js_thm);
        }
    }
    $Moodbile['js'] = $js;
    return $js;
}