Example #1
0
/**
 * Returns the jquery library js and css headers
 *
 * @param   array   list of jquery libraries supported jquery-ui, jqgrid
 * @param   bool    add the jquery library
 * @return  string  html tags
 *
 */
function api_get_jquery_libraries_js($libraries)
{
    $js = '';
    $js_path = api_get_path(WEB_LIBRARY_PATH) . 'javascript/';
    //jquery-ui js and css
    if (in_array('jquery-ui', $libraries)) {
        //Jquery ui
        $theme = 'smoothness';
        // Current themes: cupertino, smoothness, ui-lightness. Find the themes folder in main/inc/lib/javascript/jquery-ui
        $jquery_ui_version = '1.8.21';
        //$js .= '<link rel="stylesheet" href="'.$js_path.'jquery-ui/'.$theme.'/jquery-ui-'.$jquery_ui_version.'.custom.css" type="text/css">';
        $js .= api_get_css($js_path . 'jquery-ui/' . $theme . '/jquery-ui-' . $jquery_ui_version . '.custom.css');
        $js .= api_get_js('jquery-ui/' . $theme . '/jquery-ui-' . $jquery_ui_version . '.custom.min.js');
    }
    if (in_array('jquery-ui-i18n', $libraries)) {
        $js .= api_get_js('jquery-ui/jquery-ui-i18n.min.js');
    }
    //jqgrid js and css
    if (in_array('jqgrid', $libraries)) {
        $languaje = 'en';
        $platform_isocode = strtolower(api_get_language_isocode());
        //languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n
        $jqgrid_langs = array('bg', 'bg1251', 'cat', 'cn', 'cs', 'da', 'de', 'el', 'en', 'es', 'fa', 'fi', 'fr', 'gl', 'he', 'hu', 'is', 'it', 'ja', 'nl', 'no', 'pl', 'pt-br', 'pt', 'ro', 'ru', 'sk', 'sr', 'sv', 'tr', 'ua');
        if (in_array($platform_isocode, $jqgrid_langs)) {
            $languaje = $platform_isocode;
        }
        //$js .= '<link rel="stylesheet" href="'.$js_path.'jqgrid/css/ui.jqgrid.css" type="text/css">';
        $js .= api_get_css($js_path . 'jqgrid/css/ui.jqgrid.css');
        $js .= api_get_js('jqgrid/js/i18n/grid.locale-' . $languaje . '.js');
        $js .= api_get_js('jqgrid/js/jquery.jqGrid.min.js');
    }
    //Document multiple upload funcionality
    if (in_array('jquery-upload', $libraries)) {
        $js .= api_get_js('jquery-upload/jquery.fileupload.js');
        $js .= api_get_js('jquery-upload/jquery.fileupload-ui.js');
        $js .= api_get_css($js_path . 'jquery-upload/jquery.fileupload-ui.css');
    }
    //jquery-ui css changes for Chamilo
    if (in_array('jquery-ui', $libraries)) {
        //Adding default CSS changes of the jquery-ui themes for Chamilo in order to preserve the original jquery-ui css
        $js .= api_get_css($js_path . 'jquery-ui/default.css');
    }
    if (in_array('bxslider', $libraries)) {
        $js .= api_get_js('bxslider/jquery.bxSlider.min.js');
        $js .= api_get_css($js_path . 'bxslider/bx_styles/bx_styles.css');
    }
    // jquery datepicker
    if (in_array('datepicker', $libraries)) {
        $languaje = 'en-GB';
        $platform_isocode = strtolower(api_get_language_isocode());
        // languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n
        $datapicker_langs = array('af', 'ar', 'ar-DZ', 'az', 'bg', 'bs', 'ca', 'cs', 'cy-GB', 'da', 'de', 'el', 'en-AU', 'en-GB', 'en-NZ', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fo', 'fr', 'fr-CH', 'gl', 'he', 'hi', 'hr', 'hu', 'hy', 'id', 'is', 'it', 'ja', 'ka', 'kk', 'km', 'ko', 'lb', 'lt', 'lv', 'mk', 'ml', 'ms', 'nl', 'nl-BE', 'no', 'pl', 'pt', 'pt-BR', 'rm', 'ro', 'ru', 'sk', 'sl', 'sq', 'sr', 'sr-SR', 'sv', 'ta', 'th', 'tj', 'tr', 'uk', 'vi', 'zh-CN', 'zh-HK', 'zh-TW');
        if (in_array($platform_isocode, $datapicker_langs)) {
            $languaje = $platform_isocode;
        }
        $js .= api_get_js('jquery-ui/jquery-ui-i18n.min.js');
        $script = '<script>
        $(function(){
            $.datepicker.setDefaults($.datepicker.regional["' . $languaje . '"]);
            $.datepicker.regional["local"] = $.datepicker.regional["' . $languaje . '"];
        });
        </script>
        ';
        $js .= $script;
    }
    return $js;
}
Example #2
0
 /**
  * Prepare custom CSS to be added at the very end of the <head> section
  * @return void
  * @see setCssFiles() for the mainstream CSS files
  */
 public function setCssCustomFiles()
 {
     global $disable_js_and_css_files;
     // Base CSS
     $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH) . 'base.css');
     if ($this->show_learnpath) {
         $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH) . 'scorm.css');
         if (is_file(api_get_path(SYS_CSS_PATH) . 'themes/' . $this->theme . '/learnpath.css')) {
             $css[] = api_get_path(WEB_CSS_PATH) . 'themes/' . $this->theme . '/learnpath.css';
         }
     }
     $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH) . 'themes/' . $this->theme . '/default.css');
     $css_file_to_string = null;
     foreach ($css as $file) {
         $css_file_to_string .= api_get_css($file);
     }
     // @todo move this somewhere else. Special fix when using tablets in order to see the text near icons
     if (SHOW_TEXT_NEAR_ICONS == true) {
         //hack in order to fix the actions buttons
         $css_file_to_string .= '<style>
             .td_actions a {
                 float:left;
                 width:100%;
             }
             .forum_message_left a {
                 float:left;
                 width:100%;
             }
             </style>';
     }
     $navigator_info = api_get_navigator();
     if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
         $css_file_to_string .= 'img, div { behavior: url(' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/iepngfix/iepngfix.htc) } ' . "\n";
     }
     if (!$disable_js_and_css_files) {
         $this->assign('css_custom_file_to_string', $css_file_to_string);
         $style_print = '';
         if (is_readable(api_get_path(SYS_CSS_PATH) . $this->theme . '/print.css')) {
             $style_print = api_get_css(api_get_cdn_path(api_get_path(WEB_CSS_PATH) . $this->theme . '/print.css'), 'print');
         }
         $this->assign('css_style_print', $style_print);
     }
     // Logo
     $logo = return_logo($this->theme);
     $this->assign('logo', $logo);
     $this->assign('show_media_element', 1);
 }
