| | 7 | |
|---|
| | 8 | function iutilities_admin() { |
|---|
| | 9 | $form['disk_space_limit'] = array( |
|---|
| | 10 | '#type' => 'textfield', |
|---|
| | 11 | '#title' => t('Maximum space allowed'), |
|---|
| | 12 | '#default_value' => variable_get('disk_space_limit', 150), |
|---|
| | 13 | '#size' => 5, |
|---|
| | 14 | '#maxlength' => 4, |
|---|
| | 15 | '#field_suffix' => t('MB'), |
|---|
| | 16 | '#description' => t("Each illuminate ict website is permitted a certain amount of space. By default this is 150MB. This can be increased here."), |
|---|
| | 17 | '#required' => TRUE, |
|---|
| | 18 | ); |
|---|
| | 19 | return system_settings_form($form); |
|---|
| | 20 | } |
|---|
| | 37 | $items['admin/settings/diskusage'] = array( |
|---|
| | 38 | 'title' => 'Set Disk Usage Limit', |
|---|
| | 39 | 'description' => 'The default 150MB space allowance set by illuminate ICT can be increased here.', |
|---|
| | 40 | 'access callback' => 'access_disk_usage_settings', |
|---|
| | 41 | 'access arguments' => array('access disk usage settings'), |
|---|
| | 42 | 'page callback' => 'drupal_get_form', |
|---|
| | 43 | 'page arguments' => array(iutilities_admin), |
|---|
| | 44 | ); |
|---|
| | 45 | return $items; |
|---|
| | 47 | |
|---|
| | 48 | function stuff() { |
|---|
| | 49 | return "Hello"; |
|---|
| | 50 | } |
|---|
| | 51 | |
|---|
| | 52 | function access_disk_usage_settings() { |
|---|
| | 53 | global $user; |
|---|
| | 54 | if ( $user->uid == 1 ) { |
|---|
| | 55 | return TRUE; |
|---|
| | 56 | } else { |
|---|
| | 57 | return FALSE; |
|---|
| | 58 | } |
|---|
| | 59 | } |
|---|
| | 60 | |
|---|
| | 61 | function display_diskusage_report() { |
|---|
| | 62 | $space_used = variable_get('disk_space_used',150); |
|---|
| | 63 | $space_limit = variable_get('disk_space_limit',150); |
|---|
| | 64 | $space_percentage = ( $space_used / $space_limit ) * 100; |
|---|
| | 65 | $output = '<p>Your hosting account with illuminate ICT allows a maximum of <strong>'. $space_limit . 'MB</strong>.</p>'; |
|---|
| | 66 | $output .= '<p>You are currently using <strong>' . $space_used . 'MB</strong> of your allowance.</p>'; |
|---|
| | 67 | $output .= '<p>This is <strong>' . $space_percentage . '%</strong> of the available space.</p>'; |
|---|
| | 68 | return $output; |
|---|
| | 69 | } |
|---|
| | 70 | |
|---|