From 294d25a775595eb876ed8def8187b793343c5234 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Thu, 29 Apr 2010 09:41:25 +0000 Subject: [PATCH] --- inc/ws/Controlleur/class.ws.flash.php | 6 ++++++ inc/ws/DAO/class.ws.dao.theme.php | 18 ++++++++++++++++++ inc/ws/Metier/class.ws.parametres.php | 8 ++++++-- inc/ws/Metier/class.ws.theme.parametres.php | 13 ++++++++++++- inc/ws/Metier/class.ws.theme.php | 8 ++++++++ 5 files changed, 50 insertions(+), 3 deletions(-) diff --git a/inc/ws/Controlleur/class.ws.flash.php b/inc/ws/Controlleur/class.ws.flash.php index e4650a5a7..fb28ae4f3 100644 --- a/inc/ws/Controlleur/class.ws.flash.php +++ b/inc/ws/Controlleur/class.ws.flash.php @@ -137,6 +137,12 @@ class wsFlash extends cubeFlashGateway { $this->_themeToXML($theme); } + public function saveTheme(){ + global $core; + $dao=new wsDAOTheme($core->con); + $dao->sauve($this->args); + } + public function getAllThemes() { global $core; diff --git a/inc/ws/DAO/class.ws.dao.theme.php b/inc/ws/DAO/class.ws.dao.theme.php index ff2e0dbba..82a30d1ff 100644 --- a/inc/ws/DAO/class.ws.dao.theme.php +++ b/inc/ws/DAO/class.ws.dao.theme.php @@ -48,6 +48,24 @@ class wsDAOTheme extends extranetDAO { return $this->factory($r); } + public function sauve($data) + { + $parent=$this->selectById($data['theme_id']); + $c = $this->con->openCursor('themes'); + $c->date = TIME; + $p = new wsThemeParametres($parent); + foreach($data as $k => $v) { + try { + $p->$k = $v; + } + catch(Exception $e) { + } + } + $c->parametres = serialize($p); + $c->update('WHERE theme_id=\'' . $this->con->escape($data['theme_id']) . '\''); + unlink(ROOT . '/themes/' . $this->args['theme_id'] . '.jpg'); + } + protected function getNextId() { $r = $this->con->select('SELECT MAX(theme_id) AS theme_id FROM themes'); diff --git a/inc/ws/Metier/class.ws.parametres.php b/inc/ws/Metier/class.ws.parametres.php index 30efeb20c..144cb5642 100644 --- a/inc/ws/Metier/class.ws.parametres.php +++ b/inc/ws/Metier/class.ws.parametres.php @@ -102,7 +102,11 @@ class wsParametres extends cubeMetier implements Iterator { break; case 'color': case 'couleur': - $value = substr(trim($value, '#'), 0, 6); + $value = trim($value, '#'); + if (strlen($value) != 6) { + $value = dechex($value); + } + $value = cubeMath::fill($value, 6); break; case 'date': $value = intval($value); @@ -129,7 +133,7 @@ class wsParametres extends cubeMetier implements Iterator { } if (!isset($this->datas[$varname]) || is_null($this->datas[$varname])) { if (substr($this->fields[$varname]['default'], 0, 1) == '$') { - return $this->get(substr($this->fields[$varname]['default'],1)); + return $this->get(substr($this->fields[$varname]['default'], 1)); } else { return $this->fields[$varname]['default']; } diff --git a/inc/ws/Metier/class.ws.theme.parametres.php b/inc/ws/Metier/class.ws.theme.parametres.php index 533f143be..946069273 100644 --- a/inc/ws/Metier/class.ws.theme.parametres.php +++ b/inc/ws/Metier/class.ws.theme.parametres.php @@ -60,6 +60,16 @@ class wsThemeParametres extends wsParametres { __("Répéter") => wsTheme::REPEAT, __('Ne pas répéter ni étirer') => wsTheme::NONE), 'default' => 0, 'editable' => true, 'label' => __('Affichage du fond'), 'grade' => 3); + $this->fields['backgroundHAlign'] = array('type' => 'combo', + 'datas' => array(__('Centré') => wsTheme::CENTER, + __('Gauche') => wsTheme::LEFT, + __("Droite") => wsTheme::RIGHT), + 'default' => wsTheme::CENTER, 'editable' => true, 'label' => __('Alignement Horizontal'), 'grade' => 3); + $this->fields['backgroundVAlign'] = array('type' => 'combo', + 'datas' => array(__('Milieu') => wsTheme::MIDDLE, + __('Haut') => wsTheme::TOP, + __("Bas") => wsTheme::BOTTOM), + 'default' => wsTheme::MIDDLE, 'editable' => true, 'label' => __('Alignement Vertical'), 'grade' => 3); $this->fields['menuColor'] = array('type' => 'couleur', 'default' => 'ffffff', 'editable' => true, 'label' => __("Couleur du fond"), 'extra' => false, 'grade' => 3); $this->fields['shadeOnMenu'] = array('type' => 'boolean', 'default' => true, 'editable' => true, @@ -103,7 +113,8 @@ class wsThemeParametres extends wsParametres { /* Regroupement des champs par formulaire */ $this->forms['background'] = array('label' => __('Personnalisation du fond'), - 'fieldsnames' => array('backgroundColor', '|', 'useBackgroundImage', 'backgroundImage', 'repeat')); + 'fieldsnames' => array('backgroundColor', '|', 'useBackgroundImage', 'backgroundImage', '|', + 'repeat', 'backgroundHAlign', 'backgroundVAlign')); $this->forms['bouton'] = array('label' => __('Personnalisation des boutons'), 'fieldsnames' => array('couleurA', 'arrowsColor')); $this->forms['icones'] = array('label' => __('Personnalisation des icônes'), diff --git a/inc/ws/Metier/class.ws.theme.php b/inc/ws/Metier/class.ws.theme.php index 55f95a088..4f04dbbc7 100644 --- a/inc/ws/Metier/class.ws.theme.php +++ b/inc/ws/Metier/class.ws.theme.php @@ -5,6 +5,14 @@ class wsTheme extends cubeMetier { const RATIO = 2; const REPEAT = 1; + const CENTER = 4; + const LEFT = 5; + const RIGHT = 6; + + const MIDDLE = 7; + const TOP = 8; + const BOTTOM = 9; + public static $files = array('background' => 'backgroundImg.jpg', 'menu' => 'menu_back.png', 'logo' => 'menu_clientLogo.png', 'logoLoader' => 'logoLoader.png'); protected $theme_id; -- 2.39.5