Changeset 756

Show
Ignore:
Timestamp:
09/04/08 19:34:27 (3 months ago)
Author:
aarkerio
Message:

New layout

Location:
trunk/app
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/controllers/vclassrooms_controller.php

    r753 r756  
    209209 
    210210   $this->set('group',$this->Vclassroom->find($conditions, $fields)); 
    211  
    212211   $this->set('data', $this->Vclassroom->recordClass($vclassroom_id)); 
    213212 } 
  • trunk/app/models/vclassroom.php

    r753 r756  
    256256   $users      = array(); 
    257257   $records    = array(); 
    258     
    259258   $data  = $this->UsersVclassroom->findAll(array('UsersVclassroom.vclassroom_id'=>$vclassroom_id), array('user_id')); 
    260    
    261259   //die(debug($data));    
    262260   foreach ($data as $u): 
    263  
    264261     $this->User->removeBinds();  // remove innecesaries user binds 
    265262      
    266      $user_id = $u['UsersVclassroom']['user_id']; 
     263     $user_id = (int) $u['UsersVclassroom']['user_id']; 
    267264 
    268265     $conditions        = array('User.id'=>$user_id); 
    269266     $fields            = array('User.name', 'User.email'); //null; 
    270267     $records[$user_id] = $this->User->find($conditions, $fields); 
    271    
    272      // Test result      
    273      $conditions        = array('Result.vclassroom_id'=>$vclassroom_id, 'Result.user_id'=>$user_id); 
    274      $fields            = array('Result.correct', 'Test.title');  //null; 
    275      $records[$user_id]['tests']   = $this->Test->Result->findAll($conditions, $fields); 
    276      //die(debug($records)); 
    277      
     268     // Consult Test Model associated to this Vclassroom 
     269     $this->TestsVclassroom->bindModel(array('belongsTo'=>array('Test'))); 
     270     $conditions        = array('TestsVclassroom.vclassroom_id'=>$vclassroom_id); 
     271     $fields            = array('TestsVclassroom.test_id', 'TestsVclassroom.id', 'Test.title');  
     272     $tests             = $this->TestsVclassroom->findAll($conditions, $fields); 
     273 
     274     // foreach test check in Result model 
     275     foreach($tests as $k => $t): 
     276       $records[$user_id]['tests'][$k]['Test']['points'] = $this->Test->getPoints($t['TestsVclassroom']['test_id'], $user_id, $vclassroom_id); 
     277       $records[$user_id]['tests'][$k]['Test']['title']  = $t['Test']['title'];  
     278     endforeach; 
     279      
    278280     $conditions = array('ResultTreasure.vclassroom_id'=>$vclassroom_id, 'ResultTreasure.user_id'=>$user_id); 
    279281     $fields     = array('ResultTreasure.points', 'Treasure.title'); //null; 
  • trunk/app/views/helpers/fpdf.php

    r476 r756  
    2121  {  
    2222    $this->pdf = new myFPDF($orientation, $unit, $format); 
    23     $this->pdf->SetFont('Arial','B',14); 
     23    $this->pdf->SetFont('Arial','B',10); 
    2424  } 
    2525    
     
    2727  { 
    2828    $string  =  utf8_decode($data);  // UTF-8 
    29     $this->pdf->Cell(0,5,$string,1,1,'L'); 
    30     $this->pdf->Ln(5); 
     29    $this->pdf->Cell(0,2,$string,0,1,'L'); 
     30    $this->pdf->Ln(2); 
    3131  } 
    3232 
  • trunk/app/views/vclassrooms/admin_export.ctp

    r729 r756  
    11<?php 
    22//die(debug($data)); 
    3  foreach ($data as $u): 
    4      
     3 foreach ($data as $u):     
    54  $fpdf->newPage(); 
    65 
    7   $fpdf->setData('Group: ' . $group['Vclassroom']['name'] . '. Created '.$group['Vclassroom']['created']); 
    8   $fpdf->setData('Student '. $u['User']['name'] . ' '.$u['User']['email']); 
     6  $fpdf->setData(__('Group', true).': ' . $group['Vclassroom']['name'] . '. Created '.$group['Vclassroom']['created']); 
     7  $fpdf->setData(__('Student', true) . ': '.$u['User']['name'] . ' '.$u['User']['email']); 
    98   
    109  if ( count($u['tests']) > 0 ):   
    11     foreach ($u['tests'] as $te):  
    12          $fpdf->setData($te['Test']['title'] . ', Percentage '.$te['Result']['percentage'].'%'); 
     10    foreach ($u['tests'] as $te): 
     11       if ( $te['Test']['points'] ): 
     12           $fpdf->setData($te['Test']['title'] . ', '.__('Points', true).' '.$te['Test']['points']); 
     13       else: 
     14           $fpdf->setData($te['Test']['title'] . ', '.__('Not answered this test yet', true)); 
     15       endif; 
    1316    endforeach; 
    1417  else: 
     
    1821  if ( count($u['treasures']) > 0 ): 
    1922    foreach ($u['treasures'] as $t): 
    20       $fpdf->setData($t['Treasure']['title'] . ', Points '.$t['ResultTreasure']['points']); 
     23      $fpdf->setData($t['Treasure']['title'] . ', '.__('Points', true).' '.$t['ResultTreasure']['points']); 
    2124    endforeach; 
    2225  else: 
  • trunk/app/views/vclassrooms/admin_listing.ctp

    r755 r756  
    66 echo $html->div('title_section', __('vGroups', true)); 
    77 
    8  echo $html->link($html->image('actions/new.png', array("alt"=>"Add classroom", "title"=>"Add classroom")), '/admin/ecourses/listing', null, null, false);  
     8 echo $html->link($html->image('actions/new.png', array('alt'=>__('Add new', true), 'title'=>__('Add new', true))), '/admin/ecourses/listing', null, null, false);  
    99?> 
    1010<table class="tbadmin"> 
    1111<?php 
    12  
    1312$th = array(__('Edit', true), 'Virtual classroom', 'Status', __('See vGroup', true)); 
    1413echo $html->tableHeaders($th);   
    1514foreach ($data as $val): 
    1615        
    17   $st = ( $val['Vclassroom']['status'] == 1 ) ? 'Enabled' : 'Filed';     
     16  $st = ( $val['Vclassroom']['status'] == 1 ) ? __('Enabled', true) : __('Filed', true);     
    1817  $tr = array ( 
    1918        $gags->sendEdit($val['Vclassroom']['id'], 'vclassrooms'), 
    2019        $html->link($val['Vclassroom']['name'], '/admin/vclassrooms/members/'.$val['Vclassroom']['id']) . ' <span class="petit">'.$val['Ecourse']['title'].'</span>', 
    2120        $st, 
    22         $html->link($html->image('static/user-group-icon.jpg', array('width'=>22, 'alt'=>__('See vGroup', true), 'title'=>__('See vGroup', true))), '/vclassrooms/show/'.$val['Vclassroom']['user_id'].'/'.$val['Vclassroom']['id']), null, null, false); 
     21        $html->link( 
     22$html->image('static/user-group-icon.jpg', array('width'=>22, 'alt'=>__('See vGroup', true), 'title'=>__('See vGroup', true))),  
     23'/vclassrooms/show/'.$val['Vclassroom']['user_id'].'/'.$val['Vclassroom']['id'], null, null, false)); 
    2324     
    2425   echo $html->tableCells($tr, array("class"=>"altRow", "onmouseover"=>"this.className='highlight'", "onmouseout"=>"this.className='altRow'"),