ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilSCORM2004Sco.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 require_once("./Modules/Scorm2004/classes/class.ilSCORM2004Asset.php");
6 
18 {
19  protected $hide_obj_page = false;
20 
26  function __construct($a_slm_object, $a_id = 0)
27  {
28  parent::__construct($a_slm_object, $a_id);
29  $this->setType("sco");
30  }
31 
35  public function setHideObjectivePage($a_val)
36  {
37  $this->hide_obj_page = $a_val;
38  }
39 
43  public function getHideObjectivePage()
44  {
45  return $this->hide_obj_page;
46  }
47 
51  function create($a_upload = false, $a_template = false)
52  {
53  global $ilDB;
54 
55  parent::create($a_upload, $a_template);
56  if (!$a_template)
57  {
58  $obj = new ilSCORM2004Objective($this->getId());
59 // $obj->setObjectiveID("Objective SCO ".$this->getId());
60  $obj->setId("local_obj_".$this->getID()."_0");
61  $obj->update();
62  }
63  $ilDB->manipulate("INSERT INTO sahs_sc13_sco ".
64  "(id, hide_obj_page) VALUES (".
65  $ilDB->quote($this->getId(), "integer").",".
66  $ilDB->quote($this->getHideObjectivePage(), "integer").
67  ")");
68  }
69 
70 
71 
75  function read()
76  {
77  global $ilDB;
78 
79  parent::read();
80  $set = $ilDB->query("SELECT * FROM sahs_sc13_sco WHERE ".
81  " id = ".$ilDB->quote($this->getId(), "integer")
82  );
83  $rec = $ilDB->fetchAssoc($set);
84  $this->setHideObjectivePage($rec["hide_obj_page"]);
85  }
86 
90  function update()
91  {
92  global $ilDB;
93 
94  parent::update();
95  $ilDB->manipulate("UPDATE sahs_sc13_sco SET ".
96  " hide_obj_page = ".$ilDB->quote($this->getHideObjectivePage(), "integer").
97  " WHERE id = ".$ilDB->quote($this->getId(), "integer")
98  );
99  }
100 
104  function delete($a_delete_meta_data = true)
105  {
106  global $ilDB;
107 
108  parent::delete($a_delete_meta_data);
109  $ilDB->manipulate("DELETE FROM sahs_sc13_sco WHERE "
110  . " id = " . $ilDB->quote($this->getId(), "integer")
111  );
112  }
113 
117  function copy($a_target_slm)
118  {
119  $sco = new ilSCORM2004Sco($a_target_slm);
120  $sco->setTitle($this->getTitle());
121  $sco->setHideObjectivePage($this->getHideObjectivePage());
122  if ($this->getSLMId() != $a_target_slm->getId())
123  {
124  $sco->setImportId("il__sco_".$this->getId());
125  }
126  $sco->setSLMId($a_target_slm->getId());
127  $sco->setType($this->getType());
128  $sco->setDescription($this->getDescription());
129  $sco->create(true);
130  $a_copied_nodes[$this->getId()] = $sco->getId();
131 
132  // copy meta data
133  include_once("Services/MetaData/classes/class.ilMD.php");
134  $md = new ilMD($this->getSLMId(), $this->getId(), $this->getType());
135  $new_md = $md->cloneMD($a_target_slm->getId(), $sco->getId(), $this->getType());
136 
137  return $sco;
138  }
139 
146  {
147  $objectives = $this->getObjectives();
148 
149  foreach ($objectives as $ob)
150  {
151  // map info
152  $mappings = $ob->getMappings();
153  $mapinfo = null;
154  foreach($mappings as $map)
155  {
156  $mapinfo .= $map->getTargetObjectiveID();
157  }
158 
159  if ($mapinfo == null)
160  {
161  $mapinfo = "local";
162  }
163  else
164  {
165  $mapinfo = "global to ".$mapinfo;
166  }
167 
168  if ($mapinfo == "local")
169  {
170  return $ob->getObjectiveID();
171  }
172  }
173  }
174 
175 
176 }
177 ?>
getMainObjectiveText()
Get main objective.
Class ilSCORM2004Sco.
getSLMId()
Get ID of parent Scorm Learning Module Object.
create($a_upload=false, $a_template=false)
Create sco.
getDescription()
Get description.
__construct($a_slm_object, $a_id=0)
Constructor.
copy($a_target_slm)
Copy sco.
setHideObjectivePage($a_val)
Set hide objective page.
read()
Read data from database.
global $ilDB
Class ilSCORM2004Asset.
getHideObjectivePage()
Get hide objective page.
setType($a_type)
Set type.
Class ilSCORM2004Objective.