32 public function init(): void
36 $this->db = $DIC->database();
37 $this->
lng = $DIC->language();
39 $this->wiki_domain = $DIC->wiki()->internal()->domain();
44 return array(
"ed_insert_amd_page_list",
"pc_amdpl");
54 $amdpl_node = $this->dom_doc->createElement(
"AMDPageList");
55 $amdpl_node = $this->
getDomNode()->appendChild($amdpl_node);
66 $ilDB->manipulate(
"DELETE FROM pg_amd_page_list" .
67 " WHERE id = " .
$ilDB->quote($data_id,
"integer"));
69 $data_id =
$ilDB->nextId(
"pg_amd_page_list");
73 $this->
getChildNode()->setAttribute(
"Mode", (
int) $a_mode);
75 foreach ($a_fields_data as $field_id => $field_data) {
77 "id" => array(
"integer", $data_id)
78 ,
"field_id" => array(
"integer", $field_id)
79 ,
"sdata" => array(
"text", serialize($field_data))
81 $ilDB->insert(
"pg_amd_page_list", $fields);
88 return (
int) $this->
getChildNode()->getAttribute(
"Mode");
97 ?
int $a_data_id =
null 110 $set =
$ilDB->query(
"SELECT * FROM pg_amd_page_list" .
111 " WHERE id = " .
$ilDB->quote($a_data_id,
"integer"));
112 while ($row =
$ilDB->fetchAssoc($set)) {
113 $res[$row[
"field_id"]] = unserialize((
string) $row[
"sdata"], [
"allowed_classes" =>
false]);
120 bool $a_self_ass =
true,
121 bool $a_clone_mobs =
false,
122 int $new_parent_id = 0,
127 $ilDB = $DIC->database();
134 $nodes = $xpath->query(
"//AMDPageList");
135 foreach ($nodes as $node) {
136 $old_id = $node->getAttribute(
"Id");
141 $new_id =
$ilDB->nextId(
"pg_amd_page_list");
143 $set =
$ilDB->query(
"SELECT * FROM pg_amd_page_list" .
144 " WHERE id = " .
$ilDB->quote($old_id,
"integer"));
145 while ($row =
$ilDB->fetchAssoc($set)) {
147 "id" => array(
"integer", $new_id)
148 ,
"field_id" => array(
"integer", $row[
"field_id"])
149 ,
"sdata" => array(
"text", $row[
"sdata"])
151 $ilDB->insert(
"pg_amd_page_list", $fields);
154 $node->setAttribute(
"Id", $new_id);
163 protected function findPages(
172 $wiki_id = $wpage->getWikiId();
173 $wiki_ref_id = $wpage->getWikiRefId();
175 $found_result = array();
180 foreach ($recs as $record) {
182 if (isset($list_values[$field->getFieldId()]) && $list_values[$field->getFieldId()] !==
"") {
183 $field_form =
ilADTFactory::getInstance()->getSearchBridgeForDefinitionInstance($field->getADTDefinition(),
true,
false);
184 $field->setSearchValueSerialized($field_form, $list_values[$field->getFieldId()]);
185 $found_pages = $field->searchSubObjects($field_form, $wiki_id,
"wpg");
186 if (is_array($found_ids)) {
187 $found_ids = array_intersect($found_ids, $found_pages);
189 $found_ids = $found_pages;
195 if (is_array($found_ids) && count($found_ids) > 0) {
196 $sql =
"SELECT id,title FROM il_wiki_page" .
197 " WHERE " .
$ilDB->in(
"id", $found_ids,
"",
"integer") .
198 " AND lang = " .
$ilDB->quote($wpage->getLanguage(),
"text") .
200 $set =
$ilDB->query($sql);
201 while ($row =
$ilDB->fetchAssoc($set)) {
202 $found_result[$row[
"id"]] = $row[
"title"];
206 return $found_result;
212 bool $a_abstract_only =
false 214 if ($this->
getPage()->getParentType() !==
"wpg") {
218 $wiki_id = $this->
getPage()->getWikiId();
219 $pm = $this->wiki_domain->page()->page($this->
getPage()->getWikiRefId());
221 $start = strpos($a_output,
"[[[[[AMDPageList;");
222 if (is_int($start)) {
223 $end = strpos($a_output,
"]]]]]", $start);
226 $parts = explode(
";", substr($a_output, $start + 17, $end - $start - 17));
229 $list_mode = (count(
$parts) === 2)
233 $ltpl =
new ilTemplate(
"tpl.wiki_amd_page_list.html",
true,
true,
"components/ILIAS/Wiki");
235 $pages = $this->findPages($list_id);
237 $ltpl->setCurrentBlock(
"page_bl");
238 foreach ($pages as $page_id => $page_title) {
241 $frag->mFragment =
null;
242 $frag->mTextform = $page_title;
245 $ltpl->setVariable(
"PAGE",
"<a href='" . $href .
"'>" . $page_title .
"</a>");
246 $ltpl->parseCurrentBlock();
249 $ltpl->touchBlock(
"no_hits_bl");
252 $ltpl->setVariable(
"LIST_MODE", $list_mode ?
"ol" :
"ul");
254 $a_output = substr($a_output, 0, $start) .
256 substr($a_output, $end + 5);
258 $start = strpos($a_output,
"[[[[[AMDPageList;", $start + 5);
260 if (is_int($start)) {
261 $end = strpos($a_output,
"]]]]]", $start);
280 $ilDB = $DIC->database();
284 $set =
$ilDB->query(
"SELECT * FROM pg_amd_page_list" .
285 " WHERE field_id = " .
$ilDB->quote($a_field_id,
"integer"));
286 while ($row =
$ilDB->fetchAssoc($set)) {
287 $data = unserialize(unserialize((
string) $row[
"sdata"], [
"allowed_classes" =>
false]), [
"allowed_classes" =>
false]);
288 if (!is_array(
$data)) {
291 $updated_data =
$data;
292 foreach ($mapping as $old_option => $new_option) {
293 if (!in_array($old_option,
$data)) {
296 $idx = array_search($old_option,
$data);
297 if ($new_option !==
'') {
298 $updated_data[$idx] = $new_option;
300 unset($updated_data[$idx]);
304 $serialized_updated_data = serialize(empty($updated_data) ?
'' : serialize($updated_data));
307 "sdata" => array(
"text", $serialized_updated_data)
310 "id" => array(
"integer", $row[
"id"]),
311 "field_id" => array(
"integer", $row[
"field_id"])
313 $ilDB->update(
"pg_amd_page_list", $fields, $primary);
setType(string $a_type)
Set Type.
create(ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
modifyPageContentPostXsl(string $a_output, string $a_mode, bool $a_abstract_only=false)
static _getSelectedRecordsByObject(string $a_obj_type, int $a_id, string $a_sub_type="", bool $is_ref_id=true)
static getInstancesByRecordId( $a_record_id, $a_only_searchable=false, string $language='')
Get definitions by record id.
Content object of ilPageObject (see ILIAS DTD).
static migrateField(int $a_field_id, array $mapping)
Migrate search/filter values on advmd change.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ILIAS Wiki InternalDomainService $wiki_domain
insertContent(ilPageContent $a_cont_obj, string $a_pos, int $a_mode=IL_INSERT_AFTER, string $a_pcid="", bool $remove_placeholder=true)
insert a content node before/after a sibling or as first child of a parent
setData(array $a_fields_data, ?int $a_mode=null)
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
getFieldValues(?int $a_data_id=null)
Get filter field values.
createPageContentNode(bool $a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
static handleCopiedContent(DOMDocument $a_domdoc, bool $a_self_ass=true, bool $a_clone_mobs=false, int $new_parent_id=0, int $obj_copy_id=0)