Ejemplo n.º 1
0
 function _getTableheadMonthAsHTMLWithJavascript()
 {
     $params = $this->_getGetParamsAsArray();
     // Optimierungsbedarf: Die $this->_translator->getMessage wird 11Mal!!! umsonst aufgerufen
     $current_time = localtime();
     $month = getLongMonthName($current_time[4]);
     $html = '   <tr>' . LF;
     #$html .= '      <td class="infoborderyear"  style="vertical-align:bottom;">'.LF;
     #// jQuery
     #//$html .= '   <select style="width: 10em; font-size:10pt;" name="presentation_mode" size="1" onChange="javascript:document.indexform.submit()">'.LF;
     #$html .= '   <select style="width: 10em; font-size:10pt;" name="presentation_mode" size="1" id="submit_form">'.LF;
     #// jQuery
     #$html .= '      <option value="2"';
     #if ($this->_presentation_mode == '2'){
     #   $html .= ' selected="selected"';
     #}
     #$html .= '>'.$this->_translator->getMessage('DATE_MONTH_PRESENTATION').'</option>'.LF;
     #$html .= '      <option value="1"';
     #if ($this->_presentation_mode != '2'){
     #   $html .= ' selected="selected"';
     #}
     #$html .= '>'.$this->_translator->getMessage('DATE_WEEK_PRESENTATION').'</option>'.LF;
     #$html .= '   </select>'.LF;
     $html .= '</td>' . LF;
     $html .= '<td colspan="3" class="infoborderweek"  style="vertical-align:bottom; text-align:left; white-space:nowrap;">' . LF;
     #$html .= $this->_getWeekList();
     #$html .= '&nbsp;&nbsp;&nbsp;';
     $html .= $this->_getMonthListWithJavascript();
     #$html .= '&nbsp;&nbsp;&nbsp;';
     #$html .= $this->_getYearList();
     $html .= '<noscript><input type="submit" style="font-size:10pt; width:2em;" name="room_change" value="' . $this->_translator->getMessage('COMMON_GO_BUTTON2') . '"/></noscript>' . LF;
     $html .= '</td>' . LF;
     $html .= '   </tr>' . LF;
     return $html;
 }
