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


PHP GroupManager::get_groups方法代码示例

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


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

示例1: foreach

$used_quota_bytes = $quota_bytes;
if (!empty($session_list)) {
    foreach ($session_list as $session_data) {
        $quota_percentage = 0;
        $quota_bytes = intval(DocumentManager::documents_total_space($course_id, null, $session_data['id']));
        if (!empty($quota_bytes)) {
            $quota_percentage = round($quota_bytes / $total_quota_bytes, 2) * 100;
        }
        if ($session_id == $session_data['id']) {
            $session_data['name'] = $session_data['name'] . ' * ';
        }
        $used_quota_bytes += $quota_bytes;
        $session[] = array(addslashes(get_lang('Session') . ': ' . $session_data['name']) . ' (' . format_file_size($quota_bytes) . ')', $quota_percentage);
    }
}
$group_list = GroupManager::get_groups();
if (!empty($group_list)) {
    foreach ($group_list as $group_data) {
        $quota_percentage = 0;
        $my_group_id = $group_data['id'];
        $quota_bytes = intval(DocumentManager::documents_total_space($course_id, $my_group_id, 0));
        if (!empty($quota_bytes)) {
            $quota_percentage = round($quota_bytes / $total_quota_bytes, 2) * 100;
        }
        if ($group_id == $my_group_id) {
            $group_data['name'] = $group_data['name'] . ' * ';
        }
        $used_quota_bytes += $quota_bytes;
        $session[] = array(addslashes(get_lang('Group') . ': ' . $group_data['name']) . ' (' . format_file_size($quota_bytes) . ')', $quota_percentage);
    }
}
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:document_quota.php

