ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Blog\Contributor\ContributorRetrieval Class Reference
+ Inheritance diagram for ILIAS\Blog\Contributor\ContributorRetrieval:
+ Collaboration diagram for ILIAS\Blog\Contributor\ContributorRetrieval:

Public Member Functions

 __construct (\ilRbacReview $rbac_review, array $local_roles)
 
 getData (array $fields, ?Range $range=null, ?Order $order=null, array $filter=[], array $parameters=[])
 
 count (array $filter, array $parameters)
 
 isFieldNumeric (string $field)
 
 getData (array $fields, ?Range $range=null, ?Order $order=null, array $filter=[], array $parameters=[])
 
 count (array $filter, array $parameters)
 
 isFieldNumeric (string $field)
 

Protected Member Functions

 applyOrder (array $data, ?Order $order=null)
 
 applyRange (array $data, ?Range $range=null)
 
 collectData ()
 

Protected Attributes

ilRbacReview $rbac_review
 
array $local_roles = []
 

Detailed Description

Definition at line 28 of file ContributorRetrieval.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Blog\Contributor\ContributorRetrieval::__construct ( \ilRbacReview  $rbac_review,
array  $local_roles 
)

Member Function Documentation

◆ applyOrder()

ILIAS\Blog\Contributor\ContributorRetrieval::applyOrder ( array  $data,
?Order  $order = null 
)
protected

Definition at line 63 of file ContributorRetrieval.php.

63 : array
64 {
65 if ($order !== null) {
66 $order_field = array_keys($order->get())[0];
67 $order_direction = $order->get()[$order_field];
68
69 array_multisort(
70 array_column($data, $order_field),
71 $order_direction === 'ASC' ? SORT_ASC : SORT_DESC,
72 $this->isFieldNumeric($order_field) ? SORT_NUMERIC : SORT_STRING,
73 $data
74 );
75 }
76 return $data;
77 }

References $data.

◆ applyRange()

ILIAS\Blog\Contributor\ContributorRetrieval::applyRange ( array  $data,
?Range  $range = null 
)
protected

Definition at line 79 of file ContributorRetrieval.php.

79 : array
80 {
81 if ($range !== null) {
82 $offset = $range->getStart();
83 $limit = $range->getLength();
84 $data = array_slice($data, $offset, $limit);
85 }
86 return $data;
87 }

References $data, ILIAS\UI\Implementation\Component\Table\$range, ILIAS\Data\Range\getLength(), and ILIAS\Data\Range\getStart().

+ Here is the call graph for this function:

◆ collectData()

ILIAS\Blog\Contributor\ContributorRetrieval::collectData ( )
protected

Definition at line 96 of file ContributorRetrieval.php.

96 : array
97 {
98 $user_map = $assigned = array();
99 foreach ($this->local_roles as $id => $title) {
100 $local = $this->rbac_review->assignedUsers($id);
101 $assigned = array_merge($assigned, $local);
102 foreach ($local as $user_id) {
103 $user_map[$user_id][] = $title;
104 }
105 }
106
107 $data = array();
108 foreach (array_unique($assigned) as $id) {
109 $data[] = array(
110 "id" => $id,
111 "name" => \ilUserUtil::getNamePresentation($id, false, false, "", true),
112 "role" => $user_map[$id]
113 );
114 }
115
116 return $data;
117 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path=null)
Default behaviour is:

References $data, $id, $user_id, and ilUserUtil\getNamePresentation().

+ Here is the call graph for this function:

◆ count()

ILIAS\Blog\Contributor\ContributorRetrieval::count ( array  $filter,
array  $parameters 
)

Implements ILIAS\Repository\RetrievalInterface.

Definition at line 89 of file ContributorRetrieval.php.

92 : int {
93 return count($this->collectData());
94 }
count(array $filter, array $parameters)

◆ getData()

ILIAS\Blog\Contributor\ContributorRetrieval::getData ( array  $fields,
?Range  $range = null,
?Order  $order = null,
array  $filter = [],
array  $parameters = [] 
)

Implements ILIAS\Repository\RetrievalInterface.

Definition at line 43 of file ContributorRetrieval.php.

49 : \Generator {
50 $data = $this->collectData();
51
52 // Apply ordering if specified
53 $data = $this->applyOrder($data, $order);
54
55 // Apply range (pagination) if specified
56 $data = $this->applyRange($data, $range);
57
58 foreach ($data as $row) {
59 yield $row;
60 }
61 }
applyOrder(array $data, ?Order $order=null)
applyRange(array $data, ?Range $range=null)

◆ isFieldNumeric()

ILIAS\Blog\Contributor\ContributorRetrieval::isFieldNumeric ( string  $field)

Implements ILIAS\Repository\RetrievalInterface.

Definition at line 119 of file ContributorRetrieval.php.

119 : bool
120 {
121 return $field === "id";
122 }

Field Documentation

◆ $local_roles

array ILIAS\Blog\Contributor\ContributorRetrieval::$local_roles = []
protected

◆ $rbac_review

ilRbacReview ILIAS\Blog\Contributor\ContributorRetrieval::$rbac_review
protected

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