ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilPCPRGActionNote Class Reference

PageComponent "Note" for PageEditor in PRGs. More...

+ Inheritance diagram for ilPCPRGActionNote:
+ Collaboration diagram for ilPCPRGActionNote:

Public Member Functions

 init ()
 
 create (ilPageObject $a_pg_obj, string $a_hier_id, string $a_pc_id="")
 
 modifyPageContentPostXsl (string $a_output, string $a_mode, bool $a_abstract_only=false)
 
- Public Member Functions inherited from ilPageContent
 __construct (ilPageObject $a_pg_obj, ?PageManagerInterface $page_manager=null, ?ObjectAdapterInterface $object_adapter=null)
 
 setPage (ilPageObject $a_val)
 
 getPage ()
 
 init ()
 Init object. More...
 
 getType ()
 
 getDomNode ()
 
 getDomDoc ()
 
 setDomNode (DOMNode $node)
 
 getChildNode ()
 
 getJavascriptFiles (string $a_mode)
 
 getCssFiles (string $a_mode)
 
 getOnloadCode (string $a_mode)
 
 setHierId (string $a_hier_id)
 
 getHierId ()
 
 lookupHierId ()
 
 readHierId ()
 
 setPcId (string $a_pcid)
 
 getPCId ()
 
 setFileDownloadLink (string $a_download_link)
 
 getFileDownloadLink ()
 
 setProfileBackUrl (string $url)
 
 getProfileBackUrl ()
 
 setFullscreenLink (string $a_fullscreen_link)
 
 getFullscreenLink ()
 
 setSourcecodeDownloadScript (string $script_name)
 
 getSourcecodeDownloadScript ()
 
 readPCId ()
 
 writePCId (string $a_pc_id)
 
 setEnabled (string $value)
 Set Enabled value for page content component. More...
 
 enable ()
 
 disable ()
 
 isEnabled ()
 
 createPageContentNode (bool $a_set_this_node=true)
 Create page content node (always use this method first when adding a new element) More...
 
 getNewPageContentNode ()
 
 modifyPageContentPostXsl (string $a_output, string $a_mode, bool $a_abstract_only=false)
 Modify page content after xsl. More...
 
 getModel ()
 Get model as needed for the front-end editor. More...
 

Data Fields

const PCTYPE = 'prgactionnote'
 
const PCELEMENT = 'PRGActionNote'
 
const PLACEHOLDER = '[[[PRG_ACTION_NOTE]]]'
 
const PROVIDING_TYPES = ['prg']
 
- Data Fields inherited from ilPageContent
string $hier_id = ""
 
DOMNode $dom_node = null
 
string $page_lang = ""
 

Protected Member Functions

 supportsType (int $parent_obj_id)
 
 replaceWithRendered (int $obj_id, $html)
 
 getTemplate ()
 
- Protected Member Functions inherited from ilPageContent
 getPageManager ()
 
 setType (string $a_type)
 Set Type. More...
 
 hasNode ()
 
 createInitialChildNode (string $hier_id, string $pc_id, string $child, array $child_attributes=[])
 

Protected Attributes

ilLanguage $lng
 
- Protected Attributes inherited from ilPageContent
DOMDocument $dom_doc
 
ILIAS COPage InternalDomainService $domain
 
string $pcid
 
string $type = ""
 
ilPageObject $pg_obj
 
string $file_download_link
 
string $fullscreen_link
 
string $sourcecode_download_script
 
ilLogger $log
 
string $profile_back_url = ""
 
ILIAS COPage Dom DomUtil $dom_util
 
PageManagerInterface $page_manager = null
 
ObjectAdapterInterface $object = null
 

Additional Inherited Members

- Static Public Member Functions inherited from ilPageContent
static sortHierIds (array $a_array)
 Sort an array of Hier IDS in ascending order. More...
 
static isGreaterHierId (string $a, string $b)
 Check whether Hier ID $a is greater than Hier ID $b. More...
 
static getLangVars ()
 Get lang vars needed for editing. More...
 
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)
 Handle copied content. More...
 
static afterPageUpdate (ilPageObject $a_page, DOMDocument $a_domdoc, string $a_xml, bool $a_creation)
 After page has been updated (or created) More...
 
static beforePageDelete (ilPageObject $a_page)
 Before page is being deleted. More...
 
static afterRepositoryCopy (ilPageObject $page, array $mapping, int $source_ref_id)
 After repository (container) copy action. More...
 
static afterPageHistoryEntry (ilPageObject $a_page, DOMDocument $a_old_domdoc, string $a_old_xml, int $a_old_nr)
 After page history entry has been created. More...
 
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. More...
 

Detailed Description

PageComponent "Note" for PageEditor in PRGs.

Definition at line 25 of file class.ilPCPRGActionNote.php.

Member Function Documentation

◆ create()

ilPCPRGActionNote::create ( ilPageObject  $a_pg_obj,
string  $a_hier_id,
string  $a_pc_id = "" 
)

Definition at line 40 of file class.ilPCPRGActionNote.php.

References ilPageContent\createPageContentNode(), IL_INSERT_AFTER, and ilPageObject\insertContent().