Example #3
0
}
//Checking visibility (eye icon)
$visibility = api_get_item_visibility(api_get_course_info(), TOOL_LEARNPATH, $lp_id, $action, api_get_user_id(), api_get_session_id());
if (!api_is_allowed_to_edit(null, true) && intval($visibility) == 0) {
    api_not_allowed();
}
if (empty($_SESSION['oLP'])) {
    api_not_allowed(true);
}
$debug = 0;
if ($debug) {
    error_log('------ Entering lp_impress.php -------');
}
$course_code = api_get_course_id();
$course_id = api_get_course_int_id();
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH) . 'javascript/impress/impress-demo.css');
$list = $_SESSION['oLP']->get_toc();
$is_allowed_to_edit = api_is_allowed_to_edit(null, true, false, false);
if ($is_allowed_to_edit) {
    echo '<div style="position: fixed; top: 0px; left: 0px; pointer-events: auto;width:100%">';
    global $interbreadcrumb;
    $interbreadcrumb[] = array('url' => 'lp_controller.php?action=list&isStudentView=false', 'name' => get_lang('LearningPaths'));
    $interbreadcrumb[] = array('url' => api_get_self() . "?action=add_item&type=step&lp_id=" . $_SESSION['oLP']->lp_id . "&isStudentView=false", 'name' => $_SESSION['oLP']->get_name());
    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Preview'));
    echo return_breadcrumb($interbreadcrumb, null, null);
    echo '</div>';
}
$html = '';
$step = 1;
foreach ($list as $toc) {
    $x = 1000 * $step;
Example #4
0
            $(window).resize(resizeIframe());
        });
    </script>';
}
// Activate code highlight.
$isChatFolder = false;
if (isset($document_data['parents']) && isset($document_data['parents'][0])) {
    $chatFolder = $document_data['parents'][0];
    if (isset($chatFolder['path']) && $chatFolder['path'] == '/chat_files') {
        $isChatFolder = true;
    }
}
if ($isChatFolder) {
    $htmlHeadXtra[] = api_get_js('js/highlight/highlight.pack.js');
    $htmlHeadXtra[] = api_get_css('css/chat.css');
    $htmlHeadXtra[] = api_get_css('js/highlight/styles/github.css');
    $htmlHeadXtra[] = '
    <script>
        hljs.initHighlightingOnLoad();
    </script>';
}
$execute_iframe = true;
if ($jplayer_supported) {
    $extension = api_strtolower($pathinfo['extension']);
    $js_path = api_get_path(WEB_LIBRARY_PATH) . 'javascript/';
    $htmlHeadXtra[] = '<link rel="stylesheet" href="' . $js_path . 'jquery-jplayer/skins/blue/jplayer.blue.monday.css" type="text/css">';
    $htmlHeadXtra[] = '<script type="text/javascript" src="' . $js_path . 'jquery-jplayer/jquery.jplayer.min.js"></script>';
    $jquery = ' $("#jquery_jplayer_1").jPlayer({
                    ready: function() {
                        $(this).jPlayer("setMedia", {
                            ' . $extension . ' : "' . $document_data['direct_url'] . '"
if (!$objExercise) {
    //Redirect to the exercise overview
    //Check if the exe_id exists
    header("Location: overview.php?exerciseId=" . $exerciseId);
    exit;
}
$time_control = false;
$clock_expired_time = ExerciseLib::get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id);
if ($objExercise->expired_time != 0 && !empty($clock_expired_time)) {
    $time_control = true;
}
if ($time_control) {
    // Get time left for exipiring time
    $time_left = api_strtotime($clock_expired_time, 'UTC') - time();
    $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH) . 'javascript/epiclock/stylesheet/jquery.epiclock.css');
    $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH) . 'javascript/epiclock/renderers/minute/epiclock.minute.css');
    $htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.dateformat.min.js');
    $htmlHeadXtra[] = api_get_js('epiclock/javascript/jquery.epiclock.min.js');
    $htmlHeadXtra[] = api_get_js('epiclock/renderers/minute/epiclock.minute.js');
    $htmlHeadXtra[] = $objExercise->show_time_control_js($time_left);
}
$exe_id = intval(Session::read('exe_id'));
$exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id);
if (!empty($exercise_stat_info['data_tracking'])) {
    $question_list = explode(',', $exercise_stat_info['data_tracking']);
}
if (empty($exercise_stat_info) || empty($question_list)) {
    api_not_allowed();
}
$nameTools = get_lang('Exercises');
$interbreadcrumb[] = array("url" => "exercise.php?" . api_get_cidreq(), "name" => get_lang('Exercises'));
Example #6
0
*/
use Chamilo\UserBundle\Entity\User;
use ChamiloSession as Session;
$cidReset = true;
if (api_get_setting('social.allow_social_tool') == 'true') {
    $this_section = SECTION_SOCIAL;
} else {
    $this_section = SECTION_MYPROFILE;
}
//$htmlHeadXtra[] = api_get_password_checker_js('#username', '#password1');
$_SESSION['this_section'] = $this_section;
if (!(isset($_user['user_id']) && $_user['user_id']) || api_is_anonymous($_user['user_id'], true)) {
    api_not_allowed(true);
}
$htmlHeadXtra[] = api_get_password_checker_js('#username', '#password1');
$htmlHeadXtra[] = api_get_css('components/cropper/dist/cropper.min.css');
$htmlHeadXtra[] = api_get_js('components/cropper/dist/cropper.min.js');
$htmlHeadXtra[] = '<script>
$(document).ready(function() {
    var $image = $("#previewImage");
    var $input = $("[name=\'cropResult\']");
    var $cropButton = $("#cropButton");
    var canvas = "";
    var imageWidth = "";
    var imageHeight = "";

    $("input:file").change(function() {
        var oFReader = new FileReader();
        oFReader.readAsDataURL(document.getElementById("picture_form").files[0]);

        oFReader.onload = function (oFREvent) {
Example #7
0
/**
 * Returns the jquery library js and css headers
 *
 * @param   array   list of jquery libraries supported jquery-ui, jqgrid
 * @param   bool    add the jquery library
 * @return  string  html tags
 *
 */
function api_get_jquery_libraries_js($libraries)
{
    $js = '';
    //jqgrid js and css
    if (in_array('jqgrid', $libraries)) {
        $languaje = 'en';
        $platform_isocode = strtolower(api_get_language_isocode());
        //languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n
        $jqgrid_langs = array('bg', 'bg1251', 'cat', 'cn', 'cs', 'da', 'de', 'el', 'en', 'es', 'fa', 'fi', 'fr', 'gl', 'he', 'hu', 'is', 'it', 'ja', 'nl', 'no', 'pl', 'pt-br', 'pt', 'ro', 'ru', 'sk', 'sr', 'sv', 'tr', 'ua');
        if (in_array($platform_isocode, $jqgrid_langs)) {
            $languaje = $platform_isocode;
        }
        //$js .= '<link rel="stylesheet" href="'.$js_path.'jqgrid/css/ui.jqgrid.css" type="text/css">';
        $js .= api_get_css('components/jqgrid/css/ui.jqgrid.css');
        $js .= api_get_css('components/jqgrid/js/i18n/grid.locale-' . $languaje . '.js');
        $js .= api_get_js('components/jqgrid/js/minified/jquery.jqGrid.min.js');
    }
    //Document multiple upload funcionality
    /*    if (in_array('jquery-upload', $libraries)) {
              $js .= api_get_js('jquery-upload/jquery.fileupload.js');
              $js .= api_get_js('jquery-upload/jquery.fileupload-ui.js');
              $js .= api_get_css($js_path.'jquery-upload/jquery.fileupload-ui.css');
          }*/
    // jquery datepicker
    if (in_array('datepicker', $libraries)) {
        $languaje = 'en-GB';
        $platform_isocode = strtolower(api_get_language_isocode());
        // languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n
        $datapicker_langs = array('af', 'ar', 'ar-DZ', 'az', 'bg', 'bs', 'ca', 'cs', 'cy-GB', 'da', 'de', 'el', 'en-AU', 'en-GB', 'en-NZ', 'eo', 'es', 'et', 'eu', 'fa', 'fi', 'fo', 'fr', 'fr-CH', 'gl', 'he', 'hi', 'hr', 'hu', 'hy', 'id', 'is', 'it', 'ja', 'ka', 'kk', 'km', 'ko', 'lb', 'lt', 'lv', 'mk', 'ml', 'ms', 'nl', 'nl-BE', 'no', 'pl', 'pt', 'pt-BR', 'rm', 'ro', 'ru', 'sk', 'sl', 'sq', 'sr', 'sr-SR', 'sv', 'ta', 'th', 'tj', 'tr', 'uk', 'vi', 'zh-CN', 'zh-HK', 'zh-TW');
        if (in_array($platform_isocode, $datapicker_langs)) {
            $languaje = $platform_isocode;
        }
        $js .= api_get_js('components/jquery-ui/jquery-ui-i18n.min.js');
        $script = '<script>
        $(function(){
            $.datepicker.setDefaults($.datepicker.regional["' . $languaje . '"]);
            $.datepicker.regional["local"] = $.datepicker.regional["' . $languaje . '"];
        });
        </script>
        ';
        $js .= $script;
    }
    return $js;
}
Example #8
0
 /**
  * @return string
  */
 public function parseResources()
 {
     $resourceToString = null;
     foreach ($this->resources as $type => $resources) {
         switch ($type) {
             case 'js':
                 if ($this->disableJsAndCss == false) {
                     foreach ($resources as $resource) {
                         //$resourceToString .= api_get_js_simple($resource);
                     }
                 }
                 break;
             case 'css':
                 if ($this->disableJsAndCss == false) {
                     foreach ($resources as $resource) {
                         $resourceToString .= api_get_css($resource);
                     }
                 }
                 break;
             case 'string':
                 if ($this->disableJsAndCss == false) {
                     foreach ($resources as $resource) {
                         $resourceToString .= $resource;
                     }
                 }
                 break;
             case 'no_js_css':
                 foreach ($resources as $resource) {
                     $resourceToString .= $resource;
                 }
                 break;
         }
     }
     $this->assign('resources', $resourceToString);
 }
Example #9
0
    /**
     * The ajax call must contain an array of id and text
     * @return string
     */
    function toHtml()
    {
        $html = api_get_asset('select2/dist/js/select2.min.js');
        $iso = api_get_language_isocode(api_get_interface_language());
        $languageCondition = '';
        if (file_exists(api_get_path(SYS_PATH) . "web/assets/select2/dist/js/i18n/{$iso}.js")) {
            $html .= api_get_asset("select2/dist/js/i18n/{$iso}.js");
            $languageCondition = "language: '{$iso}',";
        }
        $html .= api_get_css(api_get_path(WEB_PATH) . 'web/assets/select2/dist/css/select2.min.css');
        $formatResult = $this->getAttribute('formatResult');
        $formatCondition = null;
        if (!empty($formatResult)) {
            $formatCondition = ',
                templateResult : ' . $formatResult . ',
                templateSelection : ' . $formatResult;
        }
        $width = 'element';
        $givenWidth = '100%';
        if (!empty($givenWidth)) {
            $width = $givenWidth;
        }
        //Get the minimumInputLength for select2
        $minimumInputLength = $this->getAttribute('minimumInputLength') > 3 ? $this->getAttribute('minimumInputLength') : 3;
        $plHolder = $this->getAttribute('placeholder');
        if (empty($plHolder)) {
            $plHolder = get_lang('SelectAnOption');
        }
        $id = $this->getAttribute('id');
        if (empty($id)) {
            $id = $this->getAttribute('name');
            $this->setAttribute('id', $id);
        }
        $html .= <<<JS
            <script>
                \$(function(){
                    \$('#{$this->getAttribute('id')}').select2({
                        {$languageCondition}
                        placeholder: '{$plHolder}',
                        allowClear: true,
                        width: '{$width}',
                        minimumInputLength: '{$minimumInputLength}',
                        ajax: {
                            url: '{$this->getAttribute('url')}',
                            dataType: 'json',
                            data: function(params) {
                                return {
                                    q: params.term, // search term
                                    page_limit: 10,
                                };
                            },
                            processResults: function (data, page) {
                                //parse the results into the format expected by Select2
                                return {
                                    results: data.items
                                };
                            }
                            {$formatCondition}
                        }
                    });
                });
            </script>
JS;
        $this->removeAttribute('formatResult');
        $this->removeAttribute('minimumInputLength');
        $this->removeAttribute('placeholder');
        $this->removeAttribute('class');
        $this->removeAttribute('url');
        $this->setAttribute('style', 'width: 100%;');
        return parent::toHtml() . $html;
    }
 /**
  * Set theme, include CSS files
  */
 private function setCssFiles()
 {
     global $disable_js_and_css_files;
     $css = array();
     $this->theme = api_get_visual_theme();
     if (isset($_POST['style']) && api_is_platform_admin()) {
         $this->preview_theme = $_POST['style'];
     }
     if (!empty($this->preview_theme)) {
         $this->theme = $this->preview_theme;
     }
     $this->app['theme'] = $this->theme;
     $cssPath = api_get_path(WEB_CSS_PATH);
     // Loads only 1 css file
     if ($this->app['assetic.enabled']) {
         $css[] = api_get_path(WEB_PUBLIC_PATH) . 'css/' . $this->theme . '/style.css';
     } else {
         // Bootstrap
         $css[] = api_get_cdn_path(api_get_path(WEB_LIBRARY_PATH) . 'javascript/bootstrap/css/bootstrap.css');
         //$css[] = api_get_cdn_path(api_get_path(WEB_LIBRARY_PATH).'javascript/bootstrap/css/bootstrap-theme.css');
         // Base CSS.
         $css[] = api_get_cdn_path($cssPath . 'base.css');
         // Default theme CSS.
         $css[] = api_get_cdn_path($cssPath . $this->theme . '/default.css');
         // Extra CSS files.
         if ($this->show_learnpath) {
             //$css[] = $cssPath.$this->theme.'/learnpath.css';
             //$css[] = $cssPath.$this->theme.'/scorm.css';
         }
         if (api_is_global_chat_enabled()) {
             $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/chat/css/chat.css';
         }
         $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/jquery-ui/css/' . $this->jquery_ui_theme . '/jquery-ui-custom.css';
         //$css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/jquery-ui/default.css';
     }
     $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/font-awesome/css/font-awesome.css';
     $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/thickbox.css';
     $css[] = api_get_path(WEB_LIBRARY_PATH) . 'javascript/chosen/chosen.css';
     $css_file_to_string = null;
     foreach ($css as $file) {
         $css_file_to_string .= api_get_css($file);
     }
     // @todo move this somewhere else. Special fix when using tablets in order to see the text near icons
     if (SHOW_TEXT_NEAR_ICONS == true) {
         //hack in order to fix the actions buttons
         $css_file_to_string .= '<style>
             .td_actions a {
                 float:left;
                 width:100%;
             }
             .forum_message_left a {
                 float:left;
                 width:100%;
             }
             </style>';
     }
     $navigator_info = api_get_navigator();
     if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
         $css_file_to_string .= 'img, div { behavior: url(' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/iepngfix/iepngfix.htc) } ' . "\n";
     }
     if (!$disable_js_and_css_files) {
         $this->assign('css_file_to_string', $css_file_to_string);
         $style_print = api_get_css(api_get_cdn_path($cssPath . $this->theme . '/print.css'), 'print');
         $this->assign('css_style_print', $style_print);
     }
 }
Example #11
0
/**
 * Init
 */
$language_file = array('document');
//require_once '../inc/global.inc.php';
if (!api_is_allowed_to_edit(null, true)) {
    api_not_allowed(true);
}
$current_course_tool = TOOL_DOCUMENT;
$this_section = SECTION_COURSES;
$tool_name = get_lang('DocumentQuota');
$interbreadcrumb[] = array('url' => 'document.php', 'name' => get_lang('Documents'));
$htmlHeadXtra[] = api_get_js('jqplot/jquery.jqplot.min.js');
$htmlHeadXtra[] = api_get_js('jqplot/plugins/jqplot.pieRenderer.min.js');
$htmlHeadXtra[] = api_get_js('jqplot/plugins/jqplot.donutRenderer.min.js');
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH) . 'jqplot/jquery.jqplot.min.css');
$course_code = api_get_course_id();
$course_id = api_get_course_int_id();
$session_id = api_get_session_id();
$group_id = api_get_group_id();
$user_id = api_get_user_id();
$user_info = api_get_user_info($user_id);
$session = array();
$user_name = $user_info['complete_name'];
$course_list = SessionManager::get_course_list_by_session_id($session_id);
$session_list = SessionManager::get_session_by_course($course_id);
$total_quota_bytes = DocumentManager::get_course_quota();
$quota_bytes = DocumentManager::documents_total_space($course_id, 0, 0);
$quota_percentage = round($quota_bytes / $total_quota_bytes, 2) * 100;
$session[] = array(get_lang('Course') . ' (' . Text::format_file_size($quota_bytes) . ')', $quota_percentage);
$used_quota_bytes = $quota_bytes;
Example #12
0
//Checking visibility (eye icon)
$visibility = api_get_item_visibility(api_get_course_info(), TOOL_LEARNPATH, $lp_id, $action, api_get_user_id(), api_get_session_id());
if (!api_is_allowed_to_edit(null, true) && intval($visibility) == 0) {
    api_not_allowed();
}
$learnPath = learnpath::getCurrentLpFromSession();
if (empty($learnPath)) {
    api_not_allowed(true);
}
$debug = 0;
if ($debug) {
    error_log('------ Entering lp_impress.php -------');
}
$course_code = api_get_course_id();
$course_id = api_get_course_int_id();
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH) . 'impress/impress-demo.css');
$list = $learnPath->get_toc();
$is_allowed_to_edit = api_is_allowed_to_edit(null, true, false, false);
if ($is_allowed_to_edit) {
    echo '<div style="position: fixed; top: 0px; left: 0px; pointer-events: auto;width:100%">';
    global $interbreadcrumb;
    $interbreadcrumb[] = array('url' => 'lp_controller.php?action=list&isStudentView=false', 'name' => get_lang('LearningPaths'));
    $interbreadcrumb[] = array('url' => api_get_self() . "?action=add_item&type=step&lp_id=" . $learnPath->lp_id . "&isStudentView=false", 'name' => $learnPath->get_name());
    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Preview'));
    echo return_breadcrumb($interbreadcrumb, null, null);
    echo '</div>';
}
$html = '';
$step = 1;
foreach ($list as $toc) {
    $x = 1000 * $step;
 /**
  * @param Application $app
  * @return Response
  */
 public function loginAction(Application $app)
 {
     $request = $this->getRequest();
     $app['template']->assign('error', $app['security.last_error']($request));
     $extra = array();
     if (api_get_setting('use_virtual_keyboard') == 'true') {
         $extra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH) . 'javascript/keyboard/keyboard.css');
         $extra[] = api_get_js('keyboard/jquery.keyboard.js');
     }
     $app['extraJS'] = $extra;
     $response = $app['template']->render_template('auth/login.tpl');
     return new Response($response, 200, array('Cache-Control' => 's-maxage=3600, public'));
 }
