diff --git a/admin/webservice/service_users.php b/admin/webservice/service_users.php
index 74a48a9814c..bf9b8798f84 100644
--- a/admin/webservice/service_users.php
+++ b/admin/webservice/service_users.php
@@ -177,28 +177,13 @@ if (!empty($allowedusers)) {
}
$contents .= $OUTPUT->select($select);
}
- $checkbox = new html_select_option();
- $checkbox->value = 1;
- $checkbox->id = 'enablevaliduntil'.$user->id;
- $checkbox->name = 'enablevaliduntil';
- $checkbox->selected = empty($user->validuntil)?false:true;
- $checkbox->text = get_string('enabled', 'webservice');
- $checkbox->label->text = get_string('enabled', 'webservice');
- $checkbox->alt = get_string('enabled', 'webservice');
- $checkbox->add_action('change', 'external_disablevaliduntil', array($user->id)); //into admin/webservice/script.js
- $contents .= $OUTPUT->checkbox($checkbox, 'enablevaliduntil');
- $contents .= ""; //init date selector disable status
+ $contents .= html_writer::checkbox('enablevaliduntil', 1, !empty($user->validuntil), get_string('enabled', 'webservice'), array('id'=>'enablevaliduntil'.$user->id));
+ // TODO: init date selector using standard $PAGE->requires->js_init_call();
$contents .= "";
//TO IMPLEMENT : assign the required capability (if needed)
$contents .= "
";
- $checkbox = new html_select_option();
- $checkbox->value = $user->id;
- $checkbox->selected = false;
- $checkbox->text = ' ';
- $checkbox->label->text = ' ';
- $checkbox->alt = 'TODO:'.get_string('addrequiredcapability', 'webservice');
- $contents .= $OUTPUT->checkbox($checkbox, 'addcap')."
";
+ $contents .= html_writer::checkbox('addcap', 1, 'TODO:'.get_string('addrequiredcapability', 'webservice'));
$contents .= '';
$contents .= '';
$contents .= '';
diff --git a/enrol/authorize/config_form.php b/enrol/authorize/config_form.php
index 13f190533f3..6da095ef041 100755
--- a/enrol/authorize/config_form.php
+++ b/enrol/authorize/config_form.php
@@ -99,7 +99,7 @@ if (!isset($frm->acceptechecktypes)) {
| delete_current: |
- checkbox(html_select_option::make_checkbox('1', !empty($frm->delete_current), get_string("deletecheck", "moodle", get_string('oldpassword'))), 'delete_current');?>
+ | delete_current), get_string("deletecheck", "moodle", get_string('oldpassword')));?>
|
@@ -122,20 +122,20 @@ if (!isset($frm->acceptechecktypes)) {
| an_avs: |
- checkbox(html_select_option::make_checkbox('1', !empty($frm->an_avs), get_string("adminavs", "enrol_authorize")), 'an_avs'); ?>
+ | an_avs), get_string("adminavs", "enrol_authorize")); ?>
|
| an_authcode: |
- checkbox(html_select_option::make_checkbox('1', !empty($frm->an_authcode), get_string("adminauthcode", "enrol_authorize")), 'an_authcode'); ?>
+ | an_authcode), get_string("adminauthcode", "enrol_authorize")); ?>
help_icon('authorize/authcode', 'authcode', 'enrol'); ?>
|
| an_test: |
- checkbox(html_select_option::make_checkbox('1', !empty($frm->an_test), get_string("antestmode", "enrol_authorize")), 'an_test'); ?>
+ | an_test), get_string("antestmode", "enrol_authorize")); ?>
|
@@ -146,26 +146,26 @@ if (!isset($frm->acceptechecktypes)) {
$allpaymentmethods = get_list_of_payment_methods(true);
foreach ($allpaymentmethods as $key) {
if ($key == AN_METHOD_CC) {
- echo $OUTPUT->checkbox(html_select_option::make_checkbox(AN_METHOD_CC, in_array(AN_METHOD_CC, $paymentmethodsenabled), get_string('method'.AN_METHOD_CC,'enrol_authorize')), 'acceptmethods[]');
+ echo html_writer::checkbox('acceptmethods[]', AN_METHOD_CC, in_array(AN_METHOD_CC, $paymentmethodsenabled), get_string('method'.AN_METHOD_CC,'enrol_authorize'));
echo(""); // blockquote breaks and
tags
$acceptedccs = array_keys(get_list_of_creditcards());
$allccs = get_list_of_creditcards(true);
foreach ($allccs as $key => $val) {
echo "- ";
- echo $OUTPUT->checkbox(html_select_option::make_checkbox($key, in_array($key, $acceptedccs), $val), 'acceptccs[]');
+ echo html_writer::checkbox('acceptccs[]', $key, in_array($key, $acceptedccs), $val);
echo "
";
}
echo("
");
}
elseif ($key == AN_METHOD_ECHECK) {
- $checkbox = html_select_option::make_checkbox(AN_METHOD_ECHECK, in_array(AN_METHOD_ECHECK, $paymentmethodsenabled), get_string('method'.AN_METHOD_ECHECK,'enrol_authorize'));
+ $checkbox = html_writer::checkbox('enrol_authorize', AN_METHOD_ECHECK, in_array(AN_METHOD_ECHECK, $paymentmethodsenabled), get_string('method'.AN_METHOD_ECHECK));
echo $OUTPUT->checkbox($checkbox, 'acceptmethods[]');
echo(""); // blockquote breaks and
tags
$echecktypesenabled = get_list_of_bank_account_types();
$allechecktypes = get_list_of_bank_account_types(true);
foreach ($allechecktypes as $key) {
echo "- ";
- echo $OUTPUT->checkbox(html_select_option::make_checkbox($key, in_array($key, $echecktypesenabled), get_string('echeck'.strtolower($key),'enrol_authorize')), 'acceptechecktypes[]');
+ echo html_writer::checkbox('acceptechecktypes[]', $key, in_array($key, $echecktypesenabled), get_string('echeck'.strtolower($key)));
echo "
";
}
echo("
");
@@ -180,7 +180,7 @@ if (!isset($frm->acceptechecktypes)) {
| an_review: |
- checkbox(html_select_option::make_checkbox('1', !empty($frm->an_review), get_string("adminreview", "enrol_authorize")), 'an_review'); ?>
+ | an_review), get_string("adminreview", "enrol_authorize")); ?>
help_icon('authorize/review', get_string('adminhelpreviewtitle', 'enrol_authorize'), 'enrol'); ?>
|
@@ -203,7 +203,7 @@ if (!isset($frm->acceptechecktypes)) {
| an_emailexpiredteacher: |
- checkbox(html_select_option::make_checkbox('1', !empty($frm->an_emailexpiredteacher), get_string("adminemailexpiredteacher", "enrol_authorize")), 'an_emailexpiredteacher'); ?>
+ | an_emailexpiredteacher), get_string("adminemailexpiredteacher", "enrol_authorize")); ?>
|
@@ -220,19 +220,19 @@ if (!isset($frm->acceptechecktypes)) {
| enrol_mailstudents: |
- checkbox(html_select_option::make_checkbox('1', !empty($frm->enrol_mailstudents), get_string("mailstudents")), 'enrol_mailstudents'); ?>
+ | enrol_mailstudents), get_string("mailstudents")); ?>
|
| enrol_mailteachers: |
- checkbox(html_select_option::make_checkbox('1', !empty($frm->enrol_mailteachers), get_string("mailteachers")), 'enrol_mailteachers'); ?>
+ | enrol_mailteachers), get_string("mailteachers")); ?>
|
| enrol_mailadmins: |
- checkbox(html_select_option::make_checkbox('1', !empty($frm->enrol_mailadmins), get_string("mailadmins")), 'enrol_mailadmins'); ?>
+ | enrol_mailadmins), get_string("mailadmins")); ?>
|
diff --git a/enrol/authorize/locallib.php b/enrol/authorize/locallib.php
index edc4a21b4ed..7a63a876f3a 100644
--- a/enrol/authorize/locallib.php
+++ b/enrol/authorize/locallib.php
@@ -69,10 +69,10 @@ function authorize_print_orders($courseid, $userid) {
$popupmenu .= $OUTPUT->select(html_select::make_popup_form($baseurl.'&course='.$courseid, 'status', $statusmenu, 'statusmenu', $status));
if ($canmanagepayments) {
$popupmenu .= '
';
- $checkbox = html_select_option::make_checkbox(1, $userid == $USER->id, get_string('mypaymentsonly', 'enrol_authorize'));
+ $id = html_writer::random_id('ea');
$PAGE->requires->js('/enrol/authorize/authorize.js');
- $checkbox->add_action('click', 'authorize_jump_to_mypayments', array('userid' => $USER->id, 'status' => $status));
- $popupmenu .= $OUTPUT->checkbox($checkbox, 'showonlymy');
+ $OUTPUT->add_action_handler($id, new component_action('click', 'authorize_jump_to_mypayments', array('userid' => $USER->id, 'status' => $status)));
+ $popupmenu .= html_writer::checkbox('enrol_authorize', 1, $userid == $USER->id, get_string('mypaymentsonly', 'enrol_authorize'), array('id'=>$id));
}
if (SITEID != $courseid) {
@@ -670,7 +670,7 @@ function authorize_print_action_button($orderid, $do, $suborderid=0, $confirm=fa
$ret .= '';
}
if (!empty($unenrol)) {
- $ret .= $OUTPUT->checkbox(html_select_option::make_checkbox(1, false, $unenrol), 'unenrol') . '
';
+ $ret .= html_writer::checkbox('unenrol', 1, false, $unenrol) . '
';
}
$ret .= $extrahtml;
$ret .= '' .
diff --git a/grade/edit/tree/lib.php b/grade/edit/tree/lib.php
index 97cebcfdfb8..e72230ff429 100755
--- a/grade/edit/tree/lib.php
+++ b/grade/edit/tree/lib.php
@@ -1149,33 +1149,15 @@ class grade_edit_tree_column_select extends grade_edit_tree_column {
}
public function get_item_cell($item, $params) {
- global $OUTPUT;
if (empty($params['itemtype']) || empty($params['eid'])) {
- throw new Exception('Array key (itemtype or eid) missing from 2nd param of grade_edit_tree_column_select::get_item_cell($item, $params)');
+ error('Array key (itemtype or eid) missing from 2nd param of grade_edit_tree_column_select::get_item_cell($item, $params)');
}
$itemselect = '';
if ($params['itemtype'] != 'course' && $params['itemtype'] != 'category') {
- $itemselect = html_select_option::make_checkbox('0', false, get_string('select'));
- $itemselect->label->add_class('accesshide');
- $itemselect->add_action('change', 'toggleCategorySelector');
- $itemselect->add_class('itemselect');
- $itemselect = $OUTPUT->checkbox($itemselect, 'select_'.$params['eid']);
+ $itemselect = ''; // TODO: convert to YUI handler
}
- /*
- if (empty($params['itemtype']) || empty($params['eid'])) {
- throw new Exception('Array key (itemtype or eid) missing from 2nd param of grade_edit_tree_column_select::get_item_cell($item, $params)');
- }
- $itemselect = '';
-
- if ($params['itemtype'] != 'course' && $params['itemtype'] != 'category') {
- $itemselect = '';
- }
- */
- $itemcell = clone($this->itemcell);
- $itemcell->add_classes(array('last', 'selection'));
- $itemcell->text = $itemselect;
- return $itemcell;
+ return '' . $itemselect . ' | ';
}
public function is_hidden($mode='simple') {
diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php
index f5278082170..f0a76b41692 100644
--- a/lib/deprecatedlib.php
+++ b/lib/deprecatedlib.php
@@ -3434,7 +3434,7 @@ function print_checkbox($name, $value, $checked = true, $label = '', $alt = '',
debugging('The use of the $script param in print_checkbox has not been migrated into $OUTPUT->checkbox. Please use $checkbox->add_action().', DEBUG_DEVELOPER);
}
- $output = $OUTPUT->checkbox(html_select_option::make_checkbox($value, $checked, $label, $alt), $name);
+ $output = html_writer::checkbox($name, $value, $checked, $label);
if (empty($return)) {
echo $output;
diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php
index 2323e30ba0b..2be065b732e 100644
--- a/lib/outputcomponents.php
+++ b/lib/outputcomponents.php
@@ -1606,24 +1606,6 @@ class html_select_option extends labelled_html_component {
parent::prepare($output, $page, $target);
}
-
- /**
- * Shortcut for making a checkbox-ready option
- * @param string $value The value of the checkbox
- * @param boolean $checked
- * @param string $label
- * @param string $alt
- * @return html_select_option A component ready for $OUTPUT->checkbox()
- */
- public static function make_checkbox($value, $checked, $label, $alt=null) {
- $checkbox = new html_select_option();
- $checkbox->value = $value;
- $checkbox->selected = $checked;
- $checkbox->text = $label;
- $checkbox->label->text = $label;
- $checkbox->alt = $alt;
- return $checkbox;
- }
}
diff --git a/mod/data/field/checkbox/field.class.php b/mod/data/field/checkbox/field.class.php
index 3f99354551c..5c1436ce64e 100755
--- a/mod/data/field/checkbox/field.class.php
+++ b/mod/data/field/checkbox/field.class.php
@@ -80,16 +80,16 @@ class data_field_checkbox extends data_field_base {
$checkbox = trim($checkbox);
if (in_array(addslashes($checkbox), $content)) {
- $str .= $OUTPUT->checkbox(html_select_option::make_checkbox(s($checkbox), true, $checkbox), 'f_'.$this->field->id.'[]');
+ $str .= html_writer::checkbox('f_'.$this->field->id.'[]', s($checkbox), true, $checkbox);
}
- $str .= $OUTPUT->checkbox(html_select_option::make_checkbox(s($checkbox), false, $checkbox), 'f_'.$this->field->id.'[]');
+ $str .= html_writer::checkbox('f_'.$this->field->id.'[]', s($checkbox), false, $checkbox);
$found = true;
}
if (!$found) {
return '';
}
- $str .= $OUTPUT->checkbox(html_select_option::make_checkbox(null, false, get_string('selectedrequired', 'data')), 'f_'.$this->field->id.'_allreq');
+ $str .= html_writer::checkbox('f_'.$this->field->id.'_allreq', null, false, get_string('selectedrequired', 'data'));
return $str;
}
diff --git a/mod/feedback/lib.php b/mod/feedback/lib.php
index b5680f298d3..61289201ee2 100644
--- a/mod/feedback/lib.php
+++ b/mod/feedback/lib.php
@@ -506,9 +506,9 @@ function feedback_reset_course_form($course) {
foreach($feedbacks as $feedback) {
echo '';
echo get_string('name','feedback').': '.$feedback->name.'
';
- echo $OUTPUT->checkbox(html_select_option::make_checkbox(1, true, get_string('resetting_data','feedback')), FEEDBACK_RESETFORM_RESET.$feedback->id);
+ echo html_writer::checkbox(FEEDBACK_RESETFORM_RESET.$feedback->id, 1, true, get_string('resetting_data','feedback'));
echo '
';
- echo $OUTPUT->checkbox(html_select_option::make_checkbox(1, false, get_string('drop_feedback','feedback')), FEEDBACK_RESETFORM_DROP.$feedback->id);
+ echo html_writer::checkbox(FEEDBACK_RESETFORM_DROP.$feedback->id, 1, false, get_string('drop_feedback','feedback'));
echo '
';
}
}