/**
  * Final processing
  *
  * @param	array		mapping array
  */
 function finalProcessing($a_mapping)
 {
     $pages = $a_mapping->getMappingsOfEntity("Services/COPage", "pg");
     $media_objects = $a_mapping->getMappingsOfEntity("Services/MediaObjects", "mob");
     $file_objects = $a_mapping->getMappingsOfEntity("Modules/File", "file");
     if (count($media_objects) > 0 || count($file_objects) > 0) {
         foreach ($pages as $p) {
             $id = explode(":", $p);
             if (count($id) == 2) {
                 include_once "./Services/COPage/classes/class.ilPageObject.php";
                 if (ilPageObject::_exists($id[0], $id[1])) {
                     $new_page = new ilPageObject($id[0], $id[1]);
                     $new_page->buildDom();
                     $med = $new_page->resolveMediaAliases($media_objects);
                     $fil = $new_page->resolveFileItems($file_objects);
                     if ($med || $fil) {
                         $new_page->update(false, true);
                     }
                 }
             }
         }
     }
 }
Пример #2
0
 /**
  * Update page
  *
  * @return	boolean
  */
 function update($a_validate = true, $a_no_history = false)
 {
     global $ilDB;
     $id = $this->getId();
     if ($id) {
         $fields = $this->getPropertiesForDB();
         $ilDB->update("usr_portfolio_page", $fields, array("id" => array("integer", $id)));
         parent::update($a_validate, $a_no_history);
         return true;
     }
     return false;
 }
 /**
  * Update Viewdefinition
  * @param bool $a_validate
  * @param bool $a_no_history
  * @return boolean
  */
 public function update($a_validate = true, $a_no_history = false)
 {
     //TODO
     //Page-Object updaten
     //Es wäre auch möglich direkt in der GUI-Klasse ilPageObject aufzurufen. Falls wir aber bei doCreate,
     //das Page-Object anlegen, fänd ich es sinnvoll, wenn wir auch hier das PageObject updaten würden.
     //Andernfalls sämtliche Page-Object-Methoden in der GUI-Klasse aufrufen.
     parent::update($a_validate, $a_no_history);
     return true;
 }
Пример #4
0
 /**
  * Update blog posting
  *
  * @param bool $a_validate
  * @param bool $a_no_history
  * @param bool $a_notify
  * @param string $a_notify_action
  * @return boolean
  */
 function update($a_validate = true, $a_no_history = false, $a_notify = true, $a_notify_action = "update")
 {
     global $ilDB;
     // blog_id, author and created cannot be changed
     $query = "UPDATE il_blog_posting SET" . " title = " . $ilDB->quote($this->getTitle(), "text") . ",created = " . $ilDB->quote($this->getCreated()->get(IL_CAL_DATETIME), "text") . ",approved =" . $ilDB->quote($this->isApproved(), "integer") . " WHERE id = " . $ilDB->quote($this->getId(), "integer");
     $ilDB->manipulate($query);
     parent::update($a_validate, $a_no_history);
     if ($a_notify && $this->getActive()) {
         include_once "Modules/Blog/classes/class.ilObjBlog.php";
         ilObjBlog::sendNotification($a_notify_action, $this->blog_node_is_wsp, $this->blog_node_id, $this->getId());
     }
     return true;
 }
Пример #5
0
 /**
  * update object data
  *
  * @access	public
  * @return	boolean
  */
 function update($a_validate = true, $a_no_history = false)
 {
     global $ilDB;
     parent::update($a_validate, $a_no_history);
     return true;
 }
 /**
  * Update page
  *
  * @return	boolean
  */
 function update($a_validate = true, $a_no_history = false)
 {
     global $ilDB;
     // update wiki page data
     $query = "UPDATE usr_ext_profile_page SET " . " title = " . $ilDB->quote($this->getTitle(), "text") . ",user_id = " . $ilDB->quote($this->getUserId(), "integer") . ",order_nr = " . $ilDB->quote($this->getOrderNr(), "integer") . " WHERE id = " . $ilDB->quote($this->getId(), "integer");
     $ilDB->manipulate($query);
     parent::update($a_validate, $a_no_history);
     return true;
 }