Ejemplo n.º 2
0
 function asHTML()
 {
     $html = '';
     $session = $this->_environment->getSession();
     if (!empty($session)) {
         $session_id = $session->getSessionID();
     } else {
         $session_id = '';
     }
     if (!$this->_blank_page) {
         // Link Row
         if ($this->_with_navigation_links and !$this->_shown_as_printable) {
             $html .= $this->_getLinkRowAsHTML();
         } else {
             $html .= $this->_getBlankLinkRowAsHTML();
         }
         $width = 'width:100%;';
         //not used
         $html .= '<div style="padding:0px; margin:0px;">' . LF;
         $html .= '<div class="content">' . LF;
         // Full Screen Views
         $first = true;
         $html .= '<div class="content_fader">';
         $show_agb_again = false;
         $current_user = $this->_environment->getCurrentUserItem();
         $current_context = $this->_environment->getCurrentContextItem();
         if ($current_user->isUser() and !$current_user->isRoot() and $current_context->withAGB()) {
             $user_agb_date = $current_user->getAGBAcceptanceDate();
             $context_agb_date = $current_context->getAGBChangeDate();
             if ($user_agb_date < $context_agb_date) {
                 $show_agb_again = true;
             }
         }
         unset($current_user);
         $html .= LF . '<div id="main">' . LF;
         $html .= $this->_getPluginInfosForBeforeContentAsHTML();
         if ($show_agb_again) {
             $html .= '&nbsp;';
         }
         if (!empty($this->_views)) {
             foreach ($this->_views as $view) {
                 if ($first) {
                     $first = false;
                     $html .= $view->asHTML();
                 } else {
                     $html .= $view->asHTML();
                 }
             }
         }
         if ($this->_environment->getCurrentModule() != 'home' or isset($view->_title) or $show_agb_again) {
             $html .= '</div>';
         }
         // Left views
         if (!empty($this->_views_right)) {
             if ($this->_environment->getCurrentModule() == 'home') {
                 $context_item = $this->_environment->getCurrentContextItem();
                 $title_string = '';
                 $desc_string = '';
                 $size_string = '';
                 $mod_string = '';
                 $config_text = '';
                 $html .= '<div style="clear:both;">' . LF;
                 $html .= '</div>' . LF;
                 $html .= '<div id="commsy_panels" style="width:100%;">' . LF;
                 $html .= '<div style="float:right; width:28%; padding-top:5px; padding-left:0px; vertical-align:top; text-align:left;">' . LF;
                 $html .= '<div style="width:250px;">' . LF;
                 if ($this->_environment->inPrivateRoom()) {
                     $list_infos = '';
                     foreach ($this->_views_left as $view) {
                         if (method_exists($view, '_getListInfosAsHTML')) {
                             $list_infos = $view->_getListInfosAsHTML();
                             break;
                         }
                     }
                     $html .= $list_infos . LF;
                     unset($list_infos);
                     unset($view);
                 }
                 $first = true;
                 $count = 1;
                 $home_right_conf = $context_item->getHomeRightConf();
                 $right_boxes_config_array = array();
                 if (!empty($home_right_conf)) {
                     $home_right_conf_array = explode(',', $home_right_conf);
                     foreach ($home_right_conf_array as $box_conf) {
                         $box_conf_array = explode('_', $box_conf);
                         $right_boxes_config_array[$box_conf_array[0]] = $box_conf_array[1];
                     }
                 }
                 $append = '';
                 foreach ($this->_views_right as $view) {
                     $view_name = $view->getViewName();
                     if ($view_name != 'actions' and $view_name != 'activity' and $view_name != 'usageinfos' and $view_name != 'preferences' and $view_name != 'search' and $view_name != 'homeextratools' and ($view_name != 'netnavigation' or $context_item->withRubric(CS_GROUP_TYPE) or $context_item->withRubric(CS_TOPIC_TYPE) or $context_item->withRubric(CS_INSTITUTION_TYPE))) {
                         $html .= '<div class="commsy_panel" style="margin-bottom:1px;">' . LF;
                         $html .= $view->asHTML();
                         $title_string .= $append . '"' . $view->getViewTitle() . '"';
                         $desc_string .= $append . '"&nbsp;"';
                         $mod_string .= $append . '"&nbsp;"';
                         if ($view_name == 'buzzwords') {
                             $buzzword_manager = $this->_environment->getLabelManager();
                             $buzzword_manager->resetLimits();
                             $buzzword_manager->setContextLimit($this->_environment->getCurrentContextID());
                             $buzzword_manager->setTypeLimit('buzzword');
                             $size = count($buzzword_manager->getIds());
                             unset($buzzword_manager);
                             $size_string .= $append . '"' . $size . '"';
                         } elseif ($view_name == 'tags') {
                             $tag_manager = $this->_environment->getTagManager();
                             $tag_manager->setContextLimit($this->_environment->getCurrentContextID());
                             $tag_manager->select();
                             $size = $tag_manager->getCountAll();
                             unset($tag_manager);
                             $size_string .= $append . '"' . $size . '"';
                         } else {
                             $size_string .= $append . '"10"';
                         }
                         if ($view_name == 'buzzwords' and $context_item->isBuzzwordShowExpanded() or $view_name == 'tags' and $context_item->isTagsShowExpanded() or $view_name == 'netnavigation' and $context_item->isNetnavigationShowExpanded()) {
                             $config_text .= $append . 'true';
                         } else {
                             $config_text .= $append . 'false';
                         }
                         $html .= '</div>';
                     } elseif ($view_name == 'activity') {
                         $html .= '<div style="margin-bottom:1px;">' . LF;
                         $html .= $view->asHTML();
                         $html .= '</div>';
                     } elseif ($view_name == 'usageinfos') {
                         $html .= '<div style="margin-bottom:10px;">' . LF;
                         $html .= $view->asHTML();
                         $html .= '</div>';
                     }
                     if ($view_name == 'buzzwords' or $view_name == 'tags' or $view_name == 'netnavigation') {
                         $append = ',';
                     }
                 }
                 $html .= '</div>' . LF;
                 $html .= '</div>' . LF;
                 $current_browser = mb_strtolower($this->_environment->getCurrentBrowser(), 'UTF-8');
                 $current_browser_version = $this->_environment->getCurrentBrowserVersion();
                 if ($current_browser == 'msie' and (strstr($current_browser_version, '5.') or strstr($current_browser_version, '6.'))) {
                     $width = ' width:100%; padding-right:10px;';
                 } else {
                     $width = '';
                 }
                 $html .= '<div class="content_display_width" style="' . $width . 'padding-top:5px; vertical-align:bottom;">' . LF;
                 $conf = $context_item->getHomeConf();
                 if (!empty($conf)) {
                     $rubrics = explode(',', $conf);
                 } else {
                     $rubrics = array();
                 }
                 foreach ($rubrics as $rubric) {
                     $rubric_array = explode('_', $rubric);
                     if ($rubric_array[1] != 'none' and $rubric_array[1] != 'nodisplay') {
                         if ($rubric_array[1] == 'short') {
                             if (empty($config_text)) {
                                 $config_text .= 'true';
                             } else {
                                 $config_text .= ',true';
                             }
                         } else {
                             if (empty($config_text)) {
                                 $config_text .= 'false';
                             } else {
                                 $config_text .= ',false';
                             }
                         }
                     }
                 }
                 foreach ($this->_views_left as $view) {
                     if (!$this->_environment->inPrivateRoom()) {
                         if ($view->getViewName() != $this->_translator->getMessage('COMMON_INFORMATION_INDEX')) {
                             $html .= '<div class="commsy_panel" style="margin-bottom:20px; border:0px solid black;">' . LF;
                         } else {
                             $html .= '<div id="commsy_no_panel" style="margin-bottom:20px; border:0px solid black;">' . LF;
                         }
                         $desc = $view->_getDescriptionAsHTML();
                         $noscript_title = $view->getViewTitle();
                         if ($view instanceof cs_user_short_view or $view instanceof cs_user_tiny_view) {
                             $image_text = 'user';
                         } elseif ($view instanceof cs_announcement_short_view or $view instanceof cs_announcement_tiny_view) {
                             $image_text = 'announcement';
                         } elseif ($view instanceof cs_project_short_view or $view instanceof cs_project_tiny_view) {
                             $image_text = 'room';
                         } elseif ($view instanceof cs_date_short_view or $view instanceof cs_date_tiny_view) {
                             $image_text = 'date';
                         } elseif ($view instanceof cs_group_short_view or $view instanceof cs_group_tiny_view) {
                             $image_text = 'group';
                         } elseif ($view instanceof cs_institution_short_view or $view instanceof cs_institution_tiny_view) {
                             $image_text = 'group';
                         } elseif ($view instanceof cs_todo_short_view or $view instanceof cs_todo_tiny_view) {
                             $image_text = 'todo';
                         } elseif ($view instanceof cs_topic_short_view or $view instanceof cs_topic_tiny_view) {
                             $image_text = 'topic';
                         } elseif ($view instanceof cs_institution_short_view or $view instanceof cs_institution_tiny_view) {
                             $image_text = 'institution';
                         } elseif ($view instanceof cs_discussion_short_view or $view instanceof cs_discussion_tiny_view) {
                             $image_text = 'discussion';
                         } else {
                             $image_text = 'material';
                         }
                         $mod = $image_text;
                         if ($this->_environment->getCurrentBrowser() == 'MSIE' && mb_substr($this->_environment->getCurrentBrowserVersion(), 0, 1) == '6') {
                             $image = '<img src="images/commsyicons_msie6/16x16/' . $image_text . '.gif" style="padding-top:2px; float:left;"/>';
                         } else {
                             $image = '<img src="images/commsyicons/16x16/' . $image_text . '.png" style="padding-top:2px; float:left;"/>';
                         }
                         $title = addslashes($image . ' ' . $view->getViewTitle());
                         if ($view->getViewName() != $this->_translator->getMessage('COMMON_INFORMATION_INDEX')) {
                             $item_list = $view->getList();
                             $size = 10;
                             if (isset($item_list)) {
                                 $size = $item_list->getCount();
                             }
                             if (empty($size)) {
                                 $size = 10;
                             }
                             if (!empty($size) and ($view instanceof cs_user_short_view or $view instanceof cs_topic_short_view or $view instanceof cs_institution_short_view or $view instanceof cs_group_short_view)) {
                                 $size = round($size / 3, 0);
                             }
                             if (empty($title_string)) {
                                 $title_string .= '"' . $title . '"';
                                 $desc_string .= '"' . $desc . '"';
                                 $size_string .= '"' . $size . '"';
                                 $mod_string .= '"' . $mod . '"';
                             } else {
                                 $title_string .= ',"' . $title . '"';
                                 $desc_string .= ',"' . $desc . '"';
                                 $size_string .= ',"' . $size . '"';
                                 $mod_string .= ',"' . $mod . '"';
                             }
                         }
                         // jQuery
                         //$html .= '<div>';
                         $html .= '<div id="homeheader">';
                         // jQuery
                         $html .= '<noscript>';
                         $html .= '<div class="homeheader">' . $noscript_title . ' ' . $desc . '</div>';
                         $html .= '</noscript>';
                     } else {
                         if ($view->getViewName() == $this->_translator->getMessage('COMMON_INFORMATION_INDEX')) {
                             $html .= '<div id="commsy_no_panel" style="margin-bottom:20px; border:0px solid black;">' . LF;
                         }
                     }
                     $html .= $view->asHTML();
                     if (!$this->_environment->inPrivateRoom()) {
                         $html .= '</div>' . LF;
                         $html .= '</div>' . LF;
                     } else {
                         if ($view->getViewName() == $this->_translator->getMessage('COMMON_INFORMATION_INDEX')) {
                             $html .= '</div>' . LF;
                         }
                     }
                     $last_view = $view;
                 }
                 $html .= '</div>';
                 $html .= '</div>';
                 $html .= '<div style="clear:both;">' . LF;
                 $html .= '</div>' . LF;
                 #               $html .= '</form>'."\n";
                 $html .= '</div>' . LF;
                 $html .= '<script type="text/javascript">' . LF;
                 /*******************************/
                 /* TBD: Die Werte des dritten Arrays setzen, falls die Veränderungen*/
                 /* gespeichert werden sollen Array("pane1","pane1",...)*/
                 /*******************************/
                 $title_string = str_replace('</', '&COMMSYDHTMLTAG&', $title_string);
                 if ($this->_with_modifying_actions) {
                     $modify = 1;
                     $html .= 'var new_action_message="' . $this->_translator->getMessage('COMMON_NEW_ITEM') . '";' . LF;
                     if (!$session->issetValue('cookie') or $session->getValue('cookie') == '0') {
                         $html .= 'var session_id = "' . $session->getSessionID() . '";' . LF;
                     } else {
                         $html .= 'var session_id = false;' . LF;
                     }
                     // Test auf Gemeinschaftsraum
                     if ($context_item->isCommunityRoom()) {
                         $html .= 'var is_community_room = true;' . LF;
                     } else {
                         $html .= 'var is_community_room = false;' . LF;
                     }
                 } else {
                     $modify = 0;
                     $html .= 'var new_action_message="' . $this->_translator->getMessage('COMMON_NO_ACTION_NEW', $this->_translator->getMessage('COMMON_NEW_ITEM')) . '";' . LF;
                 }
                 $html .= 'initCommSyPanels(Array(' . $title_string . '),Array(' . $desc_string . '),Array(' . $config_text . '),Array(),Array(' . $size_string . '),Array(' . $mod_string . '),' . $this->_environment->getCurrentContextID() . ',' . $modify . ');' . LF;
                 $html .= '</script>' . LF;
             } else {
                 $html .= '<table style="width:100%; padding-top:0px;" summary="Layout">' . LF;
                 $html .= '<tr>' . LF;
                 $html .= '<td class="leftviews">' . LF;
                 $html .= '<div class="infoborder" style="margin-top:1px; padding-bottom:10px;"></div>' . LF;
                 foreach ($this->_views_left as $view) {
                     $html .= $view->asHTML();
                     $last_view = $view;
                 }
                 $html .= '</td>' . LF;
                 $html .= '<td class="rightviews">' . LF;
                 $html .= '<div class="infoborder" style="margin-top:1px; padding-bottom:10px;"></div>' . LF;
                 $first = true;
                 foreach ($this->_views_right as $view) {
                     if ($first) {
                         $first = false;
                     } else {
                         $html .= '<br/>' . LF;
                     }
                     $html .= $view->asHTML();
                     $last_view = $view;
                 }
                 unset($first);
                 $html .= '</td>' . LF;
                 $html .= '</tr>' . LF;
                 $html .= '</table>' . LF;
             }
         } else {
             $new_private_room = $this->_environment->inConfigArray('c_use_new_private_room', $this->_environment->getCurrentContextID());
             if ($new_private_room) {
                 $html .= '<div style="clear:both"/></div>' . LF;
             }
         }
         $html .= '<div class="top_of_page">' . LF;
         $html .= '<div style="float:right; padding-right:0px;">' . LF;
         $date = date("Y-m-d");
         $date_array = explode('-', $date);
         $current_time = localtime();
         $month = getLongMonthName($current_time[4]);
         $year = $current_time[5] + 1900;
         $language = $this->_environment->getSelectedLanguage();
         if ($language != 'en') {
             $text = $date_array[2] . '. ' . $month . ' ' . $date_array[0];
         } else {
             $text = $date_array[2] . ' ' . $month . ' ' . $date_array[0];
         }
         $text .= ', ';
         if (mb_strlen($current_time[1]) == 1) {
             $current_time[1] = '0' . $current_time[1];
         }
         $text .= $current_time[2] . ':' . $current_time[1];
         $html .= '<span>' . $text . '</span>' . LF;
         $html .= '</div>' . LF;
         $html .= '<div class="footer">' . LF;
         $html .= '<a href="#top">' . '<img src="images/browse_left2.gif" alt="&lt;" border="0"/></a>&nbsp;<a href="#top">' . $this->_translator->getMessage('COMMON_TOP_OF_PAGE') . '</a>';
         $html .= '</div>' . LF;
         $html .= '</div>' . LF;
         /*         if ($this->_with_navigation_links and !$this->_shown_as_printable) {
                     $html .= $this->_getBlankLinkRowAsHTML(true);
                  } else {
                     $html .= $this->_getBlankLinkRowAsHTML();
                  }*/
         $html .= '</div>' . LF;
         $html .= '</div>' . LF;
         $html .= '</div>' . LF;
         $html .= '</div>' . LF;
         if ($this->_with_delete_box) {
             $html .= $this->getDeleteBoxAsHTML();
         }
         if (isset($_GET['show_profile']) and $_GET['show_profile'] == 'yes') {
             $html .= $this->getProfileBoxAsHTML();
         }
         if (isset($_GET['show_copies']) and $_GET['show_copies'] == 'yes') {
             $html .= $this->getCopyBoxAsHTML();
         }
         if (isset($_GET['attach_view']) and $_GET['attach_view'] == 'yes' and isset($_GET['attach_type']) and !empty($_GET['attach_type']) and $_GET['attach_type'] == 'buzzword' or isset($_POST['right_box_option']) and isOption($_POST['right_box_option'], $this->_translator->getMessage('COMMON_BUZZWORD_NEW_ATTACH')) and !isset($_POST['return_attach_buzzword_list']) or !empty($_POST['option']) and isOption($_POST['option'], $this->_translator->getMessage('COMMON_BUZZWORD_ADD'))) {
             $html .= $this->getBuzzwordBoxAsHTML();
         }
         if (isset($_GET['attach_view']) and $_GET['attach_view'] == 'yes' and isset($_GET['attach_type']) and !empty($_GET['attach_type']) and $_GET['attach_type'] == 'tag' or isset($_POST['right_box_option']) and isOption($_POST['right_box_option'], $this->_translator->getMessage('COMMON_TAG_NEW_ATTACH')) and !isset($_POST['return_attach_tag_list'])) {
             $html .= $this->getTagBoxAsHTML();
         }
         if (isset($_GET['attach_view']) and $_GET['attach_view'] == 'yes' and isset($_GET['attach_type']) and !empty($_GET['attach_type']) and $_GET['attach_type'] == 'item' or isset($_POST['right_box_option']) and (isOption($_POST['right_box_option'], $this->_translator->getMessage('COMMON_ITEM_NEW_ATTACH')) or isOption($_POST['right_box_option'], $this->_translator->getMessage('COMMON_GROUP_ATTACH')) or isOption($_POST['right_box_option'], $this->_translator->getMessage('COMMON_INSTITUTION_ATTACH'))) and !isset($_POST['return_attach_tag_list'])) {
             $html .= $this->getItemListBoxAsHTML();
         }
         if (!empty($this->_views_overlay)) {
             foreach ($this->_views_overlay as $view) {
                 $html .= $this->_getOverlayBoxAsHTML($view);
             }
         }
         $html .= $this->_getPluginInfosForAfterContentAsHTML();
         if ($this->_environment->getCurrentModule() == 'agb' and $this->_environment->getCurrentFunction() == 'index') {
             $html .= '<div id="ie_footer" class="commsy_footer" style="width: 550px;">' . LF;
         } else {
             $html .= '<div id="ie_footer" class="commsy_footer">' . LF;
         }
         $html .= '<div class="footer" style="float:right; text-align:right; padding-left:20px; padding-right:12px; padding-top:5px; padding-bottom:10px; ">' . LF;
         $email_to_moderators = '';
         $current_user = $this->_environment->getCurrentUserItem();
         $current_context = $this->_environment->getCurrentContextItem();
         if ($current_context->showMail2ModeratorLink()) {
             $email_to_moderators = ahref_curl($this->_environment->getCurrentContextID(), 'mail', 'to_moderator', '', $this->_translator->getMessage('COMMON_MAIL_TO_MODERATOR'));
         }
         // service link
         if ($current_context->withAGB() and $this->_with_agb_link) {
             $desc_link = ahref_curl($this->_environment->getCurrentContextID(), 'agb', 'index', '', $this->_translator->getMessage('COMMON_AGB_CONFIRMATION_LINK_INPUT'), '', 'agb', '', '', ' onclick="window.open(href, target, \'toolbar=no, location=no, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=yes, copyhistory=yes, width=600, height=400\');"');
         } else {
             $desc_link = '';
         }
         if ($current_context->showServiceLink() and $current_user->isUser() and !$this->_environment->inPrivateRoom() and !($this->_environment->getCurrentModule() == 'agb' and $this->_environment->getCurrentFunction() == 'index')) {
             // exernal link: BEGIN
             // Hierarchy of service-email: Set email, test if portal tier has one, then server tier
             $service_link_ext = $current_context->getServiceLinkExternal();
             if ($service_link_ext == '') {
                 $portal_item = $this->_environment->getCurrentPortalItem();
                 if (isset($portal_item) and !empty($portal_item)) {
                     $service_link_ext = $portal_item->getServiceLinkExternal();
                 }
                 unset($portal_item);
             }
             if ($service_link_ext == '') {
                 $server_item = $this->_environment->getServerItem();
                 $service_link_ext = $server_item->getServiceLinkExternal();
             }
             if (!empty($service_link_ext)) {
                 if (strstr($service_link_ext, '%')) {
                     $text_convert = $this->_environment->getTextConverter();
                     $service_link_ext = $text_convert->convertPercent($service_link_ext, false, true);
                 }
                 $email_to_service = '<a href="' . $service_link_ext . '" title="' . $this->_translator->getMessage('COMMON_MAIL_TO_SERVICE2_LINK_TITLE') . '" target="_blank">' . $this->_translator->getMessage('COMMON_MAIL_TO_SERVICE2') . '</a>';
             } else {
                 // exernal link: END
                 $server_item = $this->_environment->getServerItem();
                 $link = 'http://www.commsy.net/?n=Software.FAQ&amp;mod=edit';
                 //Hierarchy of service-email: Set email, test if portal tier has one, then server tier
                 $service_email = $current_context->getServiceEmail();
                 if ($service_email == '') {
                     $portal_item = $this->_environment->getCurrentPortalItem();
                     if (isset($portal_item) and !empty($portal_item)) {
                         $service_email = $portal_item->getServiceEmail();
                     }
                     unset($portal_item);
                 }
                 if ($service_email == '') {
                     $service_email = $server_item->getServiceEmail();
                 }
                 if ($service_email == '') {
                     $service_email = 'NONE';
                 }
                 $ip = 'unknown';
                 if (!empty($_SERVER["SERVER_ADDR"])) {
                     $ip = $_SERVER["SERVER_ADDR"];
                 } elseif (!empty($_SERVER["HTTP_HOST"])) {
                     $ip = $_SERVER["HTTP_HOST"];
                 }
                 $email_to_service = '<form action="' . $link . '" method="post" name="service" style="margin-bottom: 0px;">' . LF;
                 $email_to_service .= '<input type="hidden" name="server_name" value="' . $this->_text_as_html_short($server_item->getTitle()) . '"/>' . LF;
                 $email_to_service .= '<input type="hidden" name="server_ip" value="' . $this->_text_as_html_short($ip) . '"/>' . LF;
                 $email_to_service .= '<input type="hidden" name="context_id" value="' . $this->_text_as_html_short($current_context->getItemID()) . '"/>' . LF;
                 $email_to_service .= '<input type="hidden" name="context_name" value="' . $this->_text_as_html_short($current_context->getTitle()) . '"/>' . LF;
                 $email_to_service .= '<input type="hidden" name="context_type" value="' . $this->_text_as_html_short($current_context->getType()) . '"/>' . LF;
                 $email_to_service .= '<input type="hidden" name="user_name" value="' . $this->_text_as_html_short($current_user->getFullname()) . '"/>' . LF;
                 $email_to_service .= '<input type="hidden" name="user_email" value="' . $this->_text_as_html_short($current_user->getEmail()) . '"/>' . LF;
                 $email_to_service .= '<input type="hidden" name="service_email" value="' . $this->_text_as_html_short($service_email) . '"/>' . LF;
                 #$email_to_service .= $this->_translator->getMessage('COMMON_MAIL_TO_SERVICE').' <input type="image" src="images/servicelink.jpg" alt="Link to CommSyService" style="vertical-align:text-bottom;" />'.LF;
                 // jQuery
                 //$email_to_service .= '<a href="javascript:document.service.submit();" title="'.$this->_translator->getMessage('COMMON_MAIL_TO_SERVICE2_LINK_TITLE').'">'.$this->_translator->getMessage('COMMON_MAIL_TO_SERVICE2').'</a>'.LF;
                 $email_to_service .= '<a href="#" id="submit_form" title="' . $this->_translator->getMessage('COMMON_MAIL_TO_SERVICE2_LINK_TITLE') . '">' . $this->_translator->getMessage('COMMON_MAIL_TO_SERVICE2') . '</a>' . LF;
                 // jQuery
                 $email_to_service .= '</form>' . LF;
             }
             $html .= '<table style="margin:0px; padding:0px; border-collapse: collapse; border:0px solid black;" summary="Layout">' . LF;
             $html .= '  <tr>' . LF;
             $html .= '     <td style="margin:0px; padding:0px; font-size:8pt; vertical-align:text-bottom;">' . LF;
             if ($email_to_moderators != '') {
                 $html .= $email_to_moderators . '&nbsp;-&nbsp;';
             }
             $html .= '     </td>' . LF;
             if (!empty($desc_link)) {
                 $html .= '     <td style="margin:0px; padding:0px; font-size:8pt; vertical-align:text-bottom;">' . LF;
                 $html .= $desc_link . '&nbsp;-&nbsp;';
                 $html .= '     </td>' . LF;
             }
             if (!empty($email_to_service)) {
                 $html .= '     <td style="margin:0px; padding:0px; font-size:8pt; vertical-align:text-bottom;">' . LF;
                 $html .= $email_to_service;
                 $html .= '     </td>' . LF;
             }
             $html .= '  </tr>' . LF;
             $html .= '</table>' . LF;
         } elseif (!$this->_environment->inPrivateRoom() and !($this->_environment->getCurrentModule() == 'agb' and $this->_environment->getCurrentFunction() == 'index')) {
             $html .= '<table style="margin:0px; padding:0px; border-collapse: collapse; border:0px solid black;" summary="Layout">' . LF;
             $html .= '  <tr>' . LF;
             $html .= '     <td style="margin:0px; padding:0px; font-size:8pt; vertical-align:text-bottom;">' . LF;
             $html .= $email_to_moderators;
             $html .= '</td>' . LF;
             if (!empty($desc_link)) {
                 $html .= '     <td style="margin:0px; padding:0px; font-size:8pt; vertical-align:text-bottom;">' . LF;
                 $html .= '&nbsp;-&nbsp;' . $desc_link;
                 $html .= '     </td>' . LF;
             }
             $html .= '  </tr>' . LF;
             $html .= '</table>' . LF;
         }
         $html .= '</div>' . LF;
         $html .= '<div style="padding-top:5px; padding-left:10px;">' . LF;
         $html .= $this->_getSystemInfoAsHTML();
         $html .= '</div>' . LF;
         $html .= '</div>' . LF;
         unset($current_user);
         unset($current_context);
         unset($server_item);
         $html .= $this->_getFooterAsHTML();
         $html .= '</body>' . LF;
         $html .= '</html>' . LF;
     }
     return $html;
 }
Ejemplo n.º 3
0
function getLongMonthNameFromInt($int)
{
    return getLongMonthName($int - 1);
}
Ejemplo n.º 4
0
 /**
  * process basic template information
  */
 private function processBaseTemplate()
 {
     $current_user = $this->_environment->getCurrentUser();
     $own_room_item = $current_user->getOwnRoom();
     $portal_user = $current_user->getRelatedPortalUserItem();
     $portal_item = $this->_environment->getCurrentPortalItem();
     $current_context = $this->_environment->getCurrentContextItem();
     $translator = $this->_environment->getTranslationObject();
     $portal_user_item = $current_user->getRelatedPortalUserItem();
     if ($portal_user_item) {
         $this->assign('environment', 'user_language', $portal_user_item->getLanguage());
     }
     $count_new_accounts = 0;
     if ($current_user->isModerator()) {
         // user count
         $manager = $this->_environment->getUserManager();
         $manager->resetLimits();
         $manager->setContextLimit($this->_environment->getCurrentContextID());
         $manager->setStatusLimit(1);
         $manager->select();
         $user = $manager->get();
         $count_new_accounts = 0;
         if ($user->getCount() > 0) {
             $count_new_accounts = $user->getCount();
         }
         // // tasks
         // $manager = $this->_environment->getTaskManager();
         // $manager->resetLimits();
         // $manager->setContextLimit($this->_environment->getCurrentContextID());
         // $manager->setStatusLimit('REQUEST');
         // $manager->select();
         // $tasks = $manager->get();
         // $task = $tasks->getFirst();
         // $count_new_accounts = 0;
         // while($task){
         //    $mode = $task->getTitle();
         //    $task = $tasks->getNext();
         //    if ($mode == 'TASK_USER_REQUEST'){
         //       $count_new_accounts ++;
         //    }
         // }
     }
     global $c_jsmath_enable;
     global $c_jsmath_url;
     if (!isset($c_jsmath_enable)) {
         $c_jsmath_enable = false;
     }
     if (!isset($c_jsmath_url)) {
         $c_jsmath_url = '';
     }
     global $c_js_mode;
     global $c_commsy_url_path;
     global $c_commsy_domain;
     $url_path = '';
     if ($c_commsy_url_path != '') {
         $url_path = $c_commsy_url_path . '/';
         if (!(strpos($url_path, '/') === 0)) {
             $url_path = '/' . $c_commsy_url_path;
         }
     } else {
         $url_path = '/';
     }
     $this->assign('basic', 'commsy_path', $c_commsy_domain . $url_path);
     $this->assign('basic', 'tpl_path', $c_commsy_domain . $url_path . $this->_tpl_path);
     $this->assign('environment', 'cid', $this->_environment->getCurrentContextID());
     $this->assign('environment', 'pid', $this->_environment->getCurrentPortalID());
     $this->assign('environment', 'current_user_id', $this->_environment->getCurrentUserID());
     $this->assign('environment', 'function', $this->_environment->getCurrentFunction());
     $this->assign('environment', 'module', $this->_environment->getCurrentModule());
     $this->assign('environment', 'module_name', $translator->getMessage(strtoupper($this->_environment->getCurrentModule())) . '_INDEX');
     $this->assign('environment', 'params', $this->_environment->getCurrentParameterString());
     $this->assign('environment', 'params_array', $this->_environment->getCurrentParameterArray());
     $this->assign('environment', 'username', $current_user->getFullName());
     $this->assign('environment', 'user_item_id', $current_user->getItemID());
     $this->assign('environment', 'user_picture', $current_user->getPicture());
     $this->assign('environment', 'room_type_commnunity', $current_context->isCommunityRoom());
     $this->assign('environment', 'room_type_group', $current_context->isGroupRoom());
     $this->assign('environment', 'is_guest', $current_user->isReallyGuest());
     $this->assign('environment', 'is_read_only', $current_user->isOnlyReadUser());
     $this->assign('environment', 'is_moderator', $current_user->isModerator());
     $this->assign('translation', 'act_month_long', getLongMonthName(date("n") - 1));
     $this->assign('environment', 'lang', $this->_environment->getSelectedLanguage());
     $this->assign('environment', 'logo', $current_context->getLogoFileName());
     $this->assign('environment', 'room_title', $current_context->getTitle());
     $this->assign('environment', 'portal_title', $portal_item->getTitle());
     $this->assign('environment', 'show_room_title', $current_context->showTitle());
     $this->assign('environment', 'language', $current_context->getLanguage());
     $this->assign('environment', 'count_copies', $this->getUtils()->getCopyCount());
     $this->assign('environment', 'show_moderator_link', $current_context->showMail2ModeratorLink());
     $this->assign('environment', 'show_service_link', $portal_item->showServiceLink());
     $this->assign('environment', 'service_link', $this->_getServiceMailLink());
     $this->assign('environment', 'c_jsmath_enable', $c_jsmath_enable);
     $this->assign('environment', 'c_jsmath_url', $c_jsmath_url);
     $this->assign('environment', 'c_js_mode', isset($c_js_mode) && $c_js_mode === "layer" ? $c_js_mode : "source");
     $this->assign('environment', 'count_new_accounts', $count_new_accounts);
     $this->assign('environment', 'post', $_POST);
     $this->assign('environment', 'get', $_GET);
     include_once 'functions/misc_functions.php';
     $this->assign('environment', 'commsy_version', getCommSyVersion());
     $c_version_addon = $this->_environment->getConfiguration('c_version_addon');
     if (!empty($c_version_addon)) {
         $this->assign('environment', 'commsy_version_addon', $c_version_addon);
     }
     // archive
     $this->assign('environment', 'archive_mode', $this->_environment->isArchiveMode());
     // archive
     // browser
     $current_browser = mb_strtolower($this->_environment->getCurrentBrowser(), 'UTF-8');
     $current_browser_version = $this->_environment->getCurrentBrowserVersion();
     $IE8 = false;
     if ($current_browser == 'msie' && strstr($current_browser_version, '8.')) {
         $IE8 = true;
     }
     $this->assign("environment", "IE8", $IE8);
     $ownRoomItem = $current_user->getOwnRoom();
     if ($ownRoomItem) {
         $this->assign("own", "id", $ownRoomItem->getItemId());
         $this->assign("own", "with_activating", $ownRoomItem->withActivatingContent());
     }
     $this->assign('environment', 'use_problems', $this->getUseProblems());
     if (isset($own_room_item) and !$this->_environment->isArchiveMode()) {
         $this->assign('cs_bar', 'show_widgets', $own_room_item->getCSBarShowWidgets());
         $this->assign('cs_bar', 'show_calendar', $own_room_item->getCSBarShowCalendar());
         $this->assign('cs_bar', 'show_stack', $own_room_item->getCSBarShowStack());
         $this->assign('cs_bar', 'show_portfolio', $own_room_item->getCSBarShowPortfolio());
         $this->assign('cs_bar', 'addon_information', $this->getAddonInformation());
         if ($own_room_item->showCSBarConnection()) {
             $this->assign('cs_bar', 'show_connection', $own_room_item->getCSBarShowConnection());
         } else {
             $this->assign('cs_bar', 'show_connection', false);
         }
     } else {
         $this->assign('cs_bar', 'show_widgets', false);
         $this->assign('cs_bar', 'show_calendar', false);
         $this->assign('cs_bar', 'show_stack', false);
         $this->assign('cs_bar', 'show_portfolio', false);
         $this->assign('cs_bar', 'show_connection', false);
     }
     $this->assign('cs_bar', 'show_limesurvey', !($this->_environment->inPortal() || $this->_environment->inServer()) && $current_context->isLimeSurveyActive() && $portal_item->isLimeSurveyActive() && $portal_item->withLimeSurveyFunctions());
     // to javascript
     $to_javascript = array();
     $to_javascript['template']['tpl_path'] = $this->_tpl_path;
     $to_javascript['environment']['lang'] = $this->_environment->getSelectedLanguage();
     $to_javascript['environment']['single_entry_point'] = $this->_environment->getConfiguration('c_single_entry_point');
     $to_javascript['environment']['max_upload_size'] = $this->_environment->getCurrentContextItem()->getMaxUploadSizeInBytes();
     $to_javascript['environment']['portal_link_status'] = $portal_item->getProjectRoomLinkStatus();
     // optional | mandatory
     $to_javascript['environment']['isPortal'] = $this->_environment->getCurrentContextItem()->isPortal();
     // escape ' and replace it with \x27
     $to_javascript['environment']['user_name'] = str_replace("'", '\\x27', $current_user->getFullName());
     $current_portal_user = $this->_environment->getPortalUserItem();
     // password expires soon alert
     if (!empty($current_portal_user) and $current_portal_user->getPasswordExpireDate() > getCurrentDateTimeInMySQL()) {
         $start_date = new DateTime(getCurrentDateTimeInMySQL());
         $since_start = $start_date->diff(new DateTime($current_portal_user->getPasswordExpireDate()));
         $days = $since_start->days;
         if ($days == 0) {
             $days = 1;
         }
         $days_before_expiring_sendmail = $portal_item->getDaysBeforeExpiringPasswordSendMail();
         if (isset($days_before_expiring_sendmail) and $days <= $days_before_expiring_sendmail) {
             $to_javascript["translations"]["password_expire_soon_alert"] = $translator->getMessage("COMMON_PASSWORD_EXPIRE_ALERT", $days);
             $to_javascript['environment']['password_expire_soon'] = true;
         } else {
             if (!isset($days_before_expiring_sendmail) and $days <= 14) {
                 $to_javascript["translations"]["password_expire_soon_alert"] = $translator->getMessage("COMMON_PASSWORD_EXPIRE_ALERT", $days);
                 $to_javascript['environment']['password_expire_soon'] = true;
             }
         }
     } else {
         $to_javascript['environment']['password_expire_soon'] = false;
     }
     // locking
     $checkLocking = $this->_environment->getConfiguration('c_item_locking');
     $checkLocking = $checkLocking ? $checkLocking : false;
     $to_javascript["environment"]["item_locking"] = $checkLocking;
     // single categorie selection
     $singleCatSelection = $this->_environment->getConfiguration('c_single_cat_selection');
     $singleCatSelection = $singleCatSelection ? $singleCatSelection : false;
     $to_javascript["environment"]["single_cat_selection"] = $singleCatSelection;
     $to_javascript['i18n']['COMMON_NEW_BLOCK'] = $translator->getMessage('COMMON_NEW_BLOCK');
     $to_javascript['i18n']['COMMON_SAVE_BUTTON'] = $translator->getMessage('COMMON_SAVE_BUTTON');
     $to_javascript['security']['token'] = getToken();
     $to_javascript['autosave']['mode'] = 0;
     $to_javascript['autosave']['limit'] = 0;
     global $c_media_integration;
     if ($c_media_integration) {
         $to_javascript['c_media_integration'] = true;
         // check for rights for mdo
         $current_context_item = $this->_environment->getCurrentContextItem();
         if ($current_context_item->isProjectRoom()) {
             // does this project room has any community room?
             $community_list = $current_context_item->getCommunityList();
             if ($community_list->isNotEmpty()) {
                 // check for community rooms activated the mdo feature
                 $community = $community_list->getFirst();
                 while ($community) {
                     $mdo_active = $community->getMDOActive();
                     if (!empty($mdo_active) && $mdo_active != '-1') {
                         $to_javascript['mdo_active'] = true;
                         break;
                     }
                     $community = $community_list->getNext();
                 }
             }
         }
     } else {
         $to_javascript['c_media_integration'] = false;
     }
     if ($ownRoomItem) {
         $to_javascript['own']['id'] = $ownRoomItem->getItemId();
         $to_javascript['ownRoom']['id'] = $ownRoomItem->getItemId();
         $to_javascript['ownRoom']['withPortfolio'] = $own_room_item->getCSBarShowPortfolio();
     }
     // translations - should be managed elsewhere soon
     $to_javascript["translations"]["common_hide"] = $translator->getMessage("COMMON_HIDE");
     $to_javascript["translations"]["common_show"] = $translator->getMessage("COMMON_SHOW");
     $current_user = $this->_environment->getCurrentUserItem();
     $auth_source_manager = $this->_environment->getAuthSourceManager();
     $auth_source_item = $auth_source_manager->getItem($current_user->getAuthSource());
     if (isset($auth_source_item)) {
         $show_tooltip = true;
         // password
         if ($auth_source_item->getPasswordLength() > 0) {
             $to_javascript["password"]["length"] = $translator->getMessage('PASSWORD_INFO2_LENGTH', $auth_source_item->getPasswordLength());
         } else {
             $show_tooltip = false;
         }
         if ($auth_source_item->getPasswordSecureBigchar() == 1) {
             $to_javascript["password"]["big"] = $translator->getMessage('PASSWORD_INFO2_BIG');
         } else {
             $show_tooltip = false;
         }
         if ($auth_source_item->getPasswordSecureSmallchar() == 1) {
             $to_javascript["password"]["small"] = $translator->getMessage('PASSWORD_INFO2_SMALL');
         } else {
             $show_tooltip = false;
         }
         if ($auth_source_item->getPasswordSecureNumber() == 1) {
             $to_javascript["password"]["special"] = $translator->getMessage('PASSWORD_INFO2_SPECIAL');
         } else {
             $show_tooltip = false;
         }
         if ($auth_source_item->getPasswordSecureSpecialchar() == 1) {
             $to_javascript["password"]["number"] = $translator->getMessage('PASSWORD_INFO2_NUMBER');
         } else {
             $show_tooltip = false;
         }
     } else {
         $show_tooltip = false;
     }
     if ($show_tooltip) {
         $to_javascript["password"]["tooltip"] = 1;
     } else {
         $to_javascript["password"]["tooltip"] = 0;
     }
     if ($this->_environment->getCurrentFunction() == 'detail' and $this->_environment->getCurrentModule() == 'group') {
         $params = $this->_environment->getCurrentParameterArray();
         $group_manager = $this->_environment->getGroupManager();
         $group_item = $group_manager->getItem($params['iid']);
         if ($group_item->isGroupRoomActivated()) {
             $to_javascript['dev']['room_id'] = $group_item->getGroupRoomItemID();
         }
     }
     // dev
     global $c_indexed_search;
     global $c_xhr_error_reporting;
     $this->assign('environment', 'with_indexed_search', isset($c_indexed_search) && $c_indexed_search === true ? true : false);
     $to_javascript['dev']['indexed_search'] = isset($c_indexed_search) && $c_indexed_search === true ? true : false;
     $to_javascript['dev']['xhr_error_reporting'] = isset($c_xhr_error_reporting) && !empty($c_xhr_error_reporting) ? true : false;
     if (isset($portal_user) && $portal_user->isAutoSaveOn()) {
         global $c_autosave_mode;
         global $c_autosave_limit;
         if (isset($c_autosave_mode) && isset($c_autosave_limit)) {
             $to_javascript['autosave']['mode'] = $c_autosave_mode;
             $to_javascript['autosave']['limit'] = $c_autosave_limit;
         }
     }
     // limesurvey
     if (!($this->_environment->inPortal() || $this->_environment->inServer()) && $current_context->isLimeSurveyActive() && $portal_item->isLimeSurveyActive() && $portal_item->withLimeSurveyFunctions()) {
         $rpcPathParsed = parse_url($portal_item->getLimeSurveyJsonRpcUrl());
         $matches = array();
         preg_match('/(.*)\\/index.php/', $rpcPathParsed['path'], $matches);
         $subPath = '';
         if (isset($matches[1])) {
             $subPath = $matches[1];
         }
         $to_javascript["limesurvey"]["newSurveyPath"] = $rpcPathParsed['scheme'] . "://" . $rpcPathParsed['host'] . $subPath . "/index.php/admin/survey/sa/index";
         $to_javascript["limesurvey"]["adminPath"] = $rpcPathParsed['scheme'] . "://" . $rpcPathParsed['host'] . $subPath . "/index.php/admin/";
         $to_javascript["limesurvey"]["roomName"] = $current_context = $current_context->getTitle();
     }
     // mixin javascript variables
     if (is_array($this->_toJSMixin)) {
         $to_javascript = array_merge($to_javascript, $this->_toJSMixin);
     }
     $this->assign('javascript', 'variables_as_json', json_encode($to_javascript));
     $this->assign("javascript", "locale", $this->_environment->getSelectedLanguage());
     // version
     global $c_debug;
     if (isset($c_debug) && $c_debug === true) {
         $this->assign("javascript", "version", uniqid("", true));
     } else {
         if (file_exists("version")) {
             $versionFromFile = trim(file_get_contents("version"));
             /*
              * It is very important to replace " " whitespaces, otherwhise dojo shows some odd behaviour
              * resulting in adding y11n body classes(high contrast css)
              */
             $this->assign("javascript", "version", str_replace(" ", "_", $versionFromFile));
         } else {
             $this->assign("javascript", "version", "unset");
         }
     }
     // plugins
     $info_before_body_ends = LF . '   <!-- PLUGINS BEGIN -->' . LF;
     include_once 'functions/misc_functions.php';
     $info_before_body_ends .= plugin_hook_output_all('getInfosForBeforeBodyEndAsHTML', array(), LF, false) . LF;
     $info_before_body_ends .= '   <!-- PLUGINS END -->' . LF . LF;
     $this->assign('basic', 'html_before_body_ends', $info_before_body_ends);
 }