Class ilObjCategory. More...
Inheritance diagram for ilObjCategory:
Collaboration diagram for ilObjCategory:Public Member Functions | |
| ilObjCategory ($a_id=0, $a_call_by_reference=true) | |
| Constructor public. | |
| delete () | |
| delete category and all related data | |
| getTranslations () | |
| get all translations from this category | |
| removeTranslations () | |
| addTranslation ($a_title, $a_desc, $a_lang, $a_lang_default) | |
| updateTranslation ($a_title, $a_desc, $a_lang, $a_lang_default) | |
Class ilObjCategory.
Definition at line 39 of file class.ilObjCategory.php.
| ilObjCategory::addTranslation | ( | $ | a_title, | |
| $ | a_desc, | |||
| $ | a_lang, | |||
| $ | a_lang_default | |||
| ) |
Definition at line 127 of file class.ilObjCategory.php.
References ilObject::getId().
{
global $ilDB;
if (empty($a_title))
{
$a_title = "NO TITLE";
}
$q = "INSERT INTO object_translation ".
"(obj_id,title,description,lang_code,lang_default) ".
"VALUES ".
"(".$ilDB->quote($this->getId()).",".
$ilDB->quote($a_title).",".$ilDB->quote($a_desc).",".
$ilDB->quote($a_lang).",".$ilDB->quote($a_lang_default).")";
$this->ilias->db->query($q);
return true;
}
Here is the call graph for this function:| ilObjCategory::delete | ( | ) |
delete category and all related data
public
Reimplemented from ilObject.
Definition at line 66 of file class.ilObjCategory.php.
References ilObjUserFolder::_updateUserFolderAssignment(), and ilObject::getId().
{
global $ilDB;
// always call parent delete function first!!
if (!parent::delete())
{
return false;
}
// put here category specific stuff
include_once('./Services/User/classes/class.ilObjUserFolder.php');
ilObjUserFolder::_updateUserFolderAssignment($this->ref_id,USER_FOLDER_ID);
$query = "DELETE FROM object_translation WHERE obj_id = ".$ilDB->quote($this->getId());
$this->ilias->db->query($query);
return true;
}
Here is the call graph for this function:| ilObjCategory::getTranslations | ( | ) |
get all translations from this category
public
Definition at line 91 of file class.ilObjCategory.php.
References $data, and ilObject::getId().
{
global $ilDB;
$q = "SELECT * FROM object_translation WHERE obj_id = ".
$ilDB->quote($this->getId())." ORDER BY lang_default DESC";
$r = $this->ilias->db->query($q);
$num = 0;
while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
{
$data["Fobject"][$num]= array("title" => $row->title,
"desc" => $row->description,
"lang" => $row->lang_code
);
$num++;
}
// first entry is always the default language
$data["default_language"] = 0;
return $data ? $data : array();
}
Here is the call graph for this function:| ilObjCategory::ilObjCategory | ( | $ | a_id = 0, |
|
| $ | a_call_by_reference = true | |||
| ) |
Constructor public.
| integer | reference_id or object_id | |
| boolean | treat the id as reference_id (true) or object_id (false) |
Definition at line 47 of file class.ilObjCategory.php.
References $ilBench.
{
global $ilBench;
$ilBench->start("Core", "ilObjCategory_Constructor");
$this->type = "cat";
$this->ilContainer($a_id,$a_call_by_reference);
$ilBench->stop("Core", "ilObjCategory_Constructor");
}
| ilObjCategory::removeTranslations | ( | ) |
Definition at line 117 of file class.ilObjCategory.php.
References ilObject::getId().
{
global $ilDB;
$q = "DELETE FROM object_translation WHERE obj_id= ".
$ilDB->quote($this->getId());
$this->ilias->db->query($q);
}
Here is the call graph for this function:| ilObjCategory::updateTranslation | ( | $ | a_title, | |
| $ | a_desc, | |||
| $ | a_lang, | |||
| $ | a_lang_default | |||
| ) |
Definition at line 148 of file class.ilObjCategory.php.
References $ilLog, and ilObject::getId().
{
global $ilDB, $ilLog;
if (empty($a_title))
{
$a_title = "NO TITLE";
}
$q = "UPDATE object_translation ".
"SET title = ". $ilDB->quote($a_title).",".
"description = ".$ilDB->quote($a_desc).",".
"lang_code = ".$ilDB->quote($a_lang) . ",".
"lang_default = ".$ilDB->quote($a_lang_default)." ".
"WHERE ".
" obj_id = ".$ilDB->quote($this->getId());
$this->ilias->db->query($q);
return true;
}
Here is the call graph for this function:
1.7.1