Пример #7
0
 /**
  * update object data
  *
  * @access	public
  * @return	boolean
  */
 function update($a_validate = true, $a_no_history = false)
 {
     global $ilDB;
     // update wiki page data
     $query = "UPDATE il_wiki_page SET " . " title = " . $ilDB->quote($this->getTitle(), "text") . ",wiki_id = " . $ilDB->quote((int) $this->getWikiId(), "integer") . ",blocked = " . $ilDB->quote((int) $this->getBlocked(), "integer") . ",rating = " . $ilDB->quote((int) $this->getRating(), "integer") . " WHERE id = " . $ilDB->quote($this->getId(), "integer");
     $ilDB->manipulate($query);
     $updated = parent::update($a_validate, $a_no_history);
     if ($updated === true) {
         include_once "./Services/Notification/classes/class.ilNotification.php";
         ilWikiUtil::sendNotification("update", ilNotification::TYPE_WIKI_PAGE, $this->getWikiRefId(), $this->getId());
         $this->updateNews(true);
     } else {
         return $updated;
     }
     return true;
 }
 /**
  * parse pages that contain files, mobs and/or internal links
  */
 function processPagesToParse()
 {
     /*
     		$pg_mapping = array();
     		foreach($this->pg_mapping as $key => $value)
     		{
     			$pg_mapping[$key] = "il__pg_".$value;
     		}*/
     //echo "<br><b>processIntLinks</b>"; flush();
     // outgoin internal links
     foreach ($this->pages_to_parse as $page_id) {
         $page_arr = explode(":", $page_id);
         //echo "<br>resolve:".$this->content_object->getType().":".$page_id; flush();
         switch ($page_arr[0]) {
             case "lm":
                 $page_obj =& new ilPageObject($this->content_object->getType(), $page_arr[1]);
                 break;
             case "gdf":
                 $page_obj =& new ilPageObject("gdf", $page_arr[1]);
                 break;
         }
         $page_obj->buildDom();
         $page_obj->resolveIntLinks();
         $page_obj->resolveIIMMediaAliases($this->mob_mapping);
         if (in_array($this->coType, array("lm", "dbk"))) {
             $page_obj->resolveQuestionReferences($this->qst_mapping);
         }
         $page_obj->update(false);
         if ($page_arr[0] == "gdf") {
             $def =& new ilGlossaryDefinition($page_arr[1]);
             $def->updateShortText();
         }
         unset($page_obj);
     }
     //echo "<br><b>map area internal links</b>"; flush();
     // outgoins map area (mob) internal links
     foreach ($this->mobs_with_int_links as $mob_id) {
         ilMediaItem::_resolveMapAreaLinks($mob_id);
     }
     //echo "<br><b>incoming interna links</b>"; flush();
     // incoming internal links
     $done = array();
     foreach ($this->link_targets as $link_target) {
         //echo "doin link target:".$link_target.":<br>";
         $link_arr = explode("_", $link_target);
         $target_inst = $link_arr[1];
         $target_type = $link_arr[2];
         $target_id = $link_arr[3];
         $sources = ilInternalLink::_getSourcesOfTarget($target_type, $target_id, $target_inst);
         foreach ($sources as $key => $source) {
             //echo "got source:".$key.":<br>";
             if (in_array($key, $done)) {
                 continue;
             }
             $type_arr = explode(":", $source["type"]);
             // content object pages
             if ($type_arr[1] == "pg") {
                 $page_object = new ilPageObject($type_arr[0], $source["id"]);
                 $page_object->buildDom();
                 $page_object->resolveIntLinks();
                 $page_object->update();
                 unset($page_object);
             }
             // eventually correct links in questions to learning modules
             if ($type_arr[0] == "qst") {
                 require_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
                 assQuestion::_resolveIntLinks($source["id"]);
             }
             // eventually correct links in survey questions to learning modules
             if ($type_arr[0] == "sqst") {
                 require_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
                 SurveyQuestion::_resolveIntLinks($source["id"]);
             }
             $done[$key] = $key;
         }
     }
 }
 /**
  * update object data
  *
  * @access	public
  * @return	boolean
  */
 function update($a_validate = true, $a_no_history = false)
 {
     global $ilDB;
     // maybe we need an additional table here?
     parent::update($a_validate, $a_no_history);
     return true;
 }
