You are here

function timeline_bookmark_resume_get in MediaFront 7.2

Function to get the latest resume timeline bookmark.

1 string reference to 'timeline_bookmark_resume_get'
timeline_bookmark_menu in modules/timeline_bookmark/timeline_bookmark.module
Implements hook_menu().

File

modules/timeline_bookmark/timeline_bookmark.module, line 388

Code

function timeline_bookmark_resume_get($account, $entity_type, $entity_id) {
  global $user;
  $error = '';

  // Check to make sure the user is logged in or is admin.
  if ($user->uid == $account->uid || user_access("administer nodes")) {
    $bookmark = new stdClass();
    $bookmark->uid = $account->uid;
    $bookmark->entity_type = $entity_type;
    $bookmark->entity_id = $entity_id;
    $bookmark->type = 'resume';
    $bookmark = timeline_bookmark_get($bookmark);
    if ($bookmark) {
      drupal_add_http_header('Content-Type', 'text/javascript; charset=utf-8');
      print drupal_json_encode($bookmark);
      drupal_exit();
    }
    else {
      $error = 'Bookmark does not exist.';
    }
  }
  else {
    $error = 'Permission Denied.';
  }

  // An error occured.
  drupal_add_http_header('Content-Type', 'text/javascript; charset=utf-8');
  print drupal_json_encode(array(
    'status' => FALSE,
    'errorMessage' => $error,
  ));
  drupal_exit();
}