/**
  * activates or deactivates pages
  */
 function activatePages()
 {
     if (is_array($_POST["id"])) {
         foreach ($_POST["id"] as $id) {
             include_once "./Modules/LearningModule/classes/class.ilLMPage.php";
             $act = ilLMPage::_lookupActive($id, $this->object->getType());
             ilLMPage::_writeActive($id, $this->object->getType(), !$act);
         }
     }
     $this->ctrl->redirect($this, "pages");
 }
 /**
  * activates or deactivates pages
  */
 function activatePages()
 {
     global $lng;
     include_once "./Modules/LearningModule/classes/class.ilLMPage.php";
     if (is_array($_POST["id"])) {
         $act_items = array();
         // get all "top" ids, i.e. remove ids, that have a selected parent
         foreach ($_POST["id"] as $id) {
             $path = $this->tree->getPathId($id);
             $take = true;
             foreach ($path as $path_id) {
                 if ($path_id != $id && in_array($path_id, $_POST["id"])) {
                     $take = false;
                 }
             }
             if ($take) {
                 $act_items[] = $id;
             }
         }
         foreach ($act_items as $id) {
             $childs = $this->tree->getChilds($id);
             foreach ($childs as $child) {
                 if (ilLMObject::_lookupType($child["child"]) == "pg") {
                     $act = ilLMPage::_lookupActive($child["child"], $this->content_object->getType());
                     ilLMPage::_writeActive($child["child"], $this->content_object->getType(), !$act);
                 }
             }
             if (ilLMObject::_lookupType($id) == "pg") {
                 $act = ilLMPage::_lookupActive($id, $this->content_object->getType());
                 ilLMPage::_writeActive($id, $this->content_object->getType(), !$act);
             }
         }
     } else {
         ilUtil::sendFailure($lng->txt("no_checkbox"), true);
     }
     $this->ctrl->redirect($this, "view");
 }