ILIAS  Release_5_0_x_branch Revision 61816
 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_id=0, $a_old_nr=0, $a_lang="-")
 Constructor public.
 afterConstructor ()
 After constructor.
 getParentType ()
 Get parent type.
 initPageConfig ()
 Init page config.
 setLanguage ($a_val)
 Set language.
 getLanguage ()
 Get language.
 setPageConfig ($a_val)
 Set page config object.
 getPageConfig ()
 Get page config object.
 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.
 setLastChangeUser ($a_val)
 Set last change user.
 getLastChangeUser ()
 Get last change user.
 setShowActivationInfo ($a_val)
 Set show page activation info.
 getShowActivationInfo ()
 Get show page activation info.
 read ()
 Read page data.
 buildDom ($a_force=false)
 freeDom ()
 getDom ()
 Deprecated php4DomDocument.
 getDomDoc ()
 Get dom doc (php5 dom document)
 setId ($a_id)
 set id
 getId ()
 setParentId ($a_id)
 getParentId ()
 addUpdateListener (&$a_object, $a_method, $a_parameters="")
 callUpdateListeners ()
 setActive ($a_active)
 set activation
 getActive ($a_check_scheduled_activation=false)
 get activation
 _writeActive ($a_id, $a_parent_type, $a_active, $a_reset_scheduled_activation=true, $a_lang="-")
 write activation status
 _lookupActivationData ($a_id, $a_parent_type, $a_lang="-")
 Lookup activation data.
 _writeParentId ($a_parent_type, $a_pg_id, $a_par_id)
 Write parent id.
 setActivationStart ($a_activationstart)
 Set Activation Start.
 getActivationStart ()
 Get Activation Start.
 setActivationEnd ($a_activationend)
 Set Activation End.
 getActivationEnd ()
 Get Activation End.
 getContentObject ($a_hier_id, $a_pc_id="")
 Get a content object of the page.
