You are here

function panels_renderer_ipe::ipe_test_lock in Panels 7.3

This is a generic lock test.

2 calls to panels_renderer_ipe::ipe_test_lock()
panels_renderer_ipe::ajax_change_layout in panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php
AJAX entry point to create the controller form for an IPE.
panels_renderer_ipe::ajax_save_form in panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php
AJAX entry point to create the controller form for an IPE.

File

panels_ipe/plugins/display_renderers/panels_renderer_ipe.class.php, line 255

Class

panels_renderer_ipe
Renderer class for all In-Place Editor (IPE) behavior.

Code

function ipe_test_lock($url, $break) {
  if (!empty($this->cache->locked)) {
    if ($break != 'break') {
      $account = user_load($this->cache->locked->uid);
      $name = format_username($account);
      $lock_age = format_interval(time() - $this->cache->locked->updated);
      $message = t("This panel is being edited by user !user, and is therefore locked from editing by others. This lock is !age old.\n\nClick OK to break this lock and discard any changes made by !user.", array(
        '!user' => $name,
        '!age' => $lock_age,
      ));
      $this->commands[] = array(
        'command' => 'unlockIPE',
        'message' => $message,
        'break_path' => url($this
          ->get_url($url, 'break')),
        'key' => $this->clean_key,
      );
      return TRUE;
    }

    // Break the lock.
    panels_edit_cache_break_lock($this->cache);
  }
}