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');
?>
    <?php 
echo api_get_js('js/jquery-scrollbar/jquery.scrollbar.min.js');
// echo api_get_js('jquery.tinyscrollbar.js');
?>
<script type="text/javascript">
    hljs.initHighlightingOnLoad();
    emojione.ascii = true;
    emojione.imagePathPNG = '<?php 
echo api_get_path(WEB_LIBRARY_PATH) . 'javascript/emojione/png/';
?>
';
    emojione.imagePathSVG ='<?php 
echo api_get_path(WEB_LIBRARY_PATH) . 'javascript/emojione/svg/';
?>
';
    emojione.imagePathSVGSprites = '<?php 
echo api_get_path(WEB_LIBRARY_PATH) . 'javascript/emojione/sprites/';
Example #2
0
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;
if ($show_web_odf) {
    //$htmlHeadXtra[] = api_get_js('webodf/webodf.js');
    $htmlHeadXtra[] = api_get_js('wodotexteditor/wodotexteditor.js');
    $htmlHeadXtra[] = api_get_js('wodotexteditor/localfileeditor.js');
    $htmlHeadXtra[] = api_get_js('wodotexteditor/FileSaver.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.'");
                    createEditor();
            }
            $(document).ready(function() {
                //createEditor();
                window.setTimeout(init, 0);
            });
      </script>';
        */
Example #3
0
    /**
     * Special function to declare last-minute JS libraries which depend on
     * other things to be declared first. In particular, it might be useful
     * under IE9 with compatibility mode, which for some reason is getting
     * upset when a variable is used in a function (even if not used yet)
     * when this variable hasn't been defined yet.
     */
    public function set_js_files_post()
    {
        global $disable_js_and_css_files, $htmlHeadXtra;
        $js_files = array();
        if (api_is_global_chat_enabled()) {
            //Do not include the global chat in LP
            if ($this->show_learnpath == false && $this->show_footer == true && $this->hide_global_chat == false) {
                $js_files[] = 'chat/js/chat.js';
            }
        }
        $js_file_to_string = null;

        foreach ($js_files as $js_file) {
            $js_file_to_string .= api_get_js($js_file);
        }
        if (!$disable_js_and_css_files) {
            $this->assign('js_file_to_string_post', $js_file_to_string);
        }
    }
Example #4
0
<?php

/* For licensing terms, see /license.txt */
/**
 *  @package chamilo.admin
 */
$cidReset = true;
require_once '../inc/global.inc.php';
$this_section = SECTION_MYPROFILE;
api_block_anonymous_users();
if (api_get_setting('allow_skills_tool') != 'true') {
    api_not_allowed();
}
//Adds the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_jqgrid_js();
$htmlHeadXtra[] = api_get_js('jqueryui-touch-punch/jquery.ui.touch-punch.min.js');
$htmlHeadXtra[] = api_get_js('jquery.jsPlumb.all.js');
$htmlHeadXtra[] = api_get_js('skills.js');
$skill = new Skill();
$type = 'read';
//edit
$tree = $skill->get_skills_tree(api_get_user_id(), null, true);
$skill_visualizer = new SkillVisualizer($tree, $type);
$url = api_get_path(WEB_AJAX_PATH) . 'skill.ajax.php?1=1';
$tpl = new Template(null, false, false);
$tpl->assign('url', $url);
$tpl->assign('skill_visualizer', $skill_visualizer);
$content = $tpl->fetch('default/skill/skill_tree_student.tpl');
$tpl->assign('content', $content);
$tpl->display_no_layout_template();
Example #5
0
 /**
  * @param array parameters: count, url, extension
  * @return string
  */
 static function generate_jplayer_jquery($params = array())
 {
     $js_path = api_get_js('jplayer/dist/jplayer/', true);
     $js = ' $("#jquery_jplayer_' . $params['count'] . '").jPlayer({
                 ready: function() {
                     $(this).jPlayer("setMedia", {
                         ' . $params['extension'] . ' : "' . $params['url'] . '"
                     });
                 },
                 play: function() { // To avoid both jPlayers playing together.
                     $(this).jPlayer("pauseOthers");
                 },
                 //errorAlerts: true,
                 //warningAlerts: true,
                 swfPath: "' . $js_path . '",
                 //supplied: "m4a, oga, mp3, ogg, wav",
                 supplied: "' . $params['extension'] . '",
                 wmode: "window",
                 solution: "flash, html",  // Do not change this setting
                 cssSelectorAncestor: "#jp_container_' . $params['count'] . '",
             });  	 ' . "\n\n";
     return $js;
 }
