Changeset 407
- Timestamp:
- 04/16/08 17:24:40 (9 months ago)
- Location:
- trunk/app
- Files:
-
- 1 removed
- 11 modified
-
app_controller.php (modified) (1 diff)
-
config/core.php (modified) (1 diff)
-
config/routes.php (modified) (1 diff)
-
controllers/discussions_controller.php (modified) (1 diff)
-
controllers/polls_controller.php (modified) (3 diffs)
-
models/discussion.php (modified) (1 diff)
-
models/discution.php (deleted)
-
models/news.php (modified) (1 diff)
-
views/errors/error404.ctp (modified) (1 diff)
-
views/news/admin_listing.ctp (modified) (1 diff)
-
views/news/view.ctp (modified) (2 diffs)
-
views/polls/admin_add.ctp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/app_controller.php
r400 r407 12 12 class AppController extends Controller { 13 13 14 public $components = array('Auth', 'Cookie', 'Se curity', 'Session');14 public $components = array('Auth', 'Cookie', 'Session', 'Security'); 15 15 16 16 public $helpers = array('Html', 'Form', 'Session'); -
trunk/app/config/core.php
r406 r407 14 14 * In development mode, you need to click the flash message to continue. 15 15 */ 16 Configure::write('debug', 2);16 Configure::write('debug', 1); 17 17 /** 18 18 * Application wide charset encoding -
trunk/app/config/routes.php
r276 r407 14 14 * developement. 15 15 */ 16 Router::connect('/tests', array('controller' => 'tests', 'action' => 'index'));16 // Router::connect('/tests', array('controller' => 'tests', 'action' => 'index')); 17 17 ?> -
trunk/app/controllers/discussions_controller.php
r406 r407 42 42 public function agregar() 43 43 { 44 44 45 $this->layout = 'portal'; 45 46 echo 'I am in a ddfunction !!!<br />';46 47 echo 'I am in agregar function !!!<br />'; 47 48 48 49 die(debug($this->data)); -
trunk/app/controllers/polls_controller.php
r328 r407 25 25 } 26 26 27 /** 28 == ADMIN METHODS 29 **/ 27 /**== ADMIN METHODS **/ 30 28 31 public function admin_add() 32 {29 public function admin_listing() 30 { 33 31 $this->layout = 'admin'; 34 $this->pageTitle = ' Add Poll';32 $this->pageTitle = 'Polls'; 35 33 36 if (!empty($this->data["Poll"])) 37 { 38 $this->Sanitize = new Sanitize; 34 $conditions = array("user_id" => $this->Auth->user('id')); 35 $fields = array("id", "question", "created", "status"); 36 $order = "created DESC"; 37 38 $this->set('data', $this->Poll->findAll($conditions, $fields, $order, null, null, 2)); 39 } 40 41 public function admin_add() 42 { 43 $this->layout = 'admin'; 44 $this->pageTitle = 'Add Poll'; 45 46 if (!empty($this->data['Poll'])) 47 { 48 $this->Sanitize = new Sanitize; 39 49 40 $this->Sanitize->clean($this->data['Poll']); //Hopefully this is enough50 $this->Sanitize->clean($this->data['Poll']); //Hopefully this is enough 41 51 42 $this->Pollrow = new Pollrow;52 $this->Pollrow = new Pollrow; 43 53 44 $this->data['Poll']['user_id'] = $this->Auth->user('id');54 $this->data['Poll']['user_id'] = $this->Auth->user('id'); 45 55 46 56 $this->Poll->create(); 47 57 48 if ( $this->Poll->save($this->data['Poll']))49 {50 $this->Poll->id = false;51 $this->Pollrow->id = false;58 if ( $this->Poll->save($this->data['Poll'])) 59 { 60 $this->Poll->id = false; 61 $this->Pollrow->id = false; 52 62 53 $poll_id = $this->Poll->getLastInsertID();63 $poll_id = $this->Poll->getLastInsertID(); 54 64 55 $colors = array('green', 'blue', 'brown', 'yellow', 'orange', 'red', 'black');65 $colors = array('green', 'blue', 'brown', 'yellow', 'orange', 'red', 'black'); 56 66 57 67 $i = 0; … … 69 79 } 70 80 71 exit($this->redirect('/admin/polls/listing'));81 $this->msgFlash('Poll saved', '/admin/polls/listing'); 72 82 73 }74 else75 {76 $this->flash('/admin/polls/listing', 'Error Pollrow model');77 }78 }79 }83 } 84 else 85 { 86 $this->flash('/admin/polls/listing', 'Error Pollrow model'); 87 } 88 } 89 } 80 90 81 public function admin_listing() 82 { 83 $this->layout = 'admin'; 84 $this->pageTitle = 'Polls'; 85 86 $conditions = array("user_id" => $this->othAuth->user('id')); 87 $fields = array("id", "question", "created", "status"); 88 $order = "created DESC"; 89 90 $this->set('data', $this->Poll->findAll($conditions, $fields, $order, null, null, 2)); 91 } 92 93 public function admin_edit($id=null) 94 { 91 public function admin_edit($poll_id=null) 92 { 95 93 96 94 if (empty($this->data['Poll'])) 97 95 { 98 96 $this->layout = 'admin'; 99 100 $this->Poll->id = $id;101 97 102 $this->data = $this->Poll->read( );98 $this->data = $this->Poll->read(null, $poll_id); 103 99 } 104 100 else … … 114 110 } 115 111 } 116 } 117 118 public function admin_delete($id) 119 { 120 // deletes task from database 121 //die($this->data['Poll']['id']); 122 $this->Poll->del($id); 123 $this->msgFlash('Poll deleted', '/admin/polls/listing'); 124 exit(); 112 } 113 114 public function admin_delete($id) 115 { 116 if ( $this->Poll->del($id) ) 117 { 118 $this->msgFlash('Poll deleted', '/admin/polls/listing'); 119 } 125 120 } 126 121 } -
trunk/app/models/discussion.php
r401 r407 24 24 25 25 public $validate = array( 26 ' username' => array(27 'rule' => array('minLength', 2),26 'comment' => array( 27 'rule' => array('minLength', 2), 28 28 'message' => 'Usernames must be at least 6 characters long.' 29 29 ) -
trunk/app/models/news.php
r401 r407 33 33 public $validate = array( 34 34 'title' => VALID_NOT_EMPTY, 35 'user_id' => VALID_NOT_EMPTY,35 'user_id' => VALID_NOT_EMPTY, 36 36 'body' => VALID_NOT_EMPTY, 37 'status' => VALID_NOT_EMPTY37 'status' => VALID_NOT_EMPTY 38 38 ); 39 39 -
trunk/app/views/errors/error404.ctp
r313 r407 1 Karamelo: error404.thtml 1 <h1><?php echo $name; ?></h1> 2 <p><?php echo $message; ?></p> 3 -
trunk/app/views/news/admin_listing.ctp
r301 r407 4 4 <?php 5 5 echo $html->link($html->image('actions/new.png', array("alt"=>"Add new", "title"=>"Add new")), '/admin/news/add', null, false, false); 6 echo $html->link($html->image('static/forum.gif', array("alt"=>"See comments", "title"=>"See comments")), '/admin/ commentnews/listing', null, false, false);6 echo $html->link($html->image('static/forum.gif', array("alt"=>"See comments", "title"=>"See comments")), '/admin/discussions/listing', null, false, false); 7 7 ?> 8 8 -
trunk/app/views/news/view.ctp
r406 r407 46 46 47 47 echo '<div class="comentnew" style="background-color:'.$bg.'">'; 48 echo $time->timeAgoInWords($v[ "created"]) . " <b>". $v["name"] . "</b> wrote:<br />";48 echo $time->timeAgoInWords($v['created']) . ' <b>'. $v['name'] . '</b> wrote:<br />'; 49 49 echo $v["comment"]; 50 50 echo "</div>"; … … 54 54 55 55 echo $form->create('Discussion', array('action'=>'agregar')); 56 //echo '<form action="/discussions/agregar" method="post">'; 56 57 ?> 58 59 57 60 <fieldset> 58 61 <legend>Write comment:</legend> -
trunk/app/views/polls/admin_add.ctp
r268 r407 1 1 2 <?php echo $ html->formTag('/admin/polls/add/','post'); ?>2 <?php echo $form->create('Poll'); ?> 3 3 <fieldset> 4 4 <legend>New Poll</legend> 5 <?php echo $form->labelTag('Poll/question', 'Question:') . "<br />"; ?> 6 <?php echo $html->input('Poll/question', array("size" => 60, "maxlength"=>130)); ?> 7 <?php echo $html->tagErrorMsg('Poll/question', 'A question is required.'); ?> 5 <?php 6 echo $form->input('Poll.question', array("size" => 60, "maxlength"=>100)); 7 ?> 8 8 9 <div style="margin:15px auto 15px auto;border:1px dotted gray;padding-left:40px;width:80%;"> 9 10 10 11 <?php 11 12 for ($i=1;$i<10;$i++) 12 { 13 echo $form->labelTag('Row/answer'.$i, 'Answer ' . $i . ':') . "<br />"; 14 echo $html->input('Row/answer'.$i, array("size" => 50, "maxlenght"=>100)); 13 { 14 echo $form->input('Row.answer'.$i, array('size' => 50, 'maxlenght'=>100)); 15 15 } 16 16 ?> … … 18 18 19 19 <?php 20 echo $form->label Tag('Poll/status', 'Published:') . "<br />";21 echo $ html->checkbox('Poll/status');20 echo $form->label('Poll.status', 'Published:') . "<br />"; 21 echo $form->checkbox('Poll.status', array('value'=>1)); 22 22 ?> 23 23 24 <div style="clear:both"></div> 25 <?php echo $html->submit('Add'); ?> 26 </fieldset> 27 </form> 24 <div style="clear:both"></div></fieldset> 28 25 26 <?php echo $form->end('Save'); ?> 27 28
