From fb43129fa085d1ed9e60bc07aee90b405a60c09f Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Tue, 22 May 2012 08:25:41 +0200 Subject: [PATCH] Working on the userfront application. Layout, javascript to update chosen categories. --- apps/companyfront/templates/layout.php | 9 +- apps/companyfront/templates/layoutsfGuardAuth.php | 4 +- apps/userfront/config/app.yml | 18 +++ apps/userfront/config/cache.yml | 7 ++ apps/userfront/config/factories.yml | 49 ++++++++ apps/userfront/config/filters.yml | 12 ++ apps/userfront/config/routing.yml | 61 ++++++++++ apps/userfront/config/security.yml | 6 + apps/userfront/config/settings.yml | 44 ++++++++ .../config/userfrontConfiguration.class.php | 8 ++ apps/userfront/config/view.yml | 20 ++++ apps/userfront/lib/myUser.class.php | 6 + .../modules/api/actions/actions.class.php | 106 ++++++++++++++++++ apps/userfront/modules/api/config/security.yml | 7 ++ .../api/templates/getadsbygpsSuccess.json.php | 5 + .../modules/api/templates/indexSuccess.php | 0 .../api/templates/loginauthSuccess.json.php | 0 .../api/templates/logoutauthSuccess.json.php | 0 .../modules/api/templates/signinSuccess.php | 5 + .../modules/category/actions/actions.class.php | 80 ++++++++++++++ .../userfront/modules/category/templates/_form.php | 67 +++++++++++ .../modules/category/templates/editSuccess.php | 3 + .../modules/category/templates/indexSuccess.php | 54 +++++++++ .../modules/category/templates/newSuccess.php | 3 + .../modules/category/templates/showSuccess.php | 38 +++++++ apps/userfront/modules/sfGuardAuth/config/view.yml | 20 ++++ .../modules/sfGuardAuth/templates/_signin_form.php | 25 +++++ apps/userfront/templates/layout.php | 123 +++++++++++++++++++++ apps/userfront/templates/layoutsfGuardAuth.php | 25 +++++ lib/model/doctrine/GeneralCategoryTable.class.php | 13 ++- test/functional/userfront/categoryActionsTest.php | 19 ++++ web/userfront.php | 7 ++ web/userfront_dev.php | 13 +++ 33 files changed, 853 insertions(+), 4 deletions(-) create mode 100644 apps/userfront/config/app.yml create mode 100644 apps/userfront/config/cache.yml create mode 100644 apps/userfront/config/factories.yml create mode 100644 apps/userfront/config/filters.yml create mode 100644 apps/userfront/config/routing.yml create mode 100644 apps/userfront/config/security.yml create mode 100644 apps/userfront/config/settings.yml create mode 100644 apps/userfront/config/userfrontConfiguration.class.php create mode 100644 apps/userfront/config/view.yml create mode 100644 apps/userfront/lib/myUser.class.php create mode 100644 apps/userfront/modules/api/actions/actions.class.php create mode 100644 apps/userfront/modules/api/config/security.yml create mode 100644 apps/userfront/modules/api/templates/getadsbygpsSuccess.json.php create mode 100644 apps/userfront/modules/api/templates/indexSuccess.php create mode 100644 apps/userfront/modules/api/templates/loginauthSuccess.json.php create mode 100644 apps/userfront/modules/api/templates/logoutauthSuccess.json.php create mode 100644 apps/userfront/modules/api/templates/signinSuccess.php create mode 100644 apps/userfront/modules/category/actions/actions.class.php create mode 100644 apps/userfront/modules/category/templates/_form.php create mode 100644 apps/userfront/modules/category/templates/editSuccess.php create mode 100644 apps/userfront/modules/category/templates/indexSuccess.php create mode 100644 apps/userfront/modules/category/templates/newSuccess.php create mode 100644 apps/userfront/modules/category/templates/showSuccess.php create mode 100644 apps/userfront/modules/sfGuardAuth/config/view.yml create mode 100644 apps/userfront/modules/sfGuardAuth/templates/_signin_form.php create mode 100644 apps/userfront/templates/layout.php create mode 100644 apps/userfront/templates/layoutsfGuardAuth.php create mode 100644 test/functional/userfront/categoryActionsTest.php create mode 100644 web/userfront.php create mode 100644 web/userfront_dev.php diff --git a/apps/companyfront/templates/layout.php b/apps/companyfront/templates/layout.php index 286dfe5..f62cac1 100644 --- a/apps/companyfront/templates/layout.php +++ b/apps/companyfront/templates/layout.php @@ -90,8 +90,15 @@
  • + + - + diff --git a/apps/companyfront/templates/layoutsfGuardAuth.php b/apps/companyfront/templates/layoutsfGuardAuth.php index 5b89487..296f96c 100644 --- a/apps/companyfront/templates/layoutsfGuardAuth.php +++ b/apps/companyfront/templates/layoutsfGuardAuth.php @@ -4,7 +4,7 @@ - Mobi - Mobile Ads + <?php echo __('Mobi - Mobile Ads') ?> @@ -16,7 +16,7 @@ diff --git a/apps/userfront/config/app.yml b/apps/userfront/config/app.yml new file mode 100644 index 0000000..e5ccf79 --- /dev/null +++ b/apps/userfront/config/app.yml @@ -0,0 +1,18 @@ +# You can find more information about this file on the symfony website: +# http://www.symfony-project.org/reference/1_4/en/11-App + +# default values +all: + default_language: eng # Everything must exist at least with this language + # Using meters for the radius parameter in PostGIS + radius: 100 + + sf_guard_plugin: + remember_key_expiration_age: 2592000 # 30 days in seconds + remember_cookie_name: mobiuserRemember # used by sfGuardSecurityUser.class.php + success_signin_url: @homepage # the plugin uses the referer as default + success_signout_url: @sf_guard_signin # used by BasesfGuardAuthActions.class.php. After logout we are redirected to this page + signin_url_path: login # used by sfGuardRememberMeFilter.class.php. The Remember cookie must not be used when using the login page + remember_cookie_path: /userfront.php # used by sfGuardSecurityUser.class.php. The scope of the Remeber cookie + remember_cookie_domain: .localhost + diff --git a/apps/userfront/config/cache.yml b/apps/userfront/config/cache.yml new file mode 100644 index 0000000..4eecbf7 --- /dev/null +++ b/apps/userfront/config/cache.yml @@ -0,0 +1,7 @@ +# You can find more information about this file on the symfony website: +# http://www.symfony-project.org/reference/1_4/en/09-Cache + +default: + enabled: false + with_layout: false + lifetime: 86400 diff --git a/apps/userfront/config/factories.yml b/apps/userfront/config/factories.yml new file mode 100644 index 0000000..dda50c6 --- /dev/null +++ b/apps/userfront/config/factories.yml @@ -0,0 +1,49 @@ +# You can find more information about this file on the symfony website: +# http://www.symfony-project.org/reference/1_4/en/05-Factories + +prod: + logger: + class: sfNoLogger + param: + level: err + loggers: ~ + + storage: + class: sfSessionStorage + param: + session_name: mobiuser + session_cookie_path: /userfront.php + session_cookie_lifetime: 0 # The cookie will be deleted in the browser when it is closed + +test: + storage: + class: sfSessionTestStorage + param: + session_path: %SF_TEST_CACHE_DIR%/sessions + + response: + class: sfWebResponse + param: + send_http_headers: false + + mailer: + param: + delivery_strategy: none + +dev: + mailer: + param: + delivery_strategy: none + +all: + routing: + class: sfPatternRouting + param: + generate_shortest_url: true + extra_parameters_as_query_string: true + + view_cache_manager: + class: sfViewCacheManager + param: + cache_key_use_vary_headers: true + cache_key_use_host_name: true diff --git a/apps/userfront/config/filters.yml b/apps/userfront/config/filters.yml new file mode 100644 index 0000000..cc999d0 --- /dev/null +++ b/apps/userfront/config/filters.yml @@ -0,0 +1,12 @@ +# You can find more information about this file on the symfony website: +# http://www.symfony-project.org/reference/1_4/en/12-Filters + +rendering: ~ +remember_me: + class: sfGuardRememberMeFilter +security: ~ + +# insert your own filters here + +cache: ~ +execution: ~ diff --git a/apps/userfront/config/routing.yml b/apps/userfront/config/routing.yml new file mode 100644 index 0000000..9e69288 --- /dev/null +++ b/apps/userfront/config/routing.yml @@ -0,0 +1,61 @@ +# You can find more information about this file on the symfony website: +# http://www.symfony-project.org/reference/1_4/en/10-Routing + +# default rules +homepage: + url: / + class: sfDoctrineRoute + param: { module: category, action: index } + options: { model: GeneralCategory, type: object } + +categories_index: + url: /category/index + class: sfDoctrineRoute + param: { module: category, action: index } + options: { model: GeneralCategory, type: object } + + +# http://localhost/userfront.php/api/51,32/0,5/gpsads.xml latitude/longitude +api_getadsbygps: + url: /api/:latitude/:longitude/gpsads.:sf_format +# class: sfDoctrineRoute + class: sfRequestRoute + param: { module: api, action: getadsbygps } +# options: { model: Anuncio, type: list, method: getAdsByGPS } I can not use this one because I can not pass the userId to this method in AnuncioTable. + requirements: + sf_format: (?:json) + #sf_format: (?:xml|json|yaml) + sf_method: [GET] + +api_loginauth: + url: /api/login/auth.:sf_format + class: sfRequestRoute + param: { module: api, action: loginauth } + requirements: + sf_format: (?:json) + sf_method: [POST] + +api_logoutauth: + url: /api/logout/auth.:sf_format + class: sfRequestRoute + param: { module: api, action: logoutauth } + requirements: + sf_format: (?:json) + sf_method: [GET] + +# generic rules +# please, remove them by adding more specific rules +default_index: + url: /:module + param: { action: index } + +default: + url: /:module/:action/* + +sf_guard_signin: + url: /login + param: { module: sfGuardAuth, action: signin } + +sf_guard_signout: + url: /logout + param: { module: sfGuardAuth, action: signout } diff --git a/apps/userfront/config/security.yml b/apps/userfront/config/security.yml new file mode 100644 index 0000000..3b12e8d --- /dev/null +++ b/apps/userfront/config/security.yml @@ -0,0 +1,6 @@ +# You can find more information about this file on the symfony website: +# http://www.symfony-project.org/reference/1_4/en/08-Security + +default: + is_secure: true + credentials: users diff --git a/apps/userfront/config/settings.yml b/apps/userfront/config/settings.yml new file mode 100644 index 0000000..57a00ba --- /dev/null +++ b/apps/userfront/config/settings.yml @@ -0,0 +1,44 @@ +# You can find more information about this file on the symfony website: +# http://www.symfony-project.org/reference/1_4/en/04-Settings + +prod: + .settings: + no_script_name: false + logging_enabled: false + +dev: + .settings: + error_reporting: + web_debug: true + cache: false + no_script_name: false + etag: false + +test: + .settings: + error_reporting: + cache: false + web_debug: false + no_script_name: false + etag: false + +all: + .settings: + # Form security secret (CSRF protection) + csrf_secret: ca31cbfa36656b0e00f28967e0960b6ba8b993fe + enabled_modules: [default, sfGuardAuth] + standard_helpers: [Partial, Cache, I18N] + + # Output escaping settings + escaping_strategy: true + escaping_method: ESC_SPECIALCHARS + + # Enable the database manager + use_database: true + + .actions: + login_module: sfGuardAuth + login_action: signin + + secure_module: sfGuardAuth + secure_action: secure diff --git a/apps/userfront/config/userfrontConfiguration.class.php b/apps/userfront/config/userfrontConfiguration.class.php new file mode 100644 index 0000000..4b9f817 --- /dev/null +++ b/apps/userfront/config/userfrontConfiguration.class.php @@ -0,0 +1,8 @@ +forward('default', 'module'); + } + + /** + * RESTful Web Service: receiving latitude and longitude, it sends a response with the found ads on thoses coordinates. + * + * We will try to reduce as much as we can the number of methods and queries. While the tables in the data base do not have many rows + * we will try to make the queries directly in the data base. When the tables get bigger than now probably we are going to need + * a solution based on queries to data base and php code. Right now and with this size, the fastest solution (IMHO) is to make the queries + * directly on the data base. + * + * TODO: Take measures about the performance using queries directly to the data base and using Doctrine Objects with PHP + * Choose this or the other one solution. I got no time to make this profiling before. But to be serious I should do it. + * Now I am using queries directly to the data base because I am making the supposition that this is the best to achieve high performance. + * + * TODO: C-programmed dedicated server to make this stuff without using PHP should be the best to achieve the max performance. + * + * @param sfRequest $request A request object + */ + public function executeGetadsbygps(sfWebRequest $request) + { + //With RESTFUL is allowed to use cookies to get authentication (user / password) + $this->ads = AdTable::getInstance()->getAdsByGPSandUserId($this->getRoute()->getParameters(), $this->getUser()->getGuardUser()->getId()); + if (!$this->ads) + { + //If there are not results. + //In production replace this line by a die command (trying to stop wasting TCP bandwidth) + throw new sfError404Exception(sprintf(' + There are not offices with GPS coordinates: longitude "%s" and + latitude "%s".', $request->getParameter('longitude'), $request->getParameter('latitude'))); + //die; + } + } + + /** + * RESTful Web Service: authentication by username/email and password. + * + * This service checks the username and password. It must response with OK or NOK and the user's cookie + * See in this module the config/security.yml file. This action must not be executed under security conditions + * + * @param sfRequest $request A request object + */ + public function executeLoginauth(sfWebRequest $request) + { + //If everything goes alright the mobile will receive HTTP 200 OK, otherwise HTTP 401 Unauthorized or 400 Bad Request + $this->getResponse()->setStatusCode(401); + + if ($this->getUser()->isAuthenticated()) + { + //If the mobile is authenticated, why the heck it is reaching this code? It must log in just once, when launching the application + $this->getResponse()->setStatusCode(400); + } + else + { + $form = new WebServiceSigninForm(); + //TODO: JSON instead of signin array as container to send the data from the mobile to this Web Service (I have no time right now...) + $form->bind($request->getParameter('signin')); + if ($form->isValid()) + { + $values = $form->getValues(); + $this->getUser()->signin($values['user'], array_key_exists('remember', $values) ? $values['remember'] : false); + $this->getResponse()->setStatusCode(200); + } + } + + //Returning from this function with the StatusCode with its right value + + } + + /** + * RESTful Web Service: log out from the web application + * + * This service checks the cookie sent by the user. If the user is authenticated it removes his/her permissions. + * See in this module the config/security.yml file. This action must not be executed under security conditions + * + * @param sfRequest $request A request object + */ + public function executeLogoutauth($request) + { + //If everything goes alright the mobile will receive HTTP 200 OK, otherwise HTTP 500 Internal Server Error + $this->getResponse()->setStatusCode(500); + + $this->getUser()->signOut(); + + $this->getResponse()->setStatusCode(200); + } +} diff --git a/apps/userfront/modules/api/config/security.yml b/apps/userfront/modules/api/config/security.yml new file mode 100644 index 0000000..b63a388 --- /dev/null +++ b/apps/userfront/modules/api/config/security.yml @@ -0,0 +1,7 @@ + + +loginauth: + is_secure: false + +logoutauth: + is_secure: false diff --git a/apps/userfront/modules/api/templates/getadsbygpsSuccess.json.php b/apps/userfront/modules/api/templates/getadsbygpsSuccess.json.php new file mode 100644 index 0000000..b951d93 --- /dev/null +++ b/apps/userfront/modules/api/templates/getadsbygpsSuccess.json.php @@ -0,0 +1,5 @@ +[ + + { "id" : "getId()?>", "domain" : "getDomain()?>", "link" : "getLinks()?>" }, + +] diff --git a/apps/userfront/modules/api/templates/indexSuccess.php b/apps/userfront/modules/api/templates/indexSuccess.php new file mode 100644 index 0000000..e69de29 diff --git a/apps/userfront/modules/api/templates/loginauthSuccess.json.php b/apps/userfront/modules/api/templates/loginauthSuccess.json.php new file mode 100644 index 0000000..e69de29 diff --git a/apps/userfront/modules/api/templates/logoutauthSuccess.json.php b/apps/userfront/modules/api/templates/logoutauthSuccess.json.php new file mode 100644 index 0000000..e69de29 diff --git a/apps/userfront/modules/api/templates/signinSuccess.php b/apps/userfront/modules/api/templates/signinSuccess.php new file mode 100644 index 0000000..54d0b25 --- /dev/null +++ b/apps/userfront/modules/api/templates/signinSuccess.php @@ -0,0 +1,5 @@ + + +

    + + $form)) ?> diff --git a/apps/userfront/modules/category/actions/actions.class.php b/apps/userfront/modules/category/actions/actions.class.php new file mode 100644 index 0000000..aedc677 --- /dev/null +++ b/apps/userfront/modules/category/actions/actions.class.php @@ -0,0 +1,80 @@ +userId = $this->getUser()->getGuardUser()->getId(); + + //Doctrine Query used to show a list with the General Categories (execute returns a Doctrine Collection of Doctrine Records) + $this->generalCategories = $query=GeneralCategoryTable::getInstance()->getGeneralCategoriesByLftQuery()->execute(); + } + + public function executeShow(sfWebRequest $request) + { + $this->general_category = Doctrine_Core::getTable('GeneralCategory')->find(array($request->getParameter('id'))); + $this->forward404Unless($this->general_category); + } + + public function executeNew(sfWebRequest $request) + { + $this->form = new GeneralCategoryForm(); + } + + public function executeCreate(sfWebRequest $request) + { + $this->forward404Unless($request->isMethod(sfRequest::POST)); + + $this->form = new GeneralCategoryForm(); + + $this->processForm($request, $this->form); + + $this->setTemplate('new'); + } + + public function executeEdit(sfWebRequest $request) + { + $this->forward404Unless($general_category = Doctrine_Core::getTable('GeneralCategory')->find(array($request->getParameter('id'))), sprintf('Object general_category does not exist (%s).', $request->getParameter('id'))); + $this->form = new GeneralCategoryForm($general_category); + } + + public function executeUpdate(sfWebRequest $request) + { + $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT)); + $this->forward404Unless($general_category = Doctrine_Core::getTable('GeneralCategory')->find(array($request->getParameter('id'))), sprintf('Object general_category does not exist (%s).', $request->getParameter('id'))); + $this->form = new GeneralCategoryForm($general_category); + + $this->processForm($request, $this->form); + + $this->setTemplate('edit'); + } + + public function executeDelete(sfWebRequest $request) + { + $request->checkCSRFProtection(); + + $this->forward404Unless($general_category = Doctrine_Core::getTable('GeneralCategory')->find(array($request->getParameter('id'))), sprintf('Object general_category does not exist (%s).', $request->getParameter('id'))); + $general_category->delete(); + + $this->redirect('category/index'); + } + + protected function processForm(sfWebRequest $request, sfForm $form) + { + $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName())); + if ($form->isValid()) + { + $general_category = $form->save(); + + $this->redirect('category/edit?id='.$general_category->getId()); + } + } +} diff --git a/apps/userfront/modules/category/templates/_form.php b/apps/userfront/modules/category/templates/_form.php new file mode 100644 index 0000000..2c0b213 --- /dev/null +++ b/apps/userfront/modules/category/templates/_form.php @@ -0,0 +1,67 @@ + + + +
    isMultipart() and print 'enctype="multipart/form-data" ' ?>> +getObject()->isNew()): ?> + + + + + + + + + + renderGlobalErrors() ?> + + + + + + + + + + + + + + + + + + + + + + + + + +
    + renderHiddenFields(false) ?> +  Back to list + getObject()->isNew()): ?> +  getObject()->getId(), array('method' => 'delete', 'confirm' => 'Are you sure?')) ?> + + +
    renderLabel() ?> + renderError() ?> + +
    renderLabel() ?> + renderError() ?> + +
    renderLabel() ?> + renderError() ?> + +
    renderLabel() ?> + renderError() ?> + +
    renderLabel() ?> + renderError() ?> + +
    renderLabel() ?> + renderError() ?> + +
    +
    diff --git a/apps/userfront/modules/category/templates/editSuccess.php b/apps/userfront/modules/category/templates/editSuccess.php new file mode 100644 index 0000000..375523c --- /dev/null +++ b/apps/userfront/modules/category/templates/editSuccess.php @@ -0,0 +1,3 @@ +

    Edit General category

    + + $form)) ?> diff --git a/apps/userfront/modules/category/templates/indexSuccess.php b/apps/userfront/modules/category/templates/indexSuccess.php new file mode 100644 index 0000000..7475768 --- /dev/null +++ b/apps/userfront/modules/category/templates/indexSuccess.php @@ -0,0 +1,54 @@ +

    + + + + + + + + + + + + + + + + + + getNode(); + if ($node->isValidNode() && $node->hasParent() && ($node->getParent()->getId() != '1')) + { + echo 'class="child-of-node-'.$node->getParent()->getId().'"'; + } + ?>> + + + + + +
    getUserBaskets() as $userBasket): ?> + getUserId() == $userId): ?> + checked + + + + >
    + + diff --git a/apps/userfront/modules/category/templates/newSuccess.php b/apps/userfront/modules/category/templates/newSuccess.php new file mode 100644 index 0000000..236934d --- /dev/null +++ b/apps/userfront/modules/category/templates/newSuccess.php @@ -0,0 +1,3 @@ +

    New General category

    + + $form)) ?> diff --git a/apps/userfront/modules/category/templates/showSuccess.php b/apps/userfront/modules/category/templates/showSuccess.php new file mode 100644 index 0000000..a68d8a1 --- /dev/null +++ b/apps/userfront/modules/category/templates/showSuccess.php @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Id:getId() ?>
    Created at:getCreatedAt() ?>
    Updated at:getUpdatedAt() ?>
    Root:getRootId() ?>
    Lft:getLft() ?>
    Rgt:getRgt() ?>
    Level:getLevel() ?>
    + +
    + +Edit +  +List diff --git a/apps/userfront/modules/sfGuardAuth/config/view.yml b/apps/userfront/modules/sfGuardAuth/config/view.yml new file mode 100644 index 0000000..4084c6e --- /dev/null +++ b/apps/userfront/modules/sfGuardAuth/config/view.yml @@ -0,0 +1,20 @@ +# You can find more information about this file on the symfony website: +# http://www.symfony-project.org/reference/1_4/en/13-View + +default: + http_metas: + content-type: text/html + + metas: + #title: symfony project + #description: symfony project + #keywords: symfony, project + #language: en + #robots: index, follow + + stylesheets: [inadminpanel/style.css, inadminpanel/niceforms-default.css] + + javascripts: [jquery-1.6.2.min.js, inadminpanel/ddaccordion.js] + + has_layout: true + layout: layoutsfGuardAuth diff --git a/apps/userfront/modules/sfGuardAuth/templates/_signin_form.php b/apps/userfront/modules/sfGuardAuth/templates/_signin_form.php new file mode 100644 index 0000000..924a8c7 --- /dev/null +++ b/apps/userfront/modules/sfGuardAuth/templates/_signin_form.php @@ -0,0 +1,25 @@ + + +
    + + + + + + + + + +
    + + + getRouting()->getRoutes() ?> + + + + + +   + +
    +
    diff --git a/apps/userfront/templates/layout.php b/apps/userfront/templates/layout.php new file mode 100644 index 0000000..f62cac1 --- /dev/null +++ b/apps/userfront/templates/layout.php @@ -0,0 +1,123 @@ + + + + + + + <?php echo __('Mobi - Mobile Ads') ?> + + + + + + + +
    +
    + +
    getGuardUser()->getFirstName() ?> |
    +
    +
    + +
    +
    + +
    + + + + + + + + + + + + +
    +
    + +
    + + + +
    +
    +
    +
    + + +
    + + diff --git a/apps/userfront/templates/layoutsfGuardAuth.php b/apps/userfront/templates/layoutsfGuardAuth.php new file mode 100644 index 0000000..e3d5827 --- /dev/null +++ b/apps/userfront/templates/layoutsfGuardAuth.php @@ -0,0 +1,25 @@ + + + + + + + <?php echo __('Mobi - Mobile Ads') ?> + Mobi - Mobile Ads + + + +
    + + + +
    + + diff --git a/lib/model/doctrine/GeneralCategoryTable.class.php b/lib/model/doctrine/GeneralCategoryTable.class.php index b5722a4..864b0ae 100644 --- a/lib/model/doctrine/GeneralCategoryTable.class.php +++ b/lib/model/doctrine/GeneralCategoryTable.class.php @@ -16,4 +16,15 @@ class GeneralCategoryTable extends Doctrine_Table { return Doctrine_Core::getTable('GeneralCategory'); } -} \ No newline at end of file + + + /** + * Returns general categories, ordered by lft field. + * + * @return Doctrine Query + */ + public function getGeneralCategoriesByLftQuery() + { + return $this->createQuery('gc')->orderBy('gc.lft'); + } +} diff --git a/test/functional/userfront/categoryActionsTest.php b/test/functional/userfront/categoryActionsTest.php new file mode 100644 index 0000000..3372571 --- /dev/null +++ b/test/functional/userfront/categoryActionsTest.php @@ -0,0 +1,19 @@ + + get('/category/index')-> + + with('request')->begin()-> + isParameter('module', 'category')-> + isParameter('action', 'index')-> + end()-> + + with('response')->begin()-> + isStatusCode(200)-> + checkElement('body', '!/This is a temporary page/')-> + end() +; diff --git a/web/userfront.php b/web/userfront.php new file mode 100644 index 0000000..a653d46 --- /dev/null +++ b/web/userfront.php @@ -0,0 +1,7 @@ +dispatch(); diff --git a/web/userfront_dev.php b/web/userfront_dev.php new file mode 100644 index 0000000..12c3339 --- /dev/null +++ b/web/userfront_dev.php @@ -0,0 +1,13 @@ +dispatch(); -- 2.1.4