/**
 * Document quota management script
 * @package chamilo.document
 */
//require_once '../inc/global.inc.php';
if (!api_is_allowed_to_edit(null, true)) {
    api_not_allowed(true);
}
$current_course_tool = TOOL_DOCUMENT;
$this_section = SECTION_COURSES;
$tool_name = get_lang('DocumentQuota');
$interbreadcrumb[] = array('url' => 'document.php', 'name' => get_lang('Documents'));
$htmlHeadXtra[] = api_get_js('js/jqplot/jquery.jqplot.js');
$htmlHeadXtra[] = api_get_js('js/jqplot/plugins/jqplot.pieRenderer.js');
$htmlHeadXtra[] = api_get_js('js/jqplot/plugins/jqplot.donutRenderer.js');
$htmlHeadXtra[] = api_get_css('js/jqplot/jquery.jqplot.css');
$course_code = api_get_course_id();
$course_id = api_get_course_int_id();
$session_id = api_get_session_id();
$group_id = api_get_group_id();
$user_id = api_get_user_id();
$user_info = api_get_user_info($user_id);
$session = array();
$user_name = $user_info['complete_name'];
$course_list = SessionManager::get_course_list_by_session_id($session_id);
$session_list = SessionManager::get_session_by_course($course_id);
$total_quota_bytes = DocumentManager::get_course_quota();
$quota_bytes = DocumentManager::documents_total_space($course_id, 0, 0);
$quota_percentage = round($quota_bytes / $total_quota_bytes, 2) * 100;
$session[] = array(get_lang('Course') . ' (' . format_file_size($quota_bytes) . ')', $quota_percentage);
$used_quota_bytes = $quota_bytes;
Example #15
0
/* For licensing terms, see /license.txt */
/**
	@author Julio Montoya <*****@*****.**> BeezNest 2011
*	@package chamilo.timeline
*/
//require_once '../inc/global.inc.php';
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('Timeline'));
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('Listing'));
$timeline = new Timeline();
if (empty($_GET['id'])) {
    api_not_allowed();
}
$url = $timeline->get_url($_GET['id']);
$item = $timeline->get($_GET['id']);
$interbreadcrumb[] = array('url' => '#', 'name' => $item['headline']);
$htmlHeadXtra[] = api_get_css('js/timeline/timeline.css');
$htmlHeadXtra[] = api_get_js('js/timeline/timeline-min.js');
$htmlHeadXtra[] = '
<script>
	$(document).ready(function() {
		var timeline = new VMM.Timeline();
		timeline.init("' . $url . '");
	});
