Ejemplo n.º 1
0
 /** get the single entry of the list view as HTML
  * this method returns the single entry in HTML-Code
  *
  * @returns string $item as HMTL
  *
  * @param object item     the single list entry
  * @author CommSy Development Group
  */
 function _getItemAsHTML($item)
 {
     $html = LF . '<!-- BEGIN OF ANNOUNCEMENT ITEM DETAIL -->' . LF;
     $formal_data = array();
     $temp_array[0] = $this->_translator->getMessage('ANNOUNCEMENT_SHOW_HOME_DATE');
     $temp_array[1] = $this->_compareWithSearchText(getDateTimeInLang($item->getSeconddateTime()));
     $formal_data[] = $temp_array;
     // Files
     $files = $this->_getFilesForFormalData($item);
     if (!empty($files)) {
         $temp_array = array();
         $temp_array[] = $this->_translator->getMessage('MATERIAL_FILES');
         $temp_array[] = implode(BRLF, $files);
         $formal_data[] = $temp_array;
     }
     if (!empty($formal_data)) {
         $html .= $this->_getFormalDataAsHTML($formal_data);
         $html .= BRLF;
     }
     $desc = $this->_item->getDescription();
     if (!empty($desc)) {
         $desc = $this->_text_as_html_long($this->_compareWithSearchText($this->_cleanDataFromTextArea($desc)));
         $desc = $this->_show_images($desc, $item, true);
         $html .= $this->getScrollableContent($desc, $item, '', true);
     }
     $html .= '<!-- END OF ANNOUNCEMENT ITEM DETAIL -->' . LF . LF;
     return $html;
 }
 protected function getDetailContent()
 {
     $converter = $this->_environment->getTextConverter();
     $desc = $this->_item->getDescription();
     if (!empty($desc)) {
         $converter->setFileArray($this->getItemFileList());
         if ($this->_with_old_text_formating) {
             $desc = $converter->textFullHTMLFormatting($desc);
         } else {
             //$desc = $converter->cleanDataFromTextArea($desc);
             //$desc = $converter->compareWithSearchText...
             //$desc = $converter->text_as_html_long($desc);
             //$desc = $converter->show_images($desc, $this->_item, true);
             //$html .= $this->getScrollableContent($desc,$item,'',true);
             $desc = $converter->textFullHTMLFormatting($desc);
         }
     }
     return array('item_id' => $this->_item->getItemID(), 'formal' => $this->getFormalData(), 'files' => $this->getFileContent(), 'title' => $this->_item->getTitle(), 'creator' => $this->_item->getCreatorItem()->getFullName(), 'creation_date' => getDateTimeInLang($this->_item->getCreationDate()), 'description' => $desc, 'moredetails' => $this->getCreatorInformationAsArray($this->_item));
 }
Ejemplo n.º 3
0
 /** get the single entry of the list view as HTML
  * this method returns the single entry in HTML-Code
  *
  * @returns string $item as HMTL
  *
  * @param cs_material_item material     the single list entry
  */
 function _getItemAsHTML($item, $version_id = NULL, $with_links = TRUE)
 {
     $context_item = $this->_environment->getCurrentContextItem();
     $html = LF . '<!-- BEGIN OF MATERIAL ITEM DETAIL -->' . LF;
     $html .= $this->_getPluginInfosForMaterialDetailAsHTML();
     $formal_data1 = array();
     $bib_kind = $item->getBibKind() ? $item->getBibKind() : 'none';
     $biblio = '';
     // Author, Year
     $temp_array = array();
     /*      $author = $item->getAuthor();
           if ($bib_kind =='none' and !empty($author)){
              $temp_array[0]  = $this->_translator->getMessage('MATERIAL_AUTHORS');
              $temp_array[1]  = $this->_text_as_html_short($item->getAuthor());
              $formal_data1[] = $temp_array;
              $temp_array = array();
              $old_bibtext = $item->getBibliographicValues();
              if( !empty($old_bibtext) ){
                 $temp_array[0]  = $this->_translator->getMessage('MATERIAL_PUBLISHING_DATE');
                 $temp_array[1]  = $this->_text_as_html_long($item->getPublishingDate());
                 $formal_data1[] = $temp_array;
                 $temp_array = array();
                 $temp_array[0]  = $this->_translator->getMessage('MATERIAL_BIBLIOGRAPHIC');
                 $temp_array[1]  = $this->_text_as_html_long($item->getBibliographicValues());
                 $formal_data1[] = $temp_array;
                 $temp_array = array();
              }
           }else
           */
     if ($bib_kind == 'common') {
         $author = $item->getAuthor();
         $formal_data1 = array();
         if (!empty($author)) {
             $temp_array[0] = $this->_translator->getMessage('MATERIAL_AUTHORS');
             $temp_array[1] = $this->_text_as_html_short($this->_compareWithSearchText($item->getAuthor()));
             $formal_data1[] = $temp_array;
         }
         $pub_date = $item->getPublishingDate();
         if (!empty($pub_date)) {
             $temp_array[0] = $this->_translator->getMessage('MATERIAL_PUBLISHING_DATE');
             $temp_array[1] = $this->_text_as_html_short($this->_compareWithSearchText($item->getPublishingDate()));
             $formal_data1[] = $temp_array;
         }
         if (!empty($formal_data1)) {
             $html .= $this->_getFormalDataAsHTML($formal_data1);
             if (isset($html_script) and !empty($html_script)) {
                 $html .= $html_script;
             }
         }
         $formal_data1 = array();
         $temp_array = array();
         $biblio = $item->getBibliographicValues();
     } elseif ($bib_kind == 'website') {
         $biblio = $item->getAuthor() . ',';
     } elseif ($bib_kind == 'document') {
         $biblio = '';
     } else {
         $biblio = $item->getAuthor() . ' (' . $item->getPublishingDate() . '). ';
     }
     if ($bib_kind != 'common') {
         // Bibliographic
         switch ($bib_kind) {
             case 'book':
             case 'collection':
                 $biblio .= $item->getAddress() . ': ' . $item->getPublisher();
                 if ($item->getEdition()) {
                     $biblio .= ', ' . $this->_translator->getMessage('MATERIAL_BIB_EDITION', $item->getEdition());
                 }
                 if ($item->getSeries()) {
                     $biblio .= ', ' . $this->_translator->getMessage('MATERIAL_BIB_SERIES', $item->getSeries());
                 }
                 if ($item->getVolume()) {
                     $biblio .= ', ' . $this->_translator->getMessage('MATERIAL_BIB_VOLUME', $item->getVolume());
                 }
                 if ($item->getISBN()) {
                     $biblio .= ', ' . $this->_translator->getMessage('MATERIAL_BIB_ISBN', $item->getISBN());
                 }
                 $biblio .= '.';
                 if ($item->getURL()) {
                     $biblio .= ' ' . $this->_translator->getMessage('MATERIAL_BIB_URL', $item->getURL());
                     if ($item->getURLDate()) {
                         $biblio .= ' (' . $this->_translator->getMessage('MATERIAL_BIB_URL_DATE', $item->getURLDate()) . ')';
                     }
                     $biblio .= '.';
                 }
                 break;
             case 'incollection':
                 $editor = $item->getEditor();
                 if (!empty($editor)) {
                     $biblio .= $this->_translator->getMessage('MATERIAL_BIB_IN') . ': ';
                     $biblio .= $this->_translator->getMessage('MATERIAL_BIB_EDITOR', $item->getEditor()) . ': ';
                 }
                 $biblio .= $item->getBooktitle() . '. ';
                 $biblio .= $item->getAddress() . ': ' . $item->getPublisher();
                 if ($item->getEdition()) {
                     $biblio .= ', ' . $this->_translator->getMessage('MATERIAL_BIB_EDITION', $item->getEdition());
                 }
                 if ($item->getSeries()) {
                     $biblio .= ', ' . $this->_translator->getMessage('MATERIAL_BIB_SERIES', $item->getSeries());
                 }
                 if ($item->getVolume()) {
                     $biblio .= ', ' . $this->_translator->getMessage('MATERIAL_BIB_VOLUME', $item->getVolume());
                 }
                 if ($item->getISBN()) {
                     $biblio .= ', ' . $this->_translator->getMessage('MATERIAL_BIB_ISBN', $item->getISBN());
                 }
                 $biblio .= ', ' . $this->_translator->getMessage('MATERIAL_BIB_PAGES', $item->getPages()) . '.';
                 if ($item->getURL()) {
                     $biblio .= ' ' . $this->_translator->getMessage('MATERIAL_BIB_URL', $item->getURL());
                     if ($item->getURLDate()) {
                         $biblio .= ' (' . $this->_translator->getMessage('MATERIAL_BIB_URL_DATE', $item->getURLDate()) . ')';
                     }
                     $biblio .= '.';
                 }
                 break;
             case 'article':
                 $biblio .= $this->_translator->getMessage('MATERIAL_BIB_IN') . ': ' . $item->getJournal();
                 if ($item->getVolume()) {
                     $biblio .= ', ' . $item->getVolume();
                     if ($item->getIssue()) {
                         $biblio .= ' (' . $item->getIssue() . ')';
                     }
                 } elseif ($item->getIssue()) {
                     $biblio .= ', ' . $item->getIssue();
                 }
                 $biblio .= ', ' . $this->_translator->getMessage('MATERIAL_BIB_PAGES', $item->getPages()) . '. ';
                 $bib2 = '';
                 if ($item->getAddress()) {
                     $bib2 .= $item->getAddress();
                 }
                 if ($item->getPublisher()) {
                     $bib2 .= $bib2 ? ', ' : '';
                     $bib2 .= $item->getPublisher();
                 }
                 if ($item->getISSN()) {
                     $bib2 .= $bib2 ? ', ' : '';
                     $bib2 .= $item->getISSN();
                 }
                 $bib2 .= $bib2 ? '. ' : '';
                 $biblio .= $bib2 ? $bib2 : '';
                 if ($item->getURL()) {
                     $biblio .= ' ' . $this->_translator->getMessage('MATERIAL_BIB_URL', $item->getURL());
                     if ($item->getURLDate()) {
                         $biblio .= ' (' . $this->_translator->getMessage('MATERIAL_BIB_URL_DATE', $item->getURLDate()) . ')';
                     }
                     $biblio .= '.';
                 }
                 break;
             case 'inpaper':
                 $biblio .= $this->_translator->getMessage('MATERIAL_BIB_IN') . ': ' . $item->getJournal();
                 if ($item->getIssue()) {
                     $biblio .= ', ' . $item->getIssue();
                 }
                 $biblio .= ', ' . $this->_translator->getMessage('MATERIAL_BIB_PAGES', $item->getPages()) . '. ';
                 $bib2 = '';
                 if ($item->getAddress()) {
                     $bib2 .= $item->getAddress();
                 }
                 if ($item->getPublisher()) {
                     $bib2 .= $bib2 ? ', ' : '';
                     $bib2 .= $item->getPublisher();
                 }
                 $bib2 .= $bib2 ? '. ' : '';
                 $biblio .= $bib2 ? $bib2 : '';
                 if ($item->getURL()) {
                     $biblio .= ' ' . $this->_translator->getMessage('MATERIAL_BIB_URL', $item->getURL());
                     if ($item->getURLDate()) {
                         $biblio .= ' (' . $this->_translator->getMessage('MATERIAL_BIB_URL_DATE', $item->getURLDate()) . ')';
                     }
                     $biblio .= '.';
                 }
                 break;
             case 'thesis':
                 $temp_Thesis_Kind = mb_strtoupper($item->getThesisKind(), 'UTF-8');
                 switch ($temp_Thesis_Kind) {
                     case 'BACHELOR':
                         $biblio .= $this->_translator->getMessage('MATERIAL_THESIS_BACHELOR') . '. ';
                         break;
                     case 'DIPLOMA':
                         $biblio .= $this->_translator->getMessage('MATERIAL_THESIS_DIPLOMA') . '. ';
                         break;
                     case 'DISSERTATION':
                         $biblio .= $this->_translator->getMessage('MATERIAL_THESIS_DISSERTATION') . '. ';
                         break;
                     case 'EXAM':
                         $biblio .= $this->_translator->getMessage('MATERIAL_THESIS_EXAM') . '. ';
                         break;
                     case 'KIND':
                         $biblio .= $this->_translator->getMessage('MATERIAL_THESIS_KIND') . '. ';
                         break;
                     case 'KIND_DESC':
                         $biblio .= $this->_translator->getMessage('MATERIAL_THESIS_KIND_DESC') . '. ';
                         break;
                     case 'MASTER':
                         $biblio .= $this->_translator->getMessage('MATERIAL_THESIS_MASTER') . '. ';
                         break;
                     case 'OTHER':
                         $biblio .= $this->_translator->getMessage('MATERIAL_THESIS_OTHER') . '. ';
                         break;
                     case 'POSTDOC':
                         $biblio .= $this->_translator->getMessage('MATERIAL_THESIS_POSTDOC') . '. ';
                         break;
                     case 'TERM':
                         $biblio .= $this->_translator->getMessage('MATERIAL_THESIS_TERM') . '. ';
                         break;
                     default:
                         $biblio .= $this->_translator->getMessage('COMMON_MESSAGETAG_ERROR') . ' cs_material_detail_view(446) ';
                         break;
                 }
                 $biblio .= $item->getAddress() . ': ' . $item->getUniversity();
                 if ($item->getFaculty()) {
                     $biblio .= ', ' . $item->getFaculty();
                 }
                 $biblio .= '.';
                 if ($item->getURL()) {
                     $biblio .= ' ' . $this->_translator->getMessage('MATERIAL_BIB_URL', $item->getURL());
                     if ($item->getURLDate()) {
                         $biblio .= ' (' . $this->_translator->getMessage('MATERIAL_BIB_URL_DATE', $item->getURLDate()) . ')';
                     }
                     $biblio .= '.';
                 }
                 break;
             case 'website':
                 $biblio .= ' ' . $this->_translator->getMessage('MATERIAL_BIB_URL', $item->getURL());
                 if ($item->getURLDate()) {
                     $biblio .= ' (' . $this->_translator->getMessage('MATERIAL_BIB_URL_DATE', $item->getURLDate()) . ')';
                 }
                 $biblio .= '.';
                 break;
             case 'manuscript':
                 $biblio .= $item->getBibliographicValues();
                 if ($item->getAddress()) {
                     $biblio .= ' ' . $item->getAddress();
                     $biblio .= '.';
                 }
                 if ($item->getURL()) {
                     $biblio .= ' ' . $this->_translator->getMessage('MATERIAL_BIB_URL', $item->getURL());
                     if ($item->getURLDate()) {
                         $biblio .= ' (' . $this->_translator->getMessage('MATERIAL_BIB_URL_DATE', $item->getURLDate()) . ')';
                     }
                     $biblio .= '.';
                 }
                 break;
                 /** Start Dokumentenverwaltung **/
             /** Start Dokumentenverwaltung **/
             case 'document':
                 $formal_data_bib = array();
                 $html .= $this->_translator->getMessage('MATERIAL_BIB_DOCUMENT_ADMINISTRATION_INFO');
                 if ($item->getDocumentEditor()) {
                     $temp_array = array();
                     $temp_array[] = $this->_translator->getMessage('MATERIAL_BIB_DOCUMENT_EDITOR');
                     $temp_array[] = $item->getDocumentEditor();
                     $formal_data_bib[] = $temp_array;
                 }
                 if ($item->getDocumentMaintainer()) {
                     $temp_array = array();
                     $temp_array[] = $this->_translator->getMessage('MATERIAL_BIB_DOCUMENT_MAINTAINER');
                     $temp_array[] = $item->getDocumentMaintainer();
                     $formal_data_bib[] = $temp_array;
                 }
                 if ($item->getDocumentReleaseNumber()) {
                     $temp_array = array();
                     $temp_array[] = $this->_translator->getMessage('MATERIAL_BIB_DOCUMENT_RELEASE_NUMBER');
                     $temp_array[] = $item->getDocumentReleaseNumber();
                     $formal_data_bib[] = $temp_array;
                 }
                 if ($item->getDocumentReleaseDate()) {
                     $temp_array = array();
                     $temp_array[] = $this->_translator->getMessage('MATERIAL_BIB_DOCUMENT_RELEASE_DATE');
                     $temp_array[] = $item->getDocumentReleaseDate();
                     $formal_data_bib[] = $temp_array;
                 }
                 if (!empty($formal_data_bib)) {
                     $html .= $this->_getFormalDataAsHTML($formal_data_bib);
                 }
                 break;
                 /** Ende Dokumentenverwaltung **/
             /** Ende Dokumentenverwaltung **/
             case 'none':
             default:
                 $biblio .= $item->getBibliographicValues();
         }
     }
     $biblio_pur = strip_tags($biblio);
     $biblio_pur = str_ireplace('&nbsp;', '', $biblio_pur);
     $biblio_pur = trim($biblio_pur);
     if ($bib_kind != 'none' and !empty($biblio_pur)) {
         $temp_array = array();
         $temp_array[] = $this->_translator->getMessage('MATERIAL_BIBLIOGRAPHIC');
         if (!empty($biblio)) {
             $temp_array[] = $this->_text_as_html_long($this->_compareWithSearchText($this->_cleanDataFromTextArea($biblio)));
         } else {
             $temp_array[] = '<span class="disabled">' . $this->_translator->getMessage('COMMON_NONE') . '</span>';
         }
         $formal_data1[] = $temp_array;
     }
     if ($item->issetBibTOC()) {
         $temp_array = array();
         $temp_array[] = $this->_translator->getMessage('COMMON_TABLE_OF_CONTENT');
         $temp_array[] = '<a href="' . $item->getBibTOC() . '" target="blank">' . chunkText($item->getBibTOC(), 60) . '</a>';
         $formal_data1[] = $temp_array;
     }
     if ($item->issetBibURL()) {
         $temp_array = array();
         $temp_array[] = $this->_translator->getMessage('BELUGA_LINK');
         $temp_array[] = '<a href="' . $item->getBibURL() . '" target="blank">' . chunkText($item->getBibURL(), 60) . '</a>';
         $formal_data1[] = $temp_array;
     }
     if ($item->issetBibAvailibility()) {
         $temp_array = array();
         $temp_array[] = $this->_translator->getMessage('BELUGA_AVAILABILITY');
         $link = $item->getBibAvailibility();
         $temp_array[] = $link;
         $formal_data1[] = $temp_array;
     }
     if ($context_item->isWikiActive()) {
         if ($item->isExportToWiki()) {
             $temp_array = array();
             $temp_array[] = $this->_translator->getMessage('MATERIAL_EXPORT_TO_WIKI_LINK');
             $temp_array[] = $item->getExportToWikiLink();
             $formal_data1[] = $temp_array;
         }
     }
     if ($context_item->isWordpressActive()) {
         if ($item->isExportToWordpress()) {
             $temp_array = array();
             $temp_array[] = $this->_translator->getMessage('MATERIAL_EXPORT_TO_WORDPRESS_LINK');
             $temp_array[] = $item->getExportToWordpressLink();
             $formal_data1[] = $temp_array;
         }
     }
     // Sections
     $this->_section_list = $item->getSectionList();
     if (!$this->_section_list->isEmpty()) {
         $temp_array = array();
         $temp_array[] = $this->_translator->getMessage('MATERIAL_ABSTRACT');
         $description = $item->getDescription();
         if (!empty($description)) {
             $temp_string = $this->_text_as_html_long($this->_cleanDataFromTextArea($this->_compareWithSearchText($description)));
             $temp_array[] = '<div class="handle_width">' . $this->_show_images($temp_string, $this->_item, $with_links) . '</div>' . '<br/><br/>';
         } else {
             $temp_array[] = '<span class="disabled">' . $this->_translator->getMessage('COMMON_NONE') . '</span>';
         }
         $formal_data1[] = $temp_array;
         $sections = array();
         $i = 1;
         $section = $this->_section_list->getFirst();
         while ($section) {
             // files
             $fileicons = $this->_getItemFiles($section, true);
             if (!empty($fileicons)) {
                 $fileicons = '&nbsp;' . $fileicons;
             }
             $section_title = $this->_text_as_html_short($this->_compareWithSearchText($section->getTitle()));
             if ($with_links and !(isset($_GET['mode']) and $_GET['mode'] == 'print')) {
                 $section_title = '<a href="#anchor' . $section->getItemID() . '">' . $section_title . '</a>' . $fileicons . LF;
             }
             $sections[] = $section_title;
             $section = $this->_section_list->getNext();
             $i++;
         }
         $temp_array = array();
         $temp_array[] = $this->_translator->getMessage('MATERIAL_SECTIONS');
         $temp_array[] = implode(BRLF, $sections) . '<br/><br/>';
         $formal_data1[] = $temp_array;
     }
     // Files
     $files = $this->_getFilesForFormalData($item);
     if (!empty($files)) {
         $temp_array = array();
         $temp_array[] = $this->_translator->getMessage('MATERIAL_FILES');
         $temp_array[] = implode(BRLF, $files);
         $formal_data1[] = $temp_array;
     }
     // World-public status
     $current_context = $this->_environment->getCurrentContextItem();
     if ($current_context->isCommunityRoom() and $current_context->isOpenForGuests()) {
         $temp_array = array();
         $world_public = $item->getWorldPublic();
         if ($world_public == 0) {
             $public_info = $this->_translator->getMessage('MATERIAL_WORLD_PUBLISH_STATUS_0');
         } elseif ($world_public == 1) {
             $public_info = $this->_translator->getMessage('MATERIAL_WORLD_PUBLISH_STATUS_1');
         } elseif ($world_public == 2) {
             $public_info = $this->_translator->getMessage('MATERIAL_WORLD_PUBLISH_STATUS_2');
         }
         $temp_array[0] = $this->_translator->getMessage('MATERIAL_WORLD_PUBLISH');
         $temp_array[1] = $public_info;
         $formal_data1[] = $temp_array;
     }
     $version_mode = 'long';
     $iid = 0;
     $params = $this->_environment->getCurrentParameterArray();
     if (isset($params['iid'])) {
         $iid = $params['iid'];
     }
     $params = array();
     $params = array();
     $params = $this->_environment->getCurrentParameterArray();
     $show_versions = 'false';
     if (isset($params[$iid . 'version_mode']) and $params[$iid . 'version_mode'] == 'long') {
         $show_versions = 'true';
     }
     $params[$iid . 'version_mode'] = 'long';
     // Versions
     $versions = array();
     if (!$this->_version_list->isEmpty()) {
         $version = $this->_version_list->getFirst();
         if ($version->getVersionID() == $this->_item->getVersionID()) {
             $title = '&nbsp;&nbsp;' . $this->_translator->getMessage('MATERIAL_CURRENT_VERSION_DATE') . ' ' . getDateTimeInLang($version->getModificationDate());
         } else {
             $params = array();
             $params[$iid . 'version_mode'] = 'long';
             $params['iid'] = $version->getItemID();
             $title = '&nbsp;&nbsp;' . ahref_curl($this->_environment->getCurrentContextID(), 'material', 'detail', $params, $this->_translator->getMessage('MATERIAL_CURRENT_VERSION_DATE') . ' ' . getDateTimeInLang($version->getModificationDate()));
             unset($params);
         }
         $version = $this->_version_list->getNext();
         $current_user = $this->_environment->getCurrentUserItem();
         $is_user = $current_user->isUser();
         while ($version) {
             if (!$with_links or !$is_user and $this->_environment->inCommunityRoom() and !$version->isWorldPublic() or $item->getVersionID() == $version->getVersionID()) {
                 $versions[] = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $this->_translator->getMessage('MATERIAL_VERSION_DATE') . ' ' . getDateTimeInLang($version->getModificationDate());
             } else {
                 $params = array();
                 $params[$iid . 'version_mode'] = 'long';
                 $params['iid'] = $version->getItemID();
                 $params['version_id'] = $version->getVersionID();
                 $versions[] = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . ahref_curl($this->_environment->getCurrentContextID(), 'material', 'detail', $params, $this->_translator->getMessage('MATERIAL_VERSION_DATE') . ' ' . getDateTimeInLang($version->getModificationDate()));
                 unset($params);
             }
             $version = $this->_version_list->getNext();
         }
         $count = $this->_version_list->getCount();
         if (!empty($versions) and $count > 1) {
             $temp_array = array();
             $temp_array[] = $this->_translator->getMessage('MATERIAL_VERSION');
             $html_string = '&nbsp;<img id="toggle' . $item->getItemID() . $item->getVersionID() . '" src="images/more.gif"/>';
             $html_string .= $title;
             $html_string .= '<div id="creator_information' . $item->getItemID() . $item->getVersionID() . '">' . LF;
             $html_string .= '<div class="creator_information_panel">     ' . LF;
             $html_string .= '<div>' . LF;
             if ($show_versions == 'true') {
                 $html_script = '<script type="text/javascript">initCreatorInformations("' . $item->getItemID() . $item->getVersionID() . '",true)</script>';
             } else {
                 $html_script = '<script type="text/javascript">initCreatorInformations("' . $item->getItemID() . $item->getVersionID() . '",false)</script>';
             }
             if ($with_links) {
                 $html_string .= implode(BRLF, $versions);
             } else {
                 $version_count = count($versions);
                 $html_string .= "{$version_count}. " . $versions[0];
             }
             $html_string .= '</div>' . LF;
             $html_string .= '</div>' . LF;
             $html_string .= '</div>' . LF;
             $temp_array[] = $html_string;
             $formal_data1[] = $temp_array;
         }
     }
     if (!empty($formal_data1)) {
         $html .= $this->_getFormalDataAsHTML($formal_data1);
         if (isset($html_script) and !empty($html_script)) {
             $html .= $html_script;
         }
     }
     if ($this->_section_list->isEmpty()) {
         // Description
         $desc = $item->getDescription();
         if (!empty($desc)) {
             $temp_string = $this->_text_as_html_long($this->_compareWithSearchText($this->_cleanDataFromTextArea($desc)));
             $html .= $this->getScrollableContent($temp_string, $item, '', $with_links);
         }
     }
     $html .= '<!-- END OF material ITEM DETAIL -->' . LF . LF;
     return $html;
 }
 public function actionQuery()
 {
     $return = array("items" => array(), "total" => 0);
     // get the limesurvey export folder
     $discManager = $this->_environment->getDiscManager();
     $filePath = $discManager->getFilePath() . "limesurvey_export/";
     // scan the limesurvey_export directory in the room folder
     $surveyDirectoryArray = $this->getDirectoryArray($filePath);
     foreach ($surveyDirectoryArray as $surveyDirectory) {
         // get the survey id from the path
         $surveyDirectoryExplode = explode("/", $surveyDirectory);
         $secondLastIndex = sizeof($surveyDirectoryExplode) - 2;
         if (isset($surveyDirectoryExplode[$secondLastIndex])) {
             $surveyId = $surveyDirectoryExplode[$secondLastIndex];
             // scan the timestamp folder in the survey folder
             $timestampDirectoryArray = $this->getDirectoryArray($surveyDirectory);
             foreach ($timestampDirectoryArray as $timestampDirectory) {
                 // extract the timestamp from the path
                 $timestampDirectoryExplode = explode("/", $timestampDirectory);
                 $secondLastIndex = sizeof($timestampDirectoryExplode) - 2;
                 if (isset($timestampDirectoryExplode[$secondLastIndex])) {
                     $timestamp = $timestampDirectoryExplode[$secondLastIndex];
                     // look for exported files
                     $fileSurvey = "";
                     $fileStatistics = "";
                     $fileResponses = "";
                     if (is_file($timestampDirectory . "survey.lss")) {
                         $fileSurvey = $timestampDirectory . "survey.lss";
                     }
                     if (is_file($timestampDirectory . "statistics.pdf")) {
                         $fileStatistics = $timestampDirectory . "statistics.pdf";
                     }
                     if (is_file($timestampDirectory . "responses.csv")) {
                         $fileResponses = $timestampDirectory . "responses.csv";
                     }
                     // get the survey title by parsing the survey.lss file
                     $title = "";
                     if (!empty($fileSurvey)) {
                         $lssFileContent = file_get_contents($fileSurvey);
                         if ($lssFileContent) {
                             if (class_exists("SimpleXMLElement")) {
                                 $lssXml = new SimpleXMLElement($lssFileContent, LIBXML_NOCDATA);
                                 $result = $lssXml->xpath('/document/surveys_languagesettings/rows/row/surveyls_title');
                                 $simpleXMLElement = $result[0];
                                 if ($simpleXMLElement) {
                                     $elementArray = (array) $simpleXMLElement;
                                     if (isset($elementArray[0])) {
                                         $title = $elementArray[0];
                                     }
                                 }
                             }
                         }
                     }
                     // add item
                     $return["items"][] = array("surveyId" => $surveyId, "timestamp" => $timestamp, "title" => $title, "exportDate" => getDateTimeInLang(date("Y-m-d H:i:s", $timestamp)), "files" => array("survey" => $fileSurvey, "statistics" => $fileStatistics, "responses" => $fileResponses));
                     $return["total"]++;
                 }
             }
         }
     }
     $this->setSuccessfullDataReturn($return);
     echo $this->_return;
 }
