当前位置: 首页>>代码示例>>PHP>>正文


PHP GroupManager::get_group_properties方法代码示例

本文整理汇总了PHP中GroupManager::get_group_properties方法的典型用法代码示例。如果您正苦于以下问题:PHP GroupManager::get_group_properties方法的具体用法?PHP GroupManager::get_group_properties怎么用?PHP GroupManager::get_group_properties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GroupManager的用法示例。


在下文中一共展示了GroupManager::get_group_properties方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: api_protect_course_script

/**
 *	This script displays an area where teachers can edit the group properties and member list.
 *	Groups are also often called "teams" in the Dokeos code.
 *
 *	@author various contributors
 *	@author Roan Embrechts (VUB), partial code cleanup, initial virtual course support
 *	@package chamilo.group
 *	@todo course admin functionality to create groups based on who is in which course (or class).
 */
//require_once '../inc/global.inc.php';
$this_section = SECTION_COURSES;
$current_course_tool = TOOL_GROUP;
// Notice for unauthorized people.
api_protect_course_script(true);
$group_id = api_get_group_id();
$current_group = GroupManager::get_group_properties($group_id);
$nameTools = get_lang('EditGroup');
$interbreadcrumb[] = array('url' => 'group.php', 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => 'group_space.php?' . api_get_cidReq(), 'name' => $current_group['name']);
$is_group_member = GroupManager::is_tutor_of_group(api_get_user_id(), $group_id);
if (!api_is_allowed_to_edit(false, true) && !$is_group_member) {
    api_not_allowed(true);
}
/**
 *  List all users registered to the course
 */
