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


PHP ChamiloSession类代码示例

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


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

示例1: onLogoutSuccess

 /**
  * @param Request $request
  * @return null|RedirectResponse
  */
 public function onLogoutSuccess(Request $request)
 {
     $session = $request->getSession();
     \ChamiloSession::setSession($session);
     // Chamilo logout
     $userId = api_get_user_id();
     \Online::logout($userId, false);
     $login = $this->router->generate('index');
     $response = new RedirectResponse($login);
     return $response;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:15,代码来源:LogoutSuccessHandler.php

示例2: onSecuritySwitchUser

 /**
  * Fired on switch user, you can remove attributes or whatever you want here.
  * @param SwitchUserEvent $event
  */
 public function onSecuritySwitchUser(SwitchUserEvent $event)
 {
     /** @var \Entity\User $user */
     $user = $event->getTargetUser();
     /*var_dump($user );
       var_dump($event->getRequest()->getUser());
       */
     $request = $event->getRequest();
     $session = $request->getSession();
     \ChamiloSession::setSession($session);
     $session = $event->getRequest()->getSession();
     //$session->remove('partThatShouldNotCarryOver');
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:17,代码来源:LoginListener.php

示例3: createApplication

 /**
  * @return \Symfony\Component\HttpKernel\HttpKernel
  */
 public function createApplication()
 {
     // do not use require_once
     $app = (require __DIR__ . '/../../main/inc/global.inc.php');
     $app['debug'] = true;
     $app['session.test'] = true;
     $app['exception_handler']->disable();
     // Setting session obj for old libraries
     \ChamiloSession::setSession($app['session']);
     \UserManager::setEntityManager($app['orm.em']);
     //$app['monolog'] = $this->getMock('Monolog\Logger');
     return $app;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:16,代码来源:BaseWebTestCase.php

示例4: fixDocumentNameCallback

function fixDocumentNameCallback($p_event, &$p_header)
{
    global $remove_dir;
    $files = Session::read('doc_files_to_download');
    $storedFile = $remove_dir . $p_header['stored_filename'];
    if (!isset($files[$storedFile])) {
        return 0;
    }
    $documentData = $files[$storedFile];
    $documentNameFixed = DocumentManager::undoFixDocumentName($documentData['path'], $documentData['c_id'], $documentData['session_id'], $documentData['to_group_id']);
    // Changes file.phps to file.php
    $basename = basename($documentNameFixed);
    $basenamePHPFixed = str_replace('.phps', '.php', $basename);
    $documentNameFixed = str_replace($basename, $basenamePHPFixed, $documentNameFixed);
    if ($remove_dir != '/') {
        $documentNameFixed = str_replace($remove_dir, '/', $documentNameFixed);
        if (substr($documentNameFixed, 0, 1) == '/') {
            $documentNameFixed = substr($documentNameFixed, 1, api_strlen($documentNameFixed));
        }
    } else {
        $documentNameFixed = ltrim($documentNameFixed, '/');
    }
    $p_header['stored_filename'] = $documentNameFixed;
    return 1;
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:25,代码来源:downloadfolder.inc.php

示例5: unset_session_resources

/**
 * FUNCTIONS
 */
function unset_session_resources()
{
    $_SESSION['addedresource'] = '';
    $_SESSION['addedresourceid'] = '';
    Session::erase('addedresource');
    Session::erase('addedresourceid');
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:10,代码来源:resourcelinker.inc.php

示例6: login

 /**
  * Create a Shibboleth session for the user ID
  *
  * @param  string $uid - The user ID
  * @return $_user (array) - The user infos array created when the user logs in
  */
 function login($uid)
 {
     /* This must be set for local.inc.php to register correctly the global variables in session
      * This is BAD. Logic should be migrated into a function and stop relying on global variables.
      */
     global $_uid, $is_allowedCreateCourse, $_real_cid, $_courseUser;
     global $is_courseMember, $is_courseTutor, $is_allowed_in_course, $_gid;
     $_uid = $uid;
     //is_allowedCreateCourse
     $user = User::store()->get_by_user_id($uid);
     if (empty($user)) {
         return;
     }
     $this->logout();
     Chamilo::session()->start();
     Session::write('_uid', $_uid);
     global $_user;
     $_user = (array) $user;
     $_SESSION['_user'] = $_user;
     $_SESSION['_user']['user_id'] = $_uid;
     $_SESSION['noredirection'] = true;
     //must be called before 'init_local.inc.php'
     event_login();
     //used in 'init_local.inc.php' this is BAD but and should be changed
     $loginFailed = false;
     $uidReset = true;
     $gidReset = true;
     $cidReset = false;
     //FALSE !!
     $mainDbName = Database::get_main_database();
     $includePath = api_get_path(INCLUDE_PATH);
     $no_redirection = true;
     require "{$includePath}/local.inc.php";
     return $_user;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:41,代码来源:shibboleth_session.class.php

示例7: indexAction

 /**
  * @param Application $app
  * @param string $type courses|sessions|mycoursecategories
  * @param string $filter for the userportal courses page. Only works when setting 'history'
  * @param int $page
  *
  * @return Response|void
  */
 public function indexAction(Application $app, $type = 'courses', $filter = 'current', $page = 1)
 {
     // @todo Use filters like "after/before|finish" to manage user access
     api_block_anonymous_users();
     // Abort request because the user is not allowed here - @todo use filters
     if ($app['allowed'] == false) {
         return $app->abort(403, 'Not allowed');
     }
     // Main courses and session list
     $items = null;
     $type = str_replace('/', '', $type);
     /** @var \PageController $pageController */
     $pageController = $app['page_controller'];
     switch ($type) {
         case 'sessions':
             $items = $pageController->returnSessions(api_get_user_id(), $filter, $page);
             break;
         case 'sessioncategories':
             $items = $pageController->returnSessionsCategories(api_get_user_id(), $filter, $page);
             break;
         case 'courses':
             $items = $pageController->returnCourses(api_get_user_id(), $filter, $page);
             break;
         case 'mycoursecategories':
             $items = $pageController->returnMyCourseCategories(api_get_user_id(), $filter, $page);
             break;
         case 'specialcourses':
             $items = $pageController->returnSpecialCourses(api_get_user_id(), $filter, $page);
             break;
     }
     //Show the chamilo mascot
     if (empty($items) && empty($filter)) {
         $pageController->return_welcome_to_course_block($app['template']);
     }
     /*
             $app['my_main_menu'] = function($app) {
                 $menu = $app['knp_menu.factory']->createItem('root');
                 $menu->addChild('Home', array('route' => api_get_path(WEB_CODE_PATH)));
                 return $menu;
             };
             $app['knp_menu.menus'] = array('main' => 'my_main_menu');*/
     $app['template']->assign('content', $items);
     $pageController->setCourseSessionMenu();
     $pageController->setProfileBlock();
     $pageController->setUserImageBlock();
     $pageController->setCourseBlock($filter);
     $pageController->setSessionBlock();
     $pageController->return_reservation_block();
     $pageController->returnNavigationLinks($app['template']->getNavigationLinks());
     $app['template']->assign('search_block', $pageController->return_search_block());
     $app['template']->assign('classes_block', $pageController->return_classes_block());
     $pageController->returnSkillsLinks();
     // Deleting the session_id.
     Session::erase('session_id');
     $response = $app['template']->render_template('userportal/index.tpl');
     return new Response($response, 200, array());
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:65,代码来源:UserPortalController.php

示例8: display_success_message

 /**
  * Displays info stating that the message is sent successfully.
  * @deprecated
  */
 public static function display_success_message($uid)
 {
     $socialExist = Session::read('social_exist');
     $userInfo = api_get_user_info($uid);
     if (isset($socialExist) && $socialExist === true) {
         if (api_get_setting('social.allow_social_tool') == 'true' && api_get_setting('message.allow_message_tool') == 'true') {
             $success = get_lang('MessageSentTo') . "&nbsp;<b>" . $userInfo['complete_name'] . "</b>";
         } else {
             $success = get_lang('MessageSentTo') . "&nbsp;<b>" . $userInfo['complete_name'] . "</b>";
         }
     } else {
         $success = get_lang('MessageSentTo') . "&nbsp;<b>" . $userInfo['complete_name'] . "</b>";
     }
     return Display::return_message(api_xml_http_response_encode($success), 'confirmation', false);
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:19,代码来源:message.lib.php

示例9: reuseQuestionAction

 /**
  * @param Application $app
  * @param int $exerciseId
  * @param int $questionId
  * @return Response
  */
 public function reuseQuestionAction(Application $app, $exerciseId, $questionId)
 {
     /** @var \Question $question */
     $question = \Question::read($questionId);
     if ($question) {
         // adds the exercise ID represented by $fromExercise into the list of exercises for the current question
         $question->addToList($exerciseId);
         $objExercise = new \Exercise();
         $objExercise->read($exerciseId);
         // adds the question ID represented by $recup into the list of questions for the current exercise
         $objExercise->addToList($exerciseId);
         Session::write('objExercise', $objExercise);
         /*$params = array(
               'cidReq' => api_get_course_id(),
               'id_session' => api_get_session_id(),
               'id' => $questionId,
               'exerciseId' => $exerciseId
           );
           $url = $app['url_generator']->generate('exercise_question_pool', $params);
           return $app->redirect($url);*/
         $response = \Display::return_message(get_lang('QuestionReused') . ": " . $question->question);
         return new Response($response, 200, array());
     }
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:30,代码来源:ExerciseController.php

示例10: xajaxResponse

 /**
  * Search for a session based on a given search string
  * @param string A search string
  * @param string A search box type (single or anything else)
  * @return string XajaxResponse
  * @assert () !== ''
  * @assert ('abc','single') !== ''
  */
 function search_courses($needle, $type)
 {
     $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
     $xajax_response = new xajaxResponse();
     $return = '';
     if (!empty($needle) && !empty($type)) {
         // xajax send utf8 datas... datas in db can be non-utf8 datas
         $charset = api_get_system_encoding();
         $needle = api_convert_encoding($needle, $charset, 'utf-8');
         $needle = Database::escape_string($needle);
         $sql = 'SELECT * FROM ' . $tbl_session . ' WHERE name LIKE "' . $needle . '%" ORDER BY id';
         $rs = Database::query($sql);
         $course_list = array();
         $return .= '<select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:340px;">';
         while ($course = Database::fetch_array($rs)) {
             $course_list[] = $course['id'];
             $return .= '<option value="' . $course['id'] . '" title="' . htmlspecialchars($course['name'], ENT_QUOTES) . '">' . $course['name'] . '</option>';
         }
         $return .= '</select>';
         $xajax_response->addAssign('ajax_list_courses_multiple', 'innerHTML', api_utf8_encode($return));
     }
     Session::write('course_list', $course_list);
     return $xajax_response;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:32,代码来源:add_many_session_to_category_functions.lib.php

示例11:

 case 'delete':
     if (!$is_allowed_to_edit) {
         api_not_allowed(true);
     }
     if ($debug > 0) {
         error_log('New LP - delete action triggered', 0);
     }
     if (!$lp_found) {
         error_log('New LP - No learnpath given for delete', 0);
         require 'lp_list.php';
     } else {
         $_SESSION['refresh'] = 1;
         // Remove lp from homepage if it is there.
         //$_SESSION['oLP']->toggle_visibility((int)$_GET['lp_id'],'i');
         $_SESSION['oLP']->delete(null, (int) $_GET['lp_id'], 'remove');
         Session::erase('oLP');
         require 'lp_list.php';
     }
     break;
 case 'toggle_visible':
     // Change lp visibility (inside lp tool).
     if (!$is_allowed_to_edit) {
         api_not_allowed(true);
     }
     if ($debug > 0) {
         error_log('New LP - visibility action triggered', 0);
     }
     if (!$lp_found) {
         error_log('New LP - No learnpath given for visibility', 0);
         require 'lp_list.php';
     } else {
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:lp_controller.php

示例12:

    $TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
    $sql_fraud = "UPDATE $TBL_TRACK_ATTEMPT SET answer = 0, marks = 0, position = 0 WHERE exe_id = $exe_id ";
    Database::query($sql_fraud);
}*/
// Unset session for clock time.
ExerciseLib::exercise_time_control_delete($objExercise->id, $learnpath_id, $learnpath_item_id);
ExerciseLib::delete_chat_exercise_session($exe_id);
if ($origin != 'learnpath') {
    echo '<hr>';
    echo $objExercise->returnEndButtonHTML();
    if (api_is_allowed_to_session_edit()) {
        Session::erase('objExercise');
        Session::erase('exe_id');
        Session::erase('categoryList');
        Session::erase('question_list_flatten');
    }
    Display::display_footer();
} else {
    $lp_mode = $_SESSION['lp_mode'];
    $url = api_get_path(WEB_CODE_PATH) . 'newscorm/lp_controller.php?cidReq=' . api_get_course_id() . '&action=view&lp_id=' . $learnpath_id . '&lp_item_id=' . $learnpath_item_id . '&exeId=' . $exercise_stat_info['exe_id'] . '&fb_type=' . $objExercise->feedback_type;
    $href = $lp_mode == 'fullscreen' ? ' window.opener.location.href="' . $url . '" ' : ' top.location.href="' . $url . '"';
    if (api_is_allowed_to_session_edit()) {
        Session::erase('objExercise');
        Session::erase('exe_id');
        Session::erase('categoryList');
    }
    // Record the results in the learning path, using the SCORM interface (API)
    echo "<script>window.parent.API.void_save_asset('{$total_score}', '{$total_weight}', 0, 'completed');</script>";
    echo '<script type="text/javascript">' . $href . '</script>';
    echo '</body></html>';
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:exercise_result.php

示例13: isset

        api_not_allowed();
    }
}
/* Header and Breadcrumbs */
$my_search = isset($_GET['search']) ? $_GET['search'] : '';
$my_action = isset($_GET['action']) ? $_GET['action'] : '';
$gradebook = null;
if (isset($_SESSION['gradebook'])) {
    $gradebook = $_SESSION['gradebook'];
}
if (!empty($gradebook) && $gradebook == 'view') {
    $interbreadcrumb[] = array('url' => '../gradebook/' . $_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook'));
}
if (!empty($_GET['gidReq'])) {
    $toolgroup = Database::escape_string($_GET['gidReq']);
    Session::write('toolgroup', $toolgroup);
}
$forumUrl = api_get_path(WEB_CODE_PATH) . 'forum/';
if ($origin == 'group') {
    $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'group/group.php', 'name' => get_lang('Groups'));
    $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'group/group_space.php?' . api_get_cidreq(), 'name' => get_lang('GroupSpace') . ' ' . $group_properties['name']);
    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Forum') . ' ' . Security::remove_XSS($current_forum['forum_title']));
} else {
    $interbreadcrumb[] = array('url' => $forumUrl . 'index.php?search=' . Security::remove_XSS($my_search), 'name' => get_lang('ForumCategories'));
    $interbreadcrumb[] = array('url' => $forumUrl . 'viewforumcategory.php?forumcategory=' . $current_forum_category['cat_id'] . '&amp;search=' . Security::remove_XSS(urlencode($my_search)), 'name' => prepare4display($current_forum_category['cat_title']));
    $interbreadcrumb[] = array('url' => '#', 'name' => Security::remove_XSS($current_forum['forum_title']));
}
if ($origin == 'learnpath') {
    Display::display_reduced_header();
} else {
    // The last element of the breadcrumb navigation is already set in interbreadcrumb, so give empty string.
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:viewforum.php

示例14: array

$(function() {
<?php 
// grid definition see the $career->display() function
echo Display::grid_js('careers', $url, $columns, $column_model, $extra_params, array(), $action_links, true);
?>
});
</script>
<?php 
$career = new Career();
// Action handling: Add
switch ($action) {
    case 'add':
        if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
            api_not_allowed();
        }
        Session::write('notebook_view', 'creation_date');
        $url = api_get_self() . '?action=' . Security::remove_XSS($_GET['action']);
        $form = $career->return_form($url, 'add');
        // The validation or display
        if ($form->validate()) {
            if ($check) {
                $values = $form->exportValues();
                $res = $career->save($values);
                if ($res) {
                    Display::display_confirmation_message(get_lang('ItemAdded'));
                }
            }
            $career->display();
        } else {
            echo '<div class="actions">';
            echo '<a href="' . api_get_self() . '">' . Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM) . '</a>';
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:31,代码来源:careers.php

示例15: createAnswersForm

 /**
  * function which redefines Question::createAnswersForm
  * @param FormValidator $form
  */
 public function createAnswersForm($form)
 {
     $nb_answers = isset($_POST['nb_answers']) ? $_POST['nb_answers'] : 4;
     $nb_answers += isset($_POST['lessAnswers']) ? -1 : (isset($_POST['moreAnswers']) ? 1 : 0);
     $obj_ex = Session::read('objExercise');
     /* Mise en variable de Affichage "Reponses" et son icone, "N�", "Vrai", "Reponse" */
     $html = '<table class="data_table">
             <tr>
                 <th width="10px">
                     ' . get_lang('Number') . '
                 </th>
                 <th width="10px">
                     ' . get_lang('True') . '
                 </th>
                 <th width="50%">
                     ' . get_lang('Answer') . '
                 </th>';
     $html .= '<th>' . get_lang('Comment') . '</th>';
     $html .= '</tr>';
     $form->addElement('label', get_lang('Answers') . '<br /> <img src="../img/fill_field.png">', $html);
     $defaults = array();
     $correct = 0;
     $answer = false;
     if (!empty($this->id)) {
         $answer = new Answer($this->id);
         $answer->read();
         if (count($answer->nbrAnswers) > 0 && !$form->isSubmitted()) {
             $nb_answers = $answer->nbrAnswers;
         }
     }
     #le nombre de r�ponses est bien enregistr� sous la forme int(nb)
     /* Ajout mise en forme nb reponse */
     $form->addElement('hidden', 'nb_answers');
     $boxes_names = array();
     /* V�rification : Cr�action d'au moins une r�ponse */
     if ($nb_answers < 1) {
         $nb_answers = 1;
         Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer'));
     }
     //D�but affichage score global dans la modification d'une question
     $scoreA = "0";
     //par reponse
     $scoreG = "0";
     //Global
     /* boucle pour sauvegarder les donn�es dans le tableau defaults */
     for ($i = 1; $i <= $nb_answers; ++$i) {
         /* si la reponse est de type objet */
         if (is_object($answer)) {
             $defaults['answer[' . $i . ']'] = $answer->answer[$i];
             $defaults['comment[' . $i . ']'] = $answer->comment[$i];
             $defaults['correct[' . $i . ']'] = $answer->correct[$i];
             // start
             $scoreA = $answer->weighting[$i];
         }
         if ($scoreA > 0) {
             $scoreG = $scoreG + $scoreA;
         }
         //------------- Fin
         //------------- Debut si un des scores par reponse est egal � 0 : la coche vaut 1 (coch�)
         if ($scoreA == 0) {
             $defaults['pts'] = 1;
         }
         $renderer =& $form->defaultRenderer();
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'correct[' . $i . ']');
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'counter[' . $i . ']');
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'answer[' . $i . ']');
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'comment[' . $i . ']');
         //$renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error --><br/>{element}</td>', 'weighting['.$i.']');
         $answer_number = $form->addElement('text', 'counter[' . $i . ']', null, 'value="' . $i . '"');
         $answer_number->freeze();
         $form->addElement('checkbox', 'correct[' . $i . ']', null, null, 'class="checkbox"');
         $boxes_names[] = 'correct[' . $i . ']';
         $form->addHtmlEditor('answer[' . $i . ']', null, null, array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
         $form->addRule('answer[' . $i . ']', get_lang('ThisFieldIsRequired'), 'required');
         $form->addHtmlEditor('comment[' . $i . ']', null, null, array('ToolbarSet' => 'TestProposedAnswer', 'Width' => '100%', 'Height' => '100'));
         $form->addElement('html', '</tr>');
     }
     //--------- Mise en variable du score global lors d'une modification de la question/r�ponse
     $defaults['weighting[1]'] = round($scoreG);
     $form->addElement('html', '</div></div></table>');
     //$form -> addElement ('html', '<br />');
     $form->add_multiple_required_rule($boxes_names, get_lang('ChooseAtLeastOneCheckbox'), 'multiple_required');
     //only 1 answer the all deal ...
     $form->addElement('text', 'weighting[1]', get_lang('Score'));
     global $pts;
     //--------- Creation coche pour ne pas prendre en compte les n�gatifs
     $form->addElement('checkbox', 'pts', '', get_lang('NoNegativeScore'));
     $form->addElement('html', '<br />');
     // Affiche un message si le score n'est pas renseign�
     $form->addRule('weighting[1]', get_lang('ThisFieldIsRequired'), 'required');
     global $text, $class;
     if ($obj_ex->edit_exercise_in_lp == true) {
         $form->addButtonDelete(get_lang('LessAnswer'), 'lessAnswers');
         $form->addButtonCreate(get_lang('PlusAnswer'), 'moreAnswers');
         $form->addButtonSave($text, 'submitQuestion');
         // setting the save button here and not in the question class.php
//.........这里部分代码省略.........
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:101,代码来源:global_multiple_answer.class.php


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