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


PHP SessionManager::copy_session方法代码示例

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


在下文中一共展示了SessionManager::copy_session方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: copy

 /**
  * Copies the promotion to a new one
  * @param   integer     Promotion ID
  * @param   integer     Career ID, in case we want to change it
  * @param   boolean     Whether or not to copy the sessions inside
  * @return  integer     New promotion ID on success, false on failure
  */
 public function copy($id, $career_id = null, $copy_sessions = false)
 {
     $pid = false;
     $promotion = $this->get($id);
     if (!empty($promotion)) {
         $new = array();
         foreach ($promotion as $key => $val) {
             switch ($key) {
                 case 'id':
                 case 'updated_at':
                     break;
                 case 'name':
                     $val .= ' ' . get_lang('CopyLabelSuffix');
                     $new[$key] = $val;
                     break;
                 case 'created_at':
                     $val = api_get_utc_datetime();
                     $new[$key] = $val;
                     break;
                 case 'career_id':
                     if (!empty($career_id)) {
                         $val = (int) $career_id;
                     }
                     $new[$key] = $val;
                 default:
                     $new[$key] = $val;
                     break;
             }
         }
         if ($copy_sessions) {
             /**
              * When copying a session we do:
              * 1. Copy a new session from the source
              * 2. Copy all courses from the session (no user data, no user list)
              * 3. Create the promotion
              */
             $session_list = SessionManager::get_all_sessions_by_promotion($id);
             if (!empty($session_list)) {
                 $pid = $this->save($new);
                 if (!empty($pid)) {
                     $new_session_list = array();
                     foreach ($session_list as $item) {
                         $sid = SessionManager::copy_session($item['id'], true, false, false, true);
                         $new_session_list[] = $sid;
                     }
                     if (!empty($new_session_list)) {
                         SessionManager::suscribe_sessions_to_promotion($pid, $new_session_list);
                     }
                 }
             }
         } else {
             $pid = $this->save($new);
         }
     }
     return $pid;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:63,代码来源:promotion.lib.php

示例2: api_get_jqgrid_js

$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)) {
    Display::display_normal_message($error_message, false);
}
//jqgrid will use this URL to do the selects
$url = api_get_path(WEB_AJAX_PATH) . 'model.ajax.php?a=get_sessions&list_type=' . $list_type;
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:session_list.php

示例3: api_protect_admin_script

 * List sessions in an efficient and usable way
 * @package chamilo.admin
 */
$cidReset = true;
//require_once '../inc/global.inc.php';
api_protect_admin_script(true);
//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;
if ($action == 'delete') {
    SessionManager::delete_session($idChecked);
    header('Location: session_list.php');
    exit;
} elseif ($action == 'copy') {
    SessionManager::copy_session($idChecked);
    header('Location: session_list.php');
    exit;
}
$interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('PlatformAdmin'));
$tool_name = get_lang('SessionList');
Display::display_header($tool_name);
$error_message = '';
// Avoid conflict with the global variable $error_msg (array type) in add_course.conf.php.
if (isset($_GET['action']) && $_GET['action'] == 'show_message') {
    $error_message = Security::remove_XSS($_GET['message']);
}
if (!empty($error_message)) {
    Display::display_normal_message($error_message, false);
}
$sessionFilter = new FormValidator('course_filter', 'get', '', '', array('class' => 'form-search'), false);
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:session_list.php


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