Ejemplo n.º 5
0
 /** get the last login time of the account
  * this method returns the account last login time in the right formatted style
  *
  * @return string tast login time of the account
  */
 function _getItemLastlogin($item)
 {
     // last login
     $datetime = $item->getLastLogin();
     if (empty($datetime) or $datetime == '0000-00-00 00:00:00') {
         $datetime = $this->_translator->getMessage('USER_NEVER_LOGIN');
     } else {
         $datetime = getDateTimeInLang($datetime);
     }
     $datetime = $this->_compareWithSearchText($datetime);
     return $datetime;
 }
Ejemplo n.º 6
0
 /** get the time of the last change
  * this method returns the item last change time in the right formatted style
  *
  * @return string last change
  *
  * @author CommSy Development Group
  */
 function _getLastChanged($item)
 {
     $last_item = $item->getLastChangedItem();
     if (!empty($last_item) and is_object($last_item)) {
         $last_modificated = $last_item->getModificationDate();
     }
     $item_modificated = $item->getModificationDate();
     $time_text = '';
     if (!empty($last_modificated) and !empty($item_modificated)) {
         if ($last_modificated > $item_modificated) {
             $time = $last_modificated;
         } else {
             $time = $item_modificated;
         }
     } else {
         if (!empty($item_modificated)) {
             $time = $item_modificated;
         } else {
             if (!empty($last_modificated)) {
                 $time = $last_modificated;
             }
         }
     }
     if (!empty($time)) {
         $time_text = getDateTimeInLang($time);
         $time_text = $this->_compareWithSearchText($time_text);
         $time_text = '<span class="list_view_description">' . $this->_translator->getMessage('COMMON_LAST_CHANGE') . ': </span>' . ' ' . $time_text;
     }
     return $time_text;
 }
 private function buildTreeArray($discussionArticlesList, $root)
 {
     $disc_manager = $this->_environment->getDiscManager();
     $converter = $this->_environment->getTextConverter();
     $tree = array();
     // creator
     $creator = $root->getCreatorItem();
     $creator_fullname = '';
     $modificator_image = '';
     $image = '';
     // TODO: implement over general detail_controller.php
     if (isset($creator)) {
         $current_user_item = $this->_environment->getCurrentUserItem();
         if ($current_user_item->isGuest() && $creator->isVisibleForLoggedIn()) {
             $creator_fullname = $translator->getMessage('COMMON_USER_NOT_VISIBLE');
         } else {
             $creator_fullname = $creator->getFullName();
             $modificator_item = $root->getModificatorItem();
             $image = $modificator_item->getPicture();
             if (!empty($image)) {
                 if ($disc_manager->existsFile($image)) {
                     $modificator_image = $image;
                 }
             }
         }
     }
     // parse position string
     $position = $root->getPosition();
     $numberArray = explode(".", $position);
     $number = "";
     foreach ($numberArray as $num) {
         if (empty($number)) {
             $number = "1";
         } else {
             $len = mb_strlen($num);
             $tmpNum = mb_substr($num, 1, $len);
             $first = mb_substr($tmpNum, 0, 1);
             while ($first == "0") {
                 $tmpNum = mb_substr($tmpNum, 1, mb_strlen($tmpNum));
                 $first = mb_substr($tmpNum, 0, 1);
             }
             $number .= "." . $tmpNum;
         }
     }
     $position = $number;
     // description
     $description = $root->getDescription();
     //$converter->setFileArray($this->getItemFileList());
     //$description = $converter->showImages($description, $root, true);
     // files
     $files = $root->getFileList();
     $file_string = '';
     if (!$files->isEmpty()) {
         $file_string = '';
         $file = $files->getFirst();
         while ($file) {
             $file_string .= '<a rel="lightbox-gallery' . $root->getItemID() . '" href="' . $file->getUrl() . '" target="blank">';
             //$name = $file->getDisplayName();
             //$name = $converter->compareWithSearchText($name);
             //$name = $converter->text_as_html_short($name);
             $file_string .= $file->getFileIcon() . '</a>';
             $file = $files->getNext();
         }
     }
     $articleLevelWidth = 350 - (sizeof(explode('.', $root->getPosition())) - 1) * 20;
     $chunkt_length = 45 - (sizeof(explode('.', $root->getPosition())) - 1) * 4;
     if ($chunkt_length < 10) {
         $chunkt_length = 10;
     }
     if ($articleLevelWidth < 150) {
         $chunkt_length = 150;
     }
     $label = '';
     $label .= "<span style=\" display:inline-block; width:" . $articleLevelWidth . "px;\">" . chunkText($root->getSubject(), $chunkt_length) . ' ' . $file_string . "</span>";
     $label .= "<span style=\" display:inline-block; width:180px;\">" . chunkText($creator_fullname, 20) . "</span>";
     $label .= "<span style=\"width:" . $articleLevelWidth . "px;text-align:right;\">" . getDateTimeInLang($root->getModificationDate(), false) . "</span>";
     $tree = array('item_id' => $root->getItemID(), 'position' => $position, 'subject' => $label, 'description' => $description, 'creator' => $creator_fullname, 'modification_date' => getDateTimeInLang($root->getModificationDate(), false));
     $potentialChildList = clone $discussionArticlesList;
     $potentialChildList->removeElement($root);
     $rootPosition = $root->getPosition();
     if (empty($rootPosition)) {
         $rootPosition = "1";
     }
     $rootLevel = sizeof(explode('.', $rootPosition)) - 1;
     // iterate list - get children
     $article = $potentialChildList->getFirst();
     while ($article) {
         $articlePosition = $article->getPosition();
         $articleLevel = sizeof(explode('.', $articlePosition)) - 1;
         // skip if item is not a direct child of root
         if ($articleLevel === $rootLevel + 1 && $rootPosition === mb_substr($articlePosition, 0, sizeof($articlePosition) - 6)) {
             $tree["children"][] = $this->buildTreeArray($potentialChildList, $article);
         }
         $article = $potentialChildList->getNext();
     }
     return $tree;
 }
Ejemplo n.º 8
0
 function _getTodosListAsHTML($todo_list, $number_of_portlets)
 {
     $html = '';
     #$html .= '</div>'.LF;
     #$html .= '</div>'.LF;
     $html .= '<div class="portlet" style="width:200px;">' . LF;
     $html .= '<div id="mycalendar_todo_portlet" class="portlet-header">';
     $html .= $this->_translator->getMessage('TODO_INDEX');
     $html .= '<div style="float:right;"><a name="mycalendar_remove" style="cursor:pointer;"><img src="images/commsyicons/16x16/delete.png" /></a></div>';
     $html .= '</div>' . LF;
     $html .= '<div class="portlet-content">' . LF;
     $width = '';
     #$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:170px;';
     #} else {
     #   $width = 'width:170px;';
     #}
     #if ( isset($parameter_array['show_todo_selections'])
     #     and $parameter_array['show_todo_selections'] == 'true'
     #   ) {
     #   if ( $current_browser == 'msie' and (strstr($current_browser_version,'5.') or (strstr($current_browser_version,'6.'))) ){
     #      $width = 'width:170px;'; // TBD
     #   } else {
     #      $width = 'width:190px;';
     #   }
     #   if ($this->_presentation_mode == '2'){
     #      $html .= '<div class="" style="'.$width.' height:393px; overflow-y:auto;">'.LF;
     #   }else{
     #      $html .= '<div class="" style="'.$width.' height:273px; overflow-y:auto;">'.LF;
     #   }
     #   $html .= $this->_getAdditionalFormFieldsForPrivateRoomAsHTML(CS_TODO_TYPE);
     #   $html .= '</div>'.LF;
     #}else{
     #if ($this->_presentation_mode == '2'){
     #   $html .= '<div class="" style="'.$width.' height:398px; overflow-y:auto; padding:0px;">'.LF;
     #}else{
     #   $html .= '<div class="" style="'.$width.' height:278px; overflow-y:auto; padding:0px;">'.LF;
     #}
     $height = '300px';
     if ($number_of_portlets == 1) {
         $height = '614px';
     } elseif ($number_of_portlets == 2) {
         $height = '369px';
     } elseif ($number_of_portlets == 3) {
         $height = '200px';
     }
     $html .= '<div class="" style="height:' . $height . '; overflow-y:auto; padding:0px;">' . LF;
     // show selections
     $html .= $this->_getTodoSelectionsAsHTML();
     if (isset($todo_list) and !$todo_list->isEmpty()) {
         $todo_array_for_jQuery = array();
         $todo_tooltip_array = array();
         $todo_item = $todo_list->getFirst();
         $i = 1;
         while ($todo_item) {
             if ($i % 2 == 0) {
                 $color = '#DFDFDF';
             } else {
                 $color = '#FFFFFF';
             }
             $html .= '<div style="background-color:' . $color . '; width:100%; overflow-x:hidden; white-space:nowrap;">';
             $html .= '<div style="padding:2px 3px;" id="todo_tooltip_' . $todo_item->getItemID() . '" data-tooltip="todo_tooltip_' . $todo_item->getItemID() . '">' . LF;
             $params = array();
             $params['iid'] = $todo_item->getItemID();
             $original_date = $todo_item->getDate();
             $date = getDateInLang($original_date);
             $actual_date = date("Y-m-d H:i:s");
             if ($original_date < $actual_date) {
                 $style = 'class="required" style="font-weight:normal;"';
                 $color_link = 'red';
             } else {
                 $style = 'style="color:#05860F;"';
                 $color_link = '#05860F';
             }
             $link = ahref_curl($todo_item->getContextID(), CS_TODO_TYPE, 'detail', $params, $this->_text_as_html_short($todo_item->getTitle()), '', '', '', '', '', '', $style) . LF;
             $html .= $link;
             $html .= '</div></div>';
             // tooltip
             $todo_tooltip = array();
             $todo_tooltip['iid'] = $todo_item->getItemID();
             $todo_tooltip['title'] = $todo_item->getTitle();
             $todo_tooltip['participants'] = $todo_item->getProcessorItemList();
             $original_date = $todo_item->getDate();
             $date = getDateTimeInLang($original_date);
             if ($date != '00.00.0000, 00:00 Uhr' and $date != '00.00.9999, 00:00 Uhr') {
                 $todo_tooltip['date'] = $date;
             } else {
                 $todo_tooltip['date'] = $this->_translator->getMessage('TODO_NO_END_DATE_LONG');
             }
             $todo_tooltip['color'] = $color_link;
             $todo_context_item = $todo_item->getContextItem();
             if (isset($todo_context_item)) {
                 $room_title = $todo_context_item->getTitle();
                 if (!empty($room_title)) {
                     $todo_tooltip['context'] = encode(AS_HTML_SHORT, $room_title);
                 }
                 unset($todo_context_item);
             }
             $todo_tooltip_array[$todo_tooltip['iid']] = $todo_tooltip;
             // tooltip
             $i++;
             $todo_item = $todo_list->getNext();
         }
     }
     $html .= '</div>' . LF;
     // tooltip
     if (!empty($todo_tooltip_array)) {
         foreach ($todo_tooltip_array as $id => $tooltip) {
             $tooltip_html = '<div id="todo_tooltip_' . $tooltip['iid'] . '" class="atip" style="padding:5px; border:2px solid ' . $tooltip['color'] . '">' . LF;
             $tooltip_html .= '<table>' . LF;
             $tooltip_html .= '<tr><td colspan="2"><b>' . $tooltip['title'] . '</b></td></tr>' . LF;
             $tooltip_html .= '<tr><td style="vertical-align:top;"><b>' . $this->_translator->getMessage('TODO_DATE') . ':</b></td><td>' . $tooltip['date'] . '</td></tr>' . LF;
             $tooltip_html .= '<tr><td style="vertical-align:top;"><b>' . $this->_translator->getMessage('DATE_PARTICIPANTS') . ':</b></td><td>' . LF;
             if ($tooltip['participants']->isEmpty()) {
                 $tooltip_html .= $this->_translator->getMessage('TODO_NO_PROCESSOR');
             } else {
                 $participant = $tooltip['participants']->getFirst();
                 $count = $tooltip['participants']->getCount();
                 $counter = 1;
                 while ($participant) {
                     $tooltip_html .= $participant->getFullName();
                     if ($counter < $count) {
                         $tooltip_html .= ', ';
                     }
                     $participant = $tooltip['participants']->getNext();
                     $counter++;
                 }
             }
             $tooltip_html .= '</td></tr>' . LF;
             if (!empty($tooltip['context'])) {
                 $tooltip_html .= '<tr><td style="vertical-align:top;"><b>' . $this->_translator->getMessage('COMMON_ROOM') . ':</b></td><td>' . $tooltip['context'] . '</td></tr>' . LF;
             }
             $tooltip_html .= '</table>' . LF;
             $tooltip_html .= '</div>' . LF;
             $this->_tooltip_div_array[] = $tooltip_html;
             unset($tooltip_html);
         }
     }
     // tooltip
     #}
     $html .= '</div>' . LF;
     $html .= '</div>' . LF;
     return $html;
 }
