Author: slau Date: 2010-09-19 23:09:07 +0200 (Sun, 19 Sep 2010) New Revision: 30929
Added: plugins/sfDoctrineFaqPlugin/tags/ plugins/sfDoctrineFaqPlugin/trunk/ plugins/sfDoctrineFaqPlugin/trunk/LICENSE plugins/sfDoctrineFaqPlugin/trunk/README plugins/sfDoctrineFaqPlugin/trunk/config/ plugins/sfDoctrineFaqPlugin/trunk/config/app.yml plugins/sfDoctrineFaqPlugin/trunk/config/doctrine/ plugins/sfDoctrineFaqPlugin/trunk/config/doctrine/schema.yml plugins/sfDoctrineFaqPlugin/trunk/config/routing.yml.backend plugins/sfDoctrineFaqPlugin/trunk/config/routing.yml.frontend plugins/sfDoctrineFaqPlugin/trunk/data/ plugins/sfDoctrineFaqPlugin/trunk/data/fixtures/ plugins/sfDoctrineFaqPlugin/trunk/data/fixtures/fixtures.yml.example plugins/sfDoctrineFaqPlugin/trunk/lib/ plugins/sfDoctrineFaqPlugin/trunk/lib/filter/ plugins/sfDoctrineFaqPlugin/trunk/lib/filter/doctrine/ plugins/sfDoctrineFaqPlugin/trunk/lib/filter/doctrine/PluginsfFaqCategoryFormFilter.class.php plugins/sfDoctrineFaqPlugin/trunk/lib/filter/doctrine/PluginsfFaqFaqFormFilter.class.php plugins/sfDoctrineFaqPlugin/trunk/lib/form/ plugins/sfDoctrineFaqPlugin/trunk/lib/form/doctrine/ plugins/sfDoctrineFaqPlugin/trunk/lib/form/doctrine/PluginsfFaqCategoryForm.class.php plugins/sfDoctrineFaqPlugin/trunk/lib/form/doctrine/PluginsfFaqFaqForm.class.php plugins/sfDoctrineFaqPlugin/trunk/lib/helper/ plugins/sfDoctrineFaqPlugin/trunk/lib/helper/sfFaqHelper.php plugins/sfDoctrineFaqPlugin/trunk/lib/model/ plugins/sfDoctrineFaqPlugin/trunk/lib/model/doctrine/ plugins/sfDoctrineFaqPlugin/trunk/lib/model/doctrine/PluginsfFaqCategory.class.php plugins/sfDoctrineFaqPlugin/trunk/lib/model/doctrine/PluginsfFaqCategoryTable.class.php plugins/sfDoctrineFaqPlugin/trunk/lib/model/doctrine/PluginsfFaqFaq.class.php plugins/sfDoctrineFaqPlugin/trunk/lib/model/doctrine/PluginsfFaqFaqTable.class.php plugins/sfDoctrineFaqPlugin/trunk/modules/ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/actions/ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/actions/actions.class.php plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/lib/ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/lib/BasesfFaqActions.class.php plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/templates/ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/templates/_footer.php plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/templates/_header.php plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/templates/indexSuccess.php plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqAdmin/ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqAdmin/actions/ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqAdmin/actions/actions.class.php plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqAdmin/config/ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqAdmin/config/generator.yml plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqAdmin/lib/ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqAdmin/lib/sfFaqAdminGeneratorConfiguration.class.php plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqAdmin/lib/sfFaqAdminGeneratorHelper.class.php plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqAdmin/templates/ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqCategoryAdmin/ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqCategoryAdmin/actions/ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqCategoryAdmin/actions/actions.class.php plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqCategoryAdmin/config/ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqCategoryAdmin/config/generator.yml plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqCategoryAdmin/lib/ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqCategoryAdmin/lib/sfFaqCategoryAdminGeneratorConfiguration.class.php plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqCategoryAdmin/lib/sfFaqCategoryAdminGeneratorHelper.class.php plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqCategoryAdmin/templates/ plugins/sfDoctrineFaqPlugin/trunk/web/ plugins/sfDoctrineFaqPlugin/trunk/web/css/ plugins/sfDoctrineFaqPlugin/trunk/web/css/sf_faq.css plugins/sfDoctrineFaqPlugin/trunk/web/images/ plugins/sfDoctrineFaqPlugin/trunk/web/images/sf_faq_answer.gif Log: import first stable version of plugin Added: plugins/sfDoctrineFaqPlugin/trunk/LICENSE =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/LICENSE (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/LICENSE 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,20 @@ +sfFaqPlugin Copyright (c) 2007 Jonathan Démoutiez - [email protected] +sfFaqPlugin Copyright (c) 2007 Akky AKIMOTO - [email protected] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file Added: plugins/sfDoctrineFaqPlugin/trunk/README =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/README (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/README 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,111 @@ +# sfDoctrineFaqPlugin # + +## Overview ## + +This plugin is a Doctrine port of the sfFaqPlugin +http://www.symfony-project.org/plugins/sfFaqPlugin + +It allows you to embed a FAQ module within your symfony application with the following features : + + * Questions are grouped into Categories + * BackEnd Modules to manage categories and questions + * A category can be activated or desactivated + * The front reloads the page with a good URL for search engine optimization + * i18n ready + + +## Requirements ## + + * symfony 1.4 + * Doctrine + +## Installation ## + +Get the source from github into your plugins-folder: + + $ git clone http://github.com/slaubi/sfDoctrineFaqPlugin + +or from the SVN + + $ svn co http://svn.symfony-project.com/plugins/sfDoctrineFaqPlugin/trunk plugins/sfDoctrineFaqPlugin + + + +Rebuild the model, generate the SQL code for the new tables and insert it into your database: + + $ ./symfony doctrine:build --all + + +Clear the cache to enable autoloading to find new classes: + + $ ./symfony cc + +You can load included fixtures to start using FAQ with test data. + + $ cp plugins/sfDoctrineFaqPlugin/data/fixtures/fixtures.yml.example data/fixtures/sf_doctrine_faq.yml + $ ./symfony doctrine:data-load --env=frontend + + + +## Configuration ## + +### plugin activation ### + +You need to add this plugin name in the setup() method in config/ProjectConfiguration.class.php + + public function setup() + { + $this->enablePlugins(array('sfDoctrineFaqPlugin')); + } + + +Or, if your setup() uses enableAllPluginsExcept(), which is to tell what plugins you do not use, make sure the 'sfFaqPlugin' is not in the array. + + +### setting.yml ### + +Enable the new `sfFaq` module in your application, within `settings.yml` file. + + // in myproject/apps/frontend/config/settings.yml + all: + .settings: + enabled_modules: [default, sfFaq] + + // in myproject/apps/backend/config/settings.yml + all: + .settings: + enabled_modules: [default, sfFaqCategoryAdmin, sfFaqAdmin] + + +Start using the plugin by browsing front-end module's default page: + + // frontend + http://myproject/sfFaq + + // backend + http://myproject/backend.php/sfFaqAdmin + http://myproject/backend.php/sfFaqCategoryAdmin + + +### app.yml ### + +Plugin features can be altered by configuration. To do so, check the plugin app.yml and copy the needed lines to your application's `app.yml`: + +### Routing rules ### + +The plugin doesn't come with any routing rule. However, you can add some of your own to make the URLs look nicer. An example of set of rules you find in the config folder. + + +### frontend-view / templates ### + +The template is very simple to allow you all wished and needed adaptions. It is also up to you to integrate more fancy javascript/ajax if necessary. + + +## Credits ## + +The propel version of this plugin was developed by [http://jonathan.demoutiez.net Jonathan Demoutiez] and [http://asiajin.com/blog/ Akky Akimoto]. + + +Modification for symfony 1.4 and migration to Doctrine is done by slaubi +http://github.com/slaubi/sfDoctrineFaqPlugin + Added: plugins/sfDoctrineFaqPlugin/trunk/config/app.yml =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/config/app.yml (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/config/app.yml 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,6 @@ +all: + sf_doctrine_faq_plugin: + + first_category_by_default: true # default : false, open the first category into load module + first_question_by_default: true # default : false, open the first question into load category + Added: plugins/sfDoctrineFaqPlugin/trunk/config/doctrine/schema.yml =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/config/doctrine/schema.yml (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/config/doctrine/schema.yml 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,51 @@ +sfFaqCategory: + options: + comment: FAQ Categories + type: INNODB + collate: utf8_general_ci + charset: utf8 + symfony: + form: true + filter: true + + actAs: + Timestampable: ~ + Sluggable: + fields: [name] + unique: [name] + + columns: + name: { type: string(255) } + description: { type: clob } + is_active: { type: boolean, notnull: true, default: 0 } + + indexes: + is_active: + fields: [is_active] + + + +sfFaqFaq: + options: + comment: FAQ Elements + type: INNODB + collate: utf8_general_ci + charset: utf8 + symfony: + form: true + filter: true + + actAs: + Timestampable: ~ + Sluggable: + fields: [question] + unique: [Category,question] + + + columns: + question: { type: string(255) } + answer: { type: clob } + category_id: { type: bigint(20) } + + relations: + sfFaqCategory: { onDelete: CASCADE, local: category_id, foreign: id, alias: Category } Added: plugins/sfDoctrineFaqPlugin/trunk/config/routing.yml.backend =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/config/routing.yml.backend (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/config/routing.yml.backend 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,18 @@ + +sf_faq_faq: + class: sfDoctrineRouteCollection + options: + model: sfFaqFaq + module: sfFaqAdmin + prefix_path: /sfFaqAdmin + column: id + with_wildcard_routes: true + +sf_faq_category: + class: sfDoctrineRouteCollection + options: + model: sfFaqCategory + module: sfFaqCategoryAdmin + prefix_path: /sfFaqCategoryAdmin + column: id + with_wildcard_routes: true \ No newline at end of file Added: plugins/sfDoctrineFaqPlugin/trunk/config/routing.yml.frontend =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/config/routing.yml.frontend (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/config/routing.yml.frontend 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,13 @@ + + +sf_faq_index: + url: /faq + param: { module: sfFaq, action: index } + +sf_faq_category: + url: /faq/:category_slug + param: { module: sfFaq, action: index } + +sf_faq_question: + url: /faq/:category_slug/:faq_slug + param: { module: sfFaq, action: index } Added: plugins/sfDoctrineFaqPlugin/trunk/data/fixtures/fixtures.yml.example =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/data/fixtures/fixtures.yml.example (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/data/fixtures/fixtures.yml.example 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,21 @@ +sfFaqCategory: + faq_category_1: + name: category 1 + faq_category_2: + name: category 2 + +sfFaqFaq: + faq_question_1: + question: Question 1 ? + answer: Answer 1 + Category: faq_category_1 + + faq_question_2: + question: Question 2 ? + answer: Answer 2 + Category: faq_category_2 + + faq_question_3: + question: Question 3 ? + answer: Answer 3 + Category: faq_category_2 Added: plugins/sfDoctrineFaqPlugin/trunk/lib/filter/doctrine/PluginsfFaqCategoryFormFilter.class.php =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/lib/filter/doctrine/PluginsfFaqCategoryFormFilter.class.php (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/lib/filter/doctrine/PluginsfFaqCategoryFormFilter.class.php 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,13 @@ +<?php + +/** + * PluginsfFaqCategory form. + * + * @package ##PROJECT_NAME## + * @subpackage filter + * @author ##AUTHOR_NAME## + * @version SVN: $Id: sfDoctrineFormFilterPluginTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $ + */ +abstract class PluginsfFaqCategoryFormFilter extends BasesfFaqCategoryFormFilter +{ +} Added: plugins/sfDoctrineFaqPlugin/trunk/lib/filter/doctrine/PluginsfFaqFaqFormFilter.class.php =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/lib/filter/doctrine/PluginsfFaqFaqFormFilter.class.php (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/lib/filter/doctrine/PluginsfFaqFaqFormFilter.class.php 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,13 @@ +<?php + +/** + * PluginsfFaqFaq form. + * + * @package ##PROJECT_NAME## + * @subpackage filter + * @author ##AUTHOR_NAME## + * @version SVN: $Id: sfDoctrineFormFilterPluginTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $ + */ +abstract class PluginsfFaqFaqFormFilter extends BasesfFaqFaqFormFilter +{ +} Added: plugins/sfDoctrineFaqPlugin/trunk/lib/form/doctrine/PluginsfFaqCategoryForm.class.php =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/lib/form/doctrine/PluginsfFaqCategoryForm.class.php (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/lib/form/doctrine/PluginsfFaqCategoryForm.class.php 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,22 @@ +<?php + +/** + * PluginsfFaqCategory form. + * + * @package sfDoctrineFaqPlugin + * @subpackage form + * @author Susan Lau <[email protected]> + * @version SVN: $Id: sfDoctrineFormPluginTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $ + */ +abstract class PluginsfFaqCategoryForm extends BasesfFaqCategoryForm +{ + public function setup() + { + parent::setup(); + + unset( + $this['created_at'], + $this['updated_at'] + ); + } +} Added: plugins/sfDoctrineFaqPlugin/trunk/lib/form/doctrine/PluginsfFaqFaqForm.class.php =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/lib/form/doctrine/PluginsfFaqFaqForm.class.php (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/lib/form/doctrine/PluginsfFaqFaqForm.class.php 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,22 @@ +<?php + +/** + * PluginsfFaqFaq form. + * + * @package sfDoctrineFaqPlugin + * @subpackage form + * @author Susan Lau <[email protected]> + * @version SVN: $Id: sfDoctrineFormPluginTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $ + */ +abstract class PluginsfFaqFaqForm extends BasesfFaqFaqForm +{ + public function setup() + { + parent::setup(); + + unset( + $this['created_at'], + $this['updated_at'] + ); + } +} Added: plugins/sfDoctrineFaqPlugin/trunk/lib/helper/sfFaqHelper.php =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/lib/helper/sfFaqHelper.php (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/lib/helper/sfFaqHelper.php 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,39 @@ +<?php + +function stripText($text) +{ + // rewrite critical characters + // French + $text = str_replace(array('À', 'Â', 'à', 'â'), 'a', $text); + $text = str_replace(array('É', 'È', 'Ê', 'Ë', 'é', 'è', 'ê', 'ë'), 'e', $text); + $text = str_replace(array('Î', 'Ï', 'î', 'ï'), 'i', $text); + $text = str_replace(array('Ô', 'ô'), 'o', $text); + $text = str_replace(array('Ù', 'Û', 'ù', 'û'), 'u', $text); + $text = str_replace(array('Ç', 'ç'), 'c', $text); + // German + $text = str_replace(array('Ä', 'ä'), 'ae', $text); + $text = str_replace(array('Ö', 'ö'), 'oe', $text); + $text = str_replace(array('Ü', 'ü'), 'ue', $text); + $text = str_replace('ß', 'ss', $text); + // Spanish + $text = str_replace(array('Ñ', 'ñ'), 'n', $text); + $text = str_replace(array('Á', 'á'), 'a', $text); + $text = str_replace(array('Í', 'í'), 'i', $text); + $text = str_replace(array('Ó', 'ó'), 'o', $text); + $text = str_replace(array('Ú', 'ú'), 'u', $text); + + // strip all non word chars + $text = preg_replace('/[^a-z0-9_-]/i', ' ', $text); + + // strtolower is not utf8-safe, therefore it can only be done after special characters replacement + $text = strtolower($text); + + // replace all white space sections with a dash + $text = preg_replace('/\ +/', '-', $text); + + // trim dashes + $text = preg_replace('/\-$/', '', $text); + $text = preg_replace('/^\-/', '', $text); + + return $text; +} Added: plugins/sfDoctrineFaqPlugin/trunk/lib/model/doctrine/PluginsfFaqCategory.class.php =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/lib/model/doctrine/PluginsfFaqCategory.class.php (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/lib/model/doctrine/PluginsfFaqCategory.class.php 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,30 @@ +<?php + +/** + * PluginsfFaqCategory + * + * This class has been auto-generated by the Doctrine ORM Framework + * + * @package sfDoctrineFaqPlugin + * @subpackage model + * @author Susan Lau <[email protected]> + * @version SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $ + */ +abstract class PluginsfFaqCategory extends BasesfFaqCategory +{ + public function __toString() + { + return $this->getName(); + } + + public function getsfFaqFaqs() + { + + return Doctrine::getTable('sfFaqFaq') + ->createQuery('a') + ->where('a.category_id = ?', $this->getId()) + ->orderBy('a.question asc') + ->execute(); + + } +} Added: plugins/sfDoctrineFaqPlugin/trunk/lib/model/doctrine/PluginsfFaqCategoryTable.class.php =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/lib/model/doctrine/PluginsfFaqCategoryTable.class.php (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/lib/model/doctrine/PluginsfFaqCategoryTable.class.php 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,44 @@ +<?php + +/** + * PluginsfFaqCategoryTable + * + * This class has been auto-generated by the Doctrine ORM Framework + */ +class PluginsfFaqCategoryTable extends Doctrine_Table +{ + /** + * Returns an instance of this class. + * + * @return object PluginsfFaqCategoryTable + */ + public static function getInstance() + { + return Doctrine_Core::getTable('PluginsfFaqCategory'); + } + + /* + * retrieves all items ordered by name + * + */ + public function retrieveAll() + { + return Doctrine::getTable('sfFaqCategory') + ->createQuery('a') + ->orderBy('a.name asc') + ->execute(); + } + + /* + * retrieves first item ordered by name + * + */ + public function retrieveFirst() + { + return Doctrine::getTable('sfFaqCategory') + ->createQuery('a') + ->orderBy('a.name asc') + ->fetchOne(); + } + +} Added: plugins/sfDoctrineFaqPlugin/trunk/lib/model/doctrine/PluginsfFaqFaq.class.php =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/lib/model/doctrine/PluginsfFaqFaq.class.php (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/lib/model/doctrine/PluginsfFaqFaq.class.php 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,16 @@ +<?php + +/** + * PluginsfFaqFaq + * + * This class has been auto-generated by the Doctrine ORM Framework + * + * @package ##PACKAGE## + * @subpackage ##SUBPACKAGE## + * @author ##NAME## <##EMAIL##> + * @version SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $ + */ +abstract class PluginsfFaqFaq extends BasesfFaqFaq +{ + +} \ No newline at end of file Added: plugins/sfDoctrineFaqPlugin/trunk/lib/model/doctrine/PluginsfFaqFaqTable.class.php =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/lib/model/doctrine/PluginsfFaqFaqTable.class.php (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/lib/model/doctrine/PluginsfFaqFaqTable.class.php 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,19 @@ +<?php + +/** + * PluginsfFaqFaqTable + * + * This class has been auto-generated by the Doctrine ORM Framework + */ +class PluginsfFaqFaqTable extends Doctrine_Table +{ + /** + * Returns an instance of this class. + * + * @return object PluginsfFaqFaqTable + */ + public static function getInstance() + { + return Doctrine_Core::getTable('PluginsfFaqFaq'); + } +} \ No newline at end of file Added: plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/actions/actions.class.php =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/actions/actions.class.php (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/actions/actions.class.php 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,17 @@ +<?php + +require_once dirname(__FILE__).'/../lib/BasesfFaqActions.class.php'; + +/** + * Faq module + * + * The front can be full JS nothing reload OR one click reload the page with a good URL for the referencement + * cf : README + * + * @package sfFaqPlugin + * @author Jonathan Démoutiez <[email protected]> + */ +class sfFaqActions extends BasesfFaqActions +{ + +} Added: plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/lib/BasesfFaqActions.class.php =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/lib/BasesfFaqActions.class.php (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/lib/BasesfFaqActions.class.php 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,86 @@ +<?php + +/** + * Faq module + * + * just simple listing + * + * @package sfDoctrineFaqPlugin + * @author Jonathan Démoutiez <[email protected]> + * @author Susan Lau <[email protected]> + */ +class BasesfFaqActions extends sfActions +{ + public function preExecute() + { + $this->initList(); + } + + public function executeIndex() + { + if ($this->hasRequestParameter('faq_slug')) + { + $this->selectedFaq = Doctrine::getTable('sfFaqFaq')->findOneBySlug($this->getRequestParameter('faq_slug')); + } + + if (!isset($this->selectedFaq) && !$this->selectedFaq) + { + if ($this->hasRequestParameter('category_slug')) + { + $this->selectedCategory = Doctrine::getTable('sfFaqCategory')->findOneBySlug($this->getRequestParameter('category_slug')); + $this->defaultQuestionSelection(); + } + else + { + $this->defaultSelection(); + } + } + else + { + $this->selectedCategory = $this->selectedFaq->getCategory(); + } + } + + + /** + * Private methods + * + * @author Jonathan Démoutiez + */ + private function initList() + { + $this->categoriesList = Doctrine::getTable('sfFaqCategory')->retrieveAll(); + } + + private function defaultSelection() + { + $this->defaultCategorySelection(); + $this->defaultQuestionSelection(); + } + + private function defaultCategorySelection() + { + $this->selectedCategory = NULL; + $this->selectedFaq = NULL; + + if (sfConfig::get('app_sf_doctrine_faq_plugin_first_category_by_default', false) && !isset($this->selectedCategory) && !$this->selectedCategory) + { + $this->selectedCategory = Doctrine::getTable('sfFaqCategory')->retrieveFirst(); + $this->defaultQuestionSelection(); + } + } + + private function defaultQuestionSelection() + { + $this->selectedFaq = NULL; + + if (sfConfig::get('app_sf_doctrine_faq_plugin_first_question_by_default', false) && $this->selectedCategory) + { + $selectedFaqs = $this->selectedCategory->getsfFaqFaqs(); + if (is_array($selectedFaqs)) + { + $this->selectedFaq = array_shift($selectedFaqs); + } + } + } +} Added: plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/templates/_footer.php =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/templates/_footer.php (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/templates/_footer.php 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1 @@ +</div> \ No newline at end of file Added: plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/templates/_header.php =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/templates/_header.php (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/templates/_header.php 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,4 @@ +<?php use_helper('I18N', 'sfFaq') ?> + +<div class="sf_faq"> + <p class="title"><?php echo __(sfConfig::get('app_sfFaqPlugin_title', 'FAQ') ) ?></p> Added: plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/templates/indexSuccess.php =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/templates/indexSuccess.php (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaq/templates/indexSuccess.php 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,35 @@ + + <div id="tabs_sf_faq_categories"> + <?php foreach ($categoriesList as $key => $category): ?> + <?php $class = ($selectedCategory && $selectedCategory->getId() == $category->getId()) ? 'active' : 'inactive'; ?> + <a href="<?php echo url_for('@sf_faq_category?category_slug=' . $category->getSlug()); ?>" class="<?php echo $class; ?>"><?php echo $category->getName(); ?></a> | + <?php endforeach ?> + </div> + + <div class="question_separator"><hr /></div> + + +<?php if ($selectedCategory): ?> + + <?php foreach ($selectedCategory->getsfFaqFaqs() as $key => $faq): ?> + <?php if ($selectedFaq && $selectedFaq->getId() == $faq->getId()): ?> + <div id="answer"> + <p class="question-on"> + - <?php echo $faq->getQuestion() ?> + </p> + <p class="answer"> + <?php echo $faq->getAnswer() ?> + </p> + </div> + <?php else: ?> + <div class="question"> + + <a href="<?php echo url_for('@sf_faq_question?category_slug=' . $faq->getCategory()->getSlug().'&faq_slug=' . $faq->getSlug()); ?>"><?php echo $faq->getQuestion(); ?></a> + </div> + <?php endif ?> + + <div class="question_separator"><hr /></div> + + <?php endforeach ?> + +<?php endif ?> + Added: plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqAdmin/actions/actions.class.php =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqAdmin/actions/actions.class.php (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqAdmin/actions/actions.class.php 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,16 @@ +<?php + +require_once dirname(__FILE__).'/../lib/sfFaqAdminGeneratorConfiguration.class.php'; +require_once dirname(__FILE__).'/../lib/sfFaqAdminGeneratorHelper.class.php'; + +/** + * sfFaqAdmin actions. + * + * @package plain + * @subpackage sfFaqAdmin + * @author Your name here + * @version SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $ + */ +class sfFaqAdminActions extends autoSfFaqAdminActions +{ +} Added: plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqAdmin/config/generator.yml =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqAdmin/config/generator.yml (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqAdmin/config/generator.yml 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,21 @@ +generator: + class: sfDoctrineGenerator + param: + model_class: sfFaqFaq + theme: admin + non_verbose_templates: true + with_show: false + singular: ~ + plural: ~ + route_prefix: sf_faq_faq + with_doctrine_route: true + actions_base_class: sfActions + + config: + actions: ~ + fields: ~ + list: ~ + filter: ~ + form: ~ + edit: ~ + new: ~ Added: plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqAdmin/lib/sfFaqAdminGeneratorConfiguration.class.php =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqAdmin/lib/sfFaqAdminGeneratorConfiguration.class.php (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqAdmin/lib/sfFaqAdminGeneratorConfiguration.class.php 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,13 @@ +<?php + +/** + * sfFaqAdmin module configuration. + * + * @package plain + * @subpackage sfFaqAdmin + * @author Your name here + * @version SVN: $Id: configuration.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $ + */ +class sfFaqAdminGeneratorConfiguration extends BaseSfFaqAdminGeneratorConfiguration +{ +} Added: plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqAdmin/lib/sfFaqAdminGeneratorHelper.class.php =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqAdmin/lib/sfFaqAdminGeneratorHelper.class.php (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqAdmin/lib/sfFaqAdminGeneratorHelper.class.php 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,13 @@ +<?php + +/** + * sfFaqAdmin module helper. + * + * @package plain + * @subpackage sfFaqAdmin + * @author Your name here + * @version SVN: $Id: helper.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $ + */ +class sfFaqAdminGeneratorHelper extends BaseSfFaqAdminGeneratorHelper +{ +} Added: plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqCategoryAdmin/actions/actions.class.php =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqCategoryAdmin/actions/actions.class.php (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqCategoryAdmin/actions/actions.class.php 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,16 @@ +<?php + +require_once dirname(__FILE__).'/../lib/sfFaqCategoryAdminGeneratorConfiguration.class.php'; +require_once dirname(__FILE__).'/../lib/sfFaqCategoryAdminGeneratorHelper.class.php'; + +/** + * sfFaqCategoryAdmin actions. + * + * @package plain + * @subpackage sfFaqCategoryAdmin + * @author Your name here + * @version SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $ + */ +class sfFaqCategoryAdminActions extends autoSfFaqCategoryAdminActions +{ +} Added: plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqCategoryAdmin/config/generator.yml =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqCategoryAdmin/config/generator.yml (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqCategoryAdmin/config/generator.yml 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,21 @@ +generator: + class: sfDoctrineGenerator + param: + model_class: sfFaqCategory + theme: admin + non_verbose_templates: true + with_show: false + singular: ~ + plural: ~ + route_prefix: sf_faq_category + with_doctrine_route: true + actions_base_class: sfActions + + config: + actions: ~ + fields: ~ + list: ~ + filter: ~ + form: ~ + edit: ~ + new: ~ Added: plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqCategoryAdmin/lib/sfFaqCategoryAdminGeneratorConfiguration.class.php =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqCategoryAdmin/lib/sfFaqCategoryAdminGeneratorConfiguration.class.php (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqCategoryAdmin/lib/sfFaqCategoryAdminGeneratorConfiguration.class.php 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,13 @@ +<?php + +/** + * sfFaqCategoryAdmin module configuration. + * + * @package plain + * @subpackage sfFaqCategoryAdmin + * @author Your name here + * @version SVN: $Id: configuration.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $ + */ +class sfFaqCategoryAdminGeneratorConfiguration extends BaseSfFaqCategoryAdminGeneratorConfiguration +{ +} Added: plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqCategoryAdmin/lib/sfFaqCategoryAdminGeneratorHelper.class.php =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqCategoryAdmin/lib/sfFaqCategoryAdminGeneratorHelper.class.php (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/modules/sfFaqCategoryAdmin/lib/sfFaqCategoryAdminGeneratorHelper.class.php 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,13 @@ +<?php + +/** + * sfFaqCategoryAdmin module helper. + * + * @package plain + * @subpackage sfFaqCategoryAdmin + * @author Your name here + * @version SVN: $Id: helper.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $ + */ +class sfFaqCategoryAdminGeneratorHelper extends BaseSfFaqCategoryAdminGeneratorHelper +{ +} Added: plugins/sfDoctrineFaqPlugin/trunk/web/css/sf_faq.css =================================================================== --- plugins/sfDoctrineFaqPlugin/trunk/web/css/sf_faq.css (rev 0) +++ plugins/sfDoctrineFaqPlugin/trunk/web/css/sf_faq.css 2010-09-19 21:09:07 UTC (rev 30929) @@ -0,0 +1,27 @@ +.sf_faq A{ color: blue; } + +.sf_faq .title{ font-size: 28px; text-align: center; } + +.sf_faq #tabs_sf_faq_categories{ font-size: 30px; } + +.sf_faq #tabs_sf_faq_categories .tabs_sf_faq_category-on{ font-weight: bold; } + +.sf_faq .answer { + float: left; + padding-left: 30px; + margin: 10px 0 10px 10px; + background:url(/sfFaqPlugin/images/sf_faq_answer.gif) repeat-y 20px 0px; +} + + +.sf_faq #answer p.question-on{ + color: blue; + font-weight:bold; + padding: 0 25px 0px 25px; +} + +.sf_faq .question_separator { clear: both; margin: 10px 0 10px 0; } + + + +.sf_faq_admin A { color: blue; font-size: 30px; } \ No newline at end of file Added: plugins/sfDoctrineFaqPlugin/trunk/web/images/sf_faq_answer.gif =================================================================== (Binary files differ) Property changes on: plugins/sfDoctrineFaqPlugin/trunk/web/images/sf_faq_answer.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream -- You received this message because you are subscribed to the Google Groups "symfony SVN" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/symfony-svn?hl=en.
