Skip to content

Commit

Permalink
Adicionados
Browse files Browse the repository at this point in the history
* Modelo inicial do banco de dados
* Atualizado README
* Adicionado Cake Base de https://github.com/redsuns/cake-base
  • Loading branch information
andrebian committed Aug 11, 2013
1 parent 54943c1 commit 997fbc5
Show file tree
Hide file tree
Showing 1,362 changed files with 118,951 additions and 34 deletions.
Empty file modified .editorconfig
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified .htaccess
100644 → 100755
Empty file.
Empty file modified .travis.yml
100644 → 100755
Empty file.
Empty file modified CONTRIBUTING.md
100644 → 100755
Empty file.
42 changes: 11 additions & 31 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,39 +1,19 @@
CakePHP
=======
Book Control
============

[![CakePHP](http://cakephp.org/img/cake-logo.png)](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!

[![Bake Status](https://secure.travis-ci.org/cakephp/cakephp.png?branch=master)](http://travis-ci.org/cakephp/cakephp)

![Cake Power](https://raw.github.com/cakephp/cakephp/master/lib/Cake/Console/Templates/skel/webroot/img/cake.power.gif)
;)
Empty file modified app/.htaccess
100644 → 100755
Empty file.
Binary file added app/Config/Schema/base.mwb
Binary file not shown.
Empty file modified app/Config/Schema/db_acl.php
100644 → 100755
Empty file.
Empty file modified app/Config/Schema/db_acl.sql
100644 → 100755
Empty file.
Empty file modified app/Config/Schema/i18n.php
100644 → 100755
Empty file.
Empty file modified app/Config/Schema/i18n.sql
100644 → 100755
Empty file.
48 changes: 48 additions & 0 deletions app/Config/Schema/schema.php
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')
);

}
52 changes: 52 additions & 0 deletions app/Config/Schema/schema.sql
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 modified app/Config/Schema/sessions.php
100644 → 100755
Empty file.
Empty file modified app/Config/Schema/sessions.sql
100644 → 100755
Empty file.
Empty file modified app/Config/acl.ini.php
100644 → 100755
Empty file.
Empty file modified app/Config/acl.php
100644 → 100755
Empty file.
2 changes: 2 additions & 0 deletions app/Config/bootstrap.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,5 @@
'types' => array('warning', 'error', 'critical', 'alert', 'emergency'),
'file' => 'error',
));

CakePlugin::loadAll();
Empty file modified app/Config/core.php
100644 → 100755
Empty file.
Empty file modified app/Config/database.php.default
100644 → 100755
Empty file.
Empty file modified app/Config/email.php.default
100644 → 100755
Empty file.
Empty file modified app/Config/routes.php
100644 → 100755
Empty file.
Empty file modified app/Console/Command/AppShell.php
100644 → 100755
Empty file.
Empty file modified app/Console/Command/Task/empty
100644 → 100755
Empty file.
Empty file modified app/Console/Templates/empty
100644 → 100755
Empty file.
Empty file modified app/Console/cake
100644 → 100755
Empty file.
Empty file modified app/Console/cake.bat
100644 → 100755
Empty file.
Empty file modified app/Console/cake.php
100644 → 100755
Empty file.
49 changes: 49 additions & 0 deletions app/Controller/AppController.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,53 @@
* @link http://book.cakephp.org/2.0/en/controllers.html#the-app-controller
*/
class AppController extends Controller {

public $components = array('Session', 'Auth', 'Acl', 'DebugKit.Toolbar');


public function beforeFilter() {

// Mecanismo de autenticação
$this->Auth->authenticate = array('Blowfish' => array(
// Configura o model e os campos
'userModel' => 'User',
// 'fields' => array(
// 'username' => 'email',
// 'password' => 'senha',
// ),
));



$this->Auth->loginAction = array(
'controller' => 'user',
'action' => 'login'
);


$this->Auth->allow();

$blackList = array();

//$this->Auth->deny($blackList);


// Iremos autorizar controllers e actions
$this->Auth->authorize = array(
'Actions' => array('actionPath' => 'controllers')
);

//definindo a mensagem
$this->Auth->authError = __('<div class="notification msgerror">
<div class="alert alert-error">
<p>
Você precisa realizar o login
para acessar a área solicitada.
</p>
</div>
</div>');

parent::beforeFilter();
}

}
Empty file modified app/Controller/Component/empty
100644 → 100755
Empty file.
96 changes: 96 additions & 0 deletions app/Controller/GroupsController.php
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 modified app/Controller/PagesController.php
100644 → 100755
Empty file.
Loading

0 comments on commit 997fbc5

Please sign in to comment.