本文整理汇总了PHP中JApplicationWeb::getSession方法的典型用法代码示例。如果您正苦于以下问题:PHP JApplicationWeb::getSession方法的具体用法?PHP JApplicationWeb::getSession怎么用?PHP JApplicationWeb::getSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JApplicationWeb
的用法示例。
在下文中一共展示了JApplicationWeb::getSession方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: canCheckout
/**
* Method to check whether the user can check out an item.
*
* @return boolean True if the item can be checked out, false otherwise.
*
* @since 12.1
* @throws LogicException
* @throws RuntimeException
*/
public function canCheckout()
{
// Assert the object is loaded.
$this->assertIsLoaded();
// Get the session id.
$sessionId = $this->app->getSession()->getId();
// Check if the item is checked out at all.
if (!empty($this->checked_out_session) && $this->checked_out_session != $sessionId) {
// Build the query to check if the item is editable.
$query = $this->db->getQuery(true);
$query->select('a.content_id');
$query->from('#__content AS a');
$query->join('INNER', '#__session AS s ON s.session_id = a.checked_out_session');
$query->where('a.content_id = ' . (int) $this->content_id);
// Get the checked out state.
$this->db->setQuery($query);
$checkedOut = (int) $this->db->loadResult();
// Check if the checked out session is still valid.
if ($checkedOut) {
return false;
}
}
return true;
}