ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilPageObject Class Reference

Class ilPageObject. More...

+ Inheritance diagram for ilPageObject:
+ Collaboration diagram for ilPageObject:

Public Member Functions

 ilPageObject ($a_parent_type, $a_id=0, $a_old_nr=0, $a_halt=true)
 Constructor public.
 haltOnError ($a_halt)
 setRenderMd5 ($a_rendermd5)
 Set Render MD5.
 getRenderMd5 ()
 Get Render MD5.
 setRenderedContent ($a_renderedcontent)
 Set Rendered Content.
 getRenderedContent ()
 Get Rendered Content.
 setRenderedTime ($a_renderedtime)
 Set Rendered Time.
 getRenderedTime ()
 Get Rendered Time.
 setLastChange ($a_lastchange)
 Set Last Change.
 getLastChange ()
 Get Last Change.
 read ()
 read page data
 _exists ($a_parent_type, $a_id)
 checks whether page exists
 buildDom ($a_force=false)
 freeDom ()
getDom ()
 setId ($a_id)
 set id
 getId ()
 setParentId ($a_id)
 getParentId ()
 setParentType ($a_type)
 getParentType ()
 addUpdateListener (&$a_object, $a_method, $a_parameters="")
 callUpdateListeners ()
getContentObject ($a_hier_id, $a_pc_id="")
getContentNode ($a_hier_id, $a_pc_id="")
 lookforhier ($a_hier_id)
