ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilTermsOfServiceUserHasLanguageCriterion.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
9 {
13  public function getTypeIdent() : string
14  {
15  return 'usr_language';
16  }
17 
21  public function hasUniqueNature() : bool
22  {
23  return true;
24  }
25 
30  {
31  $lng = $config['lng'] ?? '';
32 
33  if (!is_string($lng) || 2 !== strlen($lng)) {
34  return false;
35  }
36 
37  $result = strtolower($lng) === strtolower($user->getLanguage());
38 
39  return $result;
40  }
41 
46  {
47  return new \ilTermsOfServiceUserHasLanguageCriterionGUI($this, $lng);
48  }
49 }
Interface ilTermsOfServiceCriterionTypeGUI.
$config
Definition: bootstrap.php:15
$result
Interface ilTermsOfServiceCriterionType.
Class ilTermsOfServiceCriterionConfig.
evaluate(\ilObjUser $user, \ilTermsOfServiceCriterionConfig $config)
bool
$lng
hasUniqueNature()
Returns whether or not a criterion is unique by it&#39;s nature.Example: "User Language". A user account can only have one profile language . bool
$user
Definition: migrateto20.php:57
language handling
getTypeIdent()
Returns a unique id of the criterion type.string
getLanguage()
returns a 2char-language-string public