Changeset 537
- Timestamp:
- 05/20/08 20:43:23 (8 months ago)
- Location:
- trunk/app
- Files:
-
- 8 modified
-
controllers/discussions_controller.php (modified) (1 diff)
-
controllers/news_controller.php (modified) (1 diff)
-
models/discussion.php (modified) (2 diffs)
-
models/news.php (modified) (2 diffs)
-
models/theme.php (modified) (1 diff)
-
views/discussions/admin_listing.ctp (modified) (2 diffs)
-
views/news/view.ctp (modified) (4 diffs)
-
webroot/img/themes (modified) (1 prop)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/discussions_controller.php
r529 r537 125 125 $this->layout = 'admin'; 126 126 127 $this->pageTitle = 'Comments on Blogs'; 128 127 $this->pageTitle = 'Comments on News'; 128 129 $this->Discussion->bindModel(array('belongsTo'=> array('News' =>array('className'=> 'News', 'foreignKey'=> 'new_id' )))); 130 129 131 $conditions = null; 132 133 $fields = array('Discussion.id','News.id','News.title','Discussion.id','Discussion.comment', 'Discussion.created', 'Discussion.username', 'Discussion.user_id', 'Discussion.status'); 130 134 131 $fields = array("Discussion.id", "News.title", "Discussion.id", "Discussion.comment", "Discussion.created", "Discussion.username", "Discussion.user_id"); 132 $order = "Discussion.id DESC"; 133 135 $order = "Discussion.id DESC"; 136 137 $limit = 50; 138 134 139 $this->set('data', $this->Discussion->findAll($conditions, $fields, $order, $limit)); 135 140 } 136 141 137 public function admin_edit($id )142 public function admin_edit($id=null) 138 143 { 139 if (empty($this->data["Discussion"])) 140 { 144 if (empty($this->data["Discussion"])): 145 141 146 $this->layout = 'admin'; 142 143 $this->Discussion->poll_id = $id; 144 145 $this->data = $this->Discussion->read(); 146 } 147 else 148 { 147 148 $this->data = $this->Discussion->read(null, $id); 149 150 else: 151 149 152 $this->Sanitize = new Sanitize; 150 153 151 154 $this->Sanitize->clean($this->data["Discussion"]); 152 155 153 if ($this->Discussion->save($this->data["Discussion"])) 154 { 155 $this->msgFlash('/polls/listing'); 156 } 157 } 158 } 156 if ($this->Discussion->save($this->data["Discussion"])): 157 $this->msgFlash('Disccusion saved', '/admin/discussions/listing'); 158 endif; 159 endif; 160 } 159 161 160 public function admin_delete($id) 162 // change status enabled/disabled actived 163 public function admin_change($discussion_id, $status) 164 { 165 $this->data['Discussion']['status'] = ($status == 0 ) ? 1 : 0; 166 167 $this->data['Discussion']['id'] = $discussion_id; 168 169 if ($this->Discussion->save($this->data['Discussion'])): 170 $this->msgFlash('Discussio status changed', '/admin/discussions/listing'); 171 endif; 172 } 173 174 public function admin_delete($discussion_id) 161 175 { 162 176 // deletes comment on database 163 $this->Discussion->del($id); 164 $this->msgFlash('Comment deleted', '/admin/commentnews/listing'); 165 } 177 if ( $this->Discussion->del($discussion_id) ): 178 $this->msgFlash('Comment deleted', '/admin/discussions/listing'); 179 endif; 180 } 166 181 } 167 182 ?> -
trunk/app/controllers/news_controller.php
r515 r537 53 53 54 54 $this->Portal->statics(); // Charge Portal components aka Sidebars 55 }55 } 56 56 57 public function view($id = null) 58 { 59 if ($id == null) 60 { 57 public function view($new_id = null) 58 { 59 if ( $new_id == null || !intval($new_id) ): 61 60 $this->redirect("/"); 62 } 63 64 $this->layout = 'portal'; 65 66 $this->pageTitle = '::News'; 67 68 $conditions = array("News.status"=>1, "News.id"=>$id); 69 70 $fields = array("News.id", "News.title", "News.comments", "News.body", "News.created", "News.reference", "News.theme_id", "News.user_id", "Theme.img", "Theme.theme", "User.username"); 71 72 $this->set('data', $this->News->find($conditions, $fields, null, 2)); 73 74 $this->Portal->statics(); // Charge Portal components aka Sidebars 75 } 61 endif; 62 63 $this->layout = 'portal'; 64 65 $this->pageTitle = '::News'; 66 67 $this->News->User->unbindAll(); 68 69 $conditions = array('News.status'=>1, 'News.id'=>$new_id); 70 71 $fields = array('News.id','News.title','News.comments', 'News.body', 'News.created', 'News.reference', 'News.theme_id', 'News.user_id', 'Theme.img', 'Theme.theme', 'User.username'); 72 73 $this->set('data', $this->News->find($conditions, $fields, null, 2)); 74 75 $this->Portal->statics(); // Charge Portal components aka Sidebars 76 } 76 77 77 78 /** -
trunk/app/models/discussion.php
r407 r537 11 11 public $name = 'Discussion'; 12 12 13 public $belongsTo = array('News' =>13 /* public $belongsTo = array('News' => 14 14 array('className' => 'News', 15 15 'conditions' => null, … … 21 21 'finderQuery' => '' 22 22 ) 23 ); 23 ); */ 24 24 25 25 public $validate = array( -
trunk/app/models/news.php
r535 r537 20 20 'Theme' => array( 21 21 'className' => 'Theme', 22 'foreignKey' => 'theme_id' 22 'foreignKey' => 'theme_id' 23 23 ) 24 24 ); … … 26 26 public $hasMany = array( 27 27 'Discussion' => array( 28 'className' => 'Discussion', 29 'foreignKey' => 'new_id' 30 ) 31 ); 28 'className' => 'Discussion', 29 'foreignKey' => 'new_id', 30 'conditions' => 'Discussion.status = 1' 31 ) 32 ); 32 33 33 34 public $validate = array( -
trunk/app/models/theme.php
r535 r537 2 2 /** 3 3 * Karamelo E-Learning Platform 4 * Manuel Montoya 2002-200 75 * Chipotle Software 6 * GPLv3 manuel< at>mononeurona.org4 * Manuel Montoya 2002-2008 5 * Chipotle Software tm 6 * GPLv3 manuel<ARROBA>mononeurona<PUNTO>org 7 7 */ 8 class Theme extends AppModel 9 { 8 class Theme extends AppModel { 9 10 10 public $name = 'Theme'; 11 11 12 public $hasMany = array(12 /* public $hasMany = array( 13 13 "News" => array( 14 14 "className" => "News", 15 15 "foreignKey" => "theme_id" 16 )); 16 )); */ 17 17 18 18 public $validate = array( -
trunk/app/views/discussions/admin_listing.ctp
r529 r537 1 1 <?php 2 die(debug($data));2 //die(debug($data)); 3 3 echo $html->addCrumb('Control Tools', '/admin/news/start'); 4 4 echo $html->addCrumb('Comments', '/admin/comments/listing'); … … 8 8 9 9 foreach ($data as $val): 10 $tmp = $html->link($val['Discussion']['title'], '/users/entry/'. $cU['User']['username'] . '/'.$val['Discussion']['id']) . '<br />'; 11 $tmp .= $val['Comment']['created'].' <b>'.$val['Comment']['username'].' wrote:</b><br />'; 12 $tmp .= $html->para(null, $val['Comment']['comment']); 13 $tmp .= $gags->confirmDel($val['Comment']['id'], 'Comment'); 14 echo $html->div(null, $tmp); 10 $st = ( $val['Discussion']['status'] == 1 ) ? 'Published' : 'Non published'; 11 $tmp = $html->link($val['News']['title'], '/news/view/'.$val['News']['id']) . '<br />'; 12 $tmp .= $val['Discussion']['created'].' <b>'.$val['Discussion']['username'].' wrote:</b><br />'; 13 $tmp .= $html->para(null, $val['Discussion']['comment']); 14 $tmp .= $html->para(null, $html->link($st, '/admin/discussions/change/'.$val['Discussion']['id'].'/'.$val['Discussion']['status'])); 15 $tmp .= $gags->confirmDel($val['Discussion']['id'], 'Discussion'); 16 echo $html->div('grayblock', $tmp); 15 17 endforeach; 16 18 ?> 17 -
trunk/app/views/news/view.ctp
r497 r537 1 1 <?php 2 // die(debug($data)); 2 3 echo $html->div('titnew', $data['News']['title']); 3 4 … … 8 9 <?php 9 10 10 echo $html->div('img_new', $html->link(11 echo $html->div('img_new', $html->link( 11 12 $html->image('themes/'.$data['Theme']['img'], 12 13 array("alt"=>$data['Theme']['theme'], "title"=>$data['Theme']['theme'], "class"=>"themes")), … … 14 15 null, null, false)); 15 16 16 echo $data['News']['body'];17 echo $data['News']['body']; 17 18 ?> 18 19 … … 43 44 foreach($data['Discussion'] as $v) 44 45 { 45 $bg = ($i%2==0) ? "#e2e2e2" : "#fff"; 46 47 echo '<div class="comentnew" style="background-color:'.$bg.'">'; 48 echo $time->timeAgoInWords($v['created']) . ' <b>'. $v['username'] . '</b> wrote:<br />'; 49 echo $v["comment"]; 50 echo "</div>"; 46 $bg = ($i%2 == 0) ? "#e2e2e2" : "#fff"; 47 48 $tmp = $html->para(null,$time->timeAgoInWords($v['created']) . ' <b>'. $v['username'] . '</b> wrote:<br />', array('style'=>'font-size:8pt;font-family:Georgia;')); 49 $tmp .= $html->para(null, $v['comment']); 50 echo $html->div('divblock', $tmp, array('style'=>'background-color:'.$bg)); 51 51 $i++; 52 52 } -
trunk/app/webroot/img/themes
-
Property
svn:ignore set
to
*
-
Property
svn:ignore set
to
