source-function-F_show_select_questions

It appears that you are using AdBlocking software. The cost of running this website is covered by advertisements. If you like it please feel free to a small amount of money to secure the future of this website.
Overview

Classes

Interfaces

Exceptions

Functions

  1: <?php
  2: //============================================================+
  3: // File name   : tce_show_all_questions.php
  4: // Begin       : 2005-07-06
  5: // Last Update : 2014-03-04
  6: //
  7: // Description : Display all questions grouped by topic.
  8: //
  9: // Author: Nicola Asuni
 10: //
 11: // (c) Copyright:
 12: //               Nicola Asuni
 13: //               Tecnick.com LTD
 14: //               www.tecnick.com
 15: //               info@tecnick.com
 16: //
 17: // License:
 18: //    Copyright (C) 2004-2014 Nicola Asuni - Tecnick.com LTD
 19: //    See LICENSE.TXT file for more information.
 20: //============================================================+
 21: 
 22: /**
 23:  * @file
 24:  * Display all questions grouped by topic.
 25:  * @package com.tecnick.tcexam.admin
 26:  * @author Nicola Asuni
 27:  * @since 2005-07-06
 28:  */
 29: 
 30: /**
 31:  */
 32: 
 33: require_once('../config/tce_config.php');
 34: 
 35: $pagelevel = K_AUTH_ADMIN_RESULTS;
 36: require_once('../../shared/code/tce_authorization.php');
 37: 
 38: $thispage_title = $l['t_questions_list'];
 39: require_once('../code/tce_page_header.php');
 40: require_once('../../shared/code/tce_functions_form.php');
 41: require_once('../../shared/code/tce_functions_tcecode.php');
 42: require_once('../../shared/code/tce_functions_auth_sql.php');
 43: require_once('tce_functions_questions.php');
 44: 
 45: // --- Initialize variables
 46: 
 47: // set default values
 48: $wherequery='';
 49: $order_field = 'question_enabled DESC, question_position,';
 50: if (K_DATABASE_TYPE == 'ORACLE') {
 51:     $order_field .= ' CAST(question_description as varchar2(100))';
 52: } else {
 53:     $order_field .= ' question_description';
 54: }
 55: if (!isset($orderdir)) {
 56:     $orderdir=0;
 57: }
 58: if (!isset($firstrow)) {
 59:     $firstrow=0;
 60: }
 61: if (!isset($rowsperpage)) {
 62:     $rowsperpage=K_MAX_ROWS_PER_PAGE;
 63: }
 64: if (!isset($hide_answers)) {
 65:     $hide_answers=false;
 66: }
 67: 
 68: if (isset($selectmodule)) {
 69:     $changemodule = 1;
 70: }
 71: if (isset($selectcategory)) {
 72:     $changecategory = 1;
 73: }
 74: if ((isset($changemodule) and ($changemodule > 0)) or (isset($changecategory) and ($changecategory > 0))) {
 75:     $wherequery = '';
 76:     $firstrow = 0;
 77:     $orderdir = 0;
 78:     $order_field = 'question_enabled DESC, question_position,';
 79:     if (K_DATABASE_TYPE == 'ORACLE') {
 80:         $order_field .= ' CAST(question_description as varchar2(100))';
 81:     } else {
 82:         $order_field .= ' question_description';
 83:     }
 84: }
 85: if (isset($subject_module_id)) {
 86:     $subject_module_id = intval($subject_module_id);
 87: } else {
 88:     // select default module/subject (if not specified)
 89:     $sql = F_select_modules_sql().' LIMIT 1';
 90:     if ($r = F_db_query($sql, $db)) {
 91:         if ($m = F_db_fetch_array($r)) {
 92:             $subject_module_id = $m['module_id'];
 93:         } else {
 94:             $subject_module_id = 0;
 95:         }
 96:     } else {
 97:         F_display_db_error();
 98:     }
 99: }
