You are here

function entityform_get_submissions in Entityform 7.2

Same name and namespace in other branches
  1. 7 entityform.module \entityform_get_submissions()

Get all the submissions for a user.

Parameters

string $type: The EntityformType to restrict submissions for.

int $uid: uid of user to get submissions for.

int $draft:

Return value

array

2 calls to entityform_get_submissions()
entityform_user_previous_submission in ./entityform.module
Get previous submission for a form for a user
entityform_user_submitted in ./entityform.module
Has the user submitted a form

File

./entityform.module, line 423
Module for the Entityform Entity - a starting point to create your own Entity and associated administration interface

Code

function entityform_get_submissions($type = NULL, $uid = NULL, $draft = 0, $limit = NULL) {
  $submissions = array();
  $query = new EntityFieldQuery();
  $query
    ->entityCondition('entity_type', "entityform");
  if ($type) {
    $query
      ->propertyCondition('type', $type);
  }

  // uid = 0 for anonymous users.
  if (isset($uid)) {
    $query
      ->propertyCondition('uid', $uid);
  }
  if ($draft !== NULL) {
    $query
      ->propertyCondition('draft', $draft);
  }
  if ($limit !== NULL) {
    $query
      ->range(0, $limit);
  }
  $result = $query
    ->execute();
  if (isset($result['entityform'])) {
    $submissions = $result['entityform'];
  }
  return $submissions;
}