Changeset 361 for trunk/app/views/questions
- Timestamp:
- 04/02/08 13:19:24 (8 months ago)
- Location:
- trunk/app/views/questions
- Files:
-
- 2 modified
-
admin_answers.ctp (modified) (4 diffs)
-
admin_edit.ctp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/views/questions/admin_answers.ctp
r269 r361 1 1 <?php 2 // die(print_r($data)); 3 if ( isset($javascript) ): 4 echo $html->charsetTag('UTF-8'); 5 echo $javascript->link('prototype'); 6 echo $javascript->link('scriptaculous.js?load=effects'); 7 endif; 8 9 echo $html->addCrumb('Control Tools', '/admin/entries/start'); 10 echo $html->addCrumb('Tests', '/admin/tests/listing'); 11 echo $html->getCrumbs(' / '); 2 echo $html->addCrumb('Control Tools', '/admin/entries/start'); 3 echo $html->addCrumb('Tests', '/admin/tests/listing'); 4 echo $html->getCrumbs(' / '); 5 6 echo $html->div('title_section', 'Answers to ' . $data['Question']['question']); 12 7 ?> 13 14 <div class="title_section">Answers to <?php echo $data['Question']['question']; ?></div>15 8 16 9 <div id="loading" style="display: none;"> … … 25 18 26 19 <?php 27 echo $ajax->form( null,'post');28 echo $ html->hiddenTag('Answer/question_id', $data['Question']['id']);20 echo $ajax->form(); 21 echo $form->hidden('Answer.question_id', array('value'=>$data['Question']['id'])); 29 22 ?> 30 <fieldset> 31 <legend>New answer</legend> 32 33 <div class="required"> 34 <?php echo $form->labelTag('Answer/answer', 'Answer:' ); ?> 35 <?php echo $html->input('Answer/answer', array("size" => 55, "maxlength" => 120)); ?> 36 <?php echo $html->tagErrorMsg('Answer/answer', 'Answer is required.'); ?> 37 </div> 38 <div class="required"> 39 <?php echo $form->labelTag('Answer/correct', 'Answer is correct:' ); ?> 40 <?php echo $html->checkbox('Answer/correct', null, array("value" => 1)); ?> 41 </div> 42 <div> 23 <fieldset><legend>New answer</legend> 43 24 <?php 44 echo $ajax->submit('Save', array("url" => "/admin/answers/add", 25 echo $html->div('required',$form->input('Answer.answer', array("size" => 55, "maxlength" => 120))); 26 echo $html->div('required',$form->label('Answer.correct','Answer is correct:').$form->checkbox('Answer.correct', array("value" => 1))); 27 echo $ajax->submit('Save', array("url" => "/admin/answers/add", 45 28 "update"=>"questions", 46 29 "loading" => "Element.hide('questions');Element.hide('addquestion');Element.show('loading')", … … 48 31 )); 49 32 ?> 50 </div>51 33 </fieldset> 52 53 34 </div> 54 35 … … 58 39 { 59 40 $st = ($val["correct"]==1) ? 'Yes' : 'No'; 60 echo '<div style="padding:5px;border:1px dotted gray;margin:4px;">';61 echo '<div class="butonright">' . $html->link('Delete', '/admin/answers/delete/'.$val['id'].'/'.$val['question_id']) . '</div>';62 echo '<div class="butonright">' . $html->link('Edit', '/admin/answers/edit/' .$val['id']) . '</div>';63 echo "Answer: " . $val["answer"]. "<br />";64 echo "Correct: " . $st . "<br />"; 65 echo '</div>';41 $tmp = $html->div(null, $html->link('Delete', '/admin/answers/delete/'.$val['id'].'/'.$val['question_id'])); 42 $tmp .= $html->div(null, $html->link('Edit', '/admin/answers/edit/' .$val['id'])); 43 $tmp .= "Answer: " . $val["answer"] . "<br />"; 44 $tmp .= "Correct: " . $html->link($st, '/admin/answers/changed/'.$val['id'].'/'.$val['question_id']) . "<br />"; 45 46 echo $html->div('adminblock', $tmp); 66 47 } 67 48 ?> -
trunk/app/views/questions/admin_edit.ctp
r269 r361 1 <?php echo $html->addCrumb('Control Tools', '/admin/entries/start'); ?>2 <?php echo $html->addCrumb('Test', '/admin/tests/listing'); ?>3 <?php echo $html->getCrumbs(' / '); ?>4 5 1 <?php 6 echo $html->formTag('/admin/questions/edit','post', array("onsubmit"=>"return validateNew()")); 7 echo $html->hidden('Question/test_id'); 2 echo $html->addCrumb('Control Tools', '/admin/entries/start'); 3 echo $html->addCrumb('Test', '/admin/tests/listing'); 4 echo $html->getCrumbs(' / '); 5 6 echo $form->create('Question', array("onsubmit"=>"return validateNew()")); 7 echo $form->hidden('Question.id'); 8 echo $form->hidden('Question.test_id', array('value'=>$this->data['Question']['test_id'])); 8 9 ?> 9 10 <fieldset> 10 11 <legend>Edit question</legend> 11 < div class="required">12 <?php13 echo $form->labelTag('Question/question', 'Question:' );14 echo $html->input('Question/question', array("size" => 40, "maxlength" => 120));15 echo $html->tagErrorMsg('Question/question', 'Question is required.');16 ?>17 </div> 12 <?php 13 echo $html->div('required',$form->input('Question.question', array("size" => 40, "maxlength" => 120))); 14 15 echo $html->div('required',$form->input('Question.hint', array("size" => 40, "maxlength" => 120))); 16 17 $tmp = $form->label('Question.explanation', 'Explanation:'); 18 $tmp .= $form->textarea('Question.explanation', array("cols" => 50, "rows" => 5)); 18 19 19 <div class="required"> 20 <?php 21 echo $form->labelTag('Question/hint', 'Hint:' ); 22 echo $html->input('Question/hint', array("size" => 40, "maxlength" => 120)); 23 echo $html->tagErrorMsg('Question/hint', 'Hint is required.'); 24 ?> 25 </div> 20 echo $html->div('required',$tmp); 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); 24 echo $html->div('required',$t); 25 ?> 26 </fieldset> 27 <?php echo $form->end('Save'); ?> 26 28 27 <div class="required">28 <?php29 echo $form->labelTag('Question/explanation', 'Explanation:' );30 echo $html->textarea('Question/explanation', array("cols" => 50, "rows" => 5));31 echo $html->tagErrorMsg('Question/explanation', 'Description is required.');32 ?>33 </div>34 35 <div class="required">36 <?php37 echo $form->labelTag( 'Question/status', 'Published:' );38 $options = array(1,2,3,4,5,6,7,8,9,10);39 echo $html->selectTag('Question/value', $options, null, null, false, false);40 ?>41 </div>42 43 <div>44 <?php echo $html->submit('Save'); ?> </form>45 </div>46 </fieldset>
