示例#1
0
         $i++;
     }
     break;
 case 'get_extra_field_options':
     $obj = new ExtraFieldOption($type);
     $columns = array('display_text', 'option_value', 'option_order');
     $result = Database::select('*', $obj->table, array('where' => array("field_id = ? " => $field_id), 'order' => "{$sidx} {$sord}", 'LIMIT' => "{$start} , {$limit}"));
     break;
 case 'get_usergroups_teacher':
     $columns = array('name', 'users', 'status', 'group_type', 'actions');
     $options = array('order' => "name {$sord}", 'LIMIT' => "{$start} , {$limit}");
     $options['course_id'] = $course_id;
     switch ($type) {
         case 'not_registered':
             $options['where'] = array(" (course_id IS NULL OR course_id != ?) " => $course_id);
             $result = $obj->getUserGroupNotInCourse($options, $groupFilter);
             break;
         case 'registered':
             $options['where'] = array(" usergroup.course_id = ? " => $course_id);
             $result = $obj->getUserGroupInCourse($options, $groupFilter);
             break;
     }
     $new_result = array();
     if (!empty($result)) {
         foreach ($result as $group) {
             $group['users'] = count($obj->get_users_by_usergroup($group['id']));
             if ($obj->usergroup_was_added_in_course($group['id'], $course_id)) {
                 $url = 'class.php?action=remove_class_from_course&id=' . $group['id'] . '&' . api_get_cidreq();
                 $icon = Display::return_icon('delete.png', get_lang('Remove'));
                 //$class = 'btn btn-danger';
                 //$text = get_lang('Remove');