</script>';
$content = '<div class="timeline-example"><div id="timeline"></div></div>';
$tpl = new Template($tool_name);
$tpl->assign('actions', $actions);
$tpl->assign('message', $message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
echo api_get_path(WEB_LIBRARY_PATH);
?>
javascript/emojione/css/emojione.min.css">
<link rel="stylesheet" type="text/css" href="<?php 
echo api_get_path(WEB_LIBRARY_PATH);
?>
javascript/emojione/css/autocomplete.css">
<link rel="stylesheet" type="text/css" href="<?php 
echo api_get_path(WEB_LIBRARY_PATH);
?>
javascript/highlight/styles/github.css">
<?php 
echo api_get_jquery_js();
?>
    <?php 
echo api_get_css('components/bootstrap/dist/css/bootstrap.css');
?>
    <?php 
echo api_get_js('components/bootstrap/dist/js/bootstrap.min.js');
?>
    <?php 
echo api_get_js('js/highlight/highlight.pack.js');
?>
    <?php 
echo api_get_js('components/jquery-textcomplete/jquery.textcomplete.js');
?>
    <?php 
echo api_get_js('components/emojione/js/emojione.min.js');
?>
    <?php 
echo api_get_js('js/jquery-emojiarea/jquery.emojiarea.js');
Example #17
0
 * Modified by hubert.borderiou (question category)
 */
/**
 * Code
 */
// name of the language file that needs to be included
use ChamiloSession as Session;
$language_file = array('exercice', 'tracking');
// including the global library
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_QUIZ;
require_once api_get_path(SYS_CODE_PATH) . 'gradebook/lib/be.inc.php';
// Setting the tabs
$this_section = SECTION_COURSES;
$htmlHeadXtra[] = api_get_js('qtip2/jquery.qtip.min.js');
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH) . 'javascript/qtip2/jquery.qtip.min.css');
// Access control
api_protect_course_script(true);
// including additional libraries
require_once 'exercise.class.php';
require_once 'question.class.php';
require_once 'answer.class.php';
require_once 'hotpotatoes.lib.php';
/*	Constants and variables */
$is_allowedToEdit = api_is_allowed_to_edit(null, true);
$is_tutor = api_is_allowed_to_edit(true);
$is_tutor_course = api_is_course_tutor();
$TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$TBL_ITEM_PROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$TBL_EXERCICE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
Example #18
0
    /**
     * The ajax call must contain an array of id and text
     * @return string
     */
    function toHtml()
    {
        $html = api_get_js('select2/select2.js');
        $iso = api_get_language_isocode(api_get_interface_language());
        $localeFile = 'select2_locale_' . $iso . '.js';
        if (file_exists(api_get_path(LIBRARY_PATH) . 'javascript/select2/' . $localeFile)) {
            $html .= api_get_js('select2/' . $localeFile);
        }
        $html .= api_get_css(api_get_path(WEB_LIBRARY_PATH) . 'javascript/select2/select2.css');
        $formatResult = $this->getAttribute('formatResult');
        $formatCondition = null;
        if (!empty($formatResult)) {
            $formatCondition = ',
                formatResult : ' . $formatResult . ',
                formatSelection : ' . $formatResult . ',';
        }
        $defaultValues = $this->getAttribute('defaults');
        $dataCondition = null;
        $tags = null;
        if (!empty($defaultValues)) {
            $result = json_encode($defaultValues);
            $result = str_replace('"id"', 'id', $result);
            $result = str_replace('"text"', 'text', $result);
            $dataCondition = '$("#' . $this->getAttribute('name') . '").select2("data", ' . $result . ')';
            $tags = ', tags : function() { return ' . $result . '} ';
        }
        $width = 'element';
        $givenWidth = $this->getAttribute('width');
        if (!empty($givenWidth)) {
            $width = $givenWidth;
        }
        //Get the minimumInputLength for select2
        $minimumInputLength = $this->getAttribute('minimumInputLength') > 3 ? $this->getAttribute('minimumInputLength') : 3;
        $plHolder = $this->getAttribute('placeholder');
        if (empty($plHolder)) {
            $plHolder = get_lang('SelectAnOption');
        }
        $html .= '<script>
                $(function() {
                    $("#' . $this->getAttribute('name') . '").select2({
                        placeholder: "' . $plHolder . '",
                        allowClear: true,
                        width: "' . $width . '",
                        minimumInputLength: ' . $minimumInputLength . ',
                        // instead of writing the function to execute the request we use Select2s convenient helper
                        ajax: {
                            url: "' . $this->getAttribute('url') . '",
                            dataType: "json",
                            data: function (term, page) {
                                return {
                                    q: term, // search term
                                    page_limit: 10,
                                };
                            },
                            results: function (data, page) { // parse the results into the format expected by Select2.
                                // since we are using custom formatting functions we do not need to alter remote JSON data
                                return {
                                    results: data
                                };
                            }
                        }
                        ' . $tags . '
                        ' . $formatCondition . '
                    });
                    ' . $dataCondition . '

                });

        </script>';
        $html .= '<input id="' . $this->getAttribute('name') . '" name="' . $this->getAttribute('name') . '" />';
        return $html;
    }
