Changeset 640

Show
Ignore:
Timestamp:
07/10/08 22:51:44 (3 months ago)
Author:
aarkerio
Message:

Updates genrali

Location:
trunk/app
Files:
7 modified

Legend:

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

    r627 r640  
    4444 {       
    4545  // student belongst to this class? 
    46   if ( $this->Auth->user() && $this->Auth->user('group_id') == 3): 
     46  if ( $this->Auth->user() ): 
    4747             $this->set('belongs', $this->Forum->Vclassroom->belongs($this->Auth->user('id'), $vclassroom_id)); 
    4848  else: 
  • trunk/app/controllers/topics_controller.php

    r564 r640  
    2525 public function display($user_id, $forum_id, $topic_id) 
    2626 {   
    27    $this->pageTitle = 'Discussion'; 
     27  $this->pageTitle = __('Discussion', true); 
    2828      
    29    $this->layout    = $this->Edublog->layout($user_id); 
     29  $this->layout    = $this->Edublog->layout($user_id); 
    3030      
    31    $this->Edublog->blog($user_id); 
    32       
     31  $this->Edublog->blog($user_id); 
     32    
     33  $vclassroom_id = $this->Topic->Forum->field('vclassroom_id', array('Forum.id'=>$forum_id)); 
     34  // student belongst to this class? 
     35  if ( $this->Auth->user() ): 
     36             $this->set('belongs', $this->Topic->Forum->Vclassroom->belongs($this->Auth->user('id'), $vclassroom_id)); 
     37  else: 
     38             $this->set('belongs', false); 
     39  endif; 
     40   
    3341   $conditions = array("Topic.status"=>1, "Topic.id"=>$topic_id); 
    3442   $fields     = null; 
     
    3846   $this->Topic->Forum->unbindModel(array('hasMany'=>array('Topic'))); 
    3947   $data =  $this->Topic->find($conditions, $fields, $order, 2); 
    40    //die(debug($data)); 
     48    
    4149   $this->set('data',$data); 
    4250 
  • trunk/app/controllers/vclassrooms_controller.php

    r624 r640  
    7171    
    7272   // student belongs to this class? 
    73    if ( $this->Auth->user() && $this->Auth->user('group_id') == 3): 
     73   if ( $this->Auth->user()): 
    7474             $this->set('belongs', $this->Vclassroom->belongs($this->Auth->user('id'), $vclassroom_id)); 
    7575   else: 
  • trunk/app/models/vclassroom.php

    r619 r640  
    2020 
    2121  public $hasMany = array('Forum' => 
    22                array('className'     => 'Forum', 
     22                array('className'     => 'Forum', 
    2323                 'conditions'    => null, 
    2424                 'order'         => null, 
     
    509509 */ 
    510510 public function belongs($user_id, $vclassroom_id) 
    511  {  
    512    $conditions =  array("UsersVclassroom.user_id"=>$user_id, "UsersVclassroom.vclassroom_id"=>$vclassroom_id); 
     511 { 
     512   $conditions =  array('Vclassroom.id'=>$vclassroom_id); 
     513 
     514   $teacher_id  =  $this->field('Vclassroom.user_id',$conditions); 
     515    
     516   if ($teacher_id == $user_id ):    // teacher wnats to see his/her own vclass 
     517          return true; 
     518   endif; 
     519 
     520   $conditions =  array('UsersVclassroom.user_id'=>$user_id, 'UsersVclassroom.vclassroom_id'=>$vclassroom_id); 
    513521 
    514522   $data       =  $this->UsersVclassroom->field('UsersVclassroom.user_id',$conditions); 
  • trunk/app/views/elements/lastentries.ctp

    r240 r640  
    11<?php 
    2 echo $html->image('static/blogactiv.gif', array("alt"=>"Teachers Blogging", "title"=>"Teachers Blogging", "style"=>"margin-right:5px 0 10px 0")); 
     2if ( count($Element['Lentry']) > 0): 
     3  echo $html->image('static/blogactiv.gif',array("alt"=>"Teachers Blogging", "title"=>"Teachers Blogging", "style"=>"margin-right:5px 0 15px 0")); 
     4endif; 
    35 
    4 echo  "<br />"; 
    5  
    6 foreach ($Element["Lentry"] as $key => $val)  
    7 { 
    8       echo '<div style="margin-top:3px;padding-left:2px;">' . $html->link($val['Entry']['title'], '/users/entry/'.$val['User']['username'].'/'.$val['Entry']['id']) . " "; 
    9       echo '<span style="font-size:6pt">'.$val['User']['username'].'</span></div>'; 
    10 } 
     6foreach ($Element['Lentry'] as $val): 
     7    echo $html->div(null, $html->link($val['Entry']['title'],  
     8                          '/entries/view/'.$val['User']['username'].'/'.$val['Entry']['id']) .  
     9                           ' <span style="font-size:6pt">'.$val['User']['username'].'</span>',  
     10                           aa('style', 'margin-top:4px;padding-left:2px') 
     11                    ); 
     12endforeach; 
    1113?> 
  • trunk/app/views/entries/display.ctp

    r635 r640  
    2222endforeach; 
    2323 
    24 $paginator->options(array('url' => $val['User']['username'])); 
     24$paginator->options(array('url' => $blog['User']['username'])); 
    2525 
    2626$t  = $html->div(null,$paginator->prev('« Previous ',null,null,array('class'=>'disabled')),array('style'=>'width:100px;float:left')); 
  • trunk/app/views/topics/display.ctp

    r562 r640  
    1212echo $html->para(null, '<b>Discussion topic:</b> '.$data['Topic']['message']); 
    1313 
    14 if ( $session->check('Auth.User') ): 
     14if ( $belongs === true ): 
    1515/* 
    1616 $tmp = $html->link(  // add topic 
     
    4949 $int = 1; 
    5050 
    51  foreach ($data['Reply'] as $val)  
    52  { 
     51  foreach ($data['Reply'] as $val): 
    5352    $i = $int++; 
    5453        $tmp   = '<b>'.  $i . '.-</b> ';  
     
    6059    echo $html->div('reply', $tmp); 
    6160     
    62  } 
     61  endforeach; 
    6362echo '</div>'; 
    6463