/** * Fetches current CSS style definition * * @return ezcsseSiteStyleDefinition|null */ public function fetchCurrentStyleDef() { $styleDefinition = ezcsseSiteStyleDefinition::fetchObject(ezcsseSiteStyleDefinition::definition(), null, array('version' => $this->attribute('current_version'), 'sitestyle_id' => $this->attribute('id'))); return $styleDefinition; }
$siteStyleDef->setAttribute('version', $currentVersion + 1); $siteStyleDef->setAttribute('style', $style); $siteStyleDef->store(); } else { $siteStyle = new ezcsseSiteStyle(); $siteStyle->setAttribute('name', 'New style'); $siteStyle->setAttribute('current_version', 1); $siteStyle->setAttribute('selected', 1); $siteStyle->store(); $siteStyleVersion = new ezcsseSiteStyleVersion(); $siteStyleVersion->setAttribute('sitestyle_id', $siteStyle->attribute('id')); $siteStyleVersion->setAttribute('version', 1); $siteStyleVersion->setAttribute('created', time()); $siteStyleVersion->setAttribute('modified', time()); $siteStyleVersion->store(); $siteStyleDef = new ezcsseSiteStyleDefinition(); $siteStyleDef->setAttribute('sitestyle_id', $siteStyle->attribute('id')); $siteStyleDef->setAttribute('version', 1); $siteStyleDef->store(); } $tpl = templateInit(); $ini = eZINI::instance(); $http = eZHTTPTool::instance(); $contentObject = $node->attribute('object'); $nodeResult = eZNodeviewfunctions::generateNodeViewData($tpl, $node, $contentObject, $languageCode, 'full', 0); // Generate a unique cache key for use in cache-blocks in pagelayout.tpl. // This should be looked as a temporary fix as ideally all cache-blocks // should be disabled by this view. $cacheKey = 'styleeditorvisual-' + time(); $nodeResult['title_path'] = array(array('text' => 'Visual'), array('text' => $node->attribute('name'))); $httpCharset = eZTextCodec::httpCharset();
/** * Creates a new site style with given name * * @static */ public static function createSiteStyle() { $params = self::getPostParams(); $siteStyleParam = isset($params['site_style']) ? $params['site_style'] : array(); $siteStyleName = isset($siteStyleParam['name']) ? $siteStyleParam['name'] : null; $siteStyle = new ezcsseSiteStyle(); $siteStyle->setAttribute('name', $siteStyleName); $siteStyle->setAttribute('current_version', 1); $siteStyle->setAttribute('selected', 0); $siteStyle->store(); $siteStyleVersion = new ezcsseSiteStyleVersion(); $siteStyleVersion->setAttribute('sitestyle_id', $siteStyle->attribute('id')); $siteStyleVersion->setAttribute('version', 1); $siteStyleVersion->setAttribute('created', time()); $siteStyleVersion->setAttribute('modified', time()); $siteStyleVersion->store(); $siteStyleDef = new ezcsseSiteStyleDefinition(); $siteStyleDef->setAttribute('sitestyle_id', $siteStyle->attribute('id')); $siteStyleDef->setAttribute('version', 1); $siteStyleDef->store(); }