Changeset 452

Show
Ignore:
Timestamp:
05/04/08 23:49:32 (8 months ago)
Author:
aarkerio
Message:

Best podcast

Location:
trunk/app
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/config/sql/postgresql/webquests.sql

    r436 r452  
    1414  "user_id" int REFERENCES users(id) ON DELETE CASCADE, 
    1515  "status" smallint NOT NULL DEFAULT 0, 
    16   "value" smallint NOT NULL DEFAULT 10, 
     16  "points" smallint NOT NULL DEFAULT 10, 
    1717  "karanet" smallint NOT NULL DEFAULT 0  -- share karanet? 
    1818); 
  • trunk/app/models/vclassroom.php

    r451 r452  
    8585                         ) 
    8686                       ); 
     87 public $validate = array( 
     88      'name'    => VALID_NOT_EMPTY, 
     89      'user_id' => VALID_NOT_EMPTY, 
     90      'status'  => VALID_NOT_EMPTY 
     91   ); 
    8792  
    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 **/ 
    89102 public function getRecord($user_id, $vclassroom_id) 
    90103 {    
    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); 
    96111     //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     
    105113     $conditions = array('ResultTreasure.vclassroom_id'=>$vclassroom_id, 'ResultTreasure.user_id'=>$user_id); 
    106114     $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      
    129121     $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)); 
    143132     return $record; 
    144133 } 
    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 **/ 
    147156 public function chkMember($vclassroom_id, $user_id) 
    148157 {  
     
    188197 } 
    189198 
    190  public $validate = array( 
    191       'name'    => VALID_NOT_EMPTY, 
    192       'user_id' => VALID_NOT_EMPTY, 
    193       'status'  => VALID_NOT_EMPTY 
    194    ); 
    195  
    196199  /** 
    197200   * Adds a join record between two records of a hasAndBelongsToMany association 
  • trunk/app/models/webquest.php

    r416 r452  
    1212    public $belongsTo   = 'User'; 
    1313     
     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                    )); 
    1425 
    1526    public $hasAndBelongsToMany = array('Vclassroom' => 
     
    2940      'title' => VALID_NOT_EMPTY,         //'/[a-z0-9\_\-]{3,}$/i', 
    3041      'user_id' => VALID_NOT_EMPTY, 
    31       'introduction' => VALID_NOT_EMPTY 
     42      'introduction' => VALID_NOT_EMPTY, 
     43      'points' => VALID_NOT_EMPTY 
    3244   ); 
    3345} 
  • trunk/app/views/vclassrooms/admin_record.ctp

    r444 r452  
    22//die(debug($data)); 
    33 
    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'])); 
    57 
     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);   
    665?>