5 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
35 parent::setNode($a_node);
36 $this->sec_node = $a_node->first_child();
45 function create(&$a_pg_obj, $a_hier_id, $a_pc_id =
"")
49 $this->sec_node = $this->dom->create_element(
"Section");
50 $this->sec_node = $this->node->append_child($this->sec_node);
51 $this->sec_node->set_attribute(
"Characteristic",
"Block");
63 $this->sec_node->set_attribute(
"Characteristic", $a_char);
67 if ($this->sec_node->has_attribute(
"Characteristic"))
69 $this->sec_node->remove_attribute(
"Characteristic");
81 if (is_object($this->sec_node))
83 $char = $this->sec_node->get_attribute(
"Characteristic");
84 if (substr($char, 0, 4) ==
"ilc_")
86 $char = substr($char, 4);
98 return array(
"ed_insert_section");
111 include_once(
"./Services/COPage/classes/class.ilPCSection.php");
112 self::saveTimings($a_page);
123 $a_output = self::insertTimings($a_output);
138 $this->sec_node->set_attribute(
"ActiveFrom", $a_unix_ts);
142 if ($this->sec_node->has_attribute(
"ActiveFrom"))
144 $this->sec_node->remove_attribute(
"ActiveFrom");
156 if (is_object($this->sec_node))
158 return $this->sec_node->get_attribute(
"ActiveFrom");
173 $this->sec_node->set_attribute(
"ActiveTo", $a_unix_ts);
177 if ($this->sec_node->has_attribute(
"ActiveTo"))
179 $this->sec_node->remove_attribute(
"ActiveTo");
191 if (is_object($this->sec_node))
193 return $this->sec_node->get_attribute(
"ActiveTo");
209 $this->sec_node->set_attribute($a_attr, $a_val);
213 if ($this->sec_node->has_attribute($a_attr))
215 $this->sec_node->remove_attribute($a_attr);
228 if (is_object($this->sec_node))
230 return $this->sec_node->get_attribute($a_attr);
263 $this->
setAttribute(
"PermissionRefId",
"il__ref_".$a_ref_id);
273 $id = explode(
"_", $this->
getAttribute(
"PermissionRefId"));
274 if (in_array($id[1],
array(
"", 0, IL_INST_ID)))
296 if (trim($a_href) !=
"")
298 $attributes =
array(
"Href" => trim($a_href));
300 array(
""),
"", $attributes);
310 $attributes =
array(
"Type" =>
$a_type,
"Target" => $a_target,
311 "TargetFrame" => $a_target_frame);
313 array(
""),
"", $attributes);
324 $childs = $this->sec_node->child_nodes();
325 foreach($childs as $child)
327 if ($child->node_name() ==
"ExtLink")
329 return array(
"LinkType" =>
"ExtLink",
330 "Href" => $child->get_attribute(
"Href"));
332 if ($child->node_name() ==
"IntLink")
334 return array(
"LinkType" =>
"IntLink",
335 "Target" => $child->get_attribute(
"Target"),
336 "Type" => $child->get_attribute(
"Type"),
337 "TargetFrame" => $child->get_attribute(
"TargetFrame"));
340 return array(
"LinkType" =>
"NoLink");
353 while ((
$start = strpos($a_html,
"{{{{{Section;Access;")) > 0)
355 $end = strpos($a_html,
"}}}}}",
$start);
356 $access_attr = explode(
";", substr($a_html,
$start, $end -
$start));
357 $id = explode(
"_", $access_attr[3]);
359 if (in_array($id[1],
array(
"", 0, IL_INST_ID)) && $id[3] > 0)
361 $access = $ilAccess->checkAccess($access_attr[5],
"", $id[3]);
365 $a_html = substr($a_html, 0,
$start).substr($a_html, $end + 5);
369 $end = strpos($a_html,
"{{{{{Section;Access}}}}}",
$start);
370 $a_html = substr($a_html, 0,
$start).substr($a_html, $end + 24);
374 $a_html = str_replace(
"{{{{{Section;Access}}}}}",
"", $a_html);
388 $ilDB->manipulate(
"DELETE FROM copg_section_timings WHERE ".
389 " page_id = ".$ilDB->quote($a_page->getId(),
"integer").
390 " AND parent_type = ".$ilDB->quote($a_page->getParentType(),
"text")
393 $xml = $a_page->getXMLFromDom();
401 for ($i=0; $i < count(
$res->nodeset); $i++)
403 $from =
$res->nodeset[$i]->get_attribute(
"ActiveFrom");
406 $ilDB->replace(
"copg_section_timings",
408 "page_id" =>
array(
"integer", $a_page->getId()),
409 "parent_type" =>
array(
"text", $a_page->getParentType()),
410 "unix_ts" =>
array(
"integer", $from)
415 $to =
$res->nodeset[$i]->get_attribute(
"ActiveTo");
418 $ilDB->replace(
"copg_section_timings",
420 "page_id" =>
array(
"integer", $a_page->getId()),
421 "parent_type" =>
array(
"text", $a_page->getParentType()),
422 "unix_ts" =>
array(
"integer", $to)
440 $set = $ilDB->query(
"SELECT * FROM copg_section_timings ".
441 " WHERE page_id = ".$ilDB->quote($a_page->getId(),
"integer").
442 " AND parent_type = ".$ilDB->quote($a_page->getParentType(),
"text")
447 while ($rec = $ilDB->fetchAssoc($set))
449 $unix_ts = $rec[
"unix_ts"];
450 if ($unix_ts < $current_ts)
471 $start = strpos($a_html,
"{{{{{Section;ActiveFrom");
474 $end = strpos($a_html,
"}}}}}",
$start);
479 $param = substr($a_html,
$start + 13, $end -
$start - 13);
480 $param = explode(
";", $param);
496 $h2 = substr($a_html, 0,
$start).
498 substr($a_html, $end + 5);
502 $start = strpos($a_html,
"{{{{{Section;ActiveFrom;",
$start + 5);
506 $end = strpos($a_html,
"}}}}}",
$start);
setIntLink($a_type, $a_target, $a_target_frame)
Set link of area to an internal one.
modifyPageContentPostXsl($a_output, $a_mode)
Modify page content after xsl.
getPermissionRefId()
Get permission ref id.
getActiveFrom()
Get activation from.
xpath_new_context($dom_document)
setPermission($a_val)
Set permission.
getActiveTo()
Get activation to.
getCharacteristic()
Get characteristic of section.
insertTimings($a_html)
Insert timings (in edit mode)
getAttribute($a_attr)
Get attribute.
xpath_eval($xpath_context, $eval_str, $contextnode=null)
static deleteAllChildsByName($a_parent, $a_node_names)
delete all childs of a node by names in $a_node_names
setExtLink($a_href)
Set link of area to an external one.
static setUseRelativeDates($a_status)
set use relative dates
setType($a_type)
Set Type.
init()
Init page content component.
setActiveTo($a_unix_ts)
Set activation to.
getPermission()
Get permission.
static afterPageUpdate($a_page, DOMDocument $a_domdoc, $a_xml, $a_creation)
After page has been updated (or created)
static saveTimings($a_page)
Save timings.
setAttribute($a_attr, $a_val)
Set attribute.
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 formatDate(ilDateTime $date)
Format a date public.
static getCacheTriggerString($a_page)
Get page cache update trigger string.
Create styles array
The data for the language used.
setActiveFrom($a_unix_ts)
Set activation from.
static getLangVars()
Get lang vars needed for editing.
setCharacteristic($a_char)
Set Characteristic of section.
createPageContentNode($a_set_this_node=true)
Create page content node (always use this method first when adding a new element) ...
setNode($a_node)
Set node.
domxml_open_mem($str, $mode=0, &$error=NULL)
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
handleAccess($a_html, $a_mode)
create(&$a_pg_obj, $a_hier_id, $a_pc_id="")
Create section node in xml.
setPermissionRefId($a_ref_id)
Set permission ref id.