99        function ilObject($a_id = 0, $a_reference = 
true)
 
  103                $ilBench->start(
"Core", 
"ilObject_Constructor");
 
  107                        echo 
"<br/><font color=\"red\">type(".$this->type.
") id(".$a_id.
") referenced(".$a_reference.
")</font>";
 
  115                $this->add_dots = 
true;
 
  117                $this->referenced = $a_reference;
 
  118                $this->call_by_reference = $a_reference;
 
  122                        $this->referenced = 
false;              
 
  125                if ($this->referenced)
 
  127                        $this->ref_id = $a_id;
 
  139                $ilBench->stop(
"Core", 
"ilObject_Constructor");
 
  157        function read($a_force_db = 
false)
 
  161                $ilBench->start(
"Core", 
"ilObject_read");
 
  162                if (isset($this->obj_data_record) && !$a_force_db)
 
  166                else if ($this->referenced)
 
  169                        if (!isset($this->ref_id))
 
  171                                $message = 
"ilObject::read(): No ref_id given! (".$this->type.
")";
 
  172                                $this->
ilias->raiseError($message,$this->
ilias->error_obj->WARNING);
 
  176                        $ilBench->start(
"Core", 
"ilObject_read_readData");
 
  178                        $q = 
"SELECT * FROM object_data, object_reference WHERE object_data.obj_id=object_reference.obj_id ".
 
  179                                 "AND object_reference.ref_id= ".$ilDB->quote($this->ref_id, 
"integer");
 
  180                        $object_set = 
$ilDB->query($q);
 
  181                        $ilBench->stop(
"Core", 
"ilObject_read_readData");
 
  184                        if (
$ilDB->numRows($object_set) == 0)
 
  186                                $message = 
"ilObject::read(): Object with ref_id ".$this->ref_id.
" not found! (".$this->type.
")";
 
  187                                $this->
ilias->raiseError($message,$this->
ilias->error_obj->WARNING);
 
  190                        $obj = 
$ilDB->fetchAssoc($object_set);
 
  195                        if (!isset($this->
id))
 
  197                                $message = 
"ilObject::read(): No obj_id given! (".$this->type.
")";
 
  198                                $this->
ilias->raiseError($message,$this->
ilias->error_obj->WARNING);
 
  202                        $q = 
"SELECT * FROM object_data ".
 
  203                                 "WHERE obj_id = ".$ilDB->quote($this->
id, 
"integer");
 
  204                        $object_set = 
$ilDB->query($q);
 
  207                        if (
$ilDB->numRows($object_set) == 0)
 
  209                                include_once(
"./Services/Object/exceptions/class.ilObjectNotFoundException.php");
 
  211                                        " (".$this->type.
") not found!");
 
  215                        $obj = 
$ilDB->fetchAssoc($object_set);
 
  218                $this->
id = $obj[
"obj_id"];
 
  221                if ($this->type != $obj[
"type"] && $obj[
"type"] != 
"xxx")
 
  223                        $message = 
"ilObject::read(): Type mismatch. Object with obj_id: ".$this->id.
" ".
 
  224                                "was instantiated by type '".$this->type.
"'. DB type is: ".$obj[
"type"];
 
  227                        $log->write($message);
 
  230                        include_once(
"./Services/Object/exceptions/class.ilObjectTypeMismatchException.php");
 
  235                $this->type = $obj[
"type"];
 
  236                $this->title = $obj[
"title"];
 
  238                $this->untranslatedTitle = $obj[
"title"];
 
  240                $this->desc = $obj[
"description"];
 
  241                $this->owner = $obj[
"owner"];
 
  242                $this->create_date = $obj[
"create_date"];
 
  243                $this->last_update = $obj[
"last_update"];
 
  244                $this->import_id = $obj[
"import_id"];
 
  246                if($objDefinition->isRBACObject($this->getType()))
 
  249                        $query = 
"SELECT * FROM object_description WHERE obj_id = ".$ilDB->quote($this->
id,
'integer');
 
  253                                if(strlen(
$row->description))
 
  261                $ilBench->start(
"Core", 
"ilObject_Constructor_getTranslation");
 
  262                $translation_type = $objDefinition->getTranslationType($this->type);
 
  264                if ($translation_type == 
"sys")
 
  266                        $this->title = $this->lng->txt(
"obj_".$this->type);
 
  267                        $this->
