diff --git a/app/controllers/pages_controller.php b/app/controllers/pages_controller.php new file mode 100644 index 0000000..2040c98 --- /dev/null +++ b/app/controllers/pages_controller.php @@ -0,0 +1,68 @@ +data['Pages']['event'])) { + $this->Session->write('Option.event', $this->data['Pages']['event']); + $this->redirect(array('controller' => 'tweets', $this->data['Pages']['event'])); + } + } + + public function view($id = null) { + if (!$id) { + $this->Session->setFlash(__('Invalid page', true)); + $this->redirect(array('action' => 'index')); + } + $this->set('page', $this->Page->read(null, $id)); + } + + public function add() { + if (!empty($this->data)) { + $this->Page->create(); + if ($this->Page->save($this->data)) { + $this->Session->setFlash(__('The page has been saved', true)); + $this->redirect(array('action' => 'index')); + } else { + $this->Session->setFlash(__('The page could not be saved. Please, try again.', true)); + } + } + } + + public function edit($id = null) { + if (!$id && empty($this->data)) { + $this->Session->setFlash(__('Invalid page', true)); + $this->redirect(array('action' => 'index')); + } + if (!empty($this->data)) { + if ($this->Page->save($this->data)) { + $this->Session->setFlash(__('The page has been saved', true)); + $this->redirect(array('action' => 'index')); + } else { + $this->Session->setFlash(__('The page could not be saved. Please, try again.', true)); + } + } + if (empty($this->data)) { + $this->data = $this->Page->read(null, $id); + } + } + + public function delete($id = null) { + if (!$id) { + $this->Session->setFlash(__('Invalid id for page', true)); + $this->redirect(array('action' => 'index')); + } + if ($this->Page->delete($id)) { + $this->Session->setFlash(__('Page deleted', true)); + $this->redirect(array('action' => 'index')); + } + $this->Session->setFlash(__('Page was not deleted', true)); + $this->redirect(array('action' => 'index')); + } + +} + +?> \ No newline at end of file diff --git a/app/models/page.php b/app/models/page.php new file mode 100644 index 0000000..fec4898 --- /dev/null +++ b/app/models/page.php @@ -0,0 +1,18 @@ + array( + 'notempty' => array( + 'rule' => array('notempty'), + //'message' => 'Your custom message here', + //'allowEmpty' => false, + //'required' => false, + //'last' => false, // Stop validation after this rule + //'on' => 'create', // Limit validation to 'create' or 'update' operations + ), + ), + ); +} +?> \ No newline at end of file diff --git a/app/views/helpers/tweets_assist.php b/app/views/helpers/tweets_assist.php new file mode 100644 index 0000000..44e772e --- /dev/null +++ b/app/views/helpers/tweets_assist.php @@ -0,0 +1,24 @@ +Tweet = new Tweet(); + $users_images = $this->Tweet->find('all', array('limit' => 26, + 'order' => 'RAND()', 'fields' => array('DISTINCT(user)', 'profile_image'))); + echo $this->Html->tag('h2', __('Quem está tuitando?', true)); + foreach ($users_images as $user) + echo $this->Html->image($user['Tweet']['profile_image'], array('alt' => $user['Tweet']['user'], + 'alt' => $user['Tweet']['user'], 'url' => "http://twitter.com/#!/{$user['Tweet']['user']}", 'id' => 'user_image')); + } + +} + +?> \ No newline at end of file diff --git a/app/views/pages/index.ctp b/app/views/pages/index.ctp new file mode 100644 index 0000000..2188758 --- /dev/null +++ b/app/views/pages/index.ctp @@ -0,0 +1,3 @@ +Form->create('Pages', array('url' => '/')); ?> +Form->input('event', array('label' => false)); ?> +Form->end(__('Start', true)); ?> \ No newline at end of file diff --git a/app/webroot/css/bkp.css b/app/webroot/css/bkp.css new file mode 100644 index 0000000..858c00b --- /dev/null +++ b/app/webroot/css/bkp.css @@ -0,0 +1,102 @@ +* { + border: 0 none; + margin: 0; + padding: 0; + outline: none; + text-decoration: none; +} + +body { + background: #3DABCB; + border-top: 10px solid #121621; + color: #121621; + font-family: 'Philosopher', Arial, serif; + font-size: 17px; + font-weight: normal; + line-height: 24px; +} + +a { + color: #459ECB; + text-decoration: none; +} + +a#tweet { + background: url(../img/date.png) left center no-repeat; + font-family: Georgia, Times, "Times New Roman", serif; + font-size: 12px; + font-weight: normal; + padding: 0 0 0 15px; +} + +#header { + margin: 50px auto 10px; + width: 900px; +} + +#header h1 { + background: url(../img/icon.png) left center no-repeat; + color: #121621; + float: left; + font-family: 'Neucha', Arial, serif; + font-size: 56px; + font-weight: bold; + line-height: 56px; + padding: 5px 0 0 50px; +} + +#header #users { + display: block; + float: right; + height: 130px; + width: 400px; +} + +#header #users h2 { + background: 0 none; + color: #FFF; + font-family: 'Neucha', Arial, serif; + font-style: italic; +} + +#content { + background: #459ECB; + border-radius: 5px; + box-shadow: 1px 1px 5px #121621; + margin: 0 auto; + padding: 10px 10px 5px 10px; + width: 900px; +} + +#content table { + background: 0 none; +} + +#content table tbody tr { + background: 0 none; +} + +#content table tbody tr td { + background: #FCFCFC; + padding: 10px 5px; +} + +#content table tbody tr td:hover { + background: #F5F5F5; + cursor: pointer; +} + +#content table tbody tr:first-child td { + border-top-left-radius: 5px; + border-top-right-radius: 5px; +} + +#content table tbody tr:last-child td { + border-bottom-right-radius: 5px; + border-bottom-left-radius: 5px; +} + +#content table tbody tr td img { + float: left; + margin: 0 10px; +} \ No newline at end of file