4require_once(
"./Services/COPage/classes/class.ilPageContent.php");
 
   37        $this->db = 
$DIC->database();
 
   38        $this->lng = 
$DIC->language();
 
   41        $this->ref_id = (int) 
$_GET[
"ref_id"];
 
   50        return array(
"ed_insert_amd_page_list", 
"pc_amdpl");
 
   58        parent::setNode($a_node);               
 
   59        $this->amdpl_node = $a_node->first_child();             
 
   68    public function create(&$a_pg_obj, $a_hier_id, $a_pc_id = 
"")
 
   72        $this->amdpl_node = $this->dom->create_element(
"AMDPageList");
 
   73        $this->amdpl_node = $this->node->append_child($this->amdpl_node);
 
   79    public function setData(array $a_fields_data, $a_mode = 
null)
 
   83        $data_id = $this->amdpl_node->get_attribute(
"Id");
 
   85            $ilDB->manipulate(
"DELETE FROM pg_amd_page_list" .
 
   86                " WHERE id = " . 
$ilDB->quote($data_id, 
"integer"));
 
   88            $data_id = 
$ilDB->nextId(
"pg_amd_page_list");
 
   89            $this->amdpl_node->set_attribute(
"Id", $data_id);
 
   92        $this->amdpl_node->set_attribute(
"Mode", (
int) $a_mode);
 
   94        foreach ($a_fields_data as $field_id => $field_data) {
 
   96                "id" => array(
"integer", $data_id)
 
   97                ,
"field_id" => array(
"integer", $field_id)
 
   98                ,
"data" => array(
"text", serialize($field_data))
 
  100            $ilDB->insert(
"pg_amd_page_list", $fields);
 
  106        if (is_object($this->amdpl_node)) {
 
  107            return (
int) $this->amdpl_node->get_attribute(
"Mode");
 
  124            if (is_object($this->amdpl_node)) {
 
  125                $a_data_id = $this->amdpl_node->get_attribute(
"Id");
 
  130            $set = 
$ilDB->query(
"SELECT * FROM pg_amd_page_list" .
 
  131                " WHERE id = " . 
$ilDB->quote($a_data_id, 
"integer"));
 
  140    public static function handleCopiedContent(DOMDocument $a_domdoc, $a_self_ass = 
true, $a_clone_mobs = 
false)
 
  148        $xpath = 
new DOMXPath($a_domdoc);
 
  149        $nodes = $xpath->query(
"//AMDPageList");
 
  150        foreach ($nodes as 
$node) {
 
  151            $old_id = 
$node->getAttribute(
"Id");
 
  156            $new_id = 
$ilDB->nextId(
"pg_amd_page_list");
 
  158            $set = 
$ilDB->query(
"SELECT * FROM pg_amd_page_list" .
 
  159                    " WHERE id = " . 
$ilDB->quote($old_id, 
"integer"));
 
  162                    "id" => array(
"integer", $new_id)
 
  163                    ,
"field_id" => array(
"integer", 
$row[
"field_id"])
 
  164                    ,
"data" => array(
"text", 
$row[
"data"])
 
  166                $ilDB->insert(
"pg_amd_page_list", $fields);
 
  169            $node->setAttribute(
"Id", $new_id);
 
  183        $wiki_id = $this->
getPage()->getWikiId();
 
  185        $found_result = array();
 
  190        foreach ($recs as $record) {
 
  192                if (isset($list_values[$field->getFieldId()])) {
 
  193                    $field_form = 
ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(), 
true, 
false);
 
  194                    $field->setSearchValueSerialized($field_form, $list_values[$field->getFieldId()]);
 
  195                    $found_pages = $field->searchSubObjects($field_form, $wiki_id, 
"wpg");
 
  196                    if (is_array($found_ids)) {
 
  197                        $found_ids = array_intersect($found_ids, $found_pages);
 
  199                        $found_ids = $found_pages;
 
  205        if (
sizeof($found_ids)) {
 
  206            $sql = 
"SELECT id,title FROM il_wiki_page" .
 
  207                " WHERE " . 
$ilDB->in(
"id", $found_ids, 
"", 
"integer") .
 
  209            $set = 
$ilDB->query($sql);
 
  211                $found_result[
$row[
"id"]] = 
$row[
"title"];
 
  215        return $found_result;
 
  222        if ($this->
getPage()->getParentType() != 
"wpg") {
 
  226        include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
 
  227        include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
 
  228        include_once(
'Modules/Wiki/classes/class.ilWikiUtil.php');
 
  230        $wiki_id = $this->
getPage()->getWikiId();
 
  233        $start = strpos($a_html, 
"[[[[[AMDPageList;");
 
  234        if (is_int($start)) {
 
  235            $end = strpos($a_html, 
"]]]]]", $start);
 
  239            $parts = explode(
";", substr($a_html, $start + 17, 
$end - $start - 17));
 
  241            $list_id = (int) $parts[0];
 
  242            $list_mode = (
sizeof($parts) == 2)
 
  246            $ltpl = 
new ilTemplate(
"tpl.wiki_amd_page_list.html", 
true, 
true, 
"Modules/Wiki");
 
  249            if (
sizeof($pages)) {
 
  250                $ltpl->setCurrentBlock(
"page_bl");
 
  251                foreach ($pages as $page_id => $page_title) {
 
  253                    $frag = 
new stdClass;
 
  254                    $frag->mFragment = 
null;
 
  255                    $frag->mTextform = $page_title;
 
  258                    $ltpl->parseCurrentBlock();
 
  261                $ltpl->touchBlock(
"no_hits_bl");
 
  264            $ltpl->setVariable(
"LIST_MODE", $list_mode ? 
"ol" : 
"ul");
 
  266            $a_html = substr($a_html, 0, $start) .
 
  268                substr($a_html, 
$end + 5);
 
  270            $start = strpos($a_html, 
"[[[[[AMDPageList;", $start + 5);
 
  272            if (is_int($start)) {
 
  273                $end = strpos($a_html, 
"]]]]]", $start);
 
  289    public static function migrateField($a_obj_id, $a_field_id, $old_option, $new_option, $a_is_multi = 
false)
 
  297        $set = 
$ilDB->query(
"SELECT * FROM pg_amd_page_list" .
 
  298            " WHERE field_id = " . 
$ilDB->quote($a_field_id, 
"integer"));
 
  300            $data = unserialize(unserialize(
$row[
"data"]));
 
  301            if (is_array(
$data) &&
 
  302                in_array($old_option, 
$data)) {
 
  303                $idx = array_search($old_option, 
$data);
 
  305                    $data[$idx] = $new_option;
 
  311                    "data" => array(
"text", serialize(serialize(
$data)))
 
  314                    "id" => array(
"integer", 
$row[
"id"]),
 
  315                    "field_id" => array(
"integer", 
$row[
"field_id"])
 
  317                $ilDB->update(
"pg_amd_page_list", $fields, $primary);
 
An exception for terminatinating execution or to throw for unit testing.
static getInstance()
Get singleton.
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.
static _getSelectedRecordsByObject($a_obj_type, $a_ref_id, $a_sub_type="")
Get selected records by object.
modifyPageContentPostXsl($a_html, $a_mode)
Modify page content after xsl.
create(&$a_pg_obj, $a_hier_id, $a_pc_id="")
Create list node in xml.
static getLangVars()
Get lang vars needed for editing.
setData(array $a_fields_data, $a_mode=null)
Set list settings.
static handleCopiedContent(DOMDocument $a_domdoc, $a_self_ass=true, $a_clone_mobs=false)
Handle copied content.
setNode($a_node)
Set node.
static migrateField($a_obj_id, $a_field_id, $old_option, $new_option, $a_is_multi=false)
Migrate search/filter values on advmd change.
init()
Init page content component.
getFieldValues($a_data_id=null)
Get filter field values.
createPageContentNode($a_set_this_node=true)
Create page content node (always use this method first when adding a new element)
setType($a_type)
Set Type.
special template class to simplify handling of ITX/PEAR
static makeLink(&$nt, $a_wiki_id, $text='', $query='', $trail='', $prefix='', $a_offline=false)
Make a wiki link, the following formats are supported:
foreach($_POST as $key=> $value) $res