104                $ilBench->start(
"Core", 
"ilObject_Constructor");
 
  108                        echo 
"<br/><font color=\"red\">type(".$this->type.
") id(".$a_id.
") referenced(".$a_reference.
")</font>";
 
  113                $this->objDefinition = $objDefinition;
 
  117                $this->add_dots = 
true;
 
  119                $this->referenced = $a_reference;
 
  120                $this->call_by_reference = $a_reference;
 
  124                        $this->referenced = 
false;              
 
  127                if ($this->referenced)
 
  129                        $this->ref_id = $a_id;
 
  141                $ilBench->stop(
"Core", 
"ilObject_Constructor");
 
  159        function read($a_force_db = 
false)
 
  163                $ilBench->start(
"Core", 
"ilObject_read");
 
  164                if (isset($this->obj_data_record) && !$a_force_db)
 
  168                else if ($this->referenced)
 
  171                        if (!isset($this->ref_id))
 
  173                                $message = 
"ilObject::read(): No ref_id given! (".$this->type.
")";
 
  174                                $this->
ilias->raiseError($message,$this->
ilias->error_obj->WARNING);
 
  178                        $ilBench->start(
"Core", 
"ilObject_read_readData");
 
  180                        $q = 
"SELECT * FROM object_data, object_reference WHERE object_data.obj_id=object_reference.obj_id ".
 
  181                                 "AND object_reference.ref_id= ".$ilDB->quote($this->ref_id, 
"integer");
 
  182                        $object_set = 
$ilDB->query($q);
 
  183                        $ilBench->stop(
"Core", 
"ilObject_read_readData");
 
  186                        if (
$ilDB->numRows($object_set) == 0)
 
  188                                $message = 
"ilObject::read(): Object with ref_id ".$this->ref_id.
" not found! (".$this->type.
")";
 
  189                                $this->
ilias->raiseError($message,$this->
ilias->error_obj->WARNING);
 
  192                        $obj = 
$ilDB->fetchAssoc($object_set);
 
  197                        if (!isset($this->
id))
 
  199                                $message = 
"ilObject::read(): No obj_id given! (".$this->type.
")";
 
  200                                $this->
ilias->raiseError($message,$this->
ilias->error_obj->WARNING);
 
  204                        $q = 
"SELECT * FROM object_data ".
 
  205                                 "WHERE obj_id = ".$ilDB->quote($this->
id, 
"integer");
 
  206                        $object_set = 
$ilDB->query($q);
 
  209                        if (
$ilDB->numRows($object_set) == 0)
 
  211                                include_once(
"./Services/Object/exceptions/class.ilObjectNotFoundException.php");
 
  213                                        " (".$this->type.
") not found!");
 
  217                        $obj = 
$ilDB->fetchAssoc($object_set);
 
  220                $this->
id = $obj[
"obj_id"];
 
  223                if ($this->type != $obj[
"type"] && $obj[
"type"] != 
"xxx")
 
  225                        $message = 
"ilObject::read(): Type mismatch. Object with obj_id: ".$this->id.
" ".
 
  226                                "was instantiated by type '".$this->type.
"'. DB type is: ".$obj[
"type"];
 
  229                        $log->write($message);
 
  232                        include_once(
"./Services/Object/exceptions/class.ilObjectTypeMismatchException.php");
 
  237                $this->type = $obj[
"type"];
 
  238                $this->title = $obj[
"title"];
 
  240                $this->untranslatedTitle = $obj[
"title"];
 
  242                $this->desc = $obj[
"description"];
 
  243                $this->owner = $obj[
"owner"];
 
  244                $this->create_date = $obj[
"create_date"];
 
  245                $this->last_update = $obj[
"last_update"];
 
  246                $this->import_id = $obj[
"import_id"];
 
  248                if($objDefinition->isRBACObject($this->getType()))
 
  251                        $query = 
"SELECT * FROM object_description WHERE obj_id = ".$ilDB->quote($this->
id,
'integer');
 
  255                                if(strlen(
$row->description))
 
  263                $ilBench->start(
"Core", 
"ilObject_Constructor_getTranslation");
 
  264                $translation_type = $objDefinition->getTranslationType($this->type);
 
  266                if ($translation_type == 
"sys")
 
  268                        $this->title = $this->lng->txt(
"obj_".$this->type);
 
  269                        $this->
setDescription($this->lng->txt(
"obj_".$this->type.
"_desc"));
 
  271                elseif ($translation_type == 
"db")
 
  273                        $q = 
"SELECT title,description FROM object_translation ".
 
  274                                 "WHERE obj_id = ".$ilDB->quote($this->
id,
'integer').
" ".
 
  275                                 "AND lang_code = ".$ilDB->quote($this->
ilias->account->getCurrentLanguage(),
'text').
" ".
 
  276                                 "AND NOT lang_default = 1";
 
  277                        $r = $this->
ilias->db->query($q);
 
  281                                $this->title = 
$row->title;
 
  283                                #$this->desc = $row->description; 
  287                $ilBench->stop(
"Core", 
"ilObject_Constructor_getTranslation");
 
  289                $ilBench->stop(
"Core", 
"ilObject_read");
 
  319                $this->ref_id = $a_id;
 
  320                $this->referenced = 
true;
 
  350                $this->type = $a_type;
 
  425                $this->long_desc = $a_desc;
 
  438                return strlen($this->long_desc) ? $this->long_desc : 
$this->desc;
 
  460                $this->import_id = $a_import_id;
 
  467                $query = 
"SELECT * FROM object_data ".
 
  468                        "WHERE import_id = ".$ilDB->quote($a_import_id, 
"text").
" ".
 
  469                        "ORDER BY create_date DESC";
 
  482                $query = 
"SELECT import_id FROM object_data ".
 
  483                        "WHERE obj_id = ".$ilDB->quote($a_obj_id, 
"integer");
 
  486                return $row->import_id;
 
  518                if ($a_owner_id != -1)
 
  528                        $own_name = 
$owner->getFullname();
 
  532                        $own_name = 
$lng->txt(
"unknown");
 
  546                $this->owner = $a_owner;
 
  598                $this->obj_data_record = $a_record;
 
  613                if (!isset($this->type))
 
  615                        $message = get_class($this).
"::create(): No object type given!";
 
  616                        $this->
ilias->raiseError($message,$this->
ilias->error_obj->WARNING);
 
  620                $log->write(
"ilObject::create(), start");
 
  638                $this->
id = $ilDB->nextId(
"object_data");
 
  639                $q = 
"INSERT INTO object_data ".
 
  640                         "(obj_id,type,title,description,owner,create_date,last_update,import_id) ".
 
  643                         $ilDB->quote($this->
id, 
"integer").
",".
 
  644                         $ilDB->quote($this->type, 
"text").
",".
 
  647                         $ilDB->quote(
$owner, 
"integer").
",".
 
  652                $ilDB->manipulate($q);
 
  658                if($objDefinition->isRBACObject($this->getType()))
 
  661                                'obj_id'                => array(
'integer',$this->
id),
 
  664                        $ilDB->insert(
'object_description',$values);
 
  671                $q = 
"SELECT last_update, create_date FROM object_data".
 
  672                         " WHERE obj_id = ".$ilDB->quote($this->
id, 
"integer");
 
  673                $obj_set = 
$ilDB->query($q);
 
  674                $obj_rec = 
$ilDB->fetchAssoc($obj_set);
 
  675                $this->last_update = $obj_rec[
"last_update"];
 
  676                $this->create_date = $obj_rec[
"create_date"];
 
  682                $log->write(
"ilObject::create(), finished, obj_id: ".$this->
id.
", type: ".
 
  683                        $this->type.
", title: ".$this->getTitle());
 
  685                $GLOBALS[
'ilAppEventHandler']->raise(
 
  688                        array(
'obj_id' => $this->
id,
'obj_type' => $this->type));
 
  701                global $objDefinition, 
$ilDB;
 
  703                $q = 
"UPDATE object_data ".
 
  705                        "title = ".$ilDB->quote($this->
getTitle(), 
"text").
",".
 
  706                        "description = ".$ilDB->quote($this->
getDescription(), 
"text").
", ".
 
  707                        "import_id = ".$ilDB->quote($this->
getImportId(), 
"text").
",".
 
  708                        "last_update = ".$ilDB->now().
" ".
 
  709                        "WHERE obj_id = ".$ilDB->quote($this->
getId(), 
"integer");
 
  710                $ilDB->manipulate($q);
 
  715                $q = 
"SELECT last_update FROM object_data".
 
  716                         " WHERE obj_id = ".$ilDB->quote($this->
getId(), 
"integer");
 
  717                $obj_set = 
$ilDB->query($q);
 
  718                $obj_rec = 
$ilDB->fetchAssoc($obj_set);
 
  719                $this->last_update = $obj_rec[
"last_update"];
 
  721                if($objDefinition->isRBACObject($this->getType()))
 
  724                        $res = $this->
