Skip to content

Commit

Permalink
I have just found a cute function called print_checkbox. :)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethem committed May 18, 2006
1 parent 6b4f186 commit 527d142
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 24 deletions.
25 changes: 11 additions & 14 deletions enrol/authorize/config.html
Expand Up @@ -21,9 +21,9 @@
$frm->an_cutoff_hour = intval($CFG->an_cutoff) / 60; $frm->an_cutoff_hour = intval($CFG->an_cutoff) / 60;
$frm->an_cutoff_min = 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_hour)) $frm->an_cutoff_hour = '0';
if (!isset($frm->an_cutoff_min)) $frm->an_cutoff_min = '5'; if (!isset($frm->an_cutoff_min)) $frm->an_cutoff_min = '5';

if (!isset($frm->acceptccs)) { if (!isset($frm->acceptccs)) {
$frm->acceptccs = array_keys(get_list_of_creditcards()); $frm->acceptccs = array_keys(get_list_of_creditcards());
$CFG->an_acceptccs = implode(',', $frm->acceptccs); $CFG->an_acceptccs = implode(',', $frm->acceptccs);
Expand Down Expand Up @@ -90,25 +90,22 @@


<tr valign="top"> <tr valign="top">
<td align="right">an_avs:</td> <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> <td><?php print_string("adminavs", "enrol_authorize") ?></td>
</tr> </tr>


<tr valign="top"> <tr valign="top">
<td align="right">an_test:</td> <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> <td><?php print_string("antestmode", "enrol_authorize") ?></td>
</tr> </tr>


<tr valign="top"> <tr valign="top">
<td align="right">an_acceptccs:</td> <td align="right">an_acceptccs:</td>
<td><?php <td><?php
foreach (get_list_of_creditcards(true) as $key => $val) { $allccs = get_list_of_creditcards(true);
echo '<input type="checkbox" name="acceptccs[]" value="'.$key.'"'; foreach ($allccs as $key => $val) {
if (stristr($CFG->an_acceptccs, $key) !== false) { print_checkbox('acceptccs[]', $key, stristr($CFG->an_acceptccs, $key) !== false, $val); echo "<br />\n";
echo ' checked="checked"';
}
echo " /> $val<br />\n";
} }
?></td> ?></td>
<td><?php print_string("adminacceptccs", "enrol_authorize") ?></td> <td><?php print_string("adminacceptccs", "enrol_authorize") ?></td>
Expand All @@ -124,13 +121,13 @@


<tr valign="top"> <tr valign="top">
<td align="right">an_teachermanagepay:</td> <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> <td><?php print_string("adminteachermanagepay", "enrol_authorize") ?></td>
</tr> </tr>


<tr valign="top"> <tr valign="top">
<td align="right">an_review:</td> <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> <?php helpbutton('review', get_string('adminhelpreviewtitle', 'enrol_authorize'), 'enrol/authorize'); ?></td>
<td><?php print_string("adminreview", "enrol_authorize") ?></td> <td><?php print_string("adminreview", "enrol_authorize") ?></td>
</tr> </tr>
Expand All @@ -152,19 +149,19 @@


<tr valign="top"> <tr valign="top">
<td align="right">enrol_mailstudents:</td> <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> <td><?php print_string("mailstudents") ?></td>
</tr> </tr>


<tr valign="top"> <tr valign="top">
<td align="right">enrol_mailteachers:</td> <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> <td><?php print_string("mailteachers") ?></td>
</tr> </tr>


<tr valign="top"> <tr valign="top">
<td align="right">enrol_mailadmins:</td> <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> <td><?php print_string("mailadmins") ?></td>
</tr> </tr>


Expand Down
17 changes: 7 additions & 10 deletions enrol/authorize/locallib.php
Expand Up @@ -188,7 +188,7 @@ function authorize_print_order_details($orderno)


echo "<form action=\"index.php\" method=\"post\">\n"; echo "<form action=\"index.php\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"order\" value=\"$orderno\">\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); $settled = settled($order);
$status = authorize_get_status_action($order); $status = authorize_get_status_action($order);
Expand Down Expand Up @@ -280,8 +280,8 @@ function authorize_print_order_details($orderno)
if (($amount > $upto) || empty($confirm)) { if (($amount > $upto) || empty($confirm)) {
$a->upto = $upto; $a->upto = $upto;
$strcanbecredit = get_string('canbecredit', 'enrol_authorize', $a); $strcanbecredit = get_string('canbecredit', 'enrol_authorize', $a);
$table->data[] = array("<b>$authstrs->unenrolstudent</b>", $cbunenrol = print_checkbox('unenrol', 'y', !empty($unenrol), '', '', '', true);
"<input type='checkbox' name='unenrol' value='y'" . (!empty($unenrol) ? " checked" : "") . ">"); $table->data[] = array("<b>$authstrs->unenrolstudent</b>", $cbunenrol);
$table->data[] = array("<b>$authstrs->howmuch</b>", $table->data[] = array("<b>$authstrs->howmuch</b>",
"<input type='hidden' name='confirm' value='y'> "<input type='hidden' name='confirm' value='y'>
<input type='text' size='5' name='amount' value='$amount'> <input type='text' size='5' name='amount' value='$amount'>
Expand Down Expand Up @@ -373,10 +373,8 @@ function authorize_print_order_details($orderno)
$a->transid = $suborder->transid; $a->transid = $suborder->transid;
$a->amount = $suborder->amount; $a->amount = $suborder->amount;
$strsubvoidyes = get_string('subvoidyes', 'enrol_authorize', $a); $strsubvoidyes = get_string('subvoidyes', 'enrol_authorize', $a);

$cbunenrol = print_checkbox('unenrol', 'y', !empty($unenrol), '', '', '', true);
$table->data[] = array("<b>$authstrs->unenrolstudent</b>", $table->data[] = array("<b>$authstrs->unenrolstudent</b>", $cbunenrol);
"<input type='checkbox' name='unenrol' value='y'" . (!empty($unenrol) ? " checked" : "") . ">");

$table->data[] = array("<b>$strs->confirm:</b>", $table->data[] = array("<b>$strs->confirm:</b>",
"$strsubvoidyes<br /><input type='hidden' name='".ORDER_VOID."' value='y'> "$strsubvoidyes<br /><input type='hidden' name='".ORDER_VOID."' value='y'>
<input type='hidden' name='confirm' value='y'> <input type='hidden' name='confirm' value='y'>
Expand Down Expand Up @@ -415,9 +413,8 @@ function authorize_print_order_details($orderno)
error(get_string('youcantdo', 'enrol_authorize', $a)); error(get_string('youcantdo', 'enrol_authorize', $a));
} }
if (empty($confirm)) { if (empty($confirm)) {
$table->data[] = array("<b>$authstrs->unenrolstudent</b>", $cbunenrol = print_checkbox('unenrol', 'y', !empty($unenrol), '', '', '', true);
"<input type='checkbox' name='unenrol' value='y'" . (!empty($unenrol) ? " checked" : "") . ">"); $table->data[] = array("<b>$authstrs->unenrolstudent</b>", $cbunenrol);

$table->data[] = array("<b>$strs->confirm:</b>", $table->data[] = array("<b>$strs->confirm:</b>",
"<input type='hidden' name='".ORDER_DELETE."' value='y'> "<input type='hidden' name='".ORDER_DELETE."' value='y'>
<input type='hidden' name='confirm' value='y'> <input type='hidden' name='confirm' value='y'>
Expand Down

0 comments on commit 527d142

Please sign in to comment.