Ejemplo n.º 9
0
 function _getSubItemAsHTML($item, $anchor_number)
 {
     $html = '';
     $formal_data = array();
     $temp_array = array();
     $temp_array[] = $this->_translator->getMessage('COMMON_ACCOUNT');
     $temp_array[] = $item->getUserID();
     $formal_data[] = $temp_array;
     unset($temp_array);
     $portal_item = $this->_environment->getCurrentPortalItem();
     if ($portal_item->getCountAuthSourceListEnabled() != 1) {
         $temp_array = array();
         $temp_array[] = $this->_translator->getMessage('USER_AUTH_SOURCE');
         $auth_source_item = $portal_item->getAuthSource($item->getAuthSource());
         $temp_array[] = $auth_source_item->getTitle();
         $formal_data[] = $temp_array;
         unset($temp_array);
     }
     if (!$this->_environment->inPrivateRoom()) {
         $temp_array = array();
         $temp_array[] = $this->_translator->getMessage('COMMON_STATUS');
         $current_context = $this->_environment->getCurrentContextItem();
         $status = $this->_getStatus($item, $current_context);
         $temp_array[] = $status;
         $formal_data[] = $temp_array;
         if ($item->isContact()) {
             $temp_array = array();
             $temp_array[] = $this->_translator->getMessage('ROOM_CONTACT_SINGULAR');
             $temp_array[] = $this->_translator->getMessage('COMMON_YES');
             $formal_data[] = $temp_array;
         } elseif ($item->isModerator()) {
             $temp_array = array();
             $temp_array[] = $this->_translator->getMessage('ROOM_CONTACT_SINGULAR');
             $temp_array[] = $this->_translator->getMessage('COMMON_NO');
             $formal_data[] = $temp_array;
         }
     }
     $current_context = $this->_environment->getCurrentContextItem();
     $language = $current_context->getLanguage();
     if (mb_strtoupper($language, 'UTF-8') == 'USER' or $this->_display_mod == 'admin' and $this->_environment->inPortal()) {
         $temp_array = array();
         $temp_array[] = $this->_translator->getMessage('USER_LANGUAGE');
         switch (cs_strtoupper($item->getLanguage())) {
             case 'BROWSER':
                 $temp_array[] = $this->_translator->getMessage('BROWSER');
                 break;
             default:
                 $temp_array[] = $this->_translator->getLanguageLabelTranslated($item->getLanguage());
                 break;
         }
         $formal_data[] = $temp_array;
     }
     if ($this->_environment->inCommunityRoom()) {
         $current_context = $this->_environment->getCurrentContextItem();
         if ($current_context->isOpenForGuests()) {
             $temp_array = array();
             $temp_array[] = $this->_translator->getMessage('ACCOUNT_VISIBLE_PROPERTY');
             if ($item->isVisibleForAll()) {
                 $temp_array[] = $this->_translator->getMessage('VISIBLE_ALWAYS');
             } else {
                 $temp_array[] = $this->_translator->getMessage('VISIBLE_ONLY_LOGGED');
             }
             $formal_data[] = $temp_array;
         }
         unset($current_context);
     }
     if ($item->isModerator() or $item->isUser()) {
         // Datenschutz expired password date
         $temp_array = array();
         $temp_array[] = $this->_translator->getMessage('USER_LOGIN_AS_ACTIV');
         if (!$item->isDeactivatedLoginAsAnotherUser()) {
             $temp_array[] = $this->_translator->getMessage('COMMON_YES');
         } else {
             if ($item->isTemporaryAllowedToLoginAs()) {
                 $temp_array[] = $item->getTimestampForLoginAs();
             } else {
                 $temp_array[] = $this->_translator->getMessage('COMMON_NO');
             }
         }
         $formal_data[] = $temp_array;
         if ($portal_item->getPasswordExpiration() != 0) {
             // Datenschutz expired password date
             $temp_array = array();
             $temp_array[] = $this->_translator->getMessage('USER_EXPIRED_PASSWORD');
             if ($item->isPasswordExpired()) {
                 $temp_array[] = $this->_translator->getMessage('COMMON_YES');
             } else {
                 $temp_array[] = $this->_translator->getMessage('COMMON_NO');
             }
             $formal_data[] = $temp_array;
         }
         $temp_array = array();
         $temp_array[] = $this->_translator->getMessage('USER_ACCEPTED_AGB');
         $agb = $item->getAGBAcceptanceDate();
         if (!empty($agb)) {
             $temp_array[] = getDateTimeInLang($item->getAGBAcceptanceDate());
         }
         $formal_data[] = $temp_array;
     }
     $temp_array = array();
     $temp_array[] = $this->_translator->getMessage('USER_EMAIL_DEFAULT');
     if (!$item->getDefaultIsMailVisible()) {
         $temp_array[] = $this->_translator->getMessage('COMMON_YES');
     } else {
         $temp_array[] = $this->_translator->getMessage('COMMON_NO');
     }
     $formal_data[] = $temp_array;
     if ($item->isModerator() and !$this->_environment->inPrivateRoom()) {
         $temp_array = array();
         $temp_array[] = $this->_translator->getMessage('ACCOUNT_EMAIL_MEMBERSHIP');
         $tempExtra = cs_strtoupper($item->getAccountWantMail());
         // text_functions, respectively cs_user_item.php
         switch ($tempExtra) {
             case 'YES':
                 $temp_array[] = $this->_translator->getMessage('COMMON_YES');
                 break;
             case 'NO':
                 $temp_array[] = $this->_translator->getMessage('COMMON_NO');
                 break;
             default:
                 $temp_array[] = $this->_translator->getMessage('COMMON_MESSAGETAG_ERROR') . " cs_user_detail_view(362) ";
                 break;
         }
         $formal_data[] = $temp_array;
         $temp_array = array();
         $temp_array[] = $this->_translator->getMessage('USER_MAIL_ROOM');
         $tempExtra = cs_strtoupper($item->getOpenRoomWantMail());
         switch ($tempExtra) {
             case 'YES':
                 $temp_array[] = $this->_translator->getMessage('COMMON_YES');
                 break;
             case 'NO':
                 $temp_array[] = $this->_translator->getMessage('COMMON_NO');
                 break;
             default:
                 $temp_array[] = $this->_translator->getMessage('COMMON_MESSAGETAG_ERROR') . " cs_user_detail_view(362) ";
                 break;
         }
         $formal_data[] = $temp_array;
         if ($this->_environment->inCommunityRoom()) {
             $current_context = $this->_environment->getCurrentContextItem();
             if ($current_context->isOpenForGuests()) {
                 $temp_array = array();
                 $temp_array[] = $this->_translator->getMessage('ACCOUNT_EMAIL_MATERIAL');
                 $tempExtra = cs_strtoupper($item->getPublishMaterialWantMail());
                 switch ($tempExtra) {
                     case 'YES':
                         $temp_array[] = $this->_translator->getMessage('COMMON_YES');
                         break;
                     case 'NO':
                         $temp_array[] = $this->_translator->getMessage('COMMON_NO');
                         break;
                     default:
                         $temp_array[] = $this->_translator->getMessage('COMMON_MESSAGETAG_ERROR') . " cs_user_detail_view(411) ";
                         break;
                 }
                 $formal_data[] = $temp_array;
             }
             unset($current_context);
         }
     }
     if ($this->_environment->inPortal()) {
         $related_user_array = array();
         $related_user_list = $item->getRelatedUserList();
         if ($related_user_list->isNotEmpty()) {
             $user_item = $related_user_list->getFirst();
             while ($user_item) {
                 $related_user_array[$user_item->getContextID()] = $user_item;
                 unset($user_item);
                 $user_item = $related_user_list->getNext();
             }
             unset($related_user_list);
         }
         // archive
         if (!$this->_environment->isArchiveMode()) {
             $this->_environment->activateArchiveMode();
             $related_user_list = $item->getRelatedUserList();
             if ($related_user_list->isNotEmpty()) {
                 $user_item = $related_user_list->getFirst();
                 while ($user_item) {
                     $related_user_array[$user_item->getContextID()] = $user_item;
                     unset($user_item);
                     $user_item = $related_user_list->getNext();
                 }
                 unset($related_user_list);
             }
             $this->_environment->deactivateArchiveMode();
         }
         // archive - end
         $temp_array = array();
         $formal_data[] = $temp_array;
         unset($temp_array);
         $temp_array = array();
         $temp_array[] = $this->_translator->getMessage('USER_ROOM_MEMBERSHIPS');
         $formal_data[] = $temp_array;
         unset($temp_array);
         $temp_array = array();
         $temp_array[] = $this->_translator->getMessage('COMMUNITYS');
         $community_list = $item->getRelatedCommunityList();
         if ($community_list->isNotEmpty()) {
             $community_item = $community_list->getFirst();
             $first = true;
             $temp_string = '';
             while ($community_item) {
                 if ($first) {
                     $first = false;
                 } else {
                     $temp_string .= BRLF;
                 }
                 $temp_string .= $community_item->getTitle();
                 // status
                 $status = $this->_getStatus($related_user_array[$community_item->getItemID()], $community_item);
                 if (!empty($status)) {
                     $temp_string .= ' (' . $status . ')';
                 }
                 unset($community_item);
                 $community_item = $community_list->getNext();
             }
             $temp_array[] = $temp_string;
             unset($temp_string);
             unset($community_list);
         } else {
             $temp_array[] = '<span class="disabled">' . $this->_translator->getMessage('COMMON_NONE') . '</span>';
         }
         $formal_data[] = $temp_array;
         unset($temp_array);
         $temp_array = array();
         $temp_array[] = $this->_translator->getMessage('PROJECTS');
         $room_list = $item->getRelatedProjectList();
         if ($room_list->isNotEmpty()) {
             $room_item = $room_list->getFirst();
             $first = true;
             $temp_string = '';
             while ($room_item) {
                 if ($first) {
                     $first = false;
                 } else {
                     $temp_string .= BRLF;
                 }
                 $temp_string .= $room_item->getTitle();
                 // room status
                 if ($room_item->isLocked()) {
                     $temp_string .= ' [' . $this->_translator->getMessage('PROJECTROOM_LOCKED') . ']' . LF;
                 } elseif ($room_item->isClosed()) {
                     $temp_string .= ' [' . $this->_translator->getMessage('PROJECTROOM_CLOSED') . ']' . LF;
                 }
                 // status
                 $status = $this->_getStatus($related_user_array[$room_item->getItemID()], $room_item);
                 if (!empty($status)) {
                     $temp_string .= ' (' . $status . ')';
                 }
                 unset($room_item);
                 $room_item = $room_list->getNext();
             }
             $temp_array[] = $temp_string;
             unset($temp_string);
             unset($room_list);
         } else {
             $temp_array[] = '<span class="disabled">' . $this->_translator->getMessage('COMMON_NONE') . '</span>';
         }
         $formal_data[] = $temp_array;
         unset($temp_array);
         // archive
         if (!$this->_environment->isArchiveMode()) {
             $temp_array = array();
             $formal_data[] = $temp_array;
             unset($temp_array);
             $temp_array = array();
             $temp_array[] = $this->_translator->getMessage('PORTAL_ARCHIVED_ROOMS');
             $zzz_project_manager = $this->_environment->getZzzProjectManager();
             $zzz_project_manager->setUserIDLimit($item->getUserID());
             $zzz_project_manager->setStatusLimit(2);
             $zzz_project_manager->select();
             $archived_room_list = $zzz_project_manager->get();
             if ($archived_room_list->isNotEmpty()) {
                 $room_item = $archived_room_list->getFirst();
                 $first = true;
                 $temp_string = '';
                 while ($room_item) {
                     if ($first) {
                         $first = false;
                     } else {
                         $temp_string .= BRLF;
                     }
                     $temp_string .= $room_item->getTitle();
                     // room status
                     if ($room_item->isLocked()) {
                         $temp_string .= ' [' . $this->_translator->getMessage('PROJECTROOM_LOCKED') . ']' . LF;
                     } elseif ($room_item->isClosed()) {
                         $temp_string .= ' [' . $this->_translator->getMessage('PROJECTROOM_CLOSED') . ']' . LF;
                     }
                     // status
                     $status = $this->_getStatus($related_user_array[$room_item->getItemID()], $room_item);
                     if (!empty($status)) {
                         $temp_string .= ' (' . $status . ')';
                     }
                     unset($room_item);
                     $room_item = $archived_room_list->getNext();
                 }
                 $temp_array[] = $temp_string;
                 unset($temp_string);
                 unset($room_list);
             } else {
                 $temp_array[] = '<span class="disabled">' . $this->_translator->getMessage('COMMON_NONE') . '</span>';
             }
             $formal_data[] = $temp_array;
             unset($temp_array);
             $this->_environment->activateArchiveMode();
             $temp_array = array();
             $temp_array[] = $this->_translator->getMessage('COMMUNITYS');
             $community_list = $item->getRelatedCommunityList();
             if ($community_list->isNotEmpty()) {
                 $community_item = $community_list->getFirst();
                 $first = true;
                 $temp_string = '';
                 while ($community_item) {
                     if ($first) {
                         $first = false;
                     } else {
                         $temp_string .= BRLF;
                     }
                     $temp_string .= $community_item->getTitle();
                     // status
                     $status = $this->_getStatus($related_user_array[$community_item->getItemID()], $community_item);
                     if (!empty($status)) {
                         $temp_string .= ' (' . $status . ')';
                     }
                     unset($community_item);
                     $community_item = $community_list->getNext();
                 }
                 $temp_array[] = $temp_string;
                 unset($temp_string);
                 unset($community_list);
             } else {
                 $temp_array[] = '<span class="disabled">' . $this->_translator->getMessage('COMMON_NONE') . '</span>';
             }
             $formal_data[] = $temp_array;
             unset($temp_array);
             $temp_array = array();
             $temp_array[] = $this->_translator->getMessage('PROJECTS');
             $room_list = $item->getRelatedProjectList();
             if ($room_list->isNotEmpty()) {
                 $room_item = $room_list->getFirst();
                 $first = true;
                 $temp_string = '';
                 while ($room_item) {
                     if ($first) {
                         $first = false;
                     } else {
                         $temp_string .= BRLF;
                     }
                     $temp_string .= $room_item->getTitle();
                     // status
                     $status = $this->_getStatus($related_user_array[$room_item->getItemID()], $room_item);
                     if (!empty($status)) {
                         $temp_string .= ' (' . $status . ')';
                     }
                     unset($room_item);
                     $room_item = $room_list->getNext();
                 }
                 $temp_array[] = $temp_string;
                 unset($temp_string);
                 unset($room_list);
             } else {
                 $temp_array[] = '<span class="disabled">' . $this->_translator->getMessage('COMMON_NONE') . '</span>';
             }
             $formal_data[] = $temp_array;
             unset($temp_array);
             $this->_environment->deactivateArchiveMode();
         }
         // arcive - end
         unset($related_user_list);
     }
     if ($this->_environment->inPrivateRoom()) {
         $temp_array = array();
         $temp_array[] = $this->_translator->getMessage('CONFIGURATION_AUTOSAVE_STATUS');
         if ($item->isAutoSaveOn()) {
             $temp_array[] = $this->_translator->getMessage('COMMON_YES');
         } else {
             $temp_array[] = $this->_translator->getMessage('COMMON_NO');
         }
         $formal_data[] = $temp_array;
     }
     if (count($formal_data) > 0) {
         $html .= $this->_getFormalDataAsHTML($formal_data) . LF;
     } else {
         $html .= '<span class="disabled">' . $this->_translator->getMessage('USER_PREFERENCES_NO_ENTRIES') . '</span>' . LF;
     }
     unset($formal_data);
     return $html;
 }
Ejemplo n.º 10
0
 function _getItemAsHTMLLinear($item)
 {
     $subitems = $this->_subitems;
     $article = $subitems->getFirst();
     $pos_number = 1;
     $html = '';
     while ($article) {
         $html .= '<tr style="padding:0px; margin:0px;">' . LF;
         // files
         $fileicons = $this->_getItemFiles($article, true);
         if (empty($fileicons)) {
             $fileicons = '&nbsp;';
         } else {
             $fileicons = '&nbsp;' . $fileicons . '&nbsp;';
         }
         // creator
         $creator = $article->getCreatorItem();
         if (isset($creator)) {
             $current_user_item = $this->_environment->getCurrentUserItem();
             if ($current_user_item->isGuest() && $creator->isVisibleForLoggedIn()) {
                 $creator_fullname = $this->_translator->getMessage('COMMON_USER_NOT_VISIBLE');
             } else {
                 $creator_fullname = $creator->getFullName();
             }
             unset($current_user_item);
         } else {
             $creator_fullname = '';
         }
         $display_subject = $article->getSubject();
         $length = mb_strlen($display_subject);
         $max = 28;
         if ($length > $max) {
             $display_subject = mb_substr($display_subject, 0, $max) . '...';
         }
         $hover = str_replace('"', '\'', $this->_text_as_html_short($article->getSubject()));
         $html .= '   <td style="width: 2%; vertical-align:bottom">' . $pos_number . '. ' . '</td>' . LF;
         $html .= '   <td style="width: 46%;">';
         $params = array();
         $params['iid'] = $item->getItemID();
         $param_zip = $this->_environment->getValueOfParameter('download');
         if (empty($param_zip) || $param_zip != 'zip') {
             $html .= ahref_curl($this->_environment->getCurrentContextID(), CS_DISCUSSION_TYPE, 'detail', $params, $this->_text_as_html_short($this->_compareWithSearchText($display_subject)), $hover, '', 'anchor' . $article->getItemID());
         } else {
             $html .= $this->_text_as_html_short($this->_compareWithSearchText($display_subject));
         }
         $html .= $this->_getItemChangeStatus($article) . ' ';
         $html .= $fileicons . '</td>' . LF;
         $html .= '   <td style="vertical-align:bottom; white-space:nowrap; width: 30%;">' . $this->_text_as_html_short($this->_compareWithSearchText($creator_fullname)) . '&nbsp; </td>' . LF;
         $html .= '   <td style="vertical-align:bottom; white-space:nowrap; width: 22%;">' . $this->_text_as_html_short($this->_compareWithSearchText(getDateTimeInLang($article->getModificationDate(), false))) . '</td>' . LF;
         $html .= '</tr>' . LF;
         $article = $subitems->getNext();
         $pos_number++;
     }
     return $html;
 }
Ejemplo n.º 11
0
 protected function getDetailContent()
 {
     $translator = $this->_environment->getTranslationObject();
     $converter = $this->_environment->getTextConverter();
     $context_item = $this->_environment->getCurrentContextItem();
     $current_user = $this->_environment->getCurrentUserItem();
     $desc = $this->_item->getDescription();
     $item = $this->_item;
     $room_user_status = 'closed';
     $user_manager = $this->_environment->getUserManager();
     $user_manager->setUserIDLimit($current_user->getUserID());
     $user_manager->setAuthSourceLimit($current_user->getAuthSource());
     $user_manager->setContextLimit($item->getItemID());
     $user_manager->select();
     $user_list = $user_manager->get();
     if (!empty($user_list)) {
         $room_user = $user_list->getFirst();
     } else {
         $room_user = '';
     }
     if ($current_user->isRoot()) {
         $may_enter = true;
     } elseif (!empty($room_user)) {
         $may_enter = $item->mayEnter($room_user);
     } else {
         $may_enter = false;
     }
     // Eintritt erlaubt
     if ($may_enter) {
         $room_user_status = 'open';
         $room_user_status_text = '';
     } elseif ($item->isLocked()) {
         $room_user_status = 'closed';
         $room_user_status_text = $translator->getMessage('CONTEXT_JOIN');
     } elseif (!empty($room_user) and $room_user->isRequested()) {
         $room_user_status = 'requested';
         $room_user_status_text = $translator->getMessage('ACCOUNT_NOT_ACCEPTED_YET');
         //Erlaubnis verweigert
     } elseif (!empty($room_user) and $room_user->isRejected()) {
         $room_user_status = 'rejected';
         $room_user_status_text = $translator->getMessage('ACCOUNT_NOT_ACCEPTED');
         // noch nicht angemeldet als Mitglied im Raum
     } else {
         if ($item->isOpen() and !$current_user->isOnlyReadUser()) {
         } else {
             $room_user_status = 'guest';
             $room_user_status_text = $translator->getMessage('ACCOUNT_NOT_ACCEPTED_AS_GUEST');
         }
     }
     $moda = array();
     $moda_list = $this->_item->getContactModeratorList();
     $moda_item = $moda_list->getFirst();
     while ($moda_item) {
         $moda_item_here = $moda_item->getRelatedUserItemInContext($this->_environment->getCurrentContextID());
         $current_user_item = $this->_environment->getCurrentUserItem();
         $tmp_array = array();
         if ($current_user_item->isGuest() and isset($moda_item_here) and $moda_item_here->isVisibleForLoggedIn()) {
             $tmp_array['name'] = $translator->getMessage('COMMON_USER_NOT_VISIBLE');
             $tmp_array['iid'] = 'none';
         } else {
             $tmp_array['name'] = $moda_item->getFullName();
             $tmp_array['iid'] = $moda_item->getItemID();
         }
         $moda[] = $tmp_array;
         unset($current_user_item);
         $moda_item = $moda_list->getNext();
     }
     $fullname = '';
     $creator = $this->_item->getCreatorItem();
     if (isset($creator)) {
         $fullname = $creator->getFullName();
     }
     return array('item_id' => $this->_item->getItemID(), 'formal' => $this->getFormalData(), 'title' => $this->_item->getTitle(), 'creator' => $fullname, 'creation_date' => getDateTimeInLang($this->_item->getCreationDate()), 'description' => $desc, 'room_user_status' => $room_user_status, 'room_user_status_text' => $room_user_status_text, 'moderator_array' => $moda, 'moredetails' => $this->getCreatorInformationAsArray($this->_item));
 }
Ejemplo n.º 12
0
 protected function getDetailContent()
 {
     $converter = $this->_environment->getTextConverter();
     $translator = $this->_environment->getTranslationObject();
     $portal_item = $this->_environment->getCurrentPortalItem();
     $return = array();
     ################
     ## FIRST BLOCK
     #
     // title
     $title = $this->_item->getTitle();
     if (!empty($title)) {
         $title .= ' ';
         //$temp_array = array();
         //$temp_array[] = $translator->getMessage('USER_TITLE');
         // TODO:
         // $title = compareWithSearchText($title);
         //$temp_array[] = $converter->text_as_html_short($title);
         //$formal_data[] = $temp_array;
     }
     $return['first_block']['title'] = $title;
     $title .= $this->_item->getFullname();
     $return['first_block']['fullname'] = $converter->text_as_html_short($title);
     // birthday
     $birthday = $this->_item->getBirthday();
     if (!empty($birthday)) {
         //$temp_array = array();
         //$temp_array[] = $translator->getMessage('USER_BIRTHDAY');
         // TODO:
         //$birthday = $converter->compareWithSearchText($birthday);
         //$temp_array[] = $converter->text_as_html_short($birthday);
         //$formal_data[] = $temp_array;
         $return['first_block']['birthday'] = $converter->text_as_html_short($birthday);
     }
     #
     ##
     ################
     ################
     ## SECOND BLOCK
     #
     // email
     $email = $this->_item->getEmail();
     // TODO:
     //$email = $converter->compareWithSearchText...
     $email = $converter->text_as_html_short($email);
     $return['hidden']['email'] = false;
     if (!empty($email) && ($this->_item->isEmailVisible() || $this->_display_mod === 'admin' || $this->_environment->getCurrentUser()->isModerator())) {
         $return['second_block']['email'] = $email;
     } elseif (!$this->_item->isEmailVisible()) {
         $return['hidden']['email'] = true;
     }
     // telephone
     $telephone = $this->_item->getTelephone();
     if (!empty($telephone)) {
         //$temp_array[] = $this->_translator->getMessage('USER_TELEPHONE');
         // TODO:
         //$telephone = $converter->compareWithSearchText($telephone);
         $telephone = $converter->text_as_html_short($telephone);
         $return['second_block']['telephone'] = $telephone;
     }
     $cellularphone = $this->_item->getCellularphone();
     if (!empty($cellularphone)) {
         //$temp_array[] = $this->_translator->getMessage('USER_CELLULARPHONE');
         // TODO:
         // $cellularphone = $converter->compareWithSearchText($cellularphone);
         $cellularphone = $converter->text_as_html_short($cellularphone);
         $return['second_block']['cellularphone'] = $cellularphone;
     }
     #
     ##
     ################
     ################
     ## THIRD BLOCK
     #
     // street
     $street = $this->_item->getStreet();
     if (!empty($street)) {
         // TODO:
         // $street = $converter->compareWithSearchText($street);
         $street = $converter->text_as_html_short($street);
         $return['third_block']['street'] = $street;
     }
     // city
     $city = $this->_item->getCity();
     if (!empty($city)) {
         $zipcode = $this->_item->getZipCode();
         //TODO:
         //$city = $converter->compareWithSearchText($zipcode) . ' ' . $converter->compareWithSearchText($city);
         $city = $zipcode . ' ' . $city;
         $city = $converter->text_as_html_short(trim($city));
         $return['third_block']['city'] = $city;
     }
     // room
     $room = $this->_item->getRoom();
     if (!empty($room)) {
         //TODO:
         //$room = $converter->compareWithSearchText($room);
         $room = $converter->text_as_html_short($room);
         $return['third_block']['room'] = $room;
     }
     #
     ##
     ################
     ################
     ## FOURTH BLOCK
     #
     // organisation
     $organisation = $this->_item->getOrganisation();
     if (!empty($organisation)) {
         //TODO:
         //$organisation = $converter->compareWithSearchText($organisation);
         $organisation = $converter->text_as_html_short($organisation);
         $return['fourth_block']['organisation'] = $organisation;
     }
     // position
     $position = $this->_item->getPosition();
     if (!empty($position)) {
         //TODO:
         //$position = $converter->compareWithSearchText($position);
         $position = $converter->text_as_html_short($position);
         $return['fourth_block']['position'] = $position;
     }
     #
     ##
     ################
     // picture
     $picture = $this->_item->getPicture();
     if (!empty($picture)) {
         $disc_manager = $this->_environment->getDiscManager();
         $width = 150;
         if ($disc_manager->existsFile($picture)) {
             $image_array = getimagesize($disc_manager->getFilePath() . $picture);
             $pict_width = $image_array[0];
             if ($pict_width < 150) {
                 $width = $pict_width;
             }
         }
         $return['picture']['src'] = $picture;
     }
     ################
     ## messenger block
     #
     $icq = $this->_item->getICQ();
     $jabber = $this->_item->getJabber();
     $msn = $this->_item->getMSN();
     $skype = $this->_item->getSkype();
     $yahoo = $this->_item->getYahoo();
     if (!empty($icq) || !empty($jabber) || !empty($msn) || !empty($skype) || !empty($yahoo)) {
         global $c_commsy_domain;
         $host = $c_commsy_domain;
         if (strstr($c_commsy_domain, 'http')) {
             $host = mb_substr($c_commsy_domain, mb_strrpos($c_commsy_domain, '/') + 1);
         }
         global $c_commsy_url_path;
         $url_to_img = $host . $c_commsy_url_path . '/img/messenger';
         $url_to_service = 'http://osi.danvic.co.uk';
         //$temp_array[] = $this->_translator->getMessage('USER_MESSENGER_NUMBERS');
         // icq
         if (!empty($icq)) {
             //TODO:
             //$icq = $converter->compareWithSearchText($icq);
             $icq = $converter->text_as_html_short($icq);
             $return['messenger_block']['icq'] = $icq;
             $return['indicators']['icq'] = 'http://status.icq.com/online.gif?icq=' . rawurlencode($icq) . '&img=2';
         }
         // jabber
         if (!empty($jabber)) {
             //TODO:
             //$jabber = $converter->compareWithSearchText($jabber);
             $jabber = $converter->text_as_html_short($jabber);
             $return['messenger_block']['jabber'] = $jabber;
             //$return['indicators']['jabber'] = '';
         }
         // msn
         if (!empty($msn)) {
             //TODO:
             //$msn = $converter->compareWithSearchText($msn);
             $msn = $converter->text_as_html_short($msn);
             $return['messenger_block']['msn'] = $msn;
             $return['indicators']['msn'] = 'http://www.IMStatusCheck.com/status/msn/' . rawurlencode($msn) . '?icons';
         }
         // skype
         if (!empty($skype)) {
             //TODO:
             //$html_text .= '<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>'.LF;
             //$html_text .= '<a href="skype:'.rawurlencode($skype_number).'?chat">'.LF;
             //$html_text .= '   <img style="vertical-align:middle; margin-bottom:5px;" src="http://mystatus.skype.com/smallclassic/'.rawurlencode($skype_number).'" alt="Skype Online Status Indicator" />'.LF;
             //$html_text .= '</a>'.LF;
             //$skype = $comverter->compareWithSearchText($skype);
             $skype = $converter->text_as_html_short($skype);
             $return['messenger_block']['skype'] = $skype;
         }
         // yahoo
         if (!empty($yahoo)) {
             //TODO:
             //$html_text .= '<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>'.LF;
             //$html_text .= '<a href="http://messenger.yahoo.com/edit/send/?.target='.rawurlencode($yahoo_number).'">'.LF;
             //$html_text .= '   <img style="vertical-align:middle;" src="http://opi.yahoo.com/yahooonline/u='.rawurlencode($yahoo_number).'/m=g/t=1/l='.$this->_environment->getSelectedLanguage().'/opi.jpg" alt="Yahoo Online Status Indicator" />'.LF;
             //$html_text .= '</a>'.LF;
             //$yahoo = $converter->compareWithSearchText($converter);
             $yahoo = $converter->text_as_html_short($yahoo);
             $return['messenger_block']['yahoo'] = $yahoo;
         }
     }
     #
     ##
     ################
     $homepage = $this->_item->getHomepage();
     $homepage = $converter->text_as_html_short($homepage);
     if (!empty($homepage)) {
         if (strstr($homepage, '?')) {
             list($first_part, $second_part) = explode('?', $homepage);
             $homepage = $first_part . '?';
             if (strstr($second_part, '&')) {
                 $param_array = explode('&', $second_part);
                 foreach ($param_array as $key => $value) {
                     $value = str_replace('=', 'EQUAL', $value);
                     $value = rawurlencode($value);
                     $value = str_replace('EQUAL', '=', $value);
                     $param_array[$key] = $value;
                 }
                 $homepage .= implode('&', $param_array);
             }
             //$homepage = '<a href="'.$homepage.'" title="'.str_replace('"','&quot;',$homepage_text).'" target="_blank">'.$this->_text_as_html_short($this->_compareWithSearchText($homepage_short)).'</a>';
         }
         // TODO:
         // $homepage = $converter->compareWithSearchText($homepage);
         $homepage = $converter->text_as_html_short($homepage);
         $return['homepage'] = $homepage;
     }
     // description of the user
     $desc = $this->_item->getDescription();
     if (!empty($desc)) {
         $desc = $converter->textFullHTMLFormatting($desc);
         //$desc = $converter->cleanDataFromTextArea($desc);
         //TODO:
         //$desc = $converter->compareWithSearchText($desc);
         $converter->setFileArray($this->getItemFileList());
         if ($this->_with_old_text_formating) {
             //$desc = $converter->text_as_html_long($desc);
             $desc = $converter->textFullHTMLFormatting($desc);
         } else {
             //$desc = $converter->_activate_urls($desc);
             $desc = $converter->textFullHTMLFormatting($desc);
         }
         $return['description'] = $desc;
     }
     ##################################################
     //if($this->_item->isModerator() or )
     $temp_array = array();
     if ($portal_item->getPasswordExpiration() != 0) {
         // Datenschutz expired password date
         #$temp_array = array();
         #$temp_array[] = $translator->getMessage('USER_EXPIRED_PASSWORD');
         $portal_user_item = $this->_item->getRelatedPortalUserItem();
         if ($portal_user_item->isPasswordExpired()) {
             $temp = $translator->getMessage('COMMON_YES');
         } else {
             $temp = $translator->getMessage('COMMON_NO');
         }
         $return['expired_password'] = $temp;
     }
     $temp = '';
     #$temp_array = array();
     #$temp_array[] = $translator->getMessage('USER_ACCEPTED_AGB');
     $agb = $this->_item->getAGBAcceptanceDate();
     if (!empty($agb)) {
         $temp = getDateTimeInLang($this->_item->getAGBAcceptanceDate());
     }
     $return['agb_acceptance'] = $temp;
     ##############################################
     $return['moredetails'] = $this->getCreatorInformationAsArray($this->_item);
     return $return;
 }