setDescription($this->lng->txt(
"obj_".$this->type.
"_desc"));
 
  269                elseif ($translation_type == 
"db")
 
  271                        $q = 
"SELECT title,description FROM object_translation ".
 
  272                                 "WHERE obj_id = ".$ilDB->quote($this->
id,
'integer').
" ".
 
  273                                 "AND lang_code = ".$ilDB->quote($this->
ilias->account->getCurrentLanguage(),
'text').
" ".
 
  274                                 "AND NOT lang_default = 1";
 
  275                        $r = $this->
ilias->db->query($q);
 
  279                                $this->title = 
$row->title;
 
  281                                #$this->desc = $row->description; 
  285                $ilBench->stop(
"Core", 
"ilObject_Constructor_getTranslation");
 
  287                $ilBench->stop(
"Core", 
"ilObject_read");
 
  317                $this->ref_id = $a_id;
 
  318                $this->referenced = 
true;
 
  348                $this->type = $a_type;
 
  423                $this->long_desc = $a_desc;
 
  436                return strlen($this->long_desc) ? $this->long_desc : 
$this->desc;
 
  458                $this->import_id = $a_import_id;
 
  465                $query = 
"SELECT * FROM object_data ".
 
  466                        "WHERE import_id = ".$ilDB->quote($a_import_id, 
"text").
" ".
 
  467                        "ORDER BY create_date DESC";
 
  505                if ($a_owner_id != -1)
 
  515                        $own_name = 
$owner->getFullname();
 
  519                        $own_name = 
$lng->txt(
"unknown");
 
  533                $this->owner = $a_owner;
 
  585                $this->obj_data_record = $a_record;
 
  600                if (!isset($this->type))
 
  602                        $message = get_class($this).
"::create(): No object type given!";
 
  603                        $this->
ilias->raiseError($message,$this->
ilias->error_obj->WARNING);
 
  607                $log->write(
"ilObject::create(), start");
 
  625                $this->
id = $ilDB->nextId(
"object_data");
 
  626                $q = 
"INSERT INTO object_data ".
 
  627                         "(obj_id,type,title,description,owner,create_date,last_update,import_id) ".
 
  630                         $ilDB->quote($this->
id, 
"integer").
",".
 
  631                         $ilDB->quote($this->type, 
"text").
",".
 
  634                         $ilDB->quote(
$owner, 
"integer").
",".
 
  639                $ilDB->manipulate($q);
 
  645                if($objDefinition->isRBACObject($this->getType()))
 
  648                                'obj_id'                => array(
'integer',$this->
id),
 
  651                        $ilDB->insert(
'object_description',$values);
 
  658                $q = 
"SELECT last_update, create_date FROM object_data".
 
  659                         " WHERE obj_id = ".$ilDB->quote($this->
id, 
"integer");
 
  660                $obj_set = 
$ilDB->query($q);
 
  661                $obj_rec = 
$ilDB->fetchAssoc($obj_set);
 
  662                $this->last_update = $obj_rec[
"last_update"];
 
  663                $this->create_date = $obj_rec[
"create_date"];
 
  669                $log->write(
"ilObject::create(), finished, obj_id: ".$this->
id.
", type: ".
 
  670                        $this->type.
", title: ".$this->getTitle());
 
  672                $GLOBALS[
'ilAppEventHandler']->raise(
 
  675                        array(
'obj_id' => $this->
id,
'obj_type' => $this->type));
 
  688                global $objDefinition, 
$ilDB;
 
  690                $q = 
"UPDATE object_data ".
 
  692                        "title = ".$ilDB->quote($this->
getTitle(), 
"text").
",".
 
  693                        "description = ".$ilDB->quote($this->
getDescription(), 
"text").
", ".
 
  694                        "import_id = ".$ilDB->quote($this->
getImportId(), 
"text").
",".
 
  695                        "last_update = ".$ilDB->now().
