Changeset 494

Show
Ignore:
Timestamp:
05/16/08 01:20:37 (5 months ago)
Author:
aarkerio
Message:

Message interfase

Location:
trunk/app
Files:
1 added
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/controllers/components/portal.php

    r289 r494  
    1414App::import('Model', 'Banner'); 
    1515App::import('Model', 'User'); 
    16   
     16App::import('Model', 'Vclassroom');  
     17 
    1718class PortalComponent extends Object { 
    18   
     19 
    1920 public function startup(&$controller)  
    2021 { 
     
    2627 public function statics()  
    2728 { 
    28      $Element["Lentry"]      = $this->lastEntries(); 
    29      $Element["Quote"]       = $this->randomQuote(); 
    30      $Element["rankLessons"] = $this->rankLessons(); 
    31      $Element["Poll"]        = $this->poll(); 
     29     $Element['Lentry']       = $this->lastEntries(); 
     30     $Element['Quote']        = $this->randomQuote(); 
     31     $Element['rankLessons']  = $this->rankLessons(); 
     32     $Element['Poll']         = $this->poll(); 
     33     $Element['Vclassrooms']  = $this->vclassrooms(); 
     34 
    3235     $this->controller->set('Element', $Element); 
    3336 
    3437     return true; 
    3538 } 
    36   
     39 
     40 private function vclassrooms()  
     41 { 
     42   if ( $this->controller->Auth->user() && $this->controller->Auth->user('group_id') == 3): 
     43           $this->Vclassroom = new Vclassroom; 
     44           return $this->Vclassroom->getList( $this->controller->Auth->user('id') ); 
     45   else: 
     46           return null; 
     47   endif; 
     48 } 
     49 
    3750 private function lastEntries() { 
    3851    
     
    4760   $this->Entry = new Entry; 
    4861    
    49    return $this->Entry->findAll($conditions, $fields, $order, $limit); 
    50   
     62   return $this->Entry->findAll($conditions, $fields, $order, $limit);  
    5163 } 
    5264  
  • trunk/app/models/vclassroom.php

    r477 r494  
    140140     return $record; 
    141141 } 
     142/* 
     143*  build a list containing vclassrooms to wich the stundent belongs to, used in portal component to display select   
     144*  int  user_id 
     145*  return  array 
     146*/ 
     147 public function getList($user_id) 
     148 {    
     149  $record     = array(); 
     150  $conditions = array('UsersVclassroom.user_id'=>$user_id); 
     151  $fields     = array('vclassroom_id'); 
     152  $data       = $this->UsersVclassroom->findAll($conditions, $fields);             
     153   
     154  if ( $data == false): 
     155      return false; 
     156  else: 
     157      $fields     = array('id', 'name', 'user_id'); 
     158      foreach ( $data as $v): 
     159        $conditions = array('Vclassroom.id'=>$v['UsersVclassroom']['vclassroom_id']); 
     160        $this->unbindAll(); 
     161        $tmp = $this->find($conditions, $fields); 
     162       
     163        array_push($record, $tmp);  
     164      endforeach; 
     165  endif; 
     166   
     167  return $record; 
     168 } 
     169 
    142170 /** 
    143171 *  Get class (group) record 
  • trunk/app/views/layouts/portal.ctp

    r489 r494  
    4040                                                                                  array('alt'=>'Messages', 'title'=>'Messages')),  
    4141                                                                          '/messages/listing', null, null, false) . ' | '; 
     42 
    4243   endif; 
    43  
    4444 
    4545 else: 
     
    6363    <!-- end content --> 
    6464    <div id="sidebar"> 
    65 <?php  
    66      
     65<?php 
    6766   echo $this->renderElement('menu_b'); 
     67    
     68   // if student logged in, show groups 
     69   if ( isset($cU['User']) && $cU['User']['group_id'] == 3 && $Element['Vclassrooms'] != false): 
     70           echo $this->renderElement('studentclass', $Element['Vclassrooms']); 
     71   endif;     
     72 
    6873   
    6974   if ( isset( $cU['User']['id']) ) 
  • trunk/app/views/users/edit.ctp

    r493 r494  
     1<script type="text/javascript"> 
     2   window.onload = timedMsg; 
     3</script> 
    14<?php  
     5 
     6$session->flash();  
     7 
    28//die( var_dump( $this->data ) );  
    39