Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-54653

Move the Turn editing on button to the user menu.

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Minor Minor
    • None
    • 3.0.4
    • Administration
    • None

      I've seen quite a few issues in various statuses, including 'Reopened', related to the method of activation of editing mode. The current approach, a button in the navbar section, appears to be inconsistent between pages (it needs to be explicitly added in contributed plugins) and is not particularly aesthetic. It also takes too much space where we can otherwise do without the navbar.

      It seems to me that the natural place for this action is the User menu.

      Editing mode is off:

      Editing mode is on:

      (In this illustration the Administration block is visible only in editing mode on to reduce clutter, but that's a different story)

      The effect can be acheived by a minor addition in user_get_user_navigation_info() in user/lib.php. The additional code could look something like:

          // Editing link.
          if ($buildlogout and $page->user_allowed_editing()) {
       
              // Set user editing mode.
              global $USER;
              $pageurl = $page->url;
              $changeediting = optional_param('edit', -1, PARAM_BOOL);
              if ($changeediting != -1) {
                  $USER->editing = $changeediting;
                  $pageurl->remove_params('edit');
                  redirect($pageurl);
              }
       
              $editing = new stdClass();
              $editing->itemtype = 'link';
              if ($page->user_is_editing()) {
                  $title = get_string('turneditingoff');
                  $pix = "i/edit";
                  $url = new moodle_url($pageurl, array('edit' => '0', 'sesskey' => sesskey()));
              } else {
                  $title = get_string('turneditingon');
                  $pix = "i/edit";
                  $url = new moodle_url($pageurl, array('edit' => '1', 'sesskey' => sesskey()));
              }
              $editing->url = $url;
              $editing->pix = $pix;
              $editing->title = $title;
              $editing->titleidentifier = 'editing,moodle';
              $returnobject->navitems[] = $editing;
          }
      

      I haven't investigated this approach thoroughly so there may be some important challenges that I'm missing. Any input would be appreciated.

            Unassigned Unassigned
            itamart Itamar Tzadok (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.