Changeset 494
- Timestamp:
- 05/16/08 01:20:37 (5 months ago)
- Location:
- trunk/app
- Files:
-
- 1 added
- 4 modified
-
controllers/components/portal.php (modified) (3 diffs)
-
models/vclassroom.php (modified) (1 diff)
-
views/elements/studentclass.ctp (added)
-
views/layouts/portal.ctp (modified) (2 diffs)
-
views/users/edit.ctp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/components/portal.php
r289 r494 14 14 App::import('Model', 'Banner'); 15 15 App::import('Model', 'User'); 16 16 App::import('Model', 'Vclassroom'); 17 17 18 class PortalComponent extends Object { 18 19 19 20 public function startup(&$controller) 20 21 { … … 26 27 public function statics() 27 28 { 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 32 35 $this->controller->set('Element', $Element); 33 36 34 37 return true; 35 38 } 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 37 50 private function lastEntries() { 38 51 … … 47 60 $this->Entry = new Entry; 48 61 49 return $this->Entry->findAll($conditions, $fields, $order, $limit); 50 62 return $this->Entry->findAll($conditions, $fields, $order, $limit); 51 63 } 52 64 -
trunk/app/models/vclassroom.php
r477 r494 140 140 return $record; 141 141 } 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 142 170 /** 143 171 * Get class (group) record -
trunk/app/views/layouts/portal.ctp
r489 r494 40 40 array('alt'=>'Messages', 'title'=>'Messages')), 41 41 '/messages/listing', null, null, false) . ' | '; 42 42 43 endif; 43 44 44 45 45 else: … … 63 63 <!-- end content --> 64 64 <div id="sidebar"> 65 <?php 66 65 <?php 67 66 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 68 73 69 74 if ( isset( $cU['User']['id']) ) -
trunk/app/views/users/edit.ctp
r493 r494 1 <script type="text/javascript"> 2 window.onload = timedMsg; 3 </script> 1 4 <?php 5 6 $session->flash(); 7 2 8 //die( var_dump( $this->data ) ); 3 9
