Skip to content

Commit

Permalink
MDL-19756 Deprecated update_mymoodle_icon() and upgraded my/index.php…
Browse files Browse the repository at this point in the history
… with new output code
  • Loading branch information
nicolasconnault committed Aug 5, 2009
1 parent 6e22a1d commit 7527a2f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
15 changes: 15 additions & 0 deletions lib/deprecatedlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -3543,3 +3543,18 @@ function print_heading_with_help($text, $helppage, $module='moodle', $icon=false
echo $output;
}
}

/**
* Returns a turn edit on/off button for course in a self contained form.
* Used to be an icon, but it's now a simple form button
*
* @deprecated since Moodle 2.0
*
* @global object
* @global object
* @param int $courseid The course to update by id as found in 'course' table
* @return string
*/
function update_mymoodle_icon() {
throw new coding_exception('update_mymoodle_icon() has been completely deprecated.');
}
27 changes: 0 additions & 27 deletions lib/weblib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2764,33 +2764,6 @@ function switchroles_form($courseid) {
}


/**
* Returns a turn edit on/off button for course in a self contained form.
* Used to be an icon, but it's now a simple form button
*
* @global object
* @global object
* @param int $courseid The course to update by id as found in 'course' table
* @return string
*/
function update_mymoodle_icon() {

global $CFG, $USER;

if (!empty($USER->editing)) {
$string = get_string('updatemymoodleoff');
$edit = '0';
} else {
$string = get_string('updatemymoodleon');
$edit = '1';
}

return "<form $CFG->frametarget method=\"get\" action=\"$CFG->wwwroot/my/index.php\">".
"<div>".
"<input type=\"hidden\" name=\"edit\" value=\"$edit\" />".
"<input type=\"submit\" value=\"$string\" /></div></form>";
}

/**
* Returns a turn edit on/off button for tag in a self contained form.
*
Expand Down
14 changes: 13 additions & 1 deletion my/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,19 @@
$USER->editing = $edit;
}

$button = update_mymoodle_icon($USER->id);
if (!empty($USER->editing)) {
$string = get_string('updatemymoodleoff');
$edit = '0';
} else {
$string = get_string('updatemymoodleon');
$edit = '1';
}

$form = new html_form();
$form->url = new moodle_url("$CFG->wwwroot/my/index.php", array('edit' => $edit));
$form->button->text = $string;
$button = $OUTPUT->button($form);

$header = $SITE->shortname . ': ' . $strmymoodle;
$navigation = build_navigation($strmymoodle);
$loggedinas = user_login_string();
Expand Down

0 comments on commit 7527a2f

Please sign in to comment.