51 public function __construct($a_id = 0, $a_call_by_reference =
true)
54 parent::__construct($a_id, $a_call_by_reference);
58 public function read()
64 $sql =
'SELECT * FROM ' . self::TABLE_NAME .
' WHERE orgu_id = ' 66 $set =
$ilDB->query($sql);
67 if (
$ilDB->numRows($set)) {
68 $rec =
$ilDB->fetchObject($set);
81 'orgu_id' =>
array(
'integer', $this->
getId() ),
91 $sql =
'SELECT * FROM ' . self::TABLE_NAME .
' WHERE orgu_id = ' 93 $set =
$ilDB->query($sql);
94 if (
$ilDB->numRows($set)) {
98 'orgu_id' =>
array(
'integer', $this->
getId() ),
103 'orgu_id' =>
array(
'integer', $this->
getId() ),
109 ->getAssignedAdvancedMDRecordIds());
140 $this->orgu_type_id = $a_id;
154 public function getAdvancedMDValues($a_record_id = 0)
160 if (is_array($this->amd_data)) {
162 return (isset($this->amd_data[$a_record_id])) ? $this->amd_data[$a_record_id] :
array();
171 $this->amd_data[$record_id] = $amd_values->getADTGroup()->getElements();
174 return (isset($this->amd_data[$a_record_id])) ? $this->amd_data[$a_record_id] :
array();
188 public static function getIconsCache()
190 if (is_array(self::$icons_cache)) {
191 return self::$icons_cache;
194 $ilDB = $DIC[
'ilDB'];
196 $sql =
'SELECT orgu_id, ot.id AS type_id FROM orgu_data 197 INNER JOIN orgu_types AS ot ON (ot.id = orgu_data.orgu_type_id) 198 WHERE ot.icon IS NOT NULL';
199 $set =
$ilDB->query($sql);
201 while (
$row =
$ilDB->fetchObject($set)) {
203 if (
$type && is_file(
$type->getIconPath(
true))) {
218 self::loadRootOrgRefIdAndId();
220 return self::$root_ref_id;
229 self::loadRootOrgRefIdAndId();
231 return self::$root_id;
237 if (self::$root_ref_id === null || self::$root_id === null) {
239 $ilDB = $DIC[
'ilDB'];
240 $q =
"SELECT o.obj_id, r.ref_id FROM object_data o 241 INNER JOIN object_reference r ON r.obj_id = o.obj_id 242 WHERE title = " .
$ilDB->quote(
'__OrgUnitAdministration',
'text') .
"";
243 $set =
$ilDB->query($q);
245 self::$root_id =
$res[
"obj_id"];
246 self::$root_ref_id =
$res[
"ref_id"];
258 $ilAppEventHandler = $DIC[
'ilAppEventHandler'];
261 foreach ($user_ids as $user_id) {
268 $ilAppEventHandler->raise(
'Modules/OrgUnit',
'assignUsersToEmployeeRole',
array(
270 'obj_id' => $this->
getId(),
272 'position_id' => $position_id,
273 'user_id' => $user_id,
286 $ilAppEventHandler = $DIC[
'ilAppEventHandler'];
289 foreach ($user_ids as $user_id) {
296 $ilAppEventHandler->raise(
'Modules/OrgUnit',
'assignUsersToSuperiorRole',
array(
298 'obj_id' => $this->
getId(),
300 'position_id' => $position_id,
301 'user_id' => $user_id,
312 $ilAppEventHandler = $DIC[
'ilAppEventHandler'];
319 $ilAppEventHandler->raise(
'Modules/OrgUnit',
'deassignUserFromEmployeeRole',
array(
321 'obj_id' => $this->
getId(),
323 'position_id' => $position_id,
324 'user_id' => $user_id,
334 $ilAppEventHandler = $DIC[
'ilAppEventHandler'];
341 $ilAppEventHandler->raise(
'Modules/OrgUnit',
'deassignUserFromSuperiorRole',
array(
343 'obj_id' => $this->
getId(),
345 'position_id' => $position_id,
346 'user_id' => $user_id,
363 $ilAppEventHandler = $DIC[
'ilAppEventHandler'];
366 if (!in_array($role_id, $arrLocalRoles)) {
370 $return =
$rbacadmin->assignUser($role_id, $user_id);
372 $ilAppEventHandler->raise(
'Modules/OrgUnit',
'assignUserToLocalRole',
array(
374 'obj_id' => $this->
getId(),
376 'role_id' => $role_id,
377 'user_id' => $user_id,
396 $ilAppEventHandler = $DIC[
'ilAppEventHandler'];
399 if (!in_array($role_id, $arrLocalRoles)) {
403 $return =
$rbacadmin->deassignUser($role_id, $user_id);
405 $ilAppEventHandler->raise(
'Modules/OrgUnit',
'deassignUserFromLocalRole',
array(
407 'obj_id' => $this->
getId(),
409 'role_id' => $role_id,
410 'user_id' => $user_id,
422 public static function _exists($a_id, $a_reference =
false,
$type =
"orgu")
424 return parent::_exists($a_id, $a_reference,
"orgu");
434 if (parent::getTitle() !=
"__OrgUnitAdministration") {
435 return parent::getTitle();
437 return $this->lng->txt(
"objs_orgu");
450 if (parent::getTitle() ==
"__OrgUnitAdministration") {
451 return $this->lng->txt(
"obj_orgu_description");
453 return parent::getLongDescription();
465 $ilDB = $DIC[
'ilDB'];
467 $q =
"SELECT * FROM object_translation WHERE obj_id = " 468 .
$ilDB->quote($this->
getId(),
'integer') .
" ORDER BY lang_default DESC";
469 $r = $this->db->query($q);
472 $data = [
"Fobject" => []];
475 "title" =>
$row->title,
476 "desc" =>
$row->description,
477 "lang" =>
$row->lang_code,
478 'lang_default' =>
$row->lang_default,
483 $translations =
$data;
485 if (!count($translations[
"Fobject"])) {
487 $translations[
"Fobject"][] =
array(
490 "lang" =>
$lng->getDefaultLanguage(),
494 return $translations;
505 public function delete()
508 $ilDB = $DIC[
'ilDB'];
509 $ilAppEventHandler = $DIC[
'ilAppEventHandler'];
512 if (!parent::delete()) {
519 $query =
"DELETE FROM object_translation WHERE obj_id = " 523 $ilAppEventHandler->raise(
'Modules/OrgUnit',
'delete',
array(
525 'obj_id' => $this->
getId(),
528 $sql =
'DELETE FROM ' . self::TABLE_NAME .
' WHERE orgu_id = ' 530 $ilDB->manipulate($sql);
541 foreach ($assignments as $assignment) {
542 $assignment->delete();
555 $ilDB = $DIC[
'ilDB'];
557 $query =
"DELETE FROM object_translation WHERE obj_id= " 571 $ilDB = $DIC[
'ilDB'];
573 $query =
"DELETE FROM object_translation WHERE obj_id= " 574 .
$ilDB->quote($this->
getId(),
'integer') .
" AND lang_code = " 575 .
$ilDB->quote($a_lang,
'text');
592 $ilDB = $DIC[
'ilDB'];
594 if (empty($a_title)) {
595 $a_title =
"NO TITLE";
598 $query =
"INSERT INTO object_translation " 599 .
"(obj_id,title,description,lang_code,lang_default) " .
"VALUES " .
"(" 600 .
$ilDB->quote($this->
getId(),
'integer') .
"," .
$ilDB->quote($a_title,
'text')
601 .
"," .
$ilDB->quote($a_desc,
'text') .
"," .
$ilDB->quote($a_lang,
'text') .
"," 602 .
$ilDB->quote($a_lang_default,
'integer') .
")";
621 $ilDB = $DIC[
'ilDB'];
623 if (empty($a_title)) {
624 $a_title =
"NO TITLE";
627 $query =
"UPDATE object_translation SET ";
629 $query .=
" title = " .
$ilDB->quote($a_title,
'text');
632 $query .=
", description = " .
$ilDB->quote($a_desc,
'text') .
" ";
635 if ($a_lang_default) {
636 $query .=
", lang_default = " .
$ilDB->quote($a_lang_default,
'integer') .
" ";
639 $query .=
" WHERE obj_id = " .
$ilDB->quote($this->
getId(),
'integer') .
" AND lang_code = " 640 .
$ilDB->quote($a_lang,
'text');
650 ilOrgUnitPathStorage::writePathByRefId($this->
getRefId());
static _updateUserFolderAssignment($a_old_id, $a_new_id)
Update user folder assignment Typically called after deleting a category with local user accounts...
static getInstancesForObjectId($a_obj_id, $a_obj_type=null, $a_sub_type="-", $a_sub_id=0)
Get instances for given object id.
removeTranslations()
remove all Translations of current OrgUnit
__construct($a_id=0, $a_call_by_reference=true)
static findOrCreateAssignment($user_id, $position_id, $orgu_id)
deassignUserFromSuperiorRole($user_id)
assignUsersToSuperiorRole($user_ids)
Adds the user ids to the position superior.
const CORE_POSITION_EMPLOYEE
static getCorePositionId($core_identifier)
static _exists($a_id, $a_reference=false, $type="orgu")
Class ilOrgUnitPathStorage.
assignUsersToEmployeeRole($user_ids)
Adds the user ids to the position employee.
updateTranslation($a_title, $a_desc, $a_lang, $a_lang_default)
update a translation to current OrgUnit
deassignUserFromLocalRole($role_id, $user_id)
Deassign a given user to a given local role.
static where($where, $operator=null)
static saveObjRecSelection($a_obj_id, $a_sub_type="", array $a_records=null, $a_delete_before=true)
Save repository object record selection.
static loadRootOrgRefIdAndId()
foreach($_POST as $key=> $value) $res
addTranslation($a_title, $a_desc, $a_lang, $a_lang_default)
add a new translation to current OrgUnit
getId()
get object id public
deleteTranslation($a_lang)
remove translations of current OrgUnit
getLongDescription()
get object long description (stored in object_description)
static getInstance($a_id)
Public.
assignUserToLocalRole($role_id, $user_id)
Assign a given user to a given local role.
deassignUserFromEmployeeRole($user_id)
Create styles array
The data for the language used.
update($pash, $contents, Config $config)
const CORE_POSITION_SUPERIOR
getRefId()
get reference id public
const USER_FOLDER_ID
Class ilObjUserFolder.