public static function getInstance() { if (!self::$instance) { self::$instance = new self(); } return self::$instance; }
public function loadFromModule($moduleLabel, $lib, $media = 'all') { $lib = secure_file_path($lib); $moduleLabel = secure_file_path($moduleLabel); if (!get_module_data($moduleLabel)) { pushClaroMessage(__CLASS__ . "::{$moduleLabel} does not exists", 'error'); return false; } if (claro_debug_mode()) { pushClaroMessage(__CLASS__ . "::Try to find {$lib} for {$moduleLabel}", 'debug'); } $cssPath = array(0 => array('path' => get_path('rootSys') . 'platform/css/' . $moduleLabel . '/' . $lib . '.css', 'url' => get_path('url') . '/platform/css/' . $moduleLabel . '/' . $lib . '.css'), 1 => array('path' => get_module_path($moduleLabel) . '/css/' . $lib . '.css', 'url' => get_module_url($moduleLabel) . '/css/' . $lib . '.css')); /*$path = get_module_path( $moduleLabel ) . '/css/' . $lib . '.css'; $url = get_module_url( $moduleLabel ) . '/css/' . $lib . '.css';*/ foreach ($cssPath as $cssTry) { $path = $cssTry['path']; $url = $cssTry['url']; if (claro_debug_mode()) { pushClaroMessage(__CLASS__ . "::Try {$path}::{$url} for {$moduleLabel}", 'debug'); } if (file_exists($path)) { if (array_key_exists($path, $this->css)) { return false; } $this->css[$path] = array('url' => $url . '?' . filemtime($path), 'media' => $media); if (claro_debug_mode()) { pushClaroMessage(__CLASS__ . "::Use {$path}::{$url} for {$moduleLabel}", 'debug'); } ClaroHeader::getInstance()->addHtmlHeader('<link rel="stylesheet" type="text/css"' . ' href="' . $url . '"' . ' media="' . $media . '" />'); return true; } else { if (claro_debug_mode()) { pushClaroMessage(__CLASS__ . "::Cannot found css {$lib} for {$moduleLabel}", 'error'); } return false; } } }
public function __construct() { // HACK : force loading translation here to avoid having to rewrite the kernel ! language::load_translation(); language::load_locale_settings(); language::load_module_translation(); $this->header = ClaroHeader::getInstance(); }
public static function renderLinkerBlock($backendUrl = null) { if (empty($backendUrl)) { $backendUrl = get_path('clarolineRepositoryWeb') . 'backends/linker.php'; } self::init(); // Init Client Side Linker self::initUserAgent(); JavascriptLanguage::getInstance()->addLangVar('Attach'); JavascriptLanguage::getInstance()->addLangVar('Delete'); JavascriptLanguage::getInstance()->addLangVar('The resource is invisible. Are you sure that you want to attach this resource ?'); // init linkerFronted ClaroHeader::getInstance()->addInlineJavascript('linkerFrontend.base_url = "' . $backendUrl . '";' . "\n" . 'linkerFrontend.deleteIconUrl = "' . get_icon_url('delete') . '";' . "\n" . 'linkerFrontend.invisibleIconUrl = "' . get_icon_url('invisible') . '"; ' . "\n"); return '<div id="lnk_panel">' . "\n" . '<div id="lnk_selected_resources"></div>' . "\n" . '<p id="lnk_toggle">' . "\n" . '<a href="#" id="lnk_show_browser" class="attach">' . get_lang('Attach an existing resource') . '</a>' . "\n" . '<a href="#" id="lnk_hide_browser">' . get_lang('Close') . '</a>' . "\n" . '</p>' . "\n" . '<div id="lnk_browser">' . "\n" . '<div id="lnk_ajax_loading"><img src="' . get_icon_url('loading') . '" alt="" /></div>' . "\n" . '<h4 id="lnk_location"></h4>' . "\n" . '<div id="lnk_back_link"></div>' . '<div id="lnk_resources"></div>' . "\n" . '</div>' . "\n" . '<div id="lnk_hidden_fields"></div>' . "\n" . '</div>' . "\n\n"; }