| 1 |
<div class="wrap"> |
| 2 |
<div class="postbox-container" style="min-width:60%;margin-right:2%;"> |
| 3 |
<h1><?php printf(__("Manage Grading for Quiz '%s'", 'watu'), stripslashes($quiz->name)); ?></h1> |
| 4 |
<p><a href="admin.php?page=watu_exams"><?php _e('Back to quizzes list', 'watu')?></a> | |
| 5 |
<a href="admin.php?page=watu_questions&quiz=<?php echo $quiz->ID?>"><?php _e('Manage Questions', 'watu')?></a> | |
| 6 |
<a href="admin.php?page=watu_exam&quiz=<?php echo $quiz->ID?>&action=edit"><?php printf(__('Edit %s', 'watu'), WATU_QUIZ_WORD)?></a> |
| 7 |
</p> |
| 8 |
|
| 9 |
<h2><?php _e('Add New Grade / Result', 'watu')?></h2> |
| 10 |
<form method="post" onsubmit="return validateWatuGrade(this);"> |
| 11 |
<div class="postbox inside watu-padded"> |
| 12 |
<p><label><?php _e('Grade Title:', 'watu')?></label> <input type='text' name='gtitle' size="30" /><br /><label><?php _e('Description (optional):', 'watu')?></label><br /><?php wp_editor('', 'gdesc')?><br /><label><?php _e('From points:', 'watu')?> <input type='text' class='numeric' name='gfrom' size="4" /></label><label><?php _e('To points:', 'watu')?> <input type='text' class='numeric' name='gto' size="4" /></label> |
| 13 |
<p><label><?php _e('If this grade is achieved redirect to URL (optional):', 'watu')?></label> |
| 14 |
<input type="text" name="redirect_url" size="60"></p> |
| 15 |
<?php if(!empty($integrate_moolamojo)):?> |
| 16 |
<p><?php printf(__("If this grade is achieved transfer %s of virtual credits to user's MoolaMojo balance", 'watu'), '<input type="text" name="moola" size="4">');?></p> |
| 17 |
<?php endif;?> |
| 18 |
<input type="submit" name="add" value="<?php _e('Save new grade', 'watu')?>"></p> |
| 19 |
</div> |
| 20 |
<?php wp_nonce_field('watu_grades'); ?> |
| 21 |
</form> |
| 22 |
|
| 23 |
<?php if(sizeof($grades)):?> |
| 24 |
<h2><?php _e('Existing Grades / Quiz Results', 'watu')?></h2> |
| 25 |
|
| 26 |
<?php foreach($grades as $grade):?> |
| 27 |
<form method="post" onsubmit="return validateWatuGrade(this);"> |
| 28 |
<div class="postbox inside watu-padded"> |
| 29 |
<p><label><?php _e('Grade Title:', 'watu')?></label> <input type='text' name='gtitle' value="<?php echo esc_attr(stripslashes($grade->gtitle))?>" size="30" /><br /><label><?php _e('Description (optional):', 'watu')?></label><br /><?php wp_editor(stripslashes($grade->gdescription), 'gdesc'.$grade->ID)?><br /><label><?php _e('From points:', 'watu')?> <input type='text' class='numeric' name='gfrom' size="4" value="<?php echo $grade->gfrom?>" /></label><label><?php _e('To points:', 'watu')?> <input type='text' class='numeric' name='gto' size="4" value="<?php echo $grade->gto?>" /></label> |
| 30 |
<p><label><?php _e('If this grade is achieved redirect to URL (optional):', 'watu')?></label> |
| 31 |
<input type="text" name="redirect_url" size="60" value="<?php echo $grade->redirect_url?>"></p> |
| 32 |
<?php if(!empty($integrate_moolamojo)):?> |
| 33 |
<p><?php printf(__("If this grade is achieved transfer %s of virtual credits to user's MoolaMojo balance", 'watu'), '<input type="text" name="moola" size="4" value="'.$grade->moola.'">');?></p> |
| 34 |
<?php endif;?> |
| 35 |
<input type="submit" name="save" value="<?php _e('Save grade', 'watu')?>"> |
| 36 |
<input type="button" value="<?php _e('Delete grade', 'watu')?>" onclick="watuConfirmDelGrade(this.form);"></p> |
| 37 |
</div> |
| 38 |
<input type="hidden" name="id" value="<?php echo $grade->ID?>"> |
| 39 |
<input type="hidden" name="del" value="0"> |
| 40 |
<?php wp_nonce_field('watu_grades'); ?> |
| 41 |
</form> |
| 42 |
<?php endforeach;?> |
| 43 |
<?php endif;?> |
| 44 |
</div> |
| 45 |
|
| 46 |
<div id="watu-sidebar"> |
| 47 |
<?php include(WATU_PATH."/views/sidebar.php");?> |
| 48 |
</div> |
| 49 |
</div> |
| 50 |
|
| 51 |
<script type="text/javascript" > |
| 52 |
function validateWatuGrade(frm) { |
| 53 |
if(frm.gtitle.value == '') { |
| 54 |
alert("<?php _e('Please enter grade title', 'watu')?>"); |
| 55 |
frm.gtitle.focus(); |
| 56 |
return false; |
| 57 |
} |
| 58 |
|
| 59 |
if(frm.gfrom.value == '' || isNaN(frm.gfrom.value)) { |
| 60 |
alert("<?php _e('Please enter From points, numbers only', 'watu')?>"); |
| 61 |
frm.gfrom.focus(); |
| 62 |
return false; |
| 63 |
} |
| 64 |
|
| 65 |
if(frm.gto.value == '' || isNaN(frm.gto.value)) { |
| 66 |
alert("<?php _e('Please enter To points, numbers only', 'watu')?>"); |
| 67 |
frm.gto.focus(); |
| 68 |
return false; |
| 69 |
} |
| 70 |
|
| 71 |
return true; |
| 72 |
} |
| 73 |
|
| 74 |
function watuConfirmDelGrade(frm) { |
| 75 |
if(confirm("<?php _e('Are you sure?', 'watu')?>")) { |
| 76 |
frm.del.value=1; |
| 77 |
frm.submit(); |
| 78 |
} |
| 79 |
} |
| 80 |
</script> |
| 81 |
|