Merge branch '2.0'
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / acp / form / UserOptionListForm.class.php
1 <?php
2 namespace wcf\acp\form;
3 use wcf\data\user\group\UserGroup;
4 use wcf\system\language\LanguageFactory;
5
6 /**
7 * This class provides default implementations for a list of dynamic user options.
8 *
9 * @author Marcel Werk
10 * @copyright 2001-2014 WoltLab GmbH
11 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
12 * @package com.woltlab.wcf
13 * @subpackage acp.form
14 * @category Community Framework
15 */
16 abstract class UserOptionListForm extends AbstractOptionListForm {
17 /**
18 * @see \wcf\acp\form\AbstractOptionListForm::$optionHandlerClassName
19 */
20 public $optionHandlerClassName = 'wcf\system\option\user\UserOptionHandler';
21
22 /**
23 * @see \wcf\acp\form\AbstractOptionListForm::$supportI18n
24 */
25 public $supportI18n = false;
26
27 /**
28 * Returns a list of all available user groups.
29 *
30 * @return array
31 */
32 protected function getAvailableGroups() {
33 $userGroups = UserGroup::getAccessibleGroups(array(), array(UserGroup::GUESTS, UserGroup::EVERYONE, UserGroup::USERS));
34
35 uasort($userGroups, function(UserGroup $groupA, UserGroup $groupB) {
36 return strcmp($groupA->getName(), $groupB->getName());
37 });
38
39 return $userGroups;
40 }
41
42 /**
43 * Returns the default form language id.
44 *
45 * @return integer $languageID
46 */
47 protected function getDefaultFormLanguageID() {
48 return LanguageFactory::getInstance()->getDefaultLanguageID();
49 }
50 }