root/trunk/app/views/questions/admin_answers.ctp

Revision 905, 2.8 kB (checked in by aarkerio, 12 days ago)

updayte gags

Line 
1<?php
2//die(debug($data));
3 echo $html->addCrumb('Control Panel', '/admin/entries/start');
4 echo $html->addCrumb(__('Tests', true), '/admin/tests/listing');
5 echo $html->addCrumb($data['Test']['title'], '/admin/tests/questions/'.$data['Test']['id']);
6 echo $html->getCrumbs(' / ');
7
8 echo $html->para(null, __('Answers to', true) .': <b>'. $data['Question']['question'].'</b>');
9
10 echo $gags->imgLoad('loading');
11
12 echo $html->para(null, $html->link($html->image('actions/new.png',array('alt'=>__('Add new', true),'title'=>__('Add new', true))), '#', array("onclick"=>"hU()"), false, false));
13
14?>
15
16<div id="addquestion" style="display:none">
17
18<?php
19   echo $ajax->form();
20   echo $form->hidden('Answer.question_id', array('value'=>$data['Question']['id']));
21 ?>
22<fieldset><legend><?php __('New answer'); ?></legend>
23<?php
24 echo $html->div('required',$form->input('Answer.answer', array('size'=>55, 'maxlength'=>120, 'label'=>__('Answer',true))));
25 echo $html->div('required',$form->label('Answer.correct', __('Answer is correct', true)).$form->checkbox('Answer.correct'));
26 echo $ajax->submit(__('Save', true), array("url" => "/admin/answers/add",
27                                         "update"=>"questions",
28                                         "loading" => "Element.hide('questions');Element.hide('addquestion');Element.show('loading')",
29                                         "complete" => "Element.hide('loading');Effect.Appear('questions');clear();"
30            ));
31 ?>
32</fieldset>
33</div>
34
35<div id="questions">
36<?php
37foreach ($data['Answer'] as $val):
38
39  $st = ($val['correct']==1) ? __('Yes', true) : 'No';     
40  $tmp  = __('Answer', true) .': ' . $val['answer']   . '<br />';
41  $tmp .= __('Correct', true).': ' . $html->link($st, '/admin/answers/change/'.$val['id'].'/'.$val['correct'] .'/'.$val['question_id']) . "<br /><br />";
42  $tmp .= $html->div(null, $html->link($html->image('static/delete_icon.png', array('title'=>__('Delete', true), 'alt'=>__('Delete', true))), '/admin/answers/delete/'.$val['id'].'/'.$val['question_id'], array('onclick'=>"return confirm('".__('Are you sure to want to delete this?', true)."')"), null, false).'&nbsp;&nbsp;&nbsp; '.$html->link($html->image('static/edit_icon.gif', array('title'=>__('Edit', true), 'alt'=>__('Edit', true))), '/admin/answers/edit/'  .$val['id'], null, null, false));
43
44  echo $html->div('adminblock', $tmp);
45endforeach;
46?>
47</div>
48
49<script type="text/javascript"> 
50<!--
51function clear()
52{
53 var answer  = document.getElementById('AnswerAnswer');
54 var correct = document.getElementById('AnswerCorrect');
55 
56 answer.value    = '';
57 correct.checked = false;
58 return true;
59}
60function hU() {
61
62var tr = document.getElementById('addquestion');
63
64  if (tr.style.display == 'none')
65  {
66            tr.style.display = 'block';
67  } else {
68            tr.style.display = 'none';
69  }
70}
71-->
72</script>
Note: See TracBrowser for help on using the browser.