Changeset 425

Show
Ignore:
Timestamp:
04/24/08 14:44:46 (9 months ago)
Author:
aarkerio
Message:

Tests and answers

Location:
trunk/app
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/app_controller.php

    r407 r425  
    1212class AppController extends Controller { 
    1313  
    14  public $components = array('Auth', 'Cookie', 'Session', 'Security'); 
     14 public $components = array('Auth', 'Cookie', 'Session', 'Security'); // set Security component later 
    1515  
    1616 public $helpers    = array('Html', 'Form', 'Session'); 
  • trunk/app/controllers/results_controller.php

    r422 r425  
    1717  
    1818  public $components    = array('Edublog'); 
    19  
    20   public function beforeFilter()  
     19  
     20   public function isAuthorized()  
     21   { return true; }   
     22/* 
     23    if (isset( $this->params[Configure::read('Routing.admin')] ))  
     24    { 
     25        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 )  // admin and teachers 
     26    { 
     27        return true; 
     28    }  
     29    } 
     30    return false;  // go away !! 
     31  } 
     32*/  
     33  /*public function beforeFilter()  
    2134  { 
    2235    $this->Auth->allow(array('result')); 
    2336    parent::beforeFilter(); 
    24   } 
     37  }*/ 
    2538  
    26   public function isAuthorized()  
    27   {       
    28     if (isset( $this->params[Configure::read('Routing.admin')] ))  
    29       { 
    30         if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 )  // admin and teachers 
    31       { 
    32         return true; 
    33       }  
    34       }  
    35     return false;  // go away !! 
    36   } 
    37  
    3839  public function result() 
    3940  {  
    40     die(debug($this->data)); 
     41    debug($this->data);exit; 
    4142 
    4243    $this->pageTitle = 'Results'; 
     
    4647    $this->Edublog->blog($user_id); // set edublog components 
    4748          
    48     
    4949    $answers = $this->Resukts->Question->findAll($conditions, $fields, $order); 
    5050       
  • trunk/app/views/tests/view.ctp

    r424 r425  
    2222 
    2323  echo $form->create('Result', array('action'=>'result', 'onsubmit'=>'return chkTest()'));  
    24   echo $form->hidden('Result.test_id', array('value'=>$data['Test']['id'])); 
     24// echo $form->hidden('Result.test_id', array('value'=>$data['Test']['id'])); 
    2525 
    2626  foreach ($data['Question'] as $val): 
     
    3333                   $options[$v['id']] = $v['answer']; 
    3434          endforeach; 
    35  
    36           echo $form->radio('Result.'. $val['worth'] .' points, '.$val['question'], $options); 
     35           
     36          echo $form->label('Result.'.$v['id'], $val['worth'] .' points, '.$val['question']);  
     37          echo $form->radio('Result.'.$v['id'], $options); 
    3738 
    3839          echo $html->para(null, $val['hint']); 
     
    5253function chkTest() 
    5354{ 
     55  var formObj = document.getElementById('formid'); 
     56 
     57  for (var i = 1; i <= formObj.num_questions.value; i++)  
     58  { 
     59    radioGroupLength = document.getElementById('A' + i + "_num_responses").value; 
     60 
     61      for(var x = 1; x <= radioGroupLength; x++) 
     62      { 
     63    el = document.getElementById('A' + i + '_' + x); 
     64            
     65    alert('Do The Rest Of Your Checking Here - check if radio is checked, etc'); 
     66      } 
     67    } 
    5468  // set var radio_choice to false 
    5569  var radio_choice = false;