4require_once(
"./Services/COPage/classes/class.ilPageContent.php");
 
   34                return array(
"ed_insert_amd_page_list", 
"pc_amdpl");
 
   42                parent::setNode($a_node);               
 
   43                $this->amdpl_node =& $a_node->first_child();            
 
   52        function create(&$a_pg_obj, $a_hier_id, $a_pc_id = 
"")
 
   56                $this->amdpl_node = $this->dom->create_element(
"AMDPageList");
 
   57                $this->amdpl_node = $this->node->append_child($this->amdpl_node);
 
   67                $data_id = $this->amdpl_node->get_attribute(
"Id");              
 
   70                        $ilDB->manipulate(
"DELETE FROM pg_amd_page_list".
 
   71                                " WHERE id = ".
$ilDB->quote($data_id, 
"integer"));
 
   75                        $data_id = 
$ilDB->nextId(
"pg_amd_page_list");
 
   76                        $this->amdpl_node->set_attribute(
"Id", $data_id);
 
   79                foreach($a_fields_data as $field_id => $field_data)
 
   82                                "id" => array(
"integer", $data_id)
 
   83                                ,
"field_id" => array(
"integer", $field_id)
 
   84                                ,
"data" => array(
"text", serialize($field_data))
 
   86                        $ilDB->insert(
"pg_amd_page_list", $fields);     
 
  104                        if (is_object($this->amdpl_node))
 
  106                                $a_data_id = $this->amdpl_node->get_attribute(
"Id");
 
  112                        $set = 
$ilDB->query(
"SELECT * FROM pg_amd_page_list".
 
  113                                " WHERE id = ".
$ilDB->quote($a_data_id, 
"integer"));
 
  129                $xpath = 
new DOMXPath($a_domdoc);
 
  130                $nodes = $xpath->query(
"//AMDPageList");
 
  131                foreach($nodes as 
$node)
 
  133                        $old_id = 
$node->getAttribute(
"Id");
 
  139                        $new_id = 
$ilDB->nextId(
"pg_amd_page_list");
 
  141                        $set = 
$ilDB->query(
"SELECT * FROM pg_amd_page_list".
 
  142                                        " WHERE id = ".
$ilDB->quote($old_id, 
"integer"));
 
  146                                        "id" => array(
"integer", $new_id)
 
  147                                        ,
"field_id" => array(
"integer", 
$row[
"field_id"])
 
  148                                        ,
"data" => array(
"text", 
$row[
"data"])
 
  150                                $ilDB->insert(
"pg_amd_page_list", $fields);     
 
  153                        $node->setAttribute(
"Id", $new_id);
 
  167                $wiki_id = $this->
getPage()->getWikiId();
 
  169                $found_result = array();
 
  174                foreach($recs as $record)
 
  178                                if(isset($list_values[$field->getFieldId()]))                                   
 
  180                                        $field_form = 
ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(), 
true, 
false);                                               
 
  181                                        $field->setSearchValueSerialized($field_form, $list_values[$field->getFieldId()]);                                                                                                                              
 
  182                                        $found_pages = $field->searchSubObjects($field_form, $wiki_id, 
"wpg");                                          
 
  183                                        if(is_array($found_ids))
 
  185                                                $found_ids = array_intersect($found_ids, $found_pages);
 
  189                                                $found_ids = $found_pages;
 
  195                if(
sizeof($found_ids))
 
  197                        $sql = 
"SELECT id,title FROM il_wiki_page".
 
  198                                " WHERE ".$ilDB->in(
"id", $found_ids, 
"", 
"integer").
 
  200                        $set = 
$ilDB->query($sql);
 
  203                                $found_result[
$row[
"id"]] = 
$row[
"title"];
 
  207                return $found_result;
 
  214                if($this->
getPage()->getParentType() != 
"wpg")
 
  219                include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');         
 
  220                include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');                        
 
  221                include_once(
'Modules/Wiki/classes/class.ilWikiUtil.php');              
 
  223                $wiki_id = $this->
getPage()->getWikiId();
 
  226                $start = strpos($a_html, 
"[[[[[AMDPageList;");
 
  229                        $end = strpos($a_html, 
"]]]]]", $start);
 
  234                        $list_id = (int)substr($a_html, $start + 17, $end - $start - 17);       
 
  236                        $ltpl = 
new ilTemplate(
"tpl.wiki_amd_page_list.html", 
true, 
true, 
"Modules/Wiki");
 
  241                                $ltpl->setCurrentBlock(
"page_bl");
 
  242                                foreach($pages as $page_id => $page_title)
 
  245                                        $frag = 
new stdClass;
 
  246                                        $frag->mFragment = 
null;
 
  247                                        $frag->mTextform = $page_title;
 
  250                                        $ltpl->parseCurrentBlock();
 
  255                                $ltpl->touchBlock(
"no_hits_bl");
 
  258                        $a_html = substr($a_html, 0, $start).
 
  260                                substr($a_html, $end + 5);                      
 
  262                        $start = strpos($a_html, 
"[[[[[AMDPageList;", $start + 5);
 
  266                                $end = strpos($a_html, 
"]]]]]", $start);
 
  282        public static function migrateField($a_obj_id, $a_field_id, $old_option, $new_option, $a_is_multi = 
false)
 
  288                $set = 
$ilDB->query(
"SELECT * FROM pg_amd_page_list".
 
  289                        " WHERE field_id = ".
$ilDB->quote($a_field_id, 
"integer"));
 
  292                        $data = unserialize(unserialize(
$row[
"data"]));
 
  293                        if(is_array(
$data) && 
 
  294                                in_array($old_option, 
$data))
 
  296                                $idx = array_search($old_option, 
$data);
 
  299                                        $data[$idx] = $new_option;
 
  307                                        "data" => array(
"text", serialize(serialize(
$data)))
 
  310                                        "id" => array(
"integer", 
$row[
"id"]),
 
  311                                        "field_id" => array(
"integer", 
$row[
"field_id"])
 
  313                                $ilDB->update(
"pg_amd_page_list", $fields, $primary);
 
static getInstance()
Get singleton.
static getInstancesByRecordId($a_record_id, $a_only_searchable=false)
Get definitions by record id.
static _getSelectedRecordsByObject($a_obj_type, $a_obj_id, $a_sub_type="")
Get selected records by object.
modifyPageContentPostXsl($a_html, $a_mode)
Modify page content after xsl.
setData(array $a_fields_data)
Set list settings.
create(&$a_pg_obj, $a_hier_id, $a_pc_id="")
Create list node in xml.
static getLangVars()
Get lang vars needed for editing.
static handleCopiedContent(DOMDocument $a_domdoc, $a_self_ass=true, $a_clone_mobs=false)
Handle copied content.
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.
setNode(&$a_node)
Set node.
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: