Beispiel #1
0
 /**
  * Displays accounts and elearning modules for active user
  */
 public function my_accounts_action()
 {
     global $connected_cms, $current_module, $messages;
     Navigation::activateItem('/tools/my_elearning');
     PageLayout::setTitle(_("Meine Lernmodule und Benutzer-Accounts"));
     if ($this->new_account_cms != "") {
         $this->new_account_form = ELearningUtils::getNewAccountForm($this->new_account_cms);
     }
     foreach ($GLOBALS['ELEARNING_INTERFACE_MODULES'] as $cms => $cms_preferences) {
         if (ELearningUtils::isCMSActive($cms)) {
             ELearningUtils::loadClass($cms);
             if ($cms_preferences["auth_necessary"] == true) {
                 $this->new_module_form[$cms] = ELearningUtils::getNewModuleForm($cms);
             }
             $connection_status = $connected_cms[$cms]->getConnectionStatus($cms);
             foreach ($connection_status as $type => $msg) {
                 if ($msg["error"] != "") {
                     PageLayout::postMessage(MessageBox::error(_("Es traten Probleme bei der Anbindung einzelner Lermodule auf. Bitte wenden Sie sich an Ihren Systemadministrator."), array($cms . ': ' . $msg["error"])));
                     $GLOBALS["ELEARNING_INTERFACE_" . $cms . "_ACTIVE"] = false;
                 }
             }
         }
     }
     $connected_cms = array();
     // prepare cms list
     foreach ($GLOBALS['ELEARNING_INTERFACE_MODULES'] as $cms => $cms_preferences) {
         if (ELearningUtils::isCMSActive($cms) and $cms_preferences["auth_necessary"]) {
             ELearningUtils::loadClass($cms);
             $this->cms_list[$cms] = $cms_preferences;
             $this->cms_list[$cms]['name'] = $connected_cms[$cms]->getName();
             $this->cms_list[$cms]['logo'] = $connected_cms[$cms]->getLogo();
             $this->cms_list[$cms]['modules'] = array();
             if ($this->new_account_cms != $cms) {
                 $this->cms_list[$cms]['show_account_form'] = $cms_preferences;
             }
             if ($GLOBALS["module_type_" . $cms] != "") {
                 $this->cms_list[$cms]['cms_anker_target'] = true;
             }
             if ($connected_cms[$cms]->user->isConnected()) {
                 $this->cms_list[$cms]['start_link'] = $connected_cms[$cms]->link->getStartpageLink();
             }
             if ($this->new_account_cms != $cms) {
                 if ($connected_cms[$cms]->user->isConnected()) {
                     $this->cms_list[$cms]['user'] = $connected_cms[$cms]->user->getUsername();
                     $connected_cms[$cms]->soap_client->setCachingStatus(false);
                     $this->user_content_modules = $connected_cms[$cms]->getUserContentModules();
                     $connected_cms[$cms]->soap_client->setCachingStatus(true);
                     if (!($this->user_content_modules == false)) {
                         foreach ($this->user_content_modules as $key => $connection) {
                             $connected_cms[$cms]->setContentModule($connection, false);
                             $this->cms_list[$cms]['modules'][] = $connected_cms[$cms]->content_module[$current_module]->view->show();
                         }
                     }
                     $this->cms_list[$cms]['new_module_form'] = $this->new_module_form[$cms];
                 }
             } else {
                 $this->cms_list[$cms]['account_form'] = $this->new_account_form;
             }
         }
     }
     $sidebar = Sidebar::get();
     $sidebar->setImage('sidebar/learnmodule-sidebar.png');
     $widget = new ActionsWidget();
     if ($GLOBALS['perm']->have_perm('autor') and count($this->cms_list)) {
         foreach ($this->cms_list as $cms_key => $cms_data) {
             if ($connected_cms[$cms_key]->user->isConnected()) {
                 $widget->addLink(sprintf(_('Zur %s Startseite'), $cms_data['name']), URLHelper::getScriptLink($cms_data['start_link']), Icon::create('link-extern', 'clickable'), array('target' => '_blank'));
                 $link_count++;
             }
         }
     }
     if ($link_count) {
         $sidebar->addWidget($widget);
     }
     // terminate objects
     if (is_array($connected_cms)) {
         foreach ($connected_cms as $system) {
             $system->terminate();
         }
     }
     if (is_array($messages)) {
         foreach ($messages as $mtype => $mtext) {
             PageLayout::postMessage(MessageBox::$mtype($mtext));
         }
     }
 }