Ejemplo n.º 13
0
 /** create the form, INTERNAL
  * this methods creates the form with the form definitions
  *
  * @author CommSy Development Topic
  */
 function _createForm()
 {
     // rubrics
     $iid = $_GET['iid'];
     $manager = $this->_environment->getItemManager();
     $item = $manager->getItem($iid);
     $module = $item->getItemType();
     $link_module = $module;
     if ($module == 'label' or $module == 'labels') {
         $label_manager = $this->_environment->getLabelManager();
         $label = $label_manager->getItem($iid);
         $link_module = $label->getLabelType();
     }
     $item_manager = $this->_environment->getManager($module);
     $item = $item_manager->getItem($iid);
     $item_name = $item->getTitle();
     $context_name = $this->_context_name;
     $article = '';
     // Wenn man mit HTTPS auf Commsy surft und eine Email generiert
     // sollte diese Mail auch https links erstellen.
     if (!empty($_SERVER["HTTPS"]) and $_SERVER["HTTPS"]) {
         $url = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?cid=' . $this->_environment->getCurrentContextID() . '&mod=' . $link_module . '&fct=detail' . '&iid=' . $item->getItemID();
     } else {
         $url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?cid=' . $this->_environment->getCurrentContextID() . '&mod=' . $link_module . '&fct=detail' . '&iid=' . $item->getItemID();
     }
     $link = $url;
     $rubric_type_pretty = '';
     $content = '';
     //generate module name for the interface- a pretty version of module...
     if ($module == 'new' or $module == 'news') {
         $news_content = $this->_translator->getMessage('COMMON_NEWS') . ': ' . $item->getTitle() . LF;
         $content = $news_content;
     } elseif ($module == CS_DATE_TYPE) {
         $rubric_type_pretty = $this->_translator->getMessage('COMMON_DATES');
         // set up style of days and times
         $parse_time_start = convertTimeFromInput($item->getStartingTime());
         $conforms = $parse_time_start['conforms'];
         if ($conforms == TRUE) {
             $start_time_print = getTimeLanguage($parse_time_start['datetime']);
         } else {
             $start_time_print = $item->getStartingTime();
         }
         $parse_time_end = convertTimeFromInput($item->getEndingTime());
         $conforms = $parse_time_end['conforms'];
         if ($conforms == TRUE) {
             $end_time_print = getTimeLanguage($parse_time_end['datetime']);
         } else {
             $end_time_print = $item->getEndingTime();
         }
         $parse_day_start = convertDateFromInput($item->getStartingDay(), $this->_environment->getSelectedLanguage());
         $conforms = $parse_day_start['conforms'];
         if ($conforms == TRUE) {
             $start_day_print = getDateInLang($parse_day_start['datetime']);
         } else {
             $start_day_print = $item->getStartingDay();
         }
         $parse_day_end = convertDateFromInput($item->getEndingDay(), $this->_environment->getSelectedLanguage());
         $conforms = $parse_day_end['conforms'];
         if ($conforms == TRUE) {
             $end_day_print = getDateLanguage($parse_day_end['datetime']);
         } else {
             $end_day_print = $item->getEndingDay();
         }
         //formating dates and times for displaying
         $date_print = "";
         $time_print = "";
         if ($end_day_print != "") {
             //with ending day
             $date_print = $this->_translator->getMessage('DATES_AS_OF') . ' ' . $start_day_print . ' ' . $this->_translator->getMessage('DATES_TILL') . ' ' . $end_day_print;
             if ($parse_day_start['conforms'] and $parse_day_end['conforms']) {
                 //start and end are dates, not strings
                 $date_print .= ' (' . getDifference($parse_day_start['timestamp'], $parse_day_end['timestamp']) . ' ' . $this->_translator->getMessage('DATES_DAYS') . ')';
             }
             if ($start_time_print != "" and $end_time_print == "") {
                 //starting time given
                 $time_print = $this->_translator->getMessage('DATES_AS_OF_LOWER') . ' ' . $start_time_print;
                 if ($parse_time_start['conforms'] == true) {
                     $time_print .= ' ' . $this->_translator->getMessage('DATES_OCLOCK');
                 }
             } elseif ($start_time_print == "" and $end_time_print != "") {
                 //endtime given
                 $time_print = $this->_translator->getMessage('DATES_TILL') . ' ' . $end_time_print;
                 if ($parse_time_end['conforms'] == true) {
                     $time_print .= ' ' . $this->_translator->getMessage('DATES_OCLOCK');
                 }
             } elseif ($start_time_print != "" and $end_time_print != "") {
                 //all times given
                 if ($parse_time_end['conforms'] == true) {
                     $end_time_print .= ' ' . $this->_translator->getMessage('DATES_OCLOCK');
                 }
                 if ($parse_time_start['conforms'] == true) {
                     $start_time_print .= ' ' . $this->_translator->getMessage('DATES_OCLOCK');
                 }
                 $date_print = $this->_translator->getMessage('DATES_AS_OF') . ' ' . $start_day_print . ', ' . $start_time_print . '<br />' . $this->_translator->getMessage('DATES_TILL') . ' ' . $end_day_print . ', ' . $end_time_print;
                 if ($parse_day_start['conforms'] and $parse_day_end['conforms']) {
                     $date_print .= ' (' . getDifference($parse_day_start['timestamp'], $parse_day_end['timestamp']) . ' ' . $this->_translator->getMessage('DATES_DAYS') . ')';
                 }
             }
         } else {
             //without ending day
             $date_print = $start_day_print;
             if ($start_time_print != "" and $end_time_print == "") {
                 //starting time given
                 $time_print = $this->_translator->getMessage('DATES_AS_OF_LOWER') . ' ' . $start_time_print;
                 if ($parse_time_start['conforms'] == true) {
                     $time_print .= ' ' . $this->_translator->getMessage('DATES_OCLOCK');
                 }
             } elseif ($start_time_print == "" and $end_time_print != "") {
                 //endtime given
                 $time_print = $this->_translator->getMessage('DATES_TILL') . ' ' . $end_time_print;
                 if ($parse_time_end['conforms'] == true) {
                     $time_print .= ' ' . $this->_translator->getMessage('DATES_OCLOCK');
                 }
             } elseif ($start_time_print != "" and $end_time_print != "") {
                 //all times given
                 if ($parse_time_end['conforms'] == true) {
                     $end_time_print .= ' ' . $this->_translator->getMessage('DATES_OCLOCK');
                 }
                 if ($parse_time_start['conforms'] == true) {
                     $start_time_print .= ' ' . $this->_translator->getMessage('DATES_OCLOCK');
                 }
                 $time_print = $this->_translator->getMessage('DATES_FROM_TIME_LOWER') . ' ' . $start_time_print . ' ' . $this->_translator->getMessage('DATES_TILL') . ' ' . $end_time_print;
             }
         }
         if ($parse_day_start['timestamp'] == $parse_day_end['timestamp'] and $parse_day_start['conforms'] and $parse_day_end['conforms']) {
             $date_print = $this->_translator->getMessage('DATES_ON_DAY') . ' ' . $start_day_print;
             if ($start_time_print != "" and $end_time_print == "") {
                 //starting time given
                 $time_print = $this->_translator->getMessage('DATES_AS_OF_LOWER') . ' ' . $start_time_print;
             } elseif ($start_time_print == "" and $end_time_print != "") {
                 //endtime given
                 $time_print = $this->_translator->getMessage('DATES_TILL') . ' ' . $end_time_print;
             } elseif ($start_time_print != "" and $end_time_print != "") {
                 //all times given
                 $time_print = $this->_translator->getMessage('DATES_FROM_TIME_LOWER') . ' ' . $start_time_print . ' ' . $this->_translator->getMessage('DATES_TILL') . ' ' . $end_time_print;
             }
         }
         // Date and time
         $dates_content = '';
         $dates_content = $this->_translator->getMessage('DATES_DATETIME') . ': ' . $item_name . LF;
         if ($time_print != '') {
             $dates_content .= $this->_translator->getMessage('COMMON_TIME') . ': ' . $date_print . ',' . $time_print . LF;
         } else {
             $dates_content .= $this->_translator->getMessage('COMMON_TIME') . ': ' . $date_print . LF;
         }
         // Place
         $place = $item->getPlace();
         if (!empty($place)) {
             $dates_content .= $this->_translator->getMessage('DATES_PLACE') . ': ';
             $dates_content .= $place . LF;
         }
         $content = $dates_content;
     } elseif ($module == 'discussion' or $module == 'discussions') {
         $discussion_content = $this->_translator->getMessage('COMMON_DISCUSSION') . ': ' . $item->getTitle() . LF;
         $article_count = $item->getAllArticlesCount();
         $discussion_content .= $this->_translator->getMessage('DISCUSSION_DISCARTICLE_COUNT') . ': ' . $article_count . LF;
         $time = $item->getLatestArticleModificationDate();
         $discussion_content .= $this->_translator->getMessage('DISCUSSION_LAST_ENTRY') . ': ' . getDateTimeInLang($time) . LF;
         $content = $discussion_content;
     } elseif ($module == 'material' or $module == 'materials') {
         $material_content = $this->_translator->getMessage('COMMON_MATERIAL') . ': ' . $item->getTitle() . LF;
         $content = $material_content;
     } elseif ($module == 'announcement' or $module == CS_ANNOUNCEMENT_TYPE) {
         $announcement_content = $this->_translator->getMessage('COMMON_ANNOUNCEMENT') . ': ' . $item->getTitle() . LF;
         $content = $announcement_content;
     } elseif ($module == 'label' or $module == 'labels') {
         $label_manager = $this->_environment->getLabelManager();
         $label = $label_manager->getItem($iid);
         $module = $label->getLabelType();
         if ($module == 'group' or $module == 'groups') {
             $group_content = $this->_translator->getMessage('COMMON_GROUP') . ': ' . $item->getTitle() . LF;
             $content = $group_content;
         } elseif ($module == 'institution' or $module == 'institutions') {
             $institution_content = $this->_translator->getMessage('INSTITUTION') . ': ' . $item->getTitle() . LF;
             $content = $institution_content;
         }
     }
     if ($this->_environment->inProjectRoom()) {
         $emailtext = $this->_translator->getMessage('RUBRIC_EMAIL_DEFAULT_PROJECT', $context_name) . LF;
     } elseif ($this->_environment->inGroupRoom()) {
         $emailtext = $this->_translator->getMessage('RUBRIC_EMAIL_DEFAULT_GROUPROOM', $context_name) . LF;
     } else {
         $emailtext = $this->_translator->getMessage('RUBRIC_EMAIL_DEFAULT_COMMUNITY', $context_name) . LF;
     }
     if (empty($content)) {
         $emailtext .= LF . LF;
     } else {
         $emailtext .= $content;
     }
     $emailtext .= $this->_translator->getMessage('RUBRIC_EMAIL_DEFAULT_PROJECT_END', $link);
     $this->_form->addTextField('subject', '', $this->_translator->getMessage('COMMON_MAIL_SUBJECT'), '', '', '57', true);
     $this->_form->addTextArea('mailcontent', $emailtext, $this->_translator->getMessage('COMMON_MAIL_CONTENT'), $this->_translator->getMessage('COMMON_MAIL_CONTENT_DESC'), '60', '15', '', true, false, false);
     if ($module == 'date') {
         $this->_form->addCheckBox('attendees', '2', false, $this->_translator->getMessage('COMMON_MAIL_SEND_TO_ASIGNED_PEOPLE'), $this->_translator->getMessage('COMMON_MAIL_SEND_TO_ATTENDEES'));
     } elseif ($module == 'todo') {
         $this->_form->addCheckBox('processors', '2', false, $this->_translator->getMessage('COMMON_MAIL_SEND_TO_ASIGNED_PEOPLE'), $this->_translator->getMessage('COMMON_MAIL_SEND_TO_PROCESSORS'));
     }
     if ($this->_environment->inProjectRoom() and !empty($this->_group_array)) {
         $context_item = $this->_environment->getCurrentContextItem();
         if ($context_item->withRubric(CS_GROUP_TYPE)) {
             $this->_initCheckBoxGroup();
         }
     } else {
         $context_item = $this->_environment->getCurrentContextItem();
         if ($context_item->withRubric(CS_INSTITUTION_TYPE) and !empty($this->_institution_array)) {
             $this->_initCheckBoxInstitution();
         }
     }
     $projekt_room_show_mail_to_all = false;
     //Projectroom and no groups enabled -> send mails to group all
     if ($context_item->isProjectRoom() and !$context_item->withRubric(CS_GROUP_TYPE)) {
         $cid = $this->_environment->getCurrentContextId();
         $user_manager = $this->_environment->getUserManager();
         $user_manager->setUserLimit();
         $user_manager->setContextLimit($cid);
         $count = $user_manager->getCountAll();
         $all_iid = $this->_group_array[0]['value'];
         if ($item->getItemType() != CS_DATE_TYPE and $item->getItemType() != CS_TODO_TYPE) {
             $this->_form->addText('receiver_text', $this->_translator->getMessage('COMMON_MAIL_RECEIVER'), $this->_translator->getMessage('COMMON_MAIL_ALL_IN_ROOM', $count));
             $this->_form->addHidden('groups[0]', $all_iid);
         } else {
             $this->_form->combine();
             $this->_form->addCheckbox('groups[0]', $all_iid, false, $this->_translator->getMessage('COMMON_MAIL_RECEIVER'), $this->_translator->getMessage('COMMON_MAIL_ALL_IN_ROOM', $count));
         }
     }
     if ($context_item->isCommunityRoom() and !$context_item->withRubric(CS_INSTITUTION_TYPE)) {
         $cid = $this->_environment->getCurrentContextId();
         $user_manager = $this->_environment->getUserManager();
         $user_manager->setUserLimit();
         $user_manager->setContextLimit($cid);
         $count = $user_manager->getCountAll();
         if ($item->getItemType() != CS_DATE_TYPE and $item->getItemType() != CS_TODO_TYPE) {
             $this->_form->addText('receiver_text', $this->_translator->getMessage('COMMON_MAIL_RECEIVER'), $this->_translator->getMessage('COMMON_MAIL_ALL_IN_ROOM', $count));
             $this->_form->addHidden('send_to_all', true);
         } else {
             $this->_form->combine();
             $this->_form->addCheckbox('send_to_all', 1, false, $this->_translator->getMessage('COMMON_MAIL_RECEIVER'), $this->_translator->getMessage('COMMON_MAIL_ALL_IN_ROOM', $count));
         }
     }
     // send to all members in group rooms
     if ($context_item->isGroupRoom()) {
         $cid = $this->_environment->getCurrentContextID();
         $user_manager = $this->_environment->getUserManager();
         $user_manager->setUserLimit();
         $user_manager->setContextLimit($cid);
         $count = $user_manager->getCountAll();
         if ($item->getItemType() != CS_DATE_TYPE and $item->getItemType() != CS_TODO_TYPE) {
             $this->_form->addText('receiver_text', $this->_translator->getMessage('COMMON_MAIL_RECEIVER'), $this->_translator->getMessage('COMMON_MAIL_ALL_IN_ROOM', $count));
             $this->_form->addHidden('send_to_all', true);
         } else {
             $this->_form->combine();
             $this->_form->addCheckbox('send_to_all', 1, false, $this->_translator->getMessage('COMMON_MAIL_RECEIVER'), $this->_translator->getMessage('COMMON_MAIL_ALL_IN_ROOM', $count));
         }
     }
     $yesno[][] = array();
     $yesno['0']['text'] = $this->_translator->getMessage('COMMON_YES');
     $yesno['0']['value'] = $this->_translator->getMessage('COMMON_YES');
     $yesno['1']['text'] = $this->_translator->getMessage('COMMON_NO');
     $yesno['1']['value'] = $this->_translator->getMessage('COMMON_NO');
     $this->_form->addRadioGroup('copytosender', $this->_translator->getMessage('MAILCOPY_TO_SENDER'), $this->_translator->getMessage('MAILCOPY_TO_SENDER_DESC'), $yesno, $this->_translator->getMessage('COMMON_NO'), true, false);
     // buttons
     $this->_form->addButtonBar('option', $this->_translator->getMessage('COMMON_MAIL_SEND_BUTTON'), $this->_translator->getMessage('COMMON_CANCEL_BUTTON'));
 }
