/**
  * Creates a table filled with the sessions currently registered
  *
  * @autoTestable
  * @return string
  * @permissions right1
  */
 protected function actionSystemSessions()
 {
     $strReturn = "";
     //react on commands?
     if ($this->getParam("logout") == "true") {
         $objSession = new class_module_system_session($this->getSystemid());
         $objSession->setStrLoginstatus(class_module_system_session::$LOGINSTATUS_LOGGEDOUT);
         $objSession->updateObjectToDb();
         class_carrier::getInstance()->getObjDB()->flushQueryCache();
     }
     //showing a list using the pageview
     $objArraySectionIterator = new class_array_section_iterator(class_module_system_session::getNumberOfActiveSessions());
     $objArraySectionIterator->setPageNumber((int) ($this->getParam("pv") != "" ? $this->getParam("pv") : 1));
     $objArraySectionIterator->setArraySection(class_module_system_session::getAllActiveSessions($objArraySectionIterator->calculateStartPos(), $objArraySectionIterator->calculateEndPos()));
     $arrData = array();
     $arrHeader = array();
     $arrHeader[0] = "";
     $arrHeader[1] = $this->getLang("session_username");
     $arrHeader[2] = $this->getLang("session_valid");
     $arrHeader[3] = $this->getLang("session_status");
     $arrHeader[4] = $this->getLang("session_activity");
     $arrHeader[5] = "";
     /** @var $objOneSession class_module_system_session */
     foreach ($objArraySectionIterator as $objOneSession) {
         $arrRowData = array();
         $strUsername = "";
         if ($objOneSession->getStrUserid() != "") {
             $objUser = new class_module_user_user($objOneSession->getStrUserid());
             $strUsername = $objUser->getStrUsername();
         }
         $arrRowData[0] = class_adminskin_helper::getAdminImage("icon_user");
         $arrRowData[1] = $strUsername;
         $arrRowData[2] = timeToString($objOneSession->getIntReleasetime());
         if ($objOneSession->getStrLoginstatus() == class_module_system_session::$LOGINSTATUS_LOGGEDIN) {
             $arrRowData[3] = $this->getLang("session_loggedin");
         } else {
             $arrRowData[3] = $this->getLang("session_loggedout");
         }
         //find out what the user is doing...
         $strLastUrl = $objOneSession->getStrLasturl();
         if (uniStrpos($strLastUrl, "?") !== false) {
             $strLastUrl = uniSubstr($strLastUrl, uniStrpos($strLastUrl, "?"));
         }
         $strActivity = "";
         if (uniStrpos($strLastUrl, "admin=1") !== false) {
             $strActivity .= $this->getLang("session_admin");
             foreach (explode("&", $strLastUrl) as $strOneParam) {
                 $arrUrlParam = explode("=", $strOneParam);
                 if ($arrUrlParam[0] == "module") {
                     $strActivity .= $arrUrlParam[1];
                 }
             }
         } else {
             $strActivity .= $this->getLang("session_portal");
             if ($strLastUrl == "") {
                 $strActivity .= class_module_system_setting::getConfigValue("_pages_indexpage_") != "" ? class_module_system_setting::getConfigValue("_pages_indexpage_") : "";
             } else {
                 foreach (explode("&", $strLastUrl) as $strOneParam) {
                     $arrUrlParam = explode("=", $strOneParam);
                     if ($arrUrlParam[0] == "page") {
                         $strActivity .= $arrUrlParam[1];
                     }
                 }
                 if ($strActivity == $this->getLang("session_portal") && uniSubstr($strLastUrl, 0, 5) == "image") {
                     $strActivity .= $this->getLang("session_portal_imagegeneration");
                 }
             }
         }
         $arrRowData[4] = $strActivity;
         if ($objOneSession->getStrLoginstatus() == class_module_system_session::$LOGINSTATUS_LOGGEDIN) {
             $arrRowData[5] = class_link::getLinkAdmin("system", "systemSessions", "&logout=true&systemid=" . $objOneSession->getSystemid(), "", $this->getLang("session_logout"), "icon_delete");
         } else {
             $arrRowData[5] = class_adminskin_helper::getAdminImage("icon_deleteDisabled");
         }
         $arrData[] = $arrRowData;
     }
     $strReturn .= $this->objToolkit->dataTable($arrHeader, $arrData);
     $strReturn .= $this->objToolkit->getPageview($objArraySectionIterator, "system", "systemSessions");
     return $strReturn;
 }