本文整理汇总了PHP中SessionManager::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionManager::delete方法的具体用法?PHP SessionManager::delete怎么用?PHP SessionManager::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SessionManager
的用法示例。
在下文中一共展示了SessionManager::delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_session_category
/**
* Delete sessions categories
* @author Jhon Hinojosa <jhon.hinojosa@dokeos.com>, from existing code
* @param array id_checked
* @param bool include delete session
* @param bool optional, true if the function is called by a webservice, false otherwise.
* @return void Nothing, or false on error
* The parameters is a array to delete sessions
* */
public static function delete_session_category($id_checked, $delete_session = false, $from_ws = false)
{
$tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
if (is_array($id_checked)) {
$id_checked = Database::escape_string(implode(',', $id_checked));
} else {
$id_checked = intval($id_checked);
}
//Setting session_category_id to 0
$sql = "UPDATE {$tbl_session} SET session_category_id = 0\n WHERE session_category_id IN (" . $id_checked . ")";
Database::query($sql);
$sql = "SELECT id FROM {$tbl_session} WHERE session_category_id IN (" . $id_checked . ")";
$result = Database::query($sql);
while ($rows = Database::fetch_array($result)) {
$session_id = $rows['id'];
if ($delete_session) {
if ($from_ws) {
SessionManager::delete($session_id, true);
} else {
SessionManager::delete($session_id);
}
}
}
$sql = "DELETE FROM {$tbl_session_category} WHERE id IN (" . $id_checked . ")";
Database::query($sql);
// Add event to system log
$user_id = api_get_user_id();
Event::addEvent(LOG_SESSION_CATEGORY_DELETE, LOG_SESSION_CATEGORY_ID, $id_checked, api_get_utc_datetime(), $user_id);
return true;
}
示例2: api_get_jqgrid_js
/* For licensing terms, see /license.txt */
/**
* List sessions in an efficient and usable way
* @package chamilo.admin
*/
$cidReset = true;
require_once '../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
SessionManager::protectSession(null, false);
//Add the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_jqgrid_js();
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
$idChecked = isset($_REQUEST['idChecked']) ? $_REQUEST['idChecked'] : null;
$list_type = isset($_REQUEST['list_type']) ? $_REQUEST['list_type'] : 'simple';
if ($action == 'delete') {
SessionManager::delete($idChecked);
Display::addFlash(Display::return_message(get_lang('Deleted')));
header('Location: session_list.php');
exit;
} elseif ($action == 'copy') {
$result = SessionManager::copy($idChecked);
if ($result) {
Display::addFlash(Display::return_message(get_lang('ItemCopied')));
} else {
Display::addFlash(Display::return_message(get_lang('ThereWasAnError'), 'error'));
}
header('Location: session_list.php');
exit;
}
$tool_name = get_lang('SessionList');
Display::display_header($tool_name);
示例3: deleteSessionHelper
/**
* Deletes a session (helper method)
*
* @param string Session id field name
* @param string Session id value
* @return mixed True in case of success, WSError otherwise
*/
protected function deleteSessionHelper($session_id_field_name, $session_id_value)
{
$session_id = $this->getSessionId($session_id_field_name, $session_id_value);
if ($session_id instanceof WSError) {
return $session_id;
} else {
SessionManager::delete($session_id, true);
return true;
}
}