Ejemplo n.º 14
0
 private function getFormalData()
 {
     $return = array();
     $user = $this->_environment->getCurrentUser();
     $context = $this->_environment->getCurrentContextItem();
     $translator = $this->_environment->getTranslationObject();
     $converter = $this->_environment->getTextConverter();
     $formal_data = array();
     if ($this->_item->isNotActivated()) {
         $activating_date = $this->_item->getActivatingDate();
         $text = '';
         if (strstr($activating_date, '9999-00-00')) {
             $activating_text = $this->_environment->getTranslationObject()->getMessage('COMMON_NOT_ACTIVATED');
         } else {
             $activating_text = $this->_environment->getTranslationObject()->getMessage('COMMON_ACTIVATING_DATE') . ' ' . getDateInLang($this->_item->getActivatingDate());
         }
         $temp_array = array();
         $return['access'] = $activating_text;
     }
     // date
     $original_date = $this->_item->getDate();
     $date = getDateTimeInLang($original_date);
     $status = $this->_item->getStatus();
     $actual_date = date("Y-m-d H:i:s");
     if ($status !== $translator->getMessage('TODO_DONE') && $original_date < $actual_date) {
         // in progress
         // TODO:
         //$date = '<span class="required">'.$date.'</span>';
     }
     if ($original_date === '9999-00-00 00:00:00') {
         // no end date
         $date = 'no_end';
     }
     $return['date'] = $date;
     // status
     $return['status'] = $this->_item->getStatus();
     // todo management
     if ($context->withTodoManagement()) {
         $step_html = '';
         $step_minutes = 0;
         $step_item_list = $this->_item->getStepItemList();
         if ($step_item_list->isEmpty()) {
             $step_html .= '';
         } else {
             $step = $step_item_list->getFirst();
             $count = $step_item_list->getCount();
             $counter = 0;
             while ($step) {
                 $counter++;
                 $step_minutes = $step_minutes + $step->getMinutes();
                 $step = $step_item_list->getNext();
             }
         }
         $done_time = '';
         $done_percentage = 100;
         if ($this->_item->getPlannedTime() > 0) {
             $done_percentage = $step_minutes / $this->_item->getPlannedTime() * 100;
         }
         $time_type = $this->_item->getTimeType();
         $tmp_message = $translator->getMessage('COMMON_MINUTES');
         $step_minutes_text = $step_minutes;
         switch ($time_type) {
             case 2:
                 $step_minutes_text = '';
                 $exact_minutes = $step_minutes / 60;
                 $step_minutes = round($exact_minutes, 1);
                 if ($step_minutes !== $exact_minutes) {
                     $step_minutes_text .= 'ca. ';
                 }
                 if ($translator->getSelectedLanguage() === 'de') {
                     $step_minutes = str_replace('.', ',', $step_minutes);
                 }
                 $step_minutes_text .= $step_minutes;
                 $tmp_message = $translator->getMessage('COMMON_HOURS');
                 if ($step_minutes === 1) {
                     $tmp_message = $translator->getMessage('COMMON_HOUR');
                 }
                 break;
             case 3:
                 $exact_minutes = $step_minutes / 60 / 8;
                 $step_minutes = round($exact_minutes, 1);
                 $step_minutes_text = '';
                 if ($step_minutes !== $exact_minutes) {
                     $step_minutes_text .= 'ca. ';
                 }
                 if ($translator->getSelectedLanguage() === 'de') {
                     $step_minutes = str_replace('.', ',', $step_minutes);
                 }
                 $step_minutes_text .= $step_minutes;
                 $tmp_message = $translator->getMessage('COMMON_DAYS');
                 if ($step_minutes === 1) {
                     $tmp_message = $translator->getMessage('COMMON_DAY');
                 }
                 break;
             default:
                 $step_minutes = round($step_minutes, 1);
                 if ($translator->getSelectedLanguage() === 'de') {
                     $step_minutes = str_replace('.', ',', $step_minutes);
                 }
                 break;
         }
         /**/
         if ($done_percentage <= 100) {
             $style = ' height: 16px; background-color: #75ab05; ';
             $done_time .= '      <div style="border: 1px solid #444;  margin-left: 0px; height: 16px; width: 300px;">' . LF;
             if ($done_percentage >= 30) {
                 $done_time .= '         <div style="font-size: 10pt; ' . $style . 'width:' . $done_percentage . '%; color:#000000;">' . $step_minutes_text . ' ' . $tmp_message . '</div>' . LF;
             } else {
                 $done_time .= '<div style="float:right; font-size: 10pt;">' . $step_minutes_text . ' ' . $tmp_message . '</div>';
                 $done_time .= '         <div style="font-size: 10pt; ' . $style . 'width:' . $done_percentage . '%; color:#000000;">&nbsp;</div>' . LF;
             }
             $done_time .= '      </div>' . LF;
         } elseif ($done_percentage <= 120) {
             $done_percentage = 100 / $done_percentage * 100;
             $style = ' height: 16px; border: 1px solid #444; background-color: #f2f030; ';
             $done_time .= '         <div style="width: 300px; font-size: 10pt; ' . $style . ' color:#000000;">' . LF;
             $done_time .= '      <div style="border-right: 1px solid #444; padding-top:0px; margin-left: 0px; height:16px;  background-color:none; width:' . $done_percentage . '%;">' . LF;
             $done_time .= '&nbsp;' . $step_minutes_text . ' ' . $tmp_message;
             $done_time .= '      </div>' . LF;
             $done_time .= '</div>' . LF;
         } else {
             $done_percentage = 100 / $done_percentage * 100;
             $style = ' height: 16px; border: 1px solid #444; background-color: #f23030; ';
             $done_time .= '         <div style="width: 300px; font-size: 10pt; ' . $style . ' color:#000000;">' . LF;
             $done_time .= '      <div style="border-right: 1px solid #444; margin-left: 0px; height:16px;  background-color:none; width:' . $done_percentage . '%;">' . LF;
             $done_time .= '&nbsp;' . $step_minutes_text . ' ' . $tmp_message;
             $done_time .= '      </div>' . LF;
             $done_time .= '</div>' . LF;
         }
         //needed in print-view:
         $this->assign('detail', 'done_time', $step_minutes_text . ' ' . $tmp_message);
         /**/
         if ($this->_item->getPlannedTime() > 0) {
             $minutes = $this->_item->getPlannedTime();
             $time_type = $this->_item->getTimeType();
             $tmp_message = $translator->getMessage('COMMON_MINUTES');
             switch ($time_type) {
                 case 2:
                     $minutes = $minutes / 60;
                     $tmp_message = $translator->getMessage('COMMON_HOURS');
                     if ($minutes === 1) {
                         $tmp_message = $translator->getMessage('COMMON_HOUR');
                     }
                     break;
                 case 3:
                     $minutes = $minutes / 60 / 9;
                     $tmp_message = $translator->getMessage('COMMON_DAYS');
                     if ($minutes === 1) {
                         $tmp_message = $translator->getMessage('COMMON_DAY');
                     }
                     break;
             }
             if ($translator->getSelectedLanguage() === 'de') {
                 $minutes = str_replace('.', ',', $minutes);
             }
             $return['management'][0] = round($minutes, 0) . ' ' . $tmp_message;
         } elseif ($this->_item->getPlannedTime() === 0 && $done_percentage > 0) {
             $tmp_message = $translator->getMessage('COMMON_MINUTES');
             $done_time = $step_minutes;
             if ($step_minutes / 60 > 1 && $step_minutes / 60 <= 8) {
                 $step_minutes_text = '';
                 $exact_minutes = $step_minutes / 60;
                 $step_minutes = round($exact_minutes, 1);
                 $done_time = '';
                 if ($step_minutes !== $exact_minutes) {
                     $done_time .= 'ca. ';
                     if ($translator->getSelectedLanguage() === 'de') {
                         $step_minutes = str_replace('.', ',', $step_minutes);
                     }
                     $done_time .= $step_minutes;
                     $tmp_message = $translator->getMessage('COMMON_HOURS');
                     if ($step_minutes === 1) {
                         $tmp_message = $translator->getMessage('COMMON_HOUR');
                     }
                 }
             } elseif ($step_minutes / 60 > 8) {
                 $exact_minutes = $step_minutes / 60 / 8;
                 $step_minutes = round($exact_minutes, 1);
                 $done_time = '';
                 if ($step_minutes != $exact_minutes) {
                     $done_time .= 'ca. ';
                 }
                 $tmp_message = $translator->getMessage('COMMON_DAYS');
                 if ($step_minutes === 1) {
                     $tmp_message = $translator->getMessage('COMMON_DAY');
                 }
                 if ($translator->getSelectedLanguage() === 'de') {
                     $step_minutes = str_replace('.', ',', $step_minutes);
                 }
                 $done_time .= $step_minutes;
             } else {
                 $step_minutes = round($step_minutes, 1);
                 if ($translator->getSelectedLanguage() === 'de') {
                     $step_minutes = str_replace('.', ',', $step_minutes);
                 }
             }
             $done_time .= ' ' . $tmp_message;
         }
         if ($done_percentage > 0 || $this->_item->getPlannedTime() > 0) {
             $return['management'][1] = $done_time;
         }
     }
     // members
     $members = $this->_item->getProcessorItemList();
     if (!$members->isEmpty()) {
         $member = $members->getFirst();
         $count = $members->getCount();
         $counter = 0;
         while ($member) {
             $counter++;
             if ($member->isUser()) {
                 $linktext = $member->getFullname();
                 //TODO:
                 //$linktext = $converter->compareWithSearchText($linktext);
                 $linktext = $converter->text_as_html_short($linktext);
                 if ($member->maySee($user)) {
                     $params = array();
                     $params['iid'] = $member->getItemID();
                     $param_zip = $this->_environment->getValueOfParameter('download');
                     if (empty($param_zip) || $param_zip != 'zip') {
                         $member_html .= ahref_curl($this->_environment->getCurrentContextID(), 'user', 'detail', $params, $linktext);
                     } else {
                         $member_html .= $linktext;
                     }
                     unset($params);
                 } else {
                     $member_html .= '<span class="disabled">' . $linktext . '</span>' . LF;
                 }
                 if ($counter != $count) {
                     $member_html .= ', ';
                 }
             } else {
                 $linktext = chunkText($member->getFullname(), 35);
                 //TODO:
                 //$linktext = $converter->compareWithSearchText($linktext);
                 $linktext = $converter->text_as_html_short($linktext);
                 $param_zip = $this->_environment->getValueOfParameter('download');
                 if (empty($param_zip) || $param_zip != 'zip') {
                     $member_html .= ahref_curl($this->_environment->getCurrentContextID(), $this->_environment->getCurrentModule(), $this->_environment->getCurrentFunction(), array(), $link_text, $translator->getMessage('USER_STATUS_REJECTED'), '_self', '', '', '', '', 'class="disabled"', '', '', true);
                 } else {
                     $member_html .= $link_title;
                 }
                 if ($counter !== $count) {
                     $member_html .= ', ';
                 }
             }
             $member = $members->getNext();
         }
         $return['members'] = $member_html;
     }
     // files
     $files = $this->getFileContent();
     if (!empty($files)) {
         $return['files'] = implode(BRLF, $files);
     }
     // steps
     if ($context->withTodoManagement()) {
         $return['steps'] = $step_html;
     }
     return $return;
 }
Ejemplo n.º 15
0
 function _getCreationDate($item)
 {
     $retour = '';
     if (!empty($item) and is_object($item)) {
         $retour = getDateTimeInLang($item->getCreationDate());
     }
     return $retour;
 }
Ejemplo n.º 16
0
 function exportItemToWiki_soap($current_item_id, $rubric)
 {
     global $c_commsy_path_file;
     global $c_pmwiki_path_file;
     global $c_pmwiki_absolute_path_file;
     global $c_pmwiki_path_url;
     global $c_commsy_domain;
     global $c_commsy_url_path;
     $translator = $this->_environment->getTranslationObject();
     $client = $this->getSoapClient();
     $client->createDir('uploads/Main', $this->_environment->getSessionID());
     $author = '';
     $description = '';
     if ($rubric == CS_MATERIAL_TYPE) {
         // Material Item
         $material_manager = $this->_environment->getMaterialManager();
         $material_version_list = $material_manager->getVersionList($current_item_id);
         $item = $material_version_list->getFirst();
         // Informationen
         $author = $item->getAuthor();
         if (empty($author)) {
             $author = $item->getModificatorItem()->getFullName();
             $description = $item->getDescription();
         }
         $informations = '!' . $item->getTitle() . '%0a%0a';
         $informations .= '(:table border=0 style="margin-left:0px;":)%0a';
         $informations .= '(:cell:)\'\'\'AutorInnen:\'\'\' %0a(:cell:)' . $author . ' %0a';
         // Kurzfassung fuer Wiki vorbereiten
         if (!preg_match('~<!-- KFC TEXT -->[\\S|\\s]*<!-- KFC TEXT -->~u', $description)) {
             $text_converter = $this->_environment->getTextConverter();
             $description = $text_converter->text_for_wiki_export($description);
             //$description = _text_php2html_long($description);
         }
     } elseif ($rubric == CS_DISCUSSION_TYPE) {
         // Discussion Item
         $discussion_manager = $this->_environment->getDiscussionManager();
         $item = $discussion_manager->getItem($current_item_id);
         $informations = '!' . $item->getTitle() . '%0a%0a';
     }
     if ($rubric == CS_MATERIAL_TYPE or $rubric == CS_DISCUSSION_TYPE) {
         global $class_factory;
         $params = array();
         $params['environment'] = $this->_environment;
         $wiki_view = $class_factory->getClass(WIKI_VIEW, $params);
         $wiki_view->setItem($item);
         $description = $wiki_view->formatForWiki($description);
         $description = $this->encodeUmlaute($description);
         $description = $this->encodeUrl($description);
         if ($rubric == CS_MATERIAL_TYPE) {
             $html_wiki_file = 'Main.CommSyMaterial' . $current_item_id . '.html';
         } elseif ($rubric == CS_DISCUSSION_TYPE) {
             $html_wiki_file = 'Main.CommSy' . $translator->getMessage('COMMON_DISCUSSION') . $current_item_id . '.html';
         }
         $old_dir = getcwd();
         $description = '<br />' . "\n" . $description;
         $client->uploadFile($html_wiki_file, base64_encode($description), 'uploads/Main', $this->_environment->getSessionID());
         $c_pmwiki_path_url_upload = preg_replace('~http://[^/]*~u', '', $c_pmwiki_path_url);
         $returnwiki = '(:includeupload /' . $c_pmwiki_path_url_upload . '/wikis/' . $this->_environment->getCurrentPortalID() . '/' . $this->_environment->getCurrentContextID() . '/uploads/Main/' . $html_wiki_file . ':)';
         if ($rubric == CS_MATERIAL_TYPE) {
             $informations .= '(:cellnr:)\'\'\'Kurzfassung:\'\'\' %0a(:cell:)' . $returnwiki . ' %0a';
         }
         // Dateien
         $file_list = $item->getFileList();
         if (!$file_list->isEmpty()) {
             $file_array = $file_list->to_array();
             $file_link_array = array();
             foreach ($file_array as $file) {
                 $new_filename = $this->encodeUrl($file->getDiskFileNameWithoutFolder());
                 $new_filename = preg_replace('~cid([0-9]*)_~u', '', $new_filename);
                 $new_filename = $new_filename . '.' . $file->getExtension();
                 $temp_file = file_get_contents($c_commsy_path_file . '/' . $file->getDiskFileName());
                 $client->uploadFile($new_filename, base64_encode($temp_file), 'uploads/Main', $this->_environment->getSessionID());
                 $new_link = $this->encodeUrlToHtml($file->getFileName());
                 $file_link_array[] = '[[' . $c_pmwiki_path_url . '/wikis/' . $this->_environment->getCurrentPortalID() . '/' . $this->_environment->getCurrentContextID() . '/uploads/Main/' . $new_filename . '|' . $new_link . ']]';
             }
             $file_links = implode('\\\\%0a', $file_link_array);
             $informations .= '(:cellnr:)\'\'\'Dateien:\'\'\' %0a(:cell:)' . $file_links . ' %0a';
         }
         if ($rubric == CS_MATERIAL_TYPE) {
             // Abschnitte
             $sub_item_list = $item->getSectionList();
         } elseif ($rubric == CS_DISCUSSION_TYPE) {
             $discussionarticles_manager = $this->_environment->getDiscussionArticlesManager();
             $discussionarticles_manager->setDiscussionLimit($item->getItemID(), array());
             $discussion_type = $item->getDiscussionType();
             if ($discussion_type == 'threaded') {
                 $discussionarticles_manager->setSortPosition();
             }
             if (isset($_GET['status']) and $_GET['status'] == 'all_articles') {
                 $discussionarticles_manager->setDeleteLimit(false);
             }
             $discussionarticles_manager->select();
             $sub_item_list = $discussionarticles_manager->get();
         }
         $sub_item_descriptions = '';
         if (!$sub_item_list->isEmpty()) {
             $size = $sub_item_list->getCount();
             $index_start = 1;
             if ($rubric == CS_DISCUSSION_TYPE and $size > 0) {
                 $size = $size - 1;
                 $index_start = 0;
             }
             $sub_item_link_array = array();
             $sub_item_description_array = array();
             for ($index = $index_start; $index <= $size; $index++) {
                 $sub_item = $sub_item_list->get($index);
                 if ($rubric == CS_DISCUSSION_TYPE) {
                     $sub_item_link_array[] = '(:cellnr width=50%:)' . ($index + 1) . '. [[#' . $sub_item->getSubject() . '|' . $sub_item->getSubject() . ']] %0a(:cell width=30%:)' . $sub_item->getCreatorItem()->getFullName() . ' %0a(:cell:)' . getDateTimeInLang($sub_item->getModificationDate()) . '%0a';
                 } else {
                     $sub_item_link_array[] = '[[#' . $sub_item->getTitle() . '|' . $sub_item->getTitle() . ']]';
                 }
                 // Abschnitt fuer Wiki vorbereiten
                 $description = $sub_item->getDescription();
                 if (!preg_match('~<!-- KFC TEXT -->[\\S|\\s]*<!-- KFC TEXT -->~u', $description)) {
                     $text_converter = $this->_environment->getTextConverter();
                     $description = $text_converter->text_for_wiki_export($description);
                     //$description = _text_php2html_long($sub_item->getDescription());
                 }
                 $params = array();
                 $params['environment'] = $this->_environment;
                 $params['with_modifying_actions'] = true;
                 $wiki_view = $this->_class_factory->getClass(WIKI_VIEW, $params);
                 unset($params);
                 $wiki_view->setItem($sub_item);
                 $description = $wiki_view->formatForWiki($description);
                 $description = $this->encodeUmlaute($description);
                 $description = $this->encodeUrl($description);
                 if ($rubric == CS_MATERIAL_TYPE) {
                     $html_wiki_file = 'Main.CommSyMaterial' . $current_item_id . '.sub_item.' . $sub_item->getItemID() . '.html';
                 } elseif ($rubric == CS_DISCUSSION_TYPE) {
                     $html_wiki_file = 'Main.CommSy' . $translator->getMessage('COMMON_DISCUSSION') . $current_item_id . '.sub_item.' . $sub_item->getItemID() . '.html';
                 }
                 $html_wiki_file = $this->encodeUmlaute($html_wiki_file);
                 $html_wiki_file = $this->encodeUrl($html_wiki_file);
                 $description = '<br />' . "\n" . $description;
                 $client->uploadFile($html_wiki_file, base64_encode($description), 'uploads/Main', $this->_environment->getSessionID());
                 $c_pmwiki_path_url_upload = preg_replace('~http://[^/]*~u', '', $c_pmwiki_path_url);
                 $returnwiki = '(:includeupload /' . $c_pmwiki_path_url_upload . '/wikis/' . $this->_environment->getCurrentPortalID() . '/' . $this->_environment->getCurrentContextID() . '/uploads/Main/' . $html_wiki_file . ':)';
                 $description_sub_item_link = str_replace(' ', '', $sub_item->getTitle());
                 // Dateien (Abschnitte)
                 $files = '%0a%0a';
                 $file_list = $sub_item->getFileList();
                 if (!$file_list->isEmpty()) {
                     $file_array = $file_list->to_array();
                     $file_link_array = array();
                     foreach ($file_array as $file) {
                         $new_filename = $this->encodeUrl($file->getDiskFileNameWithoutFolder());
                         $new_filename = preg_replace('~cid([0-9]*)_~u', '', $new_filename);
                         $new_filename = $new_filename . '.' . $file->getExtension();
                         $temp_file = file_get_contents($c_commsy_path_file . '/' . $file->getDiskFileName());
                         $client->uploadFile($new_filename, base64_encode($temp_file), 'uploads/Main', $this->_environment->getSessionID());
                         $new_link = $this->encodeUrlToHtml($file->getFileName());
                         $file_link_array[] = '[[' . $c_pmwiki_path_url . '/wikis/' . $this->_environment->getCurrentPortalID() . '/' . $this->_environment->getCurrentContextID() . '/uploads/Main/' . $new_filename . '|' . $new_link . ']]';
                     }
                     $file_links = implode('\\\\%0a', $file_link_array);
                     $files .= '(:table border=0 style="margin-left:0px;":)%0a';
                     $files .= '(:cell:)\'\'\'Dateien:\'\'\' %0a(:cell:)' . $file_links . ' %0a';
                     $files .= '(:tableend:) %0a';
                 }
                 $sub_item_description_array[] = '%0a----%0a%0a====%0a%0a!!' . $sub_item->getTitle() . '%0a[[#' . $description_sub_item_link . ']]%0a' . $returnwiki . $files;
             }
             if ($rubric == CS_MATERIAL_TYPE) {
                 $sub_item_links = implode('\\\\%0a', $sub_item_link_array);
                 $informations .= '(:cellnr:)\'\'\'' . $translator->getMessage('MATERIAL_SECTIONS') . ':\'\'\' %0a(:cell:)' . $sub_item_links . ' %0a';
             } elseif ($rubric == CS_DISCUSSION_TYPE) {
                 $sub_item_links = implode('', $sub_item_link_array);
                 $informations .= '(:cellnr:)%0a(:cell:)%0a';
                 $informations .= '(:table border=0 style="margin-left:0px;":)%0a';
                 $informations .= $sub_item_links;
                 $informations .= '(:tableend:) %0a';
             }
             $informations .= '(:tableend:) %0a';
             $sub_item_descriptions = implode('\\\\%0a', $sub_item_description_array);
         }
         $buzzword_text = '';
         $buzzword_list = $item->getBuzzwordList();
         $buzzword = $buzzword_list->getFirst();
         $buzzword_file_text = '';
         $commentbox_text = '';
         while ($buzzword) {
             if (!empty($buzzword_text)) {
                 $buzzword_text .= ', ';
             }
             if (!empty($buzzword_file_text)) {
                 $buzzword_file_text .= ',';
             }
             $buzzword_title = cs_ucfirst(str_replace('.', '', str_replace(' ', '', $buzzword->getTitle())));
             $buzzword_text .= '[[!' . $buzzword_title . ']]';
             $exists_file = $client->getPageExists('Category.' . $buzzword_title, $this->_environment->getSessionID());
             if (!$exists_file) {
                 $file_buzzword_contents = file_get_contents($c_commsy_path_file . '/etc/pmwiki/Category.Keyword');
                 $file_buzzword_contents = str_replace('CS_KEYWORD', $buzzword_title, $file_buzzword_contents);
                 $client->createPage('Category.' . $buzzword_title, $file_buzzword_contents, $this->_environment->getSessionID());
             }
             $buzzword_file_text .= 'Category.' . $buzzword_title;
             $buzzword = $buzzword_list->getNext();
         }
         if (!empty($buzzword_text)) {
             $buzzword_text = '%0a\\\\%0a' . $translator->getMessage('COMMON_BUZZWORDS') . ': ' . $buzzword_text;
         }
         if ($item->getItemType() == CS_MATERIAL_TYPE) {
             $wiki_file = 'Main.CommSyMaterial' . $current_item_id . '-Comments';
         } elseif ($item->getItemType() == CS_DISCUSSION_TYPE) {
             $wiki_file = 'Main.CommSy' . $translator->getMessage('COMMON_DISCUSSION') . $current_item_id . '-Comments';
         }
         $exists_file = $client->getPageExists($wiki_file, $this->_environment->getSessionID());
         if (!$exists_file) {
             $commentbox_text = '%0a%0a----%0a\\\\%0a' . '(:include Site.FoxCommentBox:)';
         }
         // Link zurueck ins CommSy
         global $c_single_entry_point;
         $link = '[[' . $c_commsy_domain . $c_commsy_url_path . '/' . $c_single_entry_point . '?cid=' . $this->_environment->getCurrentContextID() . '&mod=' . $rubric . '&fct=detail&iid=' . $current_item_id . '|"' . $item->getTitle() . '" im CommSy]]';
         $old_dir = getcwd();
         // Kurzfassung fuer Wiki vorbereiten
         if ($rubric == CS_MATERIAL_TYPE) {
             $file_contents = file_get_contents($c_commsy_path_file . '/etc/pmwiki/Main.Material');
         } elseif ($rubric == CS_DISCUSSION_TYPE) {
             $file_contents = file_get_contents($c_commsy_path_file . '/etc/pmwiki/Main.' . $translator->getMessage('COMMON_DISCUSSION'));
         }
         $file_contents_array = explode("\n", $file_contents);
         for ($index = 0; $index < sizeof($file_contents_array); $index++) {
             if (stripos($file_contents_array[$index], 'name=') !== false) {
                 if ($rubric == CS_MATERIAL_TYPE) {
                     $file_contents_array[$index] = 'name=Main.CommSyMaterial' . $current_item_id;
                 } elseif ($rubric == CS_DISCUSSION_TYPE) {
                     $file_contents_array[$index] = 'name=Main.CommSy' . $translator->getMessage('COMMON_DISCUSSION') . $current_item_id;
                 }
             }
             if (stripos($file_contents_array[$index], 'text=') !== false) {
                 if ($rubric == CS_MATERIAL_TYPE) {
                     $title_text = '(:title CommSy-Material "' . $item->getTitle() . '":)';
                 } elseif ($rubric == CS_DISCUSSION_TYPE) {
                     $title_text = '(:title CommSy-' . $translator->getMessage('COMMON_DISCUSSION') . ' "' . $item->getTitle() . '":)';
                 }
                 $file_contents_array[$index] = 'text=' . $informations . $sub_item_descriptions . '%0a%0a----%0a\\\\%0a' . $buzzword_text . '%0a\\\\%0a' . $link . $commentbox_text . '%0a%0a' . $title_text;
             }
             if (stripos($file_contents_array[$index], 'targets=') !== false and !empty($buzzword_file_text)) {
                 $file_contents_array[$index] = 'targets=' . $buzzword_file_text;
             }
         }
         $file_contents = implode("\n", $file_contents_array);
         if (!strstr($file_contents, 'targets=') and !empty($buzzword_file_text)) {
             $file_contents .= '"\\n"' . 'targets=' . $buzzword_file_text;
         }
         if ($rubric == CS_MATERIAL_TYPE) {
             $file_contents = $file_contents . "\n" . 'title=CommSy-Material "' . $item->getTitle() . '"';
             $client->createPage('Main.CommSyMaterial' . $current_item_id, $file_contents, $this->_environment->getSessionID());
         } elseif ($rubric == CS_DISCUSSION_TYPE) {
             $file_contents = $file_contents . 'title=CommSy-' . $translator->getMessage('COMMON_DISCUSSION') . ' "' . $item->getTitle() . '"';
             $client->createPage('Main.CommSy' . $translator->getMessage('COMMON_DISCUSSION') . '' . $current_item_id, $file_contents, $this->_environment->getSessionID());
         }
         $item->setExportToWiki('1');
         $item->save();
         $link_modifier_item_manager = $this->_environment->getLinkModifierItemManager();
         $modifiers = $link_modifier_item_manager->getModifiersOfItem($item->getItemID());
         $user_manager = $this->_environment->getUserManager();
         $user_manager->reset();
         $user_manager->setContextLimit($this->_environment->getCurrentContextID());
         $user_manager->setIDArrayLimit($modifiers);
         $user_manager->select();
         $user_list = $user_manager->get();
         if ($user_list->getCount() >= 1) {
             $user_item = $user_list->getFirst();
             include_once 'classes/cs_mail.php';
             $translator = $this->_environment->getTranslationObject();
             while ($user_item) {
                 $mail = new cs_mail();
                 $mail->set_to($user_item->getEmail());
                 $room = $this->_environment->getCurrentContextItem();
                 $room_title = '';
                 if (isset($room)) {
                     $room_title = $room->getTitle();
                 }
                 $from = $translator->getMessage('SYSTEM_MAIL_MESSAGE', $room_title);
                 $mail->set_from_name($from);
                 $server_item = $this->_environment->getServerItem();
                 $default_sender_address = $server_item->getDefaultSenderAddress();
                 if (!empty($default_sender_address)) {
                     $mail->set_from_email($default_sender_address);
                 } else {
                     $mail->set_from_email('@');
                 }
                 $subject = $translator->getMessage('MATERIAL_EXPORT_WIKI_MAIL_SUBJECT') . ': ' . $room_title;
                 $mail->set_subject($subject);
                 $body = $translator->getMessage('MATERIAL_EXPORT_WIKI_MAIL_BODY', $room_title, $this->_environment->getCurrentUserItem()->getFullname(), $item->getTitle(), $item->getExportToWikiLink());
                 $mail->set_message($body);
                 $mail->setSendAsHTML();
                 $mail->send();
                 $user_item = $user_list->getNext();
             }
         }
     }
     $this->updateExportLists($rubric);
 }
