5require_once(
"./Services/COPage/classes/class.ilPageContent.php");
 
   44        $this->access = 
$DIC->access();
 
   45        $this->ctrl = 
$DIC->ctrl();
 
   46        $this->lng = 
$DIC->language();
 
   55        parent::setNode($a_node);               
 
   56        $this->sec_node = $a_node->first_child();               
 
   65    public function create(&$a_pg_obj, $a_hier_id, $a_pc_id = 
"")
 
   69        $this->sec_node = $this->dom->create_element(
"Section");
 
   70        $this->sec_node = $this->node->append_child($this->sec_node);
 
   71        $this->sec_node->set_attribute(
"Characteristic", 
"Block");
 
   81        if (!empty($a_char)) {
 
   82            $this->sec_node->set_attribute(
"Characteristic", $a_char);
 
   84            if ($this->sec_node->has_attribute(
"Characteristic")) {
 
   85                $this->sec_node->remove_attribute(
"Characteristic");
 
   97        if (is_object($this->sec_node)) {
 
   98            $char = $this->sec_node->get_attribute(
"Characteristic");
 
   99            if (substr($char, 0, 4) == 
"ilc_") {
 
  100                $char = substr($char, 4);
 
  112        return array(
"ed_insert_section");
 
  123    public static function afterPageUpdate($a_page, DOMDocument $a_domdoc, $a_xml, $a_creation)
 
  125        include_once(
"./Services/COPage/classes/class.ilPCSection.php");
 
  150        if ($a_unix_ts > 0) {
 
  151            $this->sec_node->set_attribute(
"ActiveFrom", $a_unix_ts);
 
  153            if ($this->sec_node->has_attribute(
"ActiveFrom")) {
 
  154                $this->sec_node->remove_attribute(
"ActiveFrom");
 
  166        if (is_object($this->sec_node)) {
 
  167            return $this->sec_node->get_attribute(
"ActiveFrom");
 
  180        if ($a_unix_ts > 0) {
 
  181            $this->sec_node->set_attribute(
"ActiveTo", $a_unix_ts);
 
  183            if ($this->sec_node->has_attribute(
"ActiveTo")) {
 
  184                $this->sec_node->remove_attribute(
"ActiveTo");
 
  196        if (is_object($this->sec_node)) {
 
  197            return $this->sec_node->get_attribute(
"ActiveTo");
 
  211        if (!empty($a_val)) {
 
  212            $this->sec_node->set_attribute($a_attr, $a_val);
 
  214            if ($this->sec_node->has_attribute($a_attr)) {
 
  215                $this->sec_node->remove_attribute($a_attr);
 
  228        if (is_object($this->sec_node)) {
 
  229            return $this->sec_node->get_attribute($a_attr);
 
  262        $this->
setAttribute(
"PermissionRefId", 
"il__ref_" . $a_ref_id);
 
  273        if (in_array(
$id[1], array(
"", 0, IL_INST_ID))) {
 
  294        if (trim($a_href) != 
"") {
 
  314            "TargetFrame" => $a_target_frame);
 
  333        $childs = $this->sec_node->child_nodes();
 
  334        foreach ($childs as $child) {
 
  335            if ($child->node_name() == 
"ExtLink") {
 
  336                return array(
"LinkType" => 
"ExtLink",
 
  337                    "Href" => $child->get_attribute(
"Href"));
 
  339            if ($child->node_name() == 
"IntLink") {
 
  340                return array(
"LinkType" => 
"IntLink",
 
  341                    "Target" => $child->get_attribute(
"Target"),
 
  342                    "Type" => $child->get_attribute(
"Type"),
 
  343                    "TargetFrame" => $child->get_attribute(
"TargetFrame"));
 
  346        return array(
"LinkType" => 
"NoLink");
 
  359        while ((
$start = strpos($a_html, 
"{{{{{Section;Access;")) > 0) {
 
  362            $id = explode(
"_", $access_attr[3]);
 
  363            $section_nr = $access_attr[6];
 
  366            if (in_array(
$id[1], array(
"", 0, IL_INST_ID)) && 
$id[3] > 0) {
 
  367                $access = $ilAccess->checkAccess($access_attr[5], 
"", 
$id[3]);
 
  369            $end_limiter = 
"{{{{{Section;AccessEnd;".$section_nr.
"}}}}}";
 
  371                $a_html = substr($a_html, 0, 
$start) . substr($a_html, 
$end + 5);
 
  372                $a_html = str_replace($end_limiter, 
"", $a_html);
 
  375                $a_html = substr($a_html, 0, 
$start) . substr($a_html, 
$end + strlen($end_limiter));
 
  379        $a_html = str_replace(
"{{{{{Section;Access}}}}}", 
"", $a_html);
 
  396            "DELETE FROM copg_section_timings WHERE " .
 
  397            " page_id = " . 
$ilDB->quote($a_page->getId(), 
"integer") .
 
  398            " AND parent_type = " . 
$ilDB->quote($a_page->getParentType(), 
"text")
 
  401        $xml = $a_page->getXMLFromDom();
 
  409        for (
$i = 0; 
$i < count(
$res->nodeset); 
$i++) {
 
  410            $from = 
$res->nodeset[
$i]->get_attribute(
"ActiveFrom");
 
  413                    "copg_section_timings",
 
  415                        "page_id" => array(
"integer", $a_page->getId()),
 
  416                        "parent_type" => array(
"text", $a_page->getParentType()),
 
  417                        "unix_ts" => array(
"integer", 
$from)
 
  422            $to = 
$res->nodeset[
$i]->get_attribute(
"ActiveTo");
 
  425                    "copg_section_timings",
 
  427                        "page_id" => array(
"integer", $a_page->getId()),
 
  428                        "parent_type" => array(
"text", $a_page->getParentType()),
 
  429                        "unix_ts" => array(
"integer", $to)
 
  450            "SELECT * FROM copg_section_timings " .
 
  451            " WHERE page_id = " . 
$ilDB->quote($a_page->getId(), 
"integer") .
 
  452            " AND parent_type = " . 
$ilDB->quote($a_page->getParentType(), 
"text")
 
  457        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
  458            $unix_ts = $rec[
"unix_ts"];
 
  459            if ($unix_ts < $current_ts) {
 
  462            $str .= 
"-" . $unix_ts;
 
  480        $start = strpos($a_html, 
"{{{{{Section;ActiveFrom");
 
  487            $param = explode(
";", $param);
 
  501            $h2 = substr($a_html, 0, 
$start) .
 
  503                substr($a_html, 
$end + 5);
 
  507            $start = strpos($a_html, 
"{{{{{Section;ActiveFrom;", 
$start + 5);
 
An exception for terminatinating execution or to throw for unit testing.
static setFirstOptionalElement( $doc, $parent_node, $a_node_name, $a_successors, $a_content, $a_attributes, $a_remove_childs=true)
searches for an element $a_node_name within the childs of $parent_node if no node is found,...
static deleteAllChildsByName($a_parent, $a_node_names)
delete all childs of a node by names in $a_node_names
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static setUseRelativeDates($a_status)
set use relative dates
@classDescription Date and time handling
create(&$a_pg_obj, $a_hier_id, $a_pc_id="")
Create section node in xml.
insertTimings($a_html)
Insert timings (in edit mode)
setCharacteristic($a_char)
Set Characteristic of section.
static afterPageUpdate($a_page, DOMDocument $a_domdoc, $a_xml, $a_creation)
After page has been updated (or created)
setExtLink($a_href)
Set link of area to an external one.
setActiveTo($a_unix_ts)
Set activation to.
setPermission($a_val)
Set permission.
static saveTimings($a_page)
Save timings.
static getCacheTriggerString($a_page)
Get page cache update trigger string.
init()
Init page content component.
getPermission()
Get permission.
handleAccess($a_html, $a_mode)
modifyPageContentPostXsl($a_output, $a_mode)
Modify page content after xsl.
getAttribute($a_attr)
Get attribute.
getCharacteristic()
Get characteristic of section.
getActiveTo()
Get activation to.
setIntLink($a_type, $a_target, $a_target_frame)
Set link of area to an internal one.
setPermissionRefId($a_ref_id)
Set permission ref id.
static getLangVars()
Get lang vars needed for editing.
setNode($a_node)
Set node.
setAttribute($a_attr, $a_val)
Set attribute.
setActiveFrom($a_unix_ts)
Set activation from.
getPermissionRefId()
Get permission ref id.
getActiveFrom()
Get activation from.
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.
if(!array_key_exists('StateId', $_REQUEST)) $id
if(array_key_exists('yes', $_REQUEST)) $attributes
xpath_eval($xpath_context, $eval_str, $contextnode=null)
domxml_open_mem($str, $mode=0, &$error=null)
xpath_new_context($dom_document)
foreach($_POST as $key=> $value) $res