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


PHP ilSession类代码示例

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


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

示例1: testBasicSessionBehaviour

 /**
  * @group IL_Init
  */
 public function testBasicSessionBehaviour()
 {
     global $ilUser;
     include_once "./Services/Authentication/classes/class.ilSession.php";
     $result = "";
     ilSession::_writeData("123456", "Testdata");
     if (ilSession::_exists("123456")) {
         $result .= "exists-";
     }
     if (ilSession::_getData("123456") == "Testdata") {
         $result .= "write-get-";
     }
     $duplicate = ilSession::_duplicate("123456");
     if (ilSession::_getData($duplicate) == "Testdata") {
         $result .= "duplicate-";
     }
     ilSession::_destroy("123456");
     if (!ilSession::_exists("123456")) {
         $result .= "destroy-";
     }
     ilSession::_destroyExpiredSessions();
     if (ilSession::_exists($duplicate)) {
         $result .= "destroyExp-";
     }
     ilSession::_destroyByUserId($ilUser->getId());
     if (!ilSession::_exists($duplicate)) {
         $result .= "destroyByUser-";
     }
     $this->assertEquals("exists-write-get-duplicate-destroy-destroyExp-destroyByUser-", $result);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:33,代码来源:ilSessionTest.php

示例2: storeRequest

 /**
  *
  */
 protected function storeRequest()
 {
     /**
      * @var $http ilHTTPS
      */
     global $https;
     if (!ilSession::get('orig_request_target')) {
         //#16324 don't use the complete REQUEST_URI
         $url = substr($_SERVER['REQUEST_URI'], strrpos($_SERVER['REQUEST_URI'], "/") + 1);
         ilSession::set('orig_request_target', $url);
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:15,代码来源:class.ilUserRequestTargetAdjustment.php

示例3: getChapters

 /**
  * Get chapters
  *
  * @param
  * @return
  */
 function getChapters()
 {
     $hc = ilSession::get("help_chap");
     $lm_tree = $this->parent_obj->object->getTree();
     if ($hc > 0 && $lm_tree->isInTree($hc)) {
         //$node = $lm_tree->getNodeData($hc);
         //$chaps = $lm_tree->getSubTree($node);
         $chaps = $lm_tree->getFilteredSubTree($hc, array("pg"));
         unset($chaps[0]);
     } else {
         $chaps = ilStructureObject::getChapterList($this->parent_obj->object->getId());
     }
     $this->setData($chaps);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:20,代码来源:class.ilHelpMappingTableGUI.php

示例4: storeRequest

 /**
  *
  */
 protected function storeRequest()
 {
     /**
      * @var $http ilHTTPS
      */
     global $https;
     if (!ilSession::get('orig_request_target')) {
         $target_protocol = 'http';
         if ($https->isDetected()) {
             $target_protocol .= 's';
         }
         $host = isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST'];
         $request_url = $_SERVER['REQUEST_URI'][0] == '/' ? $_SERVER['REQUEST_URI'] : '/' . $_SERVER['REQUEST_URI'];
         $url = $target_protocol . '://' . $host . $request_url;
         ilSession::set('orig_request_target', $url);
     }
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:20,代码来源:class.ilUserRequestTargetAdjustment.php

示例5: showPage


//.........这里部分代码省略.........
     // set default link xml, if nothing was set yet
     if (!$this->link_xml_set) {
         $this->setDefaultLinkXml();
     }
     //$content = $this->obj->getXMLFromDom(false, true, true,
     //	$this->getLinkXML().$this->getQuestionXML().$this->getComponentPluginsXML());
     $link_xml = $this->getLinkXML();
     // disable/enable auto margins
     if ($this->getStyleId() > 0) {
         if (ilObject::_lookupType($this->getStyleId()) == "sty") {
             include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
             $style = new ilObjStyleSheet($this->getStyleId());
             $template_xml = $style->getTemplateXML();
             $disable_auto_margins = "n";
             if ($style->lookupStyleSetting("disable_auto_margins")) {
                 $disable_auto_margins = "y";
             }
         }
     }
     if ($this->getAbstractOnly()) {
         $content = "<dummy><PageObject><PageContent><Paragraph>" . $this->obj->getFirstParagraphText() . $link_xml . "</Paragraph></PageContent></PageObject></dummy>";
     } else {
         $content = $this->obj->getXMLFromDom(false, true, true, $link_xml . $this->getQuestionXML() . $template_xml . $this->getComponentPluginsXML());
     }
     // check validation errors
     if ($builded !== true) {
         $this->displayValidationError($builded);
     } else {
         $this->displayValidationError($_SESSION["il_pg_error"]);
     }
     unset($_SESSION["il_pg_error"]);
     if (isset($_SESSION["citation_error"])) {
         ilUtil::sendFailure($this->lng->txt("cont_citation_selection_not_valid"));
         ilSession::clear("citation_error");
     }
     // get title
     $pg_title = $this->getPresentationTitle();
     $col_path = ilUtil::getImagePath("col.svg");
     $row_path = ilUtil::getImagePath("row.svg");
     $item_path = ilUtil::getImagePath("item.svg");
     if ($this->getOutputMode() != "offline") {
         $enlarge_path = ilUtil::getImagePath("enlarge.svg");
         $wb_path = ilUtil::getWebspaceDir("output") . "/";
     } else {
         $enlarge_path = "images/enlarge.svg";
         $wb_path = "";
     }
     $pg_title_class = $this->getOutputMode() == "print" ? "ilc_PrintPageTitle" : "";
     // page splitting only for learning modules and
     // digital books
     $enable_split_new = $this->obj->getParentType() == "lm" || $this->obj->getParentType() == "dbk" ? "y" : "n";
     // page splitting to next page only for learning modules and
     // digital books if next page exists in tree
     if (($this->obj->getParentType() == "lm" || $this->obj->getParentType() == "dbk") && ilObjContentObject::hasSuccessorPage($this->obj->getParentId(), $this->obj->getId())) {
         $enable_split_next = "y";
     } else {
         $enable_split_next = "n";
     }
     $img_path = ilUtil::getImagePath("", false, $this->getOutputMode(), $this->getOutputMode() == "offline");
     if ($this->getPageConfig()->getEnablePCType("Tabs")) {
         //include_once("./Services/YUI/classes/class.ilYuiUtil.php");
         //ilYuiUtil::initTabView();
         include_once "./Services/Accordion/classes/class.ilAccordionGUI.php";
         ilAccordionGUI::addJavaScript();
         ilAccordionGUI::addCss();
     }
开发者ID:bheyser,项目名称:qplskl,代码行数:67,代码来源:class.ilPageObjectGUI.php

示例6: showTermsOfService

 /**
  * Show terms of service
  */
 protected function showTermsOfService()
 {
     /**
      * @var $lng       ilLanguage
      * @var $tpl       ilTemplate
      * @var $ilUser    ilObjUser
      * @var $ilSetting ilSetting
      */
     global $lng, $tpl, $ilUser, $ilSetting;
     $back_to_login = 'getAcceptance' != $this->ctrl->getCmd();
     self::initStartUpTemplate('tpl.view_terms_of_service.html', $back_to_login, !$back_to_login);
     $tpl->setVariable('TXT_PAGEHEADLINE', $lng->txt('usr_agreement'));
     try {
         require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceSignableDocumentFactory.php';
         $document = ilTermsOfServiceSignableDocumentFactory::getByLanguageObject($lng);
         if ('getAcceptance' == $this->ctrl->getCmd()) {
             if (isset($_POST['status']) && 'accepted' == $_POST['status']) {
                 require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
                 ilTermsOfServiceHelper::trackAcceptance($ilUser, $document);
                 if (ilSession::get('orig_request_target')) {
                     $target = ilSession::get('orig_request_target');
                     ilSession::set('orig_request_target', '');
                     ilUtil::redirect($target);
                 } else {
                     ilUtil::redirect('index.php?target=' . $_GET['target'] . '&client_id=' . CLIENT_ID);
                 }
             }
             $tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, $this->ctrl->getCmd()));
             $tpl->setVariable('ACCEPT_CHECKBOX', ilUtil::formCheckbox(0, 'status', 'accepted'));
             $tpl->setVariable('ACCEPT_TERMS_OF_SERVICE', $lng->txt('accept_usr_agreement'));
             $tpl->setVariable('TXT_SUBMIT', $lng->txt('submit'));
         }
         $tpl->setVariable('TERMS_OF_SERVICE_CONTENT', $document->getContent());
     } catch (ilTermsOfServiceNoSignableDocumentFoundException $e) {
         $tpl->setVariable('TERMS_OF_SERVICE_CONTENT', sprintf($lng->txt('no_agreement_description'), 'mailto:' . ilUtil::prepareFormOutput($ilSetting->get('feedback_recipient'))));
     }
     $tpl->show();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:41,代码来源:class.ilStartUpGUI.php

示例7: filterTooltips

 /**
  * Filter tooltips
  *
  * @param
  * @return
  */
 function filterTooltips()
 {
     global $lng, $ilCtrl;
     ilSession::set("help_tt_comp", ilUtil::stripSlashes($_POST["help_tt_comp"]));
     $ilCtrl->redirect($this, "showTooltipList");
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:12,代码来源:class.ilObjContentObjectGUI.php

示例8: initHTML

 /**
  * init HTML output (level 3)
  */
 protected static function initHTML()
 {
     global $ilUser;
     if (ilContext::hasUser()) {
         // load style definitions
         // use the init function with plugin hook here, too
         self::initStyle();
     }
     // $tpl
     $tpl = new ilTemplate("tpl.main.html", true, true);
     self::initGlobal("tpl", $tpl);
     if (ilContext::hasUser() && ilContext::doAuthentication()) {
         /**
          * @var $ilUser ilObjUser
          * @var $ilCtrl ilCtrl
          */
         global $ilUser, $ilCtrl;
         require_once 'Services/User/classes/class.ilUserRequestTargetAdjustment.php';
         $request_adjuster = new ilUserRequestTargetAdjustment($ilUser, $ilCtrl);
         $request_adjuster->adjust();
     }
     // load style sheet depending on user's settings
     $location_stylesheet = ilUtil::getStyleSheetLocation();
     $tpl->setVariable("LOCATION_STYLESHEET", $location_stylesheet);
     require_once "./Services/UICore/classes/class.ilFrameTargetInfo.php";
     self::initGlobal("ilNavigationHistory", "ilNavigationHistory", "Services/Navigation/classes/class.ilNavigationHistory.php");
     self::initGlobal("ilBrowser", "ilBrowser", "./Services/Utilities/classes/class.ilBrowser.php");
     self::initGlobal("ilHelp", "ilHelpGUI", "Services/Help/classes/class.ilHelpGUI.php");
     self::initGlobal("ilToolbar", "ilToolbarGUI", "./Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php");
     self::initGlobal("ilLocator", "ilLocatorGUI", "./Services/Locator/classes/class.ilLocatorGUI.php");
     self::initGlobal("ilTabs", "ilTabsGUI", "./Services/UIComponent/Tabs/classes/class.ilTabsGUI.php");
     if (ilContext::hasUser()) {
         // $ilMainMenu
         include_once './Services/MainMenu/classes/class.ilMainMenuGUI.php';
         $ilMainMenu = new ilMainMenuGUI("_top");
         self::initGlobal("ilMainMenu", $ilMainMenu);
         unset($ilMainMenu);
         // :TODO: tableGUI related
         // set hits per page for all lists using table module
         $_GET['limit'] = (int) $ilUser->getPref('hits_per_page');
         ilSession::set('tbl_limit', $_GET['limit']);
         // the next line makes it impossible to save the offset somehow in a session for
         // a specific table (I tried it for the user administration).
         // its not posssible to distinguish whether it has been set to page 1 (=offset = 0)
         // or not set at all (then we want the last offset, e.g. being used from a session var).
         // So I added the wrapping if statement. Seems to work (hopefully).
         // Alex April 14th 2006
         if (isset($_GET['offset']) && $_GET['offset'] != "") {
             $_GET['offset'] = (int) $_GET['offset'];
             // old code
         }
     } else {
         // several code parts rely on ilObjUser being always included
         include_once "Services/User/classes/class.ilObjUser.php";
     }
 }
开发者ID:JKN-INC,项目名称:SHELBY-ILIAS,代码行数:59,代码来源:class.ilInitialisation.php

示例9: LogoutNotification

function LogoutNotification($SessionID)
{
    // Delete session of user using $SessionID to locate the user's session file
    // on the file system or in the database
    // Then delete this entry or record to clear the session
    // However, for that to work it is essential that the user's Shibboleth
    // SessionID is stored in the user session data!
    global $ilDB;
    $q = "SELECT session_id, data FROM usr_session WHERE expires > 'NOW()'";
    $r = $ilDB->query($q);
    while ($session_entry = $r->fetchRow(DB_FETCHMODE_ASSOC)) {
        $user_session = unserializesession($session_entry['data']);
        // Look for session with matching Shibboleth session id
        // and then delete this ilias session
        foreach ($user_session as $user_session_entry) {
            if (is_array($user_session_entry) && array_key_exists('shibboleth_session_id', $user_session_entry) && $user_session_entry['shibboleth_session_id'] == $SessionID) {
                // Delete this session entry
                if (ilSession::_destroy($session_entry['session_id']) !== true) {
                    return new SoapFault('LogoutError', 'Could not delete session entry in database.');
                }
            }
        }
    }
    // If no SoapFault is returned, all is fine
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:25,代码来源:shib_logout.php

示例10: kickFirstRequestAbidencer

 /**
  * kicks sessions of users that abidence after login
  * so people could not login and go for coffe break ;-)
  *
  * @global ilDB $ilDB
  * @global ilSetting $ilSetting
  * @return <type>
  */
 private static function kickFirstRequestAbidencer(array $a_types)
 {
     global $ilDB, $ilSetting;
     $max_idle_after_first_request = (int) $ilSetting->get('session_max_idle_after_first_request') * 60;
     if ((int) $max_idle_after_first_request == 0) {
         return;
     }
     $query = "SELECT session_id,expires FROM usr_session WHERE " . "(ctime - createtime) < %s " . "AND (%s - createtime) > %s " . "AND " . $ilDB->in('type', $a_types, false, 'integer');
     $res = $ilDB->queryF($query, array('integer', 'integer', 'integer'), array($max_idle_after_first_request, time(), $max_idle_after_first_request));
     $session_ids = array();
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         $session_ids[$row->session_id] = $row->expires;
     }
     ilSession::_destroy($session_ids, ilSession::SESSION_CLOSE_FIRST, true);
     self::debug(__METHOD__ . ' --> Finished kicking first request abidencer');
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:24,代码来源:class.ilSessionControl.php

示例11: redirectToTest

 /**
  * This is to be called by the plugin at the end of the signature process to redirect the user back to the test.
  */
 public function redirectToTest($success)
 {
     /** @var $ilCtrl ilCtrl */
     /** @var $ilUser ilObjUser */
     global $ilCtrl, $ilUser;
     $active = $this->test->getActiveIdOfUser($ilUser->getId());
     $pass = $this->test->_getMaxPass($active);
     $key = 'signed_' . $active . '_' . $pass;
     ilSession::set($key, $success);
     $ilCtrl->redirect($this->ilTestOutputGUI, 'afterTestPassFinished');
     return;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:15,代码来源:class.ilTestSignatureGUI.php

示例12: fillMessage

 function fillMessage()
 {
     global $lng;
     $ms = array("info", "success", "failure", "question");
     $out = "";
     foreach ($ms as $m) {
         if ($m == "question") {
             $m = "mess_question";
         }
         $txt = ilSession::get($m) != "" ? ilSession::get($m) : $this->message[$m];
         if ($m == "mess_question") {
             $m = "question";
         }
         if ($txt != "") {
             $mtpl = new ilTemplate("tpl.message.html", true, true, "Services/Utilities");
             $mtpl->setCurrentBlock($m . "_message");
             $mtpl->setVariable("TEXT", $txt);
             $mtpl->setVariable("MESSAGE_HEADING", $lng->txt($m . "_message"));
             $mtpl->setVariable("ALT_IMAGE", $lng->txt("icon") . " " . $lng->txt($m . "_message"));
             $mtpl->setVariable("SRC_IMAGE", ilUtil::getImagePath("mess_" . $m . ".png"));
             $mtpl->parseCurrentBlock();
             $out .= $mtpl->get();
         }
         if ($m == "question") {
             $m = "mess_question";
         }
         if (ilSession::get($m)) {
             ilSession::clear($m);
         }
     }
     if ($out != "") {
         $this->setVariable("MESSAGE", $out);
     }
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:34,代码来源:class.ilTemplate.php

示例13: getJsonResponse

    /**
     * @param int $sessionId
     * @return string
     */
    public function getJsonResponse($sessionId)
    {
        /**
         * @var $ilDB            ilDB
         * @var $ilUser          ilObjUser
         * @var $ilClientIniFile ilIniFile
         * @var $lng             ilLanguage
         */
        global $ilDB, $ilUser, $lng, $ilClientIniFile;
        include_once 'Services/JSON/classes/class.ilJsonUtil.php';
        $response = array('remind' => false);
        $res = $ilDB->queryF('
			SELECT expires, user_id, data
			FROM usr_session
			WHERE session_id = %s', array('text'), array($sessionId));
        $num = $ilDB->numRows($res);
        if ($num > 1) {
            $response['message'] = 'The determined session data is not unique.';
            return ilJsonUtil::encode($response);
        }
        if ($num == 0) {
            $response['message'] = 'ILIAS could not determine the session data.';
            return ilJsonUtil::encode($response);
        }
        $data = $ilDB->fetchAssoc($res);
        if (!$this->isAuthenticatedUsrSession($data)) {
            $response['message'] = 'ILIAS could not fetch the session data or the corresponding user is no more authenticated.';
            return ilJsonUtil::encode($response);
        }
        $session = ilUtil::unserializeSession($data['data']);
        $idletime = null;
        foreach ((array) $session as $key => $entry) {
            if (strpos($key, '_auth__') === 0) {
                $idletime = $entry['idle'];
                break;
            }
        }
        if (null === $idletime) {
            $response['message'] = 'ILIAS could not determine the idle time from the session data.';
            return ilJsonUtil::encode($response);
        }
        $expiretime = $idletime + ilSession::getIdleValue();
        if ($this->isSessionAlreadyExpired($expiretime)) {
            $response['message'] = 'The session is already expired. The client should have received a remind command before.';
            return ilJsonUtil::encode($response);
        }
        /**
         * @var $user ilObjUser
         */
        $ilUser = ilObjectFactory::getInstanceByObjId($data['user_id']);
        include_once './Services/Authentication/classes/class.ilSessionReminder.php';
        $remind_time = $expiretime - max(ilSessionReminder::MIN_LEAD_TIME, (double) $ilUser->getPref('session_reminder_lead_time')) * 60;
        if ($remind_time > time()) {
            // session will expire in <lead_time> minutes
            $response['message'] = 'Lead time not reached, yet. Current time: ' . date('Y-m-d H:i:s', time()) . ', Reminder time: ' . date('Y-m-d H:i:s', $remind_time);
            return ilJsonUtil::encode($response);
        }
        $dateTime = new ilDateTime($expiretime, IL_CAL_UNIX);
        switch ($ilUser->getTimeFormat()) {
            case ilCalendarSettings::TIME_FORMAT_12:
                $formatted_expiration_time = $dateTime->get(IL_CAL_FKT_DATE, 'g:ia', $ilUser->getTimeZone());
                break;
            case ilCalendarSettings::TIME_FORMAT_24:
            default:
                $formatted_expiration_time = $dateTime->get(IL_CAL_FKT_DATE, 'H:i', $ilUser->getTimeZone());
                break;
        }
        $response = array('extend_url' => './ilias.php?baseClass=ilPersonalDesktopGUI', 'txt' => str_replace("\\n", '%0A', sprintf($lng->txt('session_reminder_alert'), ilFormat::_secondsToString($expiretime - time()), $formatted_expiration_time, $ilClientIniFile->readVariable('client', 'name') . ' | ' . ilUtil::_getHttpPath())), 'remind' => true);
        return ilJsonUtil::encode($response);
    }
开发者ID:arlendotcn,项目名称:ilias,代码行数:74,代码来源:class.ilSessionReminderCheck.php

示例14: authenticate

 public static function authenticate()
 {
     global $ilAuth, $ilias, $ilErr, $ilUser;
     $oldSid = session_id();
     // error_log(">> init authenticate " . $oldSid);
     $ilAuth->start();
     $ilias->setAuthError($ilErr->getLastError());
     if ($ilAuth->getAuth() && $ilAuth->getStatus() == '') {
         error_log(">> init authenticate no session?");
         if (ilSession::get("AccountId")) {
             // ensure that web users have access to the services
             self::initUserAccount();
         }
         // 	self::initUserAccount();
         //
         // 	self::handleAuthenticationSuccess();
     }
     //
     // error_log(">> init authenticate user is: " . $ilUser->getId());
 }
开发者ID:phish108,项目名称:PowerTLA,代码行数:20,代码来源:ilRESTInitialisation.5.0.php

示例15: hasToAcceptTermsOfServiceInSession

 /**
  * @param bool|null $status
  * @return void|bool
  */
 public function hasToAcceptTermsOfServiceInSession($status = null)
 {
     if (null === $status) {
         return ilSession::get('has_to_accept_agr_in_session');
     }
     require_once 'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
     if (ilTermsOfServiceHelper::isEnabled()) {
         ilSession::set('has_to_accept_agr_in_session', (int) $status);
     }
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:14,代码来源:class.ilObjUser.php


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