Example #19
0
/* For licensing terms, see /license.txt */
/**	
	@author Julio Montoya <*****@*****.**> BeezNest 2011
*	@package chamilo.timeline
*/
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH) . 'timeline.lib.php';
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('Timeline'));
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('Listing'));
$timeline = new Timeline();
if (empty($_GET['id'])) {
    api_not_allowed();
}
$url = $timeline->get_url($_GET['id']);
$item = $timeline->get($_GET['id']);
$interbreadcrumb[] = array('url' => '#', 'name' => $item['headline']);
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH) . 'javascript/timeline/timeline.css');
$htmlHeadXtra[] = api_get_js('timeline/timeline-min.js');
$htmlHeadXtra[] = '
<script>
	$(document).ready(function() {
		var timeline = new VMM.Timeline();
		timeline.init("' . $url . '");			
	});
</script>';
$content = '<div class="timeline-example"><div id="timeline"></div></div>';
$tpl = new Template($tool_name);
$tpl->assign('actions', $actions);
$tpl->assign('message', $message);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
Example #20
0
$tpl = Container::getTwig();
// use anonymous mode when accessing this course tool
$use_anonymous = true;
// Calendar type
$type = isset($_REQUEST['type']) && in_array($_REQUEST['type'], array('personal', 'course', 'admin', 'platform')) ? $_REQUEST['type'] : 'personal';
$userId = isset($_REQUEST['user_id']) ? $_REQUEST['user_id'] : null;
if ($type == 'personal' || $type == 'admin') {
    $cidReset = true;
    // fixes #5162
}
$current_course_tool = TOOL_CALENDAR_EVENT;
$this_section = SECTION_MYAGENDA;
//$htmlHeadXtra[] = api_get_js('qtip2/jquery.qtip.min.js');
$htmlHeadXtra[] = api_get_js('components/fullcalendar/dist/fullcalendar.min.js');
$htmlHeadXtra[] = api_get_js('components/fullcalendar/dist/gcal.js');
$htmlHeadXtra[] = api_get_css('components/fullcalendar/dist/fullcalendar.min.css');
//$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/qtip2/jquery.qtip.min.css');
if (api_is_platform_admin() && ($type == 'admin' || $type == 'platform')) {
    $type = 'admin';
}
if (isset($_REQUEST['cidReq']) && !empty($_REQUEST['cidReq'])) {
    if ($_REQUEST['cidReq'] == -1) {
        // When is out of the course tool (e.g My agenda)
        header('Location: ' . api_get_self());
        exit;
    } else {
        $type = 'course';
        $this_section = SECTION_COURSES;
    }
}
api_protect_course_group(GroupManager::GROUP_TOOL_CALENDAR);
Example #21
0
//$is_visible = DocumentManager::is_visible_by_id($document_id, $course_info, api_get_session_id(), api_get_user_id());
$is_visible = DocumentManager::check_visibility_tree($document_id, api_get_course_id(), api_get_session_id(), api_get_user_id());
if (!api_is_allowed_to_edit() && !$is_visible) {
    api_not_allowed(true);
}
$header_file = $document_data['path'];
$pathinfo = pathinfo($header_file);
$show_web_odf = false;
$web_odf_supported_files = DocumentManager::get_web_odf_extension_list();
if (in_array(strtolower($pathinfo['extension']), $web_odf_supported_files)) {
    $show_web_odf = true;
}
$file_url_web = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document' . $header_file . '?' . api_get_cidreq();
if ($show_web_odf) {
    $htmlHeadXtra[] = api_get_js('webodf/webodf.js');
    $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH) . 'javascript/webodf/webodf.css');
    $htmlHeadXtra[] = '
    <script type="text/javascript" charset="utf-8">        
        function init() {
                var odfelement = document.getElementById("odf"),
                odfcanvas = new odf.OdfCanvas(odfelement);
                odfcanvas.load("' . $file_url_web . '");
        }
        $(document).ready(function() {        
            window.setTimeout(init, 0);
        });        
  </script>';
}
$interbreadcrumb[] = array("url" => "./document.php?curdirpath=" . urlencode($my_cur_dir_path) . $req_gid, "name" => get_lang('Documents'));
// Interbreadcrumb for the current directory root path
if (empty($document_data['parents'])) {
Example #22
0
/**
 * Returns the jquery library js and css headers
 *
 * @param   array   list of jquery libraries supported jquery-ui, jqgrid
 * @param   bool    add the jquery library
 * @return  string  html tags
 *
 */
function api_get_jquery_libraries_js($libraries)
{
    $js = '';
    $js_path = api_get_path(WEB_LIBRARY_JS_PATH);
    $isocode = api_get_language_isocode();
    if (in_array('jquery-ui-i18n', $libraries)) {
        $js .= api_get_js('jquery-ui/jquery-ui-i18n.min.js');
        if (!in_array($isocode, api_get_available_jquery_ui_languages())) {
            $isocode = 'en';
        }
        if ($isocode == 'en') {
            $isocode = '';
        }
        $js .= "<script> \$(function() {  \$.datepicker.setDefaults(\$.datepicker.regional['{$isocode}']);   });</script>";
    }
    //jqgrid js and css
    if (in_array('jqgrid', $libraries)) {
        $languaje = 'en';
        $platform_isocode = strtolower(api_get_language_isocode());
        //languages supported by jqgrid see files in main/inc/lib/javascript/jqgrid/js/i18n
        $jqgrid_langs = array('bg', 'bg1251', 'cat', 'cn', 'cs', 'da', 'de', 'el', 'en', 'es', 'fa', 'fi', 'fr', 'gl', 'he', 'hu', 'is', 'it', 'ja', 'nl', 'no', 'pl', 'pt-br', 'pt', 'ro', 'ru', 'sk', 'sr', 'sv', 'tr', 'ua');
        if (in_array($platform_isocode, $jqgrid_langs)) {
            $languaje = $platform_isocode;
        }
        $js .= api_get_css($js_path . 'jqgrid/css/ui.jqgrid.css');
        $js .= api_get_js('jqgrid/js/i18n/grid.locale-' . $languaje . '.js');
        $js .= api_get_js('jqgrid/js/jquery.jqGrid.min.js');
    }
    //Document multiple upload funcionality
    if (in_array('jquery-upload', $libraries)) {
        $js .= api_get_js('jquery-upload/jquery.fileupload.js');
        $js .= api_get_js('jquery-upload/jquery.fileupload-ui.js');
        $js .= api_get_css($js_path . 'jquery-upload/jquery.fileupload-ui.css');
    }
    return $js;
}
Example #23
0
            $(window).resize(resizeIframe());
        });
    </script>';
}
// Activate code highlight.
$isChatFolder = false;
if (isset($document_data['parents']) && isset($document_data['parents'][0])) {
    $chatFolder = $document_data['parents'][0];
    if (isset($chatFolder['path']) && $chatFolder['path'] == '/chat_files') {
        $isChatFolder = true;
    }
}
if ($isChatFolder) {
    $htmlHeadXtra[] = api_get_js('highlight/highlight.pack.js');
    $htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH) . 'chat.css');
    $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH) . 'javascript/highlight/styles/github.css');
    $htmlHeadXtra[] = '
    <script>
        hljs.initHighlightingOnLoad();
    </script>';
}
$execute_iframe = true;
if ($jplayer_supported) {
    $extension = api_strtolower($pathinfo['extension']);
    $js_path = api_get_path(WEB_LIBRARY_PATH) . 'javascript/';
    $htmlHeadXtra[] = '<link rel="stylesheet" href="' . $js_path . 'jquery-jplayer/skins/blue/jplayer.blue.monday.css" type="text/css">';
    $htmlHeadXtra[] = '<script type="text/javascript" src="' . $js_path . 'jquery-jplayer/jquery.jplayer.min.js"></script>';
    $jquery = ' $("#jquery_jplayer_1").jPlayer({
                    ready: function() {
                        $(this).jPlayer("setMedia", {
                            ' . $extension . ' : "' . $document_data['direct_url'] . '"
Example #24
0
//$is_visible = DocumentManager::is_visible_by_id($document_id, $course_info, api_get_session_id(), api_get_user_id());
$is_visible = DocumentManager::check_visibility_tree($document_id, api_get_course_id(), api_get_session_id(), api_get_user_id());
if (!api_is_allowed_to_edit() && !$is_visible) {
    api_not_allowed(true);
}
$header_file = $document_data['path'];
$pathinfo = pathinfo($header_file);
$show_web_odf = false;
$web_odf_supported_files = DocumentManager::get_web_odf_extension_list();
if (in_array(strtolower($pathinfo['extension']), $web_odf_supported_files)) {
    $show_web_odf = true;
}
$file_url_web = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document' . $header_file . '?' . api_get_cidreq();
if ($show_web_odf) {
    $htmlHeadXtra[] = api_get_js('webodf/webodf.js');
    $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH) . 'webodf/webodf.css');
    $htmlHeadXtra[] = '
    <script type="text/javascript" charset="utf-8">
        function init() {
            var odfelement = document.getElementById("odf"),
            odfcanvas = new odf.OdfCanvas(odfelement);
            odfcanvas.load("' . $file_url_web . '");
        }
        $(document).ready(function() {
            window.setTimeout(init, 0);
        });
  </script>';
}
$interbreadcrumb[] = array("url" => "./document.php?curdirpath=" . urlencode($my_cur_dir_path) . $req_gid, "name" => get_lang('Documents'));
// Interbreadcrumb for the current directory root path
if (empty($document_data['parents'])) {
Example #25
0
/**
 * Document quota management script
 * @package chamilo.document
 */
require_once '../inc/global.inc.php';
if (!api_is_allowed_to_edit(null, true)) {
    api_not_allowed(true);
}
$current_course_tool = TOOL_DOCUMENT;
$this_section = SECTION_COURSES;
$tool_name = get_lang('DocumentQuota');
$interbreadcrumb[] = array('url' => 'document.php', 'name' => get_lang('Documents'));
$htmlHeadXtra[] = api_get_js('jqplot/jquery.jqplot.js');
$htmlHeadXtra[] = api_get_js('jqplot/plugins/jqplot.pieRenderer.js');
$htmlHeadXtra[] = api_get_js('jqplot/plugins/jqplot.donutRenderer.js');
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH) . 'javascript/jqplot/jquery.jqplot.css');
$course_code = api_get_course_id();
$course_id = api_get_course_int_id();
$session_id = api_get_session_id();
$group_id = api_get_group_id();
$user_id = api_get_user_id();
$user_info = api_get_user_info($user_id);
$session = array();
$user_name = $user_info['complete_name'];
$course_list = SessionManager::get_course_list_by_session_id($session_id);
$session_list = SessionManager::get_session_by_course($course_id);
$total_quota_bytes = DocumentManager::get_course_quota();
$quota_bytes = DocumentManager::documents_total_space($course_id, 0, 0);
$quota_percentage = round($quota_bytes / $total_quota_bytes, 2) * 100;
$session[] = array(get_lang('Course') . ' (' . format_file_size($quota_bytes) . ')', $quota_percentage);
$used_quota_bytes = $quota_bytes;
Example #26
0
                $counter++;
                continue;
            }
        }
        if (!isset($_GET['createdir']) && $document_sub_data['id'] == $document_data['id']) {
            $document_sub_data['document_url'] = '#';
        }
        $interbreadcrumb[] = array('url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']);
        $counter++;
    }
}
if (isset($_GET['createdir'])) {
    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('CreateDir'));
}
$js_path = api_get_path(WEB_LIBRARY_PATH) . 'javascript/';
$htmlHeadXtra[] = api_get_css('components/jplayer/skin/blue.monday/css/jplayer.blue.monday.css');
$htmlHeadXtra[] = api_get_js('components/jplayer/dist/jplayer/jquery.jplayer.min.js');
$mediaplayer_path = api_get_path(WEB_LIBRARY_PATH) . 'mediaplayer/player.swf';
$documentAndFolders = DocumentManager::get_all_document_data($courseInfo, $curdirpath, $groupId, null, $is_allowed_to_edit || $group_member_with_upload_rights, false);
$count = 1;
$jquery = null;
if (!empty($documentAndFolders)) {
    foreach ($documentAndFolders as $file) {
        if ($file['filetype'] == 'file') {
            $path_info = pathinfo($file['path']);
            $extension = '';
            if (!empty($path_info['extension'])) {
                $extension = strtolower($path_info['extension']);
            }
            //@todo use a js loop to auto generate this code
            if (in_array($extension, array('ogg', 'mp3', 'wav'))) {
Example #27
0
    /**
     * The ajax call must contain an array of id and text
     * @return string
     */
    function toHtml()
    {
        $html = api_get_asset('select2/dist/js/select2.min.js');
        $iso = api_get_language_isocode(api_get_interface_language());
        $languageCondition = '';
        if (file_exists(api_get_path(SYS_PATH) . "web/assets/select2/dist/js/i18n/{$iso}.js")) {
            $html .= api_get_asset("select2/dist/js/i18n/{$iso}.js");
            $languageCondition = "language: '{$iso}',";
        }
        $html .= api_get_css(api_get_path(WEB_PATH) . 'web/assets/select2/dist/css/select2.min.css');
        $formatResult = $this->getAttribute('formatResult');
        $formatCondition = null;
        if (!empty($formatResult)) {
            $formatCondition = ',
                templateResult : ' . $formatResult . ',
                templateSelection : ' . $formatResult;
        }
        $defaultValues = $this->getAttribute('defaults');
        $defaultValues = empty($defaultValues) ? [] : $defaultValues;
        $width = 'element';
        $givenWidth = $this->getAttribute('width');
        if (!empty($givenWidth)) {
            $width = $givenWidth;
        }
        //Get the minimumInputLength for select2
        $minimumInputLength = $this->getAttribute('minimumInputLength') > 3 ? $this->getAttribute('minimumInputLength') : 3;
        $plHolder = $this->getAttribute('placeholder');
        if (empty($plHolder)) {
            $plHolder = get_lang('SelectAnOption');
        }
        $html .= <<<JS
            <script>
                \$(function(){
                    \$('#{$this->getAttribute('name')}').select2({
                        {$languageCondition}
                        placeholder_: '{$plHolder}',
                        allowClear: true,
                        width: '{$width}',
                        minimumInputLength: '{$minimumInputLength}',
                        // instead of writing the function to execute the request we use Select2s convenient helper
                        ajax: {
                            url: '{$this->getAttribute('url')}',
                            dataType: 'json',
                            data: function(params) {
                                return {
                                    q: params.term, // search term
                                    page_limit: 10,
                                };
                            },
                            processResults: function (data, page) {
                                //parse the results into the format expected by Select2
                                return {
                                    results: data.items
                                };
                            }
                            {$formatCondition}
                        }
                    });
                });
            </script>
JS;
        $html .= Display::select($this->getAttribute('name'), $defaultValues, array_keys($defaultValues), ['id' => $this->getAttribute('name'), 'style' => 'width: 100%;'], false);
        return $html;
    }
if (!$objExercise) {
    //Redirect to the exercise overview
    //Check if the exe_id exists
    header("Location: overview.php?exerciseId=" . $exerciseId);
    exit;
}
$time_control = false;
$clock_expired_time = ExerciseLib::get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id);
if ($objExercise->expired_time != 0 && !empty($clock_expired_time)) {
    $time_control = true;
}
if ($time_control) {
    // Get time left for exipiring time
    $time_left = api_strtotime($clock_expired_time, 'UTC') - time();
    $htmlHeadXtra[] = api_get_css('js/epiclock/stylesheet/jquery.epiclock.css');
    $htmlHeadXtra[] = api_get_css('js/epiclock/renderers/minute/epiclock.minute.css');
    $htmlHeadXtra[] = api_get_js('js/epiclock/javascript/jquery.dateformat.min.js');
    $htmlHeadXtra[] = api_get_js('js/epiclock/javascript/jquery.epiclock.min.js');
    $htmlHeadXtra[] = api_get_js('js/epiclock/renderers/minute/epiclock.minute.js');
    $htmlHeadXtra[] = $objExercise->show_time_control_js($time_left);
}
$exe_id = intval(Session::read('exe_id'));
$exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id);
if (!empty($exercise_stat_info['data_tracking'])) {
    $question_list = explode(',', $exercise_stat_info['data_tracking']);
}
if (empty($exercise_stat_info) || empty($question_list)) {
    api_not_allowed();
}
$nameTools = get_lang('Exercises');
$interbreadcrumb[] = array("url" => "exercise.php?" . api_get_cidreq(), "name" => get_lang('Exercises'));
Example #29
0
    /**
     * Set theme, include CSS files
     */
    public function set_css_files()
    {
        global $disable_js_and_css_files;
        $css = array();

        $this->theme = api_get_visual_theme();

        if (!empty($this->preview_theme)) {
            $this->theme = $this->preview_theme;
        }

        //Base CSS
        $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).'base.css');

        //Default CSS responsive design
        $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).'bootstrap-responsive.css');


        //Extra CSS files
        $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/thickbox.css';
        $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/chosen/chosen.css';

        if (api_is_global_chat_enabled()) {
            $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/chat/css/chat.css';
        }

        $css[] = api_get_path(WEB_CSS_PATH).'font_awesome/css/font-awesome.css';
        $css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/mediaelement/mediaelementplayer.css';
        //THEME CSS STYLE
        $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).'responsive.css');
        $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).$this->theme.'/default.css');

        if ($this->show_learnpath) {
            $css[] = api_get_path(WEB_CSS_PATH).$this->theme.'/learnpath.css';

            // if we have a SCORM file in theme, don't use default_scorm.css file
            if (is_file(api_get_path(SYS_CSS_PATH).$this->theme.'/scorm.css')) {
                $css[] = api_get_path(WEB_CSS_PATH).$this->theme.'/scorm.css';
            } else {
                $css[] = api_get_cdn_path(api_get_path(WEB_CSS_PATH).'default_scorm.css');
            }
        }

        $css_file_to_string = null;
        foreach ($css as $file) {
            $css_file_to_string .= api_get_css($file);
        }

        // @todo move this somewhere else. Special fix when using tablets in order to see the text near icons
        if (SHOW_TEXT_NEAR_ICONS == true) {
            //hack in order to fix the actions buttons
            $css_file_to_string .= '<style>
                .td_actions a {
                    float:left;
                    width:100%;
                }
                .forum_message_left a {
                    float:left;
                    width:100%;
                }
                </style>';
        }

        $navigator_info = api_get_navigator();
        if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
            $css_file_to_string .= 'img, div { behavior: url('.api_get_path(WEB_LIBRARY_PATH).'javascript/iepngfix/iepngfix.htc) } '."\n";
        }

        if (!$disable_js_and_css_files) {
            $this->assign('css_file_to_string', $css_file_to_string);

            $style_print = api_get_css(api_get_cdn_path(api_get_path(WEB_CSS_PATH).$this->theme.'/print.css'), 'print');
            $this->assign('css_style_print', $style_print);
        }

        // Logo
        $logo = return_logo($this->theme);
        $this->assign('logo', $logo);
    }
