/** * @see \wcf\page\IPage::readData() */ public function readData() { parent::readData(); // read out template groups $templateGroupList = new TemplateGroupList(); $templateGroupList->readObjects(); // build template group hierarchy (template groups that are parents of the template group of the selected template) $this->templateGroupHierarchy = array(); $templateGroup = $templateGroupList->search($this->template->templateGroupID); while ($templateGroup !== null) { $this->templateGroupHierarchy[$templateGroup->templateGroupID] = array('group' => $templateGroup, 'hasTemplate' => false); $templateGroup = $templateGroupList->search($templateGroup->parentTemplateGroupID); } $this->templateGroupHierarchy[0] = array('group' => array(), 'hasTemplate' => false); // find matching templates in the hierarchy $templateList = new TemplateList(); $templateList->getConditionBuilder()->add('templateName = ?', array($this->template->templateName)); $templateList->getConditionBuilder()->add('application = ?', array($this->template->application)); $templateList->getConditionBuilder()->add('(template.templateGroupID IN(?) OR template.templateGroupID IS NULL)', array(array_keys($this->templateGroupHierarchy))); $templateList->readObjects(); foreach ($templateList as $template) { $this->templateGroupHierarchy[$template->templateGroupID ?: 0]['hasTemplate'] = $template->templateID; } // a valid parent template was given, calculate diff if ($this->parent->templateID) { $a = explode("\n", StringUtil::unifyNewlines($this->parent->getSource())); $b = explode("\n", StringUtil::unifyNewlines($this->template->getSource())); $this->diff = new Diff($a, $b); } }
/** * @see \wcf\page\IPage::readData() */ public function readData() { parent::readData(); if (!count($_POST)) { $this->tplName = $this->template->templateName; $this->templateSource = $this->template->getSource(); $this->templateGroupID = $this->template->templateGroupID; } }
/** * @see \wcf\page\IPage::readData() */ public function readData() { parent::readData(); $this->availableTemplateGroups = TemplateGroup::getSelectList(); if (!count($_POST) && $this->copiedTemplate !== null) { $this->tplName = $this->copiedTemplate->templateName; $this->templateSource = $this->copiedTemplate->getSource(); } }