20declare(strict_types=1);
63 $names = self::getAllOrguNames();
65 return array_keys($names);
70 if (self::where(array(
'ref_id' => $this->
getRefId()))->hasSets()) {
85 public static function getTextRepresentationOfUsersOrgUnits(
87 string $separator = self::ORG_SEPARATOR,
88 bool $using_tmp_table =
true
90 if ($using_tmp_table ===
true) {
99 "SELECT " .
$ilDB->groupConcat(
102 ) .
" AS orgus FROM orgu_usr_assignements WHERE user_id = %s GROUP BY user_id;",
108 return (isset($dat->orgus) && $dat->orgus) ? $dat->orgus :
'-';
112 if (!$array_of_org_ids) {
117 return implode($separator, $paths);
128 if ($sort_by_title) {
134 public static function writePathByRefId(
int $ref_id): void
137 $names = self::getAllOrguNames();
152 $first = array_shift(
$path);
153 $last = array_pop(
$path);
154 $middle = implode(self::GLUE_SIMPLE,
$path);
155 if (mb_strlen($middle) > self::MAX_MIDDLE_PATH_LENGTH) {
156 $middle = mb_substr($middle, 0, self::MAX_MIDDLE_PATH_LENGTH) .
" ...";
158 $expression = implode(self::GLUE_SIMPLE, [$first, $middle, $last]);
160 $expression = implode(self::GLUE_SIMPLE,
$path);
166 $ilOrgUnitPathStorage->setRefId($original_ref_id);
168 $ilOrgUnitPathStorage->setPath($expression);
169 $ilOrgUnitPathStorage->store();
172 public static function clearDeleted(): void
180 $q =
"DELETE FROM " . self::TABLE_NAME .
" WHERE " .
$ilDB->in(
'ref_id', $ref_ids,
true,
'integer');
181 $ilDB->manipulate($q);
185 public static function getAllOrguNames(array $lng_key =
null): array
187 if (
count(self::$orgu_names) == 0) {
193 $res =
$ilDB->queryF(
'SELECT * FROM object_reference
194 JOIN object_data ON object_reference.obj_id = object_data.obj_id AND deleted IS NULL
195 WHERE object_data.type = %s', array(
'text'), array(
'orgu'));
197 self::$orgu_names[
$data->ref_id] =
$data->title;
static orderBy($orderBy, string $orderDirection='ASC')
static where($where, $operator=null)
static findOrGetInstance($primary_key, array $add_constructor_args=array())
static getArray(?string $key=null, $values=null)
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