getNode ()
 setXMLContent ($a_xml, $a_encoding="UTF-8")
 set xml content of page, start with <PageObject...>, end with </PageObject>, comply with ILIAS DTD, omit MetaData, use utf-8!
 appendXMLContent ($a_xml)
 append xml content to page setXMLContent must be called before and the same encoding must be used
 getXMLContent ($a_incl_head=false)
 get xml content of page
 getXMLFromDom ($a_incl_head=false, $a_append_mobs=false, $a_append_bib=false, $a_append_str="", $a_omit_pageobject_tag=false)
 get xml content of page from dom (use this, if any changes are made to the document)
 getLanguageVariablesXML ()
 get language variables as XML
 appendLangVarXML (&$xml, $var)
 getFirstParagraphText ()
 setParagraphContent ($a_hier_id, $a_content)
 Set content of paragraph.
 setContainsIntLink ($a_contains_link)
 lm parser set this flag to true, if the page contains intern links (this method should only be called by the import parser)
 containsIntLink ()
 returns true, if page was marked as containing an intern link (via setContainsIntLink) (this method should only be called by the import parser)
 needsImportParsing ($a_parse="")
 getBibliographyXML ()
 get a xml string that contains all Bibliography elements, that are referenced by any bibitem alias in the page
 collectMediaObjects ($a_inline_only=true)
 get all media objects, that are referenced and used within the page
 getInternalLinks ()
 get all internal links that are used within the page
 collectFileItems ($a_xml="")
 get all file items that are used within the page
 getMultimediaXML ()
 get a xml string that contains all media object elements, that are referenced by any media alias in the page
 getMediaAliasElement ($a_mob_id, $a_nr=1)
 get complete media object (alias) element
 validateDom ()
 Validate the page content agains page DTD.
 addHierIDs ()
 Add hierarchical ID (e.g.
 getHierIds ()
 get all hierarchical ids
 getFirstRowIds ()
 get ids of all first table rows
 getFirstColumnIds ()
 get ids of all first table columns
 getListItemIds ()
 get ids of all list items
 getFileItemIds ()
 get ids of all file items
 stripHierIDs ()
 strip all hierarchical id attributes out of the dom tree
 addFileSizes ()
 add file sizes
 resolveIntLinks ()
 Resolves all internal link targets of the page, if targets are available (after import)
 moveIntLinks ($a_from_to)
 Move internal links from one destination to another.
 handleImportRepositoryLink ($a_rep_import_id, $a_rep_type, $a_rep_ref_id)
 createFromXML ()
 create new page object with current xml content
 updateFromXML ()
 updates page object with current xml content
 update ($a_validate=true, $a_no_history=false)
 update complete page content in db (dom xml content is used)
 delete ()
 delete page object
 saveMobUsage ($a_xml, $a_old_nr=0)
 save all usages of media objects (media aliases, media objects, internal links)
 saveFileUsage ($a_xml="", $a_old_nr=0)
 save file usages
 getLastUpdateOfIncludedElements ()
 Get last update of included elements (media objects and files).
 saveInternalLinks ($a_xml)
 save internal links of page
 create ()
 create new page (with current xml data)
 deleteContent ($a_hid, $a_update=true, $a_pcid="")
 delete content object with hierarchical id $a_hid
 deleteContents ($a_hids, $a_update=true)
 delete multiple content objects
 switchEnableMultiple ($a_hids, $a_update=true)
 gui function set enabled if is not enabled and vice versa
 deleteContentFromHierId ($a_hid, $a_update=true)
 delete content object with hierarchical id >= $a_hid
 deleteContentBeforeHierId ($a_hid, $a_update=true)
 delete content object with hierarchical id < $a_hid
 _moveContentAfterHierId (&$a_source_page, &$a_target_page, $a_hid)
 move content of hierarchical id >= $a_hid to other page
 insertContent (&$a_cont_obj, $a_pos, $a_mode=IL_INSERT_AFTER, $a_pcid="")
 insert a content node before/after a sibling or as first child of a parent
 moveContentBefore ($a_source, $a_target, $a_spcid="", $a_tpcid="")
 move content object from position $a_source before position $a_target (both hierarchical content ids)
 moveContentAfter ($a_source, $a_target, $a_spcid="", $a_tpcid="")
 move content object from position $a_source before position $a_target (both hierarchical content ids)
 bbCode2XML (&$a_content)
 transforms bbCode to corresponding xml
 insertInstIntoIDs ($a_inst, $a_res_ref_to_obj_id=true)
 inserts installation id into ids (e.g.
 highlightText ($a_text, $proglang, $autoindent)
 Highligths Text with given ProgLang.
 hasHighlighter ($hfile_ext)
 insertSourceCodeParagraphs ($a_output, $outputmode="presentation")
 depending on the SubCharacteristic and ShowLineNumbers attribute the line numbers and html tags for the syntax highlighting will be inserted using the dom xml functions
 checkPCIds ()
 Check, whether (all) page content hashes are set.
 insertPCIds ()
 Insert Page Content IDs.
 getPageContentsHashes ()
 Get page contents hashes.
 send_paragraph ($par_id, $filename)
 getFO ()
 get fo page content
 registerOfflineHandler ($handler)
 _lookupContainsDeactivatedElements ($a_id, $a_parent_type)
 lookup whether page contains deactivated elements
 getHistoryEntries ()
 Get History Entries.
 getHistoryEntry ($a_old_nr)
 Get History Entry.
 getHistoryInfo ($a_nr)
 Get information about a history entry, its predecessor and its successor.
 addChangeDivClasses ($a_hashes)
 compareVersion ($a_left, $a_right)
 Compares to revisions of the page.
 increaseViewCnt ()
 increase view cnt
 writeRenderedContent ($a_content, $a_md5)
 Write rendered content.

Static Public Member Functions

static _handleImportRepositoryLinks ($a_rep_import_id, $a_rep_type, $a_rep_ref_id)
 Change targest of repository links.
static getRecentChanges ($a_parent_type, $a_parent_id, $a_period=30)
 Get recent pages changes for parent object.
static getAllPages ($a_parent_type, $a_parent_id)
 Get all pages for parent object.
static getNewPages ($a_parent_type, $a_parent_id)
 Get new pages.
static getParentObjectContributors ($a_parent_type, $a_parent_id)
 Get all contributors for parent object.
static getPageContributors ($a_parent_type, $a_page_id)
 Get all contributors for parent object.
static getPagesWithLinks ($a_parent_type, $a_parent_id)
 Get all pages for parent object that contain internal links.

Data Fields

 $id
 $ilias
 $dom
 $xml
 $encoding
 $node
 $cur_dtd = "ilias_pg_3_10.dtd"
 $contains_int_link
 $needs_parsing
 $parent_type
 $parent_id
 $update_listeners
 $update_listener_cnt
 $offline_handler
 $dom_builded
 $history_saved

Detailed Description

Class ilPageObject.

Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id:
class.ilPageObject.php 22281 2009-11-03 12:56:18Z akill

Definition at line 52 of file class.ilPageObject.php.

Member Function Documentation

ilPageObject::_exists (   $a_parent_type,
  $a_id 
)

checks whether page exists

Parameters
string$a_parent_typeparent type
int$a_idpage id

Definition at line 241 of file class.ilPageObject.php.

References DB_FETCHMODE_ASSOC.

Referenced by ilShopPurchaseGUI\__getAbstractHTML(), ilContainer\cloneObject(), ilObjContentObject\exportHTMLPages(), ilObjContentObject\exportXMLPageObjects(), ilPaymentObjectGUI\forwardToPageObject(), ilContainerGUI\forwardToPageObject(), ilShopGUI\forwardToPageObject(), ilObjPaymentSettingsGUI\forwardToPageObject(), ilContainerGUI\getContainerPageHTML(), and ilShopGUI\getPageHTML().

{
global $ilDB;
$query = "SELECT * FROM page_object WHERE page_id = ".$ilDB->quote($a_id)." ".
"AND parent_type= ".$ilDB->quote($a_parent_type);
$set = $ilDB->query($query);
if ($row = $set->fetchRow(DB_FETCHMODE_ASSOC))
{
return true;
}
else
{
return false;
}
}

+ Here is the caller graph for this function:

static ilPageObject::_handleImportRepositoryLinks (   $a_rep_import_id,
  $a_rep_type,
  $a_rep_ref_id 
)
static

Change targest of repository links.

Use full targets in "from" and "to"!!!

Parameters
arraykeys are the old targets, values are the new targets

Definition at line 1464 of file class.ilPageObject.php.

References ilInternalLink\_extractInstOfTarget(), ilInternalLink\_extractObjIdOfTarget(), ilInternalLink\_getSourcesOfTarget(), and ilPageObject().

Referenced by ilObjContentObjectGUI\importFileObject().

{
include_once("./Services/COPage/classes/class.ilInternalLink.php");
//echo "-".$a_rep_import_id."-".$a_rep_ref_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();
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::_lookupContainsDeactivatedElements (   $a_id,
  $a_parent_type 
)

lookup whether page contains deactivated elements

Definition at line 2732 of file class.ilPageObject.php.

References DB_FETCHMODE_ASSOC.

Referenced by ilChapterHierarchyFormGUI\getChildIcon(), ilChapterHierarchyFormGUI\getChildIconAlt(), ilLMEditorExplorer\getImage(), ilLMEditorExplorer\getImageAlt(), ilObjContentObjectGUI\pages(), and ilStructureObjectGUI\view().

{
global $ilDB;
$query = "SELECT * FROM page_object WHERE page_id = ".
$ilDB->quote($a_id)." AND ".
" parent_type = ".$ilDB->quote($a_parent_type)." AND ".
" content LIKE '% Enabled=\"False\"%'";
$obj_set = $ilDB->query($query);
if ($obj_rec = $obj_set->fetchRow(DB_FETCHMODE_ASSOC))
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

ilPageObject::_moveContentAfterHierId ( $a_source_page,
$a_target_page,
  $a_hid 
)

move content of hierarchical id >= $a_hid to other page

Parameters
string$a_hidhierarchical id of content object
boolean$a_updateupdate page in db (note: update deletes all hierarchical ids in DOM!)

Definition at line 2104 of file class.ilPageObject.php.

Referenced by ilLMPageObject\_splitPageNext().

{
$hier_ids = $a_source_page->getHierIds();
$copy_ids = array();
// iterate all hierarchical ids
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);
$parent_node =& $a_target_page->getContentNode("pg");
$target_dom =& $a_target_page->getDom();
$parent_childs =& $parent_node->child_nodes();
$cnt_parent_childs = count($parent_childs);
//echo "-$cnt_parent_childs-";
$first_child =& $parent_childs[0];
foreach($copy_ids as $copy_id)
{
$source_node =& $a_source_page->getContentNode($copy_id);
$new_node =& $source_node->clone_node(true);
$new_node->unlink_node($new_node);
$source_node->unlink_node($source_node);
if($cnt_parent_childs == 0)
{
$new_node =& $parent_node->append_child($new_node);
}
else
{
//$target_dom->import_node($new_node);
$new_node =& $first_child->insert_before($new_node, $first_child);
}
$parent_childs =& $parent_node->child_nodes();
//$cnt_parent_childs++;
}
$a_target_page->update();
$a_source_page->update();
}

+ Here is the caller graph for this function:

ilPageObject::addChangeDivClasses (   $a_hashes)

Definition at line 2883 of file class.ilPageObject.php.

References $res, xpath_eval(), and xpath_new_context().

{
$xpc = xpath_new_context($this->dom);
$path = "/*[1]";
$res =& xpath_eval($xpc, $path);
$rnode = $res->nodeset[0];
//echo "A";
foreach($a_hashes as $pc_id => $h)
{
//echo "B";
if ($h["change"] != "")
{
//echo "<br>C-".$h["hier_id"]."-".$h["change"]."-";
$dc_node = $this->dom->create_element("DivClass");
$dc_node->set_attribute("HierId", $h["hier_id"]);
$dc_node->set_attribute("Class", "ilEdit".$h["change"]);
$dc_node = $rnode->append_child($dc_node);
}
}
}

+ Here is the call graph for this function:

ilPageObject::addFileSizes ( )

add file sizes

Definition at line 1215 of file class.ilPageObject.php.

References $id, $res, $size, ilObjFile\_lookupFileSize(), xpath_eval(), and xpath_new_context().

{
$xpc = xpath_new_context($this->dom);
$path = "//FileItem";
$res =& xpath_eval($xpc, $path);
for($i = 0; $i < count($res->nodeset); $i++)
{
$cnode =& $res->nodeset[$i];
$size_node =& $this->dom->create_element("Size");
$size_node =& $cnode->append_child($size_node);
$childs =& $cnode->child_nodes();
$size = "";
for($j = 0; $j < count($childs); $j++)
{
if ($childs[$j]->node_name() == "Identifier")
{
if ($childs[$j]->has_attribute("Entry"))
{
$entry = $childs[$j]->get_attribute("Entry");
$entry_arr = explode("_", $entry);
$id = $entry_arr[count($entry_arr) - 1];
require_once("./Modules/File/classes/class.ilObjFile.php");
}
}
}
$size_node->set_content($size);
}
unset($xpc);
}

+ Here is the call graph for this function:

ilPageObject::addHierIDs ( )

Add hierarchical ID (e.g.

for editing) attributes "HierId" to current dom tree. This attribute will be added to the following elements: PageObject, Paragraph, Table, TableRow, TableData. Only elements of these types are counted as "childs" here.

Hierarchical IDs have the format "x_y_z_...", e.g. "1_4_2" means: second child of fourth child of first child of page.

The PageObject element gets the special id "pg". The first child of the page starts with id 1. The next child gets the 2 and so on.

Another example: The first child of the page is a Paragraph -> id 1. The second child is a table -> id 2. The first row gets the id 2_1, the

Definition at line 1032 of file class.ilPageObject.php.

References $res, ilPageContent\incEdId(), xpath_eval(), and xpath_new_context().

Referenced by moveIntLinks().

{
$this->hier_ids = array();
$this->first_row_ids = array();
$this->first_col_ids = array();
$this->list_item_ids = array();
$this->file_item_ids = array();
// set hierarchical ids for Paragraphs, Tables, TableRows and TableData elements
$xpc = xpath_new_context($this->dom);
//$path = "//Paragraph | //Table | //TableRow | //TableData";
$sep = $path = "";
foreach ($this->id_elements as $el)
{
$path.= $sep."//".$el;
$sep = " | ";
}
$res =& xpath_eval($xpc, $path);
for($i = 0; $i < count($res->nodeset); $i++)
{
$cnode = $res->nodeset[$i];
$ctag = $cnode->node_name();
// get hierarchical id of previous sibling
$sib_hier_id = "";
while($cnode =& $cnode->previous_sibling())
{
if (($cnode->node_type() == XML_ELEMENT_NODE)
&& $cnode->has_attribute("HierId"))
{
$sib_hier_id = $cnode->get_attribute("HierId");
//$sib_hier_id = $id_attr->value();
break;
}
}
if ($sib_hier_id != "") // set id to sibling id "+ 1"
{
$node_hier_id = ilPageContent::incEdId($sib_hier_id);
$res->nodeset[$i]->set_attribute("HierId", $node_hier_id);
$this->hier_ids[] = $node_hier_id;
if ($ctag == "TableData")
{
if (substr($par_hier_id,strlen($par_hier_id)-2) == "_1")
{
$this->first_row_ids[] = $node_hier_id;
}
}
if ($ctag == "ListItem")
{
$this->list_item_ids[] = $node_hier_id;
}
if ($ctag == "FileItem")
{
$this->file_item_ids[] = $node_hier_id;
}
}
else // no sibling -> node is first child
{
// get hierarchical id of next parent
$cnode = $res->nodeset[$i];
$par_hier_id = "";
while($cnode =& $cnode->parent_node())
{
if (($cnode->node_type() == XML_ELEMENT_NODE)
&& $cnode->has_attribute("HierId"))
{
$par_hier_id = $cnode->get_attribute("HierId");
//$par_hier_id = $id_attr->value();
break;
}
}
//echo "<br>par:".$par_hier_id." ($ctag)";
if (($par_hier_id != "") && ($par_hier_id != "pg")) // set id to parent_id."_1"
{
$node_hier_id = $par_hier_id."_1";
$res->nodeset[$i]->set_attribute("HierId", $node_hier_id);
$this->hier_ids[] = $node_hier_id;
if ($ctag == "TableData")
{
$this->first_col_ids[] = $node_hier_id;
if (substr($par_hier_id,strlen($par_hier_id)-2) == "_1")
{
$this->first_row_ids[] = $node_hier_id;
}
}
if ($ctag == "ListItem")
{
$this->list_item_ids[] = $node_hier_id;
}
if ($ctag == "FileItem")
{
$this->file_item_ids[] = $node_hier_id;
}
}
else // no sibling, no parent -> first node
{
$node_hier_id = "1";
$res->nodeset[$i]->set_attribute("HierId", $node_hier_id);
$this->hier_ids[] = $node_hier_id;
}
}
}
// set special hierarchical id "pg" for pageobject
$xpc = xpath_new_context($this->dom);
$path = "//PageObject";
$res =& xpath_eval($xpc, $path);
for($i = 0; $i < count($res->nodeset); $i++) // should only be 1
{
$res->nodeset[$i]->set_attribute("HierId", "pg");
$this->hier_ids[] = "pg";
}
unset($xpc);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::addUpdateListener ( $a_object,
  $a_method,
  $a_parameters = "" 
)

Definition at line 338 of file class.ilPageObject.php.

References $update_listener_cnt.

{
$this->update_listeners[$cnt]["object"] =& $a_object;
$this->update_listeners[$cnt]["method"] = $a_method;
$this->update_listeners[$cnt]["parameters"] = $a_parameters;
$this->update_listener_cnt++;
}
ilPageObject::appendLangVarXML ( $xml,
  $var 
)

Definition at line 724 of file class.ilPageObject.php.

References $lng, and $xml.

Referenced by getLanguageVariablesXML().

{
global $lng;
$xml.= "<LV name=\"$var\" value=\"".$lng->txt("cont_".$var)."\"/>";
}

+ Here is the caller graph for this function:

ilPageObject::appendXMLContent (   $a_xml)

append xml content to page setXMLContent must be called before and the same encoding must be used

Parameters
string$a_xmlxml content

Definition at line 599 of file class.ilPageObject.php.

{
$this->xml.= $a_xml;
}
ilPageObject::bbCode2XML ( $a_content)

transforms bbCode to corresponding xml

Definition at line 2307 of file class.ilPageObject.php.

{
$a_content = eregi_replace("\[com\]","<Comment>",$a_content);
$a_content = eregi_replace("\[\/com\]","</Comment>",$a_content);
$a_content = eregi_replace("\[emp]","<Emph>",$a_content);
$a_content = eregi_replace("\[\/emp\]","</Emph>",$a_content);
$a_content = eregi_replace("\[str]","<Strong>",$a_content);
$a_content = eregi_replace("\[\/str\]","</Strong>",$a_content);
}
ilPageObject::buildDom (   $a_force = false)

Definition at line 260 of file class.ilPageObject.php.

References $ilBench, $res, domxml_open_mem(), getXMLContent(), xpath_eval(), and xpath_new_context().

Referenced by delete(), handleImportRepositoryLink(), ilLMPresentationGUI\ilMedia(), ilLMPresentationGUI\ilPage(), moveIntLinks(), and ilPageObjectGUI\showMediaFullscreen().

{
global $ilBench;
if ($this->dom_builded && !$a_force)
{
return;
}
//echo "\n<br>buildDomWith:".$this->getId().":xml:".$this->getXMLContent(true).":<br>";
$ilBench->start("ContentPresentation", "ilPageObject_buildDom");
$this->dom = @domxml_open_mem($this->getXMLContent(true), DOMXML_LOAD_VALIDATING, $error);
$ilBench->stop("ContentPresentation", "ilPageObject_buildDom");
$xpc = xpath_new_context($this->dom);
$path = "//PageObject";
$res =& xpath_eval($xpc, $path);
if (count($res->nodeset) == 1)
{
$this->node =& $res->nodeset[0];
}
if (empty($error))
{
$this->dom_builded = true;
return true;
}
else
{
return $error;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::callUpdateListeners ( )

Definition at line 347 of file class.ilPageObject.php.

References $update_listener_cnt.

Referenced by update().

{
for($i=0; $i<$this->update_listener_cnt; $i++)
{
$object =& $this->update_listeners[$i]["object"];
$method = $this->update_listeners[$i]["method"];
$parameters = $this->update_listeners[$i]["parameters"];
$object->$method($parameters);
}
}

+ Here is the caller graph for this function:

ilPageObject::checkPCIds ( )

Check, whether (all) page content hashes are set.

Definition at line 2540 of file class.ilPageObject.php.

References $dom, $res, xpath_eval(), and xpath_new_context().

Referenced by update().

{
$this->builddom();
$mydom = $this->dom;
$sep = $path = "";
foreach ($this->id_elements as $el)
{
$path.= $sep."//".$el."[not(@PCID)]";
$sep = " | ";
}
$xpc = xpath_new_context($mydom);
$res = & xpath_eval($xpc, $path);
if (count ($res->nodeset) > 0)
{
return false;
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::collectFileItems (   $a_xml = "")

get all file items that are used within the page

Definition at line 941 of file class.ilPageObject.php.

References $res, domxml_open_mem(), xpath_eval(), and xpath_new_context().

Referenced by delete(), and saveFileUsage().

{
//echo "<br>PageObject::collectFileItems[".$this->getId()."]";
// determine all media aliases of the page
if ($a_xml == "")
{
$xpc = xpath_new_context($this->dom);
$path = "//FileItem/Identifier";
$res =& xpath_eval($xpc, $path);
}
else
{
$doc = domxml_open_mem($a_xml);
$xpc = xpath_new_context($doc);
$path = "//FileItem/Identifier";
$res =& xpath_eval($xpc, $path);
}
$file_ids = array();
for($i = 0; $i < count($res->nodeset); $i++)
{
$id_arr = explode("_", $res->nodeset[$i]->get_attribute("Entry"));
$file_id = $id_arr[count($id_arr) - 1];
$file_ids[$file_id] = $file_id;
}
return $file_ids;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::collectMediaObjects (   $a_inline_only = true)

get all media objects, that are referenced and used within the page

Definition at line 829 of file class.ilPageObject.php.

References $res, ilObject\_exists(), xpath_eval(), and xpath_new_context().

Referenced by delete(), and getMultimediaXML().

{
//echo htmlentities($this->getXMLFromDom());
// determine all media aliases of the page
$xpc = xpath_new_context($this->dom);
$path = "//MediaObject/MediaAlias";
$res =& xpath_eval($xpc, $path);
$mob_ids = array();
for($i = 0; $i < count($res->nodeset); $i++)
{
$id_arr = explode("_", $res->nodeset[$i]->get_attribute("OriginId"));
$mob_id = $id_arr[count($id_arr) - 1];
$mob_ids[$mob_id] = $mob_id;
}
// determine all inline internal media links
$xpc = xpath_new_context($this->dom);
$path = "//IntLink[@Type = 'MediaObject']";
$res =& xpath_eval($xpc, $path);
for($i = 0; $i < count($res->nodeset); $i++)
{
if (($res->nodeset[$i]->get_attribute("TargetFrame") == "") ||
(!$a_inline_only))
{
$target = $res->nodeset[$i]->get_attribute("Target");
$id_arr = explode("_", $target);
if (($id_arr[1] == IL_INST_ID) ||
(substr($target, 0, 4) == "il__"))
{
$mob_id = $id_arr[count($id_arr) - 1];
if (ilObject::_exists($mob_id))
{
$mob_ids[$mob_id] = $mob_id;
}
}
}
}
return $mob_ids;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::compareVersion (   $a_left,
  $a_right 
)

Compares to revisions of the page.

Parameters
int$a_leftNr of first revision
int$a_rightNr of second revision

Definition at line 2911 of file class.ilPageObject.php.

References getId(), getParentType(), and ilPageObject().

{
global $ilDB;
// get page objects
$l_page = new ilPageObject($this->getParentType(), $this->getId(), $a_left);
$r_page = new ilPageObject($this->getParentType(), $this->getId(), $a_right);
$l_hashes = $l_page->getPageContentsHashes();
$r_hashes = $r_page->getPageContentsHashes();
// determine all deleted and changed page elements
foreach ($l_hashes as $pc_id => $h)
{
if (!isset($r_hashes[$pc_id]))
{
$l_hashes[$pc_id]["change"] = "Deleted";
}
else
{
if ($l_hashes[$pc_id]["hash"] != $r_hashes[$pc_id]["hash"])
{
$l_hashes[$pc_id]["change"] = "Modified";
$r_hashes[$pc_id]["change"] = "Modified";
include_once("./Services/COPage/mediawikidiff/class.WordLevelDiff.php");
// if modified element is a paragraph, highlight changes
if ($l_hashes[$pc_id]["content"] != "" &&
$r_hashes[$pc_id]["content"] != "")
{
$new_left = str_replace("\n", "<br />", $l_hashes[$pc_id]["content"]);
$new_right = str_replace("\n", "<br />", $r_hashes[$pc_id]["content"]);
$wldiff = new WordLevelDiff(array($new_left),
array($new_right));
$new_left = $wldiff->orig();
$new_right = $wldiff->closing();
$l_page->setParagraphContent($l_hashes[$pc_id]["hier_id"], $new_left[0]);
$r_page->setParagraphContent($l_hashes[$pc_id]["hier_id"], $new_right[0]);
}
}
}
}
// determine all new paragraphs
foreach ($r_hashes as $pc_id => $h)
{
if (!isset($l_hashes[$pc_id]))
{
$r_hashes[$pc_id]["change"] = "New";
}
}
$l_page->addChangeDivClasses($l_hashes);
$r_page->addChangeDivClasses($r_hashes);
return array("l_page" => $l_page, "r_page" => $r_page,
"l_changes" => $l_hashes, "r_changes" => $r_hashes);
}

+ Here is the call graph for this function:

ilPageObject::containsIntLink ( )

returns true, if page was marked as containing an intern link (via setContainsIntLink) (this method should only be called by the import parser)

Definition at line 782 of file class.ilPageObject.php.

References $contains_int_link.

ilPageObject::create ( )

create new page (with current xml data)

Reimplemented in ilWikiPage.

Definition at line 1944 of file class.ilPageObject.php.

References createFromXML().

{
$this->createFromXML();
}

+ Here is the call graph for this function:

ilPageObject::createFromXML ( )

create new page object with current xml content

Definition at line 1518 of file class.ilPageObject.php.

References $lng, getId(), getParentId(), getParentType(), getXMLContent(), and setXMLContent().

Referenced by create().

{
global $lng, $ilDB, $ilUser;
//echo "<br>PageObject::createFromXML[".$this->getId()."]";
if($this->getXMLContent() == "")
{
$this->setXMLContent("<PageObject></PageObject>");
}
// create object
$query = "INSERT INTO page_object (page_id, parent_id, content, parent_type, create_user, last_change_user, created, last_change) VALUES ".
"(".$ilDB->quote($this->getId()).",".
$ilDB->quote($this->getParentId()).",".
$ilDB->quote($this->getXMLContent()).
", ".$ilDB->quote($this->getParentType()).
", ".$ilDB->quote($ilUser->getId()).
", ".$ilDB->quote($ilUser->getId()).
", now(), now())";
if(!$this->ilias->db->checkQuerySize($query))
{
$this->ilias->raiseError($lng->txt("check_max_allowed_packet_size"),$this->ilias->error_obj->MESSAGE);
return false;
}
$this->ilias->db->query($query);
//echo "created page:".htmlentities($this->getXMLContent())."<br>";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::delete ( )

delete page object

Reimplemented in ilWikiPage.

Definition at line 1721 of file class.ilPageObject.php.

References $files, $GLOBALS, $mobs, ilObjFile\_deleteAllUsages(), ilObject\_exists(), ilObject\_lookupType(), buildDom(), collectFileItems(), collectMediaObjects(), getId(), getParentType(), saveInternalLinks(), and saveMobUsage().

{
global $ilDB;
$mobs = array();
$files = array();
if (!$this->page_not_found)
{
$this->buildDom();
$mobs = $this->collectMediaObjects(false);
}
// delete mob usages
$this->saveMobUsage("<dummy></dummy>");
// delete internal links
$this->saveInternalLinks("<dummy></dummy>");
// delete all file usages
include_once("./Modules/File/classes/class.ilObjFile.php");
ilObjFile::_deleteAllUsages($this->getParentType().":pg", $this->getId());
// delete page_object entry
$query = "DELETE FROM page_object ".
"WHERE page_id = ".$ilDB->quote($this->getId()).
" AND parent_type= ".$ilDB->quote($this->getParentType());
$this->ilias->db->query($query);
// delete media objects
foreach ($mobs as $mob_id)
{
if(ilObject::_lookupType($mob_id) != 'mob')
{
$GLOBALS['ilLog']->write(__METHOD__.': Type mismatch. Ignoring mob with id: '.$mob_id);
continue;
}
if (ilObject::_exists($mob_id))
{
$mob_obj =& new ilObjMediaObject($mob_id);
$mob_obj->delete();
}
}
include_once("./Modules/File/classes/class.ilObjFile.php");
foreach ($files as $file_id)
{
if (ilObject::_exists($file_id))
{
$file_obj =& new ilObjFile($file_id, false);
$file_obj->delete();
}
}
}

+ Here is the call graph for this function:

ilPageObject::deleteContent (   $a_hid,
  $a_update = true,
  $a_pcid = "" 
)

delete content object with hierarchical id $a_hid

Parameters
string$a_hidhierarchical id of content object
boolean$a_updateupdate page in db (note: update deletes all hierarchical ids in DOM!)

Definition at line 1956 of file class.ilPageObject.php.

References getContentNode(), and update().

Referenced by moveContentAfter(), and moveContentBefore().

{
$curr_node =& $this->getContentNode($a_hid, $a_pcid);
$curr_node->unlink_node($curr_node);
if ($a_update)
{
return $this->update();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::deleteContentBeforeHierId (   $a_hid,
  $a_update = true 
)

delete content object with hierarchical id < $a_hid

Parameters
string$a_hidhierarchical id of content object
boolean$a_updateupdate page in db (note: update deletes all hierarchical ids in DOM!)

Definition at line 2073 of file class.ilPageObject.php.

References getContentNode(), getHierIds(), and update().

{
$hier_ids = $this->getHierIds();
// iterate all hierarchical ids
foreach ($hier_ids as $hier_id)
{
// delete top level nodes only
if (!is_int(strpos($hier_id, "_")))
{
if ($hier_id != "pg" && $hier_id < $a_hid)
{
$curr_node =& $this->getContentNode($hier_id);
$curr_node->unlink_node($curr_node);
}
}
}
if ($a_update)
{
return $this->update();
}
}

+ Here is the call graph for this function:

ilPageObject::deleteContentFromHierId (   $a_hid,
  $a_update = true 
)

delete content object with hierarchical id >= $a_hid

Parameters
string$a_hidhierarchical id of content object
boolean$a_updateupdate page in db (note: update deletes all hierarchical ids in DOM!)

Definition at line 2043 of file class.ilPageObject.php.

References getContentNode(), getHierIds(), and update().

{
$hier_ids = $this->getHierIds();
// iterate all hierarchical ids
foreach ($hier_ids as $hier_id)
{
// delete top level nodes only
if (!is_int(strpos($hier_id, "_")))
{
if ($hier_id != "pg" && $hier_id >= $a_hid)
{
$curr_node =& $this->getContentNode($hier_id);
$curr_node->unlink_node($curr_node);
}
}
}
if ($a_update)
{
return $this->update();
}
}

+ Here is the call graph for this function:

ilPageObject::deleteContents (   $a_hids,
  $a_update = true 
)

delete multiple content objects

Parameters
string$a_hidsarray of hierarchical ids of content objects
boolean$a_updateupdate page in db (note: update deletes all hierarchical ids in DOM!)

Definition at line 1973 of file class.ilPageObject.php.

References getContentNode(), and update().

{
if (!is_array($a_hids))
{
return;
}
foreach($a_hids as $a_hid)
{
$a_hid = explode(":", $a_hid);
//echo "-".$a_hid[0]."-".$a_hid[1]."-";
$curr_node =& $this->getContentNode($a_hid[0], $a_hid[1]);
if (is_object($curr_node))
{
$parent_node = $curr_node->parent_node();
if ($parent_node->node_name() != "TableRow")
{
$curr_node->unlink_node($curr_node);
}
}
}
if ($a_update)
{
return $this->update();
}
}

+ Here is the call graph for this function:

ilPageObject::freeDom ( )

Definition at line 294 of file class.ilPageObject.php.

{
//$this->dom->free();
unset($this->dom);
}
static ilPageObject::getAllPages (   $a_parent_type,
  $a_parent_id 
)
static

Get all pages for parent object.

Parameters
string$a_parent_typeParent Type
int$a_parent_idParent ID
int$a_periodTime Period

Definition at line 3032 of file class.ilPageObject.php.

References DB_FETCHMODE_ASSOC.

{
global $ilDB;
$page_changes = array();
$q = "SELECT * FROM page_object ".
" WHERE parent_id = ".$ilDB->quote($a_parent_id).
" AND parent_type = ".$ilDB->quote($a_parent_type);
$set = $ilDB->query($q);
$pages = array();
while ($page = $set->fetchRow(DB_FETCHMODE_ASSOC))
{
$pages[$page["page_id"]] = array("date" => $page["last_change"],
"id" => $page["page_id"], "user" => $page["last_change_user"]);
}
return $pages;
}
ilPageObject::getBibliographyXML ( )

get a xml string that contains all Bibliography elements, that are referenced by any bibitem alias in the page

Definition at line 805 of file class.ilPageObject.php.

References $_GET, $ilias, and DB_FETCHMODE_ASSOC.

Referenced by getXMLFromDom().

{
global $ilias, $ilDB;
// todo: access to $_GET and $_POST variables is not
// allowed in non GUI classes!
//
// access to db table object_reference is not allowed here!
$r = $ilias->db->query("SELECT * FROM object_reference WHERE ref_id=".
$ilDB->quote($_GET["ref_id"]));
$row = $r->fetchRow(DB_FETCHMODE_ASSOC);
include_once("./classes/class.ilNestedSetXML.php");
$nested = new ilNestedSetXML();
$bibs_xml = $nested->export($row["obj_id"], "bib");
return $bibs_xml;
}

+ Here is the caller graph for this function:

& ilPageObject::getContentNode (   $a_hier_id,
  $a_pc_id = "" 
)

Definition at line 528 of file class.ilPageObject.php.

References $node, $res, xpath_eval(), and xpath_new_context().

Referenced by deleteContent(), deleteContentBeforeHierId(), deleteContentFromHierId(), deleteContents(), getContentObject(), insertContent(), setParagraphContent(), and switchEnableMultiple().

{
$xpc = xpath_new_context($this->dom);
if($a_hier_id == "pg")
{
return $this->node;
}
else
{
// get per pc id
if ($a_pc_id != "")
{
$path = "//*[@PCID = '$a_pc_id']";
$res =& xpath_eval($xpc, $path);
if (count($res->nodeset) == 1)
{
$cont_node =& $res->nodeset[0];
return $cont_node;
}
}
// fall back to hier id
$path = "//*[@HierId = '$a_hier_id']";
$res =& xpath_eval($xpc, $path);
if (count($res->nodeset) == 1)
{
$cont_node =& $res->nodeset[0];
return $cont_node;
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilPageObject::getContentObject (   $a_hier_id,
  $a_pc_id = "" 
)

Definition at line 358 of file class.ilPageObject.php.

References $_GET, $res, $tab, ilObject\_exists(), exit, and getContentNode().

Referenced by moveContentAfter(), moveContentBefore(), and switchEnableMultiple().

{
//echo ":".$a_hier_id.":";
//echo "Content:".htmlentities($this->getXMLFromDOM()).":<br>";
//echo "ilPageObject::getContentObject:hierid:".$a_hier_id.":<br>";
$cont_node =& $this->getContentNode($a_hier_id, $a_pc_id);
//echo "ilPageObject::getContentObject:nodename:".$cont_node->node_name().":<br>";
if (!is_object($cont_node))
{
return false;
}
switch($cont_node->node_name())
{
case "PageContent":
$child_node =& $cont_node->first_child();
//echo "<br>nodename:".$child_node->node_name();
switch($child_node->node_name())
{
case "Paragraph":
require_once("./Services/COPage/classes/class.ilPCParagraph.php");
$par =& new ilPCParagraph($this->dom);
$par->setNode($cont_node);
$par->setHierId($a_hier_id);
$par->setPcId($a_pc_id);
return $par;
case "Table":
if ($child_node->get_attribute("DataTable") == "y")
{
require_once("./Services/COPage/classes/class.ilPCDataTable.php");
$tab =& new ilPCDataTable($this->dom);
$tab->setNode($cont_node);
$tab->setHierId($a_hier_id);
}
else
{
require_once("./Services/COPage/classes/class.ilPCTable.php");
$tab =& new ilPCTable($this->dom);
$tab->setNode($cont_node);
$tab->setHierId($a_hier_id);
}
$tab->setPcId($a_pc_id);
return $tab;
case "MediaObject":
if ($_GET["pgEdMediaMode"] != "") {echo "ilPageObject::error media"; exit;}
//require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
require_once("./Services/COPage/classes/class.ilPCMediaObject.php");
$mal_node =& $child_node->first_child();
//echo "ilPageObject::getContentObject:nodename:".$mal_node->node_name().":<br>";
$id_arr = explode("_", $mal_node->get_attribute("OriginId"));
$mob_id = $id_arr[count($id_arr) - 1];
// allow deletion of non-existing media objects
if (!ilObject::_exists($mob_id) && in_array("delete", $_POST))
{
$mob_id = 0;
}
//$mob =& new ilObjMediaObject($mob_id);
$mob = new ilPCMediaObject($this->dom);
$mob->readMediaObject($mob_id);
//$mob->setDom($this->dom);
$mob->setNode($cont_node);
$mob->setHierId($a_hier_id);
$mob->setPcId($a_pc_id);
return $mob;
case "List":
require_once("./Services/COPage/classes/class.ilPCList.php");
$list = new ilPCList($this->dom);
$list->setNode($cont_node);
$list->setHierId($a_hier_id);
$list->setPcId($a_pc_id);
return $list;
case "FileList":
require_once("./Services/COPage/classes/class.ilPCFileList.php");
$file_list = new ilPCFileList($this->dom);
$file_list->setNode($cont_node);
$file_list->setHierId($a_hier_id);
$file_list->setPcId($a_pc_id);
return $file_list;
// note: assessment handling is forwarded to assessment gui classes
case "Question":
require_once("./Services/COPage/classes/class.ilPCQuestion.php");
$pc_question = new ilPCQuestion($this->dom);
$pc_question->setNode($cont_node);
$pc_question->setHierId($a_hier_id);
$pc_question->setPcId($a_pc_id);
return $pc_question;
case "Section":
require_once("./Services/COPage/classes/class.ilPCSection.php");
$sec = new ilPCSection($this->dom);
$sec->setNode($cont_node);
$sec->setHierId($a_hier_id);
$sec->setPcId($a_pc_id);
return $sec;
case "Resources":
require_once("./Services/COPage/classes/class.ilPCResources.php");
$res = new ilPCResources($this->dom);
$res->setNode($cont_node);
$res->setHierId($a_hier_id);
$res->setPcId($a_pc_id);
return $res;
case "Map":
require_once("./Services/COPage/classes/class.ilPCMap.php");
$map = new ilPCMap($this->dom);
$map->setNode($cont_node);
$map->setHierId($a_hier_id);
$map->setPcId($a_pc_id);
return $map;
case "Tabs":
require_once("./Services/COPage/classes/class.ilPCTabs.php");
$map = new ilPCTabs($this->dom);
$map->setNode($cont_node);
$map->setHierId($a_hier_id);
$map->setPcId($a_pc_id);
return $map;
case "Plugged":
require_once("./Services/COPage/classes/class.ilPCPlugged.php");
$plugged = new ilPCPlugged($this->dom);
$plugged->setNode($cont_node);
$plugged->setHierId($a_hier_id);
$plugged->setPcId($a_pc_id);
return $plugged;
}
break;
case "TableData":
require_once("./Services/COPage/classes/class.ilPCTableData.php");
$td =& new ilPCTableData($this->dom);
$td->setNode($cont_node);
$td->setHierId($a_hier_id);
return $td;
case "ListItem":
require_once("./Services/COPage/classes/class.ilPCListItem.php");
$td =& new ilPCListItem($this->dom);
$td->setNode($cont_node);
$td->setHierId($a_hier_id);
return $td;
case "FileItem":
require_once("./Services/COPage/classes/class.ilPCFileItem.php");
$file_item =& new ilPCFileItem($this->dom);
$file_item->setNode($cont_node);
$file_item->setHierId($a_hier_id);
return $file_item;
case "Tab":
require_once("./Services/COPage/classes/class.ilPCTab.php");
$tab =& new ilPCTab($this->dom);
$tab->setNode($cont_node);
$tab->setHierId($a_hier_id);
return $file_item;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilPageObject::getDom ( )

Definition at line 300 of file class.ilPageObject.php.

References $dom.

{
return $this->dom;
}
ilPageObject::getFileItemIds ( )

get ids of all file items

Definition at line 1186 of file class.ilPageObject.php.

{
return $this->file_item_ids;
}
ilPageObject::getFirstColumnIds ( )

get ids of all first table columns

Definition at line 1170 of file class.ilPageObject.php.

{
return $this->first_col_ids;
}
ilPageObject::getFirstParagraphText ( )

Definition at line 731 of file class.ilPageObject.php.

References $res, xpath_eval(), and xpath_new_context().

{
$xpc = xpath_new_context($this->dom);
$path = "//Paragraph[1]";
$res =& xpath_eval($xpc, $path);
if (count($res->nodeset) > 0)
{
$cont_node =& $res->nodeset[0]->parent_node();
$par =& new ilPCParagraph($this->dom);
$par->setNode($cont_node);
return $par->getText();
}
else
{
return "";
}
}

+ Here is the call graph for this function:

ilPageObject::getFirstRowIds ( )

get ids of all first table rows

Definition at line 1162 of file class.ilPageObject.php.

{
return $this->first_row_ids;
}
ilPageObject::getFO ( )

get fo page content

Definition at line 2700 of file class.ilPageObject.php.

References $xml, getXMLFromDom(), xslt_create(), xslt_free(), and xslt_process().

{
$xml = $this->getXMLFromDom(false, true, true);
$xsl = file_get_contents("./Services/COPage/xsl/page_fo.xsl");
$args = array( '/_xml' => $xml, '/_xsl' => $xsl );
$xh = xslt_create();
$params = array ();
$fo = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args, $params);
// do some replacements
$fo = str_replace("\n", "", $fo);
$fo = str_replace("<br/>", "<br>", $fo);
$fo = str_replace("<br>", "\n", $fo);
xslt_free($xh);
//
$fo = substr($fo, strpos($fo,">") + 1);
//echo "<br><b>fo:</b><br>".htmlentities($fo); flush();
return $fo;
}

+ Here is the call graph for this function:

ilPageObject::getHierIds ( )

get all hierarchical ids

Definition at line 1154 of file class.ilPageObject.php.

Referenced by deleteContentBeforeHierId(), and deleteContentFromHierId().

{
return $this->hier_ids;
}

+ Here is the caller graph for this function:

ilPageObject::getHistoryEntries ( )

Get History Entries.

Definition at line 2753 of file class.ilPageObject.php.

References DB_FETCHMODE_ASSOC, getId(), and getParentType().

{
global $ilDB;
$h_query = "SELECT * FROM page_history ".
" WHERE page_id = ".$ilDB->quote($this->getId()).
" AND parent_type = ".$ilDB->quote($this->getParentType()).
" ORDER BY hdate DESC";
$hset = $ilDB->query($h_query);
$hentries = array();
while ($hrec = $hset->fetchRow(DB_FETCHMODE_ASSOC))
{
$hrec["sortkey"] = $hrec["nr"];
$hentries[] = $hrec;
}
return $hentries;
}

+ Here is the call graph for this function:

ilPageObject::getHistoryEntry (   $a_old_nr)

Get History Entry.

Definition at line 2777 of file class.ilPageObject.php.

References $res, getId(), and getParentType().

{
global $ilDB;
$st = $ilDB->prepare("SELECT * FROM page_history ".
" WHERE page_id = ? ".
" AND parent_type = ? ".
" AND nr = ?", array("integer", "text", "integer"));
$res = $ilDB->execute($st,
array($this->getId(), $this->getParentType(), $a_old_nr));
if ($hrec = $ilDB->fetchAssoc($res))
{
return $hrec;
}
return false;
}

+ Here is the call graph for this function:

ilPageObject::getHistoryInfo (   $a_nr)

Get information about a history entry, its predecessor and its successor.

Parameters
int$a_nrNr of history entry

Definition at line 2802 of file class.ilPageObject.php.

References $res, and $ret.

{
global $ilDB;
// determine previous entry
$st = $ilDB->prepare("SELECT MAX(nr) mnr FROM page_history ".
" WHERE page_id = ".$ilDB->quote($this->getId()).
" AND parent_type = ".$ilDB->quote($this->getParentType()).
" AND nr < ?", array("integer"));
$res = $ilDB->execute($st, array($a_nr));
$row = $ilDB->fetchAssoc($res);
if ($row["mnr"] > 0)
{
$st = $ilDB->prepare("SELECT * FROM page_history ".
" WHERE page_id = ".$ilDB->quote($this->getId()).
" AND parent_type = ".$ilDB->quote($this->getParentType()).
" AND nr = ?", array("integer"));
$res = $ilDB->execute($st, array($row["mnr"]));
$row = $ilDB->fetchAssoc($res);
$ret["previous"] = $row;
}
// determine next entry
$st = $ilDB->prepare("SELECT MIN(nr) mnr FROM page_history ".
" WHERE page_id = ".$ilDB->quote($this->getId()).
" AND parent_type = ".$ilDB->quote($this->getParentType()).
" AND nr > ?", array("integer"));
$res = $ilDB->execute($st, array($a_nr));
$row = $ilDB->fetchAssoc($res);
if ($row["mnr"] > 0)
{
$st = $ilDB->prepare("SELECT * FROM page_history ".
" WHERE page_id = ".$ilDB->quote($this->getId()).
" AND parent_type = ".$ilDB->quote($this->getParentType()).
" AND nr = ?", array("integer"));
$res = $ilDB->execute($st, array($row["mnr"]));
$row = $ilDB->fetchAssoc($res);
$ret["next"] = $row;
}
// current
$st = $ilDB->prepare("SELECT * FROM page_history ".
" WHERE page_id = ".$ilDB->quote($this->getId()).
" AND parent_type = ".$ilDB->quote($this->getParentType()).
" AND nr = ?", array("integer"));
$res = $ilDB->execute($st, array($a_nr));
$row = $ilDB->fetchAssoc($res);
$ret["current"] = $row;
/*
$h_query = "SELECT * FROM page_history ".
" WHERE page_id = ".$ilDB->quote($this->getId()).
" AND parent_type = ".$ilDB->quote($this->getParentType()).
" AND nr = (".
$ilDB->quote($a_nr - 1).",".$ilDB->quote($a_nr).",".$ilDB->quote($a_nr + 1).")".
" ORDER BY hdate DESC";
$hset = $ilDB->query($h_query);
$ret = array();
while ($hrec = $hset->fetchRow(DB_FETCHMODE_ASSOC))
{
switch ($hrec["nr"])
{
case ($a_nr - 1):
$ret["previous"] = $hrec;
break;
case ($a_nr):
$ret["current"] = $hrec;
break;
case ($a_nr + 1):
$ret["next"] = $hrec;
break;
}
}
*/
return $ret;
}
ilPageObject::getInternalLinks ( )

get all internal links that are used within the page

Definition at line 875 of file class.ilPageObject.php.

References $id, $res, ilMediaItem\_getMapAreasIntLinks(), xpath_eval(), and xpath_new_context().

{
// get all internal links of the page
$xpc = xpath_new_context($this->dom);
$path = "//IntLink";
$res =& xpath_eval($xpc, $path);
$links = array();
for($i = 0; $i < count($res->nodeset); $i++)
{
$target = $res->nodeset[$i]->get_attribute("Target");
$type = $res->nodeset[$i]->get_attribute("Type");
$targetframe = $res->nodeset[$i]->get_attribute("TargetFrame");
$links[$target.":".$type.":".$targetframe] =
array("Target" => $target, "Type" => $type,
"TargetFrame" => $targetframe);
// get links (image map areas) for inline media objects
if ($type == "MediaObject" && $targetframe == "")
{
if (substr($target, 0, 4) =="il__")
{
$id_arr = explode("_", $target);
$id = $id_arr[count($id_arr) - 1];
foreach($med_links as $key => $med_link)
{
$links[$key] = $med_link;
}
}
}
//echo "<br>-:".$target.":".$type.":".$targetframe.":-";
}
unset($xpc);
// get all media aliases
$xpc = xpath_new_context($this->dom);
$path = "//MediaAlias";
$res =& xpath_eval($xpc, $path);
require_once("Services/MediaObjects/classes/class.ilMediaItem.php");
for($i = 0; $i < count($res->nodeset); $i++)
{
$oid = $res->nodeset[$i]->get_attribute("OriginId");
if (substr($oid, 0, 4) =="il__")
{
$id_arr = explode("_", $oid);
$id = $id_arr[count($id_arr) - 1];
foreach($med_links as $key => $med_link)
{
$links[$key] = $med_link;
}
}
}
unset($xpc);
return $links;
}

+ Here is the call graph for this function:

ilPageObject::getLanguageVariablesXML ( )

get language variables as XML

Definition at line 695 of file class.ilPageObject.php.

References $lng, $xml, and appendLangVarXML().

Referenced by getXMLFromDom().

{
global $lng;
$xml = "<LVs>";
$lang_vars = array("ed_insert_par", "ed_insert_code",
"ed_insert_dtable", "ed_insert_atable", "ed_insert_media", "ed_insert_list",
"ed_insert_filelist", "ed_paste_clip", "ed_edit", "ed_insert_section",
"ed_edit_prop","ed_edit_data", "ed_delete", "ed_moveafter", "ed_movebefore",
"ed_go", "ed_new_row_after", "ed_new_row_before",
"ed_new_col_after", "ed_new_col_before", "ed_delete_col",
"ed_delete_row", "ed_class", "ed_width", "ed_align_left",
"ed_align_right", "ed_align_center", "ed_align_left_float",
"ed_align_right_float", "ed_delete_item", "ed_new_item_before",
"ed_new_item_after", "ed_copy_clip", "please_select", "ed_split_page",
"ed_item_up", "ed_item_down", "ed_row_up", "ed_row_down",
"ed_col_left", "ed_col_right", "ed_split_page_next","ed_enable",
"de_activate", "ed_insert_repobj", "ed_insert_map", "ed_insert_tabs");
foreach ($lang_vars as $lang_var)
{
$this->appendLangVarXML($xml, $lang_var);
}
$xml.= "</LVs>";
return $xml;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::getLastChange ( )

Get Last Change.

Returns
string Last Change

Definition at line 182 of file class.ilPageObject.php.

{
return $this->lastchange;
}
ilPageObject::getLastUpdateOfIncludedElements ( )

Get last update of included elements (media objects and files).

This is needed for cache logic, cache must be reloaded if anything has changed.

Definition at line 1860 of file class.ilPageObject.php.

References $files, $mobs, ilObjFile\_getFilesOfObject(), ilObject\_getLastUpdateOfObjects(), ilObjMediaObject\_getMobsOfObject(), getId(), and getParentType().

{
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
include_once("./Modules/File/classes/class.ilObjFile.php");
$this->getId());
$this->getId());
$objs = array_merge($mobs, $files);
}

+ Here is the call graph for this function:

ilPageObject::getListItemIds ( )

get ids of all list items

Definition at line 1178 of file class.ilPageObject.php.

{
return $this->list_item_ids;
}
ilPageObject::getMediaAliasElement (   $a_mob_id,
  $a_nr = 1 
)

get complete media object (alias) element

Definition at line 994 of file class.ilPageObject.php.

References $res, xpath_eval(), and xpath_new_context().

{
$xpc = xpath_new_context($this->dom);
$path = "//MediaObject/MediaAlias[@OriginId='il__mob_$a_mob_id']";
$res =& xpath_eval($xpc, $path);
$mal_node =& $res->nodeset[$a_nr - 1];
$mob_node =& $mal_node->parent_node();
return $this->dom->dump_node($mob_node);
}

+ Here is the call graph for this function:

ilPageObject::getMultimediaXML ( )

get a xml string that contains all media object elements, that are referenced by any media alias in the page

Definition at line 973 of file class.ilPageObject.php.

References ilObject\_lookupType(), collectMediaObjects(), and IL_MODE_OUTPUT.

Referenced by getXMLFromDom().

{
$mob_ids = $this->collectMediaObjects();
// get xml of corresponding media objects
$mobs_xml = "";
require_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
foreach($mob_ids as $mob_id => $dummy)
{
if (ilObject::_lookupType($mob_id) == "mob")
{
$mob_obj =& new ilObjMediaObject($mob_id);
$mobs_xml .= $mob_obj->getXML(IL_MODE_OUTPUT);
}
}
return $mobs_xml;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilPageObject::getNewPages (   $a_parent_type,
  $a_parent_id 
)
static

Get new pages.

Parameters
string$a_parent_typeParent Type
int$a_parent_idParent ID

Definition at line 3058 of file class.ilPageObject.php.

References DB_FETCHMODE_ASSOC.

{
global $ilDB;
$pages = array();
$q = "SELECT * FROM page_object ".
" WHERE parent_id = ".$ilDB->quote($a_parent_id).
" AND parent_type = ".$ilDB->quote($a_parent_type).
" ORDER BY created DESC";
$set = $ilDB->query($q);
while($page = $set->fetchRow(DB_FETCHMODE_ASSOC))
{
if ($page["created"] != "0000-00-00 00:00:00")
{
$pages[] = array("created" => $page["created"],
"id" => $page["page_id"],
"user" => $page["create_user"],
);
}
}
return $pages;
}
& ilPageObject::getNode ( )

Definition at line 573 of file class.ilPageObject.php.

References $node.

Referenced by insertContent().

{
return $this->node;
}

+ Here is the caller graph for this function:

ilPageObject::getPageContentsHashes ( )

Get page contents hashes.

Definition at line 2612 of file class.ilPageObject.php.

References $dom, $res, ilPCParagraph\xml2output(), xpath_eval(), and xpath_new_context().

{
$this->builddom();
$this->addHierIds();
$mydom = $this->dom;
// get existing ids
$path = "//PageContent";
$xpc = xpath_new_context($mydom);
$res = & xpath_eval($xpc, $path);
$hashes = array();
for ($i = 0; $i < count ($res->nodeset); $i++)
{
$hier_id = $res->nodeset[$i]->get_attribute("HierId");
$pc_id = $res->nodeset[$i]->get_attribute("PCID");
$dump = $mydom->dump_node($res->nodeset[$i]);
if (($hpos = strpos($dump, ' HierId="'.$hier_id.'"')) > 0)
{
$dump = substr($dump, 0, $hpos).
substr($dump, $hpos + strlen(' HierId="'.$hier_id.'"'));
}
$childs = $res->nodeset[$i]->child_nodes();
$content = "";
if ($childs[0] && $childs[0]->node_name() == "Paragraph")
{
$content = $mydom->dump_node($childs[0]);
$content = substr($content, strpos($content, ">") + 1,
strrpos($content, "<") - (strpos($content, ">") + 1));
//var_dump($content);
$content = ilPCParagraph::xml2output($content);
//var_dump($content);
}
//$hashes[$hier_id] =
// array("PCID" => $pc_id, "hash" => md5($dump));
$hashes[$pc_id] =
array("hier_id" => $hier_id, "hash" => md5($dump), "content" => $content);
}
return $hashes;
}

+ Here is the call graph for this function:

static ilPageObject::getPageContributors (   $a_parent_type,
  $a_page_id 
)
static

Get all contributors for parent object.

Parameters
string$a_parent_typeParent Type
int$a_parent_idParent ID

Definition at line 3133 of file class.ilPageObject.php.

References ilObjUser\_lookupName().

{
global $ilDB;
$contributors = array();
$st = $ilDB->prepare("SELECT last_change_user FROM page_object ".
" WHERE page_id = ? AND parent_type = ? ".
" AND last_change_user != ?",
array("integer", "text", "integer"));
$set = $ilDB->execute($st, array($a_page_id, $a_parent_type, 0));
while ($page = $ilDB->fetchAssoc($set))
{
$contributors[$page["last_change_user"]] = 1;
}
$st = $ilDB->prepare("SELECT count(*) as cnt, page_id, user FROM page_history ".
" WHERE page_id = ? AND parent_type = ? AND user != ? ".
" GROUP BY user ",
array("integer", "text", "integer"));
$set = $ilDB->execute($st, array($a_page_id, $a_parent_type, 0));
while ($hpage = $ilDB->fetchAssoc($set))
{
$contributors[$hpage["user"]] =
$contributors[$hpage["user"]] + $hpage["cnt"];
}
$c = array();
foreach ($contributors as $k => $co)
{
$c[] = array("user_id" => $k, "pages" => $co,
"lastname" => $name["lastname"], "firstname" => $name["firstname"]);
}
return $c;
}

+ Here is the call graph for this function:

static ilPageObject::getPagesWithLinks (   $a_parent_type,
  $a_parent_id 
)
static

Get all pages for parent object that contain internal links.

Parameters
string$a_parent_typeParent Type
int$a_parent_idParent ID
int$a_periodTime Period

Definition at line 3193 of file class.ilPageObject.php.

References DB_FETCHMODE_ASSOC.

Referenced by ilLMPageObject\getPagesWithLinksList().

{
global $ilDB;
$page_changes = array();
$q = "SELECT * FROM page_object ".
" WHERE parent_id = ".$ilDB->quote($a_parent_id).
" AND parent_type = ".$ilDB->quote($a_parent_type).
" AND content LIKE '%IntLink%'";
$set = $ilDB->query($q);
$pages = array();
while ($page = $set->fetchRow(DB_FETCHMODE_ASSOC))
{
$pages[$page["page_id"]] = array("date" => $page["last_change"],
"id" => $page["page_id"], "user" => $page["last_change_user"]);
}
return $pages;
}

+ Here is the caller graph for this function:

ilPageObject::getParentId ( )

Definition at line 323 of file class.ilPageObject.php.

References $parent_id.

Referenced by createFromXML(), ilWikiPage\getWikiId(), update(), and updateFromXML().

{
}

+ Here is the caller graph for this function:

static ilPageObject::getParentObjectContributors (   $a_parent_type,
  $a_parent_id 
)
static

Get all contributors for parent object.

Parameters
string$a_parent_typeParent Type
int$a_parent_idParent ID

Definition at line 3089 of file class.ilPageObject.php.

References ilObjUser\_lookupName().

{
global $ilDB;
$contributors = array();
$st = $ilDB->prepare("SELECT last_change_user FROM page_object ".
" WHERE parent_id = ? AND parent_type = ? ".
" AND last_change_user != ?",
array("integer", "text", "integer"));
$set = $ilDB->execute($st, array($a_parent_id, $a_parent_type, 0));
while ($page = $ilDB->fetchAssoc($set))
{
$contributors[$page["last_change_user"]][$page["page_id"]] = 1;
}
$st = $ilDB->prepare("SELECT count(*) as cnt, page_id, user FROM page_history ".
" WHERE parent_id = ? AND parent_type = ? AND user != ? ".
" GROUP BY page_id, user ",
array("integer", "text", "integer"));
$set = $ilDB->execute($st, array($a_parent_id, $a_parent_type, 0));
while ($hpage = $ilDB->fetchAssoc($set))
{
$contributors[$hpage["user"]][$hpage["page_id"]] =
$contributors[$hpage["user"]][$hpage["page_id"]] + $hpage["cnt"];
}
$c = array();
foreach ($contributors as $k => $co)
{
$c[] = array("user_id" => $k, "pages" => $co,
"lastname" => $name["lastname"], "firstname" => $name["firstname"]);
}
return $c;
}

+ Here is the call graph for this function:

ilPageObject::getParentType ( )
static ilPageObject::getRecentChanges (   $a_parent_type,
  $a_parent_id,
  $a_period = 30 
)
static

Get recent pages changes for parent object.

Parameters
string$a_parent_typeParent Type
int$a_parent_idParent ID
int$a_periodTime Period

Definition at line 2991 of file class.ilPageObject.php.

References DB_FETCHMODE_ASSOC, and ilUtil\sortArray().

{
global $ilDB;
$page_changes = array();
$q = "SELECT * FROM page_object ".
" WHERE parent_id = ".$ilDB->quote($a_parent_id).
" AND parent_type = ".$ilDB->quote($a_parent_type).
" AND (TO_DAYS(now()) - TO_DAYS(last_change)) <= ".((int)$a_period);
$set = $ilDB->query($q);
while($page = $set->fetchRow(DB_FETCHMODE_ASSOC))
{
$page_changes[] = array("date" => $page["last_change"],
"id" => $page["page_id"], "type" => "page",
"user" => $page["last_change_user"]);
}
$q = "SELECT * FROM page_history ".
" WHERE parent_id = ".$ilDB->quote($a_parent_id).
" AND parent_type = ".$ilDB->quote($a_parent_type).
" AND (TO_DAYS(now()) - TO_DAYS(hdate)) <= ".((int)$a_period);
$set = $ilDB->query($q);
while ($page = $set->fetchRow(DB_FETCHMODE_ASSOC))
{
$page_changes[] = array("date" => $page["hdate"],
"id" => $page["page_id"], "type" => "hist", "nr" => $page["nr"],
"user" => $page["user"]);
}
$page_changes = ilUtil::sortArray($page_changes, "date", "desc");
return $page_changes;
}

+ Here is the call graph for this function:

ilPageObject::getRenderedContent ( )

Get Rendered Content.

Returns
string Rendered Content

Definition at line 142 of file class.ilPageObject.php.

{
return $this->renderedcontent;
}
ilPageObject::getRenderedTime ( )

Get Rendered Time.

Returns
string Rendered Time

Definition at line 162 of file class.ilPageObject.php.

{
return $this->renderedtime;
}
ilPageObject::getRenderMd5 ( )

Get Render MD5.

Returns
string Render MD5

Definition at line 122 of file class.ilPageObject.php.

{
return $this->rendermd5;
}
ilPageObject::getXMLContent (   $a_incl_head = false)

get xml content of page

Definition at line 608 of file class.ilPageObject.php.

References $xml.

Referenced by buildDom(), ilWikiPage\create(), createFromXML(), ilLMPresentationGUI\ilCitation(), and updateFromXML().

{
// build full http path for XML DOCTYPE header.
// Under windows a relative path doesn't work :-(
if($a_incl_head)
{
//echo "+".$this->encoding."+";
$enc_str = (!empty($this->encoding))
? "encoding=\"".$this->encoding."\""
: "";
return "<?xml version=\"1.0\" $enc_str ?>".
"<!DOCTYPE PageObject SYSTEM \"".ILIAS_ABSOLUTE_PATH."/xml/".$this->cur_dtd."\">".
$this->xml;
}
else
{
return $this->xml;
}
}

+ Here is the caller graph for this function:

ilPageObject::getXMLFromDom (   $a_incl_head = false,
  $a_append_mobs = false,
  $a_append_bib = false,
  $a_append_str = "",
  $a_omit_pageobject_tag = false 
)

get xml content of page from dom (use this, if any changes are made to the document)

Definition at line 632 of file class.ilPageObject.php.

References $mobs, $xml, getBibliographyXML(), getLanguageVariablesXML(), and getMultimediaXML().

Referenced by getFO(), and update().

{
if ($a_incl_head)
{
//echo "\n<br>#".$this->encoding."#";
return $this->dom->dump_mem(0, $this->encoding);
}
else
{
// append multimedia object elements
if ($a_append_mobs || $a_append_bib || $a_append_link_info)
{
$mobs = "";
$bibs = "";
if ($a_append_mobs)
{
$mobs =& $this->getMultimediaXML();
}
if ($a_append_bib)
{
$bibs =& $this->getBibliographyXML();
}
$trans =& $this->getLanguageVariablesXML();
return "<dummy>".$this->dom->dump_node($this->node).$mobs.$bibs.$trans.$a_append_str."</dummy>";
}
else
{
if (is_object($this->dom))
{
if ($a_omit_pageobject_tag)
{
$xml = "";
$childs =& $this->node->child_nodes();
for($i = 0; $i < count($childs); $i++)
{
$xml.= $this->dom->dump_node($childs[$i]);
}
return $xml;
}
else
{
$xml = $this->dom->dump_mem(0, $this->encoding);
$xml = eregi_replace("<\?xml[^>]*>","",$xml);
$xml = eregi_replace("<!DOCTYPE[^>]*>","",$xml);
return $xml;
// don't use dump_node. This gives always entities.
//return $this->dom->dump_node($this->node);
}
}
else
{
return "";
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::haltOnError (   $a_halt)

Definition at line 102 of file class.ilPageObject.php.

{
$this->halt_on_error = $a_halt;
}
ilPageObject::handleImportRepositoryLink (   $a_rep_import_id,
  $a_rep_type,
  $a_rep_ref_id 
)

Definition at line 1491 of file class.ilPageObject.php.

References $res, buildDom(), xpath_eval(), and xpath_new_context().

{
$this->buildDom();
// resolve normal internal links
$xpc = xpath_new_context($this->dom);
$path = "//IntLink";
$res =& xpath_eval($xpc, $path);
//echo "1";
for($i = 0; $i < count($res->nodeset); $i++)
{
//echo "2";
$target = $res->nodeset[$i]->get_attribute("Target");
$type = $res->nodeset[$i]->get_attribute("Type");
if ($target == $a_rep_import_id && $type == "RepositoryItem")
{
//echo "setting:"."il__".$a_rep_type."_".$a_rep_ref_id;
$res->nodeset[$i]->set_attribute("Target",
"il__".$a_rep_type."_".$a_rep_ref_id);
}
}
unset($xpc);
}

+ Here is the call graph for this function:

ilPageObject::hasHighlighter (   $hfile_ext)

Definition at line 2428 of file class.ilPageObject.php.

Referenced by highlightText().

{
return file_exists ("Services/COPage/syntax_highlight/php/HFile/HFile_".$hfile_ext.".php");
}

+ Here is the caller graph for this function:

ilPageObject::highlightText (   $a_text,
  $proglang,
  $autoindent 
)

Highligths Text with given ProgLang.

Definition at line 2406 of file class.ilPageObject.php.

References hasHighlighter().

Referenced by insertSourceCodeParagraphs().

{
if (!$this->hasHighlighter($proglang)) {
$proglang="plain";
}
require_once("./Services/COPage/syntax_highlight/php/HFile/HFile_".$proglang.".php");
$classname = "HFile_$proglang";
$h_instance = new $classname();
if ($autoindent == "n") {
$h_instance ->notrim = 1;
$h_instance ->indent = array ("");
$h_instance ->unindent = array ("");
}
$highlighter = new Core($h_instance, new Output_css());
$a_text = $highlighter->highlight_text(html_entity_decode($a_text));
return $a_text;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::ilPageObject (   $a_parent_type,
  $a_id = 0,
  $a_old_nr = 0,
  $a_halt = true 
)

Constructor public.

Definition at line 75 of file class.ilPageObject.php.

References $ilias, and read().

Referenced by _handleImportRepositoryLinks(), and compareVersion().

{
global $ilias;
$this->parent_type = $a_parent_type;
$this->id = $a_id;
$this->ilias =& $ilias;
$this->contains_int_link = false;
$this->needs_parsing = false;
$this->update_listeners = array();
$this->update_listener_cnt = 0;
$this->dom_builded = false;
$this->halt_on_error = $a_halt;
$this->page_not_found = false;
$this->old_nr = $a_old_nr;
$this->encoding = "UTF-8";
$this->id_elements =
array("PageContent", "TableRow", "TableData", "ListItem", "FileItem",
"Section", "Tab");
if($a_id != 0)
{
$this->read();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::increaseViewCnt ( )

increase view cnt

Definition at line 2973 of file class.ilPageObject.php.

References getId(), and getParentType().

{
global $ilDB;
$q = "UPDATE page_object ".
" SET view_cnt = view_cnt + 1 ".
" WHERE page_id = ".$ilDB->quote($this->getId()).
" AND parent_type = ".$ilDB->quote($this->getParentType());
$ilDB->query($q);
}

+ Here is the call graph for this function:

ilPageObject::insertContent ( $a_cont_obj,
  $a_pos,
  $a_mode = IL_INSERT_AFTER,
  $a_pcid = "" 
)

insert a content node before/after a sibling or as first child of a parent

Definition at line 2161 of file class.ilPageObject.php.

References getContentNode(), getNode(), IL_INSERT_AFTER, IL_INSERT_BEFORE, and IL_INSERT_CHILD.

Referenced by moveContentAfter(), and moveContentBefore().

{
// move mode into container elements is always INSERT_CHILD
$curr_node = $this->getContentNode($a_pos, $a_pcid);
$curr_name = $curr_node->node_name();
if (($curr_name == "TableData") || ($curr_name == "PageObject") ||
($curr_name == "ListItem") || ($curr_name == "Section")
|| ($curr_name == "Tab"))
{
$a_mode = IL_INSERT_CHILD;
}
$hid = $curr_node->get_attribute("HierId");
if ($hid != "")
{
//echo "-".$a_pos."-".$hid."-";
$a_pos = $hid;
}
if($a_mode != IL_INSERT_CHILD) // determine parent hierarchical id
{ // of sibling at $a_pos
$pos = explode("_", $a_pos);
$target_pos = array_pop($pos);
$parent_pos = implode($pos, "_");
}
else // if we should insert a child, $a_pos is alreade the hierarchical id
{ // of the parent node
$parent_pos = $a_pos;
}
// get the parent node
if($parent_pos != "")
{
$parent_node =& $this->getContentNode($parent_pos);
}
else
{
$parent_node =& $this->getNode();
}
// count the parent children
$parent_childs =& $parent_node->child_nodes();
$cnt_parent_childs = count($parent_childs);
//echo "ZZ$a_mode";
switch ($a_mode)
{
// insert new node after sibling at $a_pos
$new_node =& $a_cont_obj->getNode();
//$a_pos = ilPageContent::incEdId($a_pos);
//$curr_node =& $this->getContentNode($a_pos);
//echo "behind $a_pos:";
if($succ_node =& $curr_node->next_sibling())
{
$new_node =& $succ_node->insert_before($new_node, $succ_node);
}
else
{
//echo "movin doin append_child";
$new_node =& $parent_node->append_child($new_node);
}
$a_cont_obj->setNode($new_node);
break;
//echo "INSERT_BEF";
$new_node =& $a_cont_obj->getNode();
$succ_node =& $this->getContentNode($a_pos);
$new_node =& $succ_node->insert_before($new_node, $succ_node);
$a_cont_obj->setNode($new_node);
break;
// insert new node as first child of parent $a_pos (= $a_parent)
//echo "insert as child:parent_childs:$cnt_parent_childs:<br>";
$new_node =& $a_cont_obj->getNode();
if($cnt_parent_childs == 0)
{
$new_node =& $parent_node->append_child($new_node);
}
else
{
$new_node =& $parent_childs[0]->insert_before($new_node, $parent_childs[0]);
}
$a_cont_obj->setNode($new_node);
//echo "PP";
break;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::insertInstIntoIDs (   $a_inst,
  $a_res_ref_to_obj_id = true 
)

inserts installation id into ids (e.g.

il__pg_4 -> il_23_pg_4) this is needed for xml export of page

Definition at line 2321 of file class.ilPageObject.php.

References $id, $res, ilObject\_lookupObjId(), ilObject\_lookupType(), xpath_eval(), and xpath_new_context().

{
// insert inst id into internal links
$xpc = xpath_new_context($this->dom);
$path = "//IntLink";
$res =& xpath_eval($xpc, $path);
for($i = 0; $i < count($res->nodeset); $i++)
{
$target = $res->nodeset[$i]->get_attribute("Target");
$type = $res->nodeset[$i]->get_attribute("Type");
if (substr($target, 0, 4) == "il__")
{
$id = substr($target, 4, strlen($target) - 4);
// convert repository links obj_<ref_id> to <type>_<obj_id>
if ($a_res_ref_to_obj_id && $type == "RepositoryItem")
{
$id_arr = explode("_", $id);
$obj_id = ilObject::_lookupObjId($id_arr[1]);
$otype = ilObject::_lookupType($obj_id);
if ($obj_id > 0)
{
$id = $otype."_".$obj_id;
}
}
$new_target = "il_".$a_inst."_".$id;
$res->nodeset[$i]->set_attribute("Target", $new_target);
}
}
unset($xpc);
// insert inst id into media aliases
$xpc = xpath_new_context($this->dom);
$path = "//MediaAlias";
$res =& xpath_eval($xpc, $path);
for($i = 0; $i < count($res->nodeset); $i++)
{
$origin_id = $res->nodeset[$i]->get_attribute("OriginId");
if (substr($origin_id, 0, 4) == "il__")
{
$new_id = "il_".$a_inst."_".substr($origin_id, 4, strlen($origin_id) - 4);
$res->nodeset[$i]->set_attribute("OriginId", $new_id);
}
}
unset($xpc);
// insert inst id file item identifier entries
$xpc = xpath_new_context($this->dom);
$path = "//FileItem/Identifier";
$res =& xpath_eval($xpc, $path);
for($i = 0; $i < count($res->nodeset); $i++)
{
$origin_id = $res->nodeset[$i]->get_attribute("Entry");
if (substr($origin_id, 0, 4) == "il__")
{
$new_id = "il_".$a_inst."_".substr($origin_id, 4, strlen($origin_id) - 4);
$res->nodeset[$i]->set_attribute("Entry", $new_id);
}
}
unset($xpc);
// insert inst id into
$xpc = xpath_new_context($this->dom);
$path = "//Question";
$res =& xpath_eval($xpc, $path);
for($i = 0; $i < count($res->nodeset); $i++)
{
$qref = $res->nodeset[$i]->get_attribute("QRef");
//echo "<br>setted:".$qref;
if (substr($qref, 0, 4) == "il__")
{
$new_id = "il_".$a_inst."_".substr($qref, 4, strlen($qref) - 4);
//echo "<br>setting:".$new_id;
$res->nodeset[$i]->set_attribute("QRef", $new_id);
}
}
unset($xpc);
}

+ Here is the call graph for this function:

ilPageObject::insertPCIds ( )

Insert Page Content IDs.

Definition at line 2565 of file class.ilPageObject.php.

References $dom, $id, $node, $res, xpath_eval(), and xpath_new_context().

Referenced by update().

{
$this->builddom();
$mydom = $this->dom;
$pcids = array();
$sep = $path = "";
foreach ($this->id_elements as $el)
{
$path.= $sep."//".$el."[@PCID]";
$sep = " | ";
}
// get existing ids
$xpc = xpath_new_context($mydom);
$res = & xpath_eval($xpc, $path);
for ($i = 0; $i < count ($res->nodeset); $i++)
{
$node = $res->nodeset[$i];
$pcids[] = $node->get_attribute("PCID");
}
// add missing ones
$sep = $path = "";
foreach ($this->id_elements as $el)
{
$path.= $sep."//".$el."[not(@PCID)]";
$sep = " | ";
}
$xpc = xpath_new_context($mydom);
$res = & xpath_eval($xpc, $path);
for ($i = 0; $i < count ($res->nodeset); $i++)
{
$node = $res->nodeset[$i];
$id = ilUtil::randomHash(10, $pcids);
$pcids[] = $id;
//echo "setting-".$id."-";
$res->nodeset[$i]->set_attribute("PCID", $id);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::insertSourceCodeParagraphs (   $a_output,
  $outputmode = "presentation" 
)

depending on the SubCharacteristic and ShowLineNumbers attribute the line numbers and html tags for the syntax highlighting will be inserted using the dom xml functions

Definition at line 2437 of file class.ilPageObject.php.

References $n, $res, highlightText(), xpath_eval(), and xpath_new_context().

{
$xpc = xpath_new_context($this->dom);
$path = "//Paragraph"; //"[@Characteristic = 'Code']";
$res = & xpath_eval($xpc, $path);
for($i = 0; $i < count($res->nodeset); $i++)
{
$context_node = $res->nodeset[$i];
$char = $context_node->get_attribute('Characteristic');
if ($char != "Code")
continue;
$n = $context_node->parent_node();
$char = $context_node->get_attribute('Characteristic');
$subchar = $context_node->get_attribute('SubCharacteristic');
$showlinenumbers = $context_node->get_attribute('ShowLineNumbers');
$downloadtitle = $context_node->get_attribute('DownloadTitle');
$autoindent = $context_node->get_attribute('AutoIndent');
$content = "";
// get XML Content
$childs = $context_node->child_nodes();
for($j=0; $j<count($childs); $j++)
{
$content .= $this->dom->dump_node($childs[$j]);
}
while ($context_node->has_child_nodes ())
{
$node_del = $context_node->first_child ();
$context_node->remove_child ($node_del);
}
$content = str_replace("<br />", "<br/>", utf8_decode($content) );
$content = str_replace("<br/>", "\n", $content);
$rownums = count(split ("\n",$content));
$plain_content = html_entity_decode($content);
$plain_content = preg_replace ("/\&#x([1-9a-f]{2});?/ise","chr (base_convert (\\1, 16, 10))",$plain_content);
$plain_content = preg_replace ("/\&#(\d+);?/ise","chr (\\1)",$plain_content);
$content = utf8_encode($this->highlightText($plain_content, $subchar, $autoindent));
$content = str_replace("&amp;lt;", "&lt;", $content);
$content = str_replace("&amp;gt;", "&gt;", $content);
// $content = str_replace("&", "&amp;", $content);
//var_dump($content);
$rows = "<TR valign=\"top\">";
$rownumbers = "";
$linenumbers= "";
//if we have to show line numbers
if (strcmp($showlinenumbers,"y")==0)
{
$linenumbers = "<TD nowrap=\"nowrap\" class=\"ilc_LineNumbers\" >";
$linenumbers .= "<PRE class=\"ilc_Code\">";
for ($j=0; $j < $rownums; $j++)
{
$indentno = strlen($rownums) - strlen($j+1) + 2;
$rownumeration = ($j+1);
$linenumbers .= "<span class=\"ilc_LineNumber\">$rownumeration</span>";
if ($j < $rownums-1)
{
$linenumbers .= "\n";
}
}
$linenumbers .= "</PRE>";
$linenumbers .= "</TD>";
}
$rows .= $linenumbers."<TD class=\"ilc_Sourcecode\"><PRE class=\"ilc_Code\">".$content."</PRE></TD>";
$rows .= "</TR>";
// fix for ie explorer which is not able to produce empty line feeds with <br /><br />;
// workaround: add a space after each br.
$newcontent = str_replace("\n", "<br/>",$rows);
// fix for IE
$newcontent = str_replace("<br/><br/>", "<br/> <br/>",$newcontent);
// falls drei hintereinander...
$newcontent = str_replace("<br/><br/>", "<br/> <br/>",$newcontent);
//$context_node->set_content($newcontent);
//var_dump($newcontent);
$a_output = str_replace("[[[[[Code;".($i + 1)."]]]]]", $newcontent, $a_output);
if ($outputmode != "presentation" && is_object($this->offline_handler)
&& trim($downloadtitle) != "")
{
// call code handler for offline versions
$this->offline_handler->handleCodeParagraph ($this->id, $i + 1, $downloadtitle, $plain_content);
}
}
return $a_output;
}

+ Here is the call graph for this function:

ilPageObject::lookforhier (   $a_hier_id)

Definition at line 561 of file class.ilPageObject.php.

References $res, xpath_eval(), and xpath_new_context().

{
$xpc = xpath_new_context($this->dom);
$path = "//*[@HierId = '$a_hier_id']";
$res =& xpath_eval($xpc, $path);
if (count($res->nodeset) == 1)
return "YES";
else
return "NO";
}

+ Here is the call graph for this function:

ilPageObject::moveContentAfter (   $a_source,
  $a_target,
  $a_spcid = "",
  $a_tpcid = "" 
)

move content object from position $a_source before position $a_target (both hierarchical content ids)

Definition at line 2283 of file class.ilPageObject.php.

References deleteContent(), getContentObject(), IL_INSERT_AFTER, insertContent(), and update().

{
if($a_source == $a_target)
{
return;
}
// clone the node
$content =& $this->getContentObject($a_source, $a_spcid);
$source_node =& $content->getNode();
$clone_node =& $source_node->clone_node(true);
// delete source node
$this->deleteContent($a_source, false, $a_spcid);
// insert cloned node at target
$content->setNode($clone_node);
$this->insertContent($content, $a_target, IL_INSERT_AFTER, $a_tpcid);
return $this->update();
}

+ Here is the call graph for this function:

ilPageObject::moveContentBefore (   $a_source,
  $a_target,
  $a_spcid = "",
  $a_tpcid = "" 
)

move content object from position $a_source before position $a_target (both hierarchical content ids)

Definition at line 2257 of file class.ilPageObject.php.

References deleteContent(), getContentObject(), IL_INSERT_BEFORE, insertContent(), and update().

{
if($a_source == $a_target)
{
return;
}
// clone the node
$content =& $this->getContentObject($a_source, $a_spcid);
$source_node =& $content->getNode();
$clone_node =& $source_node->clone_node(true);
// delete source node
$this->deleteContent($a_source, false, $a_spcid);
// insert cloned node at target
$content->setNode($clone_node);
$this->insertContent($content, $a_target, IL_INSERT_BEFORE, $a_tpcid);
return $this->update();
}

+ Here is the call graph for this function:

ilPageObject::moveIntLinks (   $a_from_to)

Move internal links from one destination to another.

This is used for pages and structure links. Just use IDs in "from" and "to".

Parameters
arraykeys are the old targets, values are the new targets

Definition at line 1305 of file class.ilPageObject.php.

References $id, $res, $t, ilInternalLink\_extractObjIdOfTarget(), ilLMObject\_lookupType(), addHierIDs(), buildDom(), xpath_eval(), and xpath_new_context().

{
$this->buildDom();
// resolve normal internal links
$xpc = xpath_new_context($this->dom);
$path = "//IntLink";
$res =& xpath_eval($xpc, $path);
for($i = 0; $i < count($res->nodeset); $i++)
{
$target = $res->nodeset[$i]->get_attribute("Target");
$type = $res->nodeset[$i]->get_attribute("Type");
if ($a_from_to[$obj_id] > 0 && is_int(strpos($target, "__")))
{
if ($type == "PageObject" && ilLMObject::_lookupType($a_from_to[$obj_id]) == "pg")
{
$res->nodeset[$i]->set_attribute("Target", "il__pg_".$a_from_to[$obj_id]);
}
if ($type == "StructureObject" && ilLMObject::_lookupType($a_from_to[$obj_id]) == "st")
{
$res->nodeset[$i]->set_attribute("Target", "il__st_".$a_from_to[$obj_id]);
}
}
}
unset($xpc);
// map areas
$this->addHierIDs();
$xpc = xpath_new_context($this->dom);
$path = "//MediaAlias";
$res =& xpath_eval($xpc, $path);
require_once("Services/MediaObjects/classes/class.ilMediaItem.php");
require_once("Services/COPage/classes/class.ilMediaAliasItem.php");
for($i = 0; $i < count($res->nodeset); $i++)
{
$media_object_node = $res->nodeset[$i]->parent_node();
$page_content_node = $media_object_node->parent_node();
$c_hier_id = $page_content_node->get_attribute("HierId");
// first check, wheter we got instance map areas -> take these
$std_alias_item = new ilMediaAliasItem($this->dom,
$c_hier_id, "Standard");
$areas = $std_alias_item->getMapAreas();
$correction_needed = false;
if (count($areas) > 0)
{
// check if correction needed
foreach($areas as $area)
{
if ($area["Type"] == "PageObject" ||
$area["Type"] == "StructureObject")
{
$t = $area["Target"];
$tid = _extractObjIdOfTarget($t);
if ($a_from_to[$tid] > 0)
{
$correction_needed = true;
}
}
}
}
else
{
$areas = array();
// get object map areas and check whether at least one must
// be corrected
$oid = $res->nodeset[$i]->get_attribute("OriginId");
if (substr($oid, 0, 4) =="il__")
{
$id_arr = explode("_", $oid);
$id = $id_arr[count($id_arr) - 1];
$mob = new ilObjMediaObject($id);
$med_item = $mob->getMediaItem("Standard");
$med_areas = $med_item->getMapAreas();
foreach($med_areas as $area)
{
$link_type = ($area->getLinkType() == "int")
? "IntLink"
: "ExtLink";
$areas[] = array(
"Nr" => $area->getNr(),
"Shape" => $area->getShape(),
"Coords" => $area->getCoords(),
"Link" => array(
"LinkType" => $link_type,
"Href" => $area->getHref(),
"Title" => $area->getTitle(),
"Target" => $area->getTarget(),
"Type" => $area->getType(),
"TargetFrame" => $area->getTargetFrame()
)
);
if ($area->getType() == "PageObject" ||
$area->getType() == "StructureObject")
{
$t = $area->getTarget();
if ($a_from_to[$tid] > 0)
{
$correction_needed = true;
}
//var_dump($a_from_to);
}
}
}
}
// correct map area links
if ($correction_needed)
{
$std_alias_item->deleteAllMapAreas();
foreach($areas as $area)
{
if ($area["Link"]["LinkType"] == "IntLink")
{
$target = $area["Link"]["Target"];
$type = $area["Link"]["Type"];
if ($a_from_to[$obj_id] > 0)
{
if ($type == "PageObject" && ilLMObject::_lookupType($a_from_to[$obj_id]) == "pg")
{
$area["Link"]["Target"] = "il__pg_".$a_from_to[$obj_id];
}
if ($type == "StructureObject" && ilLMObject::_lookupType($a_from_to[$obj_id]) == "st")
{
$area["Link"]["Target"] = "il__st_".$a_from_to[$obj_id];
}
}
}
$std_alias_item->addMapArea($area["Shape"], $area["Coords"],
$area["Link"]["Title"],
array( "Type" => $area["Link"]["Type"],
"TargetFrame" => $area["Link"]["TargetFrame"],
"Target" => $area["Link"]["Target"],
"Href" => $area["Link"]["Href"],
"LinkType" => $area["Link"]["LinkType"],
));
}
}
}
unset($xpc);
}

+ Here is the call graph for this function:

ilPageObject::needsImportParsing (   $a_parse = "")

Definition at line 787 of file class.ilPageObject.php.

References $needs_parsing.

{
if ($a_parse === true)
{
$this->needs_parsing = true;
}
if ($a_parse === false)
{
$this->needs_parsing = false;
}
}
ilPageObject::read ( )

read page data

Reimplemented in ilWikiPage.

Definition at line 190 of file class.ilPageObject.php.

References $ilBench, DB_FETCHMODE_ASSOC, exit, getParentType(), setLastChange(), setParentId(), setRenderedContent(), setRenderedTime(), and setRenderMd5().

Referenced by ilPageObject().

{
global $ilBench, $ilDB;
$ilBench->start("ContentPresentation", "ilPageObject_read");
if ($this->old_nr == 0)
{
$query = "SELECT * FROM page_object WHERE page_id = ".$ilDB->quote($this->id)." ".
"AND parent_type=".$ilDB->quote($this->getParentType());
$pg_set = $this->ilias->db->query($query);
$this->page_record = $pg_set->fetchRow(DB_FETCHMODE_ASSOC);
}
else
{
$query = "SELECT * FROM page_history WHERE page_id = ".$ilDB->quote($this->id)." ".
"AND parent_type=".$ilDB->quote($this->getParentType()).
" AND nr = ".$ilDB->quote($this->old_nr);
$pg_set = $this->ilias->db->query($query);
$this->page_record = $pg_set->fetchRow(DB_FETCHMODE_ASSOC);
}
if (!$this->page_record)
{
if ($this->halt_on_error)
{
echo "Error: Page ".$this->id." is not in database".
" (parent type ".$this->getParentType().")."; exit;
}
else
{
$this->page_not_found = true;
return;
}
}
$this->xml = $this->page_record["content"];
$this->setParentId($this->page_record["parent_id"]);
$this->last_change_user = $this->page_record["last_change_user"];
$this->create_user = $this->page_record["create_user"];
$this->setRenderedContent($this->page_record["rendered_content"]);
$this->setRenderMd5($this->page_record["render_md5"]);
$this->setRenderedTime($this->page_record["rendered_time"]);
$this->setLastChange($this->page_record["last_change"]);
$ilBench->stop("ContentPresentation", "ilPageObject_read");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::registerOfflineHandler (   $handler)

Definition at line 2725 of file class.ilPageObject.php.

{
$this->offline_handler = $handler;
}
ilPageObject::resolveIntLinks ( )

Resolves all internal link targets of the page, if targets are available (after import)

Definition at line 1252 of file class.ilPageObject.php.

References $res, ilInternalLink\_exists(), ilInternalLink\_extractInstOfTarget(), ilInternalLink\_getIdForImportId(), ilInternalLink\_removeInstFromTarget(), ilMediaItem\_resolveMapAreaLinks(), xpath_eval(), and xpath_new_context().

{
// resolve normal internal links
$xpc = xpath_new_context($this->dom);
$path = "//IntLink";
$res =& xpath_eval($xpc, $path);
for($i = 0; $i < count($res->nodeset); $i++)
{
$target = $res->nodeset[$i]->get_attribute("Target");
$type = $res->nodeset[$i]->get_attribute("Type");
$new_target = ilInternalLink::_getIdForImportId($type, $target);
if ($new_target !== false)
{
$res->nodeset[$i]->set_attribute("Target", $new_target);
}
else // check wether link target is same installation
{
if (ilInternalLink::_extractInstOfTarget($target) == IL_INST_ID &&
IL_INST_ID > 0 && $type != "RepositoryItem")
{
$new_target = ilInternalLink::_removeInstFromTarget($target);
if (ilInternalLink::_exists($type, $new_target))
{
$res->nodeset[$i]->set_attribute("Target", $new_target);
}
}
}
}
unset($xpc);
// resolve internal links in map areas
$xpc = xpath_new_context($this->dom);
$path = "//MediaAlias";
$res =& xpath_eval($xpc, $path);
//echo "<br><b>page::resolve</b><br>";
//echo "Content:".htmlentities($this->getXMLFromDOM()).":<br>";
for($i = 0; $i < count($res->nodeset); $i++)
{
$orig_id = $res->nodeset[$i]->get_attribute("OriginId");
$id_arr = explode("_", $orig_id);
$mob_id = $id_arr[count($id_arr) - 1];
}
}

+ Here is the call graph for this function:

ilPageObject::saveFileUsage (   $a_xml = "",
  $a_old_nr = 0 
)

save file usages

Definition at line 1845 of file class.ilPageObject.php.

References ilObjFile\_deleteAllUsages(), ilObjFile\_saveUsage(), collectFileItems(), getId(), and getParentType().

Referenced by update().

{
$file_ids = $this->collectFileItems($a_xml, $a_old_nr);
include_once("./Modules/File/classes/class.ilObjFile.php");
ilObjFile::_deleteAllUsages($this->getParentType().":pg", $this->getId(), $a_old_nr);
foreach($file_ids as $file_id)
{
ilObjFile::_saveUsage($file_id, $this->getParentType().":pg", $this->getId(), $a_old_nr);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::saveInternalLinks (   $a_xml)

save internal links of page

Parameters
stringxml page code

Reimplemented in ilWikiPage.

Definition at line 1877 of file class.ilPageObject.php.

References $res, $target_arr, ilInternalLink\_deleteAllLinksOfSource(), ilInternalLink\_saveLink(), domxml_open_mem(), getId(), getParentType(), xpath_eval(), and xpath_new_context().

Referenced by delete(), and update().

{
//echo "<br>PageObject::saveInternalLinks[".$this->getId()."]";
$doc = domxml_open_mem($a_xml);
include_once("./Services/COPage/classes/class.ilInternalLink.php");
// get all internal links
$xpc = xpath_new_context($doc);
$path = "//IntLink";
$res =& xpath_eval($xpc, $path);
for ($i=0; $i < count($res->nodeset); $i++)
{
$link_type = $res->nodeset[$i]->get_attribute("Type");
switch ($link_type)
{
case "StructureObject":
$t_type = "st";
break;
case "PageObject":
$t_type = "pg";
break;
case "GlossaryItem":
$t_type = "git";
break;
case "MediaObject":
$t_type = "mob";
break;
case "RepositoryItem":
$t_type = "obj";
break;
}
$target = $res->nodeset[$i]->get_attribute("Target");
$target_arr = explode("_", $target);
$t_id = $target_arr[count($target_arr) - 1];
// link to other internal object
if (is_int(strpos($target, "__")))
{
$t_inst = 0;
}
else // link to unresolved object in other installation
{
$t_inst = $target_arr[1];
}
if ($t_id > 0)
{
ilInternalLink::_saveLink($this->getParentType().":pg", $this->getId(), $t_type,
$t_id, $t_inst);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::saveMobUsage (   $a_xml,
  $a_old_nr = 0 
)

save all usages of media objects (media aliases, media objects, internal links)

Parameters
string$a_xmlxml data of page

Definition at line 1785 of file class.ilPageObject.php.

References $res, ilObjMediaObject\_deleteAllUsages(), ilObjMediaObject\_saveUsage(), domxml_open_mem(), getId(), getParentType(), xpath_eval(), and xpath_new_context().

Referenced by delete(), and update().

{
$doc = domxml_open_mem($a_xml);
// media aliases
$xpc = xpath_new_context($doc);
$path = "//MediaAlias";
$res =& xpath_eval($xpc, $path);
$usages = array();
for ($i=0; $i < count($res->nodeset); $i++)
{
$id_arr = explode("_", $res->nodeset[$i]->get_attribute("OriginId"));
$mob_id = $id_arr[count($id_arr) - 1];
if ($mob_id > 0)
{
$usages[$mob_id] = true;
}
}
// media objects
$xpc = xpath_new_context($doc);
$path = "//MediaObject/MetaData/General/Identifier";
$res =& xpath_eval($xpc, $path);
for ($i=0; $i < count($res->nodeset); $i++)
{
$mob_entry = $res->nodeset[$i]->get_attribute("Entry");
$mob_arr = explode("_", $mob_entry);
$mob_id = $mob_arr[count($mob_arr) - 1];
if ($mob_id > 0)
{
$usages[$mob_id] = true;
}
}
// internal links
$xpc = xpath_new_context($doc);
$path = "//IntLink[@Type='MediaObject']";
$res =& xpath_eval($xpc, $path);
for ($i=0; $i < count($res->nodeset); $i++)
{
$mob_target = $res->nodeset[$i]->get_attribute("Target");
$mob_arr = explode("_", $mob_target);
$mob_id = $mob_arr[count($mob_arr) - 1];
if ($mob_id > 0)
{
$usages[$mob_id] = true;
}
}
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
ilObjMediaObject::_deleteAllUsages($this->getParentType().":pg", $this->getId(), $a_old_nr);
foreach($usages as $mob_id => $val)
{
ilObjMediaObject::_saveUsage($mob_id, $this->getParentType().":pg", $this->getId(), $a_old_nr);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::send_paragraph (   $par_id,
  $filename 
)

Definition at line 2655 of file class.ilPageObject.php.

References $dom, $filename, $res, ilUtil\deliverData(), exit, xpath_eval(), and xpath_new_context().

Referenced by ilLMPresentationGUI\download_paragraph().

{
$this->builddom();
$mydom = $this->dom;
$xpc = xpath_new_context($mydom);
//$path = "//PageContent[position () = $par_id]/Paragraph";
//$path = "//Paragraph[$par_id]";
$path = "/descendant::Paragraph[position() = $par_id]";
$res = & xpath_eval($xpc, $path);
if (count ($res->nodeset) != 1)
die ("Should not happen");
$context_node = $res->nodeset[0];
// get plain text
$childs = $context_node->child_nodes();
for($j=0; $j<count($childs); $j++)
{
$content .= $mydom->dump_node($childs[$j]);
}
$content = str_replace("<br />", "\n", $content);
$content = str_replace("<br/>", "\n", $content);
$plain_content = html_entity_decode($content);
ilUtil::deliverData($plain_content, $filename);
/*
$file_type = "application/octet-stream";
header("Content-type: ".$file_type);
header("Content-disposition: attachment; filename=\"$filename\"");
echo $plain_content;*/
exit();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::setContainsIntLink (   $a_contains_link)

lm parser set this flag to true, if the page contains intern links (this method should only be called by the import parser)

todo: move to ilLMPageObject !?

Parameters
boolean$a_contains_linktrue, if page contains intern link tag(s)

Definition at line 773 of file class.ilPageObject.php.

{
$this->contains_int_link = $a_contains_link;
}
ilPageObject::setId (   $a_id)

set id

Definition at line 308 of file class.ilPageObject.php.

Referenced by ilWikiPage\create(), and ilLMPageObject\create().

{
$this->id = $a_id;
}

+ Here is the caller graph for this function:

ilPageObject::setLastChange (   $a_lastchange)

Set Last Change.

Parameters
string$a_lastchangeLast Change

Definition at line 172 of file class.ilPageObject.php.

Referenced by read().

{
$this->lastchange = $a_lastchange;
}

+ Here is the caller graph for this function:

ilPageObject::setParagraphContent (   $a_hier_id,
  $a_content 
)

Set content of paragraph.

Parameters
string$a_hier_idHier ID
string$a_contentContent

Definition at line 755 of file class.ilPageObject.php.

References $node, and getContentNode().

{
$node = $this->getContentNode($a_hier_id);
if (is_object($node))
{
$node->set_content($a_content);
}
}

+ Here is the call graph for this function:

ilPageObject::setParentId (   $a_id)

Definition at line 318 of file class.ilPageObject.php.

Referenced by ilContainerGUI\forwardToPageObject(), read(), and ilWikiPage\setWikiId().

{
$this->parent_id = $a_id;
}

+ Here is the caller graph for this function:

ilPageObject::setParentType (   $a_type)

Definition at line 328 of file class.ilPageObject.php.

{
$this->parent_type = $a_type;
}
ilPageObject::setRenderedContent (   $a_renderedcontent)

Set Rendered Content.

Parameters
string$a_renderedcontentRendered Content

Definition at line 132 of file class.ilPageObject.php.

Referenced by read().

{
$this->renderedcontent = $a_renderedcontent;
}

+ Here is the caller graph for this function:

ilPageObject::setRenderedTime (   $a_renderedtime)

Set Rendered Time.

Parameters
string$a_renderedtimeRendered Time

Definition at line 152 of file class.ilPageObject.php.

Referenced by read().

{
$this->renderedtime = $a_renderedtime;
}

+ Here is the caller graph for this function:

ilPageObject::setRenderMd5 (   $a_rendermd5)

Set Render MD5.

Parameters
string$a_rendermd5Render MD5

Definition at line 112 of file class.ilPageObject.php.

Referenced by read().

{
$this->rendermd5 = $a_rendermd5;
}

+ Here is the caller graph for this function:

ilPageObject::setXMLContent (   $a_xml,
  $a_encoding = "UTF-8" 
)

set xml content of page, start with <PageObject...>, end with </PageObject>, comply with ILIAS DTD, omit MetaData, use utf-8!

Parameters
string$a_xmlxml content
string$a_encodingencoding of the content (here is no conversion done! it must be already utf-8 encoded at the time)

Definition at line 587 of file class.ilPageObject.php.

Referenced by createFromXML().

{
$this->encoding = $a_encoding;
$this->xml = $a_xml;
}

+ Here is the caller graph for this function:

ilPageObject::stripHierIDs ( )

strip all hierarchical id attributes out of the dom tree

Definition at line 1194 of file class.ilPageObject.php.

References $res, xpath_eval(), and xpath_new_context().

Referenced by validateDom().

{
if(is_object($this->dom))
{
$xpc = xpath_new_context($this->dom);
$path = "//*[@HierId]";
$res =& xpath_eval($xpc, $path);
for($i = 0; $i < count($res->nodeset); $i++) // should only be 1
{
if ($res->nodeset[$i]->has_attribute("HierId"))
{
$res->nodeset[$i]->remove_attribute("HierId");
}
}
unset($xpc);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::switchEnableMultiple (   $a_hids,
  $a_update = true 
)

gui function set enabled if is not enabled and vice versa

Definition at line 2003 of file class.ilPageObject.php.

References getContentNode(), getContentObject(), and update().

{
if (!is_array($a_hids))
{
return;
}
$obj = & $this->content_obj;
foreach($a_hids as $a_hid)
{
$a_hid = explode(":", $a_hid);
//echo "-".$a_hid[0]."-".$a_hid[1]."-";
$curr_node =& $this->getContentNode($a_hid[0], $a_hid[1]);
if (is_object($curr_node))
{
if ($curr_node->node_name() == "PageContent")
{
$cont_obj =& $this->getContentObject($a_hid[0], $a_hid[1]);
if ($cont_obj->isEnabled ())
$cont_obj->disable ();
else
$cont_obj->enable ();
}
}
}
if ($a_update)
{
return $this->update();
}
}

+ Here is the call graph for this function:

ilPageObject::update (   $a_validate = true,
  $a_no_history = false 
)

update complete page content in db (dom xml content is used)

Reimplemented in ilWikiPage.

Definition at line 1589 of file class.ilPageObject.php.

References $errors, $file, $history_saved, $ilCtrl, $ilLog, $lng, ilObject\_exists(), ilObjFile\_getFilesOfObject(), ilObjMediaObject\_getMobsOfObject(), ilObject\_lookupType(), callUpdateListeners(), checkPCIds(), DB_FETCHMODE_ASSOC, getId(), getParentId(), getParentType(), getXMLFromDom(), ILIAS_VERSION_NUMERIC, insertPCIds(), saveFileUsage(), saveInternalLinks(), saveMobUsage(), and validateDom().

Referenced by deleteContent(), deleteContentBeforeHierId(), deleteContentFromHierId(), deleteContents(), moveContentAfter(), moveContentBefore(), and switchEnableMultiple().

{
global $lng, $ilDB, $ilUser, $ilLog, $ilCtrl;
//echo "<br>PageObject::update[".$this->getId()."],validate($a_validate)";
//echo "\n<br>dump_all2:".$this->dom->dump_mem(0, "UTF-8").":";
//echo "\n<br>PageObject::update:".$this->getXMLFromDom().":";
//echo "<br>PageObject::update:".htmlentities($this->getXMLFromDom());
// add missing pc ids
if (!$this->checkPCIds())
{
$this->insertPCIds();
}
// test validating
if($a_validate)
{
$errors = $this->validateDom();
}
//echo "-".htmlentities($this->getXMLFromDom())."-"; exit;
if(empty($errors))
{
$content = $this->getXMLFromDom();
// this needs to be locked
// write history entry
$old_set = $ilDB->query("SELECT * FROM page_object WHERE ".
"page_id = ".$ilDB->quote($this->getId())." AND ".
"parent_type = ".$ilDB->quote($this->getParentType()));
$last_nr_set = $ilDB->query("SELECT max(nr) as mnr FROM page_history WHERE ".
"page_id = ".$ilDB->quote($this->getId())." AND ".
"parent_type = ".$ilDB->quote($this->getParentType()));
$last_nr = $last_nr_set->fetchRow(DB_FETCHMODE_ASSOC);
if ($old_rec = $old_set->fetchRow(DB_FETCHMODE_ASSOC))
{
// only save, if something has changed
if (($content != $old_rec["content"]) && !$a_no_history &&
{
if ($old_rec["content"] != "<PageObject></PageObject>")
{
$h_query = "REPLACE INTO page_history ".
"(page_id, parent_type, hdate, parent_id, content, user, ilias_version, nr) VALUES (".
$ilDB->quote($old_rec["page_id"]).",".
$ilDB->quote($old_rec["parent_type"]).",".
$ilDB->quote($old_rec["last_change"]).",".
$ilDB->quote($old_rec["parent_id"]).",".
$ilDB->quote($old_rec["content"]).",".
$ilDB->quote($old_rec["last_change_user"]).",".
$ilDB->quote(ILIAS_VERSION_NUMERIC).",".
$ilDB->quote($last_nr["mnr"] + 1).")";
//echo "<br><br>+$a_no_history+$h_query";
$ilDB->query($h_query);
$this->saveMobUsage($old_rec["content"], $last_nr["mnr"] + 1);
$this->saveFileUsage($old_rec["content"], $last_nr["mnr"] + 1);
$this->history_saved = true; // only save one time
}
else
{
$this->history_saved = true; // do not save on first change
}
}
}
$query = "UPDATE page_object ".
"SET content = ".$ilDB->quote($content)." ".
", parent_id= ".$ilDB->quote($this->getParentId())." ".
", last_change_user= ".$ilDB->quote($ilUser->getId())." ".
", last_change = now() ".
" WHERE page_id = ".$ilDB->quote($this->getId()).
" AND parent_type= ".$ilDB->quote($this->getParentType());
if(!$this->ilias->db->checkQuerySize($query))
{
$this->ilias->raiseError($lng->txt("check_max_allowed_packet_size"),$this->ilias->error_obj->MESSAGE);
return false;
}
$this->ilias->db->query($query);
// handle media object usage
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$this->getParentType().":pg", $this->getId());
$this->saveMobUsage($this->getXMLFromDom());
foreach($mob_ids as $mob) // check, whether media object can be deleted
{
if (ilObject::_exists($mob) && ilObject::_lookupType($mob) == "mob")
{
$mob_obj = new ilObjMediaObject($mob);
$usages = $mob_obj->getUsages();
if (count($usages) == 0) // delete, if no usage exists
{
$mob_obj->delete();
}
}
}
// handle file usages
include_once("./Modules/File/classes/class.ilObjFile.php");
$this->getParentType().":pg", $this->getId());
$this->saveFileUsage();
foreach($file_ids as $file) // check, whether file object can be deleted
{
if (ilObject::_exists($file))
{
$file_obj = new ilObjFile($file, false);
$usages = $file_obj->getUsages();
if (count($usages) == 0) // delete, if no usage exists
{
$file_obj->delete();
}
}
}
// save internal link information
$this->saveInternalLinks($this->getXMLFromDom());
//echo "<br>PageObject::update:".htmlentities($this->getXMLContent()).":";
return true;
}
else
{
return $errors;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::updateFromXML ( )

updates page object with current xml content

Definition at line 1560 of file class.ilPageObject.php.

References $lng, getParentId(), and getXMLContent().

{
global $lng, $ilDB, $ilUser;
//echo "<br>PageObject::updateFromXML[".$this->getId()."]";
//echo "update:".ilUtil::prepareDBString(($this->getXMLContent())).":<br>";
//echo "update:".htmlentities(ilUtil::prepareDBString(($this->getXMLContent()))).":<br>";
$query = "UPDATE page_object ".
"SET content = ".$ilDB->quote($this->getXMLContent())." ".
", parent_id = ".$ilDB->quote($this->getParentId())." ".
", last_change_user = ".$ilDB->quote($ilUser->getId())." ".
", last_change = now() ".
"WHERE page_id = ".$ilDB->quote($this->getId())." AND parent_type=".
$ilDB->quote($this->getParentType());
if(!$this->ilias->db->checkQuerySize($query))
{
$this->ilias->raiseError($lng->txt("check_max_allowed_packet_size"),$this->ilias->error_obj->MESSAGE);
return false;
}
$this->ilias->db->query($query);
return true;
}

+ Here is the call graph for this function:

ilPageObject::validateDom ( )

Validate the page content agains page DTD.

Returns
array Error array.

Definition at line 1010 of file class.ilPageObject.php.

References stripHierIDs().

Referenced by update().

{
$this->stripHierIDs();
$this->dom->validate($error);
return $error;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::writeRenderedContent (   $a_content,
  $a_md5 
)

Write rendered content.

Definition at line 3174 of file class.ilPageObject.php.

References getId(), and getParentType().

{
global $ilDB;
$st = $ilDB->prepareManip("UPDATE page_object ".
" SET rendered_content = ?, render_md5 = ?, rendered_time = now()".
" WHERE page_id = ? AND parent_type = ?",
array("text", "text", "integer", "text"));
$r = $ilDB->execute($st,
array($a_content, $a_md5, $this->getId(), $this->getParentType()));
}

+ Here is the call graph for this function:

Field Documentation

ilPageObject::$contains_int_link

Definition at line 61 of file class.ilPageObject.php.

Referenced by containsIntLink().

ilPageObject::$cur_dtd = "ilias_pg_3_10.dtd"

Definition at line 60 of file class.ilPageObject.php.

ilPageObject::$dom
ilPageObject::$dom_builded

Definition at line 68 of file class.ilPageObject.php.

ilPageObject::$encoding

Definition at line 58 of file class.ilPageObject.php.

ilPageObject::$history_saved

Definition at line 69 of file class.ilPageObject.php.

Referenced by update().

ilPageObject::$ilias

Definition at line 55 of file class.ilPageObject.php.

Referenced by getBibliographyXML(), and ilPageObject().

ilPageObject::$needs_parsing

Definition at line 62 of file class.ilPageObject.php.

Referenced by needsImportParsing().

ilPageObject::$node

Definition at line 59 of file class.ilPageObject.php.

Referenced by getContentNode(), getNode(), insertPCIds(), and setParagraphContent().

ilPageObject::$offline_handler

Definition at line 67 of file class.ilPageObject.php.

ilPageObject::$parent_id

Definition at line 64 of file class.ilPageObject.php.

Referenced by getParentId().

ilPageObject::$parent_type

Definition at line 63 of file class.ilPageObject.php.

Referenced by getParentType().

ilPageObject::$update_listener_cnt

Definition at line 66 of file class.ilPageObject.php.

Referenced by addUpdateListener(), and callUpdateListeners().

ilPageObject::$update_listeners

Definition at line 65 of file class.ilPageObject.php.

ilPageObject::$xml

The documentation for this class was generated from the following file: