function timeline_bookmark_resume in MediaFront 7.2
Function to submit a timeline resume entry.
1 string reference to 'timeline_bookmark_resume'
- timeline_bookmark_menu in modules/
timeline_bookmark/ timeline_bookmark.module - Implements hook_menu().
File
- modules/
timeline_bookmark/ timeline_bookmark.module, line 425
Code
function timeline_bookmark_resume($account, $entity_type, $entity_id, $mediatime) {
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';
$existing = timeline_bookmark_get($bookmark);
if ($existing) {
$bookmark = $existing;
}
// Update the time.
$bookmark->timestamp = time();
$bookmark->mediatime = $mediatime;
// Print out the result.
if ($bookmark = timeline_bookmark_save($bookmark)) {
// Print out a success message and the bookmark.
drupal_add_http_header('Content-Type', 'text/javascript; charset=utf-8');
print drupal_json_encode($bookmark);
drupal_exit();
}
else {
$error = 'Unable to save bookmark.';
}
}
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();
}