Ejemplo n.º 17
0
 /** init data for form, INTERNAL
  * this methods init the data (text and options) for the form
  *
  * @author CommSy Development Group
  */
 function _initForm()
 {
     // if an item is given - first call of the form
     if (!empty($this->_item)) {
         $this->_headline = $this->_translator->getMessage('ADMIN_USER_FORM_TITLE', $this->_item->getFullname());
         $this->_user_id = $this->_item->getUserID();
         $this->_user_fullname = $this->_item->getFullname();
         $this->_user_status = $this->_item->getStatus();
         $this->_user_lastlogin = $this->_item->getLastLogin();
         $this->_admin_comment = $this->_item->getAdminComment();
     } else {
         $this->_headline = $this->_translator->getMessage('ADMIN_USER_FORM_TITLE', $this->_form_post['fullname']);
         if (!empty($this->_form_post['lastlogin']) and $this->_form_post['lastlogin'] != '0000-00-00 00:00:00') {
             $this->_with_delete_button = false;
         }
         $this->_user_id = $this->_form_post['user_id'];
         $this->_user_fullname = $this->_form_post['fullname'];
         if (!empty($this->_form_post['status'])) {
             $this->_user_status = $this->_form_post['status'];
         } else {
             $this->_user_status = '';
         }
         $this->_user_lastlogin = $this->_form_post['lastlogin'];
     }
     // transform the user status into a text message
     $this->_status_old = '';
     if ($this->_user_status == 3) {
         $this->_status_message = 'USER_STATUS_MODERATOR';
         $this->_selected = 'moderator';
     } elseif ($this->_user_status == 2) {
         $this->_status_message = 'USER_STATUS_USER';
         $this->_selected = 'user';
     } elseif ($this->_user_status == 1) {
         $this->_status_message = 'USER_STATUS_REQUESTED';
         $this->_selected = 'user';
         $this->_status_old = 'request';
     } else {
         if (!empty($this->_user_lastlogin)) {
             $this->_status_message = 'USER_STATUS_CLOSED';
         } else {
             $this->_status_message = 'USER_STATUS_REJECT';
         }
         $this->_selected = 'close';
     }
     // prepare status options for the form
     if ($this->_user_status == 1) {
         $this->_options[0]['text'] = $this->_translator->getMessage('USER_STATUS_REJECT');
         $this->_options[0]['value'] = 'reject';
     } else {
         $this->_options[0]['text'] = $this->_translator->getMessage('USER_STATUS_CLOSED');
         $this->_options[0]['value'] = 'close';
     }
     $this->_options[1]['text'] = $this->_translator->getMessage('USER_STATUS_USER');
     $this->_options[1]['value'] = 'user';
     $this->_options[2]['text'] = $this->_translator->getMessage('USER_STATUS_MODERATOR');
     $this->_options[2]['value'] = 'moderator';
     // prepare lastlogin information
     if (empty($this->_user_lastlogin) or $this->_user_lastlogin == '0000-00-00 00:00:00') {
         $this->_user_lastlogin = $this->_translator->getMessage('USER_NEVER_LOGIN');
     } else {
         $this->_user_lastlogin = getDateTimeInLang($this->_user_lastlogin);
     }
 }
Ejemplo n.º 18
0
 /** get the single entry of the list view as HTML
  * this method returns the single entry in HTML-Code
  *
  * @returns string $item as HMTL
  *
  * @param object item     the single list entry
  * @author CommSy Development Group
  */
 function _getItemAsHTML($item)
 {
     $html = LF . '<!-- BEGIN OF TODO ITEM DETAIL -->' . LF;
     $user = $this->_environment->getCurrentUser();
     $context = $this->_environment->getCurrentContextItem();
     $formal_data = array();
     $original_date = $item->getDate();
     $date = getDateTimeInLang($original_date);
     $status = $item->getStatus();
     $actual_date = date("Y-m-d H:i:s");
     if ($status != $this->_translator->getMessage('TODO_DONE') and $original_date < $actual_date) {
         $date = '<span class="required">' . $date . '</span>';
     }
     if ($original_date == '9999-00-00 00:00:00') {
         $date = $this->_translator->getMessage('TODO_NO_END_DATE_LONG');
     }
     // Members
     $member_html = '';
     $members = $item->getProcessorItemList();
     if ($members->isEmpty()) {
         $member_html .= '   ' . $this->_translator->getMessage('TODO_NO_PROCESSOR') . LF;
     } else {
         $member = $members->getFirst();
         $count = $members->getCount();
         $counter = 0;
         while ($member) {
             $counter++;
             if ($member->isUser()) {
                 $linktext = $this->_text_as_html_short($this->_compareWithSearchText($member->getFullname()));
                 if ($member->maySee($user)) {
                     $params = array();
                     $params['iid'] = $member->getItemID();
                     $param_zip = $this->_environment->getValueOfParameter('download');
                     if (empty($param_zip) or $param_zip != 'zip') {
                         $member_html .= ahref_curl($this->_environment->getCurrentContextID(), 'user', 'detail', $params, $linktext);
                     } else {
                         $member_html .= $linktext;
                     }
                     unset($params);
                 } else {
                     $member_html .= '<span class="disabled">' . $linktext . '</span>' . LF;
                 }
                 if ($counter != $count) {
                     $member_html .= ', ';
                 }
             } else {
                 $link_title = $this->_text_as_html_short($this->_compareWithSearchText(chunkText($member->getFullName(), 35)));
                 $param_zip = $this->_environment->getValueOfParameter('download');
                 if (empty($param_zip) or $param_zip != 'zip') {
                     $member_html .= ahref_curl($this->_environment->getCurrentContextID(), $this->_environment->getCurrentModule(), $this->_environment->getCurrentFunction(), array(), $link_title, $this->_translator->getMessage('USER_STATUS_REJECTED'), '_self', '', '', '', '', 'class="disabled"', '', '', true);
                 } else {
                     $member_html .= $link_title;
                 }
                 if ($counter != $count) {
                     $member_html .= ', ';
                 }
             }
             $member = $members->getNext();
         }
     }
     $temp_array[0] = $this->_translator->getMessage('TODO_VALIDITY_DATE');
     $temp_array[1] = $date;
     $formal_data[] = $temp_array;
     $temp_array[0] = $this->_translator->getMessage('TODO_STATUS');
     $temp_array[1] = $item->getStatus();
     $formal_data[] = $temp_array;
     if ($context->withTodoManagement()) {
         $step_html = '';
         $step_minutes = 0;
         $step_item_list = $item->getStepItemList();
         if ($step_item_list->isEmpty()) {
             $step_html .= '   ' . $this->_translator->getMessage('TODO_NO_STEPS') . LF;
         } else {
             $step = $step_item_list->getFirst();
             $count = $step_item_list->getCount();
             $counter = 0;
             while ($step) {
                 $counter++;
                 $step_minutes = $step_minutes + $step->getMinutes();
                 $fileicons = $this->_getItemFiles($step, true);
                 if (!empty($fileicons)) {
                     $fileicons = '&nbsp;' . $fileicons;
                 }
                 $params = array();
                 $params['iid'] = $item->getItemID();
                 $hover = str_replace('"', '&quot;', $this->_text_as_html_short($step->getTitle()));
                 $param_zip = $this->_environment->getValueOfParameter('download');
                 if (empty($param_zip) or $param_zip != 'zip') {
                     $title = ahref_curl($this->_environment->getCurrentContextID(), CS_TODO_TYPE, 'detail', $params, $this->_text_as_html_short($this->_compareWithSearchText($step->getTitle())), $hover, '', 'anchor' . $step->getItemID());
                 } else {
                     $title = $this->_text_as_html_short($this->_compareWithSearchText($step->getTitle()));
                 }
                 $step_html .= $counter . '. ' . $title . $fileicons;
                 $step_html .= $this->_getItemChangeStatus($step) . ' ' . '<br/>';
                 $step = $step_item_list->getNext();
             }
         }
         $done_time = '';
         $done_percentage = 100;
         if ($item->getPlannedTime() > 0) {
             $done_percentage = $step_minutes / $item->getPlannedTime() * 100;
         }
         $time_type = $item->getTimeType();
         $tmp_message = $this->_translator->getMessage('COMMON_MINUTES');
         $step_minutes_text = $step_minutes;
         switch ($time_type) {
             case 2:
                 $step_minutes_text = '';
                 $exact_minutes = $step_minutes / 60;
                 #               $step_minutes = round($exact_minutes);
                 $step_minutes = round($exact_minutes, 1);
                 if ($step_minutes != $exact_minutes) {
                     $step_minutes_text .= 'ca. ';
                 }
                 if ($this->_translator->getSelectedLanguage() == 'de') {
                     $step_minutes = str_replace('.', ',', $step_minutes);
                 }
                 $step_minutes_text .= $step_minutes;
                 $tmp_message = $this->_translator->getMessage('COMMON_HOURS');
                 if ($step_minutes == 1) {
                     $tmp_message = $this->_translator->getMessage('COMMON_HOUR');
                 }
                 break;
             case 3:
                 $exact_minutes = $step_minutes / 60 / 8;
                 #               $step_minutes = round($exact_minutes);
                 $step_minutes = round($exact_minutes, 1);
                 $step_minutes_text = '';
                 if ($step_minutes != $exact_minutes) {
                     $step_minutes_text .= 'ca. ';
                 }
                 if ($this->_translator->getSelectedLanguage() == 'de') {
                     $step_minutes = str_replace('.', ',', $step_minutes);
                 }
                 $step_minutes_text .= $step_minutes;
                 $tmp_message = $this->_translator->getMessage('COMMON_DAYS');
                 if ($step_minutes == 1) {
                     $tmp_message = $this->_translator->getMessage('COMMON_DAY');
                 }
                 break;
             default:
                 $step_minutes = round($step_minutes, 1);
                 if ($this->_translator->getSelectedLanguage() == 'de') {
                     $step_minutes = str_replace('.', ',', $step_minutes);
                 }
                 break;
         }
         if ($done_percentage <= 100) {
             $style = ' height: 16px; background-color: #75ab05; ';
             $done_time .= '      <div style="border: 1px solid #444;  margin-left: 0px; height: 16px; width: 300px;">' . LF;
             if ($done_percentage >= 30) {
                 $done_time .= '         <div style="font-size: 10pt; ' . $style . 'width:' . $done_percentage . '%; color:#000000;">' . $step_minutes_text . ' ' . $tmp_message . '</div>' . LF;
             } else {
                 $done_time .= '<div style="float:right; font-size: 10pt;">' . $step_minutes_text . ' ' . $tmp_message . '</div>';
                 $done_time .= '         <div style="font-size: 10pt; ' . $style . 'width:' . $done_percentage . '%; color:#000000;">&nbsp;</div>' . LF;
             }
             $done_time .= '      </div>' . LF;
         } elseif ($done_percentage <= 120) {
             $done_percentage = 100 / $done_percentage * 100;
             $style = ' height: 16px; border: 1px solid #444; background-color: #f2f030; ';
             $done_time .= '         <div style="width: 300px; font-size: 10pt; ' . $style . ' color:#000000;">' . LF;
             $done_time .= '      <div style="border-right: 1px solid #444; padding-top:0px; margin-left: 0px; height:16px;  background-color:none; width:' . $done_percentage . '%;">' . LF;
             $done_time .= '&nbsp;' . $step_minutes_text . ' ' . $tmp_message;
             $done_time .= '      </div>' . LF;
             $done_time .= '</div>' . LF;
         } else {
             $done_percentage = 100 / $done_percentage * 100;
             $style = ' height: 16px; border: 1px solid #444; background-color: #f23030; ';
             $done_time .= '         <div style="width: 300px; font-size: 10pt; ' . $style . ' color:#000000;">' . LF;
             $done_time .= '      <div style="border-right: 1px solid #444; margin-left: 0px; height:16px;  background-color:none; width:' . $done_percentage . '%;">' . LF;
             $done_time .= '&nbsp;' . $step_minutes_text . ' ' . $tmp_message;
             $done_time .= '      </div>' . LF;
             $done_time .= '</div>' . LF;
         }
         if ($item->getPlannedTime() > 0) {
             $minutes = $item->getPlannedTime();
             $time_type = $item->getTimeType();
             $tmp_message = $this->_translator->getMessage('COMMON_MINUTES');
             switch ($time_type) {
                 case 2:
                     $minutes = $minutes / 60;
                     $tmp_message = $this->_translator->getMessage('COMMON_HOURS');
                     if ($minutes == 1) {
                         $tmp_message = $this->_translator->getMessage('COMMON_HOUR');
                     }
                     break;
                 case 3:
                     $minutes = $minutes / 60 / 8;
                     $tmp_message = $this->_translator->getMessage('COMMON_DAYS');
                     if ($minutes == 1) {
                         $tmp_message = $this->_translator->getMessage('COMMON_DAY');
                     }
                     break;
             }
             if ($this->_translator->getSelectedLanguage() == 'de') {
                 $minutes = str_replace('.', ',', $minutes);
             }
             $temp_array[0] = $this->_translator->getMessage('TODO_MINUTES');
             $temp_array[1] = $minutes . ' ' . $tmp_message;
             $formal_data[] = $temp_array;
         } elseif ($item->getPlannedTime() == 0 and $done_percentage > 0) {
             $tmp_message = $this->_translator->getMessage('COMMON_MINUTES');
             $done_time = $step_minutes;
             if ($step_minutes / 60 > 1 and $step_minutes / 60 <= 8) {
                 $step_minutes_text = '';
                 $exact_minutes = $step_minutes / 60;
                 $step_minutes = round($exact_minutes, 1);
                 $done_time = '';
                 if ($step_minutes != $exact_minutes) {
                     $done_time .= 'ca. ';
                 }
                 if ($this->_translator->getSelectedLanguage() == 'de') {
                     $step_minutes = str_replace('.', ',', $step_minutes);
                 }
                 $done_time .= $step_minutes;
                 $tmp_message = $this->_translator->getMessage('COMMON_HOURS');
                 if ($step_minutes == 1) {
                     $tmp_message = $this->_translator->getMessage('COMMON_HOUR');
                 }
             } elseif ($step_minutes / 60 > 8) {
                 $exact_minutes = $step_minutes / 60 / 8;
                 $step_minutes = round($exact_minutes, 1);
                 $done_time = '';
                 if ($step_minutes != $exact_minutes) {
                     $done_time .= 'ca. ';
                 }
                 $tmp_message = $this->_translator->getMessage('COMMON_DAYS');
                 if ($step_minutes == 1) {
                     $tmp_message = $this->_translator->getMessage('COMMON_DAY');
                 }
                 if ($this->_translator->getSelectedLanguage() == 'de') {
                     $step_minutes = str_replace('.', ',', $step_minutes);
                 }
                 $done_time .= $step_minutes;
             } else {
                 $step_minutes = round($step_minutes, 1);
                 if ($this->_translator->getSelectedLanguage() == 'de') {
                     $step_minutes = str_replace('.', ',', $step_minutes);
                 }
             }
             $done_time .= ' ' . $tmp_message;
         }
         if ($done_percentage > 0 or $item->getPlannedTime() > 0) {
             $temp_array[0] = $this->_translator->getMessage('TODO_DONE_MINUTES');
             $temp_array[1] = $done_time;
             $formal_data[] = $temp_array;
         }
     }
     $temp_array[0] = $this->_translator->getMessage('TODO_PROCESSORS');
     $temp_array[1] = $member_html;
     $formal_data[] = $temp_array;
     // Files
     $files = $this->_getFilesForFormalData($item);
     if (!empty($files)) {
         $temp_array = array();
         $temp_array[] = $this->_translator->getMessage('MATERIAL_FILES');
         $temp_array[] = implode(BRLF, $files);
         $formal_data[] = $temp_array;
     }
     if (!empty($formal_data)) {
         $html .= $this->_getFormalDataAsHTML($formal_data);
     }
     if ($context->withTodoManagement()) {
         $temp_array = array();
         $formal_data = array();
         $temp_array[0] = $this->_translator->getMessage('TODO_STEPS');
         $temp_array[1] = $step_html;
         $formal_data[] = $temp_array;
         if (!empty($formal_data)) {
             $html .= $this->_getFormalDataAsHTML($formal_data);
             $html .= BRLF;
         }
     }
     // Description
     $desc = $item->getDescription();
     if (!empty($desc)) {
         $desc = $this->_text_as_html_long($this->_compareWithSearchText($this->_cleanDataFromTextArea($desc)));
         $desc = $this->_show_images($desc, $item, true);
         $html .= $this->getScrollableContent($desc, $item, '', true) . LF;
     }
     // creator, modificator and reference number for printing
     if (isset($_GET['mode']) and $_GET['mode'] == 'print') {
         $modificator = $item->getModificatorItem();
         $creator = $item->getCreatorItem();
         if (isset($modificator) and !$modificator->isDeleted()) {
             $current_user_item = $this->_environment->getCurrentUserItem();
             if ($current_user_item->isGuest()) {
                 $temp_modificator = $this->_translator->getMessage('COMMON_USER_NOT_VISIBLE');
             } else {
                 $temp_modificator = $modificator->getFullname();
             }
             unset($current_user_item);
         } else {
             $temp_modificator = $this->_translator->getMessage('COMMON_DELETED_USER');
         }
         if (isset($creator) and !$creator->isDeleted()) {
             $current_user_item = $this->_environment->getCurrentUserItem();
             if ($current_user_item->isGuest()) {
                 $temp_creator = $this->_translator->getMessage('COMMON_USER_NOT_VISIBLE');
             } else {
                 $temp_creator = $creator->getFullname();
             }
             unset($current_user_item);
         } else {
             $temp_creator = $this->_translator->getMessage('COMMON_DELETED_USER');
         }
         $html .= '<table class="creator_info" summary="Layout" style="padding-top:20px">' . LF;
         // Modificator information
         $html .= '   <tr>' . LF;
         $html .= '      <td></td>' . LF;
         $html .= '      <td class="key"  style="padding-left:8px;">' . LF;
         $html .= '         ' . $this->_translator->getMessage('COMMON_LAST_MODIFIED_BY') . ':&nbsp;' . LF;
         $html .= '      </td>' . LF;
         $html .= '      <td class="value">' . LF;
         $html .= '         ' . $temp_modificator . ', ' . $this->_translator->getDateTimeInLang($item->getModificationDate()) . LF;
         $html .= '      </td>' . LF;
         $html .= '   </tr>' . LF;
         // Creator information
         $html .= '   <tr>' . LF;
         $html .= '      <td></td>' . LF;
         $html .= '      <td class="key"  style="padding-left:8px;">' . LF;
         $html .= '         ' . $this->_translator->getMessage('COMMON_CREATED_BY') . ':&nbsp;' . LF;
         $html .= '      </td>' . LF;
         $html .= '      <td class="value">' . LF;
         $html .= '         ' . $temp_creator . ', ' . $this->_translator->getDateTimeInLang($item->getCreationDate()) . LF;
         $html .= '      </td>' . LF;
         $html .= '   </tr>' . LF;
         // Reference number
         $html .= '   <tr>' . LF;
         $html .= '      <td></td>' . LF;
         $html .= '      <td class="key"  style="padding-left:8px;">' . LF;
         $html .= '         ' . $this->_translator->getMessage('COMMON_REFNUMBER') . ':&nbsp;' . LF;
         $html .= '      </td>' . LF;
         $html .= '      <td class="value">' . LF;
         $html .= '         ' . $item->getItemID();
         $html .= '      </td>' . LF;
         $html .= '   </tr>' . LF;
         $html .= '</table>' . LF;
     }
     $html .= '<!-- END OF TODO ITEM DETAIL -->' . LF . LF;
     return $html;
 }
