34    public function __construct(&$a_content_obj, $a_id = 0, $a_halt = 
true)
 
   40        $this->is_alias = 
false;
 
   41        $this->contains_int_link = 
false;
 
   42        $this->mobs_contained = array();
 
   43        $this->files_contained = array();
 
   44        $this->halt_on_error = $a_halt;
 
   53        if (is_object($this->page_object)) {
 
   54            unset($this->page_object);
 
   65        $this->page_object = 
new ilLMPage($this->
id, 0);
 
   68    public function create($a_upload = 
false, $a_omit_page_object_creation = 
false, $a_layout_id = 0)
 
   70        parent::create($a_upload);
 
   71        if ($a_omit_page_object_creation) {
 
   74        if (!is_object($this->page_object)) {
 
   77        $this->page_object->setId($this->
getId());
 
   78        $this->page_object->setParentId($this->
getLMId());
 
   79        if ($a_layout_id == 0) {
 
   80            $this->page_object->create($a_upload);
 
   82            $this->page_object->createWithLayoutId($a_layout_id);
 
   86    public function delete($a_delete_meta_data = 
true)
 
   88        parent::delete($a_delete_meta_data);
 
   89        $this->page_object->delete();
 
   96    public function copy($a_target_lm)
 
  100        $lm_page->setTitle($this->
getTitle());
 
  103        $lm_page->setLMId($a_target_lm->getId());
 
  104        $lm_page->setType($this->
getType());
 
  106        $lm_page->setImportId(
"il__pg_" . $this->
getId());
 
  107        $lm_page->create(
true);         
 
  112        if (trim($exp_id) != 
"") {
 
  120        $new_md = $md->cloneMD($a_target_lm->getId(), $lm_page->getId(), $this->getType());
 
  127                $a_target_lm->getId(),
 
  134        $page = $lm_page->getPageObject();
 
  135        $this->page_object->copy($page->getId(), $page->getParentType(), $page->getParentId());
 
  151        $lm_page->setTitle($this->
getTitle());
 
  153        $lm_page->setLMId($a_cont_obj->getId());
 
  154        $lm_page->setImportId(
"il__pg_" . $this->
getId());
 
  155        $lm_page->setType($this->
getType());
 
  157        $lm_page->create(
true);         
 
  158        $a_copied_nodes[$this->
getId()] = $lm_page->getId();
 
  162        $new_md = $md->cloneMD($a_cont_obj->getId(), $lm_page->getId(), $this->getType());
 
  165        $page = $lm_page->getPageObject();
 
  166        $page->setXMLContent($this->page_object->getXMLContent());
 
  180    public static function _splitPage($a_page_id, $a_pg_parent_type, $a_hier_id)
 
  190        $lm_page->setTitle($source_lm_page->getTitle());
 
  191        $lm_page->setLMId($source_lm_page->getLMId());
 
  192        $lm_page->setType($source_lm_page->getType());
 
  193        $lm_page->setDescription($source_lm_page->getDescription());
 
  194        $lm_page->create(
true);
 
  198        $source_page = $source_lm_page->getPageObject();
 
  199        $page = $lm_page->getPageObject();
 
  200        $page->setXMLContent($source_page->copyXMLContent());
 
  202        $page->buildDom(
true);
 
  207        $md = 
new ilMD($source_lm_page->getLMId(), $a_page_id, $source_lm_page->getType());
 
  208        $md->cloneMD($source_lm_page->getLMId(), $lm_page->getId(), $source_lm_page->getType());
 
  211        $tree = 
new ilTree($cont_obj->getId());
 
  212        $tree->setTableNames(
'lm_tree', 
'lm_data');
 
  213        $tree->setTreeTablePK(
"lm_id");
 
  214        if ($tree->isInTree($source_lm_page->getId())) {
 
  215            $parent_node = $tree->getParentNodeData($source_lm_page->getId());
 
  216            $tree->insertNode($lm_page->getId(), $parent_node[
"child"], $source_lm_page->getId());
 
  221        $page->deleteContentBeforeHierId($a_hier_id);
 
  225        $source_page->buildDom();
 
  226        $source_page->addHierIds();
 
  227        $source_page->deleteContentFromHierId($a_hier_id);
 
  245        $tree = 
new ilTree($cont_obj->getId());
 
  246        $tree->setTableNames(
'lm_tree', 
'lm_data');
 
  247        $tree->setTreeTablePK(
"lm_id");
 
  250        $source_page = $source_lm_page->getPageObject();
 
  253        $succ = $tree->fetchSuccessorNode($a_page_id, 
"pg");
 
  254        if ($succ[
"child"] > 0) {
 
  256            $target_page = $target_lm_page->getPageObject();
 
  257            $target_page->buildDom();
 
  258            $target_page->addHierIds();
 
  261            $source_page->buildDom();
 
  262            $source_page->addHierIds();
 
  266            return $succ[
"child"];
 
  278        $this->page_object = $a_page_obj;
 
  311        $this->is_alias = $a_is_alias;
 
  322        return $this->origin_id = $a_id;
 
  346        foreach ($pages as $page) {
 
  347            $ids[] = $page[
"obj_id"];
 
  352        foreach ($pages as $page) {
 
  353            if (is_array($linked_pages[$page[
"obj_id"]])) {
 
  368        $a_mode = self::CHAPTER_TITLE,
 
  369        $a_include_numbers = 
false,
 
  370        $a_time_scheduled_activation = 
false,
 
  371        $a_force_content = 
false,
 
  374        $a_include_short = 
false 
  376        if ($a_mode == self::NO_HEADER && !$a_force_content) {
 
  390        if ($a_include_short) {
 
  399        $languages = $ot->getLanguages();
 
  401        if ($a_lang != 
"-" && $ot->getContentActivated() && isset($languages[$a_lang])) {
 
  404            if ($a_include_short) {
 
  405                $trans_title = trim($lmobjtrans->getShortTitle());
 
  407            if ($trans_title == 
"") {
 
  408                $trans_title = $lmobjtrans->getTitle();
 
  410            if ($trans_title != 
"") {
 
  415        if ($a_mode == self::PAGE_TITLE) {
 
  421        if ($tree->isInTree($a_pg_id)) {
 
  422            $pred_node = $tree->fetchPredecessorNode($a_pg_id, 
"st");
 
  423            $childs = $tree->getChildsByType($pred_node[
"obj_id"], 
"pg");
 
  425            if (count($childs) > 1) {
 
  427                foreach ($childs as $child) {
 
  431                        $a_time_scheduled_activation
 
  436                        if ($act_data[
"show_activation_info"] &&
 
  442                    if ($child[
"type"] != 
"pg" || 
$active) {
 
  445                    if ($child[
"obj_id"] == $a_pg_id) {
 
  450                    $cnt_str = 
" (" . $cur_cnt . 
"/" . $cnt . 
")";
 
  454                $pred_node[
"obj_id"],
 
  474    public function exportXML(&$a_xml_writer, $a_mode = 
"normal", $a_inst = 0)
 
  477        $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
 
  490                $attrs[
"OriginId"] = 
"il_" . $a_inst .
 
  491                    "_pg_" . $this->
getId();
 
  492                $a_xml_writer->xmlElement(
"PageAlias", $attrs);
 
  499        $a_xml_writer->xmlEndTag(
"PageObject");
 
  508        $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
 
  511        $attrs[
"OriginId"] = 
"il_" . $a_inst .
 
  513        $a_xml_writer->xmlElement(
"PageAlias", $attrs);
 
  515        $a_xml_writer->xmlEndTag(
"PageObject");
 
  528        $md2xml->setExportMode(
true);
 
  529        $md2xml->startExport();
 
  530        $a_xml_writer->appendXML($md2xml->getXML());
 
  535        if ($a_tag == 
"Identifier" && $a_param == 
"Entry") {
 
  536            $a_value = 
"il_" . IL_INST_ID . 
"_pg_" . $this->
getId();
 
  554        $this->page_object->buildDom();
 
  555        $this->page_object->insertInstIntoIDs($a_inst);
 
  556        $this->mobs_contained = $this->page_object->collectMediaObjects(
false);
 
  558        $xml = $this->page_object->getXMLFromDom(
false, 
false, 
false, 
"", 
true);
 
  559        $xml = str_replace(
"&", 
"&", 
$xml);
 
  560        $a_xml_writer->appendXML(
$xml);
 
  562        $this->page_object->freeDom();
 
  573            $this->content_object->getType(),
 
  585        return $this->mobs_contained;
 
  595        return $this->files_contained;
 
  609            $attrs[
"font-family"] = 
"Times";
 
  610            $attrs[
"font-size"] = 
"14pt";
 
  611            $a_xml_writer->xmlElement(
"fo:block", $attrs, 
$title);
 
  615        $this->page_object->buildDom();
 
  616        $fo = $this->page_object->getFO();
 
  617        $a_xml_writer->appendXML($fo);
 
  636        $rbacreview = 
$DIC->rbac()->review();
 
  640        $count_query = 
"SELECT count(pq.question_id) cnt ";
 
  643        $query = 
"SELECT pq.page_id, pq.question_id ";
 
  645        $from = 
" FROM page_question pq JOIN lm_tree t ON (t.lm_id = " . 
$ilDB->quote($a_lm_id, 
"integer") .
 
  646            " AND pq.page_id = t.child and pq.page_parent_type = " . 
$ilDB->quote(
"lm", 
"text") . 
") " .
 
  647            " WHERE t.lm_id = " . 
$ilDB->quote($a_lm_id, 
"integer");
 
  648        $count_query .= $from;
 
  653        $set = 
$ilDB->query($count_query);
 
  655        if ($rec = 
$ilDB->fetchAssoc($set)) {
 
  659        $offset = (int) $a_offset;
 
  660        $limit = (int) $a_limit;
 
  662            $ilDB->setLimit($limit, $offset);
 
  668        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
  671        return array(
"cnt" => $cnt, 
"set" => 
$result);
 
  689            $parent_id = $lm_tree->getParentId($node_id);
 
  692            $parent_id = $node_id;
 
  697        for (
$i = 1; 
$i <= $num; 
$i++) {
 
  700            $page->setLMId($lm->getId());
 
  701            $page->create(
false, 
false, $layout_id);
 
  703            $page_ids[] = $page->getId();
 
  705        $page_ids = array_reverse($page_ids);
 
An exception for terminatinating execution or to throw for unit testing.
Translation information on lm object.
static copy($a_source_id, $a_target_id)
Copy all translations of an object.
static getExportId($a_lm_id, $a_lmobj_id, $a_type="pg")
Get export ID.
static getObjectList($lm_id, $type="")
static
static _lookupShortTitle($a_obj_id)
Lookup short title.
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
existsExportID($a_lm_id, $a_exp_id, $a_type="pg")
Does export ID exist in lm?
static saveExportId($a_lm_id, $a_lmobj_id, $a_exp_id, $a_type="pg")
Save export id.
getTitle()
get title of lm object
static _lookupTitle($a_obj_id)
Lookup title.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
getShortTitle()
get short title of lm object
getMediaObjectIds()
get ids of all media objects within the page
exportXMLMetaData(&$a_xml_writer)
export page objects meta data to xml (see ilias_co.dtd)
static _splitPageNext($a_page_id, $a_pg_parent_type, $a_hier_id)
split page to next page at hierarchical id
getFileItemIds()
get ids of all file items within the page
static _splitPage($a_page_id, $a_pg_parent_type, $a_hier_id)
split page at hierarchical id
copy($a_target_lm)
copy page
static insertPagesFromTemplate($lm_id, $num, $node_id, $first_child, $layout_id, $title="")
Insert (multiple) pages templates at node.
assignPageObject(&$a_page_obj)
assign page object
& copyToOtherContObject(&$a_cont_obj, &$a_copied_nodes)
copy a page to another content object (learning module / dlib book)
exportFO(&$a_xml_writer)
export page object to fo
& getPageObject()
get assigned page object
setAlias($a_is_alias)
set wether page object is an alias
static getPageList($lm_id)
static
exportXMLPageContent(&$a_xml_writer, $a_inst=0)
export page objects meta data to xml (see ilias_co.dtd)
exportXML(&$a_xml_writer, $a_mode="normal", $a_inst=0)
export page object to xml (see ilias_co.dtd)
getQuestionIds()
Get question ids.
modifyExportIdentifier($a_tag, $a_param, $a_value)
static queryQuestionsOfLearningModule( $a_lm_id, $a_order_field, $a_order_dir, $a_offset, $a_limit)
Get questions of learning module.
static getPagesWithLinksList($a_lm_id, $a_par_type)
Get all pages of lm that contain any internal links.
static _exportXMLAlias(&$a_xml_writer, $a_id, $a_inst=0)
export page alias to xml
static _getPresentationTitle( $a_pg_id, $a_mode=self::CHAPTER_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-", $a_include_short=false)
presentation title doesn't have to be page title, it may be chapter title + page title or chapter tit...
__construct(&$a_content_obj, $a_id=0, $a_halt=true)
Constructor @access public.
create($a_upload=false, $a_omit_page_object_creation=false, $a_layout_id=0)
Extension of ilPageObject for learning modules.
static getInstance($a_tree_id)
Get Instance.
Class ilObjLearningModule.
static getInstance($a_obj_id)
Get instance.
static _lookupType($a_id, $a_reference=false)
lookup object type
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.
static _getQuestionIdsForPage($a_parent_type, $a_page_id, $a_lang="-")
Get all questions of a page.
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
static _lookupActivationData($a_id, $a_parent_type, $a_lang="-")
Lookup activation data.
static getPagesWithLinks($a_parent_type, $a_parent_id, $a_lang="-")
Get all pages for parent object that contain internal links.
static _moveContentAfterHierId(&$a_source_page, &$a_target_page, $a_hid)
move content of hierarchical id >= $a_hid to other page
static _getPresentationTitle( $a_st_id, $a_mode=self::CHAPTER_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-", $a_include_short=false)
get presentation title
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static now()
Return current timestamp in Y-m-d H:i:s format.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc