Example #1
0
 protected function init()
 {
     $this->pages = PageCacheBuilder::getInstance()->getData(array(), 'pages');
     $this->contents = ContentCacheBuilder::getInstance()->getData(array(), 'contents');
     $list = new StylesheetList();
     $list->readObjects();
     $this->stylesheets = $list->getObjects();
     $this->categoryObjectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.category', 'de.codequake.cms.file');
     $list = new CategoryList();
     $list->getConditionBuilder()->add("objectTypeID = ?", array($this->categoryObjectType->objectTypeID));
     $list->readObjects();
     $this->folders = $list->getObjects();
     $list = new FileList();
     $list->readObjects();
     $this->files = $list->getObjects();
 }
 /**
  * @see	\wcf\system\cache\builder\AbstractCacheBuilder::rebuild()
  */
 public function rebuild(array $parameters)
 {
     $list = new CategoryList();
     $list->sqlSelects = "object_type.objectType";
     $list->sqlJoins = "LEFT JOIN wcf" . WCF_N . "_object_type object_type ON (object_type.objectTypeID = category.objectTypeID)";
     $list->sqlOrderBy = "category.showOrder ASC";
     $list->readObjects();
     $data = array('categories' => $list->getObjects(), 'objectTypeCategoryIDs' => array());
     foreach ($list as $category) {
         if (!isset($data['objectTypeCategoryIDs'][$category->objectType])) {
             $data['objectTypeCategoryIDs'][$category->objectType] = array();
         }
         $data['objectTypeCategoryIDs'][$category->objectType][] = $category->categoryID;
     }
     return $data;
 }
 /**
  * @see wcf\system\cache\ICacheBuilder::getData()
  */
 public function getData(array $cacheResource)
 {
     $list = new CategoryList();
     $list->sqlLimit = 0;
     $list->sqlSelects = "object_type.objectType";
     $list->sqlJoins = "\tLEFT JOIN\twcf" . WCF_N . "_object_type object_type\n\t\t\t\t\tON\t\t(object_type.objectTypeID = category.objectTypeID)";
     $list->getConditionBuilder()->add("object_type.packageID IN (?)", array(PackageDependencyHandler::getInstance()->getDependencies()));
     $list->sqlOrderBy = "category.showOrder ASC";
     $list->readObjects();
     $data = array('categories' => $list->getObjects(), 'objectTypeCategoryIDs' => array());
     foreach ($list as $category) {
         if (!isset($data['objectTypeCategoryIDs'][$category->objectType])) {
             $data['objectTypeCategoryIDs'][$category->objectType] = array();
         }
         $data['objectTypeCategoryIDs'][$category->objectType][] = $category->categoryID;
     }
     return $data;
 }