You are here

function imagepicker_quota_ok in Image Picker 7

Same name and namespace in other branches
  1. 5.2 imagepicker.module \imagepicker_quota_ok()
  2. 6.2 imagepicker.functions.inc \imagepicker_quota_ok()

Checks quotas

Parameters

$src: Tells the function where the request is coming from

$account: Optional user account object.

$label: Optional label to pass through to the theme

$help: Optional help to pass through to the theme

Return value

Returns the quota message along with the upload form, all themed

3 calls to imagepicker_quota_ok()
imagepicker_admin_images in ./imagepicker.admin.inc
imagepicker_upload in ./imagepicker.upload.inc
imagepicker_user_upload in ./imagepicker.upload.inc

File

./imagepicker.functions.inc, line 2246
@author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function imagepicker_quota_ok($src, $account = FALSE, $label = "", $help = "") {
  if ($account) {
    $user = $account;
  }
  else {
    global $user;
  }
  $ret = _imagepicker_quota_check($src, $account);
  $quota_ok = $ret[0];
  $message1 = $ret[1];
  $message2 = $ret[2];
  $form = '';
  if ($quota_ok) {
    if ($account) {
      if ($src == 'admin') {
        $form = drupal_get_form('imagepicker_upload_form', $user, TRUE);
      }
      elseif ($src == 'user') {
        $form = drupal_get_form('imagepicker_upload_form', $user);
      }
    }
    else {
      $form = drupal_get_form('imagepicker_upload_form');
    }
  }
  return theme('imagepicker_quota_message', array(
    'message1' => $message1,
    'message2' => $message2,
    'form' => $form,
    'label' => $label,
    'help' => $help,
  ));
}