Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
add complete categories implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
romelgomez committed Sep 22, 2014
1 parent 5c0ec29 commit 93be998
Show file tree
Hide file tree
Showing 183 changed files with 33,732 additions and 150 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
.project

# IntelliJ IDE files.
jqtreecakephpexample.iml
.idea

# CakePHP
php/app/Config/database.php
php/app/tmp
53 changes: 5 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,7 @@
CakePHP on OpenShift
====================
## Jqtree CakePHP Example

This git repository helps you get up and running quickly w/ a CakePHP installation
on OpenShift. The backend database is MySQL and the database name is the
same as your application name (using $_ENV['OPENSHIFT_APP_NAME']). You can call
your application by whatever name you want (the name of the database will always
match the application).
DEMO: jqtreecakephpexample-theteacher.rhcloud.com


Running on OpenShift
----------------------------

Create an account at https://www.openshift.com/

Create a php application with mysql (you can call your application whatever you want)

rhc app create cake php-5.3 mysql-5.1

Add this upstream CakePHP repo

cd cake
git remote add upstream -m master git://github.com/openshift/cakephp-example.git
git pull -s recursive -X theirs upstream master
# note that the git pull above can be used later to pull updates to CakePHP

Then push the repo upstream

git push

That's it, you can now checkout your application at (default admin account is admin/admin):

http://cake-$yournamespace.rhcloud.com


NOTES:

GIT_ROOT/.openshift/action_hooks/deploy:
This script is executed with every 'git push'. Feel free to modify this script
to learn how to use it to your advantage. By default, this script will create
the database tables that this example uses.

If you need to modify the schema, you could create a file
GIT_ROOT/.openshift/action_hooks/alter.sql and then use
GIT_ROOT/.openshift/action_hooks/deploy to execute that script (make sure to
back up your application + database w/ 'rhc app snapshot save'first :) )

CakePHP Security:
If you're doing more than just 'playing' be sure to edit app/config/core.php
and modify Security.salt and Security.cipherSeed.
CakePHP files are in /php, the rest are of openshift.

Example database file is in: /php/db/categories.sql
49 changes: 7 additions & 42 deletions php/app/Config/routes.php
Original file line number Diff line number Diff line change
@@ -1,45 +1,10 @@
<?php
/**
* Routes configuration
*
* In this file, you set up routes to your controllers and their actions.
* Routes are very important mechanism that allows you to freely connect
* different URLs to chosen controllers and their actions (functions).
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package app.Config
* @since CakePHP(tm) v 0.2.9
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
/**
* Here, we are connecting '/' (base path) to controller called 'Pages',
* its action called 'display', and we pass a param to select the view file
* to use (in this case, /app/View/Pages/home.ctp)...
*/
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/**
* ...and connect the rest of 'Pages' controller's URLs.
*/
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));

/**
* Load all plugin routes. See the CakePlugin documentation on
* how to customize the loading of plugin routes.
*/
CakePlugin::routes();
/* Sort alphabetically by the name of the controller. That is what is repeated. */

/**
* Load the CakePHP default routes. Only remove this if you do not want to use
* the built-in default routes.
*/
require CAKE . 'Config' . DS . 'routes.php';
// C
Router::connect('/', array('controller' => 'categories', 'action' => 'index')); // Acción Get - Interfaz administrar las categorías de productos y servicios
Router::connect('/new-category', array('controller' => 'categories', 'action' => 'new_category')); // Acción Ajax - Para registrar una categoría
Router::connect('/delete-category', array('controller' => 'categories', 'action' => 'deleteCategory')); // Acción Ajax - Para borrar una categoría
Router::connect('/edit-category', array('controller' => 'categories', 'action' => 'edit_category_name')); // Acción Ajax - Para editar el nombre una categoría
Router::connect('/edit-category-position', array('controller' => 'categories', 'action' => 'edit_category_position')); // Acción Ajax - Para editar la posición de una categoría
10 changes: 10 additions & 0 deletions php/app/Controller/AppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,14 @@ class AppController extends Controller {
* Add in the DebugKit toolbar
*/
public $components = array('DebugKit.Toolbar');

public function beforeFilter(){

/* Para Ubicarse entre las vistas y controladores
****************************************************/
$this->{'set'}('controller',$this->{'request'}->params['controller']);
$this->{'set'}('action',$this->{'request'}->params['action']);

}

}
Loading

0 comments on commit 93be998

Please sign in to comment.