当前位置: 首页>>代码示例>>PHP>>正文


PHP SessionManager::delete_session方法代码示例

本文整理汇总了PHP中SessionManager::delete_session方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionManager::delete_session方法的具体用法?PHP SessionManager::delete_session怎么用?PHP SessionManager::delete_session使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SessionManager的用法示例。


在下文中一共展示了SessionManager::delete_session方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 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($session_id, true);
             } else {
                 SessionManager::delete_session($session_id);
             }
         }
     }
     $sql = "DELETE FROM {$tbl_session_category} WHERE id IN (" . $id_checked . ")";
     $rs = Database::query($sql);
     $result = Database::affected_rows($rs);
     // Add event to system log
     $user_id = api_get_user_id();
     event_system(LOG_SESSION_CATEGORY_DELETE, LOG_SESSION_CATEGORY_ID, $id_checked, api_get_utc_datetime(), $user_id);
     // delete extra session fields where field variable is "PERIODO"
     $t_sf = Database::get_main_table(TABLE_MAIN_SESSION_FIELD);
     $t_sfv = Database::get_main_table(TABLE_MAIN_SESSION_FIELD_VALUES);
     $sql = "SELECT t_sfv.field_id FROM {$t_sfv} t_sfv, {$t_sf} t_sf  WHERE t_sfv.session_id = '{$id_checked}' AND t_sf.field_variable = 'PERIODO' ";
     $rs_field = Database::query($sql);
     $field_id = 0;
     if (Database::num_rows($rs_field) > 0) {
         $row_field = Database::fetch_row($rs_field);
         $field_id = $row_field[0];
         $sql_delete_sfv = "DELETE FROM {$t_sfv} WHERE session_id = '{$id_checked}' AND field_id = '{$field_id}'";
         $rs_delete_sfv = Database::query($sql_delete_sfv);
     }
     $sql = "SELECT * FROM {$t_sfv} WHERE field_id = '{$field_id}' ";
     $rs_field_id = Database::query($sql);
     if (Database::num_rows($rs_field_id) == 0) {
         $sql_delete_sf = "DELETE FROM {$t_sf} WHERE id = '{$field_id}'";
         $rs_delete_sf = Database::query($sql_delete_sf);
     }
     return true;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:59,代码来源:sessionmanager.lib.php

示例2: 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
                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($session_id, true);
                } else {
                    SessionManager::delete_session($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_system(
            LOG_SESSION_CATEGORY_DELETE,
            LOG_SESSION_CATEGORY_ID,
            $id_checked,
            api_get_utc_datetime(),
            $user_id
        );

        return true;
    }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:51,代码来源:sessionmanager.lib.php

示例3: api_get_jqgrid_js

 */
/**
 * Code
 */
$this_section = SECTION_PLATFORM_ADMIN;
SessionManager::protect_session_edit();
//Add the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_jqgrid_js();
$htmlHeadXtra[] = api_get_js('json-js/json2.js');
$htmlHeadXtra[] = api_get_js('date/date.js');
$htmlHeadXtra = api_get_datetime_picker_js($htmlHeadXtra);
$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_session($idChecked);
    header('Location: ' . api_get_path(WEB_CODE_PATH) . 'session/session_list.php');
    exit;
} elseif ($action == 'copy') {
    SessionManager::copy_session($idChecked, true, false);
    header('Location: ' . api_get_path(WEB_CODE_PATH) . 'session/session_list.php');
    exit;
}
$interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('Sessions'));
$tool_name = get_lang('SessionList');
Display::display_header($tool_name);
$error_message = '';
if (isset($_GET['action']) && $_GET['action'] == 'show_message') {
    $error_message = Security::remove_XSS($_GET['message']);
}
if (!empty($error_message)) {
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:session_list.php

示例4: transaction_9

 static function transaction_9($data)
 {
     $uidIdPrograma = $data['item_id'];
     global $data_list;
     $session_id = self::get_session_id_by_programa_id($uidIdPrograma, $data_list);
     if (!empty($session_id)) {
         $session_info_before = api_get_session_info($session_id, true);
         SessionManager::delete_session($session_id, true);
         $session_info = api_get_session_info($session_id, true);
         $data_list['sessions'][$data['item_id']] = null;
         return array('entity' => 'session', 'before' => $session_info_before, 'after' => $session_info, 'message' => "Session was deleted  session_id: {$session_id} - id: {$uidIdPrograma}", 'status_id' => self::TRANSACTION_STATUS_SUCCESSFUL);
     } else {
         return array('message' => "Session does not exists {$uidIdPrograma}", 'status_id' => self::TRANSACTION_STATUS_FAILED);
     }
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:15,代码来源:migration.custom.class.php

示例5: 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($session_id, true);
         return true;
     }
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:17,代码来源:webservice_session.php


注:本文中的SessionManager::delete_session方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。