Ejemplo n.º 19
0
 private function getFormalData()
 {
     $return = array();
     $translator = $this->_environment->getTranslationObject();
     $converter = $this->_environment->getTextConverter();
     $context_item = $this->_environment->getCurrentContextItem();
     $current_user = $this->_environment->getCurrentUserItem();
     $portal_item = $this->_environment->getCurrentPortalItem();
     if ($this->_item->isNotActivated()) {
         $activating_date = $this->_item->getActivatingDate();
         $text = '';
         if (strstr($activating_date, '9999-00-00')) {
             $activating_text = $translator->getMessage('COMMON_NOT_ACTIVATED');
         } else {
             $activating_text = $translator->getMessage('COMMON_ACTIVATING_DATE') . ' ' . getDateInLang($this->_item->getActivatingDate());
         }
         $temp_array = array();
         $temp_array[] = $translator->getMessage('COMMON_RIGHTS');
         $temp_array[] = $activating_text;
         $return[] = $temp_array;
     }
     // bibliography
     $bib_kind = $this->_item->getBibKind() ? $this->_item->getBibKind() : 'none';
     $biblio = '';
     // author, year
     $temp_array = array();
     if ($bib_kind === 'common') {
         $author = $this->_item->getAuthor();
         if (!empty($author)) {
             $temp_array[0] = $translator->getMessage('MATERIAL_AUTHORS');
             $temp_array[1] = $converter->text_as_html_short($this->_item->getAuthor());
             $return[] = $temp_array;
         }
         $pub_date = $this->_item->getPublishingDate();
         if (!empty($pub_date)) {
             $temp_array[0] = $translator->getMessage('MATERIAL_PUBLISHING_DATE');
             $temp_array[1] = $converter->text_as_html_short($this->_item->getPublishingDate());
             $return[] = $temp_array;
         }
         /*
         if(!empty($return)) {
         	$html .= $this->_getFormalDataAsHTML($return);
         		            if ( isset($html_script) and !empty($html_script) ) {
         		               $html .= $html_script;
         		            }
         }
         */
         //$return = array();
         $temp_array = array();
         $biblio = $this->_item->getBibliographicValues();
     } elseif ($bib_kind === 'website') {
         $biblio = $this->_item->getAuthor() . ',';
     } elseif ($bib_kind === 'document') {
         $biblio = '';
     } else {
         $biblio = $this->_item->getAuthor() . ' (' . $this->_item->getPublishingDate() . '). ';
     }
     if ($bib_kind !== 'common') {
         // bibliographic
         switch ($bib_kind) {
             case 'book':
             case 'collection':
                 $biblio .= $this->_item->getAddress() . ': ' . $this->_item->getPublisher();
                 if ($this->_item->getEdition()) {
                     $biblio .= ', ' . $translator->getMessage('MATERIAL_BIB_EDITION', $this->_item->getEdition());
                 }
                 if ($this->_item->getSeries()) {
                     $biblio .= ', ' . $translator->getMessage('MATERIAL_BIB_SERIES', $this->_item->getSeries());
                 }
                 if ($this->_item->getVolume()) {
                     $biblio .= ', ' . $translator->getMessage('MATERIAL_BIB_VOLUME', $this->_item->getVolume());
                 }
                 if ($this->_item->getISBN()) {
                     $biblio .= ', ' . $translator->getMessage('MATERIAL_BIB_ISBN', $this->_item->getISBN());
                 }
                 $biblio .= '.';
                 if ($this->_item->getURL()) {
                     $biblio .= ' ' . $translator->getMessage('MATERIAL_BIB_URL', $this->_item->getURL());
                 }
                 if ($this->_item->getURLDate()) {
                     $biblio .= ' (' . $translator->getMessage('MATERIAL_BIB_URL_DATE', $this->_item->getURLDate()) . ')';
                     $biblio .= '.';
                 }
                 break;
             case 'incollection':
                 $editor = $this->_item->getEditor();
                 if (!empty($editor)) {
                     $biblio .= $translator->getMessage('MATERIAL_BIB_IN') . ': ';
                     $biblio .= $translator->getMessage('MATERIAL_BIB_EDITOR', $this->_item->getEditor()) . ': ';
                 }
                 $biblio .= $this->_item->getBooktitle() . '. ';
                 $biblio .= $this->_item->getAddress() . ': ' . $this->_item->getPublisher();
                 if ($this->_item->getEdition()) {
                     $biblio .= ', ' . $translator->getMessage('MATERIAL_BIB_EDITION', $this->_item->getEdition());
                 }
                 if ($this->_item->getSeries()) {
                     $biblio .= ', ' . $translator->getMessage('MATERIAL_BIB_SERIES', $this->_item->getSeries());
                 }
                 if ($this->_item->getVolume()) {
                     $biblio .= ', ' . $translator->getMessage('MATERIAL_BIB_VOLUME', $this->_item->getVolume());
                 }
                 if ($this->_item->getISBN()) {
                     $biblio .= ', ' . $translator->getMessage('MATERIAL_BIB_ISBN', $this->_item->getISBN());
                 }
                 $biblio .= ', ' . $translator->getMessage('MATERIAL_BIB_PAGES', $this->_item->getPages()) . '.';
                 if ($this->_item->getURL()) {
                     $biblio .= ' ' . $translator->getMessage('MATERIAL_BIB_URL', $this->_item->getURL());
                 }
                 if ($this->_item->getURLDate()) {
                     $biblio .= ' (' . $translator->getMessage('MATERIAL_BIB_URL_DATE', $this->_item->getURLDate()) . ')';
                     $biblio .= '.';
                 }
                 break;
             case 'article':
                 $biblio .= $translator->getMessage('MATERIAL_BIB_IN') . ': ' . $this->_item->getJournal();
                 if ($this->_item->getVolume()) {
                     $biblio .= ', ' . $this->_item->getVolume();
                     if ($this->_item->getIssue()) {
                         $biblio .= ' (' . $this->_item->getIssue() . ')';
                     }
                 } elseif ($this->_item->getIssue()) {
                     $biblio .= ', ' . $this->_item->getIssue();
                 }
                 $biblio .= ', ' . $translator->getMessage('MATERIAL_BIB_PAGES', $this->_item->getPages()) . '. ';
                 $bib2 = '';
                 if ($this->_item->getAddress()) {
                     $bib2 .= $this->_item->getAddress();
                 }
                 if ($this->_item->getPublisher()) {
                     $bib2 .= $bib2 ? ', ' : '';
                     $bib2 .= $this->_item->getPublisher();
                 }
                 if ($this->_item->getISSN()) {
                     $bib2 .= $bib2 ? ', ' : '';
                     $bib2 .= $this->_item->getISSN();
                 }
                 $bib2 .= $bib2 ? '. ' : '';
                 $biblio .= $bib2 ? $bib2 : '';
                 if ($this->_item->getURL()) {
                     $biblio .= ' ' . $translator->getMessage('MATERIAL_BIB_URL', $this->_item->getURL());
                 }
                 if ($this->_item->getURLDate()) {
                     $biblio .= ' (' . $translator->getMessage('MATERIAL_BIB_URL_DATE', $this->_item->getURLDate()) . ')';
                     $biblio .= '.';
                 }
                 break;
             case 'inpaper':
                 $biblio .= $translator->getMessage('MATERIAL_BIB_IN') . ': ' . $this->_item->getJournal();
                 if ($this->_item->getIssue()) {
                     $biblio .= ', ' . $this->_item->getIssue();
                 }
                 $biblio .= ', ' . $translator->getMessage('MATERIAL_BIB_PAGES', $this->_item->getPages()) . '. ';
                 $bib2 = '';
                 if ($this->_item->getAddress()) {
                     $bib2 .= $this->_item->getAddress();
                 }
                 if ($this->_item->getPublisher()) {
                     $bib2 .= $bib2 ? ', ' : '';
                     $bib2 .= $this->_item->getPublisher();
                 }
                 $bib2 .= $bib2 ? '. ' : '';
                 $biblio .= $bib2 ? $bib2 : '';
                 if ($this->_item->getURL()) {
                     $biblio .= ' ' . $translator->getMessage('MATERIAL_BIB_URL', $this->_item->getURL());
                     if ($this->_item->getURLDate()) {
                         $biblio .= ' (' . $translator->getMessage('MATERIAL_BIB_URL_DATE', $this->_item->getURLDate()) . ')';
                     }
                     $biblio .= '.';
                 }
                 break;
             case 'thesis':
                 $temp_Thesis_Kind = mb_strtoupper($this->_item->getThesisKind(), 'UTF-8');
                 switch ($temp_Thesis_Kind) {
                     case 'BACHELOR':
                         $biblio .= $translator->getMessage('MATERIAL_THESIS_BACHELOR') . '. ';
                         break;
                     case 'DIPLOMA':
                         $biblio .= $translator->getMessage('MATERIAL_THESIS_DIPLOMA') . '. ';
                         break;
                     case 'DISSERTATION':
                         $biblio .= $translator->getMessage('MATERIAL_THESIS_DISSERTATION') . '. ';
                         break;
                     case 'EXAM':
                         $biblio .= $translator->getMessage('MATERIAL_THESIS_EXAM') . '. ';
                         break;
                     case 'KIND':
                         $biblio .= $translator->getMessage('MATERIAL_THESIS_KIND') . '. ';
                         break;
                     case 'KIND_DESC':
                         $biblio .= $translator->getMessage('MATERIAL_THESIS_KIND_DESC') . '. ';
                         break;
                     case 'MASTER':
                         $biblio .= $translator->getMessage('MATERIAL_THESIS_MASTER') . '. ';
                         break;
                     case 'OTHER':
                         $biblio .= $translator->getMessage('MATERIAL_THESIS_OTHER') . '. ';
                         break;
                     case 'POSTDOC':
                         $biblio .= $translator->getMessage('MATERIAL_THESIS_POSTDOC') . '. ';
                         break;
                     case 'TERM':
                         $biblio .= $translator->getMessage('MATERIAL_THESIS_TERM') . '. ';
                         break;
                     default:
                         $biblio .= $translator->getMessage('COMMON_MESSAGETAG_ERROR') . ' cs_material_detail_view(446) ';
                         break;
                 }
                 $biblio .= $this->_item->getAddress() . ': ' . $this->_item->getUniversity();
                 if ($this->_item->getFaculty()) {
                     $biblio .= ', ' . $this->_item->getFaculty();
                 }
                 $biblio .= '.';
                 if ($this->_item->getURL()) {
                     $biblio .= ' ' . $translator->getMessage('MATERIAL_BIB_URL', $this->_item->getURL());
                     if ($this->_item->getURLDate()) {
                         $biblio .= ' (' . $translator->getMessage('MATERIAL_BIB_URL_DATE', $this->_item->getURLDate()) . ')';
                     }
                     $biblio .= '.';
                 }
                 break;
             case 'website':
                 $biblio .= ' ' . $translator->getMessage('MATERIAL_BIB_URL', $converter->textFullHTMLFormatting($this->_item->getURL()));
                 if ($this->_item->getURLDate()) {
                     $biblio .= ' (' . $translator->getMessage('MATERIAL_BIB_URL_DATE', $this->_item->getURLDate()) . ')';
                 }
                 $biblio .= '.';
                 break;
             case 'manuscript':
                 $biblio .= $this->_item->getBibliographicValues();
                 if ($this->_item->getAddress()) {
                     $biblio .= ' ' . $this->_item->getAddress();
                     $biblio .= '.';
                 }
                 if ($this->_item->getURL()) {
                     $biblio .= ' ' . $translator->getMessage('MATERIAL_BIB_URL', $this->_item->getURL());
                     if ($this->_item->getURLDate()) {
                         $biblio .= ' (' . $translator->getMessage('MATERIAL_BIB_URL_DATE', $this->_item->getURLDate()) . ')';
                     }
                     $biblio .= '.';
                 }
                 break;
             case 'document':
                 $formal_data_bib = array();
                 $html .= $translator->getMessage('MATERIAL_BIB_DOCUMENT_ADMINISTRATION_INFO');
                 if ($this->_item->getDocumentEditor()) {
                     $temp_array = array();
                     $temp_array[] = $translator->getMessage('MATERIAL_BIB_DOCUMENT_EDITOR');
                     $temp_array[] = $this->_item->getDocumentEditor();
                     $return[] = $temp_array;
                 }
                 if ($this->_item->getDocumentMaintainer()) {
                     $temp_array = array();
                     $temp_array[] = $translator->getMessage('MATERIAL_BIB_DOCUMENT_MAINTAINER');
                     $temp_array[] = $this->_item->getDocumentMaintainer();
                     $return[] = $temp_array;
                 }
                 if ($this->_item->getDocumentReleaseNumber()) {
                     $temp_array = array();
                     $temp_array[] = $translator->getMessage('MATERIAL_BIB_DOCUMENT_RELEASE_NUMBER');
                     $temp_array[] = $this->_item->getDocumentReleaseNumber();
                     $return[] = $temp_array;
                 }
                 if ($this->_item->getDocumentReleaseDate()) {
                     $temp_array = array();
                     $temp_array[] = $translator->getMessage('MATERIAL_BIB_DOCUMENT_RELEASE_DATE');
                     $temp_array[] = $this->_item->getDocumentReleaseDate();
                     $return[] = $temp_array;
                 }
                 break;
             case 'foto':
                 $formal_data_bib = array();
                 if ($this->_item->getFotoCopyright()) {
                     $temp_array = array();
                     $temp_array[] = $translator->getMessage('MATERIAL_BIB_FOTO_COPYRIGHT');
                     $temp_array[] = $this->_item->getFotoCopyright();
                     $return[] = $temp_array;
                 }
                 if ($this->_item->getFotoReason()) {
                     $temp_array = array();
                     $temp_array[] = $translator->getMessage('MATERIAL_BIB_FOTO_REASON');
                     $temp_array[] = $this->_item->getFotoReason();
                     $return[] = $temp_array;
                 }
                 if ($this->_item->getFotoDate()) {
                     $temp_array = array();
                     $temp_array[] = $translator->getMessage('MATERIAL_BIB_FOTO_DATE');
                     $temp_array[] = $this->_item->getFotoDate();
                     $return[] = $temp_array;
                 }
                 break;
             case 'none':
             default:
                 $biblio .= $this->_item->getBibliographicValues();
         }
     }
     $biblio_pur = strip_tags($biblio);
     $biblio_pur = str_ireplace('&nbsp;', '', $biblio_pur);
     $biblio_pur = trim($biblio_pur);
     if ($bib_kind !== 'none' && !empty($biblio_pur)) {
         $temp_array = array();
         $temp_array[] = $translator->getMessage('MATERIAL_BIBLIOGRAPHIC');
         if (!empty($biblio)) {
             $converter->setFileArray($this->getItemFileList());
             $temp_array[] = $biblio;
             //$converter->text_as_html_long($converter->cleanDataFromTextArea($biblio));
         } else {
             $temp_array[] = '<span class="disabled"> ' . $translator->getMessage('COMON_NONE') . '</span>';
         }
         $return[] = $temp_array;
     }
     if ($this->_item->issetBibTOC()) {
         $temp_array = array();
         $temp_array[] = $translator->getMessage('COMMON_TABLE_OF_CONTENT');
         $temp_array[] = '<a href"' . $this->_item->getBibTOC() . '" target="blank">' . chunkText($this->_item->getBibTOC(), 60) . '</a>';
         $return[] = $temp_array;
     }
     if ($this->_item->issetBibURL()) {
         $temp_array = array();
         $temp_array[] = $translator->getMessage('BELUGA_LINK');
         $temp_array[] = '<a href="' . $this->_item->getBibURL() . '" target="balnk">' . chunkText($this->_item->getBibURL(), 60) . '</a>';
         $return[] = $temp_array;
     }
     if ($this->_item->issetBibAvailibility()) {
         $temp_array = array();
         $temp_array[] = $translator->getMessage('BELUGA_AVAILABILITY');
         $link = $this->_item->getBibAvailibility();
         $temp_array[] = $link;
         $return[] = $temp_array;
     }
     global $c_pmwiki;
     if ($c_pmwiki and $context_item->isWikiActive()) {
         if ($this->_item->isExportToWiki()) {
             $temp_array = array();
             $temp_array[] = $translator->getMessage('MATERIAL_EXPORT_TO_WIKI_LINK');
             $temp_array[] = $this->_item->getExportToWikiLink();
             $return[] = $temp_array;
         }
     }
     #global $c_wordpress;
     if ($portal_item->getWordpressPortalActive() and $context_item->isWordpressActive()) {
         if ($this->_item->isExporttoWordpress()) {
             $temp_array = array();
             $temp_array[] = $translator->getMessage('MATERIAL_EXPORT_TO_WORDPRESS_LINK');
             $temp_array[] = $this->_item->getExportToWordpressLink();
             $return[] = $temp_array;
         }
     }
     // files
     $files = array();
     $file_list = $this->_item->getFileList();
     if (!$file_list->isEmpty()) {
         $file = $file_list->getFirst();
         while ($file) {
             // truncate
             if (strlen($file->getDisplayName()) > 70) {
                 $file_name = $converter->filenameFormatting(substr($file->getDisplayName(), 0, 70)) . '...';
             } else {
                 $file_name = $converter->filenameFormatting($file->getDisplayName());
             }
             if (!(isset($_GET['mode']) && $_GET['mode'] === 'print') || isset($_GET['download']) && $_GET['download'] === 'zip') {
                 if ((!isset($_GET['download']) || $_GET['download'] !== 'zip') && in_array($file->getExtension(), array('png', 'jpg', 'jpeg', 'gif'))) {
                     //$this->_with_slimbox = true;
                     #$file_string = '<a href="' . $file->getUrl() . '" class="lightbox_' . $this->_item->getItemID() . '">' . $file->getFileIcon() . ' ' . ($converter->text_as_html_short($file->getDisplayName())) . '</a> (' . $file->getFileSize() . ' KB)';
                     $file_string = '<a href="' . $file->getUrl() . '" class="lightbox_' . $this->_item->getItemID() . '">' . $file->getFileIcon() . ' ' . $converter->filenameFormatting(substr($file->getDisplayName(), 0, 100)) . '</a> (' . $file->getFileSize() . ' KB)';
                 } else {
                     #$file_string = '<a href="' . $file->getUrl() . '" target="blank">' . $file->getFileIcon() . ' ' . ($converter->text_as_html_short($file->getDisplayName())) . '</a> (' . $file->getFileSize() . ' KB)';
                     $file_string = '<a href="' . $file->getUrl() . '" target="blank">' . $file->getFileIcon() . ' ' . $file_name . '</a> (' . $file->getFileSize() . ' KB)';
                 }
             } else {
                 $file_string = $file->getFileIcon() . ' ' . $converter->text_as_html_short($file->getDisplayName());
             }
             $files[] = $file_string;
             $file = $file_list->getNext();
         }
         $temp_array = array();
         $temp_array[] = $translator->getMessage('MATERIAL_FILES');
         $temp_array[] = implode(BRLF, $files);
         $return[] = $temp_array;
     }
     // world-public status
     if ($context_item->isCommunityRoom() && $context_item->isOpenForGuests()) {
         $temp_array = array();
         $wrold_public = $this->_item->getWorldPublic();
         if ($world_public === 0) {
             $public_info = $translator->getMessage('MATERIAL_WORLD_PUBLISH_STATUS_0');
         } elseif ($world_public === 1) {
             $public_info = $translator->getMessage('MATERIAL_WORLD_PUBLISH_STATUS_1');
         } elseif ($world_public === 2) {
             $public_info = $translator->getMessage('MATERIAL_WORLD_PUBLISH_STATUS_2');
         }
         $temp_array[] = $translator->getMessage('MATERIAL_WORLD_PUBLISH');
         $temp_array[] = $public_info;
         $return[] = $temp_array;
     }
     $version_mode = 'long';
     $iid = 0;
     $params = $this->_environment->getCurrentParameterArray();
     if (isset($params['iid'])) {
         $iid = $params['iid'];
     }
     $show_version = 'false';
     if (isset($params[$iid . 'version_mode']) && $params[$iid . 'version_mode'] === 'long') {
         $sho_versions = 'true';
     }
     $params[$iid . 'version_mode'] = 'long';
     // versions
     /*$versions = array();
     			if(!$this->_version_list->isEmpty()) {
     				$version = $this->_version_list->getFirst();
     
     				if($version->getVersionID() === $this->_item->getVersionID()) {
     					$title = '&nbsp;&nbsp;'.$translator->getMessage('MATERIAL_CURRENT_VERSION_DATE').' '.getDateTimeInLang($version->getModificationDate());
     				} else {
     					// TODO:
     					 $params = array();
                $params[$iid.'version_mode'] = 'long';
                $params['iid'] = $version->getItemID();
                $title = '&nbsp;&nbsp;'.ahref_curl($this->_environment->getCurrentContextID(), 'material', 'detail', $params,$this->_translator->getMessage('MATERIAL_CURRENT_VERSION_DATE').' '.getDateTimeInLang($version->getModificationDate()));
                unset($params);
     				}
     
     				$version = $this->_version_list->getNext();
     				$is_user = $current_user->isUser();
     
     				while($version) {*/
     /*
     *
     if ( !$with_links
                      or ( !$is_user
                           and $this->_environment->inCommunityRoom()
                           and !$version->isWorldPublic()
                         )
                      or $item->getVersionID() == $version->getVersionID()
                    ) {
                    $versions[] = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$this->_translator->getMessage('MATERIAL_VERSION_DATE').' '.getDateTimeInLang($version->getModificationDate());
                 } else {
                    $params = array();
                    $params[$iid.'version_mode'] = 'long';
                    $params['iid'] = $version->getItemID();
                    $params['version_id'] = $version->getVersionID();
                    $versions[] = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.ahref_curl($this->_environment->getCurrentContextID(), 'material', 'detail', $params,$this->_translator->getMessage('MATERIAL_VERSION_DATE').' '.getDateTimeInLang($version->getModificationDate()));
                    unset($params);
                 }
     *
     */
     /*		$version = $this->_version_list->getNext();
     				}
     				$count = $this->_version_list->getCount();
     
     				if(!empty($version) && $count > 1) {
     					$temp_array = array();
     					$temp_array[] = $this->_translator->getMessage('MATERIAL_VERSION');
     					// TODO:
     			            $html_string ='&nbsp;<img id="toggle'.$item->getItemID().$item->getVersionID().'" src="images/more.gif"/>';
     			            $html_string .= $title;
     			            $html_string .= '<div id="creator_information'.$item->getItemID().$item->getVersionID().'">'.LF;
     			            $html_string .= '<div class="creator_information_panel">     '.LF;
     			            $html_string .= '<div>'.LF;
     			            if ($show_versions == 'true'){
     			               $html_script ='<script type="text/javascript">initCreatorInformations("'.$item->getItemID().$item->getVersionID().'",true)</script>';
     			            }else{
     			               $html_script ='<script type="text/javascript">initCreatorInformations("'.$item->getItemID().$item->getVersionID().'",false)</script>';
     			            }
     			            if($with_links) {
     			               $html_string .= implode(BRLF, $versions);
     			            } else {
     			               $version_count = count ($versions);
     			               $html_string .= "$version_count. ".$versions[0];
     			            }
     			            $html_string .= '</div>'.LF;
     			            $html_string .= '</div>'.LF;
     			            $html_string .= '</div>'.LF;
     			            $temp_array[] = $html_string;
     			            $formal_data1[] = $temp_array;
     				}
     			}*/
     $material_manager = $this->_environment->getMaterialManager();
     $material_version_list = $material_manager->getVersionList($this->_item->getItemID());
     if ($material_version_list->getCount() > 1) {
         $translator = $this->_environment->getTranslationObject();
         $material_versions_array = array();
         $temp_material_item = $material_version_list->getFirst();
         if ($temp_material_item->getVersionID() == $this->_item->getVersionID()) {
             $material_versions_array[] = $translator->getMessage('MATERIAL_CURRENT_VERSION_DATE') . ' ' . getDateTimeInLang($temp_material_item->getModificationDate());
         } else {
             $params = array();
             $params[$iid . 'version_mode'] = 'long';
             $params['iid'] = $temp_material_item->getItemID();
             $material_versions_array[] = ahref_curl($this->_environment->getCurrentContextID(), 'material', 'detail', $params, $translator->getMessage('MATERIAL_CURRENT_VERSION_DATE') . ' ' . getDateTimeInLang($temp_material_item->getModificationDate()));
             unset($params);
         }
         $temp_material_item = $material_version_list->getNext();
         $current_user = $this->_environment->getCurrentUserItem();
         $is_user = $current_user->isUser();
         while ($temp_material_item) {
             if ($this->_item->getVersionID() == $temp_material_item->getVersionID()) {
                 $material_versions_array[] = $translator->getMessage('MATERIAL_VERSION_DATE') . ' ' . getDateTimeInLang($temp_material_item->getModificationDate());
             } else {
                 $params = array();
                 $params[$iid . 'version_mode'] = 'long';
                 $params['iid'] = $temp_material_item->getItemID();
                 $params['version_id'] = $temp_material_item->getVersionID();
                 $material_versions_array[] = ahref_curl($this->_environment->getCurrentContextID(), 'material', 'detail', $params, $translator->getMessage('MATERIAL_VERSION_DATE') . ' ' . getDateTimeInLang($temp_material_item->getModificationDate()));
                 unset($params);
             }
             $temp_material_item = $material_version_list->getNext();
         }
         $this->assign('detail', 'versions', $material_version_list->getCount());
         $this->assign('detail', 'versions_array', $material_versions_array);
         if (isset($_GET['version_id'])) {
             $this->assign('detail', 'is_versions_bar_visible', true);
         }
         $latest_material_item = $material_version_list->getFirst();
         if ($latest_material_item->getVersionID() != $this->_item->getVersionID()) {
             $this->assign('detail', 'not_latest_version', true);
         }
     }
     // TODO:
     /*
     if(!empty($formal_data1)) {
     		$html .= $this->_getFormalDataAsHTML($formal_data1);
     		         if ( isset($html_script) and !empty($html_script) ) {
     		            $html .= $html_script;
     		         }
     }
     */
     // wordpress export
     #global $c_wordpress;
     if ($portal_item->getWordpressPortalActive() and $context_item->isWordpressActive() and !isset($_GET['version_id'])) {
         $wordpress_manager = $this->_environment->getWordpressManager();
         if ($this->_item->mayEdit($current_user)) {
             $this->assign('detail', 'export_to_wordpress', true);
         } else {
             if ($context_item->isWordpressActive()) {
                 $this->assign('detail', 'export_to_wordpress_not_allowed', true);
             }
         }
     }
     // wiki export
     global $c_pmwiki;
     if ($c_pmwiki and $context_item->isWikiActive() and !isset($_GET['version_id'])) {
         $this->assign('detail', 'export_to_wiki', true);
     }
     return $return;
 }
 private function getDiscArticleContentLinear($articles_list)
 {
     $noticed_manager = $this->_environment->getNoticedManager();
     $reader_manager = $this->_environment->getReaderManager();
     $return = array();
     // go through list
     $item = $articles_list->getFirst();
     $converter = $this->_environment->getTextConverter();
     $translator = $this->_environment->getTranslationObject();
     $current_user = $this->_environment->getCurrentUserItem();
     $disc_manager = $this->_environment->getDiscManager();
     $position = 0;
     while ($item) {
         $attachment_infos = array();
         // files
         $files = $item->getFileList();
         if (!$files->isEmpty()) {
             $file = $files->getFirst();
             while ($file) {
                 if ((!isset($_GET['download']) || $_GET['download'] !== 'zip') && in_array($file->getExtension(), array('png', 'jpg', 'jpeg', 'gif'))) {
                     $file_string = '<a class="lightbox_' . $this->_item->getItemID() . '" href="' . $file->getUrl() . '" target="blank">';
                     $name = $file->getDisplayName();
                     //TODO:
                     //$name = $converter->compareWithSearchText($name);
                     $name = $converter->text_as_html_short($name);
                     $file_string .= $name . ' ' . $file->getFileIcon() . ' ' . '</a> (' . $file->getFileSize() . ' KB)';
                 } else {
                     $file_string = '<a href="' . $file->getUrl() . '" target="blank">' . $file->getFileIcon() . ' ' . $converter->text_as_html_short($file->getDisplayName()) . '</a> (' . $file->getFileSize() . ' KB)';
                 }
                 $tmp_array = array();
                 $tmp_array['name'] = $file_string;
                 if ((!isset($_GET['download']) || $_GET['download'] !== 'zip') && in_array($file->getExtension(), array('png', 'jpg', 'jpeg', 'gif'))) {
                     $tmp_array['icon'] = '<a class="lightbox_' . $this->_item->getItemID() . '" href="' . $file->getUrl() . '" target="blank">' . $file->getFileIcon() . '</a>';
                 } else {
                     $tmp_array['icon'] = '<a href="' . $file->getUrl() . '" target="blank">' . $file->getFileIcon() . '</a>';
                 }
                 $file_array[] = $tmp_array;
                 $lightbox = false;
                 if ((!isset($_GET['download']) || $_GET['download'] !== 'zip') && in_array($file->getExtension(), array('png', 'jpg', 'jpeg', 'gif'))) {
                     $lightbox = true;
                 }
                 $info = array();
                 $info['file_name'] = $converter->text_as_html_short($file->getDisplayName());
                 $info['file_icon'] = $file->getFileIcon();
                 $info['file_url'] = $file->getURL();
                 $info['file_size'] = $file->getFileSize();
                 $info['lightbox'] = $lightbox;
                 $attachment_infos[] = $info;
                 $file = $files->getNext();
             }
             $entry['files'] = $file_array;
             $file_array = array();
         }
         // creator
         $creator = $item->getCreatorItem();
         $creator_fullname = '';
         $modificator_image = '';
         $image = '';
         // TODO: implement over general detail_controller.php
         if (isset($creator)) {
             $current_user_item = $this->_environment->getCurrentUserItem();
             if ($current_user_item->isGuest() && $creator->isVisibleForLoggedIn()) {
                 $creator_fullname = $translator->getMessage('COMMON_USER_NOT_VISIBLE');
             } else {
                 $creator_fullname = $creator->getFullName();
                 $modificator_item = $item->getModificatorItem();
                 $image = $modificator_item->getPicture();
                 if (!empty($image)) {
                     if ($disc_manager->existsFile($image)) {
                         $modificator_image = $image;
                     }
                 }
             }
         }
         // noticed
         $noticed = '';
         if ($current_user->isUser()) {
             $noticed = $noticed_manager->getLatestNoticed($item->getItemID());
             if (empty($noticed)) {
                 // new
                 $noticed = 'new';
             } elseif ($noticed['read_date'] < $item->getModificationDate()) {
                 // changed
                 $noticed = 'changed';
             }
         }
         // description
         $converter = $this->_environment->getTextConverter();
         $description = $item->getDescription();
         //$description = $converter->cleanDataFromTextArea($description);
         $converter->setFileArray($this->getItemFileList());
         if ($this->_with_old_text_formating) {
             $description = $converter->textFullHTMLFormatting($description);
         } else {
             $description = $converter->textFullHTMLFormatting($description);
             $description = $converter->showImages($description, $item, true);
         }
         //$retour .= $this->getScrollableContent($desc,$item,'',true).LF;
         // append return
         $return[] = array('item_id' => $item->getItemID(), 'subject' => $item->getSubject(), 'description' => $description, 'creator' => $creator_fullname, 'position' => $position, 'modification_date' => getDateTimeInLang($item->getModificationDate(), false), 'num_attachments' => $files->getCount(), 'attachment_infos' => $attachment_infos, 'noticed' => $noticed, 'modificator_image' => $modificator_image, 'custom_image' => !empty($image), 'actions' => $this->getEditActions($item, $current_user), 'moredetails' => $this->getCreatorInformationAsArray($item), 'formal' => $entry);
         $position++;
         $entry = array();
         $item = $articles_list->getNext();
     }
     return $return;
 }
