本文整理汇总了PHP中Event::event_access_tool方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::event_access_tool方法的具体用法?PHP Event::event_access_tool怎么用?PHP Event::event_access_tool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Event
的用法示例。
在下文中一共展示了Event::event_access_tool方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prolog
/**
* Prepare the environment. Set up breadcrumps and raise tracking event.
*/
protected function prolog()
{
global $interbreadcrumb;
$interbreadcrumb = array();
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('Notebook'));
global $this_section;
$this_section = SECTION_COURSES;
global $current_course_tool;
$current_course_tool = TOOL_NOTEBOOK;
// Tracking
Event::event_access_tool(TOOL_NOTEBOOK);
}
示例2: array
$nameTools = '';
$interbreadcrumb[] = array('url' => 'link.php?' . api_get_cidreq(), 'name' => get_lang('Links'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('AddLink'));
}
if ($action == 'addcategory') {
$nameTools = '';
$interbreadcrumb[] = array('url' => 'link.php?' . api_get_cidreq(), 'name' => get_lang('Links'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('AddCategory'));
}
if ($action == 'editlink') {
$nameTools = '';
$interbreadcrumb[] = array('url' => 'link.php?' . api_get_cidreq(), 'name' => get_lang('Links'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('EditLink'));
}
// Statistics
Event::event_access_tool(TOOL_LINK);
/* Action Handling */
$nameTools = get_lang('Links');
$id = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;
$scope = isset($_REQUEST['scope']) ? $_REQUEST['scope'] : null;
$show = isset($_REQUEST['show']) && in_array(trim($_REQUEST['show']), ['all', 'none']) ? $_REQUEST['show'] : '';
$categoryId = isset($_REQUEST['category_id']) ? intval($_REQUEST['category_id']) : '';
$linkListUrl = api_get_self() . '?' . api_get_cidreq() . '&category_id=' . $categoryId . '&show=' . $show;
$content = null;
switch ($action) {
case 'addlink':
if (api_is_allowed_to_edit(null, true)) {
$form = Link::getLinkForm(null, 'addlink');
if ($form->validate()) {
// Here we add a link
Link::addlinkcategory("link");
示例3: api_protect_course_script
<?php
/* For licensing terms, see /license.txt */
/**
* Layout (principal view) used for structuring other views
* @author Christian Fasanando <christian1827@gmail.com>
* @package chamilo.course_progress
*/
// protect a course script
api_protect_course_script(true);
// Header
$tool = TOOL_COURSE_PROGRESS;
Display::display_header('');
// Introduction section
Display::display_introduction_section($tool);
// Tracking
Event::event_access_tool($tool);
// Display
echo $content;
// Footer
Display::display_footer();
示例4: prolog
/**
* Prepare the environment. Set up breadcrumps and raise tracking event.
*/
protected function prolog()
{
Event::event_access_tool(TOOL_COURSE_DESCRIPTION);
}
示例5: api_get_path
<?php
/* For licensing terms, see /license.txt */
/**
* Script allowing simple edition of learnpath information (title, description, etc)
* @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org>
*/
require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
global $charset;
$show_description_field = false;
//for now
$nameTools = get_lang('Doc');
$this_section = SECTION_COURSES;
Event::event_access_tool(TOOL_LEARNPATH);
api_protect_course_script();
if (isset($_SESSION['gradebook'])) {
$gradebook = $_SESSION['gradebook'];
}
if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array('url' => '../gradebook/' . $_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook'));
}
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));
$interbreadcrumb[] = array('url' => api_get_self() . "?action=build&lp_id=" . $_SESSION['oLP']->get_id(), 'name' => $_SESSION['oLP']->get_name());
$htmlHeadXtra[] = '<script>
function activate_start_date() {
if(document.getElementById(\'start_date_div\').style.display == \'none\') {
document.getElementById(\'start_date_div\').style.display = \'block\';
} else {
document.getElementById(\'start_date_div\').style.display = \'none\';
}
示例6: header
}
header('Location: ../newscorm/lp_controller.php?' . api_get_cidreq() . '&lp_id=' . $o_ppt->lp_id . '&action=view_item&id=' . $first_item_id);
exit;
} else {
if (!empty($o_ppt->error)) {
$errorMessage = $o_ppt->error;
} else {
$errorMessage = get_lang('OogieUnknownError');
}
}
} else {
$errorMessage = get_lang('OogieBadExtension');
}
}
}
Event::event_access_tool(TOOL_UPLOAD);
// check access permissions (edit permission is needed to add a document or a LP)
$is_allowed_to_edit = api_is_allowed_to_edit();
if (!$is_allowed_to_edit) {
api_not_allowed(true);
}
$interbreadcrumb[] = array("url" => "../newscorm/lp_controller.php?action=list", "name" => get_lang("Doc"));
$nameTools = get_lang("OogieConversionPowerPoint");
Display::display_header($nameTools);
$message = get_lang("WelcomeOogieConverter");
if (!empty($errorMessage)) {
echo Display::return_message($errorMessage, 'warning', false);
}
$div_upload_limit = get_lang('UploadMaxSize') . ' : ' . ini_get('post_max_size');
$form = new FormValidator('upload_ppt', 'POST', '', '');
$form->addElement('header', get_lang("WelcomeOogieSubtitle"));
示例7: api_get_user_id
} else {
// If student can unsubscribe
if (isset($_REQUEST['unregister']) && $_REQUEST['unregister'] == 'yes') {
if ($course_info['unsubscribe'] == 1) {
$user_id = api_get_user_id();
CourseManager::unsubscribe_user($user_id, $course_info['code']);
header('Location: ' . api_get_path(WEB_PATH) . 'user_portal.php');
exit;
}
}
}
if (!$is_allowed_in_course) {
api_not_allowed(true);
}
// Statistics
Event::event_access_tool(TOOL_USER);
/**
* Get the users to display on the current page.
*/
function get_number_of_users()
{
$counter = 0;
$sessionId = api_get_session_id();
$courseCode = api_get_course_id();
$active = isset($_GET['active']) ? $_GET['active'] : null;
if (!empty($sessionId)) {
$a_course_users = CourseManager::get_user_list_from_course_code($courseCode, $sessionId, null, null, null, null, false, false, null, null, null, $active);
} else {
$a_course_users = CourseManager::get_user_list_from_course_code($courseCode, 0, null, null, null, null, false, false, null, null, null, $active);
}
foreach ($a_course_users as $o_course_user) {
示例8: array
if (!empty($my_folder_data)) {
$interbreadcrumb[] = array('url' => 'work.php?id=' . $work_id . '&' . api_get_cidreq(), 'name' => $my_folder_data['title']);
}
if ($action == 'upload_form') {
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('UploadADocument'));
}
if ($action == 'settings') {
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('EditToolOptions'));
}
if ($action == 'create_dir') {
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('CreateAssignment'));
}
}
}
// Stats
Event::event_access_tool(TOOL_STUDENTPUBLICATION);
$is_allowed_to_edit = api_is_allowed_to_edit();
$student_can_edit_in_session = api_is_allowed_to_session_edit(false, true);
/* Display links to upload form and tool options */
if (!in_array($action, array('add', 'create_dir'))) {
$token = Security::get_token();
}
$courseInfo = api_get_course_info();
$currentUrl = api_get_path(WEB_CODE_PATH) . 'work/work.php?' . api_get_cidreq();
$content = null;
// For teachers
switch ($action) {
case 'settings':
//if posts
if ($is_allowed_to_edit && !empty($_POST['changeProperties'])) {
updateSettings($course, $_POST['show_score'], $_POST['student_delete_own_publication']);
示例9: get_lang
$current_course_tool = TOOL_CHAT;
$this_section = SECTION_COURSES;
$nameTools = get_lang('ToolChat');
$origin = isset($_GET["origin"]) ? Security::remove_XSS($_GET["origin"]) : null;
$target = isset($_GET["target"]) ? Security::remove_XSS($_GET["target"]) : null;
if ($origin != 'whoisonline') {
api_protect_course_script(true);
} else {
$origin = $_SESSION['origin'];
$target = $_SESSION['target'];
$_SESSION['origin'] = $origin;
$_SESSION['target'] = $target;
}
api_protect_course_group(GroupManager::GROUP_TOOL_CHAT, false);
/* TRACKING */
Event::event_access_tool(TOOL_CHAT);
header('Content-Type: text/html; charset=UTF-8');
/*
* Choose CSS style (platform's, user's, or course's)
*/
$my_style = api_get_visual_theme();
$mycourseid = api_get_course_id();
if (!empty($mycourseid) && $mycourseid != -1) {
$open_chat_window = api_get_course_setting('allow_open_chat_window');
}
$courseCode = Security::remove_XSS($_GET['cidReq']);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
示例10: get_lang
} else {
$errorXmlExport = Display::return_message(get_lang('ErrorWritingXMLFile'), 'error');
}
}
if ($origin != 'learnpath') {
//so we are not in learnpath tool
Display::display_header($nameTools, get_lang('Exercise'));
if (isset($_GET['message'])) {
if (in_array($_GET['message'], array('ExerciseEdited'))) {
Display::display_confirmation_message(get_lang($_GET['message']));
}
}
} else {
Display::display_reduced_header();
}
Event::event_access_tool(TOOL_QUIZ);
// Tool introduction
Display::display_introduction_section(TOOL_QUIZ);
if (!empty($errorXmlExport)) {
echo $errorXmlExport;
}
HotPotGCt($documentPath, 1, $userId);
// Only for administrator
if ($is_allowedToEdit) {
if (!empty($choice)) {
// All test choice, clean all test's results
if ($choice == 'clean_all_test') {
$check = Security::check_token('get');
if ($check) {
// list of exercises in a course/session
// we got variable $courseId $courseInfo session api_get_session_id()
示例11: api_protect_course_script
// Notice for unauthorized people.
api_protect_course_script(true);
// Additional javascript
$htmlHeadXtra[] = NotebookManager::javascript_notebook();
$htmlHeadXtra[] = '<script>
function setFocus(){
$("#note_title").focus();
}
$(document).ready(function () {
setFocus();
});
</script>';
// Setting the tool constants
$tool = TOOL_NOTEBOOK;
// Tracking
Event::event_access_tool(TOOL_NOTEBOOK);
// Tool name
if (isset($_GET['action']) && $_GET['action'] == 'addnote') {
$tool = 'NoteAddNew';
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('ToolNotebook'));
}
if (isset($_GET['action']) && $_GET['action'] == 'editnote') {
$tool = 'ModifyNote';
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('ToolNotebook'));
}
// Displaying the header
Display::display_header(get_lang(ucfirst($tool)));
// Tool introduction
Display::display_introduction_section(TOOL_NOTEBOOK);
// Action handling: Adding a note
if (isset($_GET['action']) && $_GET['action'] == 'addnote') {
示例12: api_get_path
/**
* Script to draw the results from a query
* @package chamilo.learnpath
* @author Diego Escalante Urrelo <diegoe@gmail.com>
* @author Marco Antonio Villegas Vega <marvil07@gmail.com>
* @author Julio Montoya <gugli100@gmail.com> Lots of bug fixing
*
*/
/**
* Code
*/
require api_get_path(LIBRARY_PATH) . 'search/search_widget.php';
require api_get_path(LIBRARY_PATH) . 'search/ChamiloQuery.php';
require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php';
require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
Event::event_access_tool(TOOL_SEARCH);
if (isset($_SESSION['gradebook'])) {
$gradebook = $_SESSION['gradebook'];
}
if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array('url' => '../gradebook/' . $_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook'));
}
$interbreadcrumb[] = array('url' => './index.php', 'name' => get_lang(ucfirst(TOOL_SEARCH)));
search_widget_prepare($htmlHeadXtra);
Display::display_header(null, 'Path');
if (api_get_setting('search_enabled') !== 'true') {
Display::display_error_message(get_lang('SearchFeatureNotEnabledComment'));
} else {
if (!empty($_GET['action'])) {
search_widget_show($_GET['action']);
} else {
示例13: api_get_path
} else {
$url = api_get_path(WEB_CODE_PATH) . 'calendar/agenda_js.php?';
}
header("Location: {$url}");
exit;
}
/* Resource linker */
Session::write('source_type', 'Agenda');
//require_once '../resourcelinker/resourcelinker.inc.php';
$group_id = api_get_group_id();
$eventId = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;
$type = $event_type = isset($_GET['type']) ? $_GET['type'] : null;
$htmlHeadXtra[] = "<script>\n\nfunction plus_repeated_event() {\n if (document.getElementById('options2').style.display == 'none') {\n document.getElementById('options2').style.display = 'block';\n } else {\n document.getElementById('options2').style.display = 'none';\n }\n}\n \$(function() {\n var checked = \$('input[name=repeat]').attr('checked');\n if (checked) {\n \$('#options2').show();\n }\n });\n</script>\n";
// setting the name of the tool
$nameTools = get_lang('Agenda');
Event::event_access_tool(TOOL_CALENDAR_EVENT);
// permission stuff - also used by loading from global in agenda.inc.php
$is_allowed_to_edit = api_is_allowed_to_edit(false, true) || api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous();
$agenda = new Agenda();
$agenda->type = $type;
$actions = $agenda->displayActions('calendar');
if ($type == 'fromjs') {
$id_list = explode('_', $eventId);
$eventId = $id_list[1];
$event_type = $id_list[0];
}
if (!api_is_allowed_to_edit(null, true) && $event_type == 'course') {
api_not_allowed(true);
}
if ($event_type == 'course') {
$agendaUrl = api_get_path(WEB_CODE_PATH) . 'calendar/agenda_js.php?' . api_get_cidreq() . '&type=course';
示例14: get_last_tool_access
if (isset($_SESSION[$_course['id']]) && $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] == '') {
$last_access = get_last_tool_access(TOOL_DROPBOX);
$_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] = $last_access;
} else {
if (isset($_SESSION[$_course['id']])) {
$last_access = $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX];
}
}
$categoryName = isset($_POST['category_name']) ? $_POST['category_name'] : '';
$editId = isset($_POST['edit_id']) ? $_POST['edit_id'] : '';
$postAction = isset($_POST['action']) ? $_POST['action'] : null;
$view = isset($_GET['view']) ? Security::remove_XSS($_GET['view']) : null;
$viewReceivedCategory = isset($_GET['view_received_category']) ? Security::remove_XSS($_GET['view_received_category']) : null;
$viewSentCategory = isset($_GET['view_sent_category']) ? Security::remove_XSS($_GET['view_sent_category']) : null;
// Do the tracking
Event::event_access_tool(TOOL_DROPBOX);
// This var is used to give a unique value to every page request. This is to prevent resubmiting data
$dropbox_unid = md5(uniqid(rand(), true));
/* DISPLAY SECTION */
Display::display_introduction_section(TOOL_DROPBOX);
// Build URL-parameters for table-sorting
$sort_params = array();
if (isset($_GET['dropbox_column'])) {
$sort_params[] = 'dropbox_column=' . $_GET['dropbox_column'];
}
if (isset($_GET['dropbox_page_nr'])) {
$sort_params[] = 'page_nr=' . intval($_GET['page_nr']);
}
if (isset($_GET['dropbox_per_page'])) {
$sort_params[] = 'dropbox_per_page=' . intval($_GET['dropbox_per_page']);
}
示例15: api_get_course_int_id
// Maximum title messages to display
$maximum = '12';
// Length of the titles
$length = '36';
// Database Table Definitions
$tbl_courses = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_sessions = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT);
$tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
$course_id = api_get_course_int_id();
$_course = api_get_course_info_by_id($course_id);
$group_id = api_get_group_id();
$sessionId = api_get_session_id();
api_protect_course_group(GroupManager::GROUP_TOOL_ANNOUNCEMENT);
/* Tracking */
Event::event_access_tool(TOOL_ANNOUNCEMENT);
$announcement_id = isset($_GET['id']) ? intval($_GET['id']) : null;
$origin = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : null;
$action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : 'list';
$announcement_number = AnnouncementManager::getNumberAnnouncements();
$homeUrl = api_get_self() . '?action=list&' . api_get_cidreq();
$content = '';
$searchFormToString = '';
switch ($action) {
case 'move':
/* Move announcement up/down */
if (!empty($_GET['down'])) {
$thisAnnouncementId = intval($_GET['down']);
$sortDirection = "DESC";
}
if (!empty($_GET['up'])) {