100: 
101: // check user's authorization
102: if (!F_isAuthorizedUser(K_TABLE_MODULES, 'module_id', $subject_module_id, 'module_user_id')) {
103:     F_print_error('ERROR', $l['m_authorization_denied']);
104:     require_once('../code/tce_page_footer.php');
105:     exit;
106: }
107: 
108: if (isset($subject_id)) {
109:     $subject_id = intval($subject_id);
110: }
111: 
112: // select subject
113: if ((isset($changemodule) and ($changemodule > 0))
114:     or (!(isset($subject_id) and ($subject_id > 0)))) {
115:     $sql = F_select_subjects_sql('subject_module_id='.$subject_module_id.'').' LIMIT 1';
116:     if ($r = F_db_query($sql, $db)) {
117:         if ($m = F_db_fetch_array($r)) {
118:             $subject_id = $m['subject_id'];
119:         } else {
120:             $subject_id = 0;
121:         }
122:     } else {
123:         F_display_db_error();
124:     }
125: }
126: 
127: if (isset($menu_mode) and ($menu_mode == 'update') and isset($menu_action) and !empty($menu_action)) {
128:     $istart = 1 + $firstrow;
129:     $iend = $rowsperpage + $firstrow;
130:     for ($i = $istart; $i <= $iend; $i++) {
131:         // for each selected question
132:         $keyname = 'questionid'.$i;
133:         if (isset($$keyname)) {
134:             $question_id = $$keyname;
135:             switch ($menu_action) {
136:                 case 'move': {
137:                     if (isset($new_subject_id) and ($new_subject_id > 0)) {
138:                         F_question_copy($question_id, $new_subject_id);
139:                         F_question_delete($question_id, $subject_id);
140:                     }
141:                     break;
142:                 }
143:                 case 'copy': {
144:                     if (isset($new_subject_id) and ($new_subject_id > 0)) {
145:                         F_question_copy($question_id, $new_subject_id);
146:                     }
147:                     break;
148:                 }
149:                 case 'delete': {
150:                     F_question_delete($question_id, $subject_id);
151:                     break;
152:                 }
153:                 case 'disable': {
154:                     F_question_set_enabled($question_id, false);
155:                     break;
156:                 }
157:                 case 'enable': {
158:                     F_question_set_enabled($question_id, true);
159:                     break;
160:                 }
161:             } // end of switch
162:         }
163:     }
164:     F_print_error('MESSAGE', $l['m_updated']);
165: }
166: 
167: echo '<div class="container">'.K_NEWLINE;
168: 
169: echo '<div class="tceformbox">'.K_NEWLINE;
170: echo '<form action="'.$_SERVER['SCRIPT_NAME'].'" method="post" enctype="multipart/form-data" id="form_selectquestions">'.K_NEWLINE;
171: 
172: echo '<div class="row">'.K_NEWLINE;
173: echo '<span class="label">'.K_NEWLINE;
174: echo '<label for="subject_module_id">'.$l['w_module'].'</label>'.K_NEWLINE;
175: echo '</span>'.K_NEWLINE;
176: echo '<span class="formw">'.K_NEWLINE;
177: echo '<input type="hidden" name="changemodule" id="changemodule" value="" />'.K_NEWLINE;
178: echo '<select name="subject_module_id" id="subject_module_id" size="0" onchange="document.getElementById(\'form_selectquestions\').changemodule.value=1;document.getElementById(\'form_selectquestions\').changecategory.value=1; document.getElementById(\'form_selectquestions\').submit();" title="'.$l['w_module'].'">'.K_NEWLINE;
179: $sql = F_select_modules_sql();
180: if ($r = F_db_query($sql, $db)) {
181:     $countitem = 1;
182:     while ($m = F_db_fetch_array($r)) {
183:         echo '<option value="'.$m['module_id'].'"';
184:         if ($m['module_id'] == $subject_module_id) {
185:             echo ' selected="selected"';
186:         }
187:         echo '>'.$countitem.'. ';
188:         if (F_getBoolean($m['module_enabled'])) {
189:             echo '+';
190:         } else {
191:             echo '-';
192:         }
193:         echo ' '.htmlspecialchars($m['module_name'], ENT_NOQUOTES, $l['a_meta_charset']).'&nbsp;</option>'.K_NEWLINE;
194:         $countitem++;
195:     }
196:     if ($countitem == 1) {
197:         echo '<option value="0">&nbsp;</option>'.K_NEWLINE;
198:     }
199: } else {
200:     echo '</select></span></div>'.K_NEWLINE;
201:     F_display_db_error();
202: }
203: echo '</select>'.K_NEWLINE;
204: echo '</span>'.K_NEWLINE;
205: echo '</div>'.K_NEWLINE;
206: 
207: echo getFormNoscriptSelect('selectmodule');
208: 
209: echo '<div class="row">'.K_NEWLINE;
210: echo '<span class="label">'.K_NEWLINE;
211: echo '<label for="subject_id">'.$l['w_subject'].'</label>'.K_NEWLINE;
212: echo '</span>'.K_NEWLINE;
213: echo '<span class="formw">'.K_NEWLINE;
214: echo '<input type="hidden" name="changecategory" id="changecategory" value="" />'.K_NEWLINE;
215: echo '<select name="subject_id" id="subject_id" size="0" onchange="document.getElementById(\'form_selectquestions\').changecategory.value=1;document.getElementById(\'form_selectquestions\').submit()" title="'.$l['h_subject'].'">'.K_NEWLINE;
216: $sql = F_select_subjects_sql('subject_module_id='.$subject_module_id);
217: if ($r = F_db_query($sql, $db)) {
218:     $countitem = 1;
219:     while ($m = F_db_fetch_array($r)) {
220:         echo '<option value="'.$m['subject_id'].'"';
221:         if ($m['subject_id'] == $subject_id) {
222:             echo ' selected="selected"';
223:         }
224:         echo '>'.$countitem.'. ';
225:         if (F_getBoolean($m['subject_enabled'])) {
226:             echo '+';
227:         } else {
228:             echo '-';
229:         }
230:         echo ' '.htmlspecialchars($m['subject_name'], ENT_NOQUOTES, $l['a_meta_charset']).'</option>'.K_NEWLINE;
231:         $countitem++;
232:     }
233: } else {
234:     echo '</select></span></div>'.K_NEWLINE;
235:     F_display_db_error();
236: }
237: echo '</select>'.K_NEWLINE;
238: echo '</span>'.K_NEWLINE;
239: echo '</div>'.K_NEWLINE;
240: 
241: echo getFormNoscriptSelect('selectcategory');
242: 
243: echo '<div class="row">'.K_NEWLINE;
244: echo '<span class="label">&nbsp;</span>'.K_NEWLINE;
245: echo '<span class="formw">'.K_NEWLINE;
246: echo '<input type="checkbox" name="hide_answers" id="hide_answers" value="1"';
247: if ($hide_answers) {
248:     echo ' checked="checked"';
249: }
250: echo ' title="'.$l['w_hide_answers'].'" onclick="document.getElementById(\'form_selectquestions\').submit()" />';
251: echo '<label for="hide_answers">'.$l['w_hide_answers'].'</label>'.K_NEWLINE;
252: echo '</span>'.K_NEWLINE;
253: echo '</div>'.K_NEWLINE;
254: 
255: echo getFormNoscriptSelect('selectrecord');
256: 
257: echo '<div class="row"><hr /></div>'.K_NEWLINE;
258: 
259: // display questions statistics
260: $qtype = array('<acronym class="offbox" title="'.$l['w_single_answer'].'">S</acronym>', '<acronym class="offbox" title="'.$l['w_multiple_answers'].'">M</acronym>', '<acronym class="offbox" title="'.$l['w_free_answer'].'">T</acronym>', '<acronym class="offbox" title="'.$l['w_ordering_answer'].'">O</acronym>'); // question types
261: $qstat = '';
262: $nqsum = 0;
263: $sql = 'SELECT question_type, COUNT(*) as numquestions
264:     FROM '.K_TABLE_QUESTIONS.'
265:     WHERE question_subject_id='.$subject_id.'
266:     GROUP BY question_type';
267: if ($r = F_db_query($sql, $db)) {
268:     $countitem = 1;
269:     while ($m = F_db_fetch_array($r)) {
270:         $nqsum += $m['numquestions'];
271:         $qstat .= ' + '.$m['numquestions'].' '.$qtype[($m['question_type']-1)].'';
272:     }
273: } else {
274:     F_display_db_error();
275: }
276: 
277: echo '<div class="rowl">';
278: echo '<span>'.$l['w_questions'].': '.$nqsum.' = '.$qstat.'</span><br />'.K_NEWLINE;
279: echo '</div>'.K_NEWLINE;
280: 
281: echo '<div class="row"><hr /></div>'.K_NEWLINE;
282: 
283: echo '<div class="rowl">'.K_NEWLINE;
284: 
285: if (isset($subject_id) and ($subject_id > 0)) {
286:     F_show_select_questions($wherequery, $subject_module_id, $subject_id, $order_field, $orderdir, $firstrow, $rowsperpage, $hide_answers);
287: }
288: 
289: echo '&nbsp;'.K_NEWLINE;
290: echo '</div>'.K_NEWLINE;
291: echo '<div class="row"><hr /></div>'.K_NEWLINE;
292: 
293: echo '<div class="row">'.K_NEWLINE;
294: 
295: // show buttons by case
296: if (isset($subject_id) and ($subject_id > 0)) {
297:     $pdflink = 'tce_pdf_all_questions.php';
298:     $pdflink .= '?module_id='.$subject_module_id;
299:     $pdflink .= '&amp;subject_id='.$subject_id;
300:     $pdflink .= '&amp;hide_answers='.intval($hide_answers); // hide answers option
301:     echo '<a href="'.$pdflink.'&amp;expmode=1" class="xmlbutton" title="'.$l['h_pdf'].'">PDF</a>';
302:     echo '<a href="'.$pdflink.'&amp;expmode=2" class="xmlbutton" title="'.$l['h_pdf'].'">PDF '.$l['w_module'].'</a>';
303:     echo '<a href="'.$pdflink.'&amp;expmode=3" class="xmlbutton" title="'.$l['h_pdf'].'">PDF '.$l['w_all'].'</a>';
304:     $xmllink = 'tce_xml_questions.php';
305:     $xmllink .= '?module_id='.$subject_module_id;
306:     $xmllink .= '&amp;subject_id='.$subject_id;
307:     echo ' <a href="'.$xmllink.'&amp;expmode=1" class="xmlbutton" title="'.$l['h_xml_export'].'">XML</a>';
308:     echo '<a href="'.$xmllink.'&amp;expmode=2" class="xmlbutton" title="'.$l['h_xml_export'].'">XML '.$l['w_module'].'</a>';
309:     echo '<a href="'.$xmllink.'&amp;expmode=3" class="xmlbutton" title="'.$l['h_xml_export'].'">XML '.$l['w_all'].'</a>';
310:     echo ' <a href="'.$xmllink.'&amp;expmode=1&amp;format=JSON" class="xmlbutton" title="JSON">JSON</a>';
311:     echo '<a href="'.$xmllink.'&amp;expmode=2&amp;format=JSON" class="xmlbutton" title="JSON">JSON '.$l['w_module'].'</a>';
312:     echo '<a href="'.$xmllink.'&amp;expmode=3&amp;format=JSON" class="xmlbutton" title="JSON">JSON '.$l['w_all'].'</a>';
313:     $tsvlink = 'tce_tsv_questions.php';
314:     $tsvlink .= '?module_id='.$subject_module_id;
315:     $tsvlink .= '&amp;subject_id='.$subject_id;
316:     echo ' <a href="'.$tsvlink.'&amp;expmode=1" class="xmlbutton" title="'.$l['h_tsv_export'].'">TSV</a>';
317:     echo '<a href="'.$tsvlink.'&amp;expmode=2" class="xmlbutton" title="'.$l['h_tsv_export'].'">TSV '.$l['w_module'].'</a>';
318:     echo '<a href="'.$tsvlink.'&amp;expmode=3" class="xmlbutton" title="'.$l['h_tsv_export'].'">TSV '.$l['w_all'].'</a>';
319: }
320: 
321: echo '&nbsp;'.K_NEWLINE;
322: echo '<input type="hidden" name="firstrow" id="firstrow" value="'.$firstrow.'" />'.K_NEWLINE;
323: echo '<input type="hidden" name="order_field" id="order_field" value="'.$order_field.'" />'.K_NEWLINE;
324: echo '<input type="hidden" name="orderdir" id="orderdir" value="'.$orderdir.'" />'.K_NEWLINE;
325: echo '<input type="hidden" name="submitted" id="submitted" value="0" />'.K_NEWLINE;
326: echo '<input type="hidden" name="usersearch" id="usersearch" value="" />'.K_NEWLINE;
327: echo '</div>'.K_NEWLINE;
328: 
329: echo '</form>'.K_NEWLINE;
330: 
331: echo '</div>'.K_NEWLINE;
332: 
333: echo '<div class="pagehelp">'.$l['hp_select_all_questions'].'</div>'.K_NEWLINE;
334: echo '</div>'.K_NEWLINE;
335: 
336: require_once('../code/tce_page_footer.php');
337: 
338: // ------------------------------
339: 
340: /**
341:  * Display a list of selected questions.
342:  * @author Nicola Asuni
343:  * @since 2005-07-06
344:  * @param $wherequery (string) question selection query
345:  * @param $subject_module_id (string) module ID
346:  * @param $subject_id (string) topic ID
347:  * @param $order_field (string) order by column name
348:  * @param $orderdir (int) oreder direction
349:  * @param $firstrow (int) number of first row to display
350:  * @param $rowsperpage (int) number of rows per page
351:  * @param $hide_answers (boolean) if true hide answers
352:  * @return false in case of empty database, true otherwise
353:  */
354: function F_show_select_questions($wherequery, $subject_module_id, $subject_id, $order_field, $orderdir, $firstrow, $rowsperpage, $hide_answers = false)
355: {
356:     global $l, $db;
357:     require_once('../config/tce_config.php');
358:     require_once('../../shared/code/tce_functions_page.php');
359: 
360:     $subject_module_id = intval($subject_module_id);
361:     $subject_id = intval($subject_id);
362:     $orderdir = intval($orderdir);
363:     $firstrow = intval($firstrow);
364:     $rowsperpage = intval($rowsperpage);
365:     if (empty($order_field) or (!in_array($order_field, array('question_id', 'question_subject_id', 'question_description', 'question_explanation', 'question_type', 'question_difficulty', 'question_enabled', 'question_position', 'question_timer', 'question_fullscreen', 'question_inline_answers', 'question_auto_next', 'question_enabled DESC, question_position, CAST(question_description as varchar2(100))', 'question_enabled DESC, question_position, question_description')))) {
366:         $order_field = 'question_description';
367:     }
368:     if ($orderdir == 0) {
369:         $nextorderdir = 1;
370:         $full_order_field = $order_field;
371:     } else {
372:         $nextorderdir = 0;
373:         $full_order_field = $order_field.' DESC';
374:     }
375: 
376:     if (!F_count_rows(K_TABLE_QUESTIONS)) { //if the table is void (no items) display message
377:         F_print_error('MESSAGE', $l['m_databasempty']);
378:         return false;
379:     }
380: 
381:     if (empty($wherequery)) {
382:         $wherequery = 'WHERE question_subject_id='.$subject_id.'';
383:     } else {
384:         $wherequery = F_escape_sql($db, $wherequery);
385:         $wherequery .= ' AND question_subject_id='.$subject_id.'';
386:     }
387:     $sql = 'SELECT *
388:         FROM '.K_TABLE_QUESTIONS.'
389:         '.$wherequery.'
390:         ORDER BY '.$full_order_field;
391:     if (K_DATABASE_TYPE == 'ORACLE') {
392:         $sql = 'SELECT * FROM ('.$sql.') WHERE rownum BETWEEN '.$firstrow.' AND '.($firstrow + $rowsperpage).'';
393:     } else {
394:         $sql .= ' LIMIT '.$rowsperpage.' OFFSET '.$firstrow.'';
395:     }
396:     if ($r = F_db_query($sql, $db)) {
397:         $questlist = '';
398:         $itemcount = $firstrow;
399:         while ($m = F_db_fetch_array($r)) {
400:             $itemcount++;
401:             $questlist .= '<li>'.K_NEWLINE;
402:             $questlist .= '<strong>'.$itemcount.'.</strong> ';
403:             $questlist .= '<input type="checkbox" name="questionid'.$itemcount.'" id="questionid'.$itemcount.'" value="'.$m['question_id'].'" title="'.$l['w_select'].'"';
404:             if (isset($_REQUEST['checkall']) and ($_REQUEST['checkall'] == 1)) {
405:                 $questlist .= ' checked="checked"';
406:             }
407:             $questlist .= ' />';
408:             // display question description
409:             if (F_getBoolean($m['question_enabled'])) {
410:                 $questlist .= '<acronym class="onbox" title="'.$l['w_enabled'].'">+</acronym>';
411:             } else {
412:                 $questlist .= '<acronym class="offbox" title="'.$l['w_disabled'].'">-</acronym>';
413:             }
414:             switch ($m['question_type']) {
415:                 case 1: {
416:                     $questlist .= ' <acronym class="offbox" title="'.$l['w_single_answer'].'">S</acronym>';
417:                     break;
418:                 }
419:                 case 2: {
420:                     $questlist .= ' <acronym class="offbox" title="'.$l['w_multiple_answers'].'">M</acronym>';
421:                     break;
422:                 }
423:                 case 3: {
424:                     $questlist .= ' <acronym class="offbox" title="'.$l['w_free_answer'].'">T</acronym>';
425:                     break;
426:                 }
427:                 case 4: {
428:                     $questlist .= ' <acronym class="offbox" title="'.$l['w_ordering_answer'].'">O</acronym>';
429:                     break;
430:                 }
431:             }
432:             $questlist .= ' <acronym class="offbox" title="'.$l['h_question_difficulty'].'">'.$m['question_difficulty'].'</acronym>';
433:             if ($m['question_position'] > 0) {
434:                 $questlist .= ' <acronym class="onbox" title="'.$l['h_position'].'">'.intval($m['question_position']).'</acronym>';
435:             } else {
436:                 $questlist .= ' <acronym class="offbox" title="'.$l['h_position'].'">&nbsp;</acronym>';
437:             }
438:             if (F_getBoolean($m['question_fullscreen'])) {
439:                 $questlist .= ' <acronym class="onbox" title="'.$l['w_fullscreen'].': '.$l['w_enabled'].'">F</acronym>';
440:             } else {
441:                 $questlist .= ' <acronym class="offbox" title="'.$l['w_fullscreen'].': '.$l['w_disabled'].'">&nbsp;</acronym>';
442:             }
443:             if (F_getBoolean($m['question_inline_answers'])) {
444:                 $questlist .= ' <acronym class="onbox" title="'.$l['w_inline_answers'].': '.$l['w_enabled'].'">I</acronym>';
445:             } else {
446:                 $questlist .= ' <acronym class="offbox" title="'.$l['w_inline_answers'].': '.$l['w_disabled'].'">&nbsp;</acronym>';
447:             }
448:             if (F_getBoolean($m['question_auto_next'])) {
449:                 $questlist .= ' <acronym class="onbox" title="'.$l['w_auto_next'].': '.$l['w_enabled'].'">A</acronym>';
450:             } else {
451:                 $questlist .= ' <acronym class="offbox" title="'.$l['w_auto_next'].': '.$l['w_disabled'].'">&nbsp;</acronym>';
452:             }
453:             if ($m['question_timer'] > 0) {
454:                 $questlist .= ' <acronym class="onbox" title="'.$l['h_question_timer'].'">'.intval($m['question_timer']).'</acronym>';
455:             } else {
456:                 $questlist .= ' <acronym class="offbox" title="'.$l['h_question_timer'].'">&nbsp;</acronym>';
457:             }
458: 
459:             $questlist .= ' <a href="tce_edit_question.php?subject_module_id='.$subject_module_id.'&amp;question_subject_id='.$subject_id.'&amp;question_id='.$m['question_id'].'" title="'.$l['t_questions_editor'].' [ID = '.$m['question_id'].']" class="xmlbutton">'.$l['w_edit'].'</a>';
460: 
461:             $questlist .= '<br /><br />'.K_NEWLINE;
462:             $questlist .=  '<div class="paddingleft">'.F_decode_tcecode($m['question_description']).'</div>'.K_NEWLINE;
463:             if (K_ENABLE_QUESTION_EXPLANATION and !empty($m['question_explanation'])) {
464:                 $questlist .=  '<div class="paddingleft"><br /><span class="explanation">'.$l['w_explanation'].':</span><br />'.F_decode_tcecode($m['question_explanation']).'</div>'.K_NEWLINE;
465:             }
466:             if (!$hide_answers) {
467:                 // display alternative answers
468:                 $sqla = 'SELECT *
469:                     FROM '.K_TABLE_ANSWERS.'
470:                     WHERE answer_question_id=\''.$m['question_id'].'\'
471:                     ORDER BY answer_enabled DESC,answer_position,answer_isright DESC';
472:                 if ($ra = F_db_query($sqla, $db)) {
473:                     $answlist = '';
474:                     while ($ma = F_db_fetch_array($ra)) {
475:                         $answlist .= '<li>';
476:                         if (F_getBoolean($ma['answer_enabled'])) {
477:                             $answlist .= '<acronym class="onbox" title="'.$l['w_enabled'].'">+</acronym>';
478:                         } else {
479:                             $answlist .= '<acronym class="offbox" title="'.$l['w_disabled'].'">-</acronym>';
480:                         }
481:                         if ($m['question_type'] != 4) {
482:                             if (F_getBoolean($ma['answer_isright'])) {
483:                                 $answlist .= ' <acronym class="okbox" title="'.$l['h_answer_right'].'">T</acronym>';
484:                             } else {
485:                                 $answlist .= ' <acronym class="nobox" title="'.$l['h_answer_wrong'].'">F</acronym>';
486:                             }
487:                         }
488:                         if ($ma['answer_position'] > 0) {
489:                             $answlist .= ' <acronym class="onbox" title="'.$l['h_position'].'">'.intval($ma['answer_position']).'</acronym>';
490:                         } else {
491:                             $answlist .= ' <acronym class="offbox" title="'.$l['h_position'].'">&nbsp;</acronym>';
492:                         }
493:                         if ($ma['answer_keyboard_key'] > 0) {
494:                             $answlist .= ' <acronym class="onbox" title="'.$l['h_answer_keyboard_key'].'">'.F_text_to_xml(chr($ma['answer_keyboard_key'])).'</acronym>';
495:                         } else {
496:                             $answlist .= ' <acronym class="offbox" title="'.$l['h_answer_keyboard_key'].'">&nbsp;</acronym>';
497:                         }
498: 
499:                         $answlist .= ' <a href="tce_edit_answer.php?subject_module_id='.$subject_module_id.'&amp;question_subject_id='.$subject_id.'&amp;answer_question_id='.$m['question_id'].'&amp;answer_id='.$ma['answer_id'].'" title="'.$l['t_answers_editor'].' [ID = '.$ma['answer_id'].']" class="xmlbutton">'.$l['w_edit'].'</a>';
500:                         //$answlist .= " ";
501:                         //$answlist .= "".F_decode_tcecode($ma['answer_description'])."";
502:                         $answlist .= '<br /><br />'.K_NEWLINE;
503:                         $answlist .= '<div class="paddingleft">'.F_decode_tcecode($ma['answer_description']).'</div>'.K_NEWLINE;
504:                         if (K_ENABLE_ANSWER_EXPLANATION and !empty($ma['answer_explanation'])) {
505:                             $answlist .=  '<div class="paddingleft"><br /><span class="explanation">'.$l['w_explanation'].':</span><br />'.F_decode_tcecode($ma['answer_explanation']).'</div>'.K_NEWLINE;
506:                         }
507:                         $answlist .= '</li>'.K_NEWLINE;
508:                     }
509:                     if (strlen($answlist) > 0) {
510:                         $questlist .= "<ol class=\"answer\">\n".$answlist."</ol><br /><br />\n";
511:                     }
512:                 } else {
513:                     F_display_db_error();
514:                 }
515:             } // end if hide_answers
516:             $questlist .= '</li>'.K_NEWLINE;
517:         }
518:         if (strlen($questlist) > 0) {
519:             // display the list
520:             echo '<ul class="question">'.K_NEWLINE;
521:             echo $questlist;
522:             echo '</ul>'.K_NEWLINE;
523:             echo '<div class="row"><hr /></div>'.K_NEWLINE;
524:             // check/uncheck all options
525:             echo '<span dir="'.$l['a_meta_dir'].'">';
526:             echo '<input type="radio" name="checkall" id="checkall1" value="1" onclick="document.getElementById(\'form_selectquestions\').submit()" />';
527:             echo '<label for="checkall1">'.$l['w_check_all'].'</label> ';
528:             echo '<input type="radio" name="checkall" id="checkall0" value="0" onclick="document.getElementById(\'form_selectquestions\').submit()" />';
529:             echo '<label for="checkall0">'.$l['w_uncheck_all'].'</label>';
530:             echo '</span>'.K_NEWLINE;
531:             echo '&nbsp;';
532:             if ($l['a_meta_dir'] == 'rtl') {
533:                 $arr = '&larr;';
534:             } else {
535:                 $arr = '&rarr;';
536:             }
537:             // action options
538:             echo '<select name="menu_action" id="menu_action" size="0">'.K_NEWLINE;
539:             echo '<option value="0" style="color:gray">'.$l['m_with_selected'].'</option>'.K_NEWLINE;
540:             echo '<option value="enable">'.$l['w_enable'].'</option>'.K_NEWLINE;
541:             echo '<option value="disable">'.$l['w_disable'].'</option>'.K_NEWLINE;
542:             echo '<option value="delete">'.$l['w_delete'].'</option>'.K_NEWLINE;
543:             echo '<option value="copy">'.$l['w_copy'].' '.$arr.'</option>'.K_NEWLINE;
544:             echo '<option value="move">'.$l['w_move'].' '.$arr.'</option>'.K_NEWLINE;
545:             echo '</select>'.K_NEWLINE;
546:             // select new topic (for copy or move action)
547:             echo '<select name="new_subject_id" id="new_subject_id" size="0" title="'.$l['h_subject'].'">'.K_NEWLINE;
548:             $sql = F_select_module_subjects_sql('module_enabled=\'1\' AND subject_enabled=\'1\'');
549:             if ($r = F_db_query($sql, $db)) {
550:                 echo '<option value="0" style="color:gray">'.$l['w_subject'].'</option>'.K_NEWLINE;
551:                 $prev_module_id = 0;
552:                 while ($m = F_db_fetch_array($r)) {
553:                     if ($m['module_id'] != $prev_module_id) {
554:                         $prev_module_id = $m['module_id'];
555:                         echo '<option value="0" style="color:gray;font-weight:bold;" disabled="disabled">* '.htmlspecialchars($m['module_name'], ENT_NOQUOTES, $l['a_meta_charset']).'</option>'.K_NEWLINE;
556:                     }
557:                     echo '<option value="'.$m['subject_id'].'">&nbsp;&nbsp;&nbsp;&nbsp;'.htmlspecialchars($m['subject_name'], ENT_NOQUOTES, $l['a_meta_charset']).'</option>'.K_NEWLINE;
558:                 }
559:             } else {
560:                 echo '</select>'.K_NEWLINE;
561:                 F_display_db_error();
562:             }
563:             echo '</select>'.K_NEWLINE;
564:             // submit button
565:             F_submit_button("update", $l['w_update'], $l['h_update']);
566:         }
567: 
568:         // ---------------------------------------------------------------
569:         // -- page jumper (menu for successive pages)
570:         if ($rowsperpage > 0) {
571:             $sql = 'SELECT count(*) AS total FROM '.K_TABLE_QUESTIONS.' '.$wherequery.'';
572:             if (!empty($order_field)) {
573:                 $param_array = '&amp;order_field='.urlencode($order_field).'';
574:             }
575:             if (!empty($orderdir)) {
576:                 $param_array .= '&amp;orderdir='.$orderdir.'';
577:             }
578:             if (!empty($hide_answers)) {
579:                 $param_array .= '&amp;hide_answers='.intval($hide_answers).'';
580:             }
581:             $param_array .= '&amp;subject_module_id='.$subject_module_id.'';
582:             $param_array .= '&amp;subject_id='.$subject_id.'';
583:             $param_array .= '&amp;submitted=1';
584:             F_show_page_navigator($_SERVER['SCRIPT_NAME'], $sql, $firstrow, $rowsperpage, $param_array);
585:         }
586:     } else {
587:         F_display_db_error();
588:     }
589:     return true;
590: }
591: 
592: //============================================================+
593: // END OF FILE
594: //============================================================+
595: 
 

© 2004-2018 – Nicola Asuni - Tecnick.com - All rights reserved.
about - disclaimer - privacy