Changeset 452
- Timestamp:
- 05/04/08 23:49:32 (8 months ago)
- Location:
- trunk/app
- Files:
-
- 4 modified
-
config/sql/postgresql/webquests.sql (modified) (1 diff)
-
models/vclassroom.php (modified) (2 diffs)
-
models/webquest.php (modified) (2 diffs)
-
views/vclassrooms/admin_record.ctp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/config/sql/postgresql/webquests.sql
r436 r452 14 14 "user_id" int REFERENCES users(id) ON DELETE CASCADE, 15 15 "status" smallint NOT NULL DEFAULT 0, 16 " value" smallint NOT NULL DEFAULT 10,16 "points" smallint NOT NULL DEFAULT 10, 17 17 "karanet" smallint NOT NULL DEFAULT 0 -- share karanet? 18 18 ); -
trunk/app/models/vclassroom.php
r451 r452 85 85 ) 86 86 ); 87 public $validate = array( 88 'name' => VALID_NOT_EMPTY, 89 'user_id' => VALID_NOT_EMPTY, 90 'status' => VALID_NOT_EMPTY 91 ); 87 92 88 // get student record 93 /** 94 * Get student record, return array 95 * 96 * @param integer $user_id description 97 * @param integer $vclassroom_id description 98 * @return array $record description 99 * @access public 100 * @author author Manuel Montoya 101 **/ 89 102 public function getRecord($user_id, $vclassroom_id) 90 103 { 91 $record = (string) ''; 92 93 $conditions = array('Result.vclassroom_id'=>$vclassroom_id, 'Result.user_id'=>$user_id); 94 $fields = array('Result.percentage', 'Test.title'); //null; 95 $tests = $this->Test->Result->findAll($conditions, $fields); 104 $record = array(); 105 106 $record['user'] = $this->User->find(array('User.id'=>$user_id), array('id', 'username', 'name', 'email')); 107 108 $conditions = array('Result.vclassroom_id'=>$vclassroom_id, 'Result.user_id'=>$user_id); 109 $fields = array('Result.percentage', 'Test.title'); //null; 110 $record['tests'] = $this->Test->Result->findAll($conditions, $fields); 96 111 //die(debug($tests)); 97 foreach ($tests as $t) 98 { 99 $record .= 'Test: ' . $t['Test']['title'] . '<br />'; 100 $record .= 'Percentage: ' . $t['Result']['percentage'] . '<br />'; 101 } 102 103 // $webquests = $this->Webquest->ResultWebquest->findAll($conditions, $fields); 104 112 105 113 $conditions = array('ResultTreasure.vclassroom_id'=>$vclassroom_id, 'ResultTreasure.user_id'=>$user_id); 106 114 $fields = array('ResultTreasure.points', 'Treasure.title'); //null; 107 $treasures = $this->Treasure->ResultTreasure->findAll($conditions, $fields); 108 109 foreach ($treasures as $tr) 110 { 111 $record .= 'Treasure: '. $tr['Treasure']['title'] . '<br />'; 112 $record .= 'Points: ' . $tr['ResultTreasure']['points'] . '<br />'; 113 } 114 115 $conditions = array('Topic.vclassroom_id'=>$vclassroom_id, 'Topic.user_id'=>$user_id); 116 $fields = array('Forum.title', 'Topic.subject'); //null; 117 $topics = $this->Forum->Topic->findAll($conditions, $fields); 118 119 $num_topics = (int) 0; 120 121 foreach ($topics as $p) 122 { 123 $record .= 'Forum: '. $p['Forum']['title'] . '<br />'; 124 $num_topics++; 125 } 126 127 $record .= 'Participations on Forums: ' . $num_topics . '<br />'; 128 115 $record['treasures'] = $this->Treasure->ResultTreasure->findAll($conditions, $fields); 116 117 $conditions = array('Topic.vclassroom_id'=>$vclassroom_id, 'Topic.user_id'=>$user_id); 118 $fields = array('Forum.title', 'Topic.subject'); //null; 119 $record['topics'] = $this->Forum->Topic->findAll($conditions, $fields); 120 129 121 $conditions = array('Participation.vclassroom_id'=>$vclassroom_id, 'Participation.user_id'=>$user_id); 130 $fields = array('Participation.title', 'Participation.points'); //null; 131 132 $participations = $this->Participation->findAll($conditions, $fields); 133 134 $points = (int) 0; 135 136 foreach ($participations as $pr) 137 { 138 $record .= 'Part title: '. $pr['Participation']['title'] . ' Points '. $pr['Participation']['points'] .'<br />'; 139 $points += $pr['Participation']['points']; 140 } 141 $record .= ' Total participation points: '. $points .'<br />'; 142 // die(debug($treasures)); 122 $fields = array('Participation.title', 'Participation.id', 'Participation.points'); //null; 123 124 $record['participations'] = $this->Participation->findAll($conditions, $fields); 125 126 $conditions = array('ResultWebquest.vclassroom_id'=>$vclassroom_id, 'ResultWebquest.user_id'=>$user_id); 127 $fields = array('Webquest.title', 'Webquest.id', 'ResultWebquest.points'); //null; 128 129 $record['webquests'] = $this->Webquest->ResultWebquest->findAll($conditions, $fields); 130 131 //die(debug($record)); 143 132 return $record; 144 133 } 145 146 //Check if the user already exist in the classroom 134 /** 135 * Get student evaluation, return integer 136 * 137 * @param integer $user_id description 138 * @param integer $vclassroom_id description 139 * @return array $record description 140 * @access public 141 * @author author Manuel Montoya 142 **/ 143 public function getEval($user_id, $vclassroom_id) 144 { 145 return $record; 146 } 147 /** 148 * Check if the student already exist in the classroom 149 * 150 * @param integer $user_id description 151 * @param integer $vclassroom_id description 152 * @return boolean description 153 * @access public 154 * @author author Manuel Montoya 155 **/ 147 156 public function chkMember($vclassroom_id, $user_id) 148 157 { … … 188 197 } 189 198 190 public $validate = array(191 'name' => VALID_NOT_EMPTY,192 'user_id' => VALID_NOT_EMPTY,193 'status' => VALID_NOT_EMPTY194 );195 196 199 /** 197 200 * Adds a join record between two records of a hasAndBelongsToMany association -
trunk/app/models/webquest.php
r416 r452 12 12 public $belongsTo = 'User'; 13 13 14 public $hasMany = array( 15 'ResultWebquest' => 16 array('className' => 'ResultWebquest', 17 'conditions' => null, 18 'order' => null, 19 'limit' => null, 20 'foreignKey' => 'webquest_id', 21 'dependent' => true, 22 'exclusive' => false, 23 'finderQuery' => null 24 )); 14 25 15 26 public $hasAndBelongsToMany = array('Vclassroom' => … … 29 40 'title' => VALID_NOT_EMPTY, //'/[a-z0-9\_\-]{3,}$/i', 30 41 'user_id' => VALID_NOT_EMPTY, 31 'introduction' => VALID_NOT_EMPTY 42 'introduction' => VALID_NOT_EMPTY, 43 'points' => VALID_NOT_EMPTY 32 44 ); 33 45 } -
trunk/app/views/vclassrooms/admin_record.ctp
r444 r452 2 2 //die(debug($data)); 3 3 4 echo $html->div(null, $data); 4 echo $html->div(null, $data['user']['User']['name'] .' '. $html->link($data['user']['User']['email'], $data['user']['User']['email'])); 5 6 echo $html->div(null, $html->link('Compose message', '/admin/message/compose/'.$data['user']['User']['id'])); 5 7 8 $record = (string) ''; 9 10 if ( count($data['tests']) > 0 ) 11 { 12 foreach ($data['tests'] as $t) 13 { 14 $record .= 'Test: ' . $t['Test']['title'] . ' Percentage: ' . $t['Result']['percentage'] . '<br />'; 15 } 16 } 17 else 18 { 19 $record .= $html->para(null, 'No tests found'); 20 } 21 22 // Webquests 23 if ( count($data['webquests']) > 0 ) 24 { 25 foreach ($data['webquests'] as $w) 26 { 27 $record .= 'Webquests: '. $p['Webquest']['title'] . '<br />'; 28 } 29 } 30 else 31 { 32 $record .= $html->para(null, 'No webquests found'); 33 } 34 35 // treasures 36 if ( count($data['treasures']) > 0 ) 37 { 38 foreach ($data['treasures'] as $tr) 39 { 40 $record .= 'Treasure: '. $tr['Treasure']['title'] . ' Points: ' . $tr['ResultTreasure']['points'] . '<br />'; 41 } 42 } 43 else 44 { 45 $record .= $html->para(null, 'No treasures found'); 46 } 47 48 // Topics on forums 49 if ( count($data['topics']) > 0 ) 50 { 51 $num_topics = (int) 0; 52 53 foreach ($data['topics'] as $p) 54 { 55 $record .= 'Forum: '. $p['Forum']['title'] . '<br />'; 56 $num_topics++; 57 } 58 } 59 else 60 { 61 $record .= $html->para(null, 'No topic found'); 62 } 63 64 echo $html->div(null, $record); 6 65 ?>