44  : void {
45  $this->node = $this->createPageContentNode();
46  $a_pg_obj->insertContent($this, $a_hier_id, IL_INSERT_AFTER, $a_pc_id);
47  $this->cache_node = $this->dom_doc->createElement(self::PCELEMENT);
48  $this->cache_node = $this->node->appendChild($this->cache_node);
49  }
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
const IL_INSERT_AFTER
createPageContentNode(bool $a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
+ Here is the call graph for this function:

◆ getTemplate()

ilPCPRGActionNote::getTemplate ( )
protected

Definition at line 107 of file class.ilPCPRGActionNote.php.

References ILIAS\Repository\lng().

Referenced by modifyPageContentPostXsl().

107  : string
108  {
109  $template = new ilTemplate("tpl.action_note_poeditor_element.html", true, true, 'components/ILIAS/StudyProgramme');
110  $icon = "./assets/images/standard/icon_prg.svg";
111 
112  $template->setVariable("ICON", $icon);
113  $template->setVariable("ICON_TEXT", $this->lng->txt("study_programme_icon"));
114  $template->setVariable("LABEL", $this->lng->txt("pc_prg_action_note_label"));
115 
116  return $template->get();
117  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init()

ilPCPRGActionNote::init ( )

Definition at line 33 of file class.ilPCPRGActionNote.php.

References $DIC, ILIAS\Repository\lng(), and ilPageContent\setType().

33  : void
34  {
35  global $DIC;
36  $this->lng = $DIC->language();
37  $this->setType(self::PCTYPE);
38  }
setType(string $a_type)
Set Type.
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ modifyPageContentPostXsl()

ilPCPRGActionNote::modifyPageContentPostXsl ( string  $a_output,
string  $a_mode,
bool  $a_abstract_only = false 
)

Definition at line 51 of file class.ilPCPRGActionNote.php.

References ilPageContent\getPage(), getTemplate(), ILIAS\Repository\int(), replaceWithRendered(), and supportsType().

55  : string {
56  $parent_obj_id = $this->getPage()->getParentId();
57  $end = 0;
58  $start = strpos($a_output, "[[[PRG_ACTION_NOTE");
59 
60  if (is_int($start)) {
61  $end = strpos($a_output, "]]]", $start);
62  }
63 
64  if ($a_mode === 'edit') {
65  while ($end > 0) {
66  if ($this->supportsType($parent_obj_id)) {
67  $html = $this->getTemplate();
68 
69  $a_output = substr($a_output, 0, $start) .
70  $html .
71  substr($a_output, $end + 3);
72 
73  $start = strpos($a_output, "[[[PRG_ACTION_NOTE", $start + 3);
74  $end = 0;
75  if (is_int($start)) {
76  $end = strpos($a_output, "]]]", $start);
77  }
78 
79  }
80  }
81 
82  return $a_output;
83  }
84 
85  $parent_obj_id = (int) $this->getPage()->getParentId();
86  if ($this->supportsType($parent_obj_id)) {
87  $a_output = $this->replaceWithRendered($parent_obj_id, $a_output);
88  }
89 
90  return $a_output;
91  }
replaceWithRendered(int $obj_id, $html)
supportsType(int $parent_obj_id)
+ Here is the call graph for this function:

◆ replaceWithRendered()

ilPCPRGActionNote::replaceWithRendered ( int  $obj_id,
  $html 
)
protected

Definition at line 99 of file class.ilPCPRGActionNote.php.

References $dic, and ilStudyProgrammeDIC\dic().

Referenced by modifyPageContentPostXsl().

99  : string
100  {
102  $builder = $dic['pc.actionnote'];
103  $rendered = $builder->getNoteFor($obj_id);
104  return str_replace(self::PLACEHOLDER, $rendered, $html);
105  }
$dic
Definition: result.php:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ supportsType()

ilPCPRGActionNote::supportsType ( int  $parent_obj_id)
protected

Definition at line 93 of file class.ilPCPRGActionNote.php.

References ilObject\_lookupType().

Referenced by modifyPageContentPostXsl().

93  : bool
94  {
95  $parent_obj_id = ilObject::_lookupType($parent_obj_id);
96  return in_array($parent_obj_id, self::PROVIDING_TYPES);
97  }
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $lng

ilLanguage ilPCPRGActionNote::$lng
protected

Definition at line 27 of file class.ilPCPRGActionNote.php.

◆ PCELEMENT

const ilPCPRGActionNote::PCELEMENT = 'PRGActionNote'

Definition at line 29 of file class.ilPCPRGActionNote.php.

Referenced by ilPRGPageObjectGUI\getPageConfig().

◆ PCTYPE

const ilPCPRGActionNote::PCTYPE = 'prgactionnote'

Definition at line 28 of file class.ilPCPRGActionNote.php.

◆ PLACEHOLDER

const ilPCPRGActionNote::PLACEHOLDER = '[[[PRG_ACTION_NOTE]]]'

Definition at line 30 of file class.ilPCPRGActionNote.php.

◆ PROVIDING_TYPES

const ilPCPRGActionNote::PROVIDING_TYPES = ['prg']

Definition at line 31 of file class.ilPCPRGActionNote.php.


The documentation for this class was generated from the following file: