Changeset 666 for trunk/app/views/questions
- Timestamp:
- 07/22/08 17:08:42 (4 months ago)
- Location:
- trunk/app/views/questions
- Files:
-
- 3 modified
-
admin_answers.ctp (modified) (3 diffs)
-
admin_edit.ctp (modified) (1 diff)
-
questions.ctp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/views/questions/admin_answers.ctp
r422 r666 1 1 <?php 2 2 //die(debug($data)); 3 echo $html->addCrumb('Control Tools', '/admin/entries/start');4 echo $html->addCrumb( 'Tests', '/admin/tests/listing');3 echo $html->addCrumb('Control Panel', '/admin/entries/start'); 4 echo $html->addCrumb(__('Tests', true), '/admin/tests/listing'); 5 5 echo $html->addCrumb($data['Test']['title'], '/admin/tests/questions/'.$data['Test']['id']); 6 6 echo $html->getCrumbs(' / '); 7 7 8 echo $html->div('title_section', 'Answers to ' . $data['Question']['question']); 8 echo $html->para(null, __('Answers to', true) .': <b>'. $data['Question']['question'].'</b>'); 9 10 echo $html->div(null, $html->image('static/loading.gif', array('alt'=>'Loading')), array('id'=>'loading','style'=>'display: none;')); 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 9 14 ?> 10 11 <div id="loading" style="display: none;"> <?php echo $html->image("static/loading.gif", array("alt"=>"Loading")); ?></div>12 13 <?php echo $html->para(null, $html->link($html->image('actions/new.png', array("alt"=>"Add new answer", "title"=>"Add new answer")), '#', array("onclick"=>"hU()"), false, false)); ?>14 15 15 16 16 <div id="addquestion" style="display:none"> … … 20 20 echo $form->hidden('Answer.question_id', array('value'=>$data['Question']['id'])); 21 21 ?> 22 <fieldset><legend> New answer</legend>22 <fieldset><legend><?php __('New answer'); ?></legend> 23 23 <?php 24 echo $html->div('required',$form->input('Answer.answer', array( "size" => 55, "maxlength" => 120)));25 echo $html->div('required',$form->label('Answer.correct', 'Answer is correct:').$form->checkbox('Answer.correct', array("value"=> 1)));26 echo $ajax->submit( 'Save', array("url" => "/admin/answers/add",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', array('value' => 1))); 26 echo $ajax->submit(__('Save', true), array("url" => "/admin/answers/add", 27 27 "update"=>"questions", 28 28 "loading" => "Element.hide('questions');Element.hide('addquestion');Element.show('loading')", … … 35 35 <div id="questions"> 36 36 <?php 37 foreach ($data['Answer'] as $val) 38 { 39 $st = ($val['correct']==1) ? 'Yes': 'No';40 $tmp = $html->div(null, $html->link('Delete', '/admin/answers/delete/'.$val['id'].'/'.$val['question_id']));41 $tmp .= $html->div(null, $html->link('Edit', '/admin/answers/edit/' .$val['id']));42 $tmp .= "Answer: " . $val["answer"] . "<br />";43 $tmp .= "Correct: " . $html->link($st, '/admin/answers/change/'.$val['id'].'/'.$val['correct'] .'/'.$val['question_id']) . "<br />";37 foreach ($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(__('Delete', true), '/admin/answers/delete/'.$val['id'].'/'.$val['question_id'])); 43 $tmp .= $html->div(null, $html->link(__('Edit', true), '/admin/answers/edit/' .$val['id'])); 44 44 45 45 echo $html->div('adminblock', $tmp); 46 } 46 endforeach; 47 47 ?> 48 48 </div> -
trunk/app/views/questions/admin_edit.ctp
r361 r666 1 1 <?php 2 echo $html->addCrumb('Control Tools', '/admin/entries/start');3 echo $html->addCrumb( 'Test', '/admin/tests/listing');2 echo $html->addCrumb('Control Panel', '/admin/entries/start'); 3 echo $html->addCrumb(__('Tests', true), '/admin/tests/listing'); 4 4 echo $html->getCrumbs(' / '); 5 5 6 echo $form->create('Question', array("onsubmit"=>"return validateNew()"));6 echo $form->create('Question', array("onsubmit"=>"return chkForm()")); 7 7 echo $form->hidden('Question.id'); 8 8 echo $form->hidden('Question.test_id', array('value'=>$this->data['Question']['test_id'])); 9 9 ?> 10 10 <fieldset> 11 <legend> Edit question</legend>11 <legend><?php __('Edit question'); ?></legend> 12 12 <?php 13 echo $html->div('required',$form->input('Question.question', array( "size" => 40, "maxlength" => 120)));13 echo $html->div('required',$form->input('Question.question', array('size'=>40, 'maxlength'=> 120, 'label'=>__('Question', true)))); 14 14 15 echo $html->div('required',$form->input('Question.hint', array( "size" => 40, "maxlength" => 120)));15 echo $html->div('required',$form->input('Question.hint', array('size' => 40, 'maxlength'=> 120, 'label'=>__('Hint', true)))); 16 16 17 $tmp = $form->label('Question.explanation', 'Explanation:');17 $tmp = $form->label('Question.explanation', __('Explanation', true)); 18 18 $tmp .= $form->textarea('Question.explanation', array("cols" => 50, "rows" => 5)); 19 19 20 20 echo $html->div('required',$tmp); 21 21 22 $t = $form->label('Question.worth', 'Worth:');23 $t .= $form->select('Question.worth', array(1 ,2,3,4,5,6,7,8,9,10), null, null, false, false);22 $t = $form->label('Question.worth', __('Points', true)); 23 $t .= $form->select('Question.worth', array(1=>1,2=>2,3=>3,4=>4,5=>5,6=>6,7=>7,8=>8,9=>9,10=>10), null, null, false, false); 24 24 echo $html->div('required',$t); 25 26 echo $form->end(__('Save', true)); 25 27 ?> 26 28 </fieldset> 27 <?php echo $form->end('Save'); ?>28 29 30 -
trunk/app/views/questions/questions.ctp
r575 r666 9 9 $answers = count($val['Answer']); 10 10 $i++; 11 echo '<div style="padding:5px;border:1px dotted gray;margin:3px auto;width: 70%"><b>' . $i . '.-</b> ';11 echo '<div style="padding:5px;border:1px dotted gray;margin:3px auto;width:80%"><b>' . $i . '.-</b> '; 12 12 echo $html->div('butonright', $gags->sendEdit($val['Question']['id'], 'Question')); 13 13 echo $html->div('butonright', … … 15 15 $form->hidden('Question.id', array('value'=>$val['Question']['id'])). 16 16 $form->hidden('Question.test_id', array('value'=>$val['Question']['test_id'])). 17 $form->end( 'Delete'));17 $form->end(__('Delete', true))); 18 18 19 echo "<b>Question</b>: " . $val['Question']['question'] . "<br />"; 20 echo "<b>Hint</b>: " . $val['Question']['hint'] . "<br />"; 21 echo "<b>Explanation</b>: " . $val['Question']['explanation'] . "<br />"; 22 echo "<b>Worth</b>: " . $val['Question']['worth'] . "<br /><br />"; 23 echo $html->link('View answers ('.$answers.')', '/admin/questions/answers/'.$val['Question']['id']); 19 echo '<b>'. __('Question', true) .':</b> '. $val['Question']['question'] . '<br /><br />'; 20 echo '<b>'. __('Hint', true) .':</b> '. $val['Question']['hint'] . '<br /><br />'; 21 echo '<b>'. __('Explanation', true) .':</b> '. $val['Question']['explanation'] . '<br /><br />'; 22 echo '<b>'. __('Points', true) .':</b> '. $val['Question']['worth'] . '<br /><br />'; 23 echo $html->link(__('View answers', true) . ' ('.$answers.')', '/admin/questions/answers/'.$val['Question']['id']); 24 24 25 echo '</div>'; 25 26 endforeach;