Пример #10
0
 /**
  * Insert content template
  *
  * @param ilPageObject $a_pg_obj page object
  * @param string $a_hier_id Hierarchical ID
  * @param string $a_pc_id pc id
  * @param int $a_page_templ template page id
  */
 function create($a_pg_obj, $a_hier_id, $a_pc_id, $a_page_templ)
 {
     $source_id = explode(":", $a_page_templ);
     $source_page = ilPageObjectFactory::getInstance($source_id[1], $source_id[0]);
     $source_page->buildDom();
     $source_page->addHierIds();
     $hier_ids = $source_page->getHierIds();
     $copy_ids = array();
     foreach ($hier_ids as $hier_id) {
         // move top level nodes only
         if (!is_int(strpos($hier_id, "_"))) {
             if ($hier_id != "pg" && $hier_id >= $a_hid) {
                 $copy_ids[] = $hier_id;
             }
         }
     }
     asort($copy_ids);
     // get the target parent node
     $pos = explode("_", $a_pos);
     array_pop($pos);
     $parent_pos = implode($pos, "_");
     if ($parent_pos != "") {
         $target_parent = $a_pg_obj->getContentNode($parent_pos);
     } else {
         $target_parent = $a_pg_obj->getNode();
     }
     //$source_parent = $source_page->getContentNode("pg");
     $curr_node = $a_pg_obj->getContentNode($a_hier_id, $a_pcid);
     foreach ($copy_ids as $copy_id) {
         $source_node = $source_page->getContentNode($copy_id);
         $new_node = $source_node->clone_node(true);
         $new_node->unlink_node($new_node);
         if ($succ_node = $curr_node->next_sibling()) {
             $succ_node->insert_before($new_node, $succ_node);
         } else {
             //echo "movin doin append_child";
             $target_parent->append_child($new_node);
         }
         //$xpc = xpath_new_context($a_pg_obj->getDomDoc());
         $xpath = new DOMXpath($a_pg_obj->getDomDoc());
         //var_dump($new_node->myDOMNode);
         //echo "-".$new_node->get_attribute("PCID")."-"; exit;
         if ($new_node->get_attribute("PCID") != "") {
             $new_node->set_attribute("PCID", "");
         }
         $els = $xpath->query(".//*[@PCID]", $new_node->myDOMNode);
         foreach ($els as $el) {
             $el->setAttribute("PCID", "");
         }
         $curr_node = $new_node;
     }
     $a_pg_obj->update();
     //$this->node = $this->createPageContentNode();
     /*$a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
     		$this->map_node =& $this->dom->create_element("Map");
     		$this->map_node =& $this->node->append_child($this->map_node);
     		$this->map_node->set_attribute("Latitude", "0");
     		$this->map_node->set_attribute("Longitude", "0");
     		$this->map_node->set_attribute("Zoom", "3");*/
 }
 /**
  * Clone container settings
  *
  * @access public
  * @param int target ref_id
  * @param int copy id
  * @return object new object 
  */
 public function cloneObject($a_target_id, $a_copy_id = 0)
 {
     $new_obj = parent::cloneObject($a_target_id, $a_copy_id);
     include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
     $sorting = new ilContainerSortingSettings($new_obj->getId());
     $sorting->setSortMode($this->getOrderType());
     $sorting->update();
     // copy content page
     include_once "./Services/COPage/classes/class.ilPageObject.php";
     if (ilPageObject::_exists($this->getType(), $this->getId())) {
         $orig_page = new ilPageObject($this->getType(), $this->getId());
         $new_page_object = new ilPageObject($this->getType());
         $new_page_object->setParentId($new_obj->getId());
         $new_page_object->setId($new_obj->getId());
         $new_page_object->createFromXML();
         $new_page_object->setXMLContent($orig_page->getXMLContent());
         $new_page_object->buildDom();
         $new_page_object->update();
     }
     return $new_obj;
 }
 /**
  * Change targest of repository links. Use full targets in "from" and "to"!!!
  *
  * @param	array	keys are the old targets, values are the new targets
  */
 static function _handleImportRepositoryLinks($a_rep_import_id, $a_rep_type, $a_rep_ref_id)
 {
     include_once "./Services/COPage/classes/class.ilInternalLink.php";
     //echo "-".$a_rep_import_id."-".$a_rep_ref_id."-";
     $sources = ilInternalLink::_getSourcesOfTarget("obj", ilInternalLink::_extractObjIdOfTarget($a_rep_import_id), ilInternalLink::_extractInstOfTarget($a_rep_import_id));
     //var_dump($sources);
     foreach ($sources as $source) {
         //echo "A";
         if ($source["type"] == "lm:pg") {
             //echo "B";
             $page_obj = new ilPageObject("lm", $source["id"], false);
             if (!$page_obj->page_not_found) {
                 //echo "C";
                 $page_obj->handleImportRepositoryLink($a_rep_import_id, $a_rep_type, $a_rep_ref_id);
             }
             $page_obj->update();
         }
     }
 }
 /**
  * Update internal links, after multiple pages have been copied
  */
 static function updateInternalLinks($a_copied_nodes, $a_parent_type = "lm")
 {
     $all_fixes = array();
     foreach ($a_copied_nodes as $original_id => $copied_id) {
         $copied_type = ilLMObject::_lookupType($copied_id);
         $copy_lm = ilLMObject::_lookupContObjID($copied_id);
         if ($copied_type == "pg") {
             //
             // 1. Outgoing links from the copied page.
             //
             //$targets = ilInternalLink::_getTargetsOfSource($a_parent_type.":pg", $copied_id);
             $tpg = new ilPageObject($a_parent_type, $copied_id);
             $tpg->buildDom();
             $il = $tpg->getInternalLinks();
             $targets = array();
             foreach ($il as $l) {
                 $targets[] = array("type" => ilInternalLink::_extractTypeOfTarget($l["Target"]), "id" => (int) ilInternalLink::_extractObjIdOfTarget($l["Target"]), "inst" => (int) ilInternalLink::_extractInstOfTarget($l["Target"]));
             }
             $fix = array();
             foreach ($targets as $target) {
                 if (($target["inst"] == 0 || ($target["inst"] = IL_INST_ID)) && ($target["type"] == "pg" || $target["type"] == "st")) {
                     // first check, whether target is also within the copied set
                     if ($a_copied_nodes[$target["id"]] > 0) {
                         $fix[$target["id"]] = $a_copied_nodes[$target["id"]];
                     } else {
                         // now check, if a copy if the target is already in the same lm
                         // only if target is not already in the same lm!
                         $trg_lm = ilLMObject::_lookupContObjID($target["id"]);
                         if ($trg_lm != $copy_lm) {
                             $lm_data = ilLMObject::_getAllObjectsForImportId("il__" . $target["type"] . "_" . $target["id"]);
                             $found = false;
                             foreach ($lm_data as $item) {
                                 if (!$found && $item["lm_id"] == $copy_lm) {
                                     $fix[$target["id"]] = $item["obj_id"];
                                     $found = true;
                                 }
                             }
                         }
                     }
                 }
             }
             // outgoing links to be fixed
             if (count($fix) > 0) {
                 //echo "<br>--".$copied_id;
                 //var_dump($fix);
                 $t = ilObject::_lookupType($copy_lm);
                 if (is_array($all_fixes[$t . ":" . $copied_id])) {
                     $all_fixes[$t . ":" . $copied_id] += $fix;
                 } else {
                     $all_fixes[$t . ":" . $copied_id] = $fix;
                 }
                 //					$page = new ilPageObject(ilObject::_lookupType($copy_lm), $copied_id);
                 //					$page->moveIntLinks($fix);
                 //					$page->update();
             }
         }
         if ($copied_type == "pg" || $copied_type == "st") {
             //
             // 2. Incoming links to the original pages
             //
             // A->B			A2			(A+B currently copied)
             // A->C			B2
             // B->A
             // C->A			C2->A		(C already copied)
             $original_lm = ilLMObject::_lookupContObjID($original_id);
             $original_type = ilObject::_lookupType($original_lm);
             if ($original_lm != $copy_lm) {
                 // This gets sources that link to A+B (so we have C here)
                 // (this also does already the trick when instance map areas are given in C)
                 // int_link, where target_type, target_id, target_inst -> ok
                 $sources = ilInternalLink::_getSourcesOfTarget($copied_type, $original_id, 0);
                 // mobs linking to $original_id
                 // map_area, where link_type, target -> ok
                 $mobs = ilMapArea::_getMobsForTarget("int", "il__" . $copied_type . "_" . $original_id);
                 // pages using these mobs
                 include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
                 foreach ($mobs as $mob) {
                     // mob_usage, where id -> ok
                     // mep_item, where foreign_id, type -> ok
                     // mep_tree, where child -> already existed
                     // il_news_item, where mob_id -> ok
                     // map_area, where link_type, target -> aready existed
                     // media_item, where id -> already existed
                     // personal_clipboard, where item_id, type -> ok
                     $usages = ilObjMediaObject::lookupUsages($mob);
                     foreach ($usages as $usage) {
                         if ($usage["type"] == "lm:pg" | $usage["type"] == "lm:st") {
                             $sources[] = $usage;
                         }
                     }
                 }
                 $fix = array();
                 foreach ($sources as $source) {
                     $stype = explode(":", $source["type"]);
                     $source_type = $stype[1];
                     if ($source_type == "pg" || $source_type == "st") {
                         // first of all: source must be in original lm
                         $src_lm = ilLMObject::_lookupContObjID($source["id"]);
                         if ($src_lm == $original_lm) {
                             // check, if a copy if the source is already in the same lm
                             // now we look for the latest copy of C in LM2
                             $lm_data = ilLMObject::_getAllObjectsForImportId("il__" . $source_type . "_" . $source["id"], $copy_lm);
                             $found = false;
                             foreach ($lm_data as $item) {
                                 if (!$found) {
                                     $fix[$item["obj_id"]][$original_id] = $copied_id;
                                     $found = true;
                                 }
                             }
                         }
                     }
                 }
                 // outgoing links to be fixed
                 if (count($fix) > 0) {
                     foreach ($fix as $page_id => $fix_array) {
                         //echo "<br>++".$page_id;
                         //var_dump($fix_array);
                         $t = ilObject::_lookupType($copy_lm);
                         if (is_array($all_fixes[$t . ":" . $page_id])) {
                             $all_fixes[$t . ":" . $page_id] += $fix_array;
                         } else {
                             $all_fixes[$t . ":" . $page_id] = $fix_array;
                         }
                         //							$page = new ilPageObject(ilObject::_lookupType($copy_lm), $page_id);
                         //							$page->moveIntLinks($fix_array);
                         //							$page->update();
                     }
                 }
             }
         }
     }
     foreach ($all_fixes as $pg => $fixes) {
         //echo "<br>**".$pg;
         //echo var_dump($fixes);
         $pg = explode(":", $pg);
         $page = new ilPageObject($pg[0], $pg[1]);
         if ($page->moveIntLinks($fixes)) {
             $page->update(true, true, true);
         }
     }
 }