Пример #1
0
             $jsmodule = array('name' => 'local_rcommon', 'fullpath' => '/local/rcommon/javascript.js', 'requires' => array('base', 'io', 'panel'));
             $PAGE->requires->js_init_call('M.local_rcommon.init', array(), true, $jsmodule);
         }
     }
     break;
 case 'delete':
     $id = required_param('id', PARAM_INT);
     $username = isset($username) ? $username : optional_param('username', $USER->username, PARAM_TEXT);
     $confirm = optional_param('confirm', false, PARAM_BOOL);
     if (!$confirm) {
         echo '<p>' . get_string('keyconfirmdelete', 'local_rcommon') . '</p>';
         echo '<br/>';
         echo '<a href="users.php?action=delete&username='******'&confirm=true&id=' . $id . '">' . get_string('keydelbtn', 'local_rcommon') . '</a> &nbsp;&nbsp;<a href="users.php?action=manage&username='******'">' . get_string('back') . '</a>';
     } else {
         // Delete
         credentials::delete($id);
         echo '<script>document.location.href="users.php?action=manage&username='******'";</script>';
     }
     break;
 default:
     require_capability('local/rcommon:managecredentials', context_system::instance());
     $usercount = get_users(false, '', true);
     $with_credentials = $DB->get_field_sql('SELECT DISTINCT count(u.id) AS with_credentials FROM {user} u WHERE u.id IN (SELECT uc.euserid FROM {rcommon_user_credentials} uc GROUP BY uc.euserid)');
     $a = new StdClass();
     $a->total_users = $usercount;
     $a->with_credentials = $with_credentials;
     echo '<p>' . get_string('users_proportion', 'local_rcommon', $a) . '</p>';
     $context = context_system::instance();
     $site = get_site();
     $sort = optional_param('sort', 'firstname', PARAM_TEXT);
     $dir = optional_param('dir', 'ASC', PARAM_TEXT);