2 require_once(
'./Services/ActiveRecord/class.ActiveRecord.php');
50 $names = self::getAllOrguNames();
57 if (self::where(
array(
'ref_id' => $this->
getRefId() ))->hasSets()) {
75 public static function getTextRepresentationOfUsersOrgUnits($user_id, $separator = self::ORG_SEPARATOR, $using_tmp_table =
true) {
76 if ($using_tmp_table) {
84 $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 ));
87 return $dat->orgus ? $dat->orgus :
'-';
91 if (!$array_of_org_ids) {
94 require_once(
'./Modules/OrgUnit/classes/PathStorage/class.ilOrgUnitPathStorage.php');
97 return implode($separator, $paths);
110 if ($sort_by_title) {
122 public static function writePathByRefId(
$ref_id) {
123 require_once(
'./Modules/OrgUnit/classes/PathStorage/class.ilOrgUnitPathStorage.php');
125 $names = self::getAllOrguNames();
129 if ($ref_id == $root_ref_id || !$ref_id) {
132 while ($ref_id != $root_ref_id && $ref_id) {
133 $ref_id = $tree->getParent($ref_id);
134 if ($ref_id != $root_ref_id &&
$names[$ref_id]) {
139 $expression = reset(
$path) . self::GLUE_SIMPLE . end(
$path);
143 $ilOrgUnitPathStorage = self::findOrGetInstance($original_ref_id);
144 $ilOrgUnitPathStorage->setRefId($original_ref_id);
146 $ilOrgUnitPathStorage->setPath($expression);
147 $ilOrgUnitPathStorage->store();
153 public static function clearDeleted() {
158 $ilDB = $DIC[
'ilDB'];
159 $ref_ids = self::getAllOrguRefIds();
160 $q =
"DELETE FROM " . self::TABLE_NAME .
" WHERE " .
$ilDB->in(
'ref_id', $ref_ids,
true,
'integer');
161 $ilDB->manipulate($q);
170 protected static function writeFullPathByRefId(
$ref_id) {
171 require_once(
'./Modules/OrgUnit/classes/PathStorage/class.ilOrgUnitPathStorage.php');
173 $names = self::getAllOrguNames();
177 if ($ref_id == $root_ref_id || !$ref_id) {
180 while ($ref_id != $root_ref_id && $ref_id) {
181 $ref_id = $tree->getParent($ref_id);
182 if ($ref_id != $root_ref_id &&
$names[$ref_id]) {
189 $expression = implode(self::GLUE,
$path);
193 $ilOrgUnitPathStorage = self::findOrGetInstance($original_ref_id);
194 $ilOrgUnitPathStorage->setRefId($original_ref_id);
196 $ilOrgUnitPathStorage->setPath($expression);
197 $ilOrgUnitPathStorage->store();
207 public static function getAllOrguNames($lng_key = null) {
208 if (
count(self::$orgu_names) == 0) {
213 $ilDB = $DIC[
'ilDB'];
214 $res =
$ilDB->queryF(
'SELECT * FROM object_reference 215 JOIN object_data ON object_reference.obj_id = object_data.obj_id AND deleted IS NULL 216 WHERE object_data.type = %s',
array(
'text' ),
array(
'orgu' ));
218 self::$orgu_names[
$data->ref_id] =
$data->title;
222 return self::$orgu_names;
230 return self::TABLE_NAME;
Class ilOrgUnitPathStorage.
static _lookupObjectId($a_ref_id)
static where($where, $operator=null)
static getTextRepresentationOfOrgUnits($sort_by_title=true)
Get ref id path array.
Create styles array
The data for the language used.
getConnectorContainerName()
static getAllOrguRefIds()
static getArray($key=null, $values=null)
static orderBy($orderBy, $orderDirection='ASC')