/**
  * @see wcf\system\cache\ICacheBuilder::getData()
  */
 public function getData(array $cacheResource)
 {
     $templateGroupList = new TemplateGroupList();
     $templateGroupList->sqlLimit = 0;
     $templateGroupList->readObjects();
     return $templateGroupList->getObjects();
 }
 /**
  * @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\data\IEditableObject::deleteAll()
  */
 public static function deleteAll(array $objectIDs = array())
 {
     $list = new TemplateGroupList();
     $list->setObjectIDs($objectIDs);
     $list->readObjects();
     foreach ($list as $object) {
         $editor = new TemplateGroupEditor($object);
         $editor->deleteFolder();
     }
     return parent::deleteAll($objectIDs);
 }
Example #4
0
 /**
  * @see	\wcf\page\IPage::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     I18nHandler::getInstance()->register('styleDescription');
     $this->setVariables();
     if (empty($_POST)) {
         $this->readStyleVariables();
     }
     $templateGroupList = new TemplateGroupList();
     $templateGroupList->sqlOrderBy = "templateGroupName";
     $templateGroupList->readObjects();
     $this->availableTemplateGroups = $templateGroupList->getObjects();
     if (isset($_REQUEST['tmpHash'])) {
         $this->tmpHash = StringUtil::trim($_REQUEST['tmpHash']);
     }
     if (empty($this->tmpHash)) {
         $this->tmpHash = StringUtil::getRandomID();
     }
 }
 /**
  * @see	\wcf\system\cache\builder\AbstractCacheBuilder::rebuild()
  */
 public function rebuild(array $parameters)
 {
     $templateGroupList = new TemplateGroupList();
     $templateGroupList->readObjects();
     return $templateGroupList->getObjects();
 }