51 $names = self::getAllOrguNames();
53 return array_keys($names);
59 if (self::where(array(
'ref_id' => $this->
getRefId() ))->hasSets()) {
77 public static function getTextRepresentationOfUsersOrgUnits($user_id, $separator = self::ORG_SEPARATOR, $using_tmp_table =
true)
79 if ($using_tmp_table) {
87 $res =
$ilDB->queryF(
"SELECT " .
$ilDB->groupConcat(
"path", $separator) .
" AS orgus FROM orgu_usr_assignements WHERE user_id = %s GROUP BY user_id;", array(
'integer' ), array( $user_id ));
90 return $dat->orgus ? $dat->orgus :
'-';
94 if (!$array_of_org_ids) {
99 return implode($separator,
$paths);
113 if ($sort_by_title) {
125 public static function writePathByRefId(
$ref_id)
128 $names = self::getAllOrguNames();
143 $first = array_shift(
$path);
144 $last = array_pop(
$path);
145 $middle = implode(self::GLUE_SIMPLE,
$path);
146 if (strlen($middle) > self::MAX_MIDDLE_PATH_LENGTH) {
147 $middle = substr($middle, 0, self::MAX_MIDDLE_PATH_LENGTH) .
" ...";
149 $expression = implode(self::GLUE_SIMPLE, [ $first, $middle, $last ]);
151 $expression = implode(self::GLUE_SIMPLE,
$path);
157 $ilOrgUnitPathStorage->setRefId($original_ref_id);
159 $ilOrgUnitPathStorage->setPath($expression);
160 $ilOrgUnitPathStorage->store();
166 public static function clearDeleted()
174 $q =
"DELETE FROM " . self::TABLE_NAME .
" WHERE " .
$ilDB->in(
'ref_id', $ref_ids,
true,
'integer');
175 $ilDB->manipulate($q);
184 protected static function writeFullPathByRefId(
$ref_id)
187 $names = self::getAllOrguNames();
203 $expression = implode(self::GLUE,
$path);
208 $ilOrgUnitPathStorage->setRefId($original_ref_id);
210 $ilOrgUnitPathStorage->setPath($expression);
211 $ilOrgUnitPathStorage->store();
221 public static function getAllOrguNames($lng_key =
null)
223 if (
count(self::$orgu_names) == 0) {
229 $res =
$ilDB->queryF(
'SELECT * FROM object_reference
230 JOIN object_data ON object_reference.obj_id = object_data.obj_id AND deleted IS NULL
231 WHERE object_data.type = %s', array(
'text' ), array(
'orgu' ));
233 self::$orgu_names[
$data->ref_id] =
$data->title;
static where($where, $operator=null)
static findOrGetInstance($primary_key, array $add_constructor_args=array())
static getArray($key=null, $values=null)
static orderBy($orderBy, $orderDirection='ASC')
An exception for terminatinating execution or to throw for unit testing.
static _lookupObjectId($a_ref_id)
lookup object id
Class ilOrgUnitPathStorage.
static getTextRepresentationOfOrgUnits($sort_by_title=true)
Get ref id path array.
getConnectorContainerName()
static getAllOrguRefIds()
const MAX_MIDDLE_PATH_LENGTH
foreach($_POST as $key=> $value) $res