36 public function init(): void
40 $this->
lng = $DIC->language();
42 $this->
access = $DIC->access();
47 parent::setNode($a_node);
58 $this->incl_node = $this->dom->create_element(
"ContentInclude");
59 $this->incl_node = $this->node->append_child($this->incl_node);
67 $this->setContentIncludeAttribute(
"ContentId", (
string) $a_id);
75 return (
int) $this->getContentIncludeAttribute(
"ContentId");
83 $this->setContentIncludeAttribute(
"ContentType", $a_type);
91 return $this->getContentIncludeAttribute(
"ContentType");
99 $this->setContentIncludeAttribute(
"InstId", $a_id);
107 return $this->getContentIncludeAttribute(
"InstId");
117 if (!empty($a_value)) {
118 $this->incl_node->set_attribute($a_attr, $a_value);
120 if ($this->incl_node->has_attribute($a_attr)) {
121 $this->incl_node->remove_attribute($a_attr);
131 if (is_object($this->incl_node)) {
132 return $this->incl_node->get_attribute($a_attr);
142 DOMDocument $a_domdoc,
147 self::saveContentIncludeUsage($a_page, $a_domdoc);
163 DOMDocument $a_old_domdoc,
167 self::saveContentIncludeUsage($a_page, $a_old_domdoc, $a_old_nr);
175 DOMDocument $a_domdoc,
178 $ci_ids = self::collectContentIncludes($a_page, $a_domdoc);
180 foreach ($ci_ids as $ci_id) {
181 if ((
int) $ci_id[
"inst_id"] <= 0 || $ci_id[
"inst_id"] ==
IL_INST_ID) {
199 DOMDocument $a_domdoc
201 $xpath = new DOMXPath($a_domdoc);
202 $nodes = $xpath->query(
'//ContentInclude');
205 foreach ($nodes as $node) {
206 $type = $node->getAttribute(
"ContentType");
207 $id = $node->getAttribute(
"ContentId");
208 $inst_id = $node->getAttribute(
"InstId");
209 $ci_ids[
$type .
":" .
$id .
":" . $inst_id] = array(
210 "type" =>
$type,
"id" =>
$id,
"inst_id" => $inst_id);
219 bool $a_abstract_only =
false
224 $start = strpos($a_output,
"{{{{{ContentInclude;");
225 if (is_int($start)) {
226 $end = strpos($a_output,
"}}}}}", $start);
229 $parent_lang = $this->getPage()->getLanguage();
230 if ($parent_lang ==
"-" && $this->getPage()->getConcreteLang() !=
"") {
231 $parent_lang = $this->getPage()->getConcreteLang();
234 $param = substr($a_output, $start + 20, $end - $start - 20);
239 $snippet_lang = $parent_lang;
245 if ($a_mode !=
"offline") {
246 $page_gui->setFileDownloadLink($this->getFileDownloadLink());
247 $page_gui->setProfileBackUrl($this->getProfileBackUrl());
248 $page_gui->setFullscreenLink($this->getFullscreenLink() .
"&pg_type=mep");
249 $page_gui->setSourcecodeDownloadScript($this->getSourcecodeDownloadScript());
254 $html = $page_gui->getRawContent();
255 if ($a_mode ==
"edit") {
256 $par_id = $page_gui->getPageObject()->getParentId();
259 if ($this->
access->checkAccess(
"write",
"", $ref_id)) {
264 $html =
'<p class="small light">' .
$lng->txt(
"copg_snippet_cannot_be_edited") . $info .
'</p>' . $html;
267 if ($a_mode ==
"edit") {
269 $html =
"// " .
$lng->txt(
"cont_missing_snippet") .
" //";
271 $html =
"// " .
$lng->txt(
"cont_snippet_from_another_installation") .
" //";
275 $h2 = substr($a_output, 0, $start) .
277 substr($a_output, $end + 5);
282 $start = strpos($a_output,
"{{{{{ContentInclude;", $start + 5);
284 if (is_int($start)) {
285 $end = strpos($a_output,
"}}}}}", $start);
295 int $delete_lower_than_nr
299 $usage_repo =
$DIC->copage()
304 $usage_repo->deleteHistoryUsagesLowerEqualThan(
306 $parent_type .
":pg",
308 $delete_lower_than_nr,
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static _getLink(?int $a_ref_id, string $a_type='', array $a_params=array(), string $append="")
Class ilMediaPoolPage GUI class.
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getContentIncludeAttribute(string $a_attr)
Get content include tag attribute.
setContentId(int $a_id)
Set content id.
static deleteHistoryLowerEqualThan(string $parent_type, int $page_id, string $lang, int $delete_lower_than_nr)
Overwrite in derived classes, if old history entries are being deleted.
setNode(php4DOMElement $a_node)
Set xml node of page content.
getContentId()
Get content id.
static collectContentIncludes(ilPageObject $a_page, DOMDocument $a_domdoc)
get all content includes that are used within the page
static saveContentIncludeUsage(ilPageObject $a_page, DOMDocument $a_domdoc, int $a_old_nr=0)
save content include usages
modifyPageContentPostXsl(string $a_output, string $a_mode, bool $a_abstract_only=false)
Modify page content after xsl.
setInstId(string $a_id)
Set installation id.
getInstId()
Get installation id.
static beforePageDelete(ilPageObject $a_page)
Before page is being deleted.
create(ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
getContentType()
Get content type.
setContentIncludeAttribute(string $a_attr, string $a_value)
Set attribute of content include tag.
static afterPageHistoryEntry(ilPageObject $a_page, DOMDocument $a_old_domdoc, string $a_old_xml, int $a_old_nr)
After page history entry has been created.
init()
Init page content component.
static afterPageUpdate(ilPageObject $a_page, DOMDocument $a_domdoc, string $a_xml, bool $a_creation)
After page has been updated (or created)
php4DOMElement $incl_node
setContentType(string $a_type)
Set content type.
static saveUsage(string $a_pc_type, int $a_pc_id, string $a_usage_type, int $a_usage_id, int $a_usage_hist_nr=0, string $a_lang="-")
static deleteAllUsages(string $a_pc_type, string $a_usage_type, int $a_usage_id, int $a_usage_hist_nr=0, string $a_lang="-")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
createPageContentNode(bool $a_set_this_node=true)
Create page content node (always use this method first when adding a new element)
setType(string $a_type)
Set Type.
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
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
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...