本文整理汇总了PHP中entity::has_lock方法的典型用法代码示例。如果您正苦于以下问题:PHP entity::has_lock方法的具体用法?PHP entity::has_lock怎么用?PHP entity::has_lock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entity
的用法示例。
在下文中一共展示了entity::has_lock方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: entity
function show_other_links_item()
{
$show_delete = false;
$show_history = false;
$item = new entity($this->id);
$user = new entity($this->user_id);
if ($item->get_value('state') == 'Pending') {
$show_delete = reason_user_has_privs($this->user_id, 'delete_pending');
$show_history = reason_user_has_privs($this->user_id, 'edit_pending');
} else {
$show_delete = reason_user_has_privs($this->user_id, 'delete');
$show_history = reason_user_has_privs($this->user_id, 'edit');
}
$show_locks = defined('REASON_ENTITY_LOCKS_ENABLED') && REASON_ENTITY_LOCKS_ENABLED && reason_user_has_privs($this->user_id, 'manage_locks');
if (!$show_delete && !$show_history && !$show_locks) {
return;
}
echo '<div class="otherActionItems">' . "\n";
echo '<p class="otherActionItems"><strong>Other Action Items</strong></p>' . "\n";
echo '<ul class="leftList">' . "\n";
if ($show_delete) {
$state_locked = !$item->user_can_edit_field('state', $user);
$locked_class = !empty($state_locked) ? 'locked' : 'notLocked';
$locked_img = !empty($state_locked) ? '<img class="lockIndicator" src="' . REASON_HTTP_BASE_PATH . 'ui_images/lock_12px.png" alt="locked" width="12" height="12" />' : '';
if ($this->is_deletable()) {
echo '<li class="navItem';
if ($this->cur_module == 'Delete') {
echo ' navSelect';
}
echo ' ' . $locked_class . '">';
$page_name = 'Delete';
if ($this->cur_module == 'Delete') {
echo '<strong>' . $locked_img . $page_name . '</strong>';
} elseif ($item->get_value('state') == 'Deleted') {
echo '<a href="' . $this->make_link(array('cur_module' => 'Undelete')) . '" class="nav">' . $locked_img . 'Undelete</a>';
} else {
echo '<a href="' . $this->make_link(array('cur_module' => 'Delete')) . '" class="nav">' . $locked_img . $page_name . '</a>';
}
echo '</li>' . "\n";
} else {
echo '<li class="navItem';
if ($this->cur_module == 'NoDelete') {
echo ' navSelect';
}
echo '">';
$link = $this->make_link(array('cur_module' => 'NoDelete'));
if ($this->cur_module != 'NoDelete') {
echo 'Deletion Not Available <span class="smallText">(<a href="' . $link . '" class="inline">Explain</a>)</span>';
} else {
echo 'Deletion Not Available';
}
echo '</li>' . "\n";
}
}
if ($show_locks) {
$class = $this->cur_module == 'ManageLocks' ? 'navSelect' : 'nav';
$text = $item->has_lock() ? 'Modify Locks' : 'Lock';
echo '<li class="navItem ' . $class . '">';
if ($this->cur_module == 'ManageLocks') {
echo '<strong>' . $text . '</strong>';
} else {
echo '<a href="' . $this->make_link(array('cur_module' => 'ManageLocks')) . ' "class="nav">' . $text . '</a>';
}
echo '</li>' . "\n";
}
if ($this->show['analytics']) {
echo '<li class="navItem';
if ($this->cur_module == 'Analytics' || $this->cur_module == 'AnalyticsAbout') {
echo ' navSelect';
}
echo '"><a href="' . $this->make_link(array('cur_module' => 'Analytics')) . '" class="nav"><img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/chart_curve.png" alt="" />Analytics</a></li>' . "\n";
}
if ($show_history) {
// get archive relationship id
$num_arch = $this->_get_archived_item_count($this->id, $this->type_id);
if ($num_arch > 0) {
$selected = $this->cur_module == 'Archive' ? true : false;
$page_name = 'History (' . $num_arch . ' edit' . ($num_arch == 1 ? '' : 's') . ')';
if (!$item->user_can_edit($user, 'fields')) {
$lock_img = '<img class="lockIndicator" src="' . REASON_HTTP_BASE_PATH . 'ui_images/lock_12px.png" alt="locked" width="12" height="12" />';
} else {
$lock_img = '';
}
echo '<li class="navItem';
if ($selected) {
echo ' navSelect';
}
echo '">';
if ($selected) {
echo '<strong>' . $lock_img . $page_name . '</strong>';
} else {
echo '<a href="' . $this->make_link(array('cur_module' => 'Archive')) . '" class="nav">' . $lock_img . $page_name . '</a>';
}
echo '</li>' . "\n";
} else {
echo '<li class="navItem">No Edits</li>' . "\n";
}
}
echo '</ul>' . "\n";
echo '</div>' . "\n";
//.........这里部分代码省略.........