Example #6
0
        }
        $(document).ready(function() {
            $(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() {
Example #7
0
/* For licensing terms, see /license.txt */
/**
 * 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);
Example #8
0
<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();
echo api_get_asset('bootstrap/dist/js/bootstrap.min.js');
echo api_get_js('highlight/highlight.pack.js');
echo api_get_js('jquery-textcomplete/jquery.textcomplete.js');
echo api_get_js('emojione/js/emojione.min.js');
echo api_get_js('jquery-emojiarea/jquery.emojiarea.js');
echo api_get_js('jquery.tinyscrollbar.js');
?>
<script type="text/javascript">
    hljs.initHighlightingOnLoad();
    emojione.ascii = true;
    emojione.imagePathPNG = '<?php 
echo api_get_path(WEB_LIBRARY_PATH) . 'javascript/emojione/png/';
?>
';
    emojione.imagePathSVG ='<?php 
echo api_get_path(WEB_LIBRARY_PATH) . 'javascript/emojione/svg/';
?>
';
    emojione.imagePathSVGSprites = '<?php 
echo api_get_path(WEB_LIBRARY_PATH) . 'javascript/emojione/sprites/';
?>
Example #9
0
			$png_svg_files[] =$file;
		}
	}
}

$disk_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document/images/gallery/';
$web_path  = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/document/images/gallery/';

$style = '<style>';
$style .= '@import "'.api_get_path(WEB_CSS_PATH).'base.css";';
$style .= '@import "'.api_get_path(WEB_CSS_PATH).api_get_visual_theme().'/default.css";';
$style .='</style>';

?>
<!doctype html>
<?php echo api_get_js('jquery.min.js'); ?>
<?php echo $style ?>
<body>
<?php
echo '<h2>'.get_lang('Course').': '.$course_info['name'].'</h2>';
if (!empty($png_svg_files)) {
	echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>';
	echo '<ul>';
	foreach($png_svg_files as $filename) {
		$image=$disk_path.$filename;
		
		if (strpos($filename, "svg")){
			$new_sizes['width'] = 60;
			$new_sizes['height'] = 60;
		}
		else {
Example #10
0
<?php

/* For licensing terms, see /license.txt */
/**
 * List sessions in an efficient and usable way
 * @package chamilo.admin
 */
/**
 * Code
 */
$this_section = SECTION_PLATFORM_ADMIN;
SessionManager::protect_session_edit();
//Add the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_jqgrid_js();
$htmlHeadXtra[] = api_get_js('json-js/json2.js');
$htmlHeadXtra[] = api_get_js('date/date.js');
$htmlHeadXtra = api_get_datetime_picker_js($htmlHeadXtra);
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
$idChecked = isset($_REQUEST['idChecked']) ? $_REQUEST['idChecked'] : null;
$list_type = isset($_REQUEST['list_type']) ? $_REQUEST['list_type'] : 'simple';
if ($action == 'delete') {
    SessionManager::delete_session($idChecked);
    header('Location: ' . api_get_path(WEB_CODE_PATH) . 'session/session_list.php');
    exit;
} elseif ($action == 'copy') {
    SessionManager::copy_session($idChecked, true, false);
    header('Location: ' . api_get_path(WEB_CODE_PATH) . 'session/session_list.php');
    exit;
}
$interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('Sessions'));
$tool_name = get_lang('SessionList');
Example #11
0
                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'))) {
                // Get the document data from the ID
Example #12
0
/**
 *
 * @param string $inputId the jquery id example: #password
 * @return string
 */
function api_get_password_checker_js($inputId)
{
    global $_configuration;
    $useStrengthPassChecker = isset($_configuration['allow_strength_pass_checker']) ? $_configuration['allow_strength_pass_checker'] : false;
    if ($useStrengthPassChecker == false) {
        return null;
    }
    $verdicts = array(get_lang('Weak'), get_lang('Normal'), get_lang('Medium'), get_lang('Strong'), get_lang('VeryStrong'));
    $js = api_get_js('strength/strength.js');
    $js .= "<script>\n\n    var verdicts = ['" . implode("','", $verdicts) . "'];\n    var errorMessages = {\n        password_to_short : '" . get_lang('PasswordIsTooShort') . "'\n    };\n\n    \$(document).ready(function() {\n        var options = {\n            verdicts: verdicts,\n            onLoad : function () {\n                //\$('#messages').text('Start typing password');\n            },\n            onKeyUp: function (evt) {\n                \$(evt.target).pwstrength('outputErrorList');\n            },\n            errorMessages : errorMessages,\n            viewports: {\n              progress: '#password_progress',\n              //verdict: undefined,\n              //errors: undefined\n          }\n        };\n        \$('" . $inputId . "').pwstrength(options);\n    });\n    </script>";
    return $js;
}
Example #13
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;
    }
}
Example #14
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 #15
0
//Check user visibility
//$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
Example #16
0
 * @author Julio Montoya <*****@*****.**>, lots of cleanup + several improvements
 * 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);