ilias->db->query(
"SELECT * FROM object_description WHERE obj_id = ".
 
  725                                $ilDB->quote($this->getId(),
'integer'));
 
  731                                $ilDB->update(
'object_description',$values,array(
'obj_id' => array(
'integer',$this->
getId())));
 
  737                                        'obj_id'                => array(
'integer',$this->
getId()));
 
  738                                $ilDB->insert(
'object_description',$values);
 
  741                $GLOBALS[
'ilAppEventHandler']->raise(
 
  744                        array(
'obj_id' => $this->
getId(),
 
  745                                'obj_type' => $this->
getType(),
 
  764                include_once 
'Services/MetaData/classes/class.ilMD.php';
 
  766                $GLOBALS[
'ilAppEventHandler']->raise(
 
  769                        array(
'obj_id' => $this->
getId(),
 
  770                                'obj_type' => $this->
getType(),
 
  779                                if(!is_object($md_gen = $md->getGeneral()))
 
  783                                $this->
setTitle($md_gen->getTitle());
 
  785                                foreach($md_gen->getDescriptionIds() as 
$id)
 
  787                                        $md_des = $md_gen->getDescription(
$id);
 
  805                include_once 
'Services/MetaData/classes/class.ilMDCreator.php';
 
  810                $md_creator->setTitle($this->
getTitle());
 
  811                $md_creator->setTitleLanguage(
$ilUser->getPref(
'language'));
 
  813                $md_creator->setDescriptionLanguage(
$ilUser->getPref(
'language'));
 
  814                $md_creator->setKeywordLanguage(
$ilUser->getPref(
'language'));
 
  815                $md_creator->setLanguage(
$ilUser->getPref(
'language'));
 
  816                $md_creator->create();
 
  826                include_once(
"Services/MetaData/classes/class.ilMD.php");
 
  827                include_once(
"Services/MetaData/classes/class.ilMDGeneral.php");
 
  828                include_once(
"Services/MetaData/classes/class.ilMDDescription.php");
 
  831                $md_gen =& $md->getGeneral();
 
  837                        $md_gen =& $md->getGeneral();
 
  840                $md_gen->setTitle($this->
getTitle());
 
  843                $md_des_ids =& $md_gen->getDescriptionIds();
 
  844                if (count($md_des_ids) > 0)
 
  846                        $md_des =& $md_gen->getDescription($md_des_ids[0]);
 
  860                include_once(
'Services/MetaData/classes/class.ilMD.php');
 
  875        $q = 
"UPDATE object_data ".
 
  877            "owner = ".$ilDB->quote($this->
getOwner(), 
"integer").
", ".
 
  878            "last_update = ".$ilDB->now().
" ".
 
  879            "WHERE obj_id = ".$ilDB->quote($this->
getId(), 
"integer");
 
  880        $ilDB->manipulate($q);
 
  882        $q = 
"SELECT last_update FROM object_data".
 
  883             " WHERE obj_id = ".$ilDB->quote($this->
getId(), 
"integer");
 
  884        $obj_set = 
$ilDB->query($q);
 
  885        $obj_rec = 
$ilDB->fetchAssoc($obj_set);
 
  886        $this->last_update = $obj_rec[
"last_update"];
 
  902                $ilDB->setLimit(1,0);
 
  903                $q = 
"SELECT * FROM object_data WHERE import_id = ".$ilDB->quote($a_import_id, 
"text").
 
  904                        " ORDER BY create_date DESC";
 
  905                $obj_set = 
$ilDB->query($q);
 
  907                if ($obj_rec = 
$ilDB->fetchAssoc($obj_set))
 
  909                        return $obj_rec[
"obj_id"];
 
  926                $query = 
"SELECT * FROM object_reference WHERE obj_id = ".
 
  927                        $ilDB->quote($a_id,
'integer');
 
  931                while($obj_rec = 
$ilDB->fetchAssoc(
$res))
 
  933                        $ref[$obj_rec[
"ref_id"]] = $obj_rec[
"ref_id"];
 
  946                global $ilObjDataCache;
 
  948                $tit = $ilObjDataCache->lookupTitle($a_id);
 
  960                global $ilObjDataCache;
 
  962                $owner = $ilObjDataCache->lookupOwner($a_id);
 
  971                        ? 
"SELECT obj_id FROM object_data WHERE title = ".
$ilDB->quote(
$title, 
"text")
 
  972                        : 
"SELECT obj_id FROM object_data WHERE ".$ilDB->like(
"title", 
"text", 
'%'.
$title.
'%');
 
  975                        $query .= 
" AND type = ".$ilDB->quote(
$type, 
"text");
 
  980                $object_ids = array();
 
  983                        $object_ids[] = 
$row[
'obj_id'];
 
  986                return is_array($object_ids) ? $object_ids : array();
 
  996                global $ilObjDataCache;
 
  998                return $ilObjDataCache->lookupDescription($a_id);
 
 1008                global $ilObjDataCache;
 
 1016                        return $ilObjDataCache->lookupLastUpdate($a_id);
 
 1029                if (!is_array($a_objs))
 
 1031                        $a_objs = array($a_objs);
 
 1034                $set = 
$ilDB->query(
"SELECT max(last_update) as last_update FROM object_data ".
 
 1035                        "WHERE ".
$ilDB->in(
"obj_id", $a_objs, 
false, 
"integer").
" ");
 
 1036                $rec = 
$ilDB->fetchAssoc($set);
 
 1038                return ($rec[
"last_update"]);
 
 1043                global $ilObjDataCache;
 
 1045                return (
int) $ilObjDataCache->lookupObjId($a_id);
 
 1055                $query = 
"UPDATE object_reference SET deleted= ".$ilDB->now().
' '.
 
 1056                        "WHERE ref_id = ".$ilDB->quote($a_ref_id,
'integer');
 
 1070                $query = 
'UPDATE object_reference SET deleted = '.$ilDB->now().
' '.
 
 1071                                'WHERE '.$ilDB->in(
'ref_id',(array) $a_ref_ids,
false,
'integer');
 
 1085                $query = 
"UPDATE object_reference SET deleted = ".$ilDB->quote(
null,
'timestamp').
 
 1086                        " WHERE ref_id = ".$ilDB->quote($a_ref_id,
'integer');
 
 1097                $query = 
"SELECT deleted FROM object_reference".
 
 1098                        " WHERE ref_id = ".$ilDB->quote($a_ref_id, 
"integer");
 
 1100                $rec = 
$ilDB->fetchAssoc($set);
 
 1102                return $rec[
"deleted"];
 
 1117                $q = 
"UPDATE object_data ".
 
 1119                        "title = ".$ilDB->quote($a_title, 
"text").
",".
 
 1120                        "last_update = ".$ilDB->now().
" ".
 
 1121                        "WHERE obj_id = ".$ilDB->quote($a_obj_id, 
"integer");
 
 1123                $ilDB->manipulate($q);
 
 1135                global 
$ilDB,$objDefinition;
 
 1140                $q = 
"UPDATE object_data ".
 
 1142                        "description = ".$ilDB->quote(
$desc, 
"text").
",".
 
 1143                        "last_update = ".$ilDB->now().
" ".
 
 1144                        "WHERE obj_id = ".$ilDB->quote($a_obj_id, 
"integer");
 
 1146                $ilDB->manipulate($q);
 
 1151                        $res = 
$ilDB->query(
"SELECT * FROM object_description WHERE obj_id = ".
 
 1152                                $ilDB->quote($a_obj_id,
'integer'));
 
 1157                                        'description'   => array(
'clob',$a_desc)
 
 1159                                $ilDB->update(
'object_description',$values,array(
'obj_id' => array(
'integer',$a_obj_id)));
 
 1164                                        'description'   => array(
'clob',$a_desc),
 
 1165                                        'obj_id'                => array(
'integer',$a_obj_id));
 
 1166                                $ilDB->insert(
'object_description',$values);
 
 1182                $q = 
"UPDATE object_data ".
 
 1184                        "import_id = ".$ilDB->quote($a_import_id, 
"text").
",".
 
 1185                        "last_update = ".$ilDB->now().
" ".
 
 1186                        "WHERE obj_id = ".$ilDB->quote($a_obj_id, 
"integer");
 
 1188                $ilDB->manipulate($q);
 
 1198                global $ilObjDataCache;
 
 1202                        return $ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($a_id));
 
 1204                return $ilObjDataCache->lookupType($a_id);
 
 1214                return $tree->isSaved($a_ref_id);
 
 1241                global $ilObjDataCache;
 
 1243                return (
int) $ilObjDataCache->lookupObjId($a_ref_id);
 
 1260                $q = 
"SELECT * FROM object_data WHERE type = ".$ilDB->quote($a_type, 
"text");
 
 1261                $obj_set = 
$ilDB->query($q);
 
 1264                while ($obj_rec = 
$ilDB->fetchAssoc($obj_set))
 
 1268                                $objects[$obj_rec[
"title"].
".".$obj_rec[
"obj_id"]] = array(
"id" => $obj_rec[
"obj_id"],
 
 1269                                        "type" => $obj_rec[
"type"], 
"title" => $obj_rec[
"title"],
 
 1270                                        "description" => $obj_rec[
"description"]);
 
 1286                $tree->insertNode($this->
getRefId(), $a_parent_ref);
 
 1289                $log->write(
"ilObject::putInTree(), parent_ref: $a_parent_ref, ref_id: ".
 
 1313                global $rbacadmin, $rbacreview;
 
 1315                $parent_roles = $rbacreview->getParentRoleIds($a_parent_ref);
 
 1316                foreach((array) $parent_roles as $parent_role)
 
 1318                        $operations = $rbacreview->getOperationsOfRole(
 
 1319                                $parent_role[
'obj_id'],
 
 1321                                $parent_role[
'parent']
 
 1323                        $rbacadmin->grantPermission(
 
 1324                                $parent_role[
'obj_id'],
 
 1342                if (!isset($this->
id))
 
 1344                        $message = 
"ilObject::createNewReference(): No obj_id given!";
 
 1345                        $this->raiseError($message,$this->
ilias->error_obj->WARNING);
 
 1348                $next_id = 
$ilDB->nextId(
'object_reference');
 
 1349                $query = 
"INSERT INTO object_reference ".
 
 1350                         "(ref_id, obj_id) VALUES (".$ilDB->quote($next_id,
'integer').
','.
$ilDB->quote($this->
id ,
'integer').
")";
 
 1353                $this->ref_id = $next_id;
 
 1354                $this->referenced = 
true;
 
 1370                if (!isset($this->
id))
 
 1372                        $message = 
"ilObject::countReferences(): No obj_id given!";
 
 1373                        $this->
ilias->raiseError($message,$this->
ilias->error_obj->WARNING);
 
 1376                $query = 
"SELECT COUNT(ref_id) num FROM object_reference ".
 
 1377                        "WHERE obj_id = ".$ilDB->quote($this->
id,
'integer').
" ";
 
 1407                        if ($this->type != $db_type)
 
 1409                                $message = 
"ilObject::delete(): Type mismatch. Object with obj_id: ".$this->id.
" ".
 
 1410                                        "was instantiated by type '".$this->type.
"'. DB type is: ".$db_type;
 
 1413                                $log->write($message);
 
 1416                                $this->
ilias->raiseError(
"ilObject::delete(): Type mismatch. (".$this->type.
"/".$this->id.
")",$this->ilias->error_obj->WARNING);
 
 1420                        $q = 
"DELETE FROM object_data ".
 
 1421                                "WHERE obj_id = ".$ilDB->quote($this->
getId(), 
"integer");
 
 1422                        $ilDB->manipulate($q);
 
 1425                        $query = 
"DELETE FROM object_description WHERE obj_id = ".
 
 1427                        $ilDB->manipulate(
$query);
 
 1430                        $log->write(
"ilObject::delete(), deleted object, obj_id: ".$this->
getId().
", type: ".
 
 1434                        include_once(
"./Services/News/classes/class.ilNewsItem.php");
 
 1436                        $news_item->deleteNewsOfContext($this->
getId(), $this->
getType());
 
 1437                        include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
 
 1440                        include_once 
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
 
 1456                        $query = 
"DELETE FROM dav_property ".
 
 1457                                "WHERE obj_id = ".$ilDB->quote($this->
getId(),
'integer');
 
 1461                        include_once 
'./Services/WebServices/ECS/classes/class.ilECSImport.php';
 
 1464                        include_once(
"Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
 
 1467                        include_once(
"Services/Tracking/classes/class.ilLPObjSettings.php");
 
 1475                        $log->write(
"ilObject::delete(), object not deleted, number of references: ".
 
 1481                if ($this->referenced)
 
 1483                        include_once 
"Services/Object/classes/class.ilObjectActivation.php";
 
 1487                        $query = 
"DELETE FROM object_reference ".
 
 1488                                "WHERE ref_id = ".$ilDB->quote($this->
getRefId(),
'integer');
 
 1492                        $log->write(
"ilObject::delete(), reference deleted, ref_id: ".$this->
getRefId().
 
 1493                                ", obj_id: ".$this->
getId().
", type: ".
 
 1500                        $rbacadmin->revokePermission($this->
getRefId(),0,
false);
 
 1502                        include_once 
"Services/AccessControl/classes/class.ilRbacLog.php";
 
 1506                        include_once 
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
 
 1514                if ($this->referenced)
 
 1548                include_once 
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
 
 1551                include_once 
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
 
 1554                        $action->setRefId($this->
getRefId());
 
 1568        public static function _exists($a_id, $a_reference = 
false, $a_type = 
null)
 
 1574                        $q = 
"SELECT * FROM object_data ".
 
 1575                                 "LEFT JOIN object_reference ON object_reference.obj_id=object_data.obj_id ".
 
 1576                                 "WHERE object_reference.ref_id= ".$ilDB->quote($a_id, 
"integer");
 
 1580                        $q = 
"SELECT * FROM object_data WHERE obj_id=".$ilDB->quote($a_id, 
"integer");
 
 1584                        $q .= 
" AND object_data.type = ".$ilDB->quote($a_type, 
"text");
 
 1588                return $ilDB->numRows(
$r) ? true : 
false;
 
 1603        function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
 
 1607                $parent_id = (int) $tree->getParentId($a_node_id);
 
 1609                if ($parent_id != 0)
 
 1611                        $obj_data =& $this->
ilias->obj_factory->getInstanceByRefId($a_node_id);
 
 1612                        $obj_data->notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$parent_id,$a_params);
 
 1621                $this->
register = (bool) $a_bool;
 
 1653                $order = 
" ORDER BY title";
 
 1658                        $where_clause = 
"WHERE type = ".
 
 1659                                $ilDB->quote($a_obj_type, 
"text");
 
 1663                                $where_clause.= 
" AND owner = ".$ilDB->quote($a_owner, 
"integer");
 
 1667                $q = 
"SELECT * FROM object_data ".$where_clause.$order;
 
 1675                                $row[
"desc"] = 
$row[
"description"];
 
 1695                $query = 
"SELECT obj_data.title obj_title,path_data.title path_title,child FROM tree ".
 
 1696                        "JOIN object_reference obj_ref ON child = obj_ref.ref_id ".
 
 1697                        "JOIN object_data obj_data ON obj_ref.obj_id = obj_data.obj_id ".
 
 1698                        "JOIN object_reference path_ref ON parent = path_ref.ref_id ".
 
 1699                        "JOIN object_data path_data ON path_ref.obj_id = path_data.obj_id ".
 
 1700                        "WHERE ".$ilDB->in(
"child", $a_ref_ids, 
false, 
"integer").
" ".
 
 1701                        "ORDER BY obj_data.title ";
 
 1704                if (!$objDefinition->isPlugin($new_type))
 
 1710                        include_once(
"./Services/Component/classes/class.ilPlugin.php");
 
 1723                                if(strlen(
$path = 
$row->path_title) > 40)
 
 1745        public function cloneObject($a_target_id,$a_copy_id = 0,$a_omit_tree = 
false)
 
 1750                $class_name = (
'ilObj'.$objDefinition->getClassName($this->
getType()));
 
 1762                include_once(
$location.
"/class.".$class_name.
".php");
 
 1763                $new_obj = 
new $class_name(0, 
false);
 
 1764                $new_obj->setOwner(
$ilUser->getId());
 
 1765                $new_obj->setTitle(
$title);
 
 1767                $new_obj->setType($this->
getType());
 
 1769                $new_obj->create(
true);
 
 1773                        $new_obj->createReference();
 
 1774                        $new_obj->putInTree($a_target_id);
 
 1775                        $new_obj->setPermissions($a_target_id);
 
 1781                                $rbacadmin->copyLocalRoles($this->
getRefId(),$new_obj->getRefId());
 
 1785                include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
 
 1789                $query = 
"INSERT INTO dav_property (obj_id,node_id,ns,name,value) ".
 
 1790                        "SELECT ".$ilDB->quote($new_obj->getId(),
'integer').
",node_id,ns,name,value ".
 
 1791                        "FROM dav_property ".
 
 1792                        "WHERE obj_id = ".$ilDB->quote($this->
getId(),
'integer');
 
 1810                include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
 
 1812                if(!$cp_options->isRootNode($this->getRefId()))
 
 1816                $nodes = $tree->getChilds($a_target_id);
 
 1818                $title_unique = 
false;
 
 1819                require_once 
'Modules/File/classes/class.ilObjFileAccess.php';
 
 1821                $handleExtension = ($this->
getType() == 
"file"); 
 
 1823                while(!$title_unique)
 
 1826                        foreach($nodes as $node)
 
 1828                                if((
$title == $node[
'title']) and ($this->
getType() == $node[
'type']))
 
 1859                include_once 
'./Services/AccessControl/classes/class.ilConditionHandler.php' ;
 
 1862                include_once 
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
 
 1866                        include_once 
'./Services/Object/classes/class.ilObjectFactory.php';
 
 1868                        $obj = $factory->getInstanceByRefId($a_target_id, FALSE);
 
 1871                                $obj->applyDidacticTemplate($tpl_id);
 
 1886                include_once 
"./Services/MetaData/classes/class.ilMD.php";
 
 1888                $md->cloneMD($target_obj->getId(),0,$target_obj->getType());
 
 1900        public static function _getIcon($a_obj_id = 
"", $a_size = 
"big", $a_type = 
"",
 
 1905                if ($a_obj_id == 
"" && $a_type == 
"")
 
 1921                        in_array($a_type, array(
"cat",
"grp",
"crs", 
"root", 
"fold", 
"prg")))
 
 1923                        require_once(
"./Services/Container/classes/class.ilContainer.php");
 
 1928                                $file_name = $cont_dir.
"/icon_custom.svg";
 
 1929                                if (is_file($file_name))
 
 1938                        if ($objDefinition->isPluginTypeName($a_type))
 
 1940                                if ($objDefinition->getClassName($a_type) != 
"")
 
 1942                                        $class_name = 
"il".$objDefinition->getClassName($a_type).
'Plugin';
 
 1943                                        $location = $objDefinition->getLocation($a_type);
 
 1944                                        if (is_file(
$location.
"/class.".$class_name.
".php"))
 
 1946                                                include_once(
$location.
"/class.".$class_name.
".php");
 
 1947                                                return call_user_func(array($class_name, 
"_getIcon"), $a_type, $a_size, $a_obj_id);
 
 1957                        return "./images/icon_".$a_type.
".svg";
 
 1969                global $objDefinition, $tree;
 
 1973                        $deps[
"dep"] = array();
 
 1976                $deps[
"del_ids"][$a_obj_id] = $a_obj_id;
 
 1978                if (!$objDefinition->isPluginTypeName($a_type))
 
 1980                        $class_name = 
"ilObj".$objDefinition->getClassName($a_type);            
 
 1981                        $location = $objDefinition->getLocation($a_type);
 
 1982                        include_once(
$location.
"/class.".$class_name.
".php");
 
 1983                        $odeps = call_user_func(array($class_name, 
"getDeletionDependencies"), $a_obj_id);
 
 1984                        if (is_array($odeps))
 
 1986                                foreach ($odeps as 
$id => $message)
 
 1988                                        $deps[
"dep"][
$id][$a_obj_id][] = $message;
 
 1993                        foreach ($tree->getChilds($a_ref_id) as $c)
 
 2002                        foreach ($deps[
"del_ids"] as $obj_id)
 
 2004                                unset($deps[
"dep"][$obj_id]);
 
 2006                        $deps = $deps[
"dep"];
 
 2029                $res = 
$ilDB->query(
"SELECT * FROM object_description".
 
 2030                        " WHERE ".
$ilDB->in(
"obj_id", $a_obj_ids, 
"", 
"integer"));
 
 2034                        $all[
$row[
"obj_id"]] = 
$row[
"description"];
 
 2047                global 
$ilDB, $objDefinition;
 
 2052                $types = array_keys($objDefinition->getSubObjectsRecursively(
"root"));  
 
 2054                $sql = 
"SELECT od.obj_id,od.type,od.title FROM object_data od".
 
 2055                        " JOIN object_reference oref ON(oref.obj_id = od.obj_id)".
 
 2056                        " JOIN tree ON (tree.child = oref.ref_id)";
 
 2060                        $sql .= 
" WHERE od.owner = ".$ilDB->quote($a_user_id, 
"integer");                               
 
 2064                        $sql .= 
" LEFT JOIN usr_data ud ON (ud.usr_id = od.owner)".
 
 2065                                " WHERE (od.owner < ".$ilDB->quote(1, 
"integer").
 
 2066                                " OR od.owner IS NULL OR ud.login IS NULL)".
 
 2067                                " AND od.owner <> ".$ilDB->quote(-1, 
"integer");
 
 2070                $sql .= 
" AND ".$ilDB->in(
"od.type", $types, 
"", 
"text").
 
 2071                        " AND tree.tree > ".$ilDB->quote(0, 
"integer"); 
 
 2092                if(!in_array($a_type, array(
"catr", 
"crsr", 
"sess")))
 
 2098                $missing_obj_ids = array();
 
 2099                foreach($a_obj_title_map as $obj_id => 
$title)
 
 2103                                $missing_obj_ids[] = $obj_id;
 
 2107                if(!
sizeof($missing_obj_ids))
 
 2116                                $set = 
$ilDB->query(
"SELECT oref.obj_id, od.type, od.title FROM object_data od".
 
 2117                                        " JOIN container_reference oref ON (od.obj_id = oref.target_obj_id)".
 
 2118                                        " AND ".
$ilDB->in(
"oref.obj_id", $missing_obj_ids, 
"", 
"integer"));
 
 2121                                        $a_obj_title_map[
$row[
"obj_id"]] = 
$row[
"title"];                                                                       
 
 2126                                include_once 
"Modules/Session/classes/class.ilObjSession.php";
 
 2127                                foreach($missing_obj_ids as $obj_id)
 
 2130                                        $a_obj_title_map[$obj_id] = 
$sess->getFirstAppointment()->appointmentToString();
 
 2146                $set = 
$ilDB->query(
"SELECT create_date FROM object_data ".
 
 2147                        " WHERE obj_id = ".
$ilDB->quote($a_id, 
"integer"));
 
 2148                $rec  = 
$ilDB->fetchAssoc($set);
 
 2149                return $rec[
"create_date"];
 
 2164                        !in_array($a_type, array(
"file", 
"lm", 
"wiki")))
 
 2170                $parent_ref_id = $tree->checkForParentType($a_ref_id, 
"grp");
 
 2173                        $parent_ref_id = $tree->checkForParentType($a_ref_id, 
"crs");
 
 2177                        include_once 
'./Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
 
 2200                return $this->objDefinition->getSubObjects($this->type, $a_filter);
 
const DB_FETCHMODE_OBJECT
static _deleteByObjId($a_obj_id)
Delete by objekt id.
static _cloneValues($a_source_id, $a_target_id, $a_sub_type=null, $a_source_sub_id=null, $a_target_sub_id=null)
Clone Advanced Meta Data.
static _deleteSettingsOfBlock($a_block_id, $a_block_type)
Delete block settings of block.
Handles conditions for accesses to different ILIAS objects.
static cloneDependencies($a_src_ref_id, $a_target_ref_id, $a_copy_id)
_lookupContainerSetting($a_id, $a_keyword, $a_default_value=NULL)
Lookup a container setting.
_getContainerDirectory($a_id)
Get the container directory.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
static getActionsByTemplateId($a_tpl_id)
Get actions of one template.
static assignTemplate($a_ref_id, $a_obj_id, $a_tpl_id)
Assign template to object @global ilDB $ilDB.
static deleteByObjId($a_obj_id)
Delete by obj id @global ilDB $ilDB.
static deleteByRefId($a_ref_id)
Delete by ref_id @global ilDB $ilDB.
static lookupTemplateId($a_ref_id)
Lookup template id @global ilDB $ilDB.
static _deleteByObjId($a_obj_id)
Delete by obj_id.
static _deleteByObjId($a_obj_id)
static _appendNumberOfCopyToFilename($a_file_name, $nth_copy=null, $a_handle_extension=false)
Appends the text " - Copy" to a filename in the language of the current user.
static deleteAllEntries($a_ref_id)
Delete all db entries for ref id.
Object not found exception.
const AUTO_RATING_NEW_OBJECTS
Class ilObject Basic functions for all objects.
static getDeletionDependencies($a_obj_id)
Get deletion dependencies.
$obj_data_record
object_data record
_getIdForImportId($a_import_id)
get current object id for import id (static)
getType()
get object type @access public
getOwner()
get object owner
setParentRolePermissions($a_parent_ref)
Initialize the permissions of parent roles (local roles of categories, global roles....
static hasAutoRating($a_type, $a_ref_id)
Check if auto rating is active for parent group/course.
static _lookupObjId($a_id)
createReference()
creates reference for object
setRefId($a_id)
set reference id @access public
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
Clone object permissions, put in tree ...
setId($a_id)
set object id @access public
_getObjectsDataForType($a_type, $a_omit_trash=false)
get all objects of a certain type
const TITLE_LENGTH
max length of object title
MDUpdateListener($a_element)
Meta data update listener.
static setDeletedDates($a_ref_ids)
Set deleted date @global type $ilDB.
update()
update object in db
_writeTitle($a_obj_id, $a_title)
write title to db (static)
static _lookupImportId($a_obj_id)
static getAllOwnedRepositoryObjects($a_user_id)
Get all ids of objects user owns.
getPossibleSubObjects($a_filter=true)
get all possible subobjects of this type the object can decide which types of subobjects are possible...
static _lookupTitle($a_id)
lookup object title
initDefaultRoles()
init default roles settings Purpose of this function is to create a local role folder and local roles...
cloneDependencies($a_target_id, $a_copy_id)
Clone object dependencies.
updateOwner()
update owner of object in db
setType($a_type)
set object type @access public
_lookupCreationDate($a_id)
Lookup creation date.
_isInTrash($a_ref_id)
checks wether object is in trash
_lookupDeletedDate($a_ref_id)
only called in ilObjectGUI::insertSavedNodes
static fixMissingTitles($a_type, array &$a_obj_title_map)
Try to fix missing object titles.
static _lookupObjectId($a_ref_id)
lookup object id
static _getObjectsByType($a_obj_type="", $a_owner="")
Get objects by type.
setTitle($a_title)
set object title
ilObject($a_id=0, $a_reference=true)
Constructor @access public.
deleteMetaData()
delete meta data entry
getLastUpdateDate()
get last update date @access public
static _lookupDescription($a_id)
lookup object description
updateMetaData()
update meta data entry
isUserRegistered($a_user_id=0)
_setDeletedDate($a_ref_id)
only called in ilTree::saveSubTree
_lookupOwner($a_id)
lookup object owner
_hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
notify($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
notifys an object about an event occured Based on the event passed, each object may decide how it rea...
setDescription($a_desc)
set object description
_getLastUpdateOfObjects($a_objs)
Get last update for a set of media objects.
createMetaData()
create meta data entry
setObjDataRecord($a_record)
set object_data record (note: this method should only be called from the ilObjectFactory class)
setPermissions($a_parent_ref)
set permissions of object
withReferences()
determines wehter objects are referenced or not (got ref ids or not)
getRefId()
get reference id @access public
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
setOwner($a_owner)
set object owner
_resetDeletedDate($a_ref_id)
only called in ilObjectGUI::insertSavedNodes
appendCopyInfo($a_target_id, $a_copy_id)
Prepend Copy info if object with same name exists in that container.
getLongDescription()
get object long description (stored in object_description)
static _getAllReferences($a_id)
get all reference ids of object
getDescription()
get object description
cloneMetaData($target_obj)
Copy meta data.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
getId()
get object id @access public
getUntranslatedTitle()
get untranslated object title @access public
setImportId($a_import_id)
set import id
static _lookupObjIdByImportId($a_import_id)
static _prepareCloneSelection($a_ref_ids, $new_type, $show_path=true)
Prepare copy wizard object selection.
putInTree($a_parent_ref)
maybe this method should be in tree object!?
static collectDeletionDependencies(&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
Collect deletion dependencies.
applyDidacticTemplate($a_tpl_id)
Apply template.
static getLongDescriptions(array $a_obj_ids)
Get long description data.
_writeDescription($a_obj_id, $a_desc)
write description to db (static)
read($a_force_db=false)
read object data from db into object
_lookupLastUpdate($a_id, $a_as_string=false)
lookup last update
static _lookupType($a_id, $a_reference=false)
lookup object type
_lookupOwnerName($a_owner_id)
lookup owner name for owner id
static _getIdsForTitle($title, $type='', $partialmatch=false)
_writeImportId($a_obj_id, $a_import_id)
write import id to db (static)
getImportId()
get import id
getCreateDate()
get create date @access public
getTitle()
get object title @access public
countReferences()
count references of object
getPresentationTitle()
get presentation title Normally same as title Overwritten for sessions
static lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
Lookup language text.
static shortenText($a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
static removeItemFromDesktops($a_id)
removes object from all user's desktops @access public
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
redirection script todo: (a better solution should control the processing via a xml file)
if(!is_array($argv)) $options