Ejemplo n.º 21
0
 public function actionInit()
 {
     $response = array();
     $iid = $this->_data['itemId'];
     $current_user = $this->_environment->getCurrentUserItem();
     $current_context = $this->_environment->getCurrentContextItem();
     $translator = $this->_environment->getTranslationObject();
     // context information
     $contextInformation = array();
     $contextInformation["name"] = $current_context->getTitle();
     $response['context'] = $contextInformation;
     // group information
     $groupArray = $this->getAllLabelsByType("group");
     // institutions information
     $institutionArray = $this->getAllLabelsByType("institution");
     // get item
     $manager = $this->_environment->getItemManager();
     $item = $manager->getItem($iid);
     $module = $item->getItemType();
     $link_module = $module;
     if ($module == 'label' or $module == 'labels') {
         $label_manager = $this->_environment->getLabelManager();
         $label = $label_manager->getItem($iid);
         $link_module = $label->getLabelType();
     }
     $item_manager = $this->_environment->getManager($module);
     $item = $item_manager->getItem($iid);
     $item_name = $item->getTitle();
     // Wenn man mit HTTPS auf Commsy surft und eine Email generiert
     // sollte diese Mail auch https links erstellen.
     if (!empty($_SERVER["HTTPS"]) and $_SERVER["HTTPS"]) {
         $url = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?cid=' . $this->_environment->getCurrentContextID() . '&mod=' . $link_module . '&fct=detail' . '&iid=' . $item->getItemID();
     } else {
         $url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?cid=' . $this->_environment->getCurrentContextID() . '&mod=' . $link_module . '&fct=detail' . '&iid=' . $item->getItemID();
     }
     $link = $url;
     $content = '';
     //generate module name for the interface- a pretty version of module...
     if ($module == CS_DATE_TYPE) {
         // set up style of days and times
         $parse_time_start = convertTimeFromInput($item->getStartingTime());
         $conforms = $parse_time_start['conforms'];
         if ($conforms == TRUE) {
             $start_time_print = getTimeLanguage($parse_time_start['datetime']);
         } else {
             $start_time_print = $item->getStartingTime();
         }
         $parse_time_end = convertTimeFromInput($item->getEndingTime());
         $conforms = $parse_time_end['conforms'];
         if ($conforms == TRUE) {
             $end_time_print = getTimeLanguage($parse_time_end['datetime']);
         } else {
             $end_time_print = $item->getEndingTime();
         }
         $parse_day_start = convertDateFromInput($item->getStartingDay(), $this->_environment->getSelectedLanguage());
         $conforms = $parse_day_start['conforms'];
         if ($conforms == TRUE) {
             $start_day_print = getDateInLang($parse_day_start['datetime']);
         } else {
             $start_day_print = $item->getStartingDay();
         }
         $parse_day_end = convertDateFromInput($item->getEndingDay(), $this->_environment->getSelectedLanguage());
         $conforms = $parse_day_end['conforms'];
         if ($conforms == TRUE) {
             $end_day_print = getDateLanguage($parse_day_end['datetime']);
         } else {
             $end_day_print = $item->getEndingDay();
         }
         //formating dates and times for displaying
         $date_print = "";
         $time_print = "";
         if ($end_day_print != "") {
             //with ending day
             $date_print = $translator->getMessage('DATES_AS_OF') . ' ' . $start_day_print . ' ' . $translator->getMessage('DATES_TILL') . ' ' . $end_day_print;
             if ($parse_day_start['conforms'] and $parse_day_end['conforms']) {
                 //start and end are dates, not strings
                 $date_print .= ' (' . getDifference($parse_day_start['timestamp'], $parse_day_end['timestamp']) . ' ' . $translator->getMessage('DATES_DAYS') . ')';
             }
             if ($start_time_print != "" and $end_time_print == "") {
                 //starting time given
                 $time_print = $translator->getMessage('DATES_AS_OF_LOWER') . ' ' . $start_time_print;
                 if ($parse_time_start['conforms'] == true) {
                     $time_print .= ' ' . $translator->getMessage('DATES_OCLOCK');
                 }
             } elseif ($start_time_print == "" and $end_time_print != "") {
                 //endtime given
                 $time_print = $translator->getMessage('DATES_TILL') . ' ' . $end_time_print;
                 if ($parse_time_end['conforms'] == true) {
                     $time_print .= ' ' . $translator->getMessage('DATES_OCLOCK');
                 }
             } elseif ($start_time_print != "" and $end_time_print != "") {
                 //all times given
                 if ($parse_time_end['conforms'] == true) {
                     $end_time_print .= ' ' . $translator->getMessage('DATES_OCLOCK');
                 }
                 if ($parse_time_start['conforms'] == true) {
                     $start_time_print .= ' ' . $translator->getMessage('DATES_OCLOCK');
                 }
                 $date_print = $translator->getMessage('DATES_AS_OF') . ' ' . $start_day_print . ', ' . $start_time_print . '<br />' . $translator->getMessage('DATES_TILL') . ' ' . $end_day_print . ', ' . $end_time_print;
                 if ($parse_day_start['conforms'] and $parse_day_end['conforms']) {
                     $date_print .= ' (' . getDifference($parse_day_start['timestamp'], $parse_day_end['timestamp']) . ' ' . $translator->getMessage('DATES_DAYS') . ')';
                 }
             }
         } else {
             //without ending day
             $date_print = $start_day_print;
             if ($start_time_print != "" and $end_time_print == "") {
                 //starting time given
                 $time_print = $translator->getMessage('DATES_AS_OF_LOWER') . ' ' . $start_time_print;
                 if ($parse_time_start['conforms'] == true) {
                     $time_print .= ' ' . $translator->getMessage('DATES_OCLOCK');
                 }
             } elseif ($start_time_print == "" and $end_time_print != "") {
                 //endtime given
                 $time_print = $translator->getMessage('DATES_TILL') . ' ' . $end_time_print;
                 if ($parse_time_end['conforms'] == true) {
                     $time_print .= ' ' . $translator->getMessage('DATES_OCLOCK');
                 }
             } elseif ($start_time_print != "" and $end_time_print != "") {
                 //all times given
                 if ($parse_time_end['conforms'] == true) {
                     $end_time_print .= ' ' . $translator->getMessage('DATES_OCLOCK');
                 }
                 if ($parse_time_start['conforms'] == true) {
                     $start_time_print .= ' ' . $translator->getMessage('DATES_OCLOCK');
                 }
                 $time_print = $translator->getMessage('DATES_FROM_TIME_LOWER') . ' ' . $start_time_print . ' ' . $translator->getMessage('DATES_TILL') . ' ' . $end_time_print;
             }
         }
         if ($parse_day_start['timestamp'] == $parse_day_end['timestamp'] and $parse_day_start['conforms'] and $parse_day_end['conforms']) {
             $date_print = $translator->getMessage('DATES_ON_DAY') . ' ' . $start_day_print;
             if ($start_time_print != "" and $end_time_print == "") {
                 //starting time given
                 $time_print = $translator->getMessage('DATES_AS_OF_LOWER') . ' ' . $start_time_print;
             } elseif ($start_time_print == "" and $end_time_print != "") {
                 //endtime given
                 $time_print = $translator->getMessage('DATES_TILL') . ' ' . $end_time_print;
             } elseif ($start_time_print != "" and $end_time_print != "") {
                 //all times given
                 $time_print = $translator->getMessage('DATES_FROM_TIME_LOWER') . ' ' . $start_time_print . ' ' . $translator->getMessage('DATES_TILL') . ' ' . $end_time_print;
             }
         }
         // Date and time
         $dates_content = '';
         $dates_content = $translator->getMessage('DATES_DATETIME') . ': ' . $item_name . LF;
         if ($time_print != '') {
             $dates_content .= $translator->getMessage('COMMON_TIME') . ': ' . $date_print . ',' . $time_print . LF;
         } else {
             $dates_content .= $translator->getMessage('COMMON_TIME') . ': ' . $date_print . LF;
         }
         // Place
         $place = $item->getPlace();
         if (!empty($place)) {
             $dates_content .= $translator->getMessage('DATES_PLACE') . ': ';
             $dates_content .= $place . LF;
         }
         $content = $dates_content;
     } elseif ($module == 'discussion' or $module == 'discussions') {
         $discussion_content = $translator->getMessage('COMMON_DISCUSSION') . ': ' . $item->getTitle() . LF;
         $article_count = $item->getAllArticlesCount();
         $discussion_content .= $translator->getMessage('DISCUSSION_DISCARTICLE_COUNT') . ': ' . $article_count . LF;
         $time = $item->getLatestArticleModificationDate();
         $discussion_content .= $translator->getMessage('DISCUSSION_LAST_ENTRY') . ': ' . getDateTimeInLang($time) . LF;
         $content = $discussion_content;
     } elseif ($module == 'material' or $module == 'materials') {
         $material_content = $translator->getMessage('COMMON_MATERIAL') . ': ' . $item->getTitle() . LF;
         $content = $material_content;
     } elseif ($module == 'announcement' or $module == CS_ANNOUNCEMENT_TYPE) {
         $announcement_content = $translator->getMessage('COMMON_ANNOUNCEMENT') . ': ' . $item->getTitle() . LF;
         $content = $announcement_content;
     } elseif ($module == 'label' or $module == 'labels') {
         $label_manager = $this->_environment->getLabelManager();
         $label = $label_manager->getItem($iid);
         $module = $label->getLabelType();
         if ($module == 'group' or $module == 'groups') {
             $group_content = $translator->getMessage('COMMON_GROUP') . ': ' . $item->getTitle() . LF;
             $content = $group_content;
         } elseif ($module == 'institution' or $module == 'institutions') {
             $institution_content = $translator->getMessage('INSTITUTION') . ': ' . $item->getTitle() . LF;
             $content = $institution_content;
         }
     }
     if ($this->_environment->inProjectRoom()) {
         $emailtext = $translator->getMessage('RUBRIC_EMAIL_DEFAULT_PROJECT', $current_context->getTitle()) . LF;
     } elseif ($this->_environment->inGroupRoom()) {
         $emailtext = $translator->getMessage('RUBRIC_EMAIL_DEFAULT_GROUPROOM', $current_context->getTitle()) . LF;
     } else {
         $emailtext = $translator->getMessage('RUBRIC_EMAIL_DEFAULT_COMMUNITY', $current_context->getTitle()) . LF;
     }
     if (empty($content)) {
         $emailtext .= LF . LF;
     } else {
         $emailtext .= $content;
     }
     $emailtext .= $translator->getMessage('RUBRIC_EMAIL_DEFAULT_PROJECT_END', $link);
     $response['body'] = strip_tags($emailtext);
     // receiver
     $showAttendees = false;
     if ($module === CS_DATE_TYPE) {
         $showAttendees = true;
         $attendeeType = CS_DATE_TYPE;
     }
     if ($module === CS_TODO_TYPE) {
         $showAttendees = true;
         $attendeeType = CS_TODO_TYPE;
     }
     $response['showAttendees'] = $showAttendees;
     $response['attendeeType'] = $attendeeType;
     $showGroupRecipients = false;
     $showInstitutionRecipients = false;
     if ($this->_environment->inProjectRoom() and !empty($groupArray)) {
         if ($current_context->withRubric(CS_GROUP_TYPE)) {
             $showGroupRecipients = true;
         }
     } else {
         if ($current_context->withRubric(CS_INSTITUTION_TYPE) and !empty($institutionArray)) {
             $showInstitutionRecipients = true;
         }
     }
     //Projectroom and no groups enabled -> send mails to group all
     $withGroups = true;
     if ($current_context->isProjectRoom() && !$current_context->withRubric(CS_GROUP_TYPE)) {
         $showGroupRecipients = true;
         $withGroups = false;
         // get number of users
         $cid = $this->_environment->getCurrentContextId();
         $user_manager = $this->_environment->getUserManager();
         $user_manager->setUserLimit();
         $user_manager->setContextLimit($cid);
         $count = $user_manager->getCountAll();
         $response['numMebers'] = $count;
         $groupArray = array_slice($groupArray, 0, 1);
     }
     $response['showGroupRecipients'] = $showGroupRecipients;
     $response['withGroups'] = $withGroups;
     $response['groups'] = $groupArray;
     $allMembers = false;
     if ($current_context->isCommunityRoom() && !$current_context->withRubric(CS_INSTITUTION_TYPE) || $current_context->isGroupRoom()) {
         $allMembers = true;
         // get number of users
         $cid = $this->_environment->getCurrentContextId();
         $user_manager = $this->_environment->getUserManager();
         $user_manager->setUserLimit();
         $user_manager->setContextLimit($cid);
         $count = $user_manager->getCountAll();
         $response['numMebers'] = $count;
     }
     $response['showInstitutionRecipients'] = $showInstitutionRecipients;
     $response['institutions'] = $institutionArray;
     $response['allMembers'] = $allMembers;
     $response['allowAdditional'] = true;
     $this->setSuccessfullDataReturn($response);
     echo $this->_return;
 }