35    public function __construct($a_slm, $a_node_id, $a_first_child, $a_confirm = 
false)
 
   39        $this->
user = $DIC->user();
 
   40        $this->lng = 
$DIC->language();
 
   41        include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Tree.php");
 
   44        $this->node_id = $a_node_id;
 
   45        $this->node = $this->tree->getNodeData($this->node_id);
 
   46        $this->current_depth = $this->node[
"depth"];
 
   48            $this->current_depth++;
 
   49            $this->current_parent = $this->node;
 
   51            $this->current_parent = $this->tree->getNodeData($this->node[
"parent"]);
 
   53        if ($this->current_parent[
"child"] == $this->tree->readRootId()) {
 
   55            $this->current_parent[
"type"] = 
"sahs";
 
   57        $this->first_child = $a_first_child;
 
   58        $this->confirm = $a_confirm;
 
   59        $this->correct = 
true;
 
   70        return $this->correct;
 
   76        $this->confirm = 
true;
 
   77        $this->perform = 
true;
 
   90        $chapters = 
$ilUser->getClipboardObjects(
"st", 
true);
 
   93            $this->current_parent[
"insert_id"] = $this->current_parent[
"child"];
 
   94            $this->target[$this->current_parent[
"insert_id"]] = 
$target;
 
   96        foreach ($chapters as $chap) {
 
   97            $chap[
"parent"] = $this->current_parent;
 
   98            $this->
addNode($chap, $this->current_parent, $this->current_depth);
 
  112        include_once(
"./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
 
  114        $this->list->setListClass(
"noStyle");
 
  116        $this->list->addListNode(
 
  118            $this->current_parent[
"title"] . 
" " .
 
  120            $this->current_parent[
"id"],
 
  126        return $this->list->getHTML();
 
  135    public function addNode($a_node, $a_parent, $a_depth)
 
  141        $lng->loadLanguageModule(
"content");
 
  144            "" => 
$lng->txt(
"cont_assign_to_parent"),
 
  145            "chap" => 
$lng->txt(
"obj_chap"),
 
  146            "sco" => 
$lng->txt(
"obj_sco"),
 
  147            "ass" => 
$lng->txt(
"obj_ass")
 
  150        if (!$this->confirm) {
 
  151            $sel = ($a_node[
"type"] != 
"pg")
 
  158            if (in_array(
$_POST[
"node"][$a_node[
"id"]], array(
"sco", 
"ass")) && in_array(
$_POST[
"node"][$a_parent[
"id"]], array(
"sco", 
"ass"))) {
 
  162                $a_parent = $a_parent[
"parent"];
 
  166            $sel = ($a_node[
"type"] != 
"pg")
 
  167                ? $sel = 
"<strong>" . 
$lng->txt(
"obj_" . 
$_POST[
"node"][$a_node[
"id"]]) . 
"</strong>" 
  169            $ctype = ($a_node[
"type"] != 
"pg")
 
  170                ? 
$_POST[
"node"][$a_node[
"id"]]
 
  173            $parent_type = $a_parent[
"type"];
 
  174            if (isset(
$_POST[
"node"][$a_parent[
"id"]])) {
 
  175                $parent_type = 
$_POST[
"node"][$a_parent[
"id"]];
 
  184                    $this->correct = 
false;
 
  188                    if (!in_array($ctype, array(
"", 
"chap", 
"sco", 
"ass"))) {
 
  189                        $error = 
'<span class="alert">' . 
$lng->txt(
"cont_type_not_allowed") . 
": " . 
$lng->txt(
"obj_" . $ctype) . 
"</span>";
 
  190                        if (
$_POST[
"node"][$a_node[
"id"]] != 
"" || $a_node[
"type"] == 
"pg") {
 
  191                            $this->correct = 
false;
 
  197                    if ($parent_type == 
"chap" && !in_array($ctype, array(
"sco", 
"ass")) ||
 
  198                        ($parent_type != 
"chap" && !in_array($ctype, array(
"pg")))) {
 
  199                        $error = 
'<span class="alert">' . 
$lng->txt(
"cont_type_not_allowed") . 
": " . 
$lng->txt(
"obj_" . $ctype) . 
"</span>";
 
  200                        if (
$_POST[
"node"][$a_node[
"id"]] != 
"" || $a_node[
"type"] == 
"pg") {
 
  201                            $this->correct = 
false;
 
  209        if (!$this->confirm || 
$_POST[
"node"][$a_node[
"id"]] != 
"" || $a_node[
"type"] == 
"pg") {
 
  210            if (!$this->perform) {
 
  211                $this->list->addListNode(
 
  213                    $a_node[
"title"] . 
" " .
 
  219                if ($a_parent[
"insert_id"] > 0) {
 
  220                    $target = $this->target[$a_parent[
"insert_id"]];
 
  225                            include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Chapter.php");
 
  227                            $chap->setTitle($a_node[
"title"]);
 
  228                            $chap->setSLMId($this->slm->getId());
 
  231                            $a_node[
"insert_id"] = $chap->getId();
 
  235                            include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Asset.php");
 
  237                            $ass->setTitle($a_node[
"title"]);
 
  238                            $ass->setSLMId($this->slm->getId());
 
  241                            $a_node[
"insert_id"] = $ass->getId();
 
  245                            include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php");
 
  247                            $sco->setTitle($a_node[
"title"]);
 
  248                            $sco->setSLMId($this->slm->getId());
 
  251                            $a_node[
"insert_id"] = $sco->getId();
 
  255                            include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
 
  256                            $copied_nodes = array();
 
  260                                $a_parent[
"insert_id"],
 
  262                                $a_node[
"insert_time"],
 
  271                    $this->target[$a_parent[
"insert_id"]] = $a_node[
"insert_id"];
 
  283        $childs = 
$ilUser->getClipboardChilds($a_node[
"id"], $a_node[
"insert_time"]);
 
  284        foreach ($childs as 
$c) {
 
  285            $c[
"parent"] = $a_node;
 
  288            $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=null, $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)