getContentNode ($a_hier_id, $a_pc_id="")
 Get content node from dom.
 checkForTag ($a_content_tag, $a_hier_id, $a_pc_id="")
 Get content node from dom.
 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
 copyXmlContent ($a_clone_mobs=false)
 Copy content of page; replace page components with copies where necessary (e.g.
 handleCopiedContent ($a_dom, $a_self_ass=true, $a_clone_mobs=false)
 Handle copied content.
 newIIMCopies ($temp_dom)
 Replaces media objects in interactive images with copies of the interactive images.
 newMobCopies ($temp_dom)
 Replaces media objects with copies.
 newQuestionCopies (&$temp_dom)
 Replaces existing question content elements with new copies.
 removeQuestions (&$temp_dom)
 Remove questions from document.
 countPageContents ()
 Remove questions from document.
 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)
 setImportMode ($a_val)
 Set import mode.
 getImportMode ()
 Get import mode.
 needsImportParsing ($a_parse="")
 setContainsQuestion ($a_val)
 Set contains question.
 getContainsQuestion ()
 Get contains question.
 collectMediaObjects ($a_inline_only=true)
 get all media objects, that are referenced and used within the page
 getInternalLinks ($a_cnt_multiple=false)
 get all internal links 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
 getHierIdsForPCIds ($a_pc_ids)
 Get hier ids for a set of pc ids.
 addFileSizes ()
 add file sizes
 resolveIntLinks ()
 Resolves all internal link targets of the page, if targets are available (after import)
 resolveMediaAliases ($a_mapping)
 Resolve media aliases (after import)
 resolveIIMMediaAliases ($a_mapping)
 Resolve iim media aliases (in ilContObjParse)
 resolveFileItems ($a_mapping)
 Resolve file items (after import)
 resolveQuestionReferences ($a_mapping)
 Resolve all quesion references (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.
 afterUpdate ()
 After update.
 update ($a_validate=true, $a_no_history=false)
 update complete page content in db (dom xml content is used)
 delete ()
 delete page object
 saveStyleUsage ($a_domdoc, $a_old_nr=0)
 Save all style class/template usages.
 deleteStyleUsages ($a_old_nr=0)
 Delete style usages.
 getLastUpdateOfIncludedElements ()
 Get last update of included elements (media objects and files).
 deleteInternalLinks ()
 Delete internal links.
 saveInternalLinks ($a_domdoc)
 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, $a_self_ass=false)
 Delete multiple content objects.
 cutContents ($a_hids)
 Copy contents to clipboard and cut them from the page.
 copyContents ($a_hids)
 Copy contents to clipboard.
 pasteContents ($a_hier_id, $a_self_ass=false)
 Paste contents from pc clipboard.
 switchEnableMultiple ($a_hids, $a_update=true, $a_self_ass=false)
 (De-)activate elements
 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
 insertContentNode (&$a_cont_node, $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.
 checkPCIds ()
 Check, whether (all) page content hashes are set.
 getAllPCIds ()
 Get all pc ids.
 existsPCId ($a_pc_id)
 existsPCId
 generatePcId ($a_pc_ids=false)
 Generate new pc id.
 insertPCIds ()
 Insert Page Content IDs.
 getPageContentsHashes ()
 Get page contents hashes.
 getQuestionIds ()
 Get question ids.
 send_paragraph ($par_id, $filename)
 getFO ()
 get fo page content
 registerOfflineHandler ($handler)
 getOfflineHandler ()
 Get offline handler.
 containsDeactivatedElements ($a_content)
 Check whether content 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.
 containsIntLinks ($a_content)
 Check whether content contains internal links.
 performAutomaticModifications ()
 Perform automatic modifications (may be overwritten by sub classes)
 saveInitialOpenedContent ($a_type, $a_id, $a_target)
 Save initial opened content.
 getInitialOpenedContent ()
 Get initial opened content.
 beforePageContentUpdate ($a_page_content)
 Before page content update.
 copy ($a_id, $a_parent_type="", $a_parent_id=0, $a_clone_mobs=false)
 Copy page.
 copyPageToTranslation ($a_target_lang)
 Copy page to translation.
 getEditLock ()
 Get page lock.
 releasePageLock ()
 Release page lock.
 getEditLockInfo ()
 Get edit lock info.
 getContentTemplates ()
 Get content templates.

Static Public Member Functions

static _exists ($a_parent_type, $a_id, $a_lang="")
 Checks whether page exists.
static _existsAndNotEmpty ($a_parent_type, $a_id, $a_lang="-")
 Checks whether page exists and is not empty (may return true on some empty pages)
static preloadActivationDataByParentId ($a_parent_id)
 Preload activation data by Parent Id.
static _lookupActive ($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
 lookup activation status
static _isScheduledActivation ($a_id, $a_parent_type, $a_lang="-")
 Check whether page is activated by time schedule.
static lookupParentId ($a_id, $a_type)
 Lookup parent id.
static _handleImportRepositoryLinks ($a_rep_import_id, $a_rep_type, $a_rep_ref_id)
 Change targest of repository links.
static _lookupContainsDeactivatedElements ($a_id, $a_parent_type, $a_lang="-")
 lookup whether page contains deactivated elements
static getRecentChanges ($a_parent_type, $a_parent_id, $a_period=30, $a_lang="")
 Get recent pages changes for parent object.
static getAllPages ($a_parent_type, $a_parent_id, $a_lang="-")
 Get all pages for parent object.
static getNewPages ($a_parent_type, $a_parent_id, $a_lang="-")
 Get new pages.
static getParentObjectContributors ($a_parent_type, $a_parent_id, $a_lang="-")
 Get all contributors for parent object.
static getPageContributors ($a_parent_type, $a_page_id, $a_lang="-")
 Get all contributors for parent object.
static getPagesWithLinks ($a_parent_type, $a_parent_id, $a_lang="-")
 Get all pages for parent object that contain internal links.
static lookupTranslations ($a_parent_type, $a_id)
 Lookup translations.
static truncateHTML ($a_text, $a_length=100, $a_ending= '...', $a_exact=false, $a_consider_html=true)
 Truncate (html) string.

Data Fields

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

Static Public Attributes

static $exists = array()

Protected Member Functions

 __afterUpdate ($a_domdoc, $a_xml, $a_creation=false, $a_empty=false)
 After update event handler (internal).
 __beforeDelete ()
 Before deletion handler (internal).
 __afterHistoryEntry ($a_old_domdoc, $a_old_content, $a_old_nr)
 Before deletion handler (internal).

Protected Attributes

 $import_mode = false

Static Protected Attributes

static $activation_data = array()

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 61508 2016-01-11 14:56:29Z gitmgr

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

Member Function Documentation

ilPageObject::__afterHistoryEntry (   $a_old_domdoc,
  $a_old_content,
  $a_old_nr 
)
finalprotected

Before deletion handler (internal).

Parameters

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

References ilCOPagePCDef\getPCDefinitions(), ilCOPagePCDef\requirePCClassByName(), and saveStyleUsage().

Referenced by update().

{
// save style usage
$this->saveStyleUsage($a_old_domdoc, $a_old_nr);
// pc classes hook
include_once("./Services/COPage/classes/class.ilCOPagePCDef.php");
foreach ($defs as $def)
{
$cl = $def["pc_class"];
call_user_func($def["pc_class"].'::afterPageHistoryEntry', $this, $a_old_domdoc, $a_old_content, $a_old_nr);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::__afterUpdate (   $a_domdoc,
  $a_xml,
  $a_creation = false,
  $a_empty = false 
)
finalprotected

After update event handler (internal).

The hooks are e.g. for storing any dependent relations/references in the database.

Parameters

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

References afterUpdate(), callUpdateListeners(), ilCOPagePCDef\getPCDefinitions(), ilCOPagePCDef\requirePCClassByName(), saveInternalLinks(), and saveStyleUsage().

Referenced by createFromXML(), update(), and updateFromXML().

{
// we do not need this if we are creating an empty page
if (!$a_creation || !$a_empty)
{
// save internal link information
// the page object is responsible to do this, since it "offers" the
// internal link feature pc and page classes
$this->saveInternalLinks($a_domdoc);
// save style usage
$this->saveStyleUsage($a_domdoc);
// pc classes hook
include_once("./Services/COPage/classes/class.ilCOPagePCDef.php");
foreach ($defs as $def)
{
$cl = $def["pc_class"];
call_user_func($def["pc_class"].'::afterPageUpdate', $this, $a_domdoc, $a_xml, $a_creation);
}
}
// call page hook
$this->afterUpdate($a_domdoc, $a_xml);
// call update listeners
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::__beforeDelete ( )
finalprotected

Before deletion handler (internal).

Parameters

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

References ilCOPagePCDef\getPCDefinitions(), and ilCOPagePCDef\requirePCClassByName().

Referenced by delete().

{
// pc classes hook
include_once("./Services/COPage/classes/class.ilCOPagePCDef.php");
foreach ($defs as $def)
{
$cl = $def["pc_class"];
call_user_func($def["pc_class"].'::beforePageDelete', $this);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilPageObject::_exists (   $a_parent_type,
  $a_id,
  $a_lang = "" 
)
static

Checks whether page exists.

Parameters
string$a_parent_typeparent type
int$a_idpage id
string$a_langlanguage code, if empty language independent existence is checked

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

References $ilDB, $query, and $row.

Referenced by ilImprintGUI\__construct(), ilShopPurchaseGUI\__getAbstractHTML(), ilContainer\cloneObject(), copy(), ilAssQuestionFeedback\ensurePageObjectDeleted(), ilAssQuestionFeedbackPageObjectCommandForwarder\ensurePageObjectExists(), ilAssQuestionHintPageObjectCommandForwarder\ensurePageObjectExists(), ilAssQuestionFeedback\ensurePageObjectExists(), ilContainerStartObjectsGUI\executeCommand(), ilLMPageObjectGUI\executeCommand(), ilLOEditorGUI\executeCommand(), ilWikiHTMLExport\exportHTMLPages(), ilPortfolioHTMLExport\exportHTMLPages(), ilObjBlogGUI\exportHTMLPages(), ilObjContentObject\exportHTMLPages(), ilObjContentObject\exportXMLPageObjects(), ilCOPageImporter\finalProcessing(), ilObjItemGroup\fixContainerItemGroupRefsAfterCloning(), ilObjPaymentSettingsGUI\forwardToDocumentsPageObject(), ilTermsConditionsGUI\forwardToPageObject(), ilShopInfoGUI\forwardToPageObject(), ilAuthLoginPageEditorGUI\forwardToPageObject(), ilContainerGUI\forwardToPageObject(), ilShopGUI\forwardToPageObject(), ilObjPaymentSettingsGUI\getDocumentsPageHTML(), ilObjectTranslation\getEffectiveContentLang(), ilPageMultiLang\getEffectiveLang(), ilLMPresentationGUI\getLMPage(), ilLMPresentationGUI\getLMPageGUI(), ilTermsConditionsGUI\getPageHTML(), ilShopInfoGUI\getPageHTML(), ilShopGUI\getPageHTML(), ilWikiExporter\getXmlExportTailDependencies(), ilMediaPoolPage\lookupUsages(), ilObjMediaObject\lookupUsages(), newQuestionCopies(), ilContObjParser\processPagesToParse(), ilWikiPage\rename(), ilPageObjectGUI\switchToLanguage(), and ilObjContentObject\validatePages().

{
global $ilDB;
if (isset(self::$exists[$a_parent_type.":".$a_id.":".$a_lang]))
{
return self::$exists[$a_parent_type.":".$a_id.":".$a_lang];
}
$and_lang = "";
if ($a_lang != "")
{
$and_lang = " AND lang = ".$ilDB->quote($a_lang, "text");
}
$query = "SELECT page_id FROM page_object WHERE page_id = ".$ilDB->quote($a_id, "integer")." ".
"AND parent_type = ".$ilDB->quote($a_parent_type, "text").$and_lang;
$set = $ilDB->query($query);
if ($row = $ilDB->fetchAssoc($set))
{
self::$exists[$a_parent_type.":".$a_id.":".$a_lang] = true;
return true;
}
else
{
self::$exists[$a_parent_type.":".$a_id.":".$a_lang] = false;
return false;
}
}

+ Here is the caller graph for this function:

static ilPageObject::_existsAndNotEmpty (   $a_parent_type,
  $a_id,
  $a_lang = "-" 
)
static

Checks whether page exists and is not empty (may return true on some empty pages)

Parameters
string$a_parent_typeparent type
int$a_idpage id
string$a_langlanguage code ("-" for unknown / not set)

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

References $ilDB.

{
global $ilDB;
include_once("./Services/COPage/classes/class.ilPageUtil.php");
return ilPageUtil::_existsAndNotEmpty($a_parent_type, $a_id, $a_lang);
}
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 2247 of file class.ilPageObject.php.

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

Referenced by ilObjContentObject\importFromDirectory().

{
include_once("./Services/Link/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";
include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
if (self::_exists("lm", $source["id"], $source["lang"]))
{
$page_obj = new ilLMPage($source["id"], 0, $source["lang"]);
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:

static ilPageObject::_isScheduledActivation (   $a_id,
  $a_parent_type,
  $a_lang = "-" 
)
static

Check whether page is activated by time schedule.

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

References $ilDB.

Referenced by ilLMPagesTableGUI\fillRow(), ilChapterHierarchyFormGUI\getChildIcon(), ilLMEditorExplorerGUI\getNodeIcon(), ilPublicSectionExplorerGUI\getNodeIcon(), and ilLMTOCExplorerGUI\getNodeIcon().

{
global $ilDB;
// language must be set at least to "-"
if ($a_lang == "")
{
$a_lang = "-";
}
//echo "<br>";
//var_dump(self::$activation_data); exit;
if (isset(self::$activation_data[$a_id.":".$a_parent_type.":".$a_lang]))
{
$rec = self::$activation_data[$a_id.":".$a_parent_type.":".$a_lang];
}
else
{
$set = $ilDB->queryF("SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s".
" AND parent_type = %s AND lang = %s", array("integer", "text", "text"),
array($a_id, $a_parent_type, $a_lang));
$rec = $ilDB->fetchAssoc($set);
}
if (!$rec["active"] && $rec["activation_start"] != "")
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

ilPageObject::_lookupActivationData (   $a_id,
  $a_parent_type,
  $a_lang = "-" 
)

Lookup activation data.

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

References $ilDB.

Referenced by ilLMPageObject\_getPresentationTitle(), ilLMTracker\_isNodeVisible(), ilLMPresentationGUI\getSuccessorPage(), ilLMPresentationGUI\ilLMNavigation(), and ilLMPresentationGUI\ilPage().

{
global $ilDB;
// language must be set at least to "-"
if ($a_lang == "")
{
$a_lang = "-";
}
if (isset(self::$activation_data[$a_id.":".$a_parent_type.":".$a_lang]))
{
$rec = self::$activation_data[$a_id.":".$a_parent_type.":".$a_lang];
}
else
{
$set = $ilDB->queryF("SELECT active, activation_start, activation_end, show_activation_info FROM page_object WHERE page_id = %s".
" AND parent_type = %s AND lang = %s",
array("integer", "text", "text"),
array($a_id, $a_parent_type, $a_lang));
$rec = $ilDB->fetchAssoc($set);
}
return $rec;
}

+ Here is the caller graph for this function:

static ilPageObject::_lookupActive (   $a_id,
  $a_parent_type,
  $a_check_scheduled_activation = false,
  $a_lang = "-" 
)
static

lookup activation status

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

References $ilDB, and ilUtil\now().

Referenced by ilLMPageObject\_getPresentationTitle(), ilLMTracker\_isNodeVisible(), ilStructureObjectGUI\activatePages(), ilObjContentObjectGUI\activatePages(), ilObjBlog\deliverRSS(), ilLMPagesTableGUI\fillRow(), ilObjBlogGUI\filterInactivePostings(), ilChapterHierarchyFormGUI\getChildIcon(), ilChapterHierarchyFormGUI\getChildIconAlt(), ilLMPresentationGUI\getCurrentPageId(), ilObjBlogGUI\getKeywords(), ilObjBlogGUI\getListItems(), ilLMTOCExplorerGUI\getNodeHref(), ilLMEditorExplorerGUI\getNodeIcon(), ilPublicSectionExplorerGUI\getNodeIcon(), ilLMTOCExplorerGUI\getNodeIcon(), ilLMEditorExplorerGUI\getNodeIconAlt(), ilLMPresentationGUI\getSuccessorPage(), ilLMPresentationGUI\ilLMNavigation(), ilImprint\isActive(), ilLMTOCExplorerGUI\isNodeClickable(), ilObjBlogGUI\renderList(), ilObjBlogGUI\renderNavigationByAuthors(), ilObjBlogGUI\renderNavigationByDate(), ilLMPresentationGUI\showPrintView(), and ilLMPresentationGUI\showPrintViewSelection().

{
global $ilDB;
// language must be set at least to "-"
if ($a_lang == "")
{
$a_lang = "-";
}
if (isset(self::$activation_data[$a_id.":".$a_parent_type.":".$a_lang]))
{
$rec = self::$activation_data[$a_id.":".$a_parent_type.":".$a_lang];
}
else
{
$set = $ilDB->queryF("SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s".
" AND parent_type = %s AND lang = %s",
array("integer", "text", "text"),
array($a_id, $a_parent_type, $a_lang));
$rec = $ilDB->fetchAssoc($set);
}
$rec["n"] = ilUtil::now();
if (!$rec["active"] && $a_check_scheduled_activation)
{
if ($rec["n"] >= $rec["activation_start"] &&
$rec["n"] <= $rec["activation_end"])
{
return true;
}
}
return $rec["active"];
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilPageObject::_lookupContainsDeactivatedElements (   $a_id,
  $a_parent_type,
  $a_lang = "-" 
)
static

lookup whether page contains deactivated elements

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

References $ilDB, $query, and DB_FETCHMODE_ASSOC.

Referenced by ilLMPagesTableGUI\fillRow(), ilChapterHierarchyFormGUI\getChildIcon(), ilChapterHierarchyFormGUI\getChildIconAlt(), ilLMEditorExplorerGUI\getNodeIcon(), ilPublicSectionExplorerGUI\getNodeIcon(), and ilLMEditorExplorerGUI\getNodeIconAlt().

{
global $ilDB;
if ($a_lang == "")
{
$a_lang = "-";
}
$query = "SELECT * FROM page_object WHERE page_id = ".
$ilDB->quote($a_id, "integer")." AND ".
" parent_type = ".$ilDB->quote($a_parent_type, "text")." AND ".
" lang = ".$ilDB->quote($a_lang, "text")." AND ".
" inactive_elements = ".$ilDB->quote(1, "integer");
$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 3261 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::_writeActive (   $a_id,
  $a_parent_type,
  $a_active,
  $a_reset_scheduled_activation = true,
  $a_lang = "-" 
)

write activation status

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

References $ilDB.

Referenced by ilStructureObjectGUI\activatePages(), and ilObjContentObjectGUI\activatePages().

{
global $ilDB;
// language must be set at least to "-"
if ($a_lang == "")
{
$a_lang = "-";
}
if ($a_reset_scheduled_activation)
{
$st = $ilDB->manipulateF("UPDATE page_object SET active = %s, activation_start = %s, ".
" activation_end = %s WHERE page_id = %s".
" AND parent_type = %s AND lang = %s", array("boolean", "timestamp", "timestamp", "integer", "text", "text"),
array($a_active, null, null, $a_id, $a_parent_type, $a_lang));
}
else
{
$st = $ilDB->prepareManip("UPDATE page_object SET active = %s WHERE page_id = %s".
" AND parent_type = %s AND lang = %s", array("boolean", "integer", "text", "text"),
array($a_active, $a_id, $a_parent_type, $a_lang));
}
}

+ Here is the caller graph for this function:

ilPageObject::_writeParentId (   $a_parent_type,
  $a_pg_id,
  $a_par_id 
)

Write parent id.

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

References $ilDB.

Referenced by ilWikiImporter\finalProcessing(), ilBlogImporter\finalProcessing(), and ilPortfolioImporter\finalProcessing().

{
global $ilDB;
$st = $ilDB->manipulateF("UPDATE page_object SET parent_id = %s WHERE page_id = %s".
" AND parent_type = %s", array("integer", "integer", "text"),
array($a_par_id, $a_pg_id, $a_parent_type));
}

+ Here is the caller graph for this function:

ilPageObject::addChangeDivClasses (   $a_hashes)

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

References $path, $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"] != "")
{
$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);
}
}
//echo "<br><br><br><br><br><br>".htmlentities($this->getXMLFromDom());
}

+ Here is the call graph for this function:

ilPageObject::addFileSizes ( )

add file sizes

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

References $id, $path, $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 1658 of file class.ilPageObject.php.

References $path, $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"
{
require_once("./Services/COPage/classes/class.ilPageContent.php");
$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 486 of file class.ilPageObject.php.

References $update_listener_cnt.

Referenced by ilBlogPosting\read().

{
$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++;
}

+ Here is the caller graph for this function:

ilPageObject::afterConstructor ( )

After constructor.

Parameters
@return

Reimplemented in ilSCORM2004Page, ilWikiPage, and ilLMPage.

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

Referenced by ilPageObject().

{
}

+ Here is the caller graph for this function:

ilPageObject::afterUpdate ( )

After update.

Parameters
@return

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

Referenced by __afterUpdate().

{
}

+ Here is the caller graph for this function:

ilPageObject::appendLangVarXML ( $xml,
  $var 
)

Definition at line 1326 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 962 of file class.ilPageObject.php.

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

transforms bbCode to corresponding xml

Definition at line 3563 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::beforePageContentUpdate (   $a_page_content)

Before page content update.

Note: This one is "work in progress", currently only text paragraphs call this hook It is called before the page content object invokes the update procedure of ilPageObject

Parameters
@return

Reimplemented in ilLMPage.

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

{
}
ilPageObject::buildDom (   $a_force = false)

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

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

Referenced by countPageContents(), createFromXML(), delete(), ilSCORM2004Page\exportXMLPageContent(), getInitialOpenedContent(), ilPortfolioTemplatePage\getPageDiskSize(), handleImportRepositoryLink(), ilPCVerification\isInPortfolioPage(), moveIntLinks(), ilSCORM2004Page\performAutomaticModifications(), saveInitialOpenedContent(), and updateFromXML().

{
if ($this->dom_builded && !$a_force)
{
return;
}
//echo "\n<br>buildDomWith:".$this->getId().":xml:".$this->getXMLContent(true).":<br>";
$this->dom = @domxml_open_mem($this->getXMLContent(true), DOMXML_LOAD_VALIDATING, $error);
$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 495 of file class.ilPageObject.php.

References $update_listener_cnt.

Referenced by __afterUpdate().

{
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::checkForTag (   $a_content_tag,
  $a_hier_id,
  $a_pc_id = "" 
)

Get content node from dom.

Parameters
string$a_hier_idhierarchical ID
string$a_pc_idpage content ID

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

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

Referenced by deleteContents(), and switchEnableMultiple().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::checkPCIds ( )

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

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

References $dom, $path, $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 = " | ";
$path.= $sep."//".$el."[@PCID='']";
}
$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::collectMediaObjects (   $a_inline_only = true)

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

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

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

Referenced by delete(), ilSCORM2004Page\exportXMLPageContent(), 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 media aliases of interactive images
$xpc = xpath_new_context($this->dom);
$path = "//InteractiveImage/MediaAlias";
$res =& xpath_eval($xpc, $path);
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 4165 of file class.ilPageObject.php.

References getId(), ilPageObjectFactory\getInstance(), and getParentType().

{
// get page objects
include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
$l_page = ilPageObjectFactory::getInstance($this->getParentType(), $this->getId(), $a_left);
$r_page = ilPageObjectFactory::getInstance($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::containsDeactivatedElements (   $a_content)

Check whether content contains deactivated elements.

Parameters
@return

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

Referenced by createFromXML(), update(), and updateFromXML().

{
if (strpos($a_content, " Enabled=\"False\""))
{
return true;
}
return false;
}

+ Here is the caller 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 1391 of file class.ilPageObject.php.

References $contains_int_link.

ilPageObject::containsIntLinks (   $a_content)

Check whether content contains internal links.

Parameters
@return

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

Referenced by createFromXML(), update(), and updateFromXML().

{
if (strpos($a_content, "IntLink"))
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

ilPageObject::copy (   $a_id,
  $a_parent_type = "",
  $a_parent_id = 0,
  $a_clone_mobs = false 
)

Copy page.

Parameters
int$a_idtarget page id
string$a_parent_typetarget parent type
int$a_parent_idtarget parent id

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

References _exists(), getId(), ilPageObjectFactory\getInstance(), getParentId(), and getParentType().

{
if ($a_parent_type == "")
{
$a_parent_type = $this->getParentType();
if ($a_parent_id == 0)
{
$a_parent_id = $this->getParentId();
}
}
include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
foreach (self::lookupTranslations($this->getParentType(), $this->getId()) as $l)
{
$existed = false;
$orig_page = ilPageObjectFactory::getInstance($this->getParentType(), $this->getId(), 0, $l);
if (ilPageObject::_exists($a_parent_type, $a_id, $l))
{
$new_page_object = ilPageObjectFactory::getInstance($a_parent_type, $a_id, 0, $l);
$existed = true;
}
else
{
$new_page_object = ilPageObjectFactory::getInstance($a_parent_type, 0, 0, $l);
$new_page_object->setParentId($a_parent_id);
$new_page_object->setId($a_id);
}
$new_page_object->setXMLContent($orig_page->copyXMLContent($a_clone_mobs));
$new_page_object->setActive($orig_page->getActive());
$new_page_object->setActivationStart($orig_page->getActivationStart());
$new_page_object->setActivationEnd($orig_page->getActivationEnd());
if ($existed)
{
$new_page_object->buildDom();
$new_page_object->update();
}
else
{
$new_page_object->create();
}
}
}

+ Here is the call graph for this function:

ilPageObject::copyContents (   $a_hids)

Copy contents to clipboard.

Parameters
string$a_hidsarray of hierarchical ids of content objects

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

References $ilUser, getContentNode(), ilEditClipboard\setAction(), and ilPageContent\sortHierIds().

Referenced by cutContents().

{
global $ilUser;
//var_dump($a_hids);
if (!is_array($a_hids))
{
return;
}
$time = date("Y-m-d H:i:s", time());
$hier_ids = array();
$skip = array();
foreach($a_hids as $a_hid)
{
if ($a_hid == "")
{
continue;
}
$a_hid = explode(":", $a_hid);
// check, whether new hid is child of existing one or vice versa
reset($hier_ids);
foreach($hier_ids as $h)
{
if($h."_" == substr($a_hid[0], 0, strlen($h) + 1))
{
$skip[] = $a_hid[0];
}
if($a_hid[0]."_" == substr($h, 0, strlen($a_hid[0]) + 1))
{
$skip[] = $h;
}
}
$pc_id[$a_hid[0]] = $a_hid[1];
if ($a_hid[0] != "")
{
$hier_ids[$a_hid[0]] = $a_hid[0];
}
}
foreach ($skip as $s)
{
unset($hier_ids[$s]);
}
include_once("./Services/COPage/classes/class.ilPageContent.php");
$hier_ids = ilPageContent::sortHierIds($hier_ids);
$nr = 1;
foreach($hier_ids as $hid)
{
$curr_node = $this->getContentNode($hid, $pc_id[$hid]);
if (is_object($curr_node))
{
if ($curr_node->node_name() == "PageContent")
{
$content = $this->dom->dump_node($curr_node);
// remove pc and hier ids
$content = eregi_replace("PCID=\"[a-z0-9]*\"","",$content);
$content = eregi_replace("HierId=\"[a-z0-9_]*\"","",$content);
$ilUser->addToPCClipboard($content, $time, $nr);
$nr++;
}
}
}
include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::copyPageToTranslation (   $a_target_lang)

Copy page to translation.

Parameters
string$a_target_langtarget language

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

References getActivationEnd(), getActivationStart(), getActive(), getId(), ilPageObjectFactory\getInstance(), getParentId(), and getParentType().

{
0, 0, $a_target_lang);
$transl_page->setId($this->getId());
$transl_page->setParentId($this->getParentId());
$transl_page->setXMLContent($this->copyXMLContent());
$transl_page->setActive($this->getActive());
$transl_page->setActivationStart($this->getActivationStart());
$transl_page->setActivationEnd($this->getActivationEnd());
$transl_page->create();
}

+ Here is the call graph for this function:

ilPageObject::copyXmlContent (   $a_clone_mobs = false)

Copy content of page; replace page components with copies where necessary (e.g.

questions)

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

References $xml, DOMXML_LOAD_PARSING, domxml_open_mem(), and handleCopiedContent().

{
$xml = $this->getXmlContent();
$temp_dom = domxml_open_mem('<?xml version="1.0" encoding="UTF-8"?>'.$xml,
if(empty($error))
{
$this->handleCopiedContent($temp_dom, true, $a_clone_mobs);
}
$xml = $temp_dom->dump_mem(0, $this->encoding);
$xml = eregi_replace("<\?xml[^>]*>","",$xml);
$xml = eregi_replace("<!DOCTYPE[^>]*>","",$xml);
return $xml;
}

+ Here is the call graph for this function:

ilPageObject::countPageContents ( )

Remove questions from document.

Parameters
@return

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

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

{
// Get question IDs
$this->buildDom();
$path = "//PageContent";
$xpc = xpath_new_context($this->dom);
$res = & xpath_eval($xpc, $path);
return count ($res->nodeset);
}

+ Here is the call graph for this function:

ilPageObject::create ( )

create new page (with current xml data)

Reimplemented in ilSCORM2004Page.

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

References createFromXML().

Referenced by ilDataCollectionRecordViewViewdefinition\create(), ilBlogPosting\create(), ilPortfolioPage\create(), and ilWikiPage\create().

{
$this->createFromXML();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::createFromXML ( )

Create new page object with current xml content.

Reimplemented in ilWikiPage.

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

References $ilDB, $ilUser, $lng, __afterUpdate(), buildDom(), containsDeactivatedElements(), containsIntLinks(), getActive(), getDomDoc(), getId(), getLanguage(), getParentId(), getParentType(), getXMLContent(), ilUtil\now(), and setXMLContent().

Referenced by create().

{
global $lng, $ilDB, $ilUser;
//echo "<br>PageObject::createFromXML[".$this->getId()."]";
$empty = false;
if($this->getXMLContent() == "")
{
$this->setXMLContent("<PageObject></PageObject>");
$empty = true;
}
$content = $this->getXMLContent();
$this->buildDom(true);
$dom_doc = $this->getDomDoc();
$iel = $this->containsDeactivatedElements($content);
$inl = $this->containsIntLinks($content);
// create object
$ilDB->insert("page_object", array(
"page_id" => array("integer", $this->getId()),
"parent_id" => array("integer", $this->getParentId()),
"lang" => array("text", $this->getLanguage()),
"content" => array("clob", $content),
"parent_type" => array("text", $this->getParentType()),
"create_user" => array("integer", $ilUser->getId()),
"last_change_user" => array("integer", $ilUser->getId()),
"active" => array("integer", $this->getActive()),
"inactive_elements" => array("integer", $iel),
"int_links" => array("integer", $inl),
"created" => array("timestamp", ilUtil::now()),
"last_change" => array("timestamp", ilUtil::now())
));
// after update event
$this->__afterUpdate($dom_doc, $content, true, $empty);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::cutContents (   $a_hids)

Copy contents to clipboard and cut them from the page.

Parameters
string$a_hidsarray of hierarchical ids of content objects

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

References copyContents(), deleteContents(), and getPageConfig().

{
$this->copyContents($a_hids);
return $this->deleteContents($a_hids, true, $this->getPageConfig()->getEnableSelfAssessment());
}

+ Here is the call graph for this function:

ilPageObject::delete ( )

delete page object

Reimplemented in ilWikiPage, ilBlogPosting, ilPortfolioPage, ilSCORM2004Page, and ilMediaPoolPage.

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

References $GLOBALS, $ilDB, $mobs, __beforeDelete(), ilObjMediaObject\_deleteAllUsages(), ilObject\_exists(), ilObjMediaObject\_getMobsOfObject(), ilObject\_lookupType(), buildDom(), collectMediaObjects(), deleteInternalLinks(), ilNewsItem\deleteNewsOfContext(), deleteStyleUsages(), getId(), getParentId(), and getParentType().

{
global $ilDB;
$mobs = array();
$files = array();
if (!$this->page_not_found)
{
$this->buildDom();
$mobs = $this->collectMediaObjects(false);
}
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$mobs2 = ilObjMediaObject::_getMobsOfObject($this->getParentType().":pg", $this->getId(), false);
foreach ($mobs2 as $m)
{
if (!in_array($m, $mobs))
{
$mobs[] = $m;
}
}
$this->__beforeDelete();
// delete style usages
$this->deleteStyleUsages(false);
// delete internal links
// delete all mob usages
// delete news
include_once("./Services/News/classes/class.ilNewsItem.php");
$this->getParentType(), $this->getId(), "pg");
// delete page_object entry
$ilDB->manipulate("DELETE FROM page_object ".
"WHERE page_id = ".$ilDB->quote($this->getId(), "integer").
" AND parent_type= ".$ilDB->quote($this->getParentType(), "text"));
//$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();
}
}
/* delete public and private notes (see PageObjectGUI->getNotesHTML())
as they can be seen as personal data we are keeping them for now
include_once("Services/Notes/classes/class.ilNote.php");
foreach(array(IL_NOTE_PRIVATE, IL_NOTE_PUBLIC) as $note_type)
{
foreach(ilNote::_getNotesOfObject($this->getParentId(), $this->getId(),
$this->getParentType(), $note_type) as $note)
{
$note->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 2974 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 3230 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 3200 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,
  $a_self_ass = false 
)

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 2992 of file class.ilPageObject.php.

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

Referenced by cutContents().

{
if (!is_array($a_hids))
{
return;
}
foreach($a_hids as $a_hid)
{
$a_hid = explode(":", $a_hid);
//echo "-".$a_hid[0]."-".$a_hid[1]."-";
// @todo 1: hook
// do not delete question nodes in assessment pages
if (!$this->checkForTag("Question", $a_hid[0], $a_hid[1]) || $a_self_ass)
{
$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:

+ Here is the caller graph for this function:

ilPageObject::deleteInternalLinks ( )

Delete internal links.

Parameters
@return

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

References ilInternalLink\_deleteAllLinksOfSource(), getId(), getLanguage(), and getParentType().

Referenced by delete(), and saveInternalLinks().

{
include_once("./Services/Link/classes/class.ilInternalLink.php");
$this->getLanguage());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::deleteStyleUsages (   $a_old_nr = 0)

Delete style usages.

Parameters
@return

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

References $ilDB.

Referenced by delete(), and saveStyleUsage().

{
global $ilDB;
if ($a_old_nr !== false)
{
$and_old_nr = " AND page_nr = ".$ilDB->quote($a_old_nr, "integer");
}
$ilDB->manipulate("DELETE FROM page_style_usage WHERE ".
" page_id = ".$ilDB->quote($this->getId(), "integer").
" AND page_type = ".$ilDB->quote($this->getParentType(), "text").
" AND page_lang = ".$ilDB->quote($this->getLanguage(), "text").
$and_old_nr
);
}

+ Here is the caller graph for this function:

ilPageObject::existsPCId (   $a_pc_id)

existsPCId

Parameters
@return

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

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

{
$this->builddom();
$mydom = $this->dom;
$pcids = array();
$sep = $path = "";
foreach ($this->id_elements as $el)
{
$path.= $sep."//".$el."[@PCID='".$a_pc_id."']";
$sep = " | ";
}
// get existing ids
$xpc = xpath_new_context($mydom);
$res = & xpath_eval($xpc, $path);
return (count($res->nodeset) > 0);
}

+ Here is the call graph for this function:

ilPageObject::freeDom ( )

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

Referenced by ilSCORM2004Page\exportXMLPageContent().

{
//$this->dom->free();
unset($this->dom);
}

+ Here is the caller graph for this function:

ilPageObject::generatePcId (   $a_pc_ids = false)

Generate new pc id.

Parameters
array$a_pc_idsexisting pc ids
Returns
string new pc id

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

References $id, and getAllPCIds().

{
if ($a_pc_ids === false)
{
$a_pc_ids = $this->getAllPCIds();
}
$id = ilUtil::randomHash(10, $a_pc_ids);
return $id;
}

+ Here is the call graph for this function:

ilPageObject::getActivationEnd ( )

Get Activation End.

Returns
date Activation End

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

Referenced by copyPageToTranslation(), getActive(), update(), and updateFromXML().

{
return $this->activationend;
}

+ Here is the caller graph for this function:

ilPageObject::getActivationStart ( )

Get Activation Start.

Returns
date Activation Start

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

Referenced by copyPageToTranslation(), getActive(), update(), and updateFromXML().

{
return $this->activationstart;
}

+ Here is the caller graph for this function:

ilPageObject::getActive (   $a_check_scheduled_activation = false)

get activation

Returns
boolean true/false for active or not

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

References ilDateTime\_after(), ilDateTime\_before(), getActivationEnd(), getActivationStart(), IL_CAL_DATETIME, and IL_CAL_UNIX.

Referenced by ilBlogPosting\checkApproval(), copyPageToTranslation(), createFromXML(), ilBlogPosting\update(), update(), and updateFromXML().

{
if ($a_check_scheduled_activation && !$this->active)
{
include_once("./Services/Calendar/classes/class.ilDateTime.php");
$now = new ilDateTime(time(), IL_CAL_UNIX);
if (!ilDateTime::_before($now, $start) && !ilDateTime::_after($now, $end))
{
return true;
}
}
return $this->active;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilPageObject::getAllPages (   $a_parent_type,
  $a_parent_id,
  $a_lang = "-" 
)
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 4305 of file class.ilPageObject.php.

References $ilDB.

Referenced by ilObjContentObject\autoLinkGlossaryTerms(), and ilBlogPosting\getAllPostings().

{
global $ilDB;
$and_lang = "";
if ($a_lang != "")
{
$and_lang = " AND lang = ".$ilDB->quote($a_lang, "text");
}
$page_changes = array();
$q = "SELECT * FROM page_object ".
" WHERE parent_id = ".$ilDB->quote($a_parent_id, "integer").
" AND parent_type = ".$ilDB->quote($a_parent_type, "text").$and_lang;
$set = $ilDB->query($q);
$pages = array();
while ($page = $ilDB->fetchAssoc($set))
{
$key_add = ($a_lang == "")
? ":".$page["lang"]
: "";
$pages[$page["page_id"].$key_add] = array(
"date" => $page["last_change"],
"id" => $page["page_id"],
"lang" => $page["lang"],
"user" => $page["last_change_user"]);
}
return $pages;
}

+ Here is the caller graph for this function:

ilPageObject::getAllPCIds ( )

Get all pc ids.

Parameters
@return

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

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

Referenced by generatePcId(), and insertPCIds().

{
$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");
}
return $pcids;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::getContainsQuestion ( )

Get contains question.

Returns
boolean contains question

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

{
return $this->contains_question;
}
& ilPageObject::getContentNode (   $a_hier_id,
  $a_pc_id = "" 
)

Get content node from dom.

Parameters
string$a_hier_idhierarchical ID
string$a_pc_idpage content ID

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

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

Referenced by copyContents(), deleteContent(), deleteContentBeforeHierId(), deleteContentFromHierId(), deleteContents(), getContentObject(), insertContent(), insertContentNode(), 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 = "" 
)

Get a content object of the page.

Parameters
stringhier ID
stringPC ID
Returns
object page content object

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

References $_GET, $_POST, $tab, ilObject\_exists(), exit, getContentNode(), and ilCOPagePCDef\getPCDefinitionByName().

Referenced by ilSCORM2004Page\exportXMLPageContent(), moveContentAfter(), moveContentBefore(), and switchEnableMultiple().

{
$cont_node = $this->getContentNode($a_hier_id, $a_pc_id);
if (!is_object($cont_node))
{
return false;
}
include_once("./Services/COPage/classes/class.ilCOPagePCDef.php");
$node_name = $cont_node->node_name();
if ($node_name == "PageObject")
{
return null;
}
if ($node_name == "PageContent")
{
$child_node = $cont_node->first_child();
$node_name = $child_node->node_name();
}
// table extra handling (@todo: get rid of it)
if ($node_name == "Table")
{
if ($child_node->get_attribute("DataTable") == "y")
{
require_once("./Services/COPage/classes/class.ilPCDataTable.php");
$tab = new ilPCDataTable($this);
$tab->setNode($cont_node);
$tab->setHierId($a_hier_id);
}
else
{
require_once("./Services/COPage/classes/class.ilPCTable.php");
$tab = new ilPCTable($this);
$tab->setNode($cont_node);
$tab->setHierId($a_hier_id);
}
$tab->setPcId($a_pc_id);
return $tab;
}
// media extra handling (@todo: get rid of it)
if ($node_name == "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);
$mob->readMediaObject($mob_id);
//$mob->setDom($this->dom);
$mob->setNode($cont_node);
$mob->setHierId($a_hier_id);
$mob->setPcId($a_pc_id);
return $mob;
}
//
// generic procedure
//
$pc_def = ilCOPagePCDef::getPCDefinitionByName($node_name);
// check if pc definition has been found
if (!is_array($pc_def))
{
include_once("./Services/COPage/exceptions/class.ilCOPageUnknownPCTypeException.php");
throw new ilCOPageUnknownPCTypeException('Unknown PC Name "'.$node_name.'".');
}
$pc_class = "ilPC".$pc_def["name"];
$pc_path = "./".$pc_def["component"]."/".$pc_def["directory"]."/class.".$pc_class.".php";
require_once($pc_path);
$pc = new $pc_class($this);
$pc->setNode($cont_node);
$pc->setHierId($a_hier_id);
$pc->setPcId($a_pc_id);
return $pc;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::getContentTemplates ( )

Get content templates.

Returns
array array of arrays with "id" => page id (int), "parent_type" => parent type (string), "title" => title (string)

Reimplemented in ilWikiPage.

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

{
return array();
}
ilPageObject::getDom ( )

Deprecated php4DomDocument.

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

References $dom.

Referenced by ilPortfolioTemplatePage\getPageDiskSize(), and ilPCVerification\isInPortfolioPage().

{
return $this->dom;
}

+ Here is the caller graph for this function:

ilPageObject::getDomDoc ( )

Get dom doc (php5 dom document)

Parameters
@return

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

References $dom.

Referenced by ilWikiPage\create(), createFromXML(), ilSCORM2004Page\exportXMLPageContent(), update(), and updateFromXML().

{
if ($this->dom instanceof php4DOMDocument)
{
return $this->dom->myDOMDocument;
}
return $this->dom;
}

+ Here is the caller graph for this function:

ilPageObject::getEditLock ( )

Get page lock.

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

References $ilDB, $ilUser, getId(), and getParentType().

Referenced by update().

{
global $ilUser, $ilDB;
$aset = new ilSetting("adve");
$min = (int) $aset->get("block_mode_minutes") ;
if ($min > 0)
{
// try to set the lock for the user
$ts = time();
$ilDB->manipulate("UPDATE page_object SET ".
" edit_lock_user = ".$ilDB->quote($ilUser->getId(), "integer").",".
" edit_lock_ts = ".$ilDB->quote($ts, "integer").
" WHERE (edit_lock_user = ".$ilDB->quote($ilUser->getId(), "integer")." OR ".
" edit_lock_ts < ".$ilDB->quote(time() - ($min * 60), "integer").") ".
" AND page_id = ".$ilDB->quote($this->getId(), "integer").
" AND parent_type = ".$ilDB->quote($this->getParentType(), "text")
);
$set = $ilDB->query("SELECT edit_lock_user FROM page_object ".
" WHERE page_id = ".$ilDB->quote($this->getId(), "integer").
" AND parent_type = ".$ilDB->quote($this->getParentType(), "text")
);
$rec = $ilDB->fetchAssoc($set);
if ($rec["edit_lock_user"] != $ilUser->getId())
{
return false;
}
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::getEditLockInfo ( )

Get edit lock info.

Returns
array info array

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

References $ilDB.

Referenced by update().

{
global $ilDB;
$aset = new ilSetting("adve");
$min = (int) $aset->get("block_mode_minutes");
$set = $ilDB->query("SELECT edit_lock_user, edit_lock_ts FROM page_object ".
" WHERE page_id = ".$ilDB->quote($this->getId(), "integer").
" AND parent_type = ".$ilDB->quote($this->getParentType(), "text")
);
$rec = $ilDB->fetchAssoc($set);
$rec["edit_lock_until"] = $rec["edit_lock_ts"] + $min * 60;
return $rec;
}

+ Here is the caller graph for this function:

ilPageObject::getFileItemIds ( )

get ids of all file items

Reimplemented in ilSCORM2004Page.

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

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

get ids of all first table columns

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

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

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

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

{
if($this->dom)
{
require_once("./Services/COPage/classes/class.ilPCParagraph.php");
$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);
$par->setNode($cont_node);
return $par->getText();
}
}
return "";
}

+ Here is the call graph for this function:

ilPageObject::getFirstRowIds ( )

get ids of all first table rows

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

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

get fo page content

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

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

{
$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);
var_dump($fo);
// 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 1781 of file class.ilPageObject.php.

Referenced by deleteContentBeforeHierId(), and deleteContentFromHierId().

{
return $this->hier_ids;
}

+ Here is the caller graph for this function:

ilPageObject::getHierIdsForPCIds (   $a_pc_ids)

Get hier ids for a set of pc ids.

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

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

{
if (!is_array($a_pc_ids) || count($a_pc_ids) == 0)
{
return array();
}
$ret = array();
if(is_object($this->dom))
{
$xpc = xpath_new_context($this->dom);
$path = "//*[@PCID]";
$res =& xpath_eval($xpc, $path);
for($i = 0; $i < count($res->nodeset); $i++) // should only be 1
{
$pc_id = $res->nodeset[$i]->get_attribute("PCID");
if (in_array($pc_id, $a_pc_ids))
{
$ret[$pc_id] = $res->nodeset[$i]->get_attribute("HierId");
}
}
unset($xpc);
}
//var_dump($ret);
return $ret;
}

+ Here is the call graph for this function:

ilPageObject::getHistoryEntries ( )

Get History Entries.

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

References $ilDB, getId(), getLanguage(), and getParentType().

{
global $ilDB;
$h_query = "SELECT * FROM page_history ".
" WHERE page_id = ".$ilDB->quote($this->getId(), "integer").
" AND parent_type = ".$ilDB->quote($this->getParentType(), "text").
" AND lang = ".$ilDB->quote($this->getLanguage(), "text").
" ORDER BY hdate DESC";
$hset = $ilDB->query($h_query);
$hentries = array();
while ($hrec = $ilDB->fetchAssoc($hset))
{
$hrec["sortkey"] = (int) $hrec["nr"];
$hrec["user"] = (int) $hrec["user_id"];
$hentries[] = $hrec;
}
//var_dump($hentries);
return $hentries;
}

+ Here is the call graph for this function:

ilPageObject::getHistoryEntry (   $a_old_nr)

Get History Entry.

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

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

{
global $ilDB;
$res = $ilDB->queryF("SELECT * FROM page_history ".
" WHERE page_id = %s ".
" AND parent_type = %s ".
" AND nr = %s".
" AND lang = %s",
array("integer", "text", "integer", "text"),
array($this->getId(), $this->getParentType(), $a_old_nr, $this->getLanguage()));
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 4071 of file class.ilPageObject.php.

References $ilDB, $res, $ret, and $row.

{
global $ilDB;
// determine previous entry
$and_nr = ($a_nr > 0)
? " AND nr < ".$ilDB->quote((int) $a_nr, "integer")
: "";
$res = $ilDB->query("SELECT MAX(nr) mnr FROM page_history ".
" WHERE page_id = ".$ilDB->quote($this->getId(), "integer").
" AND parent_type = ".$ilDB->quote($this->getParentType(), "text").
" AND lang = ".$ilDB->quote($this->getLanguage(), "text").
$and_nr);
$row = $ilDB->fetchAssoc($res);
if ($row["mnr"] > 0)
{
$res = $ilDB->query("SELECT * FROM page_history ".
" WHERE page_id = ".$ilDB->quote($this->getId(), "integer").
" AND parent_type = ".$ilDB->quote($this->getParentType(), "text").
" AND lang = ".$ilDB->quote($this->getLanguage(), "text").
" AND nr = ".$ilDB->quote((int) $row["mnr"], "integer"));
$row = $ilDB->fetchAssoc($res);
$ret["previous"] = $row;
}
// determine next entry
$res = $ilDB->query("SELECT MIN(nr) mnr FROM page_history ".
" WHERE page_id = ".$ilDB->quote($this->getId(), "integer").
" AND parent_type = ".$ilDB->quote($this->getParentType(), "text").
" AND lang = ".$ilDB->quote($this->getLanguage(), "text").
" AND nr > ".$ilDB->quote((int) $a_nr, "integer"));
$row = $ilDB->fetchAssoc($res);
if ($row["mnr"] > 0)
{
$res = $ilDB->query("SELECT * FROM page_history ".
" WHERE page_id = ".$ilDB->quote($this->getId(), "integer").
" AND parent_type = ".$ilDB->quote($this->getParentType(), "text").
" AND lang = ".$ilDB->quote($this->getLanguage(), "text").
" AND nr = ".$ilDB->quote((int) $row["mnr"], "integer"));
$row = $ilDB->fetchAssoc($res);
$ret["next"] = $row;
}
// current
if ($a_nr > 0)
{
$res = $ilDB->query("SELECT * FROM page_history ".
" WHERE page_id = ".$ilDB->quote($this->getId(), "integer").
" AND parent_type = ".$ilDB->quote($this->getParentType(), "text").
" AND lang = ".$ilDB->quote($this->getLanguage(), "text").
" AND nr = ".$ilDB->quote((int) $a_nr, "integer"));
$row = $ilDB->fetchAssoc($res);
}
else
{
$res = $ilDB->query("SELECT page_id, last_change hdate, parent_type, parent_id, last_change_user user_id, content, lang FROM page_object ".
" WHERE page_id = ".$ilDB->quote($this->getId(), "integer").
" AND parent_type = ".$ilDB->quote($this->getParentType(), "text").
" AND lang = ".$ilDB->quote($this->getLanguage(), "text"));
$row = $ilDB->fetchAssoc($res);
}
$ret["current"] = $row;
return $ret;
}
ilPageObject::getImportMode ( )

Get import mode.

Returns
bool import mode

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

References $import_mode.

{
}
ilPageObject::getInitialOpenedContent ( )

Get initial opened content.

Parameters

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

References $id, $path, $res, ilInternalLink\_extractObjIdOfTarget(), buildDom(), xpath_eval(), and xpath_new_context().

{
$this->buildDom();
$xpc = xpath_new_context($this->dom);
$path = "//PageObject/InitOpenedContent";
$res = xpath_eval($xpc, $path);
$il_node = null;
if (count($res->nodeset) > 0)
{
$init_node = $res->nodeset[0];
$childs = $init_node->child_nodes();
for($i = 0; $i < count($childs); $i++)
{
if ($childs[$i]->node_name() == "IntLink")
{
$il_node = $childs[$i];
}
}
}
if (!is_null($il_node))
{
$id = $il_node->get_attribute("Target");
$link_type = $il_node->get_attribute("Type");
$target = $il_node->get_attribute("TargetFrame");
switch($link_type)
{
case "MediaObject":
$type = "media";
break;
case "PageObject":
$type = "page";
break;
case "GlossaryItem":
$type = "term";
break;
}
include_once("./Services/Link/classes/class.ilInternalLink.php");
return array("id" => $id, "type" => $type, "target" => $target);
}
return array();
}

+ Here is the call graph for this function:

ilPageObject::getInternalLinks (   $a_cnt_multiple = false)

get all internal links that are used within the page

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

References $id, $path, $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();
$cnt_multiple = 1;
for($i = 0; $i < count($res->nodeset); $i++)
{
$add = "";
if ($a_cnt_multiple)
{
$add = ":".$cnt_multiple;
}
$target = $res->nodeset[$i]->get_attribute("Target");
$type = $res->nodeset[$i]->get_attribute("Type");
$targetframe = $res->nodeset[$i]->get_attribute("TargetFrame");
$anchor = $res->nodeset[$i]->get_attribute("Anchor");
$links[$target.":".$type.":".$targetframe.":".$anchor.$add] =
array("Target" => $target, "Type" => $type,
"TargetFrame" => $targetframe, "Anchor" => $anchor);
// 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.":-";
$cnt_multiple++;
}
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::getLanguage ( )

Get language.

Returns
string language code

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

References $language.

Referenced by createFromXML(), deleteInternalLinks(), getHistoryEntries(), getHistoryEntry(), read(), saveInternalLinks(), update(), updateFromXML(), and writeRenderedContent().

{
}

+ Here is the caller graph for this function:

ilPageObject::getLanguageVariablesXML ( )

Get language variables as XML.

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

References $lng, $xml, appendLangVarXML(), ilCOPagePCDef\getPCDefinitions(), and ilCOPagePCDef\requirePCClassByName().

Referenced by getXMLFromDom().

{
global $lng;
$xml = "<LVs>";
$lang_vars = array(
"ed_paste_clip", "ed_edit", "ed_edit_prop", "ed_delete", "ed_moveafter",
"ed_movebefore", "ed_go", "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_split_page_next","ed_enable",
"de_activate", "ed_paste", "ed_edit_multiple", "ed_cut", "ed_copy", "ed_insert_templ",
"ed_click_to_add_pg", "download");
// collect lang vars from pc elements
include_once("./Services/COPage/classes/class.ilCOPagePCDef.php");
foreach ($defs as $def)
{
$lang_vars[] = "pc_".$def["pc_type"];
$lang_vars[] = "ed_insert_".$def["pc_type"];
$cl = $def["pc_class"];
$lvs = call_user_func($def["pc_class"].'::getLangVars');
foreach ($lvs as $lv)
{
$lang_vars[] = $lv;
}
}
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 256 of file class.ilPageObject.php.

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

Get last change user.

Returns
integer last change user

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

{
return $this->last_change_user;
}
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 2861 of file class.ilPageObject.php.

References $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 1808 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 1614 of file class.ilPageObject.php.

References $path, $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 1591 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);
}
}
//var_dump($mobs_xml);
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,
  $a_lang = "-" 
)
static

Get new pages.

Parameters
string$a_parent_typeParent Type
int$a_parent_idParent ID

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

References $ilDB.

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

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

References $node.

Referenced by insertContent(), and insertContentNode().

{
return $this->node;
}

+ Here is the caller graph for this function:

ilPageObject::getOfflineHandler ( )

Get offline handler.

Parameters
@return

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

References $offline_handler.

ilPageObject::getPageConfig ( )

Get page config object.

Returns
object page config object

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

Referenced by ilLMPage\afterConstructor(), ilSCORM2004Page\afterConstructor(), ilWikiPage\afterConstructor(), cutContents(), and insertContent().

{
return $this->page_config;
}

+ Here is the caller graph for this function:

ilPageObject::getPageContentsHashes ( )

Get page contents hashes.

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

References $dom, $path, $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();
require_once("./Services/COPage/classes/class.ilPCParagraph.php");
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,
  $a_lang = "-" 
)
static

Get all contributors for parent object.

Parameters
string$a_parent_typeParent Type
int$a_parent_idParent ID

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

References $ilDB, and ilObjUser\_lookupName().

{
global $ilDB;
$and_lang = "";
if ($a_lang != "")
{
$and_lang = " AND lang = ".$ilDB->quote($a_lang, "text");
}
$contributors = array();
$set = $ilDB->queryF("SELECT last_change_user, lang FROM page_object ".
" WHERE page_id = %s AND parent_type = %s ".
" AND last_change_user != %s".$and_lang,
array("integer", "text", "integer"),
array($a_page_id, $a_parent_type, 0));
while ($page = $ilDB->fetchAssoc($set))
{
if ($a_lang == "")
{
$contributors[$page["last_change_user"]][$page["lang"]] = 1;
}
else
{
$contributors[$page["last_change_user"]] = 1;
}
}
$set = $ilDB->queryF("SELECT count(DISTINCT page_id, parent_type, hdate, lang) as cnt, lang, page_id, user_id FROM page_history ".
" WHERE page_id = %s AND parent_type = %s AND user_id != %s ".$and_lang.
" GROUP BY user_id, page_id, lang ",
array("integer", "text", "integer"),
array($a_page_id, $a_parent_type, 0));
while ($hpage = $ilDB->fetchAssoc($set))
{
if ($a_lang == "")
{
$contributors[$hpage["user_id"]][$page["lang"]] =
$contributors[$hpage["user_id"]][$page["lang"]] + $hpage["cnt"];
}
else
{
$contributors[$hpage["user_id"]] =
$contributors[$hpage["user_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:

static ilPageObject::getPagesWithLinks (   $a_parent_type,
  $a_parent_id,
  $a_lang = "-" 
)
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 4534 of file class.ilPageObject.php.

References $ilDB.

Referenced by ilLMPageObject\getPagesWithLinksList().

{
global $ilDB;
$page_changes = array();
$and_lang = "";
if ($a_lang != "")
{
$and_lang = " AND lang = ".$ilDB->quote($a_lang, "text");
}
$q = "SELECT * FROM page_object ".
" WHERE parent_id = ".$ilDB->quote($a_parent_id, "integer").
" AND parent_type = ".$ilDB->quote($a_parent_type, "text").
" AND int_links = ".$ilDB->quote(1, "integer").$and_lang;
$set = $ilDB->query($q);
$pages = array();
while ($page = $ilDB->fetchAssoc($set))
{
$key_add = ($a_lang == "")
? ":".$page["lang"]
: "";
$pages[$page["page_id"].$key_add] = array(
"date" => $page["last_change"],
"id" => $page["page_id"],
"lang" => $page["lang"],
"user" => $page["last_change_user"]);
}
return $pages;
}

+ Here is the caller graph for this function:

static ilPageObject::getParentObjectContributors (   $a_parent_type,
  $a_parent_id,
  $a_lang = "-" 
)
static

Get all contributors for parent object.

Parameters
string$a_parent_typeParent Type
int$a_parent_idParent ID

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

References $ilDB, ilObjUser\_lookupName(), and ilObject\_lookupType().

{
global $ilDB;
$and_lang = "";
if ($a_lang != "")
{
$and_lang = " AND lang = ".$ilDB->quote($a_lang, "text");
}
$contributors = array();
$set = $ilDB->queryF("SELECT last_change_user, lang, page_id FROM page_object ".
" WHERE parent_id = %s AND parent_type = %s ".
" AND last_change_user != %s".$and_lang,
array("integer", "text", "integer"),
array($a_parent_id, $a_parent_type, 0));
while ($page = $ilDB->fetchAssoc($set))
{
if ($a_lang == "")
{
$contributors[$page["last_change_user"]][$page["page_id"]][$page["lang"]] = 1;
}
else
{
$contributors[$page["last_change_user"]][$page["page_id"]] = 1;
}
}
$set = $ilDB->queryF("SELECT count(DISTINCT page_id, parent_type, hdate, lang) as cnt, lang, page_id, user_id FROM page_history ".
" WHERE parent_id = %s AND parent_type = %s AND user_id != %s ".$and_lang.
" GROUP BY page_id, user_id, lang ",
array("integer", "text", "integer"),
array($a_parent_id, $a_parent_type, 0));
while ($hpage = $ilDB->fetchAssoc($set))
{
if ($a_lang == "")
{
$contributors[$hpage["user_id"]][$hpage["page_id"]][$hpage["lang"]] =
$contributors[$hpage["user_id"]][$hpage["page_id"]][$hpage["lang"]] + $hpage["cnt"];
}
else
{
$contributors[$hpage["user_id"]][$hpage["page_id"]] =
$contributors[$hpage["user_id"]][$hpage["page_id"]] + $hpage["cnt"];
}
}
$c = array();
foreach ($contributors as $k => $co)
{
if (ilObject::_lookupType($k) == "usr")
{
$c[] = array("user_id" => $k, "pages" => $co,
"lastname" => $name["lastname"], "firstname" => $name["firstname"]);
}
}
return $c;
}

+ Here is the call graph for this function:

ilPageObject::getQuestionIds ( )

Get question ids.

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

References $dom, $path, $res, ilInternalLink\_extractInstOfTarget(), ilInternalLink\_extractObjIdOfTarget(), xpath_eval(), and xpath_new_context().

{
$this->builddom();
$mydom = $this->dom;
// Get question IDs
$path = "//Question";
$xpc = xpath_new_context($mydom);
$res = & xpath_eval($xpc, $path);
$q_ids = array();
include_once("./Services/Link/classes/class.ilInternalLink.php");
for ($i = 0; $i < count ($res->nodeset); $i++)
{
$qref = $res->nodeset[$i]->get_attribute("QRef");
if (!($inst_id > 0))
{
if ($obj_id > 0)
{
$q_ids[] = $obj_id;
}
}
}
return $q_ids;
}

+ Here is the call graph for this function:

static ilPageObject::getRecentChanges (   $a_parent_type,
  $a_parent_id,
  $a_period = 30,
  $a_lang = "" 
)
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 4242 of file class.ilPageObject.php.

References $ilDB, and ilUtil\sortArray().

{
global $ilDB;
$and_lang = "";
if ($a_lang != "")
{
$and_lang = " AND lang = ".$ilDB->quote($a_lang, "text");
}
$page_changes = array();
$limit_ts = date('Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
$q = "SELECT * FROM page_object ".
" WHERE parent_id = ".$ilDB->quote($a_parent_id, "integer").
" AND parent_type = ".$ilDB->quote($a_parent_type, "text").
" AND last_change >= ".$ilDB->quote($limit_ts, "timestamp").$and_lang;
// " AND (TO_DAYS(now()) - TO_DAYS(last_change)) <= ".((int)$a_period);
$set = $ilDB->query($q);
while($page = $ilDB->fetchAssoc($set))
{
$page_changes[] = array(
"date" => $page["last_change"],
"id" => $page["page_id"],
"lang" => $page["lang"],
"type" => "page",
"user" => $page["last_change_user"]);
}
$and_str = "";
if ($a_period > 0)
{
$limit_ts = date('Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
$and_str = " AND hdate >= ".$ilDB->quote($limit_ts, "timestamp")." ";
}
$q = "SELECT * FROM page_history ".
" WHERE parent_id = ".$ilDB->quote($a_parent_id, "integer").
" AND parent_type = ".$ilDB->quote($a_parent_type, "text").
$and_str.$and_lang;
$set = $ilDB->query($q);
while ($page = $ilDB->fetchAssoc($set))
{
$page_changes[] = array(
"date" => $page["hdate"],
"id" => $page["page_id"],
"lang" => $page["lang"],
"type" => "hist",
"nr" => $page["nr"],
"user" => $page["user_id"]);
}
$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 216 of file class.ilPageObject.php.

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

Get Rendered Time.

Returns
string Rendered Time

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

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

Get Render MD5.

Returns
string Render MD5

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

{
return $this->rendermd5;
}
ilPageObject::getShowActivationInfo ( )

Get show page activation info.

Returns
bool show page actication info

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

Referenced by update().

{
return $this->show_page_act_info;
}

+ Here is the caller graph for this function:

ilPageObject::getXMLContent (   $a_incl_head = false)

get xml content of page

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

References $xml.

Referenced by buildDom(), createFromXML(), 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 1220 of file class.ilPageObject.php.

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

Referenced by ilSCORM2004Page\exportXMLPageContent(), 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)
{
// deprecated
// $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::handleCopiedContent (   $a_dom,
  $a_self_ass = true,
  $a_clone_mobs = false 
)

Handle copied content.

This function copies items, that must be copied, if page content is duplicated.

Parameters
@return

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

References ilCOPagePCDef\getPCDefinitions(), newIIMCopies(), newMobCopies(), newQuestionCopies(), removeQuestions(), and ilCOPagePCDef\requirePCClassByName().

Referenced by copyXmlContent(), and pasteContents().

{
include_once("./Services/COPage/classes/class.ilCOPagePCDef.php");
// handle question elements
if ($a_self_ass)
{
$this->newQuestionCopies($a_dom);
}
else
{
$this->removeQuestions($a_dom);
}
// handle interactive images
$this->newIIMCopies($a_dom);
// handle media objects
if ($a_clone_mobs)
{
$this->newMobCopies($a_dom);
}
// @todo 1: move all functions from above to the new domdoc
if ($a_dom instanceof php4DOMDocument)
{
$a_dom = $a_dom->myDOMDocument;
}
foreach ($defs as $def)
{
$cl = $def["pc_class"];
$cl::handleCopiedContent($a_dom, $a_self_ass, $a_clone_mobs);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::handleImportRepositoryLink (   $a_rep_import_id,
  $a_rep_type,
  $a_rep_ref_id 
)

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

References $path, $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::ilPageObject (   $a_id = 0,
  $a_old_nr = 0,
  $a_lang = "-" 
)
final

Constructor public.

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

References $ilias, afterConstructor(), getParentType(), initPageConfig(), read(), setActive(), and setLanguage().

{
global $ilias;
// @todo: move this elsewhere
require_once("./Services/COPage/syntax_highlight/php/Beautifier/Init.php");
require_once("./Services/COPage/syntax_highlight/php/Output/Output_css.php");
$this->parent_type = $this->getParentType();
$this->id = $a_id;
$this->ilias =& $ilias;
$this->setLanguage($a_lang);
$this->contains_int_link = false;
$this->needs_parsing = false;
$this->update_listeners = array();
$this->update_listener_cnt = 0;
$this->dom_builded = false;
$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", "ContentPopup");
$this->setActive(true);
if($a_id != 0)
{
$this->read();
}
$this->initPageConfig();
$this->afterConstructor();
}

+ Here is the call graph for this function:

ilPageObject::increaseViewCnt ( )

Increase view cnt.

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

References $ilDB.

{
global $ilDB;
$ilDB->manipulate("UPDATE page_object ".
" SET view_cnt = view_cnt + 1 ".
" WHERE page_id = ".$ilDB->quote($this->getId(), "integer").
" AND parent_type = ".$ilDB->quote($this->getParentType(), "text").
" AND lang = ".$ilDB->quote($this->getLanguage(), "text"));
}
ilPageObject::initPageConfig ( )
final

Init page config.

Returns

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

References ilPageObjectFactory\getConfigInstance(), getParentType(), and setPageConfig().

Referenced by ilPageObject().

{
include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
$this->setPageConfig($cfg);
}

+ Here is the call graph for this function:

+ Here is the caller 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 3318 of file class.ilPageObject.php.

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

Referenced by moveContentAfter(), and moveContentBefore().

{
//echo "-".$a_pos."-".$a_pcid."-";
// move mode into container elements is always INSERT_CHILD
$curr_node = $this->getContentNode($a_pos, $a_pcid);
$curr_name = $curr_node->node_name();
// @todo: try to generalize this
if (($curr_name == "TableData") || ($curr_name == "PageObject") ||
($curr_name == "ListItem") || ($curr_name == "Section")
|| ($curr_name == "Tab") || ($curr_name == "ContentPopup"))
{
$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;
}
//check for PlaceHolder to remove in EditMode-keep in Layout Mode
if (!$this->getPageConfig()->getEnablePCType("PlaceHolder")) {
$sub_nodes = $curr_node->child_nodes() ;
foreach ( $sub_nodes as $sub_node ) {
if ($sub_node->node_name() == "PlaceHolder") {
$curr_node->unlink_node();
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::insertContentNode ( $a_cont_node,
  $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 3424 of file class.ilPageObject.php.

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

Referenced by pasteContents().

{
// move mode into container elements is always INSERT_CHILD
$curr_node = $this->getContentNode($a_pos, $a_pcid);
$curr_name = $curr_node->node_name();
// @todo: try to generalize
if (($curr_name == "TableData") || ($curr_name == "PageObject") ||
($curr_name == "ListItem") || ($curr_name == "Section")
|| ($curr_name == "Tab") || ($curr_name == "ContentPopup"))
{
$a_mode = IL_INSERT_CHILD;
}
$hid = $curr_node->get_attribute("HierId");
if ($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);
switch ($a_mode)
{
// insert new node after sibling at $a_pos
//$new_node =& $a_cont_obj->getNode();
if($succ_node = $curr_node->next_sibling())
{
$a_cont_node = $succ_node->insert_before($a_cont_node, $succ_node);
}
else
{
$a_cont_node = $parent_node->append_child($a_cont_node);
}
//$a_cont_obj->setNode($new_node);
break;
//$new_node =& $a_cont_obj->getNode();
$succ_node = $this->getContentNode($a_pos);
$a_cont_node = $succ_node->insert_before($a_cont_node, $succ_node);
//$a_cont_obj->setNode($new_node);
break;
// insert new node as first child of parent $a_pos (= $a_parent)
//$new_node =& $a_cont_obj->getNode();
if($cnt_parent_childs == 0)
{
$a_cont_node = $parent_node->append_child($a_cont_node);
}
else
{
$a_cont_node = $parent_childs[0]->insert_before($a_cont_node, $parent_childs[0]);
}
//$a_cont_obj->setNode($new_node);
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 3577 of file class.ilPageObject.php.

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

Referenced by ilSCORM2004Page\exportXMLPageContent().

{
// 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>
// this leads to bug 6685.
if ($a_res_ref_to_obj_id && $type == "RepositoryItem")
{
$id_arr = explode("_", $id);
// changed due to bug 6685
$ref_id = $id_arr[1];
$obj_id = ilObject::_lookupObjId($id_arr[1]);
$otype = ilObject::_lookupType($obj_id);
if ($obj_id > 0)
{
// changed due to bug 6685
// the ref_id should be used, if the content is
// imported on the same installation
// the obj_id should be used, if a different
// installation imports, but has an import_id for
// the object id.
$id = $otype."_".$obj_id."_".$ref_id;
//$id = $otype."_".$ref_id;
}
}
$new_target = "il_".$a_inst."_".$id;
$res->nodeset[$i]->set_attribute("Target", $new_target);
}
}
unset($xpc);
// @todo: move to media/fileitems/questions, ...
// 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 question references
$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:

+ Here is the caller graph for this function:

ilPageObject::insertPCIds ( )

Insert Page Content IDs.

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

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

Referenced by update().

{
$this->builddom();
$mydom = $this->dom;
$pcids = $this->getAllPCIds();
// add missing ones
$sep = $path = "";
foreach ($this->id_elements as $el)
{
$path.= $sep."//".$el."[not(@PCID)]";
$sep = " | ";
$path.= $sep."//".$el."[@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::lookforhier (   $a_hier_id)

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

References $path, $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:

static ilPageObject::lookupParentId (   $a_id,
  $a_type 
)
static

Lookup parent id.

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

References $ilDB, and $res.

Referenced by ilObjMediaObject\getParentObjectIdForUsage(), and ilLMPageGUI\processAnswer().

{
global $ilDB;
$res = $ilDB->query("SELECT parent_id FROM page_object WHERE page_id = ".$ilDB->quote($a_id, "integer")." ".
"AND parent_type=".$ilDB->quote($a_type, "text"));
$rec = $ilDB->fetchAssoc($res);
return $rec["parent_id"];
}

+ Here is the caller graph for this function:

static ilPageObject::lookupTranslations (   $a_parent_type,
  $a_id 
)
static

Lookup translations.

Parameters
string$a_parent_typeparent type
int$a_idpage id
Returns
array language codes

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

References $ilDB.

{
global $ilDB;
$set = $ilDB->query("SELECT lang FROM page_object ".
" WHERE page_id = ".$ilDB->quote($a_id, "integer").
" AND parent_type = ".$ilDB->quote($a_parent_type, "text")
);
$langs = array();
while ($rec = $ilDB->fetchAssoc($set))
{
$langs[] = $rec["lang"];
}
return $langs;
}
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 3538 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 3512 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 2081 of file class.ilPageObject.php.

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

{
$this->buildDom();
$changed = false;
// 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]);
$changed = true;
}
if ($type == "StructureObject" && ilLMObject::_lookupType($a_from_to[$obj_id]) == "st")
{
$res->nodeset[$i]->set_attribute("Target", "il__st_".$a_from_to[$obj_id]);
$changed = true;
}
}
}
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)
{
$changed = true;
$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);
return $changed;
}

+ Here is the call graph for this function:

ilPageObject::needsImportParsing (   $a_parse = "")

Definition at line 1416 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::newIIMCopies (   $temp_dom)

Replaces media objects in interactive images with copies of the interactive images.

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

References $path, $res, ilInternalLink\_extractInstOfTarget(), ilInternalLink\_extractObjIdOfTarget(), xpath_eval(), and xpath_new_context().

Referenced by handleCopiedContent().

{
// Get question IDs
$path = "//InteractiveImage/MediaAlias";
$xpc = xpath_new_context($temp_dom);
$res = & xpath_eval($xpc, $path);
$q_ids = array();
include_once("./Services/Link/classes/class.ilInternalLink.php");
for ($i = 0; $i < count ($res->nodeset); $i++)
{
$or_id = $res->nodeset[$i]->get_attribute("OriginId");
if (!($inst_id > 0))
{
if ($mob_id > 0)
{
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$media_object = new ilObjMediaObject($mob_id);
// now copy this question and change reference to
// new question id
$new_mob = $media_object->duplicate();
$res->nodeset[$i]->set_attribute("OriginId", "il__mob_".$new_mob->getId());
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::newMobCopies (   $temp_dom)

Replaces media objects with copies.

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

References $path, $res, ilInternalLink\_extractInstOfTarget(), ilInternalLink\_extractObjIdOfTarget(), xpath_eval(), and xpath_new_context().

Referenced by handleCopiedContent().

{
// Get question IDs
$path = "//MediaObject/MediaAlias";
$xpc = xpath_new_context($temp_dom);
$res = & xpath_eval($xpc, $path);
$q_ids = array();
include_once("./Services/Link/classes/class.ilInternalLink.php");
for ($i = 0; $i < count ($res->nodeset); $i++)
{
$or_id = $res->nodeset[$i]->get_attribute("OriginId");
if (!($inst_id > 0))
{
if ($mob_id > 0)
{
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$media_object = new ilObjMediaObject($mob_id);
// now copy this question and change reference to
// new question id
$new_mob = $media_object->duplicate();
$res->nodeset[$i]->set_attribute("OriginId", "il__mob_".$new_mob->getId());
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::newQuestionCopies ( $temp_dom)

Replaces existing question content elements with new copies.

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

References $path, $res, _exists(), ilInternalLink\_extractInstOfTarget(), ilInternalLink\_extractObjIdOfTarget(), assQuestion\_instantiateQuestion(), xpath_eval(), and xpath_new_context().

Referenced by handleCopiedContent().

{
// Get question IDs
$path = "//Question";
$xpc = xpath_new_context($temp_dom);
$res = & xpath_eval($xpc, $path);
$q_ids = array();
include_once("./Services/Link/classes/class.ilInternalLink.php");
for ($i = 0; $i < count ($res->nodeset); $i++)
{
$qref = $res->nodeset[$i]->get_attribute("QRef");
if (!($inst_id > 0))
{
if ($q_id > 0)
{
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
// check due to #16557
if (is_object($question))
{
// check if page for question exists
// due to a bug in early 4.2.x version this is possible
if (!ilPageObject::_exists("qpl", $q_id))
{
$question->createPageObject();
}
// now copy this question and change reference to
// new question id
$duplicate_id = $question->duplicate(false);
$res->nodeset[$i]->set_attribute("QRef", "il__qst_".$duplicate_id);
}
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::pasteContents (   $a_hier_id,
  $a_self_ass = false 
)

Paste contents from pc clipboard.

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

References $ilUser, $path, $res, DOMXML_LOAD_PARSING, domxml_open_mem(), handleCopiedContent(), IL_INSERT_AFTER, insertContentNode(), update(), xpath_eval(), and xpath_new_context().

{
global $ilUser;
$a_hid = explode(":", $a_hier_id);
$content = $ilUser->getPCClipboardContent();
// we insert from last to first, because we insert all at the
// same hier_id
for ($i = count($content) - 1; $i >= 0; $i--)
{
$c = $content[$i];
$temp_dom = domxml_open_mem('<?xml version="1.0" encoding="UTF-8"?>'.$c,
if(empty($error))
{
$this->handleCopiedContent($temp_dom, $a_self_ass);
$xpc = xpath_new_context($temp_dom);
$path = "//PageContent";
$res = xpath_eval($xpc, $path);
if (count($res->nodeset) > 0)
{
$new_pc_node = $res->nodeset[0];
$cloned_pc_node = $new_pc_node->clone_node (true);
$cloned_pc_node->unlink_node ($cloned_pc_node);
$this->insertContentNode ($cloned_pc_node, $a_hid[0],
IL_INSERT_AFTER, $a_hid[1]);
}
}
else
{
//var_dump($error);
}
}
$e = $this->update();
//var_dump($e);
}

+ Here is the call graph for this function:

ilPageObject::performAutomaticModifications ( )

Perform automatic modifications (may be overwritten by sub classes)

Reimplemented in ilSCORM2004Page.

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

Referenced by update().

{
}

+ Here is the caller graph for this function:

static ilPageObject::preloadActivationDataByParentId (   $a_parent_id)
static

Preload activation data by Parent Id.

Parameters
integer$a_parent_idparent id

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

References $ilDB.

Referenced by ilLMExplorerGUI\__construct().

{
global $ilDB;
$set = $ilDB->query("SELECT page_id, parent_type, lang, active, activation_start, activation_end, show_activation_info FROM page_object ".
" WHERE parent_id = ".$ilDB->quote($a_parent_id, "integer")
);
while ($rec = $ilDB->fetchAssoc($set))
{
self::$activation_data[$rec["page_id"].":".$rec["parent_type"].":".$rec["lang"]] = $rec;
}
}

+ Here is the caller graph for this function:

ilPageObject::read ( )

Read page data.

Reimplemented in ilBlogPosting, ilPortfolioPage, ilSCORM2004Page, and ilMediaPoolPage.

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

References $ilDB, $query, getLanguage(), getParentType(), setActivationEnd(), setActivationStart(), setActive(), setLastChange(), setParentId(), setRenderedContent(), setRenderedTime(), setRenderMd5(), and setShowActivationInfo().

Referenced by ilWikiPage\createFromXML(), ilPageObject(), and ilWikiPage\read().

{
global $ilDB;
$this->setActive(true);
if ($this->old_nr == 0)
{
$query = "SELECT * FROM page_object".
" WHERE page_id = ".$ilDB->quote($this->id, "integer").
" AND parent_type=".$ilDB->quote($this->getParentType(), "text").
" AND lang = ".$ilDB->quote($this->getLanguage(), "text");
$pg_set = $this->ilias->db->query($query);
$this->page_record = $ilDB->fetchAssoc($pg_set);
$this->setActive($this->page_record["active"]);
$this->setActivationStart($this->page_record["activation_start"]);
$this->setActivationEnd($this->page_record["activation_end"]);
$this->setShowActivationInfo($this->page_record["show_activation_info"]);
}
else
{
$query = "SELECT * FROM page_history".
" WHERE page_id = ".$ilDB->quote($this->id, "integer").
" AND parent_type=".$ilDB->quote($this->getParentType(), "text").
" AND nr = ".$ilDB->quote((int) $this->old_nr, "integer").
" AND lang = ".$ilDB->quote($this->getLanguage(), "text");
$pg_set = $ilDB->query($query);
$this->page_record = $ilDB->fetchAssoc($pg_set);
}
if (!$this->page_record)
{
include_once("./Services/COPage/exceptions/class.ilCOPageNotFoundException.php");
throw new ilCOPageNotFoundException("Error: Page ".$this->id." is not in database".
" (parent type ".$this->getParentType().").");
}
$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"]);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::registerOfflineHandler (   $handler)

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

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

Release page lock.

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

References $ilDB, and $ilUser.

{
global $ilUser, $ilDB;
$aset = new ilSetting("adve");
$min = (int) $aset->get("block_mode_minutes") ;
if ($min > 0)
{
// try to set the lock for the user
$ts = time();
$ilDB->manipulate("UPDATE page_object SET ".
" edit_lock_user = ".$ilDB->quote($ilUser->getId(), "integer").",".
" edit_lock_ts = 0".
" WHERE edit_lock_user = ".$ilDB->quote($ilUser->getId(), "integer").
" AND page_id = ".$ilDB->quote($this->getId(), "integer").
" AND parent_type = ".$ilDB->quote($this->getParentType(), "text")
);
$set = $ilDB->query("SELECT edit_lock_user FROM page_object ".
" WHERE page_id = ".$ilDB->quote($this->getId(), "integer").
" AND parent_type = ".$ilDB->quote($this->getParentType(), "text")
);
$rec = $ilDB->fetchAssoc($set);
if ($rec["edit_lock_user"] != $ilUser->getId())
{
return false;
}
}
return true;
}
ilPageObject::removeQuestions ( $temp_dom)

Remove questions from document.

Parameters
@return

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

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

Referenced by handleCopiedContent().

{
// Get question IDs
$path = "//Question";
$xpc = xpath_new_context($temp_dom);
$res = & xpath_eval($xpc, $path);
for ($i = 0; $i < count ($res->nodeset); $i++)
{
$parent_node = $res->nodeset[$i]->parent_node();
$parent_node->unlink_node($parent_node);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::resolveFileItems (   $a_mapping)

Resolve file items (after import)

Parameters
arraymapping array

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

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

{
// resolve normal internal links
$xpc = xpath_new_context($this->dom);
$path = "//FileItem/Identifier";
$res =& xpath_eval($xpc, $path);
$changed = false;
for($i = 0; $i < count($res->nodeset); $i++)
{
$old_id = $res->nodeset[$i]->get_attribute("Entry");
$old_id = explode("_", $old_id);
$old_id = $old_id[count($old_id) - 1];
if ($a_mapping[$old_id] > 0)
{
$res->nodeset[$i]->set_attribute("Entry", "il__file_".$a_mapping[$old_id]);
$changed = true;
}
}
unset($xpc);
return $changed;
}

+ Here is the call graph for this function:

ilPageObject::resolveIIMMediaAliases (   $a_mapping)

Resolve iim media aliases (in ilContObjParse)

Parameters
arraymapping array

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

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

{
// resolve normal internal links
$xpc = xpath_new_context($this->dom);
$path = "//InteractiveImage/MediaAlias";
$res =& xpath_eval($xpc, $path);
$changed = false;
for($i = 0; $i < count($res->nodeset); $i++)
{
$old_id = $res->nodeset[$i]->get_attribute("OriginId");
if ($a_mapping[$old_id] > 0)
{
$res->nodeset[$i]->set_attribute("OriginId", "il__mob_".$a_mapping[$old_id]);
$changed = true;
}
}
unset($xpc);
return $changed;
}

+ Here is the call graph for this function:

ilPageObject::resolveIntLinks ( )

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

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

References $path, $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::resolveMediaAliases (   $a_mapping)

Resolve media aliases (after import)

Parameters
arraymapping array

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

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

{
// resolve normal internal links
$xpc = xpath_new_context($this->dom);
$path = "//MediaAlias";
$res =& xpath_eval($xpc, $path);
$changed = false;
for($i = 0; $i < count($res->nodeset); $i++)
{
$old_id = $res->nodeset[$i]->get_attribute("OriginId");
$old_id = explode("_", $old_id);
$old_id = $old_id[count($old_id) - 1];
if ($a_mapping[$old_id] > 0)
{
$res->nodeset[$i]->set_attribute("OriginId", "il__mob_".$a_mapping[$old_id]);
$changed = true;
}
}
unset($xpc);
return $changed;
}

+ Here is the call graph for this function:

ilPageObject::resolveQuestionReferences (   $a_mapping)

Resolve all quesion references (after import)

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

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

{
// resolve normal internal links
$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");
if (isset($a_mapping[$qref]))
{
$res->nodeset[$i]->set_attribute("QRef", "il__qst_".$a_mapping[$qref]["pool"]);
}
}
unset($xpc);
}

+ Here is the call graph for this function:

ilPageObject::saveInitialOpenedContent (   $a_type,
  $a_id,
  $a_target 
)

Save initial opened content.

Parameters

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

References $path, $res, $ret, buildDom(), update(), xpath_eval(), and xpath_new_context().

{
$this->buildDom();
switch($a_type)
{
case "media":
$link_type = "MediaObject";
$a_id = "il__mob_".$a_id;
break;
case "page":
$link_type = "PageObject";
$a_id = "il__pg_".$a_id;
break;
case "term":
$link_type = "GlossaryItem";
$a_id = "il__git_".$a_id;
$a_target = "Glossary";
break;
}
// if type or id missing -> delete InitOpenedContent, if existing
if ($link_type == "" || $a_id == "")
{
$xpc = xpath_new_context($this->dom);
$path = "//PageObject/InitOpenedContent";
$res = xpath_eval($xpc, $path);
if (count($res->nodeset) > 0)
{
$res->nodeset[0]->unlink_node($res->nodeset[0]);
}
}
else
{
$xpc = xpath_new_context($this->dom);
$path = "//PageObject/InitOpenedContent";
$res = xpath_eval($xpc, $path);
if (count($res->nodeset) > 0)
{
$init_node = $res->nodeset[0];
$childs = $init_node->child_nodes();
for($i = 0; $i < count($childs); $i++)
{
if ($childs[$i]->node_name() == "IntLink")
{
$il_node = $childs[$i];
}
}
}
else
{
$path = "//PageObject";
$res = xpath_eval($xpc, $path);
$page_node = $res->nodeset[0];
$init_node = $this->dom->create_element("InitOpenedContent");
$init_node = $page_node->append_child($init_node);
$il_node = $this->dom->create_element("IntLink");
$il_node = $init_node->append_child($il_node);
}
$il_node->set_attribute("Target", $a_id);
$il_node->set_attribute("Type", $link_type);
$il_node->set_attribute("TargetFrame", $a_target);
}
$ret = $this->update();
}

+ Here is the call graph for this function:

ilPageObject::saveInternalLinks (   $a_domdoc)

save internal links of page

Parameters
stringxml page code

Reimplemented in ilWikiPage.

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

References $ilDB, $node, $target_arr, ilInternalLink\_saveLink(), deleteInternalLinks(), getId(), getLanguage(), and getParentType().

Referenced by __afterUpdate().

{
global $ilDB;
// query IntLink elements
$xpath = new DOMXPath($a_domdoc);
$nodes = $xpath->query('//IntLink');
foreach($nodes as $node)
{
$link_type = $node->getAttribute("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;
case "File":
$t_type = "file";
break;
case "WikiPage":
$t_type = "wpage";
break;
}
$target = $node->getAttribute("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, $this->getLanguage());
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilPageObject::saveStyleUsage (   $a_domdoc,
  $a_old_nr = 0 
)

Save all style class/template usages.

Parameters
string$a_xmlxml data of page

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

References $ilDB, $node, $path, and deleteStyleUsages().

Referenced by __afterHistoryEntry(), and __afterUpdate().

{
global $ilDB;
// media aliases
$xpath = new DOMXPath($a_domdoc);
$path = "//Paragraph | //Section | //MediaAlias | //FileItem".
" | //Table | //TableData | //Tabs | //List";
$nodes = $xpath->query($path);
$usages = array();
foreach($nodes as $node)
{
switch ($node->localName)
{
case "Paragraph":
$sname = $node->getAttribute("Characteristic");
$stype = "text_block";
$template = 0;
break;
case "Section":
$sname = $node->getAttribute("Characteristic");
$stype = "section";
$template = 0;
break;
case "MediaAlias":
$sname = $node->getAttribute("Class");
$stype = "media_cont";
$template = 0;
break;
case "FileItem":
$sname = $node->getAttribute("Class");
$stype = "flist_li";
$template = 0;
break;
case "Table":
$sname = $node->getAttribute("Template");
if ($sname == "")
{
$sname = $node->getAttribute("Class");
$stype = "table";
$template = 0;
}
else
{
$stype = "table";
$template = 1;
}
break;
case "TableData":
$sname = $node->getAttribute("Class");
$stype = "table_cell";
$template = 0;
break;
case "Tabs":
$sname = $node->getAttribute("Template");
if ($sname != "")
{
if ($node->getAttribute("Type") == "HorizontalAccordion")
{
$stype = "haccordion";
}
if ($node->getAttribute("Type") == "VerticalAccordion")
{
$stype = "vaccordion";
}
}
$template = 1;
break;
case "List":
$sname = $node->getAttribute("Class");
if ($node->getAttribute("Type") == "Ordered")
{
$stype = "list_o";
}
else
{
$stype = "list_u";
}
$template = 0;
break;
}
if ($sname != "" && $stype != "")
{
$usages[$sname.":".$stype.":".$template] = array("sname" => $sname,
"stype" => $stype, "template" => $template);
}
}
$this->deleteStyleUsages($a_old_nr);
foreach ($usages as $u)
{
$ilDB->manipulate("INSERT INTO page_style_usage ".
"(page_id, page_type, page_lang, page_nr, template, stype, sname) VALUES (".
$ilDB->quote($this->getId(), "integer").",".
$ilDB->quote($this->getParentType(), "text").",".
$ilDB->quote($this->getLanguage(), "text").",".
$ilDB->quote($a_old_nr, "integer").",".
$ilDB->quote($u["template"], "integer").",".
$ilDB->quote($u["stype"], "text").",".
$ilDB->quote($u["sname"], "text").
")");
}
}

+ 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 3887 of file class.ilPageObject.php.

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

{
$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:

ilPageObject::setActivationEnd (   $a_activationend)

Set Activation End.

Parameters
date$a_activationendActivation End

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

Referenced by read().

{
$this->activationend = $a_activationend;
}

+ Here is the caller graph for this function:

ilPageObject::setActivationStart (   $a_activationstart)

Set Activation Start.

Parameters
date$a_activationstartActivation Start

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

Referenced by read().

{
$this->activationstart = $a_activationstart;
}

+ Here is the caller graph for this function:

ilPageObject::setActive (   $a_active)

set activation

Parameters
boolean$a_activetrue/false for active or not

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

Referenced by ilDataCollectionRecordViewViewdefinition\create(), ilDataCollectionRecordViewViewdefinition\doRead(), ilPageObject(), and read().

{
$this->active = $a_active;
}

+ 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 1381 of file class.ilPageObject.php.

{
$this->contains_int_link = $a_contains_link;
}
ilPageObject::setContainsQuestion (   $a_val)

Set contains question.

Parameters
boolean$a_valcontains question

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

{
$this->contains_question = $a_val;
}
ilPageObject::setId (   $a_id)

set id

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

Referenced by ilSCORM2004PageNode\create(), ilDataCollectionRecordViewViewdefinition\create(), ilBlogPosting\create(), ilPortfolioPage\create(), and ilWikiPage\create().

{
$this->id = $a_id;
}

+ Here is the caller graph for this function:

ilPageObject::setImportMode (   $a_val)

Set import mode.

Parameters
bool$a_valimport mode

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

{
$this->import_mode = $a_val;
}
ilPageObject::setLanguage (   $a_val)

Set language.

Parameters
string$a_vallanguage code or "-" for unknown / not set

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

Referenced by ilPageObject().

{
$this->language = $a_val;
}

+ Here is the caller graph for this function:

ilPageObject::setLastChange (   $a_lastchange)

Set Last Change.

Parameters
string$a_lastchangeLast Change

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

Referenced by read().

{
$this->lastchange = $a_lastchange;
}

+ Here is the caller graph for this function:

ilPageObject::setLastChangeUser (   $a_val)

Set last change user.

Parameters
integer$a_vallast change user

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

{
$this->last_change_user = $a_val;
}
ilPageObject::setPageConfig (   $a_val)

Set page config object.

Parameters
object$a_valpage config object

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

Referenced by initPageConfig().

{
$this->page_config = $a_val;
}

+ 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 1360 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 476 of file class.ilPageObject.php.

Referenced by read(), ilBlogPosting\setBlogId(), and ilWikiPage\setWikiId().

{
$this->parent_id = $a_id;
}

+ Here is the caller graph for this function:

ilPageObject::setRenderedContent (   $a_renderedcontent)

Set Rendered Content.

Parameters
string$a_renderedcontentRendered Content

Definition at line 206 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 226 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 186 of file class.ilPageObject.php.

Referenced by read().

{
$this->rendermd5 = $a_rendermd5;
}

+ Here is the caller graph for this function:

ilPageObject::setShowActivationInfo (   $a_val)

Set show page activation info.

Parameters
bool$a_valshow page actication info

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

Referenced by read().

{
$this->show_page_act_info = $a_val;
}

+ 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 950 of file class.ilPageObject.php.

Referenced by createFromXML(), and ilSCORM2004Page\createWithLayoutId().

{
$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 1825 of file class.ilPageObject.php.

References $path, $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,
  $a_self_ass = false 
)

(De-)activate elements

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

References checkForTag(), 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);
$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 ())
{
// do not deactivate question nodes in assessment pages
if (!$this->checkForTag("Question", $a_hid[0], $a_hid[1]) || $a_self_ass)
{
$cont_obj->disable();
}
}
else
{
$cont_obj->enable();
}
}
}
}
if ($a_update)
{
return $this->update();
}
}

+ Here is the call graph for this function:

static ilPageObject::truncateHTML (   $a_text,
  $a_length = 100,
  $a_ending = '...',
  $a_exact = false,
  $a_consider_html = true 
)
static

Truncate (html) string.

See Also
http://dodona.wordpress.com/2009/04/05/how-do-i-truncate-an-html-string-without-breaking-the-html-code/
Parameters
string$a_text
int$a_length
string$a_ending
bool$a_exact
bool$a_consider_html
Returns
string

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

References ilStr\shortenText().

Referenced by ilBlogPostingGUI\getSnippet(), and ilWikiUtil\sendNotification().

{
include_once "Services/Utilities/classes/class.ilStr.php";
if ($a_consider_html)
{
// if the plain text is shorter than the maximum length, return the whole text
if(strlen(preg_replace('/<.*?>/', '', $a_text)) <= $a_length)
{
return $a_text;
}
// splits all html-tags to scanable lines
$total_length = strlen($a_ending);
$open_tags = array();
$truncate = '';
preg_match_all('/(<.+?>)?([^<>]*)/s', $a_text, $lines, PREG_SET_ORDER);
foreach($lines as $line_matchings)
{
// if there is any html-tag in this line, handle it and add it (uncounted) to the output
if(!empty($line_matchings[1]))
{
// if it's an "empty element" with or without xhtml-conform closing slash
if(preg_match('/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1]))
{
// do nothing
}
// if tag is a closing tag
else if(preg_match('/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings))
{
// delete tag from $open_tags list
$pos = array_search($tag_matchings[1], $open_tags);
if ($pos !== false)
{
unset($open_tags[$pos]);
}
}
// if tag is an opening tag
else if (preg_match('/^<\s*([^\s>!]+).*?>$/s', $line_matchings[1], $tag_matchings))
{
// add tag to the beginning of $open_tags list
array_unshift($open_tags, strtolower($tag_matchings[1]));
}
// add html-tag to $truncate'd text
$truncate .= $line_matchings[1];
}
// calculate the length of the plain text part of the line; handle entities as one character
$content_length = strlen(preg_replace('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', ' ', $line_matchings[2]));
if($total_length+$content_length > $a_length)
{
// the number of characters which are left
$left = $a_length - $total_length;
$entities_length = 0;
// search for html entities
if(preg_match_all('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', $line_matchings[2], $entities, PREG_OFFSET_CAPTURE))
{
// calculate the real length of all entities in the legal range
foreach($entities[0] as $entity)
{
if($entity[1]+1-$entities_length <= $left)
{
$left--;
$entities_length += strlen($entity[0]);
}
else
{
// no more characters left
break;
}
}
}
// $truncate .= substr($line_matchings[2], 0, $left+$entities_length);
$truncate .= ilStr::shortenText($line_matchings[2], 0, $left+$entities_length);
// maximum lenght is reached, so get off the loop
break;
}
else
{
$truncate .= $line_matchings[2];
$total_length += $content_length;
}
// if the maximum length is reached, get off the loop
if($total_length >= $a_length)
{
break;
}
}
}
else
{
if(strlen($a_text) <= $a_length)
{
return $a_text;
}
else
{
// $truncate = substr($a_text, 0, $a_length - strlen($a_ending));
$truncate = ilStr::shortenText($a_text, 0, $a_length - strlen($a_ending));
}
}
// THIS IS BUGGY AS IT MIGHT BREAK AN OPEN TAG AT THE END
if(!sizeof($open_tags))
{
// if the words shouldn't be cut in the middle...
if (!$a_exact)
{
// ...search the last occurance of a space...
$spacepos = strrpos($truncate, ' ');
if($spacepos !== false)
{
// ...and cut the text in this position
// $truncate = substr($truncate, 0, $spacepos);
$truncate = ilStr::shortenText($truncate, 0, $spacepos);
}
}
}
// add the defined ending to the text
$truncate .= $a_ending;
if($a_consider_html)
{
// close all unclosed html-tags
foreach($open_tags as $tag)
{
$truncate .= '</'.$tag.'>';
}
}
return $truncate;
}

+ Here is the call graph for this function:

+ Here is the caller 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, ilPortfolioPage, ilDataCollectionRecordViewViewdefinition, ilSCORM2004Page, and ilMediaPoolPage.

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

References $errors, $ilCtrl, $ilDB, $ilLog, $ilUser, $lm_set, $lng, __afterHistoryEntry(), __afterUpdate(), checkPCIds(), containsDeactivatedElements(), containsIntLinks(), ilDatePresentation\formatDate(), getActivationEnd(), getActivationStart(), getActive(), getDomDoc(), getEditLock(), getEditLockInfo(), getId(), getLanguage(), ilUserUtil\getNamePresentation(), getParentId(), getParentType(), getShowActivationInfo(), getXMLFromDom(), IL_CAL_UNIX, ILIAS_VERSION_NUMERIC, insertPCIds(), ilUtil\now(), performAutomaticModifications(), and validateDom().

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

{
$lm_set = new ilSetting("lm");
//echo "<br>**".$this->getId()."**";
//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().":";
//debug_print_backtrace();
//echo "<br>PageObject::update:".htmlentities($this->getXMLFromDom()); exit;
// add missing pc ids
if (!$this->checkPCIds())
{
$this->insertPCIds();
}
// test validating
if($a_validate)
{
$errors = $this->validateDom();
}
//var_dump($errors); exit;
if (empty($errors) && !$this->getEditLock())
{
include_once("./Services/User/classes/class.ilUserUtil.php");
$lock = $this->getEditLockInfo();
$errors[0] = array(0 => 0,
1 => "nocontent#".$lng->txt("cont_not_saved_edit_lock_expired")."<br />".
$lng->txt("obj_usr").": ".
ilUserUtil::getNamePresentation($lock["edit_lock_user"])."<br />".
$lng->txt("content_until").": ".
ilDatePresentation::formatDate(new ilDateTime($lock["edit_lock_until"],IL_CAL_UNIX))
);
}
//echo "-".htmlentities($this->getXMLFromDom())."-"; exit;
if(empty($errors))
{
// @todo 1: is this page type or pc content type
// related -> plugins should be able to hook in!?
// get xml content
$content = $this->getXMLFromDom();
$dom_doc = $this->getDomDoc();
// this needs to be locked
// write history entry
$old_set = $ilDB->query("SELECT * FROM page_object WHERE ".
"page_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
"parent_type = ".$ilDB->quote($this->getParentType(), "text")." AND ".
"lang = ".$ilDB->quote($this->getLanguage(), "text"));
$last_nr_set = $ilDB->query("SELECT max(nr) as mnr FROM page_history WHERE ".
"page_id = ".$ilDB->quote($this->getId(), "integer")." AND ".
"parent_type = ".$ilDB->quote($this->getParentType(), "text")." AND ".
"lang = ".$ilDB->quote($this->getLanguage(), "text"));
$last_nr = $ilDB->fetchAssoc($last_nr_set);
if ($old_rec = $ilDB->fetchAssoc($old_set))
{
// only save, if something has changed
// added user id to the check for ilias 5.0, 7.10.2014
if (($content != $old_rec["content"] || $ilUser->getId() != $old_rec["last_change_user"]) &&
!$a_no_history && !$this->history_saved && $lm_set->get("page_history", 1))
{
if ($old_rec["content"] != "<PageObject></PageObject>")
{
$ilDB->manipulateF("DELETE FROM page_history WHERE ".
"page_id = %s AND parent_type = %s AND hdate = %s AND lang = %s",
array("integer", "text", "timestamp", "text"),
array($old_rec["page_id"], $old_rec["parent_type"], $old_rec["last_change"], $old_rec["lang"]));
// the following lines are a workaround for
// bug 6741
$last_c = $old_rec["last_change"];
if ($last_c == "")
{
$last_c = ilUtil::now();
}
$ilDB->insert("page_history", array(
"page_id" => array("integer", $old_rec["page_id"]),
"parent_type" => array("text", $old_rec["parent_type"]),
"lang" => array("text", $old_rec["lang"]),
"hdate" => array("timestamp", $last_c),
"parent_id" => array("integer", $old_rec["parent_id"]),
"content" => array("clob", $old_rec["content"]),
"user_id" => array("integer", $old_rec["last_change_user"]),
"ilias_version" => array("text", ILIAS_VERSION_NUMERIC),
"nr" => array("integer", (int) $last_nr["mnr"] + 1)
));
$old_content = $old_rec["content"];
$old_domdoc = new DOMDocument();
$old_nr = $last_nr["mnr"] + 1;
$old_domdoc->loadXML('<?xml version="1.0" encoding="UTF-8"?>'.$old_content);
// after history entry creation event
$this->__afterHistoryEntry($old_domdoc, $old_content, $old_nr);
$this->history_saved = true; // only save one time
}
else
{
$this->history_saved = true; // do not save on first change
}
}
}
//echo htmlentities($content);
$em = (trim($content) == "<PageObject/>")
? 1
: 0;
// @todo: pass dom instead?
$iel = $this->containsDeactivatedElements($content);
$inl = $this->containsIntLinks($content);
$ilDB->update("page_object", array(
"content" => array("clob", $content),
"parent_id" => array("integer", $this->getParentId()),
"last_change_user" => array("integer", $ilUser->getId()),
"last_change" => array("timestamp", ilUtil::now()),
"is_empty" => array("integer", $em),
"active" => array("integer", $this->getActive()),
"activation_start" => array("timestamp", $this->getActivationStart()),
"activation_end" => array("timestamp", $this->getActivationEnd()),
"show_activation_info" => array("integer", $this->getShowActivationInfo()),
"inactive_elements" => array("integer", $iel),
"int_links" => array("integer", $inl),
), array(
"page_id" => array("integer", $this->getId()),
"parent_type" => array("text", $this->getParentType()),
"lang" => array("text", $this->getLanguage())
));
// after update event
$this->__afterUpdate($dom_doc, $content);
//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.

This function is currently (4.4.0 alpha) called by:

  • ilContObjParser (LM and Glossary import parser)
  • ilSCORM13Package->dbImportSco (SCORM importer)
  • assQuestion->copyPageOfQuestion

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

References $ilDB, $ilUser, $lng, __afterUpdate(), buildDom(), containsDeactivatedElements(), containsIntLinks(), getActivationEnd(), getActivationStart(), getActive(), getDomDoc(), getId(), getLanguage(), getParentId(), getParentType(), getXMLContent(), and ilUtil\now().

{
global $lng, $ilDB, $ilUser;
//echo "<br>PageObject::updateFromXML[".$this->getId()."]";
//echo "update:".ilUtil::prepareDBString(($this->getXMLContent())).":<br>";
//echo "update:".htmlentities($this->getXMLContent()).":<br>";
$content = $this->getXMLContent();
$this->buildDom(true);
$dom_doc = $this->getDomDoc();
$iel = $this->containsDeactivatedElements($content);
$inl = $this->containsIntLinks($content);
$ilDB->update("page_object", array(
"content" => array("clob", $content),
"parent_id" => array("integer", $this->getParentId()),
"last_change_user" => array("integer", $ilUser->getId()),
"last_change" => array("timestamp", ilUtil::now()),
"active" => array("integer", $this->getActive()),
"activation_start" => array("timestamp", $this->getActivationStart()),
"activation_end" => array("timestamp", $this->getActivationEnd()),
"inactive_elements" => array("integer", $iel),
"int_links" => array("integer", $inl),
), array(
"page_id" => array("integer", $this->getId()),
"parent_type" => array("text", $this->getParentType()),
"lang" => array("text", $this->getLanguage())
));
// after update event
$this->__afterUpdate($dom_doc, $content);
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 1630 of file class.ilPageObject.php.

References stripHierIDs().

Referenced by update().

{
$this->stripHierIDs();
// possible fix for #14820
libxml_disable_entity_loader(false);
@$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 4512 of file class.ilPageObject.php.

References $ilDB, getId(), getLanguage(), getParentType(), and ilUtil\now().

{
global $ilDB;
$ilDB->update("page_object", array(
"rendered_content" => array("clob", $a_content),
"render_md5" => array("text", $a_md5),
"rendered_time" => array("timestamp", ilUtil::now())
), array(
"page_id" => array("integer", $this->getId()),
"lang" => array("text", $this->getLanguage()),
"parent_type" => array("text", $this->getParentType())
));
}

+ Here is the call graph for this function:

Field Documentation

ilPageObject::$activation_data = array()
staticprotected

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

ilPageObject::$contains_int_link

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

Referenced by containsIntLink().

ilPageObject::$cur_dtd = "ilias_pg_4_5.dtd"

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

ilPageObject::$dom_builded

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

ilPageObject::$encoding

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

ilPageObject::$exists = array()
static

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

ilPageObject::$history_saved

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

ilPageObject::$ilias

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

Referenced by ilPageObject().

ilPageObject::$import_mode = false
protected

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

Referenced by getImportMode().

ilPageObject::$language = "-"

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

Referenced by getLanguage().

ilPageObject::$needs_parsing

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

Referenced by needsImportParsing().

ilPageObject::$offline_handler

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

Referenced by getOfflineHandler().

ilPageObject::$parent_id

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

Referenced by getParentId().

ilPageObject::$parent_type

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

ilPageObject::$update_listener_cnt

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

Referenced by addUpdateListener(), and callUpdateListeners().

ilPageObject::$update_listeners

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


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