25        function __construct($a_slm, $a_node_id, $a_first_child, $a_confirm = 
false)
 
   27                include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Tree.php");
 
   30                $this->node_id = $a_node_id;
 
   31                $this->node = $this->tree->getNodeData($this->node_id);
 
   32                $this->current_depth = $this->node[
"depth"];
 
   35                        $this->current_depth++;
 
   36                        $this->current_parent = $this->node;
 
   40                        $this->current_parent = $this->tree->getNodeData($this->node[
"parent"]);
 
   42                if ($this->current_parent[
"child"] == $this->tree->readRootId())
 
   45                        $this->current_parent[
"type"] = 
"sahs";
 
   47                $this->first_child = $a_first_child;
 
   48                $this->confirm = $a_confirm;
 
   49                $this->correct = 
true;
 
   60                return $this->correct;
 
   66                $this->confirm = 
true;
 
   67                $this->perform = 
true;
 
   80                $chapters = 
$ilUser->getClipboardObjects(
"st", 
true);
 
   84                        $this->current_parent[
"insert_id"] = $this->current_parent[
"child"];
 
   85                        $this->target[$this->current_parent[
"insert_id"]] = 
$target;
 
   87                foreach ($chapters as $chap)
 
   89                        $chap[
"parent"] = $this->current_parent;
 
   90                        $this->
addNode($chap, $this->current_parent, $this->current_depth);
 
  104                include_once(
"./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
 
  106                $this->list->setListClass(
"noStyle");
 
  108                $this->list->addListNode(
 
  110                        $this->current_parent[
"title"].
" ".
 
  112                        $this->current_parent[
"id"], 0);
 
  116                return $this->list->getHTML();
 
  125        function addNode($a_node, $a_parent, $a_depth)
 
  130                $lng->loadLanguageModule(
"content");
 
  133                        "" => 
$lng->txt(
"cont_assign_to_parent"),
 
  134                        "chap" => 
$lng->txt(
"obj_chap"),
 
  135                        "sco" => 
$lng->txt(
"obj_sco"),
 
  136                        "ass" => 
$lng->txt(
"obj_ass")
 
  141                        $sel = ($a_node[
"type"] != 
"pg")
 
  150                        if (in_array(
$_POST[
"node"][$a_node[
"id"]], array(
"sco", 
"ass")) && in_array(
$_POST[
"node"][$a_parent[
"id"]], array(
"sco", 
"ass")))
 
  155                                $a_parent = $a_parent[
"parent"];
 
  159                        $sel = ($a_node[
"type"] != 
"pg")
 
  160                                ? $sel = 
"<strong>".
$lng->txt(
"obj_".$_POST[
"node"][$a_node[
"id"]]).
"</strong>" 
  162                        $ctype = ($a_node[
"type"] != 
"pg")
 
  163                                ? 
$_POST[
"node"][$a_node[
"id"]]
 
  166                        $parent_type = $a_parent[
"type"];
 
  167                        if (isset(
$_POST[
"node"][$a_parent[
"id"]]))
 
  169                                $parent_type = 
$_POST[
"node"][$a_parent[
"id"]];
 
  179                                        $this->correct = 
false;
 
  183                                        if (!in_array($ctype, array(
"", 
"chap", 
"sco", 
"ass")))
 
  185                                                $error = 
'<span class="alert">'.$lng->txt(
"cont_type_not_allowed").
": ".
$lng->txt(
"obj_".$ctype).
"</span>";
 
  186                                                if (
$_POST[
"node"][$a_node[
"id"]] != 
"" || $a_node[
"type"] == 
"pg")
 
  188                                                        $this->correct = 
false;
 
  194                                        if ($parent_type == 
"chap" && !in_array($ctype, array(
"sco", 
"ass")) ||
 
  195                                                ($parent_type != 
"chap" && !in_array($ctype, array(
"pg"))))
 
  197                                                $error = 
'<span class="alert">'.$lng->txt(
"cont_type_not_allowed").
": ".
$lng->txt(
"obj_".$ctype).
"</span>";
 
  198                                                if (
$_POST[
"node"][$a_node[
"id"]] != 
"" || $a_node[
"type"] == 
"pg")
 
  200                                                        $this->correct = 
false;
 
  208                if (!$this->confirm || 
$_POST[
"node"][$a_node[
"id"]] != 
"" || $a_node[
"type"] == 
"pg")
 
  212                                $this->list->addListNode(
 
  214                                        $a_node[
"title"].
" ".
 
  216                                        $a_node[
"id"], $a_parent[
"id"]);
 
  220                                if ($a_parent[
"insert_id"] > 0)
 
  222                                        $target = $this->target[$a_parent[
"insert_id"]];
 
  228                                                        include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Chapter.php");
 
  230                                                        $chap->setTitle($a_node[
"title"]);
 
  231                                                        $chap->setSLMId($this->slm->getId());
 
  234                                                        $a_node[
"insert_id"] = $chap->getId();
 
  238                                                        include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Asset.php");
 
  240                                                        $ass->setTitle($a_node[
"title"]);
 
  241                                                        $ass->setSLMId($this->slm->getId());
 
  244                                                        $a_node[
"insert_id"] = $ass->getId();
 
  248                                                        include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
 
  250                                                        $sco->setTitle($a_node[
"title"]);
 
  251                                                        $sco->setSLMId($this->slm->getId());
 
  254                                                        $a_node[
"insert_id"] = $sco->getId();
 
  258                                                        include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
 
  259                                                        $copied_nodes = array();
 
  261                                                                $a_node[
"insert_time"], $copied_nodes,
 
  266                                        $this->target[$a_parent[
"insert_id"]] = $a_node[
"insert_id"];
 
  281                $childs = 
$ilUser->getClipboardChilds($a_node[
"id"], $a_node[
"insert_time"]);
 
  282                foreach ($childs as $c)
 
  284                        $c[
"parent"] = $a_node;
 
  287                        $this->
addNode($c, $parent, $a_depth);
 
An exception for terminatinating execution or to throw for unit testing.
static _lookupTitle($a_id)
lookup object title
Class ilSCORM2004Chapter.
static pasteTree($a_target_slm, $a_item_id, $a_parent_id, $a_target, $a_insert_time, &$a_copied_nodes, $a_as_copy=false, $a_from_clipboard=true, $a_source_parent_type="")
Paste item (tree) from clipboard or other learning module to target scorm learning module.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static formSelect($selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
if(!is_array($argv)) $options