Permalink
Browse files

I have just found a cute function called print_checkbox. :)

  • Loading branch information...
1 parent 6b4f186 commit 527d142c438360c91fb56f99e1ce27c2cd85d64f ethem committed May 18, 2006
Showing with 18 additions and 24 deletions.
  1. +11 −14 enrol/authorize/config.html
  2. +7 −10 enrol/authorize/locallib.php
@@ -21,9 +21,9 @@
$frm->an_cutoff_hour = intval($CFG->an_cutoff) / 60;
$frm->an_cutoff_min = intval($CFG->an_cutoff) % 60;
}
-
if (!isset($frm->an_cutoff_hour)) $frm->an_cutoff_hour = '0';
if (!isset($frm->an_cutoff_min)) $frm->an_cutoff_min = '5';
+
if (!isset($frm->acceptccs)) {
$frm->acceptccs = array_keys(get_list_of_creditcards());
$CFG->an_acceptccs = implode(',', $frm->acceptccs);
@@ -90,25 +90,22 @@
<tr valign="top">
<td align="right">an_avs:</td>
- <td><input type="checkbox" value="1" name="an_avs" <?php if (!empty($frm->an_avs)) echo "checked=\"true\"" ?> /></td>
+ <td><?php print_checkbox('an_avs', '1', !empty($frm->an_avs)) ?></td>
<td><?php print_string("adminavs", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">an_test:</td>
- <td><input type="checkbox" value="1" name="an_test" <?php if (!empty($frm->an_test)) echo "checked=\"true\"" ?> /></td>
+ <td><?php print_checkbox('an_test', '1', !empty($frm->an_test)) ?></td>
<td><?php print_string("antestmode", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">an_acceptccs:</td>
<td><?php
- foreach (get_list_of_creditcards(true) as $key => $val) {
- echo '<input type="checkbox" name="acceptccs[]" value="'.$key.'"';
- if (stristr($CFG->an_acceptccs, $key) !== false) {
- echo ' checked="checked"';
- }
- echo " /> $val<br />\n";
+ $allccs = get_list_of_creditcards(true);
+ foreach ($allccs as $key => $val) {
+ print_checkbox('acceptccs[]', $key, stristr($CFG->an_acceptccs, $key) !== false, $val); echo "<br />\n";
}
?></td>
<td><?php print_string("adminacceptccs", "enrol_authorize") ?></td>
@@ -124,13 +121,13 @@
<tr valign="top">
<td align="right">an_teachermanagepay:</td>
- <td><input type="checkbox" value="1" name="an_teachermanagepay" <?php if (!empty($frm->an_teachermanagepay)) echo "checked=\"true\"" ?> /></td>
+ <td><?php print_checkbox('an_teachermanagepay', '1', !empty($frm->an_teachermanagepay)) ?></td>
<td><?php print_string("adminteachermanagepay", "enrol_authorize") ?></td>
</tr>
<tr valign="top">
<td align="right">an_review:</td>
- <td><input type="checkbox" value="1" name="an_review" <?php if (!empty($frm->an_review)) echo "checked=\"true\"" ?> />
+ <td><?php print_checkbox('an_review', '1', !empty($frm->an_review)) ?></td>
<?php helpbutton('review', get_string('adminhelpreviewtitle', 'enrol_authorize'), 'enrol/authorize'); ?></td>
<td><?php print_string("adminreview", "enrol_authorize") ?></td>
</tr>
@@ -152,19 +149,19 @@
<tr valign="top">
<td align="right">enrol_mailstudents:</td>
- <td><input type="checkbox" value=1 name="enrol_mailstudents" <?php if (!empty($frm->enrol_mailstudents)) echo "checked=\"true\"" ?> /></td>
+ <td><?php print_checkbox('enrol_mailstudents', '1', !empty($frm->enrol_mailstudents)) ?></td>
<td><?php print_string("mailstudents") ?></td>
</tr>
<tr valign="top">
<td align="right">enrol_mailteachers:</td>
- <td><input type="checkbox" value=1 name="enrol_mailteachers" <?php if (!empty($frm->enrol_mailteachers)) echo "checked=\"true\"" ?> /></td>
+ <td><?php print_checkbox('enrol_mailteachers', '1', !empty($frm->enrol_mailteachers)) ?></td>
<td><?php print_string("mailteachers") ?></td>
</tr>
<tr valign="top">
<td align="right">enrol_mailadmins:</td>
- <td><input type="checkbox" value=1 name="enrol_mailadmins" <?php if (!empty($frm->enrol_mailadmins)) echo "checked=\"true\"" ?> /></td>
+ <td><?php print_checkbox('enrol_mailadmins', '1', !empty($frm->enrol_mailadmins)) ?></td>
<td><?php print_string("mailadmins") ?></td>
</tr>
@@ -188,7 +188,7 @@ function authorize_print_order_details($orderno)
echo "<form action=\"index.php\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"order\" value=\"$orderno\">\n";
- echo "<input type=\"hidden\" name=\"sesskey\" value=\"" . sesskey() . "\" />";
+ echo "<input type=\"hidden\" name=\"sesskey\" value=\"" . sesskey() . "\" />";
$settled = settled($order);
$status = authorize_get_status_action($order);
@@ -280,8 +280,8 @@ function authorize_print_order_details($orderno)
if (($amount > $upto) || empty($confirm)) {
$a->upto = $upto;
$strcanbecredit = get_string('canbecredit', 'enrol_authorize', $a);
- $table->data[] = array("<b>$authstrs->unenrolstudent</b>",
- "<input type='checkbox' name='unenrol' value='y'" . (!empty($unenrol) ? " checked" : "") . ">");
+ $cbunenrol = print_checkbox('unenrol', 'y', !empty($unenrol), '', '', '', true);
+ $table->data[] = array("<b>$authstrs->unenrolstudent</b>", $cbunenrol);
$table->data[] = array("<b>$authstrs->howmuch</b>",
"<input type='hidden' name='confirm' value='y'>
<input type='text' size='5' name='amount' value='$amount'>
@@ -373,10 +373,8 @@ function authorize_print_order_details($orderno)
$a->transid = $suborder->transid;
$a->amount = $suborder->amount;
$strsubvoidyes = get_string('subvoidyes', 'enrol_authorize', $a);
-
- $table->data[] = array("<b>$authstrs->unenrolstudent</b>",
- "<input type='checkbox' name='unenrol' value='y'" . (!empty($unenrol) ? " checked" : "") . ">");
-
+ $cbunenrol = print_checkbox('unenrol', 'y', !empty($unenrol), '', '', '', true);
+ $table->data[] = array("<b>$authstrs->unenrolstudent</b>", $cbunenrol);
$table->data[] = array("<b>$strs->confirm:</b>",
"$strsubvoidyes<br /><input type='hidden' name='".ORDER_VOID."' value='y'>
<input type='hidden' name='confirm' value='y'>
@@ -415,9 +413,8 @@ function authorize_print_order_details($orderno)
error(get_string('youcantdo', 'enrol_authorize', $a));
}
if (empty($confirm)) {
- $table->data[] = array("<b>$authstrs->unenrolstudent</b>",
- "<input type='checkbox' name='unenrol' value='y'" . (!empty($unenrol) ? " checked" : "") . ">");
-
+ $cbunenrol = print_checkbox('unenrol', 'y', !empty($unenrol), '', '', '', true);
+ $table->data[] = array("<b>$authstrs->unenrolstudent</b>", $cbunenrol);
$table->data[] = array("<b>$strs->confirm:</b>",
"<input type='hidden' name='".ORDER_DELETE."' value='y'>
<input type='hidden' name='confirm' value='y'>

0 comments on commit 527d142

Please sign in to comment.