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);
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);
147 self::saveContentIncludeUsage($a_page, $a_domdoc);
167 self::saveContentIncludeUsage($a_page, $a_old_domdoc, $a_old_nr);
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) {
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") {
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,
getSourcecodeDownloadScript()
getInstId()
Get installation id.
setType(string $a_type)
Set Type.
getContentId()
Get content id.
static afterPageHistoryEntry(ilPageObject $a_page, DOMDocument $a_old_domdoc, string $a_old_xml, int $a_old_nr)
After page history entry has been created.
static afterPageUpdate(ilPageObject $a_page, DOMDocument $a_domdoc, string $a_xml, bool $a_creation)
After page has been updated (or created)
static collectContentIncludes(ilPageObject $a_page, DOMDocument $a_domdoc)
get all content includes that are used within the page
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _getAllReferences(int $id)
get all reference ids for object ID
modifyPageContentPostXsl(string $a_output, string $a_mode, bool $a_abstract_only=false)
setNode(php4DOMElement $a_node)
php4DOMElement $incl_node
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 beforePageDelete(ilPageObject $a_page)
Before page is being deleted.
setContentType(string $a_type)
Set content type.
static deleteHistoryLowerEqualThan(string $parent_type, int $page_id, string $lang, int $delete_lower_than_nr)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setInstId(string $a_id)
Set installation id.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupTitle(int $obj_id)
setContentIncludeAttribute(string $a_attr, string $a_value)
Set attribute of content include tag.
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
static deleteAllUsages(string $a_pc_type, string $a_usage_type, int $a_usage_id, int $a_usage_hist_nr=0, string $a_lang="-")
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
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
static _getLink(?int $a_ref_id, string $a_type='', array $a_params=array(), string $append="")
createPageContentNode(bool $a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
static saveContentIncludeUsage(ilPageObject $a_page, DOMDocument $a_domdoc, int $a_old_nr=0)
save content include usages
setContentId(int $a_id)
Set content id.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
getContentIncludeAttribute(string $a_attr)
Get content include tag attribute.
init()
Init page content component.
create(ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
Class ilMediaPoolPage GUI class.
getContentType()
Get content type.