Changeset 462

Show
Ignore:
Timestamp:
05/08/08 12:22:20 (8 months ago)
Author:
aarkerio
Message:

Forums and topics improveds

Location:
trunk/app
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/controllers/forums_controller.php

    r461 r462  
    5555 public function display($forum_id)  
    5656 {       
    57         $conditions = array('Forum.id'=>$forum_id, 'Forum.status'=>1); 
    58          
    59         $fields     = array("Forum.title", "Forum.id", "Forum.user_id", "Forum.description", "Forum.catforum_id", "Topic.id");  
    60          
    61         $data       = $this->Forum->find($conditions, null, null, 2); 
    62          
    63         $this->pageTitle = $data['Catforum']['title'] . ' Forum'; 
    64          
    65         $this->set('data', $data); 
    66          
    67         $this->layout    = $this->Edublog->layout($data['Forum']['user_id']); 
    68          
    69         $this->Edublog->blog($data['Forum']['user_id']); // blogger elements 
     57  $conditions = array('Forum.id'=>$forum_id, 'Forum.status'=>1); 
     58         
     59  $fields     = array("Forum.title", "Forum.id", "Forum.user_id", "Forum.description", "Forum.catforum_id","Forum.vclassroom_id");  
     60  $this->Forum->Vclassroom->unbindModel(array('belongsTo'=>array('Ecourse', 'User'), 'hasAndBelongsToMany'=>array('User', 'Test', 'Webquest', 'Treasure'),'hasMany'=>array('Forum', 'Participation'))); 
     61  $this->Forum->Catforum->unbindModel(array('hasMany'=>array('Forum'), 'belongsTo'=>array('User'))); 
     62  $this->Forum->Catforum->User->unbindModel(array('belongsTo'=>array('Group'), 'hasMany'=>array('Lesson', 'Entry'))); 
     63  $this->Forum->Topic->unbindModel(array('belongsTo'=>array('Forum'))); 
     64  $data       = $this->Forum->find($conditions, $fields, null, 2); 
     65 
     66  // $visits     = $this->Forum->Topic->Visitor->findAll(array('Visitor.topic_id'=>));die(debug($visits)); 
     67   $this->pageTitle = $data['Catforum']['title'] . ' Forum'; 
     68         
     69  $this->set('data', $data); 
     70        
     71  $this->layout    = $this->Edublog->layout($data['Forum']['user_id']); 
     72         
     73  $this->Edublog->blog($data['Forum']['user_id']); // blogger elements 
    7074 } 
    7175  
  • trunk/app/views/forums/display.ctp

    r461 r462  
    11<?php 
    22//die(debug($data)); 
    3 echo $html->para(null,  
    4                  'Foro: '.$html->link($data["Catforum"]["title"],  
    5                     '                 /catforums/display/'.$blog["User"]["username"].'/'.$blog["User"]["id"].'/'.$data["Catforum"]["id"] 
    6                                       ) 
    7                ); 
     3 echo $html->div(null, 'Category: ' . $data['Catforum']['title'], array('style'=>'font-weight:bold;')); 
    84 
    95 echo  $html->div('titentry', $data["Forum"]["title"]); 
    106 echo  $html->para(null, $data["Forum"]["description"]); 
    117 
    12   $tmp = $ajax->link($html->image("static/new_post.gif", array("alt"=>"New Topic", "title"=>"New Topic")), '/topics/add/'.$data['Vclassroom']['id'].'/'.$data['Forum']['id'], 
     8  $tmp = $ajax->link($html->image("static/new_post.gif", array("alt"=>"New Topic", "title"=>"New Topic")),  
     9'/topics/add/'.$data['Forum']['vclassroom_id'].'/'.$data['Forum']['id'], 
    1310                                array("update" => "qn", 
    1411                              "loading"=>"Element.show('loading3');", 
     
    4138                   count($val['Reply']), 
    4239                   $val["User"]["username"], 
    43                    $val['views'], 
     40                   count($val['Visitor']), 
    4441                   '<span style="font-size:6pt">'.$time->timeAgoInWords($val["created"]) .'</span>' 
    4542                 ); 
  • trunk/app/views/topics/display.ctp

    r461 r462  
    4242echo '<div style="padding:2px;margin:10px 5px 10px 5px">'; 
    4343  
    44  if ( count($data['Reply']) < 1 ) 
    45  { 
    46      echo '<h2>No replies yet</h2>'; 
    47  } 
     44 if ( count($data['Reply']) < 1 ): 
     45     echo $html->para(null, 'No replies yet', array('style'=>'font-size:16pt;font-weight:bold')); 
     46 endif; 
    4847  
    4948 $int = 1; 
    50   
     49 
    5150 foreach ($data['Reply'] as $val)  
    5251 { 
     
    5655    $tmp  .= $html->link($html->image('avatars/'.$val['User']['avatar'], array('alt'=>$val['User']['username'])),  
    5756                         '/users/about/'.  $val['User']['username'], null, null, false) .'<br />'; 
    58     $tmp  .= $html->image('static/time.png') .'  '. $time->timeAgoInWords($val['created']).'<br /><br />' . $val['reply']; 
     57    $tmp  .= $html->image('static/time.png') .'  '. $time->timeAgoInWords($val['created']).'<br /><br />' . nl2br($val['reply']); 
    5958 
    6059    echo $html->div('reply', $tmp);