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);
137 $this->sec_node->set_attribute(
"ActiveFrom", $a_unix_ts);
141 if ($this->sec_node->has_attribute(
"ActiveFrom"))
143 $this->sec_node->remove_attribute(
"ActiveFrom");
155 if (is_object($this->sec_node))
157 return $this->sec_node->get_attribute(
"ActiveFrom");
172 $this->sec_node->set_attribute(
"ActiveTo", $a_unix_ts);
176 if ($this->sec_node->has_attribute(
"ActiveTo"))
178 $this->sec_node->remove_attribute(
"ActiveTo");
190 if (is_object($this->sec_node))
192 return $this->sec_node->get_attribute(
"ActiveTo");
207 $ilDB->manipulate(
"DELETE FROM copg_section_timings WHERE ".
208 " page_id = ".$ilDB->quote($a_page->getId(),
"integer").
209 " AND parent_type = ".$ilDB->quote($a_page->getParentType(),
"text")
212 $xml = $a_page->getXMLFromDom();
220 for ($i=0; $i < count(
$res->nodeset); $i++)
222 $from =
$res->nodeset[$i]->get_attribute(
"ActiveFrom");
225 $ilDB->manipulate(
"INSERT INTO copg_section_timings ".
226 "(page_id, parent_type, unix_ts) VALUES (".
227 $ilDB->quote($a_page->getId(),
"integer").
",".
228 $ilDB->quote($a_page->getParentType(),
"text").
",".
229 $ilDB->quote($from,
"text").
232 $to =
$res->nodeset[$i]->get_attribute(
"ActiveTo");
235 $ilDB->manipulate(
"INSERT INTO copg_section_timings ".
236 "(page_id, parent_type, unix_ts) VALUES (".
237 $ilDB->quote($a_page->getId(),
"integer").
",".
238 $ilDB->quote($a_page->getParentType(),
"text").
",".
239 $ilDB->quote($to,
"text").
255 $set = $ilDB->query(
"SELECT * FROM copg_section_timings ".
256 " WHERE page_id = ".$ilDB->quote($a_page->getId(),
"integer").
257 " AND parent_type = ".$ilDB->quote($a_page->getParentType(),
"text")
262 while ($rec = $ilDB->fetchAssoc($set))
264 $unix_ts = $rec[
"unix_ts"];
265 if ($unix_ts < $current_ts)
286 $start = strpos($a_html,
"{{{{{Section;ActiveFrom");
289 $end = strpos($a_html,
"}}}}}", $start);
294 $param = substr($a_html, $start + 13, $end - $start - 13);
295 $param = explode(
";", $param);
311 $h2 = substr($a_html, 0, $start).
313 substr($a_html, $end + 5);
317 $start = strpos($a_html,
"{{{{{Section;ActiveFrom;", $start + 5);
321 $end = strpos($a_html,
"}}}}}", $start);
modifyPageContentPostXsl($a_output, $a_mode)
Modify page content after xsl.
domxml_open_mem($str, $mode=DOMXML_LOAD_PARSING, &$error=NULL)
getActiveFrom()
Get activation from.
xpath_new_context($dom_document)
getActiveTo()
Get activation to.
getCharacteristic()
Get characteristic of section.
insertTimings($a_html)
Insert timings (in edit mode)
xpath_eval($xpath_context, $eval_str, $contextnode=null)
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.
static afterPageUpdate($a_page, DOMDocument $a_domdoc, $a_xml, $a_creation)
After page has been updated (or created)
static saveTimings($a_page)
Save timings.
static formatDate(ilDateTime $date)
Format a date public.
static getCacheTriggerString($a_page)
Get page cache update trigger string.
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.
create(&$a_pg_obj, $a_hier_id, $a_pc_id="")
Create section node in xml.