ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjTaxonomyAdministration.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once "./Services/Object/classes/class.ilObject.php";
5 
15 {
16  public function __construct($a_id = 0, $a_call_by_reference = true)
17  {
18  $this->type = "taxs";
19  parent::__construct($a_id,$a_call_by_reference);
20  }
21 
22  public function delete()
23  {
24  // DISABLED
25  return false;
26  }
27 
28  protected function getPath($a_ref_id)
29  {
30  global $tree;
31 
32  $res = array();
33 
34  foreach($tree->getPathFull($a_ref_id) as $data)
35  {
36  $res[] = $data['title'];
37  }
38 
39  return $res;
40  }
41 
42  public function getRepositoryTaxonomies()
43  {
44  global $ilDB, $tree;
45 
46  $res = array();
47 
48  include_once "Services/Object/classes/class.ilObjectServiceSettingsGUI.php";
49 
50  $sql = "SELECT oref.ref_id, od.obj_id, od.type obj_type, od.title obj_title,".
51  " tu.tax_id, od2.title tax_title, cs.value tax_status".
52  " FROM object_data od".
53  " JOIN object_reference oref ON (od.obj_id = oref.obj_id)".
54  " JOIN tax_usage tu ON (tu.obj_id = od.obj_id)".
55  " JOIN object_data od2 ON (od2.obj_id = tu.tax_id)".
56  " LEFT JOIN container_settings cs ON (cs.id = od.obj_id AND keyword = ".$ilDB->quote(ilObjectServiceSettingsGUI::TAXONOMIES, "text").")".
57  " WHERE od.type = ".$ilDB->quote("cat", "text"). // categories only currently
58  " AND tu.tax_id > ".$ilDB->quote(0, "integer");
59  $set = $ilDB->query($sql);
60  while($row = $ilDB->fetchAssoc($set))
61  {
62  if(!$tree->isDeleted($row["ref_id"]))
63  {
64  $res[$row["tax_id"]][$row["obj_id"]] = array(
65  "tax_id" => $row["tax_id"]
66  ,"tax_title" => $row["tax_title"]
67  ,"tax_status" => (bool)$row["tax_status"]
68  ,"obj_title" => $row["obj_title"]
69  ,"obj_type" => $row["obj_type"]
70  ,"obj_id" => $row["obj_id"]
71  ,"ref_id" => $row["ref_id"]
72  ,"path" => $this->getPath($row["ref_id"])
73  );
74  }
75  }
76 
77  return $res;
78  }
79 }
80 
81 ?>