Changeset 320
- Timestamp:
- 03/11/08 18:02:47 (10 months ago)
- Location:
- trunk/app
- Files:
-
- 2 modified
-
controllers/forums_controller.php (modified) (5 diffs)
-
views/forums/admin_add.ctp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/forums_controller.php
r302 r320 3 3 * Chipotle Software TM 4 4 * Manuel Montoya 2002-2008 5 * GPLv3 manuel<a t>mononeurona<dot>org5 * GPLv3 manuel<arroba>mononeurona<punto>org 6 6 */ 7 7 … … 62 62 $this->layout = 'admin'; 63 63 64 $conditions = array("user_id"=>$this-> othAuth->user('id'));64 $conditions = array("user_id"=>$this->Auth->user('id')); 65 65 66 66 $this->set('data', $this->Forum->findAll($conditions)); … … 70 70 { 71 71 $this->layout = 'admin'; 72 73 if ( isset($this->data["Forum"]) )72 73 if ( !empty( $this->data['Forum'] ) ) 74 74 { 75 // die( debug( $this->data ) ); 75 76 $this->Sanitize = new Sanitize; 76 77 77 $this->Sanitize->clean Array($this->data["Forum"]);78 $this->Sanitize->clean($this->data['Forum']); 78 79 79 $this->data[ "Forum"]["user_id"] = $this->othAuth->user('id');80 $this->data['Forum']['user_id'] = $this->Auth->user('id'); 80 81 81 if ( $this->Forum->save($this->data["Forum"]) ) 82 $this->Forum->create(); 83 84 if ( $this->Forum->save($this->data['Forum']) ) 82 85 { 83 $this->redirect('/admin/catforums/listing');86 $this->msgFlash('Forum created', '/admin/catforums/listing'); 84 87 } 85 88 } … … 104 107 $this->Sanitize = new Sanitize; 105 108 106 $this->Sanitize->clean Array($this->data["Forum"]);109 $this->Sanitize->clean($this->data["Forum"]); 107 110 108 111 if ($this->Forum->save($this->data["Forum"])) … … 115 118 116 119 public function admin_delete($id) 117 { 118 // deletes task from database 119 $this->Forum->del($id); 120 121 $this->msgFlash('Forum deleted', '/admin/catforums/listing'); 122 exit(); 123 } 120 { 121 if ( $this->Forum->del($id) ) 122 { 123 $this->msgFlash('Forum deleted', '/admin/catforums/listing'); 124 } 125 } 124 126 125 127 } -
trunk/app/views/forums/admin_add.ctp
r253 r320 1 2 <?php echo $javascript->link('myfunctions'); ?> 1 <?php echo $javascript->link('myfunctions'); ?> 3 2 4 3 <div> 5 <?php echo $html->addCrumb('Control Tools', '/admin/entries/start'); ?> 6 <?php echo $html->getCrumbs(' / '); ?> 4 <?php 5 echo $html->addCrumb('Control Tools', '/admin/entries/start'); 6 echo $html->getCrumbs(' / '); 7 ?> 7 8 </div> 8 9 <div class="title_section">Add New Forum</div> … … 10 11 <div class="spaced"> 11 12 12 <?php echo $html->formTag('/admin/forums/add/','post'); ?> 13 <?php echo $html->hiddenTag('Forum/catforum_id', $catforum_id); ?> 13 <?php 14 echo $form->create('Forum'); 15 echo $form->hidden('Forum.catforum_id', array('value'=>$catforum_id)); 16 ?> 14 17 <fieldset> 15 18 <legend>New Forum</legend> 16 19 17 <?php echo $form->labelTag( 'Forum/title', 'Title:' );?><br /> 18 <?php echo $html->input('Forum/title', array("size" => 40, "maxlength" => 60)); ?> 19 <?php echo $html->tagErrorMsg('Forum/title', 'A phorum title is required.'); ?> 20 <?php 21 echo $form->input('Forum.title', array("size" => 40, "maxlength" => 60)); 22 echo $form->error('Forum.title', 'A forum title is required.'); 23 ?> 20 24 <p> 21 <?php echo $form->labelTag( 'Forum/description', 'Description:' );?><br /> 22 <?php echo $html->textarea('Forum/description', array("rows" => 10, "cols" => 50)); ?> 23 <?php echo $html->tagErrorMsg('Forum/description', 'A phorum description is required.'); ?> 25 <?php 26 echo $form->label('Forum.description', 'Description:' ) . '<br />'; 27 echo $form->textarea('Forum.description', array("rows" => 10, "cols" => 50)); 28 echo $form->error('Forum.description', 'A phorum description is required.'); 29 ?> 24 30 </p> 25 31 <br /> 26 <?php echo $form->labelTag( 'Forum/status', 'Activate forum:') . $html->checkbox('Forum/status', null, array("value"=>1)); ?><br /> 27 <p><br /> 28 <?php echo $html->submit('Send') ?></p> 29 </fieldset> 30 </form> 32 <?php echo $form->label('Forum.status', 'Activate forum:') . $form->checkbox('Forum.status', array("value"=>1)); ?><br /> 33 <p><br /></fieldset> 34 <?php echo $form->end('Save'); ?></p> 31 35 </div>
