本文整理汇总了PHP中GroupManager::is_tutor_of_group方法的典型用法代码示例。如果您正苦于以下问题:PHP GroupManager::is_tutor_of_group方法的具体用法?PHP GroupManager::is_tutor_of_group怎么用?PHP GroupManager::is_tutor_of_group使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GroupManager
的用法示例。
在下文中一共展示了GroupManager::is_tutor_of_group方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: api_get_user_platform_status
/**
* @param int $user_id
*
* @return array
*/
function api_get_user_platform_status($user_id = null)
{
$status = array();
$user_id = intval($user_id);
if (empty($user_id)) {
$user_id = api_get_user_id();
}
if (empty($user_id)) {
return false;
}
$group_id = api_get_group_id();
$course_id = api_get_course_int_id();
$course_code = api_get_course_id();
$session_id = api_get_session_id();
//Group (in course)
if ($group_id && $course_id) {
$group_status = array();
$is_subscribed = GroupManager::is_subscribed($user_id, $group_id);
if ($is_subscribed) {
$group_status = array('id' => $group_id, 'status' => 'student');
$is_tutor = GroupManager::is_tutor_of_group($user_id, $group_id);
if ($is_tutor) {
$group_status['status'] = 'tutor';
} else {
$group_status['status'] = 'student';
}
}
$status['group'] = $group_status;
}
//Session
if ($session_id && $course_id) {
$session_status = array('id' => $session_id, 'course_id' => $course_id);
$session_user_status = SessionManager::get_user_status_in_course_session($user_id, $course_id, $session_id);
switch ($session_user_status) {
case 0:
$session_status['status'] = 'student';
break;
case 2:
$session_status['status'] = 'coach';
break;
}
$is_general_coach = SessionManager::user_is_general_coach($user_id, $session_id);
if ($is_general_coach) {
$session_status['status'] = 'general_coach';
}
$status['session'] = $session_status;
} elseif ($course_id) {
//Course
$course_status = array();
if ($course_id) {
$user_course_status = CourseManager::get_user_in_course_status($user_id, $course_code);
if ($user_course_status) {
$course_status = array('id' => $course_id);
switch ($user_course_status) {
case 1:
$course_status['status'] = 'teacher';
break;
case 5:
$course_status['status'] = 'student';
//check if tutor
$tutor_course_status = CourseManager::get_tutor_in_course_status($user_id, $course_code);
if ($tutor_course_status) {
$course_status['status'] = 'tutor';
}
break;
}
}
}
$status['course'] = $course_status;
}
return $status;
}
示例2: forum_not_allowed_here
}
/* Is the user allowed here? */
// If the user is not a course administrator and the forum is hidden
// then the user is not allowed here.
if (!api_is_allowed_to_edit(false, true) && ($current_forum['visibility'] == 0 || $current_thread['visibility'] == 0)) {
$forum_allow = forum_not_allowed_here();
if ($forum_allow === false) {
exit;
}
}
/* Actions */
$my_action = isset($_GET['action']) ? $_GET['action'] : '';
if ($my_action == 'delete' && isset($_GET['content']) && isset($_GET['id']) && (api_is_allowed_to_edit(false, true) || GroupManager::is_tutor_of_group(api_get_user_id(), $groupId))) {
$message = delete_post($_GET['id']);
}
if (($my_action == 'invisible' || $my_action == 'visible') && isset($_GET['id']) && (api_is_allowed_to_edit(false, true) || GroupManager::is_tutor_of_group(api_get_user_id(), $groupId))) {
$message = approve_post($_GET['id'], $_GET['action']);
}
if ($my_action == 'move' && isset($_GET['post'])) {
$message = move_post_form();
}
/* Display the action messages */
$my_message = isset($message) ? $message : '';
if ($my_message) {
Display::display_confirmation_message(get_lang($my_message));
}
if ($my_message != 'PostDeletedSpecial') {
// in this case the first and only post of the thread is removed
// this increases the number of times the thread has been viewed
increase_thread_view($_GET['thread']);
/* Action Links */
示例3: display_user_image
if (api_get_course_setting('allow_user_image_forum')) {
echo '<br />' . display_user_image($post['user_id'], $name, $origin) . '<br />';
}
echo display_user_link($post['user_id'], $name, $origin, $username) . "<br />";
echo api_convert_and_format_date($post['post_date']) . '<br /><br />';
// get attach id
$attachment_list = get_attachment($post['post_id']);
$id_attach = !empty($attachment_list) ? $attachment_list['id'] : '';
// The user who posted it can edit his thread only if the course admin allowed this in the properties of the forum
// The course admin him/herself can do this off course always
if (GroupManager::is_tutor_of_group(api_get_user_id(), $group_id) or $current_forum['allow_edit'] == 1 and $row['user_id'] == $_user['user_id'] or api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $_SESSION['id_session'])) {
if ($locked == false) {
echo "<a href=\"editpost.php?" . api_get_cidreq() . "&forum=" . $clean_forum_id . "&thread=" . $clean_thread_id . "&post=" . $post['post_id'] . "&id_attach=" . $id_attach . "\">" . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . "</a>";
}
}
if (GroupManager::is_tutor_of_group(api_get_user_id(), $group_id) or api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $_SESSION['id_session'])) {
if ($locked == false) {
echo "<a href=\"" . api_get_self() . "?" . api_get_cidreq() . "&gidReq=" . Security::remove_XSS($_GET['gidReq']) . "&forum=" . $clean_forum_id . "&thread=" . $clean_thread_id . "&action=delete&content=post&id=" . $post['post_id'] . "\" onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang('DeletePost'), ENT_QUOTES)) . "')) return false;\">" . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . "</a>";
}
}
if (api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $_SESSION['id_session'])) {
display_visible_invisible_icon('post', $post['post_id'], $post['visible'], array('forum' => $clean_forum_id, 'thread' => $clean_thread_id));
if ($count > 0) {
echo "<a href=\"viewthread.php?" . api_get_cidreq() . "&gidReq=" . Security::remove_XSS($_GET['gidReq']) . "&forum=" . $clean_forum_id . "&thread=" . $clean_thread_id . "&action=move&origin=" . $origin . "&post=" . $post['post_id'] . "\">" . Display::return_icon('move.png', get_lang('MovePost'), array(), ICON_SIZE_SMALL) . "</a>";
}
}
$userinf = api_get_user_info($post['user_id']);
$user_status = api_get_status_of_user_in_course($post['user_id'], api_get_course_id());
if (api_is_allowed_to_edit(null, true)) {
//if ($count>0 && $user_status!=1) {
if ($count > 0) {
示例4: api_get_self
*/
$subscribe_group = '';
if (GroupManager::is_self_registration_allowed($user_id, $current_group['id'])) {
$subscribe_group = '<a class="btn btn-default" href="' . api_get_self() . '?selfReg=1&group_id=' . $current_group['id'] . '" onclick="javascript: if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES)) . "'" . ')) return false;">' . get_lang("RegIntoGroup") . '</a>';
}
/*
* Unregister from group
*/
$unsubscribe_group = '';
if (GroupManager::is_self_unregistration_allowed($user_id, $current_group['id'])) {
$unsubscribe_group = '<a class="btn btn-default" href="' . api_get_self() . '?selfUnReg=1" onclick="javascript: if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES)) . "'" . ')) return false;">' . get_lang("StudentUnsubscribe") . '</a>';
}
echo ' </div>';
/* Main Display Area */
$edit_url = '';
if (api_is_allowed_to_edit(false, true) || GroupManager::is_tutor_of_group(api_get_user_id(), api_get_group_id())) {
$my_origin = isset($origin) ? $origin : '';
$edit_url = '<a href="' . api_get_path(WEB_CODE_PATH) . 'group/settings.php?' . api_get_cidreq() . '&origin=' . $my_origin . '">' . Display::return_icon('edit.png', get_lang('EditGroup'), '', ICON_SIZE_SMALL) . '</a>';
}
echo Display::page_header(Security::remove_XSS($current_group['name']) . ' ' . $edit_url . ' ' . $subscribe_group . ' ' . $unsubscribe_group);
if (!empty($current_group['description'])) {
echo '<p>' . Security::remove_XSS($current_group['description']) . '</p>';
}
/*
* Group Tools
*/
// If the user is subscribed to the group or the user is a tutor of the group then
if (api_is_allowed_to_edit(false, true) || GroupManager::is_user_in_group(api_get_user_id(), $current_group['id'])) {
$actions_array = array();
// Link to the forum of this group
$forums_of_groups = get_forums_of_group($current_group['id']);
示例5: auto_add_page_users
/**
* Function wizard individual assignment
* @author Juan Carlos Raña <herodoto@telefonica.net>
*/
function auto_add_page_users($assignment_type)
{
global $assig_user_id, $session_id;
//$assig_user_id is need to identify end reflinks
$_clean['group_id'] = (int) $_SESSION['_gid'];
if ($_clean['group_id'] == 0) {
//extract course members
if (!empty($session_id)) {
$a_users_to_add = CourseManager::get_user_list_from_course_code($_SESSION['_course']['id'], $session_id);
} else {
$a_users_to_add = CourseManager::get_user_list_from_course_code($_SESSION['_course']['id'], 0);
}
} else {
//extract group members
$subscribed_users = GroupManager::get_subscribed_users($_clean['group_id']);
$subscribed_tutors = GroupManager::get_subscribed_tutors($_clean['group_id']);
$a_users_to_add_with_duplicates = array_merge($subscribed_users, $subscribed_tutors);
//remove duplicates
$a_users_to_add = $a_users_to_add_with_duplicates;
//array_walk($a_users_to_add, create_function('&$value,$key', '$value = json_encode($value);'));
$a_users_to_add = array_unique($a_users_to_add);
//array_walk($a_users_to_add, create_function('&$value,$key', '$value = json_decode($value, true);'));
}
//echo print_r($a_users_to_add);
$all_students_pages = array();
//data about teacher
$userinfo = api_get_user_info(api_get_user_id());
$name = $userinfo['complete_name_login_as'];
if (api_get_user_id() != 0) {
$image_path = UserManager::get_user_picture_path_by_id(api_get_user_id(), 'web', false, true);
$image_repository = $image_path['dir'];
$existing_image = $image_path['file'];
$photo = '<img src="' . $image_repository . $existing_image . '" alt="' . $name . '" width="40" height="50" align="top" title="' . $name . '" />';
} else {
$photo = '<img src="' . api_get_path(WEB_CODE_PATH) . "img/unknown.jpg" . '" alt="' . $name . '" width="40" height="50" align="top" title="' . $name . '" />';
}
//teacher assignment title
$title_orig = $_POST['title'];
//teacher assignment reflink
$link2teacher = $_POST['title'] = $title_orig . "_uass" . api_get_user_id();
//first: teacher name, photo, and assignment description (original content)
// $content_orig_A='<div align="center" style="background-color: #F5F8FB; border:double">'.$photo.'<br />'.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).'<br />('.get_lang('Teacher').')</div><br/><div>';
$content_orig_A = '<div align="center" style="background-color: #F5F8FB; border:solid; border-color: #E6E6E6"><table border="0"><tr><td style="font-size:24px">' . get_lang('AssignmentDesc') . '</td></tr><tr><td>' . $photo . '<br />' . Display::tag('span', $name) . '</td></tr></table></div>';
$content_orig_B = '<br/><div align="center" style="font-size:24px">' . get_lang('AssignmentDescription') . ': ' . $title_orig . '</div><br/>' . $_POST['content'];
//Second: student list (names, photo and links to their works).
//Third: Create Students work pages.
foreach ($a_users_to_add as $user_id => $o_user_to_add) {
if ($o_user_to_add['user_id'] != api_get_user_id()) {
$assig_user_id = $o_user_to_add['user_id'];
//identifies each page as created by the student, not by teacher
$image_path = UserManager::get_user_picture_path_by_id($assig_user_id, 'web', false, true);
$image_repository = $image_path['dir'];
$existing_image = $image_path['file'];
$username = api_htmlentities(sprintf(get_lang('LoginX'), $o_user_to_add['username'], ENT_QUOTES));
$name = api_get_person_name($o_user_to_add['firstname'], $o_user_to_add['lastname']) . " . " . $username;
$photo = '<img src="' . $image_repository . $existing_image . '" alt="' . $name . '" width="40" height="50" align="bottom" title="' . $name . '" />';
$is_tutor_of_group = GroupManager::is_tutor_of_group($assig_user_id, $_clean['group_id']);
//student is tutor
$is_tutor_and_member = GroupManager::is_tutor_of_group($assig_user_id, $_clean['group_id']) && GroupManager::is_subscribed($assig_user_id, $_clean['group_id']);
//student is tutor and member
if ($is_tutor_and_member) {
$status_in_group = get_lang('GroupTutorAndMember');
} else {
if ($is_tutor_of_group) {
$status_in_group = get_lang('GroupTutor');
} else {
$status_in_group = " ";
//get_lang('GroupStandardMember')
}
}
if ($assignment_type == 1) {
$_POST['title'] = $title_orig;
$_POST['comment'] = get_lang('AssignmentFirstComToStudent');
$_POST['content'] = '<div align="center" style="background-color: #F5F8FB; border:solid; border-color: #E6E6E6"><table border="0"><tr><td style="font-size:24px">' . get_lang('AssignmentWork') . '</td></tr><tr><td>' . $photo . '<br />' . $name . '</td></tr></table></div>[[' . $link2teacher . ' | ' . get_lang('AssignmentLinktoTeacherPage') . ']] ';
//If $content_orig_B is added here, the task written by the professor was copied to the page of each student. TODO: config options
//AssignmentLinktoTeacherPage
$all_students_pages[] = '<li>' . Display::tag('span', strtoupper($o_user_to_add['lastname']) . ', ' . $o_user_to_add['firstname'], array('title' => $username)) . ' [[' . $_POST['title'] . "_uass" . $assig_user_id . ' | ' . $photo . ']] ' . $status_in_group . '</li>';
//don't change this line without guaranteeing that users will be ordered by last names in the following format (surname, name)
//$all_students_pages[] = '<li><table border="0"><tr><td width="200">'.api_get_person_name($o_user_to_add['lastname'], $o_user_to_add['firstname']).'</td><td>[['.$_POST['title']."_uass".$assig_user_id.' | '.$photo.']] '.$status_in_group.'</td></tr></table></li>';
$_POST['assignment'] = 2;
}
save_new_wiki();
}
}
//end foreach for each user
foreach ($a_users_to_add as $user_id => $o_user_to_add) {
if ($o_user_to_add['user_id'] == api_get_user_id()) {
$assig_user_id = $o_user_to_add['user_id'];
if ($assignment_type == 1) {
$_POST['title'] = $title_orig;
$_POST['comment'] = get_lang('AssignmentDesc');
sort($all_students_pages);
$_POST['content'] = $content_orig_A . $content_orig_B . '<br/><div align="center" style="font-size:18px; background-color: #F5F8FB; border:solid; border-color:#E6E6E6">' . get_lang('AssignmentLinkstoStudentsPage') . '</div><br/><div style="background-color: #F5F8FB; border:solid; border-color:#E6E6E6"><ol>' . implode($all_students_pages) . '</ol></div><br/>';
$_POST['assignment'] = 1;
}
save_new_wiki();
//.........这里部分代码省略.........
示例6: get_attachment
// get attach id
$attachment_list = get_attachment($row['post_id']);
$id_attach = !empty($attachment_list) ? $attachment_list['iid'] : '';
$iconEdit = '';
// The user who posted it can edit his thread only if the course admin allowed
// this in the properties of the forum
// The course admin him/herself can do this off course always
if (GroupManager::is_tutor_of_group($userId, $groupId) || $current_forum['allow_edit'] == 1 && $row['user_id'] == $_user['user_id'] || api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $sessionId)) {
if (api_is_allowed_to_session_edit(false, true)) {
if ($locked == false) {
$iconEdit .= "<a href=\"editpost.php?" . api_get_cidreq() . "&forum=" . $clean_forum_id . "&thread=" . $clean_thread_id . "&post=" . $row['post_id'] . "&origin=" . $origin . "&edit=edition&id_attach=" . $id_attach . "\">" . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . "</a>";
}
}
}
if ($origin != 'learnpath') {
if (GroupManager::is_tutor_of_group($userId, $groupId) || api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $sessionId)) {
if ($locked == false) {
$iconEdit .= "<a href=\"" . api_get_self() . "?" . api_get_cidreq() . "&forum=" . $clean_forum_id . "&thread=" . $clean_thread_id . "&action=delete&content=post&id=" . $row['post_id'] . "&origin=" . $origin . "\" onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang('DeletePost'), ENT_QUOTES)) . "')) return false;\">" . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . "</a>";
}
}
if (api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $sessionId)) {
$iconEdit .= return_visible_invisible_icon('post', $row['post_id'], $row['visible'], array('forum' => $clean_forum_id, 'thread' => $clean_thread_id, 'origin' => $origin));
$iconEdit .= "";
if ($increment > 0) {
$iconEdit .= "<a href=\"viewthread.php?" . api_get_cidreq() . "&forum=" . $clean_forum_id . "&thread=" . $clean_thread_id . "&action=move&post=" . $row['post_id'] . "&origin=" . $origin . "\">" . Display::return_icon('move.png', get_lang('MovePost'), array(), ICON_SIZE_SMALL) . "</a>";
}
}
}
$user_status = api_get_status_of_user_in_course($row['user_id'], api_get_course_int_id());
$current_qualify_thread = showQualify('1', $row['poster_id'], $_GET['thread']);
if (($current_thread['thread_peer_qualify'] == 1 || api_is_allowed_to_edit(null, true)) && $current_thread['thread_qualify_max'] > 0 && $origin != 'learnpath') {
示例7: get_lang
?>
&id=<?php
echo $document_id;
?>
&createdir=1">
<?php
Display::display_icon('new_folder.png', get_lang('CreateDir'), '', ICON_SIZE_MEDIUM);
?>
</a>
<?php
}
}
$table_footer = '';
$total_size = 0;
if (isset($docs_and_folders) && is_array($docs_and_folders)) {
if (api_get_group_id() == 0 || (api_is_allowed_to_edit() || GroupManager::is_subscribed(api_get_user_id(), api_get_group_id()) || GroupManager::is_tutor_of_group(api_get_user_id(), api_get_group_id()) || UserManager::is_admin(api_get_user_id()))) {
// Create a sortable table with our data
$sortable_data = array();
$count = 1;
foreach ($docs_and_folders as $key => $document_data) {
$row = array();
$row['id'] = $document_data['id'];
$row['type'] = $document_data['filetype'];
// If the item is invisible, wrap it in a span with class invisible
$is_visible = DocumentManager::is_visible_by_id($document_data['id'], $course_info, api_get_session_id(), api_get_user_id(), false);
$invisibility_span_open = $is_visible == 0 ? '<span class="muted">' : '';
$invisibility_span_close = $is_visible == 0 ? '</span>' : '';
// Size (or total size of a directory)
$size = $document_data['filetype'] == 'folder' ? FileManager::get_total_folder_size($document_data['path'], $is_allowed_to_edit) : $document_data['size'];
// Get the title or the basename depending on what we're using
if ($document_data['title'] != '') {
示例8: api_get_group_id
/* MAIN DISPLAY SECTION */
$groupId = api_get_group_id();
$my_forum = isset($_GET['forum']) ? $_GET['forum'] : '';
// Note: This has to be validated that it is an existing forum.
$current_forum = get_forum_information($my_forum);
if (empty($current_forum)) {
api_not_allowed();
}
$current_forum_category = get_forumcategory_information($current_forum['forum_category']);
$is_group_tutor = false;
if (!empty($groupId)) {
//Group info & group category info
$group_properties = GroupManager::get_group_properties($groupId);
//User has access in the group?
$user_has_access_in_group = GroupManager::user_has_access($userid, $groupId, GroupManager::GROUP_TOOL_FORUM);
$is_group_tutor = GroupManager::is_tutor_of_group(api_get_user_id(), $groupId);
//Course
if (!api_is_allowed_to_edit(false, true) and ($current_forum_category && $current_forum_category['visibility'] == 0 or $current_forum['visibility'] == 0 or !$user_has_access_in_group)) {
api_not_allowed();
}
} else {
//Course
if (!api_is_allowed_to_edit(false, true) and ($current_forum_category && $current_forum_category['visibility'] == 0 or $current_forum['visibility'] == 0)) {
api_not_allowed();
}
}
/* Header and Breadcrumbs */
$my_search = isset($_GET['search']) ? $_GET['search'] : '';
$my_action = isset($_GET['action']) ? $_GET['action'] : '';
$gradebook = null;
if (isset($_SESSION['gradebook'])) {
示例9: displayActions
/**
* @param int $filter
* @param string $view
* @return string
*/
public function displayActions($view, $filter = 0)
{
$actions = "<a href='" . api_get_path(WEB_CODE_PATH) . "calendar/agenda_js.php?type={$this->type}'>" . Display::return_icon('calendar.png', get_lang('Calendar'), '', ICON_SIZE_MEDIUM) . "</a>";
$actions .= "<a href='" . api_get_path(WEB_CODE_PATH) . "calendar/agenda_list.php?type={$this->type}&" . api_get_cidreq() . "'>" . Display::return_icon('week.png', get_lang('AgendaList'), '', ICON_SIZE_MEDIUM) . "</a>";
if (api_is_allowed_to_edit(false, true) or api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous() && api_is_allowed_to_session_edit(false, true) or GroupManager::user_has_access(api_get_user_id(), api_get_group_id(), GroupManager::GROUP_TOOL_CALENDAR) && GroupManager::is_tutor_of_group(api_get_user_id(), api_get_group_id())) {
if ($this->type == 'course') {
$form = null;
if (!isset($_GET['action'])) {
$form = new FormValidator('form-search');
$attributes = array('multiple' => false, 'id' => 'select_form_id_search');
$selectedValues = $this->parseAgendaFilter($filter);
$this->showToForm($form, $selectedValues, $attributes);
$form = $form->return_form();
}
$actions .= "<a href='" . api_get_path(WEB_CODE_PATH) . "calendar/agenda.php?" . api_get_cidreq() . "&action=add&type=course'>" . Display::return_icon('new_event.png', get_lang('AgendaAdd'), '', ICON_SIZE_MEDIUM) . "</a>";
$actions .= "<a href='" . api_get_path(WEB_CODE_PATH) . "calendar/agenda.php?" . api_get_cidreq() . "&action=importical&type=course'>" . Display::return_icon('import_calendar.png', get_lang('ICalFileImport'), '', ICON_SIZE_MEDIUM) . "</a>";
if ($view == 'calendar') {
$actions .= $form;
}
}
}
return $actions;
}
示例10: forum_not_allowed_here
/* Is the user allowed here? */
// If the user is not a course administrator and the forum is hidden
// then the user is not allowed here.
if (!api_is_allowed_to_edit(false, true) and ($current_forum['visibility'] == 0 or $current_thread['visibility'] == 0)) {
$forum_allow = forum_not_allowed_here();
if ($forum_allow === false) {
exit;
}
}
/* Actions */
$group_id = api_get_group_id();
$my_action = isset($_GET['action']) ? $_GET['action'] : '';
if ($my_action == 'delete' and isset($_GET['content']) and isset($_GET['id']) and (api_is_allowed_to_edit(false, true) or GroupManager::is_tutor_of_group(api_get_user_id(), $group_id))) {
$message = delete_post($_GET['id']);
}
if (($my_action == 'invisible' or $my_action == 'visible') and isset($_GET['id']) and (api_is_allowed_to_edit(false, true) or GroupManager::is_tutor_of_group(api_get_user_id(), $group_id))) {
$message = approve_post($_GET['id'], $_GET['action']);
}
if ($my_action == 'move' and isset($_GET['post'])) {
$message = move_post_form();
}
/* Display the action messages */
$my_message = isset($message) ? $message : '';
if ($my_message) {
Display::display_confirmation_message(get_lang($my_message));
}
if ($my_message != 'PostDeletedSpecial') {
// in this case the first and only post of the thread is removed
// this increases the number of times the thread has been viewed
increase_thread_view($_GET['thread']);
/* Action Links */
示例11: isset
/**
* Responses to AJAX calls
*/
$type = isset($_GET['type']) && in_array($_GET['type'], array('personal', 'course', 'admin')) ? $_GET['type'] : 'personal';
if ($type == 'personal') {
$cidReset = true;
// fixes #5162
}
require_once api_get_path(SYS_CODE_PATH) . 'calendar/agenda.inc.php';
$action = isset($_GET['a']) ? $_GET['a'] : null;
if ($type == 'course') {
api_protect_course_script(true);
}
$group_id = api_get_group_id();
$user_id = api_get_user_id();
$is_group_tutor = GroupManager::is_tutor_of_group($user_id, $group_id);
$agenda = new Agenda();
$agenda->setType($type);
//course,admin or personal
switch ($action) {
case 'add_event':
if (!api_is_allowed_to_edit(null, true) && !$is_group_tutor && $type == 'course') {
break;
}
$add_as_announcement = isset($_REQUEST['add_as_annonuncement']) ? $_REQUEST['add_as_annonuncement'] : null;
$usersToSend = isset($_REQUEST['users_to_send']) ? $_REQUEST['users_to_send'] : null;
echo $agenda->add_event($_REQUEST['start'], $_REQUEST['end'], $_REQUEST['all_day'], $_REQUEST['view'], $_REQUEST['title'], $_REQUEST['content'], $usersToSend, $add_as_announcement);
break;
case 'edit_event':
if (!api_is_allowed_to_edit(null, true) && $type == 'course') {
break;
示例12: array
// Documents are private
if ($is_allowed_to_edit || GroupManager::is_user_in_group($userId, $groupId)) {
// Only courseadmin or group members (members + tutors) allowed
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'group/group.php?' . api_get_cidreq(), 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'group/group_space.php?' . api_get_cidreq(), 'name' => get_lang('GroupSpace') . ' ' . $group_properties['name']);
//they are allowed to upload
$group_member_with_upload_rights = true;
} else {
$groupId = 0;
}
} elseif ($group_properties['doc_state'] == 1) {
// Documents are public
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'group/group.php?' . api_get_cidreq(), 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'group/group_space.php?' . api_get_cidreq(), 'name' => get_lang('GroupSpace') . ' ' . $group_properties['name']);
// Allowed to upload?
if ($is_allowed_to_edit || GroupManager::is_subscribed($userId, $groupId) || GroupManager::is_tutor_of_group($userId, $groupId, $courseId)) {
// Only course admin or group members can upload
$group_member_with_upload_rights = true;
}
}
Session::write('group_member_with_upload_rights', $group_member_with_upload_rights);
} else {
Session::write('group_member_with_upload_rights', false);
}
// Actions.
$document_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : null;
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
$currentUrl = api_get_self() . '?' . api_get_cidreq() . '&id=' . $document_id;
if (Portfolio::controller()->accept()) {
Portfolio::controller()->run();
}
示例13: user_can_edit_announcement
public static function user_can_edit_announcement()
{
$group_id = api_get_group_id();
return api_is_allowed_to_edit(false, true) or api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous() or !empty($group_id) and GroupManager::user_has_access(api_get_user_id(), $group_id, GroupManager::GROUP_TOOL_ANNOUNCEMENT) and GroupManager::is_tutor_of_group(api_get_user_id(), $group_id);
}
示例14: displayActions
/**
* @param int $filter
* @param string $view
* @return string
*/
public function displayActions($view, $filter = 0)
{
$courseInfo = api_get_course_info();
$actionsLeft = '';
$actionsLeft .= "<a href='" . api_get_path(WEB_CODE_PATH) . "calendar/agenda_js.php?type={$this->type}'>" . Display::return_icon('calendar.png', get_lang('Calendar'), '', ICON_SIZE_MEDIUM) . "</a>";
$courseCondition = '';
if (!empty($courseInfo)) {
$courseCondition = api_get_cidreq();
}
$actionsLeft .= "<a href='" . api_get_path(WEB_CODE_PATH) . "calendar/agenda_list.php?type={$this->type}&" . $courseCondition . "'>" . Display::return_icon('week.png', get_lang('AgendaList'), '', ICON_SIZE_MEDIUM) . "</a>";
$form = '';
if (api_is_allowed_to_edit(false, true) || api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous() && api_is_allowed_to_session_edit(false, true) || GroupManager::user_has_access(api_get_user_id(), api_get_group_id(), GroupManager::GROUP_TOOL_CALENDAR) && GroupManager::is_tutor_of_group(api_get_user_id(), api_get_group_id())) {
$actionsLeft .= Display::url(Display::return_icon('new_event.png', get_lang('AgendaAdd'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . "calendar/agenda.php?" . api_get_cidreq() . "&action=add&type=" . $this->type);
$actionsLeft .= Display::url(Display::return_icon('import_calendar.png', get_lang('ICalFileImport'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . "calendar/agenda.php?" . api_get_cidreq() . "&action=importical&type=" . $this->type);
if ($this->type == 'course') {
if (!isset($_GET['action'])) {
$form = new FormValidator('form-search', 'post', '', '', array(), FormValidator::LAYOUT_INLINE);
$attributes = array('multiple' => false, 'id' => 'select_form_id_search');
$selectedValues = $this->parseAgendaFilter($filter);
$this->showToForm($form, $selectedValues, $attributes);
$form = $form->returnForm();
}
}
}
if (api_is_platform_admin() || api_is_teacher() || api_is_student_boss() || api_is_drh() || api_is_session_admin() || api_is_coach()) {
if ($this->type == 'personal') {
$form = null;
if (!isset($_GET['action'])) {
$form = new FormValidator('form-search', 'get', api_get_self() . '?type=personal&', '', array(), FormValidator::LAYOUT_INLINE);
$sessions = SessionManager::get_sessions_by_user(api_get_user_id());
$form->addHidden('type', 'personal');
$sessions = array_column($sessions, 'session_name', 'session_id');
$sessions = ['0' => get_lang('SelectAnOption')] + $sessions;
$form->addSelect('session_id', get_lang('Session'), $sessions, ['id' => 'session_id', 'onchange' => 'submit();']);
//$form->addButtonFilter(get_lang('Filter'));
//$renderer = $form->defaultRenderer();
//$renderer->setCustomElementTemplate('<div class="col-md-6">{element}</div>');
$form->addButtonReset(get_lang('Reset'));
$form = $form->returnForm();
}
}
}
$actionsRight = '';
if ($view == 'calendar') {
$actionsRight .= $form;
}
$toolbar = Display::toolbarAction('toolbar-agenda', array(0 => $actionsLeft, 1 => $actionsRight), 2, false);
return $toolbar;
}
示例15: auto_add_page_users
/**
* Function wizard individual assignment
* @author Juan Carlos Raña <herodoto@telefonica.net>
*/
public function auto_add_page_users($values)
{
$assignment_type = $values['assignment'];
$session_id = $this->session_id;
$groupId = api_get_group_id();
if ($groupId == 0) {
//extract course members
if (!empty($session_id)) {
$a_users_to_add = CourseManager::get_user_list_from_course_code(api_get_course_id(), $session_id);
} else {
$a_users_to_add = CourseManager::get_user_list_from_course_code(api_get_course_id(), 0);
}
} else {
//extract group members
$subscribed_users = GroupManager::get_subscribed_users($groupId);
$subscribed_tutors = GroupManager::get_subscribed_tutors($groupId);
$a_users_to_add_with_duplicates = array_merge($subscribed_users, $subscribed_tutors);
//remove duplicates
$a_users_to_add = $a_users_to_add_with_duplicates;
//array_walk($a_users_to_add, create_function('&$value,$key', '$value = json_encode($value);'));
$a_users_to_add = array_unique($a_users_to_add);
//array_walk($a_users_to_add, create_function('&$value,$key', '$value = json_decode($value, true);'));
}
$all_students_pages = array();
// Data about teacher
$userId = api_get_user_id();
$userinfo = api_get_user_info($userId);
$username = api_htmlentities(sprintf(get_lang('LoginX'), $userinfo['username'], ENT_QUOTES));
$name = $userinfo['complete_name'] . " - " . $username;
$photo = '<img src="' . $userinfo['avatar'] . '" alt="' . $name . '" width="40" height="50" align="top" title="' . $name . '" />';
// teacher assignment title
$title_orig = $values['title'];
// teacher assignment reflink
$link2teacher = $values['title'] = $title_orig . "_uass" . $userId;
// first: teacher name, photo, and assignment description (original content)
$content_orig_A = '<div align="center" style="background-color: #F5F8FB; border:solid; border-color: #E6E6E6">
<table border="0">
<tr><td style="font-size:24px">' . get_lang('AssignmentDesc') . '</td></tr>
<tr><td>' . $photo . '<br />' . Display::tag('span', api_get_person_name($userinfo['firstname'], $userinfo['lastname']), array('title' => $username)) . '</td></tr>
</table></div>';
$content_orig_B = '<br/><div align="center" style="font-size:24px">' . get_lang('AssignmentDescription') . ': ' . $title_orig . '</div><br/>' . $_POST['content'];
//Second: student list (names, photo and links to their works).
//Third: Create Students work pages.
foreach ($a_users_to_add as $o_user_to_add) {
if ($o_user_to_add['user_id'] != $userId) {
// except that puts the task
$assig_user_id = $o_user_to_add['user_id'];
// identifies each page as created by the student, not by teacher
$userPicture = UserManager::getUserPicture($assig_user_id);
$username = api_htmlentities(sprintf(get_lang('LoginX'), $o_user_to_add['username'], ENT_QUOTES));
$name = api_get_person_name($o_user_to_add['firstname'], $o_user_to_add['lastname']) . " . " . $username;
$photo = '<img src="' . $userPicture . '" alt="' . $name . '" width="40" height="50" align="bottom" title="' . $name . '" />';
$is_tutor_of_group = GroupManager::is_tutor_of_group($assig_user_id, $groupId);
//student is tutor
$is_tutor_and_member = GroupManager::is_tutor_of_group($assig_user_id, $groupId) && GroupManager::is_subscribed($assig_user_id, $groupId);
// student is tutor and member
if ($is_tutor_and_member) {
$status_in_group = get_lang('GroupTutorAndMember');
} else {
if ($is_tutor_of_group) {
$status_in_group = get_lang('GroupTutor');
} else {
$status_in_group = " ";
//get_lang('GroupStandardMember')
}
}
if ($assignment_type == 1) {
$values['title'] = $title_orig;
$values['content'] = '<div align="center" style="background-color: #F5F8FB; border:solid; border-color: #E6E6E6">
<table border="0">
<tr><td style="font-size:24px">' . get_lang('AssignmentWork') . '</td></tr>
<tr><td>' . $photo . '<br />' . $name . '</td></tr></table>
</div>[[' . $link2teacher . ' | ' . get_lang('AssignmentLinktoTeacherPage') . ']] ';
//If $content_orig_B is added here, the task written by the professor was copied to the page of each student. TODO: config options
// AssignmentLinktoTeacherPage
$all_students_pages[] = '<li>' . Display::tag('span', strtoupper($o_user_to_add['lastname']) . ', ' . $o_user_to_add['firstname'], array('title' => $username)) . ' [[' . $_POST['title'] . "_uass" . $assig_user_id . ' | ' . $photo . ']] ' . $status_in_group . '</li>';
//don't change this line without guaranteeing that users will be ordered by last names in the following format (surname, name)
$values['assignment'] = 2;
}
$this->assig_user_id = $assig_user_id;
self::save_new_wiki($values);
}
}
foreach ($a_users_to_add as $o_user_to_add) {
if ($o_user_to_add['user_id'] == $userId) {
$assig_user_id = $o_user_to_add['user_id'];
if ($assignment_type == 1) {
$values['title'] = $title_orig;
$values['comment'] = get_lang('AssignmentDesc');
sort($all_students_pages);
$values['content'] = $content_orig_A . $content_orig_B . '<br/>
<div align="center" style="font-size:18px; background-color: #F5F8FB; border:solid; border-color:#E6E6E6">
' . get_lang('AssignmentLinkstoStudentsPage') . '
</div><br/>
<div style="background-color: #F5F8FB; border:solid; border-color:#E6E6E6">
<ol>' . implode($all_students_pages) . '</ol>
//.........这里部分代码省略.........