本文整理汇总了PHP中api_get_js函数的典型用法代码示例。如果您正苦于以下问题:PHP api_get_js函数的具体用法?PHP api_get_js怎么用?PHP api_get_js使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了api_get_js函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: api_get_js
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/';
示例2: api_not_allowed
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>';
*/
示例3: set_js_files_post
/**
* 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);
}
}
示例4: api_block_anonymous_users
<?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();
示例5: generate_jplayer_jquery
/**
* @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;
}
示例6: api_get_js
}
$(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() {
示例7: api_not_allowed
/* 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);
示例8: api_get_path
<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/';
?>
示例9: api_get_path
$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 {
示例10: api_get_jqgrid_js
<?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');
示例11: array
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
示例12: api_get_password_checker_js
/**
*
* @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;
}
示例13: isset
*/
$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;
}
}
示例14: toHtml
/**
* 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;
}
示例15: api_get_course_id
//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