19declare(strict_types=1);
62 $names = self::getAllOrguNames();
64 return array_keys($names);
69 if (self::where(array(
'ref_id' => $this->
getRefId()))->hasSets()) {
84 public static function getTextRepresentationOfUsersOrgUnits(
86 string $separator = self::ORG_SEPARATOR,
87 bool $using_tmp_table =
true
89 if ($using_tmp_table ===
true) {
98 "SELECT " .
$ilDB->groupConcat(
101 ) .
" AS orgus FROM orgu_usr_assignements WHERE user_id = %s GROUP BY user_id;",
107 return (isset($dat->orgus) && $dat->orgus) ? $dat->orgus :
'-';
111 if (!$array_of_org_ids) {
116 return implode($separator, $paths);
127 if ($sort_by_title) {
133 public static function writePathByRefId(
int $ref_id): void
136 $names = self::getAllOrguNames();
151 $first = array_shift(
$path);
152 $last = array_pop(
$path);
153 $middle = implode(self::GLUE_SIMPLE,
$path);
154 if (mb_strlen($middle) > self::MAX_MIDDLE_PATH_LENGTH) {
155 $middle = mb_substr($middle, 0, self::MAX_MIDDLE_PATH_LENGTH) .
" ...";
157 $expression = implode(self::GLUE_SIMPLE, [$first, $middle, $last]);
159 $expression = implode(self::GLUE_SIMPLE,
$path);
165 $ilOrgUnitPathStorage->setRefId($original_ref_id);
167 $ilOrgUnitPathStorage->setPath($expression);
168 $ilOrgUnitPathStorage->store();
171 public static function clearDeleted(): void
179 $q =
"DELETE FROM " . self::TABLE_NAME .
" WHERE " .
$ilDB->in(
'ref_id', $ref_ids,
true,
'integer');
184 public static function getAllOrguNames(?array $lng_key =
null): array
186 if (
count(self::$orgu_names) == 0) {
192 $res =
$ilDB->queryF(
'SELECT * FROM object_reference
193 JOIN object_data ON object_reference.obj_id = object_data.obj_id AND deleted IS NULL
194 WHERE object_data.type = %s', array(
'text'), array(
'orgu'));
196 self::$orgu_names[
$data->ref_id] =
$data->title;
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static where($where, $operator=null)
static getArray(?string $key=null, string|array|null $values=null)
static orderBy(string $orderBy, string $orderDirection='ASC')
static findOrGetInstance($primary_key, array $add_constructor_args=[])
static _lookupObjectId(int $ref_id)
Class ilOrgUnitPathStorage.
getConnectorContainerName()
@description Return the Name of your Connector Table
static getAllOrguRefIds()
static getTextRepresentationOfOrgUnits(bool $sort_by_title=true)
Get ref id path array.
const MAX_MIDDLE_PATH_LENGTH