예제 #1
0
 /**
  * split page to next page at hierarchical id
  *
  * the main reason for this method being static is that a lm page
  * object is not available within ilPageContentGUI where this method
  * is called
  */
 function _splitPageNext($a_page_id, $a_pg_parent_type, $a_hier_id)
 {
     // get content object (learning module / digilib book)
     $lm_id = ilLMObject::_lookupContObjID($a_page_id);
     $type = ilObject::_lookupType($lm_id, false);
     switch ($type) {
         case "lm":
             include_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php";
             $cont_obj = new ilObjLearningModule($lm_id, false);
             break;
         case "dbk":
             include_once "./Modules/LearningModule/classes/class.ilObjDlBook.php";
             $cont_obj = new ilObjDlBook($lm_id, false);
             break;
     }
     $tree = new ilTree($cont_obj->getId());
     $tree->setTableNames('lm_tree', 'lm_data');
     $tree->setTreeTablePK("lm_id");
     $source_lm_page =& new ilLMPageObject($cont_obj, $a_page_id);
     $source_page =& $source_lm_page->getPageObject();
     // get next page
     $succ = $tree->fetchSuccessorNode($a_page_id, "pg");
     if ($succ["child"] > 0) {
         $target_lm_page =& new ilLMPageObject($cont_obj, $succ["child"]);
         $target_page =& $target_lm_page->getPageObject();
         $target_page->buildDom();
         $target_page->addHierIds();
         // move nodes to target page
         $source_page->buildDom();
         $source_page->addHierIds();
         ilLMPage::_moveContentAfterHierId($source_page, $target_page, $a_hier_id);
         //$source_page->deleteContentFromHierId($a_hier_id);
         return $succ["child"];
     }
 }
예제 #2
0
 /**
  * get path ids (adjacenca and nested set)
  * @group IL_Init
  * @param
  * @return
  */
 public function testAllOthers()
 {
     $tree = new ilTree(ROOT_FOLDER_ID);
     $d = $tree->getDepth(24);
     $this->assertEquals($d, 4);
     $node = $tree->getNodeData(24);
     $this->assertEquals($node['title'], 'Public chat');
     $bool = $tree->isInTree(24);
     $this->assertEquals($bool, true);
     $bool = $tree->isInTree(24242424);
     $this->assertEquals($bool, false);
     /* ref_id 14 => obj_id 98 does not exist
     		$node = $tree->getParentNodeData(24);
     		$this->assertEquals($node['title'],'Chat-Server');
     		*/
     $bool = $tree->isGrandChild(9, 24);
     $this->assertEquals($bool, 1);
     /* see above
     		$node = $tree->getNodeDataByType('chac');
     		$this->assertEquals($node[0]['title'],'Chat-Server');
     		*/
     $bool = $tree->isDeleted(24);
     $this->assertEquals($bool, false);
     $id = $tree->getParentId(24);
     $this->assertEquals($id, 14);
     $lft = $tree->getLeftValue(24);
     $this->assertEquals($lft, 14);
     $seq = $tree->getChildSequenceNumber($tree->getNodeData(24));
     $this->assertEquals($seq, 1);
     $tree->getNodePath(9, 1);
     $max_depth = $tree->getMaximumDepth();
     // Round trip
     $tree = new ilTree(ROOT_FOLDER_ID);
     $suc = $tree->fetchSuccessorNode(16);
     // cals
     $cals = $tree->fetchPredecessorNode($suc['child']);
     $this->assertEquals($cals['child'], 16);
 }
 /**
  * checks if page has a successor page
  */
 function hasSuccessorPage($a_cont_obj_id, $a_page_id)
 {
     $tree = new ilTree($a_cont_obj_id);
     $tree->setTableNames('lm_tree', 'lm_data');
     $tree->setTreeTablePK("lm_id");
     if ($tree->isInTree($a_page_id)) {
         $succ = $tree->fetchSuccessorNode($a_page_id, "pg");
         if ($succ > 0) {
             return true;
         }
     }
     return false;
 }