示例2: importCategoriesAndGroupsFromArray

 /**
  *
  * @param array $groupData
  * @param bool $deleteNotInArray
  * @return array
  */
 public static function importCategoriesAndGroupsFromArray($groupData, $deleteNotInArray = false)
 {
     $result = array();
     $elementsFound = array('categories' => array(), 'groups' => array());
     $groupCategories = GroupManager::get_categories();
     if (empty($groupCategories)) {
         $result['error'][] = get_lang('CreateACategory');
         return $result;
     }
     foreach ($groupData as $data) {
         $isCategory = empty($data['group']) ? true : false;
         if ($isCategory) {
             $categoryInfo = self::getCategoryByTitle($data['category']);
             $categoryId = $categoryInfo['id'];
             if (!empty($categoryInfo)) {
                 // Update
                 self::update_category($categoryId, $data['category'], $data['description'], $data['doc_state'], $data['work_state'], $data['calendar_state'], $data['announcements_state'], $data['forum_state'], $data['wiki_state'], $data['chat_state'], $data['self_reg_allowed'], $data['self_unreg_allowed'], $data['max_student'], $data['groups_per_user']);
                 $data['category_id'] = $categoryId;
                 $result['updated']['category'][] = $data;
             } else {
                 // Add
                 $categoryId = self::create_category($data['category'], $data['description'], $data['doc_state'], $data['work_state'], $data['calendar_state'], $data['announcements_state'], $data['forum_state'], $data['wiki_state'], $data['chat_state'], $data['self_reg_allowed'], $data['self_unreg_allowed'], $data['max_student'], $data['groups_per_user']);
                 if ($categoryId) {
                     $data['category_id'] = $categoryId;
                     $result['added']['category'][] = $data;
                 }
             }
             $elementsFound['categories'][] = $categoryId;
         } else {
             $groupInfo = self::getGroupByName($data['group']);
             $categoryInfo = self::getCategoryByTitle($data['category']);
             $categoryId = null;
             if (!empty($categoryInfo)) {
                 $categoryId = $categoryInfo['id'];
             } else {
                 if (!empty($groupCategories) && isset($groupCategories[0])) {
                     $defaultGroupCategory = $groupCategories[0];
                     $categoryId = $defaultGroupCategory['id'];
                 }
             }
             if (empty($groupInfo)) {
                 // Add
                 $groupId = self::create_group($data['group'], $categoryId, null, $data['max_students']);
                 if ($groupId) {
                     self::set_group_properties($groupId, $data['group'], $data['description'], $data['max_students'], $data['doc_state'], $data['work_state'], $data['calendar_state'], $data['announcements_state'], $data['forum_state'], $data['wiki_state'], $data['chat_state'], $data['self_reg_allowed'], $data['self_unreg_allowed'], $categoryId);
                     $data['group_id'] = $groupId;
                     $result['added']['group'][] = $data;
                 }
             } else {
                 // Update
                 $groupId = $groupInfo['id'];
                 self::set_group_properties($groupId, $data['group'], $data['description'], $data['max_students'], $data['doc_state'], $data['work_state'], $data['calendar_state'], $data['announcements_state'], $data['forum_state'], $data['wiki_state'], $data['chat_state'], $data['self_reg_allowed'], $data['self_unreg_allowed'], $categoryId);
                 $data['group_id'] = $groupId;
                 $result['updated']['group'][] = $data;
             }
             $elementsFound['groups'][] = $groupId;
         }
     }
     if ($deleteNotInArray) {
         // Check categories
         $categories = GroupManager::get_categories();
         foreach ($categories as $category) {
             if (!in_array($category['id'], $elementsFound['categories'])) {
                 GroupManager::delete_category($category['id']);
                 $category['category'] = $category['title'];
                 $result['deleted']['category'][] = $category;
             }
         }
         $groups = GroupManager::get_groups();
         foreach ($groups as $group) {
             if (!in_array($group['id'], $elementsFound['groups'])) {
                 GroupManager::delete_groups(array($group['id']));
                 $group['group'] = $group['name'];
                 $result['deleted']['group'][] = $group;
             }
         }
     }
     return $result;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:85,代码来源:groupmanager.lib.php

示例3: delete_course


//.........这里部分代码省略.........
     $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) {
                 GroupManager::delete_category($category['id'], $course['code']);
             }
         }
         // Cleaning groups
         $groups = GroupManager::get_groups();
         if (!empty($groups)) {
             $groupList = array_column($groups, 'id');
             GroupManager::delete_groups($groupList);
         }
         // Delete the course from the stats tables
         $sql = "DELETE FROM {$table_stats_hotpots} WHERE c_id = {$courseId}";
         Database::query($sql);
         $sql = "DELETE FROM {$table_stats_attempt} WHERE c_id = {$courseId}";
         Database::query($sql);
         $sql = "DELETE FROM {$table_stats_exercises} WHERE c_id = {$courseId}";
         Database::query($sql);
         $sql = "DELETE FROM {$table_stats_access} WHERE c_id = {$courseId}";
         Database::query($sql);
         $sql = "DELETE FROM {$table_stats_lastaccess} WHERE c_id = {$courseId}";
         Database::query($sql);
         $sql = "DELETE FROM {$table_stats_course_access} WHERE c_id = {$courseId}";
         Database::query($sql);
         $sql = "DELETE FROM {$table_stats_online} WHERE c_id = {$courseId}";
         Database::query($sql);
         // Do not delete rows from track_e_default as these include course
         // creation and other important things that do not take much space
         // but give information on the course history
         //$sql = "DELETE FROM $table_stats_default WHERE c_id = $courseId";
         //Database::query($sql);
         $sql = "DELETE FROM {$table_stats_downloads} WHERE c_id = {$courseId}";
         Database::query($sql);
         $sql = "DELETE FROM {$table_stats_links} WHERE c_id = {$courseId}";
         Database::query($sql);
         $sql = "DELETE FROM {$table_stats_uploads} WHERE c_id = {$courseId}";
         Database::query($sql);
         // Delete the course from the database
         $sql = "DELETE FROM {$table_course} WHERE code = '" . $codeFiltered . "'";
         Database::query($sql);
         // delete extra course fields
         $extraFieldValues = new ExtraFieldValue('course');
         $extraFieldValues->deleteValuesByItem($courseId);
         // Add event to system log
         $user_id = api_get_user_id();
         Event::addEvent(LOG_COURSE_DELETE, LOG_COURSE_CODE, $code, api_get_utc_datetime(), $user_id, $courseId);
     }
 }
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:101,代码来源:course.lib.php


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