Changeset 451 for trunk/app/models

Show
Ignore:
Timestamp:
05/04/08 00:08:10 (7 months ago)
Author:
aarkerio
Message:

Best podcast

Location:
trunk/app/models
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/models/participation.php

    r444 r451  
    1111     
    1212  public $belongsTo  = array( 
    13              "User" => array( 
    14                              "className"    => "User", 
    15                              "foreignKey"   => "user_id" 
    16                                ),  
    17              "Forum" => array( 
    18                              "className"    => "Forum",   
    19                              "foreignKey"   => "forum_id" 
    20                               ) 
     13                             "User" => array( 
     14                                            "className"    => "User", 
     15                                            "foreignKey"   => "user_id" 
     16                                            ) 
    2117             ); 
    2218     
  • trunk/app/models/vclassroom.php

    r444 r451  
    44*  Manuel Montoya 2002-2008  
    55*  Chipotle Software TM 
    6 *  GPLv3 manuel<at>mononeurona<punto>org 
     6*  GPLv3 manuel<arroba>mononeurona<punto>org 
    77*/  
    88class Vclassroom extends AppModel 
     
    2525                 'offset'        => '', 
    2626                             'counterQuery'  => '' 
     27                 ), 
     28                      'Participation' => 
     29               array('className'     => 'Participation', 
     30                 'conditions'    => null, 
     31                 'order'         => null, 
     32                 'limit'         => null, 
     33                 'foreignKey'    => 'vclassroom_id' 
    2734                 ) 
    2835               ); 
     
    110117     $topics      = $this->Forum->Topic->findAll($conditions, $fields); 
    111118      
    112      $participations = (int) 0; 
     119     $num_topics = (int) 0; 
    113120      
    114121     foreach ($topics as $p)  
    115122     { 
    116123       $record .= 'Forum: '. $p['Forum']['title'] . '<br />'; 
    117        $participations++; 
     124       $num_topics++; 
    118125     } 
    119126      
    120      $record .= 'Participations on Forums: ' . $participations . '<br />'; 
     127     $record .= 'Participations on Forums: ' . $num_topics . '<br />'; 
     128 
     129     $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 />'; 
    121142     // die(debug($treasures)); 
    122143     return $record; 
     
    128149   
    129150   $conditions = array('"UsersVclassroom"."vclassroom_id"'=>$vclassroom_id, '"UsersVclassroom"."user_id"'=>$user_id); 
    130    
     151     
    131152   $data = $this->UsersVclassroom->field('user_id', $conditions); 
    132153