ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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)
 

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.

References $data, ILIAS\Blog\Contributor\ContributorRetrieval\isFieldNumeric(), and null.

Referenced by ILIAS\Blog\Contributor\ContributorRetrieval\getData().

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyRange()

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

Definition at line 79 of file ContributorRetrieval.php.

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

Referenced by ILIAS\Blog\Contributor\ContributorRetrieval\getData().

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  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ collectData()

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

Definition at line 96 of file ContributorRetrieval.php.

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

Referenced by ILIAS\Blog\Contributor\ContributorRetrieval\count(), and ILIAS\Blog\Contributor\ContributorRetrieval\getData().

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  }
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='ilpublicuserprofilegui')
Default behaviour is:
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller 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.

References ILIAS\Blog\Contributor\ContributorRetrieval\collectData().

92  : int {
93  return count($this->collectData());
94  }
count(array $filter, array $parameters)
+ Here is the call graph for this function:

◆ 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.

References $data, ILIAS\UI\Implementation\Component\Table\$range, ILIAS\Blog\Contributor\ContributorRetrieval\applyOrder(), ILIAS\Blog\Contributor\ContributorRetrieval\applyRange(), and ILIAS\Blog\Contributor\ContributorRetrieval\collectData().

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)
+ Here is the call graph for this function:

◆ isFieldNumeric()

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

Implements ILIAS\Repository\RetrievalInterface.

Definition at line 119 of file ContributorRetrieval.php.

Referenced by ILIAS\Blog\Contributor\ContributorRetrieval\applyOrder().

119  : bool
120  {
121  return $field === "id";
122  }
+ Here is the caller graph for this function:

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: