Changeset 444

Show
Ignore:
Timestamp:
05/01/08 23:19:28 (8 months ago)
Author:
aarkerio
Message:

Add new tables for students result

Location:
trunk/app
Files:
4 added
5 modified

Legend:

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

    r436 r444  
    44 message text NOT NULL, 
    55 created timestamp(0) with time zone DEFAULT now() NOT NULL, 
    6  forum_id integer NOT NULL REFERENCES forums(id) ON DELETE CASCADE, 
     6 forum_id int NOT NULL REFERENCES forums(id) ON DELETE CASCADE, 
     7 vclassroom_id int NOT NULL REFERENCES vclassrooms(id) ON DELETE CASCADE, -- just one facility to create student's reports 
    78 user_id integer NOT NULL REFERENCES users(id) ON DELETE CASCADE, 
    8  status int NOT NULL DEFAULT 1, 
    9  views int NOT NULL DEFAULT 0  -- number of times the topic has been seen 
     9 status smallint NOT NULL DEFAULT 1, 
     10 views smallint NOT NULL DEFAULT 0  -- number of times the topic has been seen 
    1011); 
    1112 
  • trunk/app/controllers/vclassrooms_controller.php

    r443 r444  
    264264 public function admin_record($student_id, $vclassroom_id)  
    265265 { 
     266    $this->layout    = 'admin'; 
     267    $this->pageTitle = 'Student Record'; 
     268     
    266269    $record = $this->Vclassroom->getRecord($student_id, $vclassroom_id); 
    267  
     270     
    268271    $this->set('data', $record); 
    269272 } 
  • trunk/app/models/forum.php

    r388 r444  
    1616                                           'order'      => 'id ASC', 
    1717                                           'fields'     => null 
    18                                            )); 
     18                                           ), 
     19            'Participation' =>  
     20                                     array('className'  => 'Participation',  
     21                                           'foreignkey' => 'forum_id', 
     22                                           'conditions' =>  null, 
     23                                           'order'      => 'id ASC', 
     24                                           'fields'     => null 
     25                                           ) 
     26                     ); 
     27 
    1928public $belongsTo = array('Catforum' =>  
    2029                                     array('className' => 'Catforum',  
  • trunk/app/models/vclassroom.php

    r443 r444  
    7878                         ) 
    7979                       ); 
    80  
     80  
    8181 // get student record 
    8282 public function getRecord($user_id, $vclassroom_id) 
    83  { 
     83 {    
    8484     $record     = (string) ''; 
    85  
     85      
    8686     $conditions = array('Result.vclassroom_id'=>$vclassroom_id, 'Result.user_id'=>$user_id); 
    8787     $fields     = array('Result.percentage', 'Test.title'); //null; 
     
    9090     foreach ($tests as $t)  
    9191     { 
    92        $record .= $t['Test']['title']; 
    93        $record .= 'Percentage: ' . $t['Result']['percentage'];   
     92     $record .= 'Test: ' . $t['Test']['title'] . '<br />'; 
     93         $record .= 'Percentage: ' . $t['Result']['percentage'] . '<br />'; 
    9494     } 
    95       
    9695      
    9796     // $webquests  = $this->Webquest->ResultWebquest->findAll($conditions, $fields); 
     
    101100     $treasures  = $this->Treasure->ResultTreasure->findAll($conditions, $fields); 
    102101      
    103      foreach ($tests as $t)  
     102     foreach ($treasures as $tr)  
    104103     { 
    105        $record .= $t['Test']['title']; 
    106        $record .= 'Percentage: ' . $t['Result']['percentage'];   
     104       $record .= 'Treasure: '. $tr['Treasure']['title'] . '<br />'; 
     105       $record .= 'Points: ' . $tr['ResultTreasure']['points'] . '<br />'; 
    107106     } 
     107      
     108     $conditions  = array('Topic.vclassroom_id'=>$vclassroom_id, 'Topic.user_id'=>$user_id); 
     109     $fields      = array('Forum.title', 'Topic.subject'); //null; 
     110     $topics      = $this->Forum->Topic->findAll($conditions, $fields); 
     111      
     112     $participations = (int) 0; 
     113      
     114     foreach ($topics as $p)  
     115     { 
     116       $record .= 'Forum: '. $p['Forum']['title'] . '<br />'; 
     117       $participations++; 
     118     } 
     119      
     120     $record .= 'Participations on Forums: ' . $participations . '<br />'; 
    108121     // die(debug($treasures)); 
    109122     return $record; 
  • trunk/app/views/vclassrooms/admin_record.ctp

    r442 r444  
    11<?php 
    2 die(debug($data)); 
     2//die(debug($data)); 
    33 
    4  
     4echo $html->div(null, $data); 
    55 
    66?>