Example #17
0
            src="' . $pdfUrl . '">
        </iframe>';
    echo '</div>';
} else {
    // ViewerJS already have download button
    echo '<a class="btn btn-default" href="' . $file_url_web . '" target="_blank"><em class="fa fa-download"></em>
' . get_lang('Download') . '</a>';
}
echo '</div>';
if ($jplayer_supported) {
    echo '<br /><div class="span12" style="margin:0 auto; width:100%; text-align:center;">';
    echo DocumentManager::generate_video_preview($document_data);
    echo '</div>';
}
if ($is_freemind_available) {
    echo api_get_js('js/swfobject/swfobject.js');
    ?>
    <style type="text/css">
        #flashcontent {
            height: 500px;
            padding-top:10px;
        }
    </style>
    <div id="flashcontent" onmouseover="giveFocus();">
        Flash plugin or Javascript are turned off.
        Activate both  and reload to view the mindmap
    </div>
    <script>
        function giveFocus() {
            document.visorFreeMind.focus();
        }
Example #18
0
<?php

/* For licensing terms, see /license.txt */
/**
 * Reporting page on the user's own progress
 * @package chamilo.tracking
 */
$cidReset = true;
require_once '../inc/global.inc.php';
$this_section = SECTION_TRACKING;
$nameTools = get_lang('MyProgress');
api_block_anonymous_users();
$htmlHeadXtra[] = api_get_js('jquery.timelinr-0.9.5.js');
$htmlHeadXtra[] = '
<script language="javascript">
$(function() {
    $().timelinr();
});
</script>';
$user_id = api_get_user_id();
$course_user_list = CourseManager::get_courses_list_by_user_id($user_id);
$dates = $issues = '';
$sessionId = isset($_GET['session_id']) ? intval($_GET['session_id']) : 0;
$courseCode = isset($_GET['course']) ? Security::remove_XSS($_GET['course']) : null;
if (!empty($course_user_list)) {
    $items = MySpace::get_connections_from_course_list($user_id, $course_user_list);
    $first = null;
    $last = null;
    $last_item = count($items);
    $count = 1;
    foreach ($items as $result) {
    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'));
if ($origin != 'learnpath') {
    //so we are not in learnpath tool
    Display::display_header($nameTools, get_lang('Exercise'));
Example #20
0
<?php

/* For licensing terms, see /license.txt */
/**
 * This tool show global Statistics on general platform events
 * @package chamilo.Statistics
 */
$cidReset = true;
//require_once '../../inc/global.inc.php';
api_protect_admin_script();
$interbreadcrumb[] = array('url' => '../index.php', 'name' => get_lang('PlatformAdmin'));
$report = isset($_REQUEST['report']) ? $_REQUEST['report'] : '';
if ($report) {
    $htmlHeadXtra[] = api_get_js('chartjs/Chart.min.js');
    $htmlHeadXtra[] = '' . '<script type="text/javascript">' . '$(document).ready(function() {' . '$.ajax({' . 'url: "' . api_get_path(WEB_CODE_PATH) . 'inc/ajax/statistics.ajax.php?a=recentlogins",' . 'type: "POST",' . 'success: function(data) {' . 'Chart.defaults.global.responsive = true;' . 'var myLine = new Chart(document.getElementById("canvas").getContext("2d")).Line(data);' . '}' . '});' . '});' . '</script>';
}
$tool_name = get_lang('Statistics');
Display::display_header($tool_name);
echo Display::page_header($tool_name);
$strCourse = get_lang('Courses');
$strUsers = get_lang('Users');
$strSystem = get_lang('System');
$strSocial = get_lang('Social');
$strSession = get_lang('Session');
// courses ...
$tools[$strCourse]['report=courses'] = get_lang('CountCours');
$tools[$strCourse]['report=tools'] = get_lang('PlatformToolAccess');
$tools[$strCourse]['report=courselastvisit'] = get_lang('LastAccess');
$tools[$strCourse]['report=coursebylanguage'] = get_lang('CountCourseByLanguage');
// users ...
$tools[$strUsers]['report=users'] = get_lang('CountUsers');
Example #21
0
 /**
  * Display survey question chart
  * @param	array	Chart data
  * @param	boolean	Tells if the chart has a serie. False by default
  * @return	void 	(direct output)
  */
 public static function drawChart($chartData, $hasSerie = false, $chartContainerId = 'chartContainer')
 {
     $htmlChart = '';
     if (api_browser_support("svg")) {
         $htmlChart .= api_get_js("js/d3/d3.v3.5.4.min.js");
         $htmlChart .= api_get_js("js/dimple.v2.1.2.min.js") . '
         <script type="text/javascript">
         var svg = dimple.newSvg("#' . $chartContainerId . '", "100%", 400);
         var data = [';
         $serie = array();
         $order = array();
         foreach ($chartData as $chartDataElement) {
             $htmlChart .= '{"';
             if (!$hasSerie) {
                 $htmlChart .= get_lang("Option") . '":"' . $chartDataElement['option'] . '", "';
                 array_push($order, $chartDataElement['option']);
             } else {
                 if (!is_array($chartDataElement['serie'])) {
                     $htmlChart .= get_lang("Option") . '":"' . $chartDataElement['serie'] . '", "' . get_lang("Score") . '":"' . $chartDataElement['option'] . '", "';
                     array_push($serie, $chartDataElement['serie']);
                 } else {
                     $htmlChart .= get_lang("Serie") . '":"' . $chartDataElement['serie'][0] . '", "' . get_lang("Option") . '":"' . $chartDataElement['serie'][1] . '", "' . get_lang("Score") . '":"' . $chartDataElement['option'] . '", "';
                 }
             }
             $htmlChart .= get_lang("Votes") . '":"' . $chartDataElement['votes'] . '"},';
         }
         rtrim($htmlChart, ",");
         $htmlChart .= '];
             var myChart = new dimple.chart(svg, data);
             myChart.addMeasureAxis("y", "' . get_lang("Votes") . '");';
         if (!$hasSerie) {
             $htmlChart .= 'var xAxisCategory = myChart.addCategoryAxis("x", "' . get_lang("Option") . '");
                 xAxisCategory.addOrderRule(' . json_encode($order) . ');
                 myChart.addSeries("' . get_lang("Option") . '", dimple.plot.bar);';
         } else {
             if (!is_array($chartDataElement['serie'])) {
                 $serie = array_values(array_unique($serie));
                 $htmlChart .= 'var xAxisCategory = myChart.addCategoryAxis("x", ["' . get_lang("Option") . '","' . get_lang("Score") . '"]);
                     xAxisCategory.addOrderRule(' . json_encode($serie) . ');
                     xAxisCategory.addGroupOrderRule("' . get_lang("Score") . '");
                     myChart.addSeries("' . get_lang("Option") . '", dimple.plot.bar);';
             } else {
                 $htmlChart .= 'myChart.addCategoryAxis("x", ["' . get_lang("Option") . '","' . get_lang("Score") . '"]);
                     myChart.addSeries("' . get_lang("Serie") . '", dimple.plot.bar);';
             }
         }
         $htmlChart .= 'myChart.draw();
             </script>';
     }
     return $htmlChart;
 }
Example #22
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) {
            $image.attr("src", this.result);
Example #23
0
}
?>

<!DOCTYPE html>
<html>
<!-- removed for now, causes problems in Firefox: manifest="svg-editor.manifest" -->
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="chrome=1"/>
<link rel="icon" type="image/png" href="images/logo.png"/>
<link rel="stylesheet" href="jgraduate/css/jPicker.css" type="text/css"/>
<link rel="stylesheet" href="jgraduate/css/jgraduate.css" type="text/css"/>
<link rel="stylesheet" href="svg-editor.css" type="text/css"/>
<link rel="stylesheet" href="spinbtn/JQuerySpinBtn.css" type="text/css"/>
<?php 
echo api_get_js('jquery.js');
?>
<!--Chamilo TODO: compress sgv-editor.js and change all calls by release version -->
<script type="text/javascript" src="js-hotkeys/jquery.hotkeys.min.js"></script>
<script type="text/javascript" src="jquerybbq/jquery.bbq.min.js"></script>
<script type="text/javascript" src="svgicons/jquery.svgicons.js"></script>
<script type="text/javascript" src="jgraduate/jquery.jgraduate.min.js"></script>
<script type="text/javascript" src="spinbtn/JQuerySpinBtn.min.js"></script>
<script type="text/javascript" src="contextmenu/jquery.contextMenu.min.js"></script>

<!--{if svg_edit_release}>
  <script type="text/javascript" src="svgedit.compiled.js"></script>
<!{else}-->
  <script type="text/javascript" src="browser.js"></script>
  <script type="text/javascript" src="svgtransformlist.js"></script>
  <script type="text/javascript" src="math.js"></script>
Example #24
0
<?php

/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script(false, true);
if (api_get_setting('skill.allow_skills_tool') != 'true') {
    api_not_allowed();
}
//Adds the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_js('js/d3/d3.v3.5.4.min.js');
$htmlHeadXtra[] = api_get_js('js/d3/colorbrewer.js');
$htmlHeadXtra[] = api_get_js('js/d3/jquery.xcolor.js');
$tpl = Container::getTwig();
$load_user = 0;
if (isset($_GET['load_user'])) {
    $load_user = 1;
}
$skill_condition = '';
$tpl->addGlobal('skill_id_to_load', '');
if (isset($_GET['skill_id'])) {
    $skillId = intval($_GET['skill_id']);
    $skill_condition = '&skill_id=' . $skillId;
    $tpl->addGlobal('skill_id_to_load', $skillId);
}
$url = api_get_path(WEB_AJAX_PATH) . "skill.ajax.php?a=get_skills_tree_json&load_user={$load_user}";
$tpl->addGlobal('wheel_url', $url);
$url = api_get_path(WEB_AJAX_PATH) . 'skill.ajax.php?1=1';
$tpl->addGlobal('url', $url);
$tpl->addGlobal('isAdministration', true);
$dialogForm = new FormValidator('form', 'post', null, null, ['id' => 'add_item']);
    /**
     * Uses new functions (php 5.2) for displaying real upload progress.
     * @param string $upload_id							The value of the field UPLOAD_IDENTIFIER, the second parameter (XXX) of the $form->addElement('file', XXX) sentence
     * @param string $element_after						The first element of the form (to place at first UPLOAD_IDENTIFIER)
     * @param int $delay (optional)						The frequency of the xajax call
     * @param bool $wait_after_upload (optional)
     */
    public function add_real_progress_bar($upload_id, $element_after, $delay = 2, $wait_after_upload = false)
    {
        if (!function_exists('uploadprogress_get_info')) {
            $this->add_progress_bar($delay);
            return;
        }
        $xajax_upload = new xajax(api_get_path(WEB_LIBRARY_PATH) . 'upload.xajax.php');
        $xajax_upload->registerFunction('updateProgress');
        // IMPORTANT : must be the first element of the form
        $el = $this->insertElementBefore(FormValidator::createElement('html', '<input type="hidden" name="UPLOAD_IDENTIFIER" value="' . $upload_id . '" />'), $element_after);
        $this->addElement('html', '<br />');
        // Add div-element where the progress bar is to be displayed
        $this->addElement('html', '
                		<div id="dynamic_div_container" style="display:none">
                			<div id="dynamic_div_label">' . get_lang('UploadFile') . '</div>
                			<div id="dynamic_div_frame" style="width:214px; height:12px; border:1px solid grey; background-image:url(' . api_get_path(WEB_IMG_PATH) . 'real_upload_frame.gif);">
                				<div id="dynamic_div_filled" style="width:0%;height:100%;background-image:url(' . api_get_path(WEB_IMG_PATH) . 'real_upload_step.gif);background-repeat:repeat-x;background-position:center;"></div>
                			</div>
                		</div>');
        if ($wait_after_upload) {
            $this->addElement('html', '
			<div id="dynamic_div_waiter_container" style="display:none">
				<div id="dynamic_div_waiter_label">
					' . get_lang('SlideshowConversion') . '
				</div>
				<div id="dynamic_div_waiter_frame">
					<img src="' . api_get_path(WEB_IMG_PATH) . 'real_upload_frame.gif" />
				</div>
			</div>
		');
        }
        // Get the xajax code
        $this->addElement('html', $xajax_upload->getJavascript(api_get_path(WEB_LIBRARY_PATH) . 'xajax'));
        // Get the upload code
        $this->addElement('html', api_get_js('js/upload.js'));
        $this->addElement('html', '<script type="text/javascript">var myUpload = new upload(' . abs(intval($delay)) * 1000 . ');</script>');
        if (!$wait_after_upload) {
            $wait_after_upload = 0;
        }
        // Add the upload event
        $this->updateAttributes("onsubmit=\"javascript: myUpload.startRealUpload('dynamic_div','" . $upload_id . "','" . $this->getAttribute('id') . "'," . $wait_after_upload . ")\"");
    }
Example #26
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 #27
0
/**
 * Who is online list
 * @todo move this inside web/users/online
 */
// language files that should be included
$language_file = array('index', 'registration', 'messages', 'userInfo');
if (!isset($_GET['cidReq'])) {
    $cidReset = true;
}
// including necessary files
require_once './main/inc/global.inc.php';
if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) {
    api_protect_course_script(true);
}
$_SESSION['who_is_online_counter'] = 2;
$htmlHeadXtra[] = api_get_js('jquery.endless-scroll.js');
//social tab
$this_section = SECTION_SOCIAL;
// table definitions
$track_user_table = Database::get_main_table(TABLE_MAIN_USER);
$htmlHeadXtra[] = '<script>

function show_image(image,width,height) {
    width = parseInt(width) + 20;
    height = parseInt(height) + 20;
    window_x = window.open(image,\'windowX\',\'width=\'+ width + \', height=\'+ height + \'\');
}

$(document).ready(function (){
	$("input#id_btn_send_invitation").bind("click", function(){
		if (confirm("' . get_lang('SendMessageInvitation', '') . '")) {
Example #28
0
/**
 *
 * @param string $inputId the jquery id example: #password
 *
 * @return string
 */
function api_get_password_checker_js($usernameInputId, $passwordInputid)
{
    $checkPass = api_get_setting('security.allow_strength_pass_checker');
    $useStrengthPassChecker = $checkPass == 'true';
    if ($useStrengthPassChecker == false) {
        return null;
    }
    $verdicts = array(get_lang('PasswordWeak'), get_lang('PasswordNormal'), get_lang('PasswordMedium'), get_lang('PasswordStrong'), get_lang('PasswordVeryStrong'));
    $js = api_get_js('js/strength/strength.js');
    $js .= "<script>\n\n    var verdicts = ['" . implode("','", $verdicts) . "'];\n    var errorMessages = {\n        password_to_short : \"" . get_lang('PasswordIsTooShort') . "\",\n        same_as_username : \"" . get_lang('YourPasswordCannotBeTheSameAsYourUsername') . "\"\n    };\n\n    \$(document).ready(function() {\n        var options = {\n            verdicts: verdicts,\n            onLoad : function () {\n                //\$('#messages').text('Start typing password');\n            },\n            onKeyUp: function (evt) {\n                \$(evt.target).pwstrength('outputErrorList');\n            },\n            errorMessages : errorMessages,\n            viewports: {\n                progress: '#password_progress',\n                verdict: '#password-verdict',\n                errors: '#password-errors'\n            },\n            usernameField: '{$usernameInputId}'\n        };\n        \$('" . $passwordInputid . "').pwstrength(options);\n    });\n    </script>";
    return $js;
}
Example #29
0
}
$userIsOnline = user_is_online($user_id);
$libpath = api_get_path(LIBRARY_PATH);
require_once $libpath . 'magpierss/rss_fetch.inc';
$ajax_url = api_get_path(WEB_AJAX_PATH) . 'message.ajax.php';
$socialAjaxUrl = api_get_path(WEB_AJAX_PATH) . 'social.ajax.php';
$javascriptDir = api_get_path(LIBRARY_PATH) . 'javascript/';
api_block_anonymous_users();
$locale = api_get_language_isocode();
// Add Jquery scroll pagination plugin
$htmlHeadXtra[] = api_get_js('jscroll/jquery.jscroll.js');
// Add Jquery Time ago plugin
$htmlHeadXtra[] = api_get_asset('jquery-timeago/jquery.timeago.js');
$timeAgoLocaleDir = $javascriptDir . 'jquery-timeago/locales/jquery.timeago.' . $locale . '.js';
if (file_exists($timeAgoLocaleDir)) {
    $htmlHeadXtra[] = api_get_js('jquery-timeago/locales/jquery.timeago.' . $locale . '.js');
}
$htmlHeadXtra[] = '<script>

$(document).ready(function (){
    var container = $("#wallMessages");
    container.jscroll({
        loadingHtml: "<div class=\\"well_border\\">' . get_lang('Loading') . ' </div>",
        nextSelector: "a.nextPage:last",
        contentSelector: "",
        callback: timeAgo
    });
    timeAgo()

});
Example #30
0
// 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') {
    $cidReset = true;
    // fixes #5162
}
require_once '../inc/global.inc.php';
require_once 'agenda.lib.php';
require_once 'agenda.inc.php';
$current_course_tool = TOOL_CALENDAR_EVENT;
$this_section = SECTION_MYAGENDA;
$htmlHeadXtra[] = api_get_jquery_libraries_js(array('jquery-ui', 'jquery-ui-i18n'));
$htmlHeadXtra[] = api_get_js('qtip2/jquery.qtip.min.js');
$htmlHeadXtra[] = api_get_js('fullcalendar/fullcalendar.min.js');
$htmlHeadXtra[] = api_get_js('fullcalendar/gcal.js');
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH) . 'javascript/fullcalendar/fullcalendar.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;
    }
}