ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilWorkspaceFolderSorting Class Reference
+ Collaboration diagram for ilWorkspaceFolderSorting:

Public Member Functions

 __construct (ilLanguage $lng=null)
 Constructor. More...
 
 getOptionsByType ($wsp_type, $selected, $parent_effective)
 Get options by type. More...
 
 sortNodes ($nodes, $sorting)
 Sort nodes. More...
 

Data Fields

const SORT_DERIVED = 0
 
const SORT_ALPHABETICAL_ASC = 1
 
const SORT_ALPHABETICAL_DESC = 2
 
const SORT_CREATION_ASC = 3
 
const SORT_CREATION_DESC = 4
 

Protected Member Functions

 getLabel (int $option)
 Get label. More...
 

Protected Attributes

 $lng
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilWorkspaceFolderSorting::__construct ( ilLanguage  $lng = null)

Constructor.

Definition at line 27 of file class.ilWorkspaceFolderSorting.php.

References $DIC, and $lng.

28  {
29  global $DIC;
30 
31  $this->lng = ($lng != null)
32  ? $lng
33  : $DIC->language();
34 
35  $this->lng->loadLanguageModule("wfld");
36  }
loadLanguageModule($a_module)
$DIC
Definition: xapitoken.php:46

Member Function Documentation

◆ getLabel()

ilWorkspaceFolderSorting::getLabel ( int  $option)
protected

Get label.

Parameters
int$option
Returns
string

Definition at line 74 of file class.ilWorkspaceFolderSorting.php.

Referenced by getOptionsByType().

75  {
76  switch ($option) {
77  case self::SORT_DERIVED: return $this->lng->txt("wfld_derive");
78  case self::SORT_ALPHABETICAL_ASC: return $this->lng->txt("wfld_alphabetically_asc");
79  case self::SORT_ALPHABETICAL_DESC: return $this->lng->txt("wfld_alphabetically_desc");
80  case self::SORT_CREATION_ASC: return $this->lng->txt("wfld_creation_asc");
81  case self::SORT_CREATION_DESC: return $this->lng->txt("wfld_creation_desc");
82  }
83  return "";
84  }
+ Here is the caller graph for this function:

◆ getOptionsByType()

ilWorkspaceFolderSorting::getOptionsByType (   $wsp_type,
  $selected,
  $parent_effective 
)

Get options by type.

Parameters
$wsp_type
$selected
$parent_effective
Returns
array

Definition at line 46 of file class.ilWorkspaceFolderSorting.php.

References getLabel().

47  {
48  $sort_options = ($wsp_type == "wfld")
49  ? [self::SORT_DERIVED => $this->lng->txt("wfld_derive")]
50  : [];
51  if (in_array($wsp_type, ["wfld", "wsrt"])) {
52  $sort_options[self::SORT_ALPHABETICAL_ASC] = $this->getLabel(self::SORT_ALPHABETICAL_ASC);
53  $sort_options[self::SORT_ALPHABETICAL_DESC] = $this->getLabel(self::SORT_ALPHABETICAL_DESC);
54  $sort_options[self::SORT_CREATION_ASC] = $this->getLabel(self::SORT_CREATION_ASC);
55  $sort_options[self::SORT_CREATION_DESC] = $this->getLabel(self::SORT_CREATION_DESC);
56  }
57 
58  if (isset($sort_options[self::SORT_DERIVED])) {
59  $sort_options[self::SORT_DERIVED] .= " (" . $this->getLabel($parent_effective) . ")";
60  }
61 
62  if (isset($sort_options[$selected])) {
63  $sort_options[$selected] = "<strong>" . $sort_options[$selected] . "</strong>";
64  }
65  return $sort_options;
66  }
+ Here is the call graph for this function:

◆ sortNodes()

ilWorkspaceFolderSorting::sortNodes (   $nodes,
  $sorting 
)

Sort nodes.

Parameters
$nodes
$sorting
Returns
array

Definition at line 93 of file class.ilWorkspaceFolderSorting.php.

References ilUtil\sortArray().

94  {
95  switch ($sorting) {
96  case self::SORT_ALPHABETICAL_ASC:
97  $nodes = ilUtil::sortArray($nodes, "title", "asc");
98  break;
99  case self::SORT_ALPHABETICAL_DESC:
100  $nodes = ilUtil::sortArray($nodes, "title", "desc");
101  break;
102 
103  case self::SORT_CREATION_ASC:
104  $nodes = ilUtil::sortArray($nodes, "create_date", "asc");
105  break;
106 
107  case self::SORT_CREATION_DESC:
108  $nodes = ilUtil::sortArray($nodes, "create_date", "desc");
109  break;
110 
111  }
112  return $nodes;
113  }
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilWorkspaceFolderSorting::$lng
protected

Definition at line 22 of file class.ilWorkspaceFolderSorting.php.

Referenced by __construct().

◆ SORT_ALPHABETICAL_ASC

const ilWorkspaceFolderSorting::SORT_ALPHABETICAL_ASC = 1

◆ SORT_ALPHABETICAL_DESC

const ilWorkspaceFolderSorting::SORT_ALPHABETICAL_DESC = 2

Definition at line 15 of file class.ilWorkspaceFolderSorting.php.

◆ SORT_CREATION_ASC

const ilWorkspaceFolderSorting::SORT_CREATION_ASC = 3

Definition at line 16 of file class.ilWorkspaceFolderSorting.php.

◆ SORT_CREATION_DESC

const ilWorkspaceFolderSorting::SORT_CREATION_DESC = 4

Definition at line 17 of file class.ilWorkspaceFolderSorting.php.

◆ SORT_DERIVED

const ilWorkspaceFolderSorting::SORT_DERIVED = 0

The documentation for this class was generated from the following file: