示例#1
0
 /**
  * Initiated all important variable
  * and check if it a consim-user
  *
  * @access protected
  */
 protected function init()
 {
     //Check if user in consim
     if ($this->user->data['consim_register'] == 0) {
         //go to register page
         redirect($this->helper->route('consim_core_register'));
         return null;
     }
     // Add language file
     $this->user->add_lang_ext('consim/core', 'consim_common');
     $this->add_navlinks();
     //Check all finished Actions
     $this->actionService->finishedActions();
     //Get the ConSim-User
     $consim_user = $this->userService->getCurrentUser();
     // get User Skill and add to template
     $user_skills = $this->userSkillService->getCurrentUserSkills();
     //User Skill to Template
     $this->widgetService->userSkillWidget($this->userSkillService->sortSkillsByCategory($user_skills));
     // Get inventory and add to template
     $inventory = $this->inventoryService->getCurrentInventory();
     $this->widgetService->inventoryWidget($inventory);
     //Get Cash Assets and add to template
     $cashAssets = $this->assetService->getCurrentCashAsset();
     $this->widgetService->cashAssetsWidget($cashAssets);
     //Is User active?
     if ($consim_user->getActive()) {
         //get current action
         $action = $this->actionService->getCurrentAction();
         //Is User traveling?
         if ($action->getRouteId() > 0) {
             $this->widgetService->travelWidget($action);
         }
         // is user working?
         if ($action->getWorkId() > 0) {
             $this->widgetService->workWidget($action);
         }
     }
     //Get User-Location
     $user_location = $this->locationService->getCurrentLocation();
     //Experience to Template
     $this->widgetService->experienceWidget($consim_user);
     //Location to Template
     $this->widgetService->locationWidget($user_location);
     //Set Weather to Template
     try {
         $this->weatherService->loadWeatherFromProvinceID($user_location->getProvinceID())->setWeatherWidget();
     } catch (base $e) {
         $this->template->assign_var('OWM_ERROR', $this->user->lang($e->getMessage()));
     }
     // Set output vars for display in the template
     $this->template->assign_vars(array('TIME' => date("d.m.Y - H:i:s", time()), 'GO_TO_INFORMATION' => $this->helper->route('consim_core_activity'), 'U_OVERVIEW' => $this->helper->route('consim_core_index'), 'U_ACTIONLIST' => $this->helper->route('consim_core_action_list'), 'U_ASSET' => $this->helper->route('consim_core_asset')));
 }