function search_members_keyword($firstname, $lastname, $username, $official_code, $keyword)
{
    if (api_strripos($firstname, $keyword) !== false || api_strripos($lastname, $keyword) !== false || api_strripos($username, $keyword) !== false || api_strripos($official_code, $keyword) !== false) {
        return true;
    } else {
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:member_settings.php

示例2: api_get_course_id

}
if ($dir[strlen($dir) - 1] != '/') {
    $dir .= '/';
}
if ($is_certificate_mode) {
    $document_id = DocumentManager::get_document_id(api_get_course_info(), '/certificates');
    $document_data = DocumentManager::get_document_data_by_id($document_id, api_get_course_id(), true);
    $folder_id = $document_data['id'];
    $dir = '/certificates/';
}
// Configuration for the FCKEDITOR
$doc_tree = explode('/', $dir);
$count_dir = count($doc_tree) - 2;
// "2" because at the begin and end there are 2 "/"
if (api_is_in_group()) {
    $group_properties = GroupManager::get_group_properties($groupId);
    // Level correction for group documents.
    if (!empty($group_properties['directory'])) {
        $count_dir = $count_dir > 0 ? $count_dir - 1 : 0;
    }
}
$relative_url = '';
for ($i = 0; $i < $count_dir; $i++) {
    $relative_url .= '../';
}
// We do this in order to avoid the condition in html_editor.php ==> if ($this -> fck_editor->Config['CreateDocumentWebDir']=='' || $this -> fck_editor->Config['CreateDocumentDir']== '')
if ($relative_url == '') {
    $relative_url = '/';
}
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$html_editor_config = array('ToolbarSet' => $is_allowed_to_edit ? 'Documents' : 'DocumentsStudent', 'Width' => '100%', 'Height' => '500', 'FullPage' => true, 'InDocument' => true, 'CreateDocumentDir' => $relative_url, 'CreateDocumentWebDir' => empty($group_properties['directory']) ? api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document/' : api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document' . $group_properties['directory'] . '/', 'BaseHref' => api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document' . $dir);
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:create_document.php

示例3: exportCategoriesAndGroupsToArray

 /**
  * Export all categories/group from a course to an array.
  * This function works only in a context of a course.
  * @return array
  */
 public static function exportCategoriesAndGroupsToArray()
 {
     $data = array();
     $data[] = array('category', 'group', 'description', 'announcements_state', 'calendar_state', 'chat_state', 'doc_state', 'forum_state', 'work_state', 'wiki_state', 'max_student', 'self_reg_allowed', 'self_unreg_allowed', 'groups_per_user');
     $categories = GroupManager::get_categories();
     foreach ($categories as $categoryInfo) {
         $data[] = array($categoryInfo['title'], null, $categoryInfo['description'], $categoryInfo['announcements_state'], $categoryInfo['calendar_state'], $categoryInfo['chat_state'], $categoryInfo['doc_state'], $categoryInfo['forum_state'], $categoryInfo['work_state'], $categoryInfo['wiki_state'], $categoryInfo['max_student'], $categoryInfo['self_reg_allowed'], $categoryInfo['self_unreg_allowed'], $categoryInfo['groups_per_user']);
     }
     $groups = GroupManager::get_group_list();
     foreach ($groups as $groupInfo) {
         $categoryTitle = null;
         $categoryInfo = GroupManager::get_category($groupInfo['category_id']);
         $groupSettings = GroupManager::get_group_properties($groupInfo['id']);
         if (!empty($categoryInfo)) {
             $categoryTitle = $categoryInfo['title'];
         }
         $data[] = array($categoryTitle, $groupSettings['name'], $groupSettings['description'], $groupSettings['announcements_state'], $groupSettings['calendar_state'], $groupSettings['chat_state'], $groupSettings['doc_state'], $groupSettings['forum_state'], $groupSettings['work_state'], $groupSettings['wiki_state'], $groupSettings['maximum_number_of_students'], $groupSettings['self_registration_allowed'], $groupSettings['self_unregistration_allowed']);
     }
     return $data;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:25,代码来源:groupmanager.lib.php

示例4: api_get_course_id

}
if ($dir[strlen($dir) - 1] != '/') {
    $dir .= '/';
}
if ($is_certificate_mode) {
    $document_id = DocumentManager::get_document_id(api_get_course_info(), '/certificates');
    $document_data = DocumentManager::get_document_data_by_id($document_id, api_get_course_id(), true);
    $folder_id = $document_data['id'];
    $dir = '/certificates/';
}
// Configuration for the FCKEDITOR
$doc_tree = explode('/', $dir);
$count_dir = count($doc_tree) - 2;
// "2" because at the begin and end there are 2 "/"
if (api_is_in_group()) {
    $group_properties = GroupManager::get_group_properties(api_get_group_id());
    // Level correction for group documents.
    if (!empty($group_properties['directory'])) {
        $count_dir = $count_dir > 0 ? $count_dir - 1 : 0;
    }
}
$relative_url = '';
for ($i = 0; $i < $count_dir; $i++) {
    $relative_url .= '../';
}
/* We do this in order to avoid the condition in html_editor.php ==> if
   ($this -> fck_editor->Config['CreateDocumentWebDir']=='' || $this -> fck_editor->Config['CreateDocumentDir']== '')*
*/
if ($relative_url == '') {
    $relative_url = '/';
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:create_document.php

示例5: exportCategoriesAndGroupsToArray

 /**
  * Export all categories/group from a course to an array.
  * This function works only in a context of a course.
  * @param int $groupId
  * @param bool $loadUsers
  * @return array
  */
 public static function exportCategoriesAndGroupsToArray($groupId = null, $loadUsers = false)
 {
     $data = array();
     $data[] = array('category', 'group', 'description', 'announcements_state', 'calendar_state', 'chat_state', 'doc_state', 'forum_state', 'work_state', 'wiki_state', 'max_student', 'self_reg_allowed', 'self_unreg_allowed', 'groups_per_user');
     $count = 1;
     if ($loadUsers) {
         $data[0][] = 'students';
         $data[0][] = 'tutors';
     }
     if ($loadUsers == false) {
         $categories = GroupManager::get_categories();
         foreach ($categories as $categoryInfo) {
             $data[$count] = array($categoryInfo['title'], null, $categoryInfo['description'], $categoryInfo['announcements_state'], $categoryInfo['calendar_state'], $categoryInfo['chat_state'], $categoryInfo['doc_state'], $categoryInfo['forum_state'], $categoryInfo['work_state'], $categoryInfo['wiki_state'], $categoryInfo['max_student'], $categoryInfo['self_reg_allowed'], $categoryInfo['self_unreg_allowed'], $categoryInfo['groups_per_user']);
             $count++;
         }
     }
     $groups = GroupManager::get_group_list();
     foreach ($groups as $groupInfo) {
         $categoryTitle = null;
         $categoryInfo = GroupManager::get_category($groupInfo['category_id']);
         $groupSettings = GroupManager::get_group_properties($groupInfo['id']);
         if (!empty($categoryInfo)) {
             $categoryTitle = $categoryInfo['title'];
         }
         $users = GroupManager::getStudents($groupInfo['id']);
         $userList = array();
         foreach ($users as $user) {
             $user = api_get_user_info($user['user_id']);
             $userList[] = $user['username'];
         }
         $tutors = GroupManager::getTutors($groupInfo['id']);
         $tutorList = array();
         foreach ($tutors as $user) {
             $user = api_get_user_info($user['user_id']);
             $tutorList[] = $user['username'];
         }
         $userListToString = null;
         if (!empty($userList)) {
             $userListToString = implode(',', $userList);
         }
         $tutorListToString = null;
         if (!empty($tutorList)) {
             $tutorListToString = implode(',', $tutorList);
         }
         $data[$count] = array($categoryTitle, $groupSettings['name'], $groupSettings['description'], $groupSettings['announcements_state'], $groupSettings['calendar_state'], $groupSettings['chat_state'], $groupSettings['doc_state'], $groupSettings['forum_state'], $groupSettings['work_state'], $groupSettings['wiki_state'], $groupSettings['maximum_number_of_students'], $groupSettings['self_registration_allowed'], $groupSettings['self_unregistration_allowed'], null);
         if ($loadUsers) {
             $data[$count][] = $userListToString;
             $data[$count][] = $tutorListToString;
         }
         if (!empty($groupId)) {
             if ($groupId == $groupInfo['id']) {
                 break;
             }
         }
         $count++;
     }
     return $data;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:65,代码来源:groupmanager.lib.php

示例6: api_get_path

}
if ($dir[strlen($dir) - 1] != '/') {
    $dir .= '/';
}
$filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir;
if (!is_dir($filepath)) {
    $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
    $dir = '/';
}
//groups //TODO: clean
if (isset($_SESSION['_gid']) && $_SESSION['_gid'] != 0) {
    $req_gid = '&amp;gidReq=' . $_SESSION['_gid'];
    $interbreadcrumb[] = array("url" => "../group/group_space.php?gidReq=" . $_SESSION['_gid'], "name" => get_lang('GroupSpace'));
    $noPHP_SELF = true;
    $to_group_id = $_SESSION['_gid'];
    $group = GroupManager::get_group_properties($to_group_id);
    $path = explode('/', $dir);
    if ('/' . $path[1] != $group['directory']) {
        api_not_allowed(true);
    }
}
$interbreadcrumb[] = array("url" => "./document.php?curdirpath=" . urlencode($dir) . $req_gid, "name" => get_lang('Documents'));
if (!$is_allowed_in_course) {
    api_not_allowed(true);
}
if (!($is_allowed_to_edit || GroupManager::groupMemberWithUploadRights() || is_my_shared_folder($_user['user_id'], Security::remove_XSS($dir), api_get_session_id()))) {
    api_not_allowed(true);
}
/*	Header */
Event::event_access_tool(TOOL_DOCUMENT);
$display_dir = $dir;
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:create_paint.php

示例7: api_get_system_encoding

<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo api_get_system_encoding();
?>
" />
<?php 
echo '<title>' . get_lang('Chat') . ' - ' . $mycourseid . ' - ' . api_get_setting('siteName') . '</title>';
// If it is a group chat then the breadcrumbs.
if ($_SESSION['_gid'] or $_GET['group_id']) {
    if (isset($_SESSION['_gid'])) {
        $_clean['group_id'] = (int) $_SESSION['_gid'];
    }
    if (isset($_GET['group_id'])) {
        $_clean['group_id'] = (int) Database::escape_string($_GET['group_id']);
    }
    $group_properties = GroupManager::get_group_properties($_clean['group_id']);
    $interbreadcrumb[] = array('url' => '../group/group.php', 'name' => get_lang('Groups'));
    $interbreadcrumb[] = array('url' => '../group/group_space.php?gidReq=' . api_get_group_id(), 'name' => get_lang('GroupSpace') . ' ' . $group_properties['name']);
    $noPHP_SELF = true;
    $shortBanner = false;
    $add_group_to_title = ' (' . $group_properties['name'] . ')';
    $groupfilter = 'group_id="' . $_clean['group_id'] . '"';
    // Ensure this tool in groups whe it's private or deactivated
    /*if ($group_properties['chat_state'] == 0) {
    		echo api_not_allowed();
    	} elseif ($group_properties['chat_state'] == 2) {
     		if (!api_is_allowed_to_edit(false,true) and !GroupManager :: is_user_in_group($_user['user_id'], $_SESSION['_gid'])) {
    			echo api_not_allowed();
    		}
    	}*/
} else {
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:chat.php

示例8: get_forum_information

// Note: This has to be validated that it is an existing thread.
$current_forum = get_forum_information($_GET['forum']);
// Note: This has to be validated that it is an existing forum.
$current_forum_category = get_forumcategory_information($current_forum['forum_category']);
$current_post = get_post_information($_GET['post']);
api_block_course_item_locked_by_gradebook($_GET['thread'], LINK_FORUM_THREAD);
/* Header and Breadcrumbs */
if (isset($_SESSION['gradebook'])) {
    $gradebook = $_SESSION['gradebook'];
}
if (!empty($gradebook) && $gradebook == 'view') {
    $interbreadcrumb[] = array('url' => '../gradebook/' . $_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook'));
}
if ($origin == 'group') {
    $_clean['toolgroup'] = (int) $_SESSION['toolgroup'];
    $group_properties = GroupManager::get_group_properties($_clean['toolgroup']);
    $interbreadcrumb[] = array('url' => '../group/group.php', 'name' => get_lang('Groups'));
    $interbreadcrumb[] = array('url' => '../group/group_space.php?gidReq=' . $_SESSION['toolgroup'], 'name' => get_lang('GroupSpace') . ' ' . $group_properties['name']);
    $interbreadcrumb[] = array('url' => 'viewforum.php?origin=' . $origin . '&amp;gidReq=' . $_SESSION['toolgroup'] . '&amp;forum=' . Security::remove_XSS($_GET['forum']), 'name' => prepare4display($current_forum['forum_title']));
    $interbreadcrumb[] = array('url' => 'javascript: void (0);', 'name' => get_lang('EditPost'));
} else {
    $interbreadcrumb[] = array('url' => 'index.php?gradebook=' . $gradebook, 'name' => $nameTools);
    $interbreadcrumb[] = array('url' => 'viewforumcategory.php?forumcategory=' . $current_forum_category['cat_id'], 'name' => prepare4display($current_forum_category['cat_title']));
    $interbreadcrumb[] = array('url' => 'viewforum.php?origin=' . $origin . '&amp;forum=' . Security::remove_XSS($_GET['forum']), 'name' => prepare4display($current_forum['forum_title']));
    $interbreadcrumb[] = array('url' => 'viewthread.php?gradebook=' . $gradebook . '&amp;origin=' . $origin . '&amp;forum=' . Security::remove_XSS($_GET['forum']) . '&amp;thread=' . Security::remove_XSS($_GET['thread']), 'name' => prepare4display($current_thread['thread_title']));
    $interbreadcrumb[] = array('url' => 'javascript: void (0);', 'name' => get_lang('EditPost'));
}
/* Resource Linker */
if (isset($_POST['add_resources']) and $_POST['add_resources'] == get_lang('Resources')) {
    $_SESSION['formelements'] = $_POST;
    $_SESSION['origin'] = $_SERVER['REQUEST_URI'];
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:editpost.php

示例9: api_not_allowed

}
// 4. anonymous posts are not allowed and the user is not logged in
if (!$_user['user_id'] and $current_forum['allow_anonymous'] != 1) {
    api_not_allowed();
}
// 5. Check user access
if ($current_forum['forum_of_group'] != 0) {
    $show_forum = GroupManager::user_has_access(api_get_user_id(), $current_forum['forum_of_group'], GroupManager::GROUP_TOOL_FORUM);
    if (!$show_forum) {
        api_not_allowed();
    }
}
$session_toolgroup = 0;
if ($origin == 'group') {
    $session_toolgroup = intval($_SESSION['toolgroup']);
    $group_properties = GroupManager::get_group_properties($session_toolgroup);
    $interbreadcrumb[] = array('url' => '../group/group.php', 'name' => get_lang('Groups'));
    $interbreadcrumb[] = array('url' => '../group/group_space.php?gidReq=' . $session_toolgroup, 'name' => get_lang('GroupSpace') . ' ' . $group_properties['name']);
    $interbreadcrumb[] = array('url' => 'viewforum.php?origin=' . $origin . '&amp;gidReq=' . $session_toolgroup . '&amp;forum=' . Security::remove_XSS($_GET['forum']), 'name' => $current_forum['forum_title']);
    $interbreadcrumb[] = array('url' => 'newthread.php?origin=' . $origin . '&amp;forum=' . Security::remove_XSS($_GET['forum']), 'name' => get_lang('NewTopic'));
} else {
    $interbreadcrumb[] = array('url' => 'index.php?gradebook=' . $gradebook, 'name' => $nameTools);
    $interbreadcrumb[] = array('url' => 'viewforumcategory.php?forumcategory=' . $current_forum_category['cat_id'], 'name' => $current_forum_category['cat_title']);
    $interbreadcrumb[] = array('url' => 'viewforum.php?origin=' . $origin . '&amp;forum=' . Security::remove_XSS($_GET['forum']), 'name' => $current_forum['forum_title']);
    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewTopic'));
}
/* Resource Linker */
if (isset($_POST['add_resources']) and $_POST['add_resources'] == get_lang('Resources')) {
    $_SESSION['formelements'] = $_POST;
    $_SESSION['origin'] = $_SERVER['REQUEST_URI'];
    $_SESSION['breadcrumbs'] = $interbreadcrumb;
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:newthread.php

示例10: api_get_group_id

$group_id = api_get_group_id();
$session_id = api_get_session_id();
$session_condition = api_get_session_condition($session_id);
$group_condition = " AND to_group_id = '{$group_id}'";
$extra_condition = '';
if (!empty($group_id)) {
    $extra_condition = $group_condition;
} else {
    $extra_condition = $session_condition;
}
$extra_condition .= " AND c_id = {$course_id}";
// get chat path
$chat_path = '';
$document_path = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document';
if (!empty($group_id)) {
    $group_info = GroupManager::get_group_properties($group_id);
    $chat_path = $document_path . $group_info['directory'] . '/chat_files/';
} else {
    $chat_path = $document_path . '/chat_files/';
}
// get chat file
$basename_chat = '';
if (!empty($group_id)) {
    $basename_chat = 'messages-' . $date_now . '_gid-' . $group_id;
} elseif (!empty($session_id)) {
    $basename_chat = 'messages-' . $date_now . '_sid-' . $session_id;
} else {
    $basename_chat = 'messages-' . $date_now;
}
$chat_size_old = isset($_POST['chat_size_old']) ? intval($_POST['chat_size_old']) : null;
$file = $chat_path . $basename_chat . '.log.html';
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:31,代码来源:chat_hidden.php

示例11: saveMessage

/**
 * @param string $message
 * @param array $_course
 * @param int $group_id
 * @param int $session_id
 * @param bool $preview
 */
function saveMessage($message, $userId, $_course, $session_id, $group_id, $preview = true)
{
    $userInfo = api_get_user_info($userId);
    $fullName = $userInfo['complete_name'];
    $isMaster = (bool) api_is_course_admin();
    $document_path = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document';
    if (!empty($group_id)) {
        $group_info = GroupManager::get_group_properties($group_id);
        $basepath_chat = $group_info['directory'] . '/chat_files';
    } else {
        $basepath_chat = '/chat_files';
    }
    $chat_path = $document_path . $basepath_chat . '/';
    if (!is_dir($chat_path)) {
        if (is_file($chat_path)) {
            @unlink($chat_path);
        }
    }
    $date_now = date('Y-m-d');
    $message = trim($message);
    $timeNow = date('d/m/y H:i:s');
    if (!empty($group_id)) {
        $basename_chat = 'messages-' . $date_now . '_gid-' . $group_id;
    } elseif (!empty($session_id)) {
        $basename_chat = 'messages-' . $date_now . '_sid-' . $session_id;
    } else {
        $basename_chat = 'messages-' . $date_now;
    }
    if (!api_is_anonymous()) {
        if (!empty($message)) {
            Emojione\Emojione::$imagePathPNG = api_get_path(WEB_LIBRARY_PATH) . 'javascript/emojione/png/';
            Emojione\Emojione::$ascii = true;
            // Parsing emojis
            $message = Emojione\Emojione::toImage($message);
            // Parsing text to understand markdown (code highlight)
            $message = MarkdownExtra::defaultTransform($message);
            // Security XSS
            $message = Security::remove_XSS($message);
            if ($preview == true) {
                return $message;
            }
            if (!file_exists($chat_path . $basename_chat . '.log.html')) {
                $doc_id = add_document($_course, $basepath_chat . '/' . $basename_chat . '.log.html', 'file', 0, $basename_chat . '.log.html');
                api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $userId, $group_id, null, null, null, $session_id);
                api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', $userId, $group_id, null, null, null, $session_id);
                item_property_update_on_folder($_course, $basepath_chat, $userId);
            } else {
                $doc_id = DocumentManager::get_document_id($_course, $basepath_chat . '/' . $basename_chat . '.log.html');
            }
            $fp = fopen($chat_path . $basename_chat . '.log.html', 'a');
            $userPhoto = Usermanager::getUserPicture($userId, USER_IMAGE_SIZE_MEDIUM);
            $filePhoto = '<img class="chat-image" src="' . $userPhoto . '"/>';
            if ($isMaster) {
                fputs($fp, '<div class="message-teacher"><div class="content-message"><div class="chat-message-block-name">' . $fullName . '</div><div class="chat-message-block-content">' . $message . '</div><div class="message-date">' . $timeNow . '</div></div><div class="icon-message"></div>' . $filePhoto . '</div>' . "\n");
            } else {
                fputs($fp, '<div class="message-student">' . $filePhoto . '<div class="icon-message"></div><div class="content-message"><div class="chat-message-block-name">' . $fullName . '</div><div class="chat-message-block-content">' . $message . '</div><div class="message-date">' . $timeNow . '</div></div></div>' . "\n");
            }
            fclose($fp);
            $chat_size = filesize($chat_path . $basename_chat . '.log.html');
            update_existing_document($_course, $doc_id, $chat_size);
            item_property_update_on_folder($_course, $basepath_chat, $userId);
        }
    }
}
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:71,代码来源:chat_functions.lib.php

示例12: export2doc

 /**
  * Function export last wiki page version to document area
  * @param int $doc_id wiki page id
  *
  * @author Juan Carlos Raña <herodoto@telefonica.net>
  */
 public function export2doc($doc_id)
 {
     $_course = $this->courseInfo;
     $groupId = api_get_group_id();
     $data = self::get_wiki_data($doc_id);
     if (empty($data)) {
         return false;
     }
     $wikiTitle = $data['title'];
     $wikiContents = $data['content'];
     $template = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
         <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{LANGUAGE}" lang="{LANGUAGE}">
         <head>
         <title>{TITLE}</title>
         <meta http-equiv="Content-Type" content="text/html; charset={ENCODING}" />
         <style type="text/css" media="screen, projection">
         /*<![CDATA[*/
         {CSS}
         /*]]>*/
         </style>
         {ASCIIMATHML_SCRIPT}</head>
         <body dir="{TEXT_DIRECTION}">
         {CONTENT}
         </body>
         </html>';
     $css_file = api_get_path(TO_SYS, WEB_CSS_PATH) . api_get_setting('stylesheets') . '/default.css';
     if (file_exists($css_file)) {
         $css = @file_get_contents($css_file);
     } else {
         $css = '';
     }
     // Fixing some bugs in css files.
     $root_rel = api_get_path(REL_PATH);
     $css_path = 'main/css/';
     $theme = api_get_setting('stylesheets') . '/';
     $css = str_replace('behavior:url("/main/css/csshover3.htc");', '', $css);
     $css = str_replace('main/', $root_rel . 'main/', $css);
     $css = str_replace('images/', $root_rel . $css_path . $theme . 'images/', $css);
     $css = str_replace('../../img/', $root_rel . 'main/img/', $css);
     $asciimathmal_script = api_contains_asciimathml($wikiContents) || api_contains_asciisvg($wikiContents) ? '<script src="' . api_get_path(TO_REL, SCRIPT_ASCIIMATHML) . '" type="text/javascript"></script>' . "\n" : '';
     $template = str_replace(array('{LANGUAGE}', '{ENCODING}', '{TEXT_DIRECTION}', '{TITLE}', '{CSS}', '{ASCIIMATHML_SCRIPT}'), array(api_get_language_isocode(), api_get_system_encoding(), api_get_text_direction(), $wikiTitle, $css, $asciimathmal_script), $template);
     if (0 != $groupId) {
         $groupPart = '_group' . $groupId;
         // and add groupId to put the same document title in different groups
         $group_properties = GroupManager::get_group_properties($groupId);
         $groupPath = $group_properties['directory'];
     } else {
         $groupPart = '';
         $groupPath = '';
     }
     $exportDir = api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/document' . $groupPath;
     $exportFile = api_replace_dangerous_char($wikiTitle) . $groupPart;
     $wikiContents = trim(preg_replace("/\\[[\\[]?([^\\]|]*)[|]?([^|\\]]*)\\][\\]]?/", "\$1", $wikiContents));
     //TODO: put link instead of title
     $wikiContents = str_replace('{CONTENT}', $wikiContents, $template);
     // replace relative path by absolute path for courses, so you can see items into this page wiki (images, mp3, etc..) exported in documents
     if (api_strpos($wikiContents, '../../courses/') !== false) {
         $web_course_path = api_get_path(WEB_COURSE_PATH);
         $wikiContents = str_replace('../../courses/', $web_course_path, $wikiContents);
     }
     $i = 1;
     //only export last version, but in new export new version in document area
     while (file_exists($exportDir . '/' . $exportFile . '_' . $i . '.html')) {
         $i++;
     }
     $wikiFileName = $exportFile . '_' . $i . '.html';
     $exportPath = $exportDir . '/' . $wikiFileName;
     file_put_contents($exportPath, $wikiContents);
     $doc_id = add_document($_course, $groupPath . '/' . $wikiFileName, 'file', filesize($exportPath), $wikiTitle);
     api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', api_get_user_id(), $groupId);
     return $doc_id;
 }
开发者ID:daffef,项目名称:chamilo-lms,代码行数:78,代码来源:wiki.inc.php

示例13: _dirs

 /**
  * Recursively travese the directories to get a list
  * of accessable directories.
  * @param string $base the full path to the current directory
  * @param string $path the relative path name
  * @return array of accessiable sub-directories
  * <code>array('path name' => 'full directory path', ...)</code>
  */
 function _dirs($base, $path)
 {
     $base = Files::fixPath($base);
     $dirs = array();
     if (!$this->isValidBase()) {
         return $dirs;
     }
     $d = @dir($base);
     $in_group = api_is_in_group();
     if ($in_group) {
         $group_properties = GroupManager::get_group_properties($_SESSION['_gid']);
         $group_directory = explode('/', $group_properties['directory']);
         $group_directory = $group_directory[count($group_directory) - 1];
     }
     $user_id = api_get_user_id();
     while (false !== ($entry = $d->read())) {
         //If it is a directory, and it doesn't start with
         // a dot, and if is it not the thumbnail directory
         if (is_dir($base . $entry) && substr($entry, 0, 1) != '.' && strpos($entry, '_DELETED_') === false && strpos($entry, 'chat_files') === false && strpos($entry, 'css') === false && strpos($entry, 'HotPotatoes_files') === false && ($in_group || !$in_group && strpos($entry, '_groupdocs') === false) && !$this->isThumbDir($entry)) {
             $relative = Files::fixPath($path . $entry);
             $fullpath = Files::fixPath($base . $entry);
             if ($in_group && strpos($fullpath, '_groupdocs') !== false && strpos($fullpath, $group_directory) === false) {
                 continue;
             }
             global $_course;
             if (!empty($_course)) {
                 $base_dir = substr($fullpath, 0, strpos($fullpath, '/document/') + 9);
                 //
                 $new_dir = substr($fullpath, strlen($base_dir), -1);
                 //
                 $doc_id = DocumentManager::get_document_id($_course, $new_dir);
                 $visible_status = api_get_item_visibility($_course, TOOL_DOCUMENT, $doc_id);
             }
             //Teachers can access to hidden files and directories as they can in the tool documents
             /*
             if ($visible_status=='0' || $visible_status=='-1') {
             	continue;
             }
             */
             /* if (strpos($fullpath, '/shared_folder/') !== false) {
             				if (!preg_match('/.*\/shared_folder\/$/', $fullpath)) {
             					//all students can see the shared_folder
             					if (strpos($fullpath, '/shared_folder/sf_user_'.$user_id.'/') !== false) {
             						continue;
             					}
             				}
             			}
             			*/
             $dirs[$relative] = $fullpath;
             $dirs = array_merge($dirs, $this->_dirs($fullpath, $relative));
         }
     }
     $d->close();
     return $dirs;
 }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:63,代码来源:ImageManager.php

示例14: show_user_group_filter_form

/**
 * This function displays a dropdown list that allows the course administrator do view the calendar items of one specific group
 * @author: Patrick Cool <patrick.cool@UGent.be>, Ghent University
 */
function show_user_group_filter_form()
{
    echo "<select name=\"select\" onchange=\"javascript: MM_jumpMenu('parent',this,0)\">";
    echo "<option value=\"agenda.php?user=none&action=view\">" . get_lang("ShowAll") . "</option>";
    // Groups
    $group_list = get_course_groups();
    $group_available_to_access = array();
    $option = '';
    if (!empty($group_list)) {
        $option = "<optgroup label=\"" . get_lang("Groups") . "\">";
        foreach ($group_list as $this_group) {
            // echo "<option value=\"agenda.php?isStudentView=true&amp;group=".$this_group['id']."\">".$this_group['name']."</option>";
            $has_access = GroupManager::user_has_access(api_get_user_id(), $this_group['id'], GroupManager::GROUP_TOOL_CALENDAR);
            $result = GroupManager::get_group_properties($this_group['id']);
            if ($result['calendar_state'] != '0') {
                $group_available_to_access[] = $this_group['id'];
            }
            // lastedit
            if ($has_access || $result['calendar_state'] == '1') {
                $option .= "<option value=\"agenda.php?action=view&group=" . $this_group['id'] . "\" ";
                $option .= $this_group['id'] == $_SESSION['group'] ? " selected" : "";
                $option .= ">" . $this_group['name'] . "</option>";
            }
        }
        $option .= "</optgroup>";
    }
    echo $option;
    // Users
    $user_list = get_course_users();
    if (!empty($user_list)) {
        echo "<optgroup label=\"" . get_lang("Users") . "\">";
        foreach ($user_list as $this_user) {
            echo "<option value=\"agenda.php?action=view&user=" . $this_user['uid'] . "\" ";
            echo isset($_SESSION['user']) && $this_user['uid'] == $_SESSION['user'] ? " selected" : "";
            echo ">" . api_get_person_name($this_user['firstName'], $this_user['lastName']) . "</option>";
        }
        echo "</optgroup>";
    }
    echo "</select>";
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:44,代码来源:agenda.inc.php

示例15: transform_user_group_array

 static function transform_user_group_array($user_list, $group_list, $get_names = false, $remove_users_from_group = false)
 {
     $complete_list = array();
     if (!empty($user_list)) {
         foreach ($user_list as $user_item) {
             if ($get_names) {
                 $user_item = api_get_user_info($user_item);
             }
             $complete_list["USER:" . $user_item['user_id']] = api_get_person_name($user_item['firstname'], $user_item['lastname']);
         }
     }
     if (!empty($group_list)) {
         foreach ($group_list as $group_item) {
             if ($get_names) {
                 $group_info = GroupManager::get_group_properties($group_item);
             } else {
                 $group_info = GroupManager::get_group_properties($group_item['id']);
             }
             $complete_list["GROUP:" . $group_info['id']] = $group_info['name'] . " [" . $group_info['count_users'] . " " . get_lang('Users') . "]";
             if ($remove_users_from_group) {
                 $users = GroupManager::get_users($group_info['id']);
                 foreach ($users as $user_id) {
                     if (isset($complete_list["USER:" . $user_id])) {
                         unset($complete_list["USER:" . $user_id]);
                     }
                 }
             }
         }
     }
     return $complete_list;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:usermanager.lib.php


注:本文中的GroupManager::get_group_properties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。