From: bruno@cubedesigners.com Date: Thu, 23 Jan 2014 16:40:51 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=69fd359714c632e68e644a97e8ef9c3ecbb39390;p=cubedesigners-v7.git --- diff --git a/framework/application/Bootstrap.php b/framework/application/Bootstrap.php index e83cfa1..31e6001 100644 --- a/framework/application/Bootstrap.php +++ b/framework/application/Bootstrap.php @@ -12,6 +12,7 @@ class Bootstrap extends CubeIT_Bootstrap { protected function _initScripts() { parent::_initScripts(); $this->getView()->headLink()->appendStylesheet('/css/fonts/fonts.css'); + $this->getView()->headScript()->addTagHandler(); } protected function _initRouter($initCms = true) { @@ -34,6 +35,11 @@ class Bootstrap extends CubeIT_Bootstrap { $user->addUniqueIndex(array('username')); $user->addColumn('password', 'string', array('length' => 255)); $user->addColumn('role', 'string', array('length' => 32)); + + $tags = $schema->createTable('tags'); + $tags->addColumn('id', 'integer', array('unsigned' => true, 'autoincrement' => true)); + $tags->setPrimaryKey(array('id')); + $tags->addColumn('name', 'string', array('length' => 64)); } protected function _initAcl() { diff --git a/framework/application/forms/CMS/Casestudies.php b/framework/application/forms/CMS/Casestudies.php index b7d5179..459e6a4 100644 --- a/framework/application/forms/CMS/Casestudies.php +++ b/framework/application/forms/CMS/Casestudies.php @@ -8,6 +8,10 @@ class Cubedesigners_Form_CMS_Casestudies extends Cubedesigners_Form_CMS { $titre = new CubeIT_Form_Element_Markitup('titre'); $titre->setLabel('Titre'); $this->addElement($titre); + + $studies = new Cubedesigners_Form_CMS_Sub_Casestudies_Studies(); + $studies->setLabel('Etudes de cas'); + $this->addSubForm($studies, 'studies'); } } diff --git a/framework/application/forms/CMS/Sub/Casestudies/Studie.php b/framework/application/forms/CMS/Sub/Casestudies/Studie.php new file mode 100644 index 0000000..7212a38 --- /dev/null +++ b/framework/application/forms/CMS/Sub/Casestudies/Studie.php @@ -0,0 +1,28 @@ +setLabel('Titre'); + $this->addElement($titre); + + $description = new Zend_Form_Element_Text('description'); + $description->setLabel('Description'); + $this->addElement($description); + + $visuel = new CubeIT_Form_Element_File_Image('visuel'); + $visuel->setLabel('Visuel de la page Case Studies'); + $visuel->setMaxItems(1); + $this->addElement($visuel); + + $tags = new Cubedesigners_Form_Element_Tags('tags'); + $tags->setLabel('Tags'); + $this->addElement($tags); + } + +} + +?> diff --git a/framework/application/forms/CMS/Sub/Casestudies/Studies.php b/framework/application/forms/CMS/Sub/Casestudies/Studies.php new file mode 100644 index 0000000..b4c5359 --- /dev/null +++ b/framework/application/forms/CMS/Sub/Casestudies/Studies.php @@ -0,0 +1,16 @@ +setBaseSubForm($studie); + $this->setBaseLegend('Edition de l\'etude de cas « $titre »'); + $this->setNewLegend('Nouvelle étude de cas'); + } + +} + +?> diff --git a/framework/application/forms/Element/Tags.php b/framework/application/forms/Element/Tags.php new file mode 100644 index 0000000..db73104 --- /dev/null +++ b/framework/application/forms/Element/Tags.php @@ -0,0 +1,11 @@ +setBaseForm('Cubedesigners_Form_Tags'); + } + +} + +?> diff --git a/framework/application/forms/Settings.php b/framework/application/forms/Settings.php index c161d5c..a14c418 100644 --- a/framework/application/forms/Settings.php +++ b/framework/application/forms/Settings.php @@ -35,6 +35,10 @@ class Cubedesigners_Form_Settings extends CubeIT_Form_Settings { $copyright = new Zend_Form_Element_Text('copyright'); $copyright->setLabel('Copyright du bas de page'); $this->addElementLocalized($copyright); + + $tags = new Cubedesigners_Form_Element_Tags('tags'); + $tags->setLabel(__('Tags')); + $this->addElement($tags); } } diff --git a/framework/application/forms/Tags.php b/framework/application/forms/Tags.php new file mode 100644 index 0000000..b4c0087 --- /dev/null +++ b/framework/application/forms/Tags.php @@ -0,0 +1,60 @@ +setLabel('#'); + $this->addElement($id); + + $name = new Zend_Form_Element_Text('name'); + $name->setLabel(__('Nom')); + $this->addElement($name); + + $this->setListTitle(__('Tags')) + ->setNewTitle(__('Créer un tag')) + ->setEditTitle(sprintf(__("Edition du tag « %s »"), '$name')) + ->setBaseTable('tags') + ->setIdColumn('id') + ->setTitleColumn('name'); + } + + public function saveInDatabase() { + $id = parent::saveInDatabase(); + /* + $db = Bootstrap::getInstance()->getDb(); + $us = $this->getElement('users'); + if (!is_null($us)) { + $e = explode(',', $us->getValue()); + // Delete all settings of this user + $db->delete('cubeit_group_content', $db->quoteInto('group_id = ?', $id)); + $binds = array(); + foreach ($e as $user) { + $binds[] = array('group_id' => $id, 'user_id' => $user); + } + + $db->insertMultiple('cubeit_group_content', $binds); + } */ + return $id; + } + + public function setValuesWithId($id) { + parent::setValuesWithId($id); + /* $db = Bootstrap::getInstance()->getDb(); + $all = $db->select() + ->from('cubeit_group_content') + ->where('group_id = ?', $id) + ->query() + ->fetchAll(Zend_Db::FETCH_ASSOC); + $users = array(); + foreach ($all as $r) { + $users[] = $r['user_id']; + } + $this->setDefault('users', implode(',', $users)); */ + } + +} + +?> diff --git a/framework/application/forms/User.php b/framework/application/forms/User.php index bdfdc15..7b60b99 100644 --- a/framework/application/forms/User.php +++ b/framework/application/forms/User.php @@ -8,4 +8,4 @@ class Cubedesigners_Form_User extends CubeIT_Form_User { } -?> +?> \ No newline at end of file diff --git a/framework/application/views/helpers/CasestudiesList.php b/framework/application/views/helpers/CasestudiesList.php new file mode 100644 index 0000000..35025e4 --- /dev/null +++ b/framework/application/views/helpers/CasestudiesList.php @@ -0,0 +1,42 @@ +view->imageProcess($studie['visuel'], $studie['titre'], 300, 225); + + $res .= '
'; + $res .= '
' . $image . '
'; + $res .= '
' . $studie["titre"] . '
'; + $res .= '
' . $studie["description"] . '
'; + $res .= '
'; + + // if ($addSpacer) { + // $res .= '
'; + // } + } + + return $res; + } + +} + +?> diff --git a/framework/application/views/helpers/CasestudiesTagsList.php b/framework/application/views/helpers/CasestudiesTagsList.php new file mode 100644 index 0000000..1a19307 --- /dev/null +++ b/framework/application/views/helpers/CasestudiesTagsList.php @@ -0,0 +1,40 @@ +select()->from('tags') + ->order('name ASC'); + $q = $s->query(); + + $res = ''; + return $res; + } + +} + +?> diff --git a/framework/application/views/scripts/common/footer.phtml b/framework/application/views/scripts/common/footer.phtml index d483aa8..5725c9d 100644 --- a/framework/application/views/scripts/common/footer.phtml +++ b/framework/application/views/scripts/common/footer.phtml @@ -2,7 +2,7 @@ $this->headLink()->appendStylesheet('/less/footer.less'); $mentions_page = $this->navigation()->getContainer()->findOneById($this->localeDefault() . '/7'); -fb($mentions_page); +//fb($mentions_page); $mentions = '/'; if (!is_null($mentions_page)) { $mentions = $mentions_page->getHref(); diff --git a/framework/application/views/scripts/templates/casestudies.phtml b/framework/application/views/scripts/templates/casestudies.phtml index ce70e86..86d27b8 100644 --- a/framework/application/views/scripts/templates/casestudies.phtml +++ b/framework/application/views/scripts/templates/casestudies.phtml @@ -1,31 +1,17 @@ headScript()->addScriptAndStyle('casestudies'); + +fb($this->studies); ?>
markupDotclear($this->titre); ?>
-
TOUT VOIRSites internetLogotypes
- -
- + CasestudiesTagsList($this->studies); ?> +
- if ($count == 3) { - $count = 1; - $addClass = ''; - $addSpacer = true; - } else { - $addClass = ' blocmargin'; - $count++; - } - echo '
'; - if ($addSpacer) - echo '
'; - } - ?> +
+ CasestudiesList($this->studies); ?>
diff --git a/js/casestudies.js b/js/casestudies.js new file mode 100644 index 0000000..2bce166 --- /dev/null +++ b/js/casestudies.js @@ -0,0 +1,48 @@ +TO_LOAD_ONCE[TO_LOAD_ONCE.length]='load_casestudies();'; + +var showIds = new Array(); + +function load_casestudies() { + + initTagsLink(); +} + +function initTagsLink() { + + $(".tag").click(function() { + + $(this).toggleClass('active'); + + if( $(this).hasClass('active') ) { + showIds.push( $(this).attr("data-id") ); + } else { + var index = $.inArray( $(this).attr("data-id"), showIds ); + showIds.splice(index, 1); + } + + if( showIds.length > 0 ) { + $(".tag:first").removeClass('active'); + }else{ + $(".tag:first").addClass('active'); + } + + displayStudies(); + alert(showIds); + }); + +} + +function displayStudies() { + + if( showIds.length == 0 ) { + //$(".tag:first").toggleClass('active'); + } + + $.ajax({ + url : '/ajax/displaystudies', + dataType : 'text', + //data : JSON.stringify(showIds) + }); + +} + diff --git a/less/casestudies.less b/less/casestudies.less index e747f79..f9da4c9 100644 --- a/less/casestudies.less +++ b/less/casestudies.less @@ -5,22 +5,32 @@ padding: 0 0 20px 0; } -#casestudies-tagslist span { +#casestudies-tagslist ul { + list-style: none; +} + +#casestudies-tagslist li { font-size: 14px; color: #6f6f6f; padding: 3px; border-radius: 2px; background-color: #ededed; - margin:0 6px 0 0; + margin:0 6px 6px 0; + display: inline-block; } -#casestudies-tagslist span:hover, -#casestudies-tagslist span:active { +#casestudies-tagslist li:hover, +#casestudies-tagslist li:active { cursor: pointer; color: #fff; background-color: #84ae1e; } +#casestudies-tagslist .active { + color: #fff; + background-color: #84ae1e; +} + #casestudies-list { min-width: 980px; max-width: 980px; @@ -29,11 +39,24 @@ overflow: hidden; } -#casestudies-list .bloc { +#casestudies-list .bloc { + width:300px; float:left; +} + +#casestudies-list .bloc .project-photo { width:300px; height:225px; background-color: #ccc; + margin:0 0 20px 0; +} + +#casestudies-list .bloc .project-title { + font-size: 32px; +} +#casestudies-list .bloc .project-description { + font-size: 14px; + margin-bottom: 20px; } #casestudies-list .blocmargin {