-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Modelo inicial do banco de dados * Atualizado README * Adicionado Cake Base de https://github.com/redsuns/cake-base
- Loading branch information
Showing
1,362 changed files
with
118,951 additions
and
34 deletions.
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,19 @@ | ||
CakePHP | ||
======= | ||
Book Control | ||
============ | ||
|
||
[](http://www.cakephp.org) | ||
É um pequeno sistema em PHP para gerenciamento pessoal de sua coleção de livros. | ||
|
||
CakePHP is a rapid development framework for PHP which uses commonly known design patterns like Active Record, Association Data Mapping, Front Controller and MVC. | ||
Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility. | ||
|
||
Some Handy Links | ||
---------------- | ||
A ideia é bem simples, catalogar livro a livro de sua coleção pessoal com seus | ||
respectivos dados como: data em que foi adquirido ou ganho, valor pago, ISBN | ||
e anotações gerais sobre o mesmo como data de inícios e términos de leitura, | ||
empréstimos a amigos e devoluções. | ||
|
||
[CakePHP](http://www.cakephp.org) - The rapid development PHP framework | ||
|
||
[Cookbook](http://book.cakephp.org) - THE Cake user documentation; start learning here! | ||
|
||
[Plugins](http://plugins.cakephp.org/) - A repository of extensions to the framework | ||
Como mencionado, a ideia surgiu de uma necessidade pessoal e resolvi desde | ||
o início deisponibilizar no github para qualquer um que queira utilizar bem | ||
como melhorar. | ||
|
||
[The Bakery](http://bakery.cakephp.org) - Tips, tutorials and articles | ||
|
||
[API](http://api.cakephp.org) - A reference to Cake's classes | ||
|
||
[CakePHP TV](http://tv.cakephp.org) - Screen casts from events and video tutorials | ||
|
||
[The Cake Software Foundation](http://cakefoundation.org/) - promoting development related to CakePHP | ||
|
||
Get Support! | ||
------------ | ||
|
||
[Our Google Group](https://groups.google.com/group/cake-php) - community mailing list and forum | ||
|
||
[#cakephp](http://webchat.freenode.net/?channels=#cakephp) on irc.freenode.net - Come chat with us, we have cake. | ||
|
||
[Q & A](http://ask.cakephp.org/) - Ask questions here, all questions welcome | ||
|
||
[Lighthouse](https://cakephp.lighthouseapp.com/) - Got issues? Please tell us! | ||
|
||
[](http://travis-ci.org/cakephp/cakephp) | ||
|
||
 | ||
;) |
Empty file.
Binary file not shown.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
class AppSchema extends CakeSchema { | ||
|
||
public function before($event = array()) { | ||
return true; | ||
} | ||
|
||
public function after($event = array()) { | ||
} | ||
|
||
public $groups = array( | ||
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), | ||
'name' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 60, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'), | ||
'created' => array('type' => 'datetime', 'null' => true, 'default' => null), | ||
'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), | ||
'indexes' => array( | ||
'PRIMARY' => array('column' => 'id', 'unique' => 1) | ||
), | ||
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_unicode_ci', 'engine' => 'InnoDB') | ||
); | ||
|
||
public $users = array( | ||
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), | ||
'group_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10), | ||
'name' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 100, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'), | ||
'surname' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 100, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'), | ||
'email' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'), | ||
'username' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'), | ||
'password' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 60, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'), | ||
'address' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'), | ||
'addr_number' => array('type' => 'integer', 'null' => false, 'default' => null), | ||
'addr_complement' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 50, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'), | ||
'addr_district' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 100, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'), | ||
'addr_city' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 100, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'), | ||
'addr_state' => array('type' => 'string', 'null' => false, 'default' => 'PR', 'length' => 2, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'), | ||
'addr_country' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 45, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'), | ||
'addr_zip_code' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 10, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'), | ||
'phone' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 14, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'), | ||
'celphone' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 15, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'), | ||
'created' => array('type' => 'datetime', 'null' => true, 'default' => null), | ||
'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), | ||
'indexes' => array( | ||
'PRIMARY' => array('column' => 'id', 'unique' => 1) | ||
), | ||
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_unicode_ci', 'engine' => 'InnoDB') | ||
); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; | ||
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; | ||
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL'; | ||
|
||
|
||
-- ----------------------------------------------------- | ||
-- Table `base`.`groups` | ||
-- ----------------------------------------------------- | ||
CREATE TABLE IF NOT EXISTS `groups` ( | ||
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT , | ||
`name` VARCHAR(60) NOT NULL , | ||
`created` DATETIME NULL , | ||
`modified` DATETIME NULL , | ||
PRIMARY KEY (`id`) ) | ||
ENGINE = InnoDB | ||
DEFAULT CHARACTER SET = utf8 | ||
COLLATE = utf8_unicode_ci; | ||
|
||
|
||
-- ----------------------------------------------------- | ||
-- Table `base`.`users` | ||
-- ----------------------------------------------------- | ||
CREATE TABLE IF NOT EXISTS `users` ( | ||
`id` INT NOT NULL AUTO_INCREMENT , | ||
`group_id` INT UNSIGNED NOT NULL , | ||
`name` VARCHAR(100) NOT NULL , | ||
`surname` VARCHAR(100) NOT NULL , | ||
`email` VARCHAR(255) NOT NULL , | ||
`username` VARCHAR(255) NOT NULL , | ||
`password` VARCHAR(60) NOT NULL , | ||
`address` VARCHAR(255) NOT NULL , | ||
`addr_number` INT NOT NULL , | ||
`addr_complement` VARCHAR(50) NULL , | ||
`addr_district` VARCHAR(100) NOT NULL , | ||
`addr_city` VARCHAR(100) NOT NULL , | ||
`addr_state` VARCHAR(2) NOT NULL DEFAULT 'PR' , | ||
`addr_country` VARCHAR(45) NOT NULL , | ||
`addr_zip_code` VARCHAR(10) NOT NULL , | ||
`phone` VARCHAR(14) NOT NULL , | ||
`celphone` VARCHAR(15) NULL , | ||
`created` DATETIME NULL , | ||
`modified` DATETIME NULL , | ||
PRIMARY KEY (`id`) ) | ||
ENGINE = InnoDB | ||
DEFAULT CHARACTER SET = utf8 | ||
COLLATE = utf8_unicode_ci; | ||
|
||
|
||
|
||
SET SQL_MODE=@OLD_SQL_MODE; | ||
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; | ||
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; |
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?php | ||
App::uses('AppController', 'Controller'); | ||
/** | ||
* Groups Controller | ||
* | ||
* @property Group $Group | ||
*/ | ||
class GroupsController extends AppController { | ||
|
||
/** | ||
* index method | ||
* | ||
* @return void | ||
*/ | ||
public function index() { | ||
$this->Group->recursive = 0; | ||
$this->set('groups', $this->paginate()); | ||
} | ||
|
||
/** | ||
* view method | ||
* | ||
* @throws NotFoundException | ||
* @param string $id | ||
* @return void | ||
*/ | ||
public function view($id = null) { | ||
if (!$this->Group->exists($id)) { | ||
throw new NotFoundException(__('Invalid group')); | ||
} | ||
$options = array('conditions' => array('Group.' . $this->Group->primaryKey => $id)); | ||
$this->set('group', $this->Group->find('first', $options)); | ||
} | ||
|
||
/** | ||
* add method | ||
* | ||
* @return void | ||
*/ | ||
public function add() { | ||
if ($this->request->is('post')) { | ||
$this->Group->create(); | ||
if ($this->Group->save($this->request->data)) { | ||
$this->Session->setFlash(__('The group has been saved')); | ||
$this->redirect(array('action' => 'index')); | ||
} else { | ||
$this->Session->setFlash(__('The group could not be saved. Please, try again.')); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* edit method | ||
* | ||
* @throws NotFoundException | ||
* @param string $id | ||
* @return void | ||
*/ | ||
public function edit($id = null) { | ||
if (!$this->Group->exists($id)) { | ||
throw new NotFoundException(__('Invalid group')); | ||
} | ||
if ($this->request->is('post') || $this->request->is('put')) { | ||
if ($this->Group->save($this->request->data)) { | ||
$this->Session->setFlash(__('The group has been saved')); | ||
$this->redirect(array('action' => 'index')); | ||
} else { | ||
$this->Session->setFlash(__('The group could not be saved. Please, try again.')); | ||
} | ||
} else { | ||
$options = array('conditions' => array('Group.' . $this->Group->primaryKey => $id)); | ||
$this->request->data = $this->Group->find('first', $options); | ||
} | ||
} | ||
|
||
/** | ||
* delete method | ||
* | ||
* @throws NotFoundException | ||
* @param string $id | ||
* @return void | ||
*/ | ||
public function delete($id = null) { | ||
$this->Group->id = $id; | ||
if (!$this->Group->exists()) { | ||
throw new NotFoundException(__('Invalid group')); | ||
} | ||
$this->request->onlyAllow('post', 'delete'); | ||
if ($this->Group->delete()) { | ||
$this->Session->setFlash(__('Group deleted')); | ||
$this->redirect(array('action' => 'index')); | ||
} | ||
$this->Session->setFlash(__('Group was not deleted')); | ||
$this->redirect(array('action' => 'index')); | ||
} | ||
} |
Empty file.
Oops, something went wrong.