Example #30
0
    var weight_id = "weighting_" + id;
    var array_result=new Array();
    array_result[1]="1";
    array_result[0]= "-0.50";
    array_result[-1]= "0";
    if (result) {
        result = 1;
    } else {
        result = 0;
    }
    document.getElementById(weight_id).value = array_result[result];
}


</script>';
$htmlHeadXtra[] = api_get_css('components/jsplumb/dist/js/jsPlumb-2.0.4.js');
$htmlHeadXtra[] = api_get_js('components/jquery.ui.touch/jquery.ui.touch.js');
$template = \Chamilo\CoreBundle\Framework\Container::getTwig();
$htmlHeadXtra[] = $template->render('ChamiloCoreBundle:default/exercise:submit.html.twig', ['shuffle_answers' => $objExercise->getShuffle()]);
$htmlHeadXtra[] = api_get_js('components/xcolor/jquery.xcolor.js');
$htmlHeadXtra2 = array();
$htmlHeadXtra2[] = "<script type=\"text/javascript\" src=\"../plugin/hotspot/JavaScriptFlashGateway.js\"></script>\n<script src=\"../plugin/hotspot/hotspot.js\" type=\"text/javascript\"></script>\n<script language=\"JavaScript\" type=\"text/javascript\">\n<!--\n// -----------------------------------------------------------------------------\n// Globals\n// Major version of Flash required\nvar requiredMajorVersion = 7;\n// Minor version of Flash required\nvar requiredMinorVersion = 0;\n// Minor version of Flash required\nvar requiredRevision = 0;\n// the version of javascript supported\nvar jsVersion = 1.0;\n// -----------------------------------------------------------------------------\n// -->\n</script>\n<script language=\"VBScript\" type=\"text/vbscript\">\n<!-- // Visual basic helper required to detect Flash Player ActiveX control version information\nFunction VBGetSwfVer(i)\n  on error resume next\n  Dim swControl, swVersion\n  swVersion = 0\n\n  set swControl = CreateObject(\"ShockwaveFlash.ShockwaveFlash.\" + CStr(i))\n  if (IsObject(swControl)) then\n    swVersion = swControl.GetVariable(\"\$version\")\n  end if\n  VBGetSwfVer = swVersion\nEnd Function\n// -->\n</script>\n\n<script language=\"JavaScript1.1\" type=\"text/javascript\">\n<!-- // Detect Client Browser type\nvar isIE  = (navigator.appVersion.indexOf(\"MSIE\") != -1) ? true : false;\nvar isWin = (navigator.appVersion.toLowerCase().indexOf(\"win\") != -1) ? true : false;\nvar isOpera = (navigator.userAgent.indexOf(\"Opera\") != -1) ? true : false;\njsVersion = 1.1;\n// JavaScript helper required to detect Flash Player PlugIn version information\nfunction JSGetSwfVer(i){\n\t// NS/Opera version >= 3 check for Flash plugin in plugin array\n\tif (navigator.plugins != null && navigator.plugins.length > 0) {\n\t\tif (navigator.plugins[\"Shockwave Flash 2.0\"] || navigator.plugins[\"Shockwave Flash\"]) {\n\t\t\tvar swVer2 = navigator.plugins[\"Shockwave Flash 2.0\"] ? \" 2.0\" : \"\";\n      \t\tvar flashDescription = navigator.plugins[\"Shockwave Flash\" + swVer2].description;\n\t\t\tdescArray = flashDescription.split(\" \");\n\t\t\ttempArrayMajor = descArray[2].split(\".\");\n\t\t\tversionMajor = tempArrayMajor[0];\n\t\t\tversionMinor = tempArrayMajor[1];\n\t\t\tif ( descArray[3] != \"\" ) {\n\t\t\t\ttempArrayMinor = descArray[3].split(\"r\");\n\t\t\t} else {\n\t\t\t\ttempArrayMinor = descArray[4].split(\"r\");\n\t\t\t}\n      \t\tversionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;\n            flashVer = versionMajor + \".\" + versionMinor + \".\" + versionRevision;\n      \t} else {\n\t\t\tflashVer = -1;\n\t\t}\n\t}\n\t// MSN/WebTV 2.6 supports Flash 4\n\telse if (navigator.userAgent.toLowerCase().indexOf(\"webtv/2.6\") != -1) flashVer = 4;\n\t// WebTV 2.5 supports Flash 3\n\telse if (navigator.userAgent.toLowerCase().indexOf(\"webtv/2.5\") != -1) flashVer = 3;\n\t// older WebTV supports Flash 2\n\telse if (navigator.userAgent.toLowerCase().indexOf(\"webtv\") != -1) flashVer = 2;\n\t// Can't detect in all other cases\n\telse {\n\n\t\tflashVer = -1;\n\t}\n\treturn flashVer;\n}\n// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available\nfunction DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)\n{\n \treqVer = parseFloat(reqMajorVer + \".\" + reqRevision);\n   \t// loop backwards through the versions until we find the newest version\n\tfor (i=25;i>0;i--) {\n\t\tif (isIE && isWin && !isOpera) {\n\t\t\tversionStr = VBGetSwfVer(i);\n\t\t} else {\n\t\t\tversionStr = JSGetSwfVer(i);\n\t\t}\n\t\tif (versionStr == -1 ) {\n\t\t\treturn false;\n\t\t} else if (versionStr != 0) {\n\t\t\tif(isIE && isWin && !isOpera) {\n\t\t\t\ttempArray         = versionStr.split(\" \");\n\t\t\t\ttempString        = tempArray[1];\n\t\t\t\tversionArray      = tempString .split(\",\");\n\t\t\t} else {\n\t\t\t\tversionArray      = versionStr.split(\".\");\n\t\t\t}\n\t\t\tversionMajor      = versionArray[0];\n\t\t\tversionMinor      = versionArray[1];\n\t\t\tversionRevision   = versionArray[2];\n\n\t\t\tversionString     = versionMajor + \".\" + versionRevision;   // 7.0r24 == 7.24\n\t\t\tversionNum        = parseFloat(versionString);\n        \t// is the major.revision >= requested major.revision AND the minor version >= requested minor\n\t\t\tif ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\treturn ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false );\n\t\t\t}\n\t\t}\n\t}\n}\n// -->\n</script>";
//Display::display_header($nameTools,'Exercise');
/*
if ($objExercise->exercise_was_added_in_lp) {
    if ($objExercise->force_edit_exercise_in_lp == true) {
        Display::display_warning_message(get_lang('ForceEditingExerciseInLPWarning'));
    } else {
        Display::display_warning_message(get_lang('EditingExerciseCauseProblemsInLP'));
    }
}*/