protected function xmodule() { $this->parseChildren(); $element = $this->globals['INPUT_ELEMENT']; $sectionType = $this->globals['INPUT_SECTIONTYPE']; if (empty($element)) { throw new Exception('XModule [' . $this->template->getName() . '] is missing POST parameter [element]'); } $str = StringUtils::l("{% set DataSource %}node-sections{% end %}"); $str .= StringUtils::l("{% begin contents %}"); if (!empty($this->js)) { $str .= StringUtils::l('<script type="text/javascript">'); $str .= StringUtils::l(); foreach ((array) $this->js as $line) { $str .= StringUtils::l($line); } $str .= StringUtils::l(); $str .= StringUtils::l("document.sectionWidgets['{$sectionType}'].initializeSection(%TempSectionID%);"); $str .= StringUtils::l('</script>'); } if (!empty($this->xhtml)) { foreach ((array) $this->xhtml as $line) { $str .= StringUtils::l($line); } } $str .= StringUtils::l("{% end %}"); return $str; }
protected function _xmodule() { $str = StringUtils::l("{% begin contents %}"); if (!empty($this->js)) { $str .= StringUtils::l('<script type="text/javascript">'); $str .= StringUtils::l(); if (!self::$printedFieldClasses) { $str .= StringUtils::l($this->_buildFieldClasses()); self::$printedFieldClasses = true; } $str .= StringUtils::l(); $str .= StringUtils::l(' $(document).ready(function() {'); $str .= StringUtils::l(); foreach ((array) $this->js as $line) { $str .= StringUtils::l($line); } $str .= StringUtils::l(); $str .= StringUtils::l(' });'); $str .= StringUtils::l(); $str .= StringUtils::l('</script>'); } if (!empty($this->xhtml)) { foreach ((array) $this->xhtml as $line) { $str .= StringUtils::l($line); } } $str .= StringUtils::l("{% end %}"); return $str; }
protected function _xmodule() { $element = $this->ElementService->getBySlug($this->globals['INPUT_ELEMENT']); $ignoreAspects = array(); $ignore = $this->getParameter('ignore'); if (!empty($ignore)) { $ignoreAspects = StringUtils::smartExplode($ignore); } $aspects = $element->getAspects(); $ordered = array(); foreach ((array) $aspects as $aspect) { if (in_array($aspect['Slug'], $ignoreAspects)) { continue; } $plugin = $this->PluginService->getByID($aspect['PluginID']); $ordered[$plugin->Priority][] = $aspect; } ksort($ordered); foreach ($ordered as $priority => $aspects) { foreach ($aspects as $aspect) { $template = $this->getTemplate($aspect); if ($this->TemplateService->fileExists($template)) { $this->xhtml[] = StringUtils::l("{% template {$template}?inherit=true %}"); } } } $str = StringUtils::l("{% begin contents %}"); if (!empty($this->js)) { $str .= StringUtils::l('<script type="text/javascript">'); $str .= StringUtils::l(); $str .= StringUtils::l(' $(document).ready(function() {'); $str .= StringUtils::l(); foreach ((array) $this->js as $line) { $str .= StringUtils::l($line); } $str .= StringUtils::l(); $str .= StringUtils::l(' });'); $str .= StringUtils::l(); $str .= StringUtils::l('</script>'); } if (!empty($this->xhtml)) { foreach ((array) $this->xhtml as $line) { $str .= StringUtils::l($line); } } $str .= StringUtils::l("{% end %}"); return $str; }