Exemplo n.º 1
0
 function getContent ($args) {
     global $_fullname_sql;
     
     $content = array();
     $dbv = DbView::getView('literatur');
     if (is_array($args) && isset($args['user_id'])) {
         $tree = TreeAbstract::GetInstance("StudipLitList", $args['user_id']);
     } else {
         preg_match(':^([a-z_-]{0,50})$:i', Request::quoted('username'), $matches);
         $tree = TreeAbstract::GetInstance("StudipLitList", get_userid($matches[1]));
     }
     if ($lists = $tree->getVisibleListIds()) {
         for ($i = 0; $i < count($lists); ++$i) {
             if ($this->config->getValue($this->name, 'showlastchange')) {
 //          && ($tree->tree_data[$lists[$i]]['chdate'] > $last_modified_since) ){
                 $content['LITLISTS']['LITLIST'][$i]['LITLIST_CHANGE-DATE'] = strftime($this->config->getValue('Main', 'dateformat'),
                         $tree->tree_data[$lists[$i]]['chdate']);
                 $content['LITLISTS']['LITLIST'][$i]['LITLIST_FULLNAME'] = $tree->tree_data[$lists[$i]]['fullname'];
                 $content['LITLISTS']['LITLIST'][$i]['LITLIST_NAME'] = $tree->tree_data[$lists[$i]]['name'];
             } else {
                 $content['LITLISTS']['LITLIST'][$i]['LITLIST_NAME'] = $tree->tree_data[$lists[$i]]['name'];
             }
             if ($tree->hasKids($lists[$i])){
                 $dbv->params[0] = $lists[$i];
                 $rs = $dbv->get_query("view:LIT_LIST_GET_ELEMENTS");
                 $j = 0;
                 while ($rs->next_record()){
                     if ( ($this->config->getValue($this->name, 'showlastchange'))) {
             //      && ($tree->tree_data[$rs->f('list_element_id')]['chdate'] > $last_modified_since) ){
                         $content['LITLISTS']['LITLIST'][$i]['LITLIST_ITEM'][$j]['LITLIST_ITEM_CHANGE-DATE'] = strftime($this->config->getValue('Main', 'dateformat'),
                                 $tree->tree_data[$rs->f('list_element_id')]['chdate']);
                         $content['LITLISTS']['LITLIST'][$i]['LITLIST_ITEM'][$j]['LITLIST_ITEM_FULLNAME'] = $tree->tree_data[$rs->f('list_element_id')]['fullname'];
                     }
                     $content['LITLISTS']['LITLIST'][$i]['LITLIST_ITEM'][$j]['LITLIST_ITEM_ELEMENT'] = ExternModule::ExtFormatReady($tree->getFormattedEntry($rs->f('list_element_id'), $rs->Record));
                     $j++;
                 }
             }
         }
     }
     
     return $content;
 }
    function getContent ($args = NULL, $raw = FALSE)
    {
        $content = array();
        $error_message = "";

        // stimmt die übergebene range_id?
        $query = "SELECT 1 FROM Institute WHERE Institut_id = ?";
        $statement = DBManager::get()->prepare($query);
        $statement->execute(array($this->config->range_id));
        if (!$statement->fetchColumn()) {
            $error_message = $GLOBALS['EXTERN_ERROR_MESSAGE'];
        }

        $local_fullname_sql = $GLOBALS['_fullname_sql'];
        if (!$nameformat = $this->config->getValue('Main', 'nameformat')) {
            $nameformat = 'no_title';
        }
        if ($nameformat == 'last') $local_fullname_sql['last'] = ' Nachname ';

        $news =& StudipNews::GetNewsByRange($this->config->range_id);
        if (!count($news)) {
            $content['NEWS']['NO-NEWS']['NO-NEWS_TEXT'] = $this->config->getValue('Main', "nodatatext");
        }

        $studip_link = URLHelper::getLink('dispatch.php/institute/overview?again=yes&cid='. $this->config->range_id);
        $content['__GLOBAL__']['STUDIP-LINK'] = $studip_link;

        $dateform = $this->config->getValue("Main", "dateformat");
        $show_date_author = $this->config->getValue("Main", "showdateauthor");
        $i = 1;
        $j = 1;
        foreach ($news as $news_id => $news_detail) {
            //aktuelle News ausgeben
            if (($news_detail['date'] + $news_detail['expire']) >= time())
                {
                list($news_content, $admin_msg) = explode("<admin_msg>", $news_detail['body']);
                if ($news_detail['chdate_uid']){
                    $admin_msg = StudipNews::GetAdminMsg($news_detail['chdate_uid'],$news_detail['chdate']);
                }
                if ($admin_msg) {
                    $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['NEWS_ADMIN-MESSAGE'] = preg_replace('# \(?(.*)\)?#', '$1', $admin_msg);
                }

                if (!$news_content) {
                    $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['NEWS_BODY'] = _("Keine Beschreibung vorhanden.");
                } else {
                    $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['NEWS_BODY'] =  ExternModule::ExtFormatReady($news_content);
                }

                $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['NEWS_DATE'] = strftime($dateform, $news_detail['date']);
                $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['NEWS_TOPIC'] = ExternModule::ExtHtmlReady($news_detail['topic']);
                $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['NEWS_NO'] = $i;

                $query = "SELECT Nachname, Vorname, title_front, title_rear,
                                 {$local_fullname_sql[$nameformat]} AS fullname, username,
                                 aum.user_id
                          FROM auth_user_md5 AS aum
                          LEFT JOIN user_info AS ui USING (user_id)
                          WHERE aum.user_id = ?";
                $statement = DBManager::get()->prepare($query);
                $statement->execute(array($news_detail['user_id']));
                $temp = $statement->fetch(PDO::FETCH_ASSOC);
                if ($temp) {
                    $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['FULLNAME'] = ExternModule::ExtHtmlReady($temp['fullname']);
                    $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['FIRSTNAME'] = ExternModule::ExtHtmlReady($temp['Vorname']);
                    $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['LASTNAME'] = ExternModule::ExtHtmlReady($temp['Nachname']);
                    $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['TITLEFRONT'] = ExternModule::ExtHtmlReady($temp['title_front']);
                    $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['TITLEREAR'] = ExternModule::ExtHtmlReady($temp['title_rear']);
                    $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['USERNAME'] = $temp['username'];
                    $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['PERSONDETAIL-HREF'] = $this->elements['LinkInternTemplate']->createUrl(array('link_args' => 'username='******'username']));

                    if (GetAllStatusgruppen($this->config->range_id, $temp['user_id'], true)) {
                        $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['PERSONDETAIL-LINK']['LINK_PERSONDETAIL-HREF'] = $this->elements['LinkInternTemplate']->createUrl(array('link_args' => 'username='******'username']));
                        $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['PERSONDETAIL-LINK']['LINK_FULLNAME'] = ExternModule::ExtHtmlReady($temp['fullname']);
                        $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['PERSONDETAIL-LINK']['LINK_FIRSTNAME'] = ExternModule::ExtHtmlReady($temp['Vorname']);
                        $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['PERSONDETAIL-LINK']['LINK_LASTNAME'] = ExternModule::ExtHtmlReady($temp['Nachname']);
                        $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['PERSONDETAIL-LINK']['LINK_TITLEFRONT'] = ExternModule::ExtHtmlReady($temp['title_front']);
                        $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['PERSONDETAIL-LINK']['LINK_TITLEREAR'] = ExternModule::ExtHtmlReady($temp['title_rear']);
                    }
                }
                $i++;
            }
            //archivierte News ausgeben
            elseif(($news_detail['date'] + $news_detail['expire']) < time())
            {
                list($news_content, $admin_msg) = explode("<admin_msg>", $news_detail['body']);
                if ($news_detail['chdate_uid']){
                    $admin_msg = StudipNews::GetAdminMsg($news_detail['chdate_uid'],$news_detail['chdate']);
                }
                if ($admin_msg) {
                    $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_NEWS_ADMIN-MESSAGE'] = preg_replace('# \(?(.*)\)?#', '$1', $admin_msg);
                }

                if (!$news_content) {
                    $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_NEWS_BODY'] = _("Keine Beschreibung vorhanden.");
                } else {
                    $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_NEWS_BODY'] =  ExternModule::ExtFormatReady($news_content);
                }

                $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_NEWS_DATE'] = strftime($dateform, $news_detail['date']);
                $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_NEWS_TOPIC'] = ExternModule::ExtHtmlReady($news_detail['topic']);
                $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_NEWS_NO'] = $j;

                $query = "SELECT Nachname, Vorname, title_front, title_rear,
                                 {$local_fullname_sql[$nameformat]} AS fullname, username,
                                 aum.user_id
                          FROM auth_user_md5 AS aum
                          LEFT JOIN user_info AS ui USING (user_id)
                          WHERE aum.user_id = ?";
                $statement = DBManager::get()->prepare($query);
                $statement->execute(array($news_detail['user_id']));
                $temp = $statement->fetch(PDO::FETCH_ASSOC);
                if ($temp) {
                    $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_FULLNAME'] = ExternModule::ExtHtmlReady($temp['fullname']);
                    $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_FIRSTNAME'] = ExternModule::ExtHtmlReady($temp['Vorname']);
                    $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_LASTNAME'] = ExternModule::ExtHtmlReady($temp['Nachname']);
                    $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_TITLEFRONT'] = ExternModule::ExtHtmlReady($temp['title_front']);
                    $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_TITLEREAR'] = ExternModule::ExtHtmlReady($temp['title_rear']);
                    $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_USERNAME'] = $temp['username'];
                    $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_PERSONDETAIL-HREF'] = $this->elements['LinkInternTemplate']->createUrl(array('link_args' => 'username='******'username']));

                    if (GetAllStatusgruppen($this->config->range_id, $temp['user_id'], true)) {
                        $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_PERSONDETAIL-LINK']['ARCHIV_LINK_PERSONDETAIL-HREF'] = $this->elements['LinkInternTemplate']->createUrl(array('link_args' => 'username='******'username']));
                        $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_PERSONDETAIL-LINK']['ARCHIV_LINK_FULLNAME'] = ExternModule::ExtHtmlReady($temp['fullname']);
                        $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_PERSONDETAIL-LINK']['ARCHIV_LINK_FIRSTNAME'] = ExternModule::ExtHtmlReady($temp['Vorname']);
                        $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_PERSONDETAIL-LINK']['ARCHIV_LINK_LASTNAME'] = ExternModule::ExtHtmlReady($temp['Nachname']);
                        $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_PERSONDETAIL-LINK']['ARCHIV_LINK_TITLEFRONT'] = ExternModule::ExtHtmlReady($temp['title_front']);
                        $content['NEWS']['ALL-ARCHIV-NEWS']['SINGLE-ARCHIVE-NEWS'][$j]['ARCHIV_PERSONDETAIL-LINK']['ARCHIV_LINK_TITLEREAR'] = ExternModule::ExtHtmlReady($temp['title_rear']);
                    }
                }
                $j++;
            }
        }
        $content['__GLOBAL__']['NEWS-COUNT'] = $i  - 1;
        $content['__GLOBAL__']['ARCHIV-NEWS-COUNT'] = $j -1;
        return $content;
    }
 function getContentTree()
 {
     $tree_args['sem_status'] = is_array($this->sem_browse_data['sem_status']) ? $this->sem_browse_data['sem_status'] : false;
     $tree_args['sem_number'] = $this->sem_number;
     $tree_args['visible_only'] = true;
     if ($this->config->getValue('Main', 'mode') == 'show_sem_range') {
         $tree = TreeAbstract::GetInstance('StudipSemTree', $tree_args);
     } else {
         $tree = TreeAbstract::GetInstance('StudipRangeTree', $tree_args);
     }
     $tree->enable_lonely_sem = false;
     $j = 0;
     if ($parents = $tree->getParents($this->sem_browse_data['start_item_id'])) {
         for ($i = count($parents) - 2; $i >= 0; --$i) {
             /*
             if ($tree->isModuleItem($parents[$i]) && $studienmodulmanagement = PluginEngine::getPlugin('StudienmodulManagement')) {
                 $info = $studienmodulmanagement->getModuleDescription($parents[$i], SemesterData::GetSemesterIdByIndex($this->sem_browse_data['sem']));
             } else {
             */
             if (trim($tree->tree_data[$parents[$i]]['info'])) {
                 $info = kill_format(trim($tree->tree_data[$parents[$i]]['info']));
             } else {
                 $info = '';
                 $content['LEVEL_TREE']['LEVEL_PATH']['LEVEL_PATH_ITEM'][$j]['LEVEL_NO_INFO'] = true;
             }
             //  }
             $content['LEVEL_TREE']['LEVEL_PATH']['LEVEL_PATH_ITEM'][$j] = array('LEVEL-HREF' => $this->getLinkToSelf(array('start_item_id' => $parents[$i], 'do_search' => '0', 'show_result' => $parents[$i] == $this->getRootStartItemId() ? '1' : '0'), true, 'LinkInternTree'), 'LEVEL_NAME' => ExternModule::ExtHtmlReady($tree->tree_data[$parents[$i]]['name']), 'LEVEL_INFO' => $info);
             $content['LEVEL_TREE']['LEVEL_PATH']['LEVEL_PATH_ITEM'][$j]['PATH_DELIMITER'] = true;
             $this->global_markers['TREE_LEVEL_NAME_' . ($j + 1)] = $content['LEVEL_TREE']['LEVEL_PATH']['LEVEL_PATH_ITEM'][$j]['LEVEL_NAME'];
             $this->global_markers['TREE_LEVEL_ID_' . ($j + 1)] = $parents[$i];
             $j++;
         }
         if ($j) {
             // remove last path delimiter
             unset($content['LEVEL_TREE']['LEVEL_PATH']['LEVEL_PATH_ITEM'][$j - 1]['PATH_DELIMITER']);
         }
         // set this as global marker in getContent()
         $this->global_markers['CURRENT_LEVEL_NAME'] = $tree->getValue($this->sem_browse_data['start_item_id'], 'name');
         /*
         if ($tree->isModuleItem($parents[$i]) && $studienmodulmanagement = PluginEngine::getPlugin('StudienmodulManagement')) {
             $this->global_markers['CURRENT_LEVEL_NAME'] = $studienmodulmanagement->getModuleDescription($parents[$i], SemesterData::GetSemesterIdByIndex($this->sem_browse_data['sem']));
         } else {
         */
         if (trim($tree->tree_data[$this->sem_browse_data['start_item_id']]['info'])) {
             $this->global_markers['CURRENT_LEVEL_INFO'] = ExternModule::ExtFormatReady($tree->tree_data[$this->sem_browse_data['start_item_id']]['info']);
         }
         //  }
     }
     $content['LEVEL_TREE']['LEVEL_PATH']['LEVEL_PATH_ITEM'][$j] = array('LEVEL-HREF' => $this->getLinkToSelf(array('start_item_id' => $this->sem_browse_data['start_item_id'], 'do_search' => '0', 'show_result' => $parents[$i] == $this->getRootStartItemId() ? '1' : '0'), true, 'LinkInternTree'), 'LEVEL_NAME' => ExternModule::ExtHtmlReady($tree->tree_data[$this->sem_browse_data['start_item_id']]['name']), 'LEVEL_INFO' => kill_format($tree->tree_data[$this->sem_browse_data['start_item_id']]['info'] ? $tree->tree_data[$this->sem_browse_data['start_item_id']]['info'] : _("Keine weitere Info vorhanden")));
     $content['LEVEL_TREE']['SUBLEVELS_1'] = $this->getAllTreeLevelContent($tree, $this->sem_browse_data['start_item_id'], $this->config->getValue('Main', 'countshowsublevels') ? $this->config->getValue('Main', 'countshowsublevels') : 0);
     if ($tree->hasKids($this->sem_browse_data['start_item_id']) && ($num_entries = $tree->getNumEntries($this->sem_browse_data['start_item_id'], true))) {
         $content['__GLOBAL__']['COURSE_COUNT_SUBLEVELS'] = $num_entries;
         $content['__GLOBAL__']['COURSES_SUBLEVELS-HREF'] = $this->getLinkToSelf(array('start_item_id' => $this->sem_browse_data['start_item_id'], 'show_result' => '1', 'withkids' => '1', 'do_search' => '0'), true, 'LinkInternTree');
     }
     if ($num_entries = $tree->getNumEntries($this->sem_browse_data['start_item_id'])) {
         $content['__GLOBAL__']['COURSE_COUNT_LEVEL'] = $num_entries;
         $content['__GLOBAL__']['COURSES_LEVEL-HREF'] = $this->getLinkToSelf(array('start_item_id' => $this->sem_browse_data['start_item_id'], 'show_result' => '1', 'withkids' => '0', 'do_search' => '0'), true, 'LinkInternTree');
     } else {
         $content['__GLOBAL__']['NO_COURSES_LEVEL'] = true;
     }
     return $content;
 }
 private function getContentNews () {
     $news =& StudipNews::GetNewsByRange($this->user_id, TRUE);
     if (!count($news)) {
         $content['NEWS']['NO-NEWS']['NEWS_NO-NEWS-TEXT'] = $this->config->getValue('Main', 'nodatatext');
     } else {
         $i = 0;
         foreach ($news as $news_id => $news_detail) {
             list($news_content, $admin_msg) = explode("<admin_msg>", $news_detail['body']);
             if ($admin_msg) {
                 $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['NEWS_ADMIN-MESSAGE'] = preg_replace('# \(.*?\)#', '', $admin_msg);
                 $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['NEWS_BODY'] = ExternModule::ExtFormatReady($news_content);
             } else {
                 $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['NEWS_BODY'] = ExternModule::ExtFormatReady($news_detail['body']);
             }
             $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['NEWS_DATE'] = strftime($dateform, $news_detail['date']);
             $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['NEWS_TOPIC'] = ExternModule::ExtHtmlReady($news_detail['topic']);
             $content['NEWS']['ALL-NEWS']['SINGLE-NEWS'][$i]['NEWS_NO'] = $i + 1;
             $i++;
         }
     }
     return $content;
 }