本文整理汇总了PHP中GroupManager::get_categories方法的典型用法代码示例。如果您正苦于以下问题:PHP GroupManager::get_categories方法的具体用法?PHP GroupManager::get_categories怎么用?PHP GroupManager::get_categories使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GroupManager
的用法示例。
在下文中一共展示了GroupManager::get_categories方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOverview
/**
* @param int $courseId
* @param string $keyword
* @return string
*/
public static function getOverview($courseId, $keyword = null)
{
$content = null;
$categories = GroupManager::get_categories();
if (!empty($categories)) {
foreach ($categories as $category) {
if (api_get_setting('allow_group_categories') == 'true') {
$content .= '<h2>' . $category['title'] . '</h2>';
}
if (!empty($keyword)) {
$groups = GroupManager::getGroupListFilterByName($keyword, $category['id'], $courseId);
} else {
$groups = GroupManager::get_group_list($category['id']);
}
$content .= '<ul>';
if (!empty($groups)) {
foreach ($groups as $group) {
$content .= '<li>';
$content .= Display::tag('h3', Security::remove_XSS($group['name']));
$users = GroupManager::getTutors($group['id']);
if (!empty($users)) {
$content .= '<ul>';
$content .= "<li>" . Display::tag('h4', get_lang('Tutors')) . "</li><ul>";
foreach ($users as $user) {
$user_info = api_get_user_info($user['user_id']);
$content .= '<li title="' . $user_info['username'] . '">' . $user_info['complete_name_with_username'] . '</li>';
}
$content .= '</ul>';
$content .= '</ul>';
}
$users = GroupManager::getStudents($group['id']);
if (!empty($users)) {
$content .= '<ul>';
$content .= "<li>" . Display::tag('h4', get_lang('Students')) . "</li><ul>";
foreach ($users as $user) {
$user_info = api_get_user_info($user['user_id']);
$content .= '<li title="' . $user_info['username'] . '">' . $user_info['complete_name_with_username'] . '</li>';
}
$content .= '</ul>';
$content .= '</ul>';
}
$content .= '</li>';
}
}
$content .= '</ul>';
}
}
return $content;
}
示例2: api_get_cidreq
if (api_is_allowed_to_edit(false, true)) {
$actionsLeft .= '<a href="group_creation.php?' . api_get_cidreq() . '">' . Display::return_icon('add.png', get_lang('NewGroupCreate'), '', ICON_SIZE_MEDIUM) . '</a>';
if (api_get_setting('group.allow_group_categories') == 'true') {
$actionsLeft .= '<a href="group_category.php?' . api_get_cidreq() . '&action=add_category">' . Display::return_icon('new_folder.png', get_lang('AddCategory'), '', ICON_SIZE_MEDIUM) . '</a>';
} else {
$actionsLeft .= '<a href="group_category.php?' . api_get_cidreq() . '&id=2">' . Display::return_icon('settings.png', get_lang('PropModify'), '', ICON_SIZE_MEDIUM) . '</a>';
}
$actionsLeft .= '<a href="import.php?' . api_get_cidreq() . '&action=import">' . Display::return_icon('import_csv.png', get_lang('Import'), '', ICON_SIZE_MEDIUM) . '</a>';
$actionsLeft .= '<a href="group_overview.php?' . api_get_cidreq() . '&action=export_all&type=csv">' . Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM) . '</a>';
$actionsLeft .= '<a href="group_overview.php?' . api_get_cidreq() . '&action=export_all&type=xls">' . Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM) . '</a>';
$actionsLeft .= '<a href="group_overview.php?' . api_get_cidreq() . '&action=export_pdf">' . Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM) . '</a>';
$actionsLeft .= '<a href="group_overview.php?' . api_get_cidreq() . '">' . Display::return_icon('group_summary.png', get_lang('GroupOverview'), '', ICON_SIZE_MEDIUM) . '</a>';
}
$actionsRight = GroupManager::getSearchForm();
$toolbar = Display::toolbarAction('toolbar-groups', $content = array(0 => $actionsLeft, 1 => $actionsRight));
$group_cats = GroupManager::get_categories(api_get_course_id());
echo $toolbar;
echo UserManager::getUserSubscriptionTab(3);
/* List all categories */
if (api_get_setting('group.allow_group_categories') == 'true') {
$defaultCategory = ['id' => 0, 'iid' => 0, 'description' => '', 'title' => get_lang('DefaultGroupCategory')];
$group_cats = array_merge([$defaultCategory], $group_cats);
foreach ($group_cats as $index => $category) {
$categoryId = $category['id'];
$group_list = GroupManager::get_group_list($categoryId);
$groupToShow = GroupManager::process_groups($group_list, $categoryId);
if (empty($groupToShow)) {
continue;
}
$label = Display::label(count($group_list) . ' ' . get_lang('ExistingGroups'), 'info');
$actions = null;
示例3: delete_course
/**
* Delete a course
* This function deletes a whole course-area from the platform. When the
* given course is a virtual course, the database and directory will not be
* deleted.
* When the given course is a real course, also all virtual courses refering
* to the given course will be deleted.
* Considering the fact that we remove all traces of the course in the main
* database, it makes sense to remove all tracking as well (if stats databases exist)
* so that a new course created with this code would not use the remains of an older
* course.
*
* @param string The code of the course to delete
* @todo When deleting a virtual course: unsubscribe users from that virtual
* course from the groups in the real course if they are not subscribed in
* that real course.
* @todo Remove globals
*/
public static function delete_course($code)
{
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$table_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$table_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$table_course_survey = Database::get_main_table(TABLE_MAIN_SHARED_SURVEY);
$table_course_survey_question = Database::get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION);
$table_course_survey_question_option = Database::get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION_OPTION);
$table_course_rel_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$table_stats_hotpots = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$table_stats_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$table_stats_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
$table_stats_access = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$table_stats_lastaccess = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
$table_stats_course_access = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$table_stats_online = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$table_stats_default = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
$table_stats_downloads = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
$table_stats_links = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LINKS);
$table_stats_uploads = Database::get_main_table(TABLE_STATISTIC_TRACK_E_UPLOADS);
$codeFiltered = Database::escape_string($code);
$sql = "SELECT * FROM {$table_course} WHERE code='" . $codeFiltered . "'";
$res = Database::query($sql);
if (Database::num_rows($res) == 0) {
return;
}
$sql = "SELECT * FROM {$table_course}\n WHERE code = '" . $codeFiltered . "'";
$res = Database::query($sql);
$course = Database::fetch_array($res);
$courseId = $course['id'];
$count = 0;
if (api_is_multiple_url_enabled()) {
$url_id = 1;
if (api_get_current_access_url_id() != -1) {
$url_id = api_get_current_access_url_id();
}
UrlManager::delete_url_rel_course($courseId, $url_id);
$count = UrlManager::getCountUrlRelCourse($courseId);
}
if ($count == 0) {
self::create_database_dump($code);
$course_tables = AddCourse::get_course_tables();
// Cleaning c_x tables
if (!empty($courseId)) {
foreach ($course_tables as $table) {
$table = Database::get_course_table($table);
$sql = "DELETE FROM {$table} WHERE c_id = {$courseId} ";
Database::query($sql);
}
}
$course_dir = api_get_path(SYS_COURSE_PATH) . $course['directory'];
$archive_dir = api_get_path(SYS_ARCHIVE_PATH) . $course['directory'] . '_' . time();
if (is_dir($course_dir)) {
rename($course_dir, $archive_dir);
}
// Unsubscribe all users from the course
$sql = "DELETE FROM {$table_course_user} WHERE c_id='" . $courseId . "'";
Database::query($sql);
// Delete the course from the sessions tables
$sql = "DELETE FROM {$table_session_course} WHERE c_id='" . $courseId . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_session_course_user} WHERE c_id='" . $courseId . "'";
Database::query($sql);
// Delete from Course - URL
$sql = "DELETE FROM {$table_course_rel_url} WHERE c_id = '" . $courseId . "'";
Database::query($sql);
$sql = 'SELECT survey_id FROM ' . $table_course_survey . ' WHERE course_code="' . $codeFiltered . '"';
$result_surveys = Database::query($sql);
while ($surveys = Database::fetch_array($result_surveys)) {
$survey_id = $surveys[0];
$sql = 'DELETE FROM ' . $table_course_survey_question . ' WHERE survey_id="' . $survey_id . '"';
Database::query($sql);
$sql = 'DELETE FROM ' . $table_course_survey_question_option . ' WHERE survey_id="' . $survey_id . '"';
Database::query($sql);
$sql = 'DELETE FROM ' . $table_course_survey . ' WHERE survey_id="' . $survey_id . '"';
Database::query($sql);
}
// Cleaning group categories
$groupCategories = GroupManager::get_categories($course['code']);
if (!empty($groupCategories)) {
foreach ($groupCategories as $category) {
//.........这里部分代码省略.........
示例4: get_lang
echo '<b>' . get_lang('GroupsFromClasses') . '</b>';
echo '<blockquote>';
echo '<p>' . get_lang('GroupsFromClassesInfo') . '</p>';
echo '<ul>';
foreach ($classes as $index => $class) {
$number_of_users = count($obj->get_users_by_usergroup($class['id']));
echo '<li>';
echo $class['name'];
echo ' (' . $number_of_users . ' ' . get_lang('Users') . ')';
echo '</li>';
}
echo '</ul>';
$create_class_groups_form = new FormValidator('create_class_groups_form');
$create_class_groups_form->addElement('hidden', 'action');
if (api_get_setting('allow_group_categories') == 'true') {
$group_categories = GroupManager::get_categories();
$cat_options = array();
foreach ($group_categories as $index => $category) {
// Don't allow new groups in the virtual course category!
if ($category['id'] != GroupManager::VIRTUAL_COURSE_CATEGORY) {
$cat_options[$category['id']] = $category['title'];
}
}
$create_class_groups_form->addElement('select', 'group_category', null, $cat_options);
} else {
$create_class_groups_form->addElement('hidden', 'group_category');
}
$create_class_groups_form->addElement('submit', 'submit', get_lang('Ok'));
$defaults['group_category'] = GroupManager::DEFAULT_GROUP_CATEGORY;
$defaults['action'] = 'create_class_groups';
$create_class_groups_form->setDefaults($defaults);