" ".
 
  696                        "WHERE obj_id = ".$ilDB->quote($this->
getId(), 
"integer");
 
  697                $ilDB->manipulate($q);
 
  702                $q = 
"SELECT last_update FROM object_data".
 
  703                         " WHERE obj_id = ".$ilDB->quote($this->
getId(), 
"integer");
 
  704                $obj_set = 
$ilDB->query($q);
 
  705                $obj_rec = 
$ilDB->fetchAssoc($obj_set);
 
  706                $this->last_update = $obj_rec[
"last_update"];
 
  708                if($objDefinition->isRBACObject($this->getType()))
 
  711                        $res = $this->
ilias->db->query(
"SELECT * FROM object_description WHERE obj_id = ".
 
  712                                $ilDB->quote($this->getId(),
'integer'));
 
  718                                $ilDB->update(
'object_description',$values,array(
'obj_id' => array(
'integer',$this->
getId())));
 
  724                                        'obj_id'                => array(
'integer',$this->
getId()));
 
  725                                $ilDB->insert(
'object_description',$values);
 
  728                $GLOBALS[
'ilAppEventHandler']->raise(
 
  731                        array(
'obj_id' => $this->
getId(),
 
  732                                'obj_type' => $this->
getType(),
 
  751                include_once 
'Services/MetaData/classes/class.ilMD.php';
 
  753                $GLOBALS[
'ilAppEventHandler']->raise(
 
  756                        array(
'obj_id' => $this->
getId(),
 
  757                                'obj_type' => $this->
getType(),
 
  766                                if(!is_object($md_gen = $md->getGeneral()))
 
  770                                $this->
setTitle($md_gen->getTitle());
 
  772                                foreach($md_gen->getDescriptionIds() as 
$id)
 
  774                                        $md_des = $md_gen->getDescription(
$id);
 
  792                include_once 
'Services/MetaData/classes/class.ilMDCreator.php';
 
  797                $md_creator->setTitle($this->
getTitle());
 
  798                $md_creator->setTitleLanguage(
$ilUser->getPref(
'language'));
 
  800                $md_creator->setDescriptionLanguage(
$ilUser->getPref(
'language'));
 
  801                $md_creator->setKeywordLanguage(
$ilUser->getPref(
'language'));
 
  802                $md_creator->setLanguage(
$ilUser->getPref(
'language'));
 
  803                $md_creator->create();
 
  813                include_once(
"Services/MetaData/classes/class.ilMD.php");
 
  814                include_once(
"Services/MetaData/classes/class.ilMDGeneral.php");
 
  815                include_once(
"Services/MetaData/classes/class.ilMDDescription.php");
 
  818                $md_gen =& $md->getGeneral();
 
  824                        $md_gen =& $md->getGeneral();
 
  827                $md_gen->setTitle($this->
getTitle());
 
  830                $md_des_ids =& $md_gen->getDescriptionIds();
 
  831                if (count($md_des_ids) > 0)
 
  833                        $md_des =& $md_gen->getDescription($md_des_ids[0]);
 
  847                include_once(
'Services/MetaData/classes/class.ilMD.php');
 
  862        $q = 
"UPDATE object_data ".
 
  864            "owner = ".$ilDB->quote($this->
getOwner(), 
"integer").
", ".
 
  865            "last_update = ".$ilDB->now().
" ".
 
  866            "WHERE obj_id = ".$ilDB->quote($this->
getId(), 
"integer");
 
  867        $ilDB->manipulate($q);
 
  869        $q = 
"SELECT last_update FROM object_data".
 
  870             " WHERE obj_id = ".$ilDB->quote($this->
getId(), 
"integer");
 
  871        $obj_set = 
$ilDB->query($q);
 
  872        $obj_rec = 
$ilDB->fetchAssoc($obj_set);
 
  873        $this->last_update = $obj_rec[
"last_update"];
 
  889                $ilDB->setLimit(1,0);
 
  890                $q = 
"SELECT * FROM object_data WHERE import_id = ".$ilDB->quote($a_import_id, 
"text").
 
  891                        " ORDER BY create_date DESC";
 
  892                $obj_set = 
$ilDB->query($q);
 
  894                if ($obj_rec = 
$ilDB->fetchAssoc($obj_set))
 
  896                        return $obj_rec[
"obj_id"];
 
  913                $query = 
"SELECT * FROM object_reference WHERE obj_id = ".
 
  914                        $ilDB->quote($a_id,
'integer');
 
  918                while($obj_rec = 
$ilDB->fetchAssoc(
$res))
 
  920                        $ref[$obj_rec[
"ref_id"]] = $obj_rec[
"ref_id"];
 
  933                global $ilObjDataCache;
 
  935                $tit = $ilObjDataCache->lookupTitle($a_id);
 
  947                global $ilObjDataCache;
 
  949                $owner = $ilObjDataCache->lookupOwner($a_id);
 
  958                        ? 
"SELECT obj_id FROM object_data WHERE title = ".
$ilDB->quote(
$title, 
"text")
 
  959                        : 
"SELECT obj_id FROM object_data WHERE ".$ilDB->like(
"title", 
"text", 
'%'.
$title.
'%');
 
  962                        $query .= 
" AND type = ".$ilDB->quote(
$type, 
"text");
 
  967                $object_ids = array();
 
  970                        $object_ids[] = 
$row[
'obj_id'];
 
  973                return is_array($object_ids) ? $object_ids : array();
 
  983                global $ilObjDataCache;
 
  985                return $ilObjDataCache->lookupDescription($a_id);
 
  995                global $ilObjDataCache;
 
 1003                        return $ilObjDataCache->lookupLastUpdate($a_id);
 
 1016                if (!is_array($a_objs))
 
 1018                        $a_objs = array($a_objs);
 
 1021                $set = 
$ilDB->query(
"SELECT max(last_update) as last_update FROM object_data ".
 
 1022                        "WHERE ".
$ilDB->in(
"obj_id", $a_objs, 
false, 
"integer").
" ");
 
 1023                $rec = 
$ilDB->fetchAssoc($set);
 
 1025                return ($rec[
"last_update"]);
 
 1030                global $ilObjDataCache;
 
 1032                return (
int) $ilObjDataCache->lookupObjId($a_id);
 
 1042                $query = 
"UPDATE object_reference SET deleted= ".$ilDB->now().
' '.
 
 1043                        "WHERE ref_id = ".$ilDB->quote($a_ref_id,
'integer');
 
 1057                $query = 
'UPDATE object_reference SET deleted = '.$ilDB->now().
' '.
 
 1058                                'WHERE '.$ilDB->in(
'ref_id',(array) $a_ref_ids,
false,
'integer');
 
 1072                $query = 
"UPDATE object_reference SET deleted = ".$ilDB->quote(
null,
'timestamp').
 
 1073                        " WHERE ref_id = ".$ilDB->quote($a_ref_id,
'integer');
 
 1084                $query = 
"SELECT deleted FROM object_reference".
 
 1085                        " WHERE ref_id = ".$ilDB->quote($a_ref_id, 
"integer");
 
 1087                $rec = 
$ilDB->fetchAssoc($set);
 
 1089                return $rec[
"deleted"];
 
 1104                $q = 
"UPDATE object_data ".
 
 1106                        "title = ".$ilDB->quote($a_title, 
"text").
",".
 
 1107                        "last_update = ".$ilDB->now().
" ".
 
 1108                        "WHERE obj_id = ".$ilDB->quote($a_obj_id, 
"integer");
 
 1110                $ilDB->manipulate($q);
 
 1122                global 
$ilDB,$objDefinition;
 
 1127                $q = 
"UPDATE object_data ".
 
 1129                        "description = ".$ilDB->quote(
$desc, 
"text").
",".
 
 1130                        "last_update = ".$ilDB->now().
" ".
 
 1131                        "WHERE obj_id = ".$ilDB->quote($a_obj_id, 
"integer");
 
 1133                $ilDB->manipulate($q);
 
 1138                        $res = 
$ilDB->query(
"SELECT * FROM object_description WHERE obj_id = ".
 
 1139                                $ilDB->quote($a_obj_id,
'integer'));
 
 1144                                        'description'   => array(
'clob',$a_desc)
 
 1146                                $ilDB->update(
'object_description',$values,array(
'obj_id' => array(
'integer',$a_obj_id)));
 
 1151                                        'description'   => array(
'clob',$a_desc),
 
 1152                                        'obj_id'                => array(
'integer',$a_obj_id));
 
 1153                                $ilDB->insert(
'object_description',$values);
 
 1169                $q = 
"UPDATE object_data ".
 
 1171                        "import_id = ".$ilDB->quote($a_import_id, 
"text").
",".
 
 1172                        "last_update = ".$ilDB->now().
" ".
 
 1173                        "WHERE obj_id = ".$ilDB->quote($a_obj_id, 
"integer");
 
 1175                $ilDB->manipulate($q);
 
 1185                global $ilObjDataCache;
 
 1189                        return $ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($a_id));
 
 1191                return $ilObjDataCache->lookupType($a_id);
 
 1201                return $tree->isSaved($a_ref_id);
 
 1228                global $ilObjDataCache;
 
 1230                return (
int) $ilObjDataCache->lookupObjId($a_ref_id);
 
 1247                $q = 
"SELECT * FROM object_data WHERE type = ".$ilDB->quote($a_type, 
"text");
 
 1248                $obj_set = 
$ilDB->query($q);
 
 1251                while ($obj_rec = 
$ilDB->fetchAssoc($obj_set))
 
 1255                                $objects[$obj_rec[
"title"].
".".$obj_rec[
"obj_id"]] = array(
"id" => $obj_rec[
"obj_id"],
 
 1256                                        "type" => $obj_rec[
"type"], 
"title" => $obj_rec[
"title"],
 
 1257                                        "description" => $obj_rec[
"description"]);
 
 1273                $tree->insertNode($this->
getRefId(), $a_parent_ref);
 
 1276                $log->write(
"ilObject::putInTree(), parent_ref: $a_parent_ref, ref_id: ".
 
 1300                global $rbacadmin, $rbacreview;
 
 1302                $parent_roles = $rbacreview->getParentRoleIds($a_parent_ref);
 
 1303                foreach((array) $parent_roles as $parent_role)
 
 1305                        $operations = $rbacreview->getOperationsOfRole(
 
 1306                                $parent_role[
'obj_id'],
 
 1308                                $parent_role[
'parent']
 
 1310                        $rbacadmin->grantPermission(
 
 1311                                $parent_role[
'obj_id'],
 
 1329                if (!isset($this->
id))
 
 1331                        $message = 
"ilObject::createNewReference(): No obj_id given!";
 
 1332                        $this->raiseError($message,$this->
ilias->error_obj->WARNING);
 
 1335                $next_id = 
$ilDB->nextId(
'object_reference');
 
 1336                $query = 
"INSERT INTO object_reference ".
 
 1337                         "(ref_id, obj_id) VALUES (".$ilDB->quote($next_id,
'integer').
','.
$ilDB->quote($this->
id ,
'integer').
")";
 
 1340                $this->ref_id = $next_id;
 
 1341                $this->referenced = 
true;
 
 1357                if (!isset($this->
id))
 
 1359                        $message = 
"ilObject::countReferences(): No obj_id given!";
 
 1360                        $this->
ilias->raiseError($message,$this->
ilias->error_obj->WARNING);
 
 1363                $query = 
"SELECT COUNT(ref_id) num FROM object_reference ".
 
 1364                        "WHERE obj_id = ".$ilDB->quote($this->
id,
'integer').
" ";
 
 1394                        if ($this->type != $db_type)
 
 1396                                $message = 
"ilObject::delete(): Type mismatch. Object with obj_id: ".$this->id.
" ".
 
 1397                                        "was instantiated by type '".$this->type.
"'. DB type is: ".$db_type;
 
 1400                                $log->write($message);
 
 1403                                $this->
ilias->raiseError(
"ilObject::delete(): Type mismatch. (".$this->type.
"/".$this->id.
")",$this->ilias->error_obj->WARNING);
 
 1407                        $q = 
"DELETE FROM object_data ".
 
 1408                                "WHERE obj_id = ".$ilDB->quote($this->
getId(), 
"integer");
 
 1409                        $ilDB->manipulate($q);
 
 1412                        $query = 
"DELETE FROM object_description WHERE obj_id = ".
 
 1414                        $ilDB->manipulate(
$query);
 
 1417                        $log->write(
"ilObject::delete(), deleted object, obj_id: ".$this->
getId().
", type: ".
 
 1421                        include_once(
"./Services/News/classes/class.ilNewsItem.php");
 
 1423                        $news_item->deleteNewsOfContext($this->
getId(), $this->
getType());
 
 1424                        include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
 
 1427                        include_once 
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
 
 1443                        $query = 
"DELETE FROM dav_property ".
 
 1444                                "WHERE obj_id = ".$ilDB->quote($this->
getId(),
'integer');
 
 1448                        include_once 
'./Services/WebServices/ECS/classes/class.ilECSImport.php';
 
 1451                        include_once(
"Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php");
 
 1459                        $log->write(
"ilObject::delete(), object not deleted, number of references: ".
 
 1465                if ($this->referenced)
 
 1467                        include_once 
"Services/Object/classes/class.ilObjectActivation.php";
 
 1471                        $query = 
"DELETE FROM object_reference ".
 
 1472                                "WHERE ref_id = ".$ilDB->quote($this->
getRefId(),
'integer');
 
 1476                        $log->write(
"ilObject::delete(), reference deleted, ref_id: ".$this->
getRefId().
 
 1477                                ", obj_id: ".$this->
getId().
", type: ".
 
 1484                        $rbacadmin->revokePermission($this->
getRefId(),0,
false);
 
 1486                        include_once 
"Services/AccessControl/classes/class.ilRbacLog.php";
 
 1490                        include_once 
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
 
 1498                if ($this->referenced)
 
 1532                include_once 
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
 
 1535                include_once 
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
 
 1538                        $action->setRefId($this->
getRefId());
 
 1552        public static function _exists($a_id, $a_reference = 
false, $a_type = 
null)
 
 1558                        $q = 
"SELECT * FROM object_data ".
 
 1559                                 "LEFT JOIN object_reference ON object_reference.obj_id=object_data.obj_id ".
 
 1560                                 "WHERE object_reference.ref_id= ".$ilDB->quote($a_id, 
"integer");
 
 1564                        $q = 
"SELECT * FROM object_data WHERE obj_id=".$ilDB->quote($a_id, 
"integer");
 
 1568                        $q .= 
" AND object_data.type = ".$ilDB->quote($a_type, 
"text");
 
 1570                $r = 
$ilDB->query($q);
 
 1572                return $ilDB->numRows($r) ? true : 
false;
 
 1587        function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
 
 1591                $parent_id = (int) $tree->getParentId($a_node_id);
 
 1593                if ($parent_id != 0)
 
 1595                        $obj_data =& $this->
ilias->obj_factory->getInstanceByRefId($a_node_id);
 
 1596                        $obj_data->notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$parent_id,$a_params);
 
 1605                $this->
register = (bool) $a_bool;
 
 1637                $order = 
" ORDER BY title";
 
 1642                        $where_clause = 
"WHERE type = ".
 
 1643                                $ilDB->quote($a_obj_type, 
"text");
 
 1647                                $where_clause.= 
" AND owner = ".$ilDB->quote($a_owner, 
"integer");
 
 1651                $q = 
"SELECT * FROM object_data ".$where_clause.$order;
 
 1652                $r = 
$ilDB->query($q);
 
 1655                if (
$ilDB->numRows($r) > 0)
 
 1659                                $row[
"desc"] = 
$row[
"description"];
 
 1679                $query = 
"SELECT obj_data.title obj_title,path_data.title path_title,child FROM tree ".
 
 1680                        "JOIN object_reference obj_ref ON child = obj_ref.ref_id ".
 
 1681                        "JOIN object_data obj_data ON obj_ref.obj_id = obj_data.obj_id ".
 
 1682                        "JOIN object_reference path_ref ON parent = path_ref.ref_id ".
 
 1683                        "JOIN object_data path_data ON path_ref.obj_id = path_data.obj_id ".
 
 1684                        "WHERE ".$ilDB->in(
"child", $a_ref_ids, 
false, 
"integer").
" ".
 
 1685                        "ORDER BY obj_data.title ";
 
 1688                if (!$objDefinition->isPlugin($new_type))
 
 1694                        include_once(
"./Services/Component/classes/class.ilPlugin.php");
 
 1707                                if(strlen(
$path = 
$row->path_title) > 40)
 
 1729        public function cloneObject($a_target_id,$a_copy_id = 0,$a_omit_tree = 
false)
 
 1734                $class_name = (
'ilObj'.$objDefinition->getClassName($this->
getType()));
 
 1746                include_once(
$location.
"/class.".$class_name.
".php");
 
 1747                $new_obj = 
new $class_name(0, 
false);
 
 1748                $new_obj->setOwner(
$ilUser->getId());
 
 1749                $new_obj->setTitle(
$title);
 
 1751                $new_obj->setType($this->
getType());
 
 1753                $new_obj->create(
true);
 
 1757                        $new_obj->createReference();
 
 1758                        $new_obj->putInTree($a_target_id);
 
 1759                        $new_obj->setPermissions($a_target_id);
 
 1765                                $rbacadmin->copyLocalRoles($this->
getRefId(),$new_obj->getRefId());
 
 1769                include_once(
'./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
 
 1773                $query = 
"INSERT INTO dav_property (obj_id,node_id,ns,name,value) ".
 
 1774                        "SELECT ".$ilDB->quote($new_obj->getId(),
'integer').
",node_id,ns,name,value ".
 
 1775                        "FROM dav_property ".
 
 1776                        "WHERE obj_id = ".$ilDB->quote($this->
getId(),
'integer');
 
 1794                include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
 
 1796                if(!$cp_options->isRootNode($this->getRefId()))
 
 1800                $nodes = $tree->getChilds($a_target_id);
 
 1802                $title_unique = 
false;
 
 1803                require_once 
'Modules/File/classes/class.ilObjFileAccess.php';
 
 1805                $handleExtension = ($this->
getType() == 
"file"); 
 
 1807                while(!$title_unique)
 
 1810                        foreach($nodes as $node)
 
 1812                                if((
$title == $node[
'title']) and ($this->
getType() == $node[
'type']))
 
 1843                include_once 
'./Services/AccessControl/classes/class.ilConditionHandler.php';
 
 1844                include_once 
'./Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
 
 1847                $mappings = $cwo->getMappings();
 
 1850                foreach($conditions as $con)
 
 1852                        if($mappings[$con[
'trigger_ref_id']])
 
 1859                                $newCondition->setTargetRefId($a_target_id);
 
 1860                                $newCondition->setTargetObjId($target_obj);
 
 1861                                $newCondition->setTargetType($target_typ);
 
 1863                                $trigger_ref = $mappings[$con[
'trigger_ref_id']];
 
 1867                                $newCondition->setTriggerRefId($trigger_ref);
 
 1868                                $newCondition->setTriggerObjId($trigger_obj);
 
 1869                                $newCondition->setTriggerType($trigger_typ);
 
 1870                                $newCondition->setOperator($con[
'operator']);
 
 1871                                $newCondition->setValue($con[
'value']);
 
 1872                                $newCondition->setReferenceHandlingType($con[
'ref_handling']);
 
 1873                                $newCondition->setObligatory($con[
'obligatory']);
 
 1875                                $newCondition->storeCondition();
 
 1879                include_once 
'./Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
 
 1883                        include_once 
'./Services/Object/classes/class.ilObjectFactory.php';
 
 1885                        $obj = $factory->getInstanceByRefId($a_target_id, FALSE);
 
 1888                                $obj->applyDidacticTemplate($tpl_id);
 
 1903                include_once 
"./Services/MetaData/classes/class.ilMD.php";
 
 1905                $md->cloneMD($target_obj->getId(),0,$target_obj->getType());
 
 1917        public static function _getIcon($a_obj_id = 
"", $a_size = 
"big", $a_type = 
"",
 
 1922                if ($a_obj_id == 
"" && $a_type == 
"")
 
 1938                        in_array($a_type, array(
"cat",
"grp",
"crs", 
"root", 
"fold")))
 
 1940                        require_once(
"./Services/Container/classes/class.ilContainer.php");
 
 1945                                $file_name = $cont_dir.
"/icon_custom.svg";
 
 1946                                if (is_file($file_name))
 
 1955                        if ($objDefinition->isPluginTypeName($a_type))
 
 1957                                if ($objDefinition->getClassName($a_type) != 
"")
 
 1959                                        $class_name = 
"il".$objDefinition->getClassName($a_type).
'Plugin';
 
 1960                                        $location = $objDefinition->getLocation($a_type);
 
 1961                                        if (is_file(
$location.
"/class.".$class_name.
".php"))
 
 1963                                                include_once(
$location.
"/class.".$class_name.
".php");
 
 1964                                                return call_user_func(array($class_name, 
"_getIcon"), $a_type, $a_size, $a_obj_id);
 
 1974                        return "./images/icon_".$a_type.
".svg";
 
 1986                global $objDefinition, $tree;
 
 1990                        $deps[
"dep"] = array();
 
 1993                $deps[
"del_ids"][$a_obj_id] = $a_obj_id;
 
 1995                if (!$objDefinition->isPluginTypeName($a_type))
 
 1997                        $class_name = 
"ilObj".$objDefinition->getClassName($a_type);            
 
 1998                        $location = $objDefinition->getLocation($a_type);
 
 1999                        include_once(
$location.
"/class.".$class_name.
".php");
 
 2000                        $odeps = call_user_func(array($class_name, 
"getDeletionDependencies"), $a_obj_id);
 
 2001                        if (is_array($odeps))
 
 2003                                foreach ($odeps as 
$id => $message)
 
 2005                                        $deps[
"dep"][
$id][$a_obj_id][] = $message;
 
 2010                        foreach ($tree->getChilds($a_ref_id) as $c)
 
 2019                        foreach ($deps[
"del_ids"] as $obj_id)
 
 2021                                unset($deps[
"dep"][$obj_id]);
 
 2023                        $deps = $deps[
"dep"];
 
 2046                $res = 
$ilDB->query(
"SELECT * FROM object_description".
 
 2047                        " WHERE ".
$ilDB->in(
"obj_id", $a_obj_ids, 
"", 
"integer"));
 
 2051                        $all[
$row[
"obj_id"]] = 
$row[
"description"];
 
 2064                global 
$ilDB, $objDefinition;
 
 2069                $types = array_keys($objDefinition->getSubObjectsRecursively(
"root"));  
 
 2071                $sql = 
"SELECT od.obj_id,od.type,od.title FROM object_data od";
 
 2075                        $sql .= 
" WHERE od.owner = ".$ilDB->quote($a_user_id, 
"integer");                               
 
 2079                        $sql .= 
" LEFT JOIN usr_data ud ON (ud.usr_id = od.owner)".
 
 2080                                " WHERE (od.owner < ".$ilDB->quote(1, 
"integer").
 
 2081                                " OR od.owner IS NULL OR ud.login IS NULL)".
 
 2082                                " AND od.owner <> ".$ilDB->quote(-1, 
"integer");
 
 2085                $sql .= 
" AND ".$ilDB->in(
"od.type", $types, 
"", 
"text");
 
 2106                $set = 
$ilDB->query(
"SELECT create_date FROM object_data ".
 
 2107                        " WHERE obj_id = ".
$ilDB->quote($a_id, 
"integer"));
 
 2108                $rec  = 
$ilDB->fetchAssoc($set);
 
 2109                return $rec[
"create_date"];
 
 2124                        !in_array($a_type, array(
"file", 
"lm", 
"wiki")))
 
 2130                $parent_ref_id = $tree->checkForParentType($a_ref_id, 
"grp");
 
 2133                        $parent_ref_id = $tree->checkForParentType($a_ref_id, 
"crs");
 
 2137                        include_once 
'./Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
 
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 _getConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_target_type="")
get all conditions of target object
static lookupHiddenStatusByTarget($a_target_ref_id)
Lookup hidden status @global type $ilDB.
_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 _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 getAllOwnedRepositoryObjects($a_user_id)
Get all ids of objects user owns.
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 _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)
redirection script todo: (a better solution should control the processing via a xml file)
if(!is_array($argv)) $options