Beispiel #1
0
    $isSelfUser = true;
} else {
    $isSelfUser = false;
}
$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()
Beispiel #2
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;
    }
javascript/jquery-textcomplete/jquery.textcomplete.css">
<link rel="stylesheet" type="text/css" href="<?php 
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();
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/';
Beispiel #4
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;
    }
Beispiel #5
0
// 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') {
    $cidReset = true;
    // fixes #5162
}
require_once '../inc/global.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_asset('fullcalendar/dist/fullcalendar.min.js');
$htmlHeadXtra[] = api_get_asset('fullcalendar/dist/gcal.js');
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_PATH) . 'web/assets/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;
    }
}
Beispiel #6
0
/**
 * Returns the js header to include the jquery library
 */
function api_get_jquery_js()
{
    return api_get_asset('jquery/dist/jquery.min.js');
}