本文整理汇总了PHP中GroupManager::is_user_in_group方法的典型用法代码示例。如果您正苦于以下问题:PHP GroupManager::is_user_in_group方法的具体用法?PHP GroupManager::is_user_in_group怎么用?PHP GroupManager::is_user_in_group使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GroupManager
的用法示例。
在下文中一共展示了GroupManager::is_user_in_group方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: api_get_item_property_info
Display::display_header($nameTools, 'Doc');
if (isset($msgError)) {
Display::display_error_message($msgError);
}
if (isset($info_message)) {
Display::display_confirmation_message($info_message);
if (isset($_POST['origin'])) {
$slide_id = $_POST['origin_opt'];
$call_from_tool = $_POST['origin'];
}
}
// Owner
$document_info = api_get_item_property_info(api_get_course_int_id(), 'document', $document_id);
$owner_id = $document_info['insert_user_id'];
$last_edit_date = $document_info['lastedit_date'];
if ($owner_id == api_get_user_id() || api_is_platform_admin() || $is_allowed_to_edit || GroupManager::is_user_in_group(api_get_user_id(), api_get_group_id())) {
$action = api_get_self() . '?id=' . $document_data['id'];
$form = new FormValidator('formEdit', 'post', $action, null, array('class' => 'form-horizontal'));
// Form title
$form->addElement('header', $nameTools);
$form->addElement('hidden', 'filename');
$form->addElement('hidden', 'extension');
$form->addElement('hidden', 'file_path');
$form->addElement('hidden', 'commentPath');
$form->addElement('hidden', 'showedit');
$form->addElement('hidden', 'origin');
$form->addElement('hidden', 'origin_opt');
$form->add_textfield('title', get_lang('Title'));
$defaults['title'] = $document_data['title'];
$form->addElement('hidden', 'formSent');
$defaults['formSent'] = 1;
示例2: switch
<?php
/* For licensing terms, see /license.txt */
/**
* Responses to AJAX calls for the document upload
*/
$action = $_REQUEST['a'];
switch ($action) {
case 'upload_file':
api_protect_course_script(true);
//User access same as upload.php
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
// This needs cleaning!
if (api_get_group_id()) {
if ($is_allowed_to_edit || GroupManager::is_user_in_group(api_get_user_id(), api_get_group_id())) {
// Only courseadmin or group members allowed
} else {
exit;
}
} elseif ($is_allowed_to_edit || is_my_shared_folder(api_get_user_id(), $_POST['curdirpath'], api_get_session_id())) {
} else {
// No course admin and no group member...
exit;
}
if (!empty($_FILES)) {
$file = $_FILES['file'];
$result = DocumentManager::upload_document($_FILES, $_POST['curdirpath'], $file['name'], null, 0, 'overwrite', false, false);
$json = array();
$json['name'] = Display::url(api_htmlentities($file['name']), api_htmlentities($result['url']), array('target' => '_blank'));
$json['type'] = api_htmlentities($file['type']);
$json['size'] = Text::format_file_size($file['size']);
示例3: array
// If the group id is set, we show them group documents
$group_properties = array();
$group_properties['directory'] = null;
// For sessions we should check the parameters of visibility
if (api_get_session_id() != 0) {
$group_member_with_upload_rights = $group_member_with_upload_rights && api_is_allowed_to_session_edit(false, true);
}
// Setting group variables.
if (!empty($groupId)) {
// Get group info
$group_properties = GroupManager::get_group_properties($groupId);
// Let's assume the user cannot upload files for the group
$group_member_with_upload_rights = false;
if ($group_properties['doc_state'] == 2) {
// 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)) {
// Only courseadmin or group members can upload
示例4: isset
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']);
if (is_array($forums_of_groups)) {
if ($current_group['forum_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
foreach ($forums_of_groups as $key => $value) {
if ($value['forum_group_public_private'] == 'public' || $value['forum_group_public_private'] == 'private' || !empty($user_is_tutor) || api_is_allowed_to_edit(false, true)) {
$actions_array[] = array('url' => api_get_path(WEB_CODE_PATH) . 'forum/viewforum.php?forum=' . $value['forum_id'] . '&' . api_get_cidreq() . '&origin=group', 'content' => Display::return_icon('forum.png', get_lang('Forum') . ': ' . $value['forum_title'], array(), 32));
}
}
}
}
if ($current_group['doc_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
// Link to the documents area of this group
$actions_array[] = array('url' => api_get_path(WEB_CODE_PATH) . 'document/document.php?' . api_get_cidreq(), 'content' => Display::return_icon('folder.png', get_lang('GroupDocument'), array(), 32));
示例5: handleAction
/**
* Kind of controller
* @param string $action
*/
public function handleAction($action)
{
$page = $this->page;
switch ($action) {
case 'export_to_pdf':
if (isset($_GET['wiki_id'])) {
self::export_to_pdf($_GET['wiki_id'], api_get_course_id());
exit;
}
break;
case 'export2doc':
if (isset($_GET['wiki_id'])) {
$export2doc = self::export2doc($_GET['wiki_id']);
if ($export2doc) {
self::setMessage(Display::display_confirmation_message(get_lang('ThePageHasBeenExportedToDocArea'), false, true));
}
}
break;
case 'restorepage':
self::restorePage();
break;
case 'more':
self::getStatsTable();
break;
case 'statistics':
self::getStats();
break;
case 'mactiveusers':
self::getActiveUsers($action);
break;
case 'usercontrib':
self::getUserContributions($_GET['user_id'], $action);
break;
case 'mostchanged':
$this->getMostChangedPages($action);
break;
case 'mvisited':
self::getMostVisited();
break;
case 'wanted':
$this->getWantedPages();
break;
case 'orphaned':
self::getOrphaned();
break;
case 'mostlinked':
self::getMostLinked();
break;
case 'delete':
self::deletePageWarning($page);
break;
case 'deletewiki':
$title = '<div class="actions">' . get_lang('DeleteWiki') . '</div>';
if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
$message = get_lang('ConfirmDeleteWiki');
$message .= '<p>
<a href="index.php?' . api_get_cidreq() . '">' . get_lang('No') . '</a>
|
<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=deletewiki&delete=yes">' . get_lang('Yes') . '</a>
</p>';
if (!isset($_GET['delete'])) {
self::setMessage($title . Display::display_warning_message($message, false, true));
}
} else {
self::setMessage(Display::display_normal_message(get_lang("OnlyAdminDeleteWiki"), false, true));
}
if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
if (isset($_GET['delete']) && $_GET['delete'] == 'yes') {
$return_message = self::delete_wiki();
self::setMessage(Display::display_confirmation_message($return_message, false, true));
$this->redirectHome();
}
}
break;
case 'searchpages':
self::getSearchPages($action);
break;
case 'links':
self::getLinks($page);
break;
case 'addnew':
if (api_get_session_id() != 0 && api_is_allowed_to_session_edit(false, true) == false) {
api_not_allowed();
}
echo '<div class="actions">' . get_lang('AddNew') . '</div>';
echo '<br/>';
//first, check if page index was created. chektitle=false
if (self::checktitle('index')) {
if (api_is_allowed_to_edit(false, true) || api_is_platform_admin() || GroupManager::is_user_in_group(api_get_user_id(), api_get_group_id())) {
self::setMessage(Display::display_normal_message(get_lang('GoAndEditMainPage'), false, true));
} else {
self::setMessage(Display::display_normal_message(get_lang('WikiStandBy'), false, true));
}
} elseif (self::check_addnewpagelock() == 0 && (api_is_allowed_to_edit(false, true) == false || api_is_platform_admin() == false)) {
self::setMessage(Display::display_error_message(get_lang('AddPagesLocked'), false, true));
} else {
//.........这里部分代码省略.........
示例6: get_lang
$tool_name = get_lang('ToolWiki');
/* ACCESS */
api_protect_course_script();
api_block_anonymous_users();
api_protect_course_group(GroupManager::GROUP_TOOL_WIKI);
/* TRACKING */
Event::event_access_tool(TOOL_WIKI);
if ($groupId) {
$group_properties = GroupManager::get_group_properties($groupId);
$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') . ' ' . Security::remove_XSS($group_properties['name']));
//ensure this tool in groups whe it's private or deactivated
if ($group_properties['wiki_state'] == 0) {
api_not_allowed();
} elseif ($group_properties['wiki_state'] == 2) {
if (!api_is_allowed_to_edit(false, true) and !GroupManager::is_user_in_group(api_get_user_id(), api_get_group_id())) {
api_not_allowed();
}
}
}
$is_allowed_to_edit = api_is_allowed_to_edit(false, true);
// The page we are dealing with
$page = isset($_GET['title']) ? $_GET['title'] : 'index';
$action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : 'showpage';
$view = isset($_GET['view']) ? Security::remove_XSS($_GET['view']) : null;
$wiki->page = $page;
$wiki->action = $action;
// Setting wiki data
if (!empty($view)) {
$wiki->setWikiData($view);
}
示例7: api_get_path
}
}
$style = '<style>';
$style .= '@import "' . api_get_path(WEB_CSS_PATH) . 'base.css";';
$style .= '@import "' . api_get_path(WEB_CSS_PATH) . 'themes/' . api_get_visual_theme() . '/default.css";';
$style .= '</style>';
?>
<!doctype html>
<?php
echo api_get_jquery_js();
echo $style;
?>
<body>
<?php
echo '<h2>' . get_lang('GroupSingle') . ': ' . $group_properties['name'] . '</h2>';
if ($group_properties['doc_state'] == 2 && ($is_allowed_to_edit || GroupManager::is_user_in_group($_user['user_id'], $_SESSION['_gid'])) || $group_properties['doc_state'] == 1) {
if (!empty($png_svg_files)) {
echo '<h3>' . get_lang('SelectSVGEditImage') . '</h3>';
echo '<ul>';
foreach ($png_svg_files as $filename) {
$image = $group_disk_path . $filename;
if (strpos($filename, "svg")) {
$new_sizes['width'] = 60;
$new_sizes['height'] = 60;
} else {
$new_sizes = api_resize_image($image, 60, 60);
}
echo '<li style="display:inline; padding:8px;">';
echo '<a href = "' . $group_web_path . $filename . '" alt="' . $filename . '" title="' . $filename . '">';
echo '<img src = "' . $group_web_path . $filename . '" width = "' . $new_sizes['width'] . '" height="' . $new_sizes['height'] . '" border="0"></a></li>';
}
示例8: array
if ($groupId) {
$group_properties = GroupManager::get_group_properties($groupId);
$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').' '.Security::remove_XSS($group_properties['name'])
);
//ensure this tool in groups whe it's private or deactivated
if ($group_properties['wiki_state'] == 0) {
api_not_allowed();
} elseif ($group_properties['wiki_state']==2) {
if (!api_is_allowed_to_edit(false,true) and
!GroupManager :: is_user_in_group(api_get_user_id(), api_get_group_id())
) {
api_not_allowed();
}
}
}
$is_allowed_to_edit = api_is_allowed_to_edit(false, true);
// The page we are dealing with
$page = isset($_GET['title']) ? $_GET['title']: 'index';
$action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : 'showpage';
$view = isset($_GET['view']) ? Security::remove_XSS($_GET['view']) : null;
$wiki->page = $page;
$wiki->action = $action;
示例9: display_wiki_entry
/**
* This function displays a wiki entry
* @author Patrick Cool <patrick.cool@ugent.be>, Ghent University
* @author Juan Carlos Raña Trabado
* @return html code
**/
function display_wiki_entry($newtitle)
{
global $charset, $tbl_wiki, $tbl_wiki_conf, $groupfilter, $condition_session, $page;
$course_id = api_get_course_int_id();
if ($newtitle) {
$pageMIX = $newtitle;
//display the page after it is created
} else {
$pageMIX = $page;
//display current page
}
$_clean['group_id'] = (int) $_SESSION['_gid'];
$session_id = api_get_session_id();
if ($_GET['view']) {
$_clean['view'] = (int) Database::escape_string($_GET['view']);
$filter = ' AND w.id="' . $_clean['view'] . '"';
}
//first, check page visibility in the first page version
$sql = 'SELECT * FROM ' . $tbl_wiki . ' WHERE c_id = ' . $course_id . ' AND reflink="' . Database::escape_string($pageMIX) . '" AND ' . $groupfilter . $condition_session . ' ORDER BY id ASC';
$result = Database::query($sql);
$row = Database::fetch_array($result);
$KeyVisibility = $row['visibility'];
// second, show the last version
$sql = 'SELECT * FROM ' . $tbl_wiki . ' w , ' . $tbl_wiki_conf . ' wc
WHERE wc.c_id = ' . $course_id . ' AND
w.c_id = ' . $course_id . ' AND
wc.page_id = w.page_id AND
w.reflink = "' . Database::escape_string($pageMIX) . '" AND
w.session_id = ' . $session_id . ' AND
w.' . $groupfilter . ' ' . $filter . '
ORDER BY id DESC';
$result = Database::query($sql);
$row = Database::fetch_array($result);
// we do not need a while loop since we are always displaying the last version
//update visits
if ($row['id']) {
$sql = 'UPDATE ' . $tbl_wiki . ' SET hits=(hits+1) WHERE c_id = ' . $course_id . ' AND id=' . $row['id'] . '';
Database::query($sql);
}
// if both are empty and we are displaying the index page then we display the default text.
if ($row['content'] == '' and $row['title'] == '' and $page == 'index') {
if (api_is_allowed_to_edit(false, true) || api_is_platform_admin() || GroupManager::is_user_in_group(api_get_user_id(), $_SESSION['_gid'])) {
//Table structure for better export to pdf
$default_table_for_content_Start = '<table align="center" border="0"><tr><td align="center">';
$default_table_for_content_End = '</td></tr></table>';
$content = $default_table_for_content_Start . sprintf(get_lang('DefaultContent'), api_get_path(WEB_IMG_PATH)) . $default_table_for_content_End;
$title = get_lang('DefaultTitle');
} else {
return Display::display_normal_message(get_lang('WikiStandBy'));
}
} else {
$content = Security::remove_XSS($row['content'], COURSEMANAGERLOWSECURITY);
$title = $row['title'];
}
//assignment mode: identify page type
if ($row['assignment'] == 1) {
$icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL);
} elseif ($row['assignment'] == 2) {
$icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
}
//task mode
if (!empty($row['task'])) {
$icon_task = Display::return_icon('wiki_task.png', get_lang('StandardTask'), '', ICON_SIZE_SMALL);
}
//Show page. Show page to all users if isn't hide page. Mode assignments: if student is the author, can view
if ($KeyVisibility == "1" || api_is_allowed_to_edit(false, true) || api_is_platform_admin() || $row['assignment'] == 2 && $KeyVisibility == "0" && api_get_user_id() == $row['user_id']) {
echo '<div id="wikititle">';
// page action: protecting (locking) the page
if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
if (check_protect_page() == 1) {
$protect_page = Display::return_icon('lock.png', get_lang('PageLockedExtra'), '', ICON_SIZE_SMALL);
$lock_unlock_protect = 'unlock';
} else {
$protect_page = Display::return_icon('unlock.png', get_lang('PageUnlockedExtra'), '', ICON_SIZE_SMALL);
$lock_unlock_protect = 'lock';
}
}
if ($row['id']) {
echo '<span style="float:right;">';
echo '<a href="index.php?action=showpage&actionpage=' . $lock_unlock_protect . '&title=' . api_htmlentities(urlencode($page)) . '">' . $protect_page . '</a>';
echo '</span>';
}
//page action: visibility
if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
if (check_visibility_page() == 1) {
// TODO: FIX This hides the icon eye closed to users of work they can see yours
//if(($row['assignment']==2 && $KeyVisibility=="0" && (api_get_user_id()==$row['user_id']))==false)
//{
//
// }
$visibility_page = Display::return_icon('visible.png', get_lang('ShowPageExtra'), '', ICON_SIZE_SMALL);
$lock_unlock_visibility = 'invisible';
} else {
$visibility_page = Display::return_icon('invisible.png', get_lang('HidePageExtra'), '', ICON_SIZE_SMALL);
//.........这里部分代码省略.........
示例10: api_get_path
* @since 31/December/2008
*/
require_once api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php';
// Disabling access for anonymous users.
api_block_anonymous_users();
$permissions_for_new_directories = api_get_permissions_for_new_directories();
$permissions_for_new_files = api_get_permissions_for_new_files();
$userId = api_get_user_id();
$sessionId = api_get_session_id();
if (!empty($_course['path'])) {
require_once api_get_path(LIBRARY_PATH) . 'document.lib.php';
require_once api_get_path(LIBRARY_PATH) . 'groupmanager.lib.php';
// Get the Chamilo session properties. Before ajaximagemanager!!!
$groupId = api_get_group_id();
$group_properties = GroupManager::get_group_properties($groupId);
$is_user_in_group = GroupManager::is_user_in_group($userId, $groupId);
}
$sessionName = null;
if (!empty($sessionId)) {
$sessionName = api_get_session_name($sessionId);
}
$my_path = UserManager::get_user_picture_path_by_id($userId, 'system');
$user_folder = $my_path['dir'] . 'my_files/';
// Sanity checks for Chamilo.
// Creation of a user owned folder if it does not exist.
if (!file_exists($user_folder)) {
// A recursive call of mkdir function.
@mkdir($user_folder, $permissions_for_new_directories, true);
}
// Creation of repository used by platform administrators if it does not exist.
if (api_is_platform_admin()) {
示例11: get_lang
$title = get_lang('DefaultTitle');
$page_id = 0;
} else {
$content = api_html_entity_decode($row['content']);
$title = api_html_entity_decode($row['title']);
$page_id = $row['page_id'];
}
//Only teachers and platform admin can edit the index page. Only teachers and platform admin can edit an assignment teacher. And users in groups
if (($row['reflink'] == 'index' || $row['reflink'] == '' || $row['assignment'] == 1) && (!api_is_allowed_to_edit(false, true) && $_GET['group_id'] == 0)) {
Display::display_error_message(get_lang('OnlyEditPagesCourseManager'));
} else {
$PassEdit = false;
//check if is a wiki group
if ($_clean['group_id'] != 0) {
//Only teacher, platform admin and group members can edit a wiki group
if (api_is_allowed_to_edit(false, true) || api_is_platform_admin() || GroupManager::is_user_in_group($_user['user_id'], $_GET['group_id'])) {
$PassEdit = true;
} else {
Display::display_normal_message(get_lang('OnlyEditPagesGroupMembers'));
}
} else {
$PassEdit = true;
}
// check if is a assignment
if ($row['assignment'] == 1) {
Display::display_normal_message(get_lang('EditAssignmentWarning'));
$icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL);
} elseif ($row['assignment'] == 2) {
$icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWorkExtra'), '', ICON_SIZE_SMALL);
if ((api_get_user_id() == $row['user_id']) == false) {
if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {