public function actionQuery()
 {
     $return = array("items" => array());
     $start = $this->_data["options"]["start"];
     $numEntries = $this->_data["options"]["numEntries"];
     $itemManager = $this->_environment->getItemManager();
     $currentUser = $this->_environment->getCurrentUserItem();
     $translator = $this->_environment->getTranslationObject();
     $viewable_ids = $itemManager->getExternalViewerEntriesForUser($currentUser->getRelatedPrivateRoomUserItem()->getUserID());
     $item_list = $itemManager->getItemList($viewable_ids);
     $item_list->sortby("modification_date");
     $item_list->reverse();
     /*
     * $this->_related_user = $user->getRelatedUserItemInContext($this->_environment->getCurrentPortalID());
              $noticed_manager = $this->_environment->getNoticedManager();
              $noticed_manager->getLatestNoticedByIDArray($viewable_ids,$this->_related_user->getItemID());
              $noticed_manager->getLatestNoticedAnnotationsByIDArrayAndUser($viewable_ids,$this->_related_user->getItemID());
     */
     $entry = $item_list->getFirst();
     $count = 0;
     while ($entry) {
         if ($count >= $start && $count < $start + $numEntries) {
             $type = $entry->getItemType();
             if ($type == CS_LABEL_TYPE) {
                 $labelManager = $this->_environment->getLabelManager();
                 $entry = $labelManager->getItem($entry->getItemID());
                 $type = $entry->getLabelType();
             } else {
                 $manager = $this->_environment->getManager($type);
                 $entry = $manager->getItem($entry->getItemID());
             }
             if (isset($entry) and !empty($entry)) {
                 // released from
                 $modifierItem = $entry->getModificatorItem();
                 $releasedFrom = $translator->getMessage("PRIVATEROOM_RELEASED_FROM") . ": " . $modifierItem->getFullname();
                 if ($type === CS_MATERIAL_TYPE) {
                     $versionId = $entry->getVersionID();
                 } else {
                     $versionId = null;
                 }
                 $return["items"][] = array("itemId" => $entry->getItemID(), "contextId" => $entry->getContextID(), "module" => Type2Module($type), "title" => $entry->getTitle(), "image" => $this->getUtils()->getLogoInformationForType($type), "releasedFrom" => $releasedFrom, "versionId" => $versionId);
             }
         }
         $count++;
         $entry = $item_list->getNext();
     }
     $return["total"] = $count;
     $this->setSuccessfullDataReturn($return);
     echo $this->_return;
 }
Esempio n. 2
0
 function _getModifiedItemsAsHTML($item)
 {
     $html = '';
     foreach ($this->_modified_items_array as $connection => $ids) {
         $module = Type2Module($connection);
         $manager = $this->_environment->getItemManager();
         $html .= ' <div class="netnavigation_panel">     ' . LF;
         switch (mb_strtoupper($connection, 'UTF-8')) {
             case 'ANNOUNCEMENT':
                 $text = $this->_translator->getMessage('ANNOUNCEMENTS');
                 break;
             case 'DATE':
                 $text = $this->_translator->getMessage('DATES');
                 break;
             case 'DISCUSSION':
                 $text = $this->_translator->getMessage('DISCUSSIONS');
                 break;
             case 'GROUP':
                 $text = $this->_translator->getMessage('GROUPS');
                 break;
             case 'INSTITUTION':
                 $text = $this->_translator->getMessage('INSTITUTIONS');
                 break;
             case 'MATERIAL':
                 $text = $this->_translator->getMessage('MATERIALS');
                 break;
             case 'PROJECT':
                 $text = $this->_translator->getMessage('PROJECTS');
                 break;
             case 'TODO':
                 $text = $this->_translator->getMessage('TODOS');
                 break;
             case 'TOPIC':
                 $text = $this->_translator->getMessage('TOPICS');
                 break;
             case 'USER':
                 $text = $this->_translator->getMessage('USERS');
                 break;
             default:
                 $text = $this->_translator->getMessage('COMMON_MESSAGETAG_ERROR') . ' cs_user_detail_view(' . __LINE__ . ') ';
                 break;
         }
         $html .= '         <noscript>';
         $html .= '<div class="netnavigation_title">' . $text . '(' . sizeof($ids) . ')</div>';
         $html .= '         </noscript>';
         $html .= '<div>' . LF;
         $html .= '<ul style="list-style-type: circle; font-size:8pt;">' . LF;
         $count = sizeof($ids);
         $limit = 0;
         $count_shown = 0;
         $show = true;
         if ($count > 10) {
             $limit = 9;
             $count_shown = 1;
         }
         if ($count == 0) {
             $html .= '   <li><a><span class="disabled">' . $this->_translator->getMessage('COMMON_NONE') . '</span></a></li>' . LF;
         }
         foreach ($ids as $id) {
             if ($show) {
                 $item = $manager->getItem($id);
                 if (isset($item)) {
                     $type = $item->getItemType();
                     $rubric_manager = $this->_environment->getManager($type);
                     $rubric_item = $rubric_manager->getItem($id);
                     // Get link creator
                     $link_creator = $rubric_item->getCreatorItem();
                     $link_created = $this->_translator->getDateInLang($rubric_item->getCreationDate());
                     $link_creator_text = $this->_translator->getMessage('COMMON_LINK_CREATOR') . ' ' . $this->_text_as_html_short($link_creator->getFullname()) . ', ' . $this->_text_as_html_short($link_created);
                     switch ($connection) {
                         case CS_DISCARTICLE_TYPE:
                             $linked_iid = $rubric_item->getDiscussionID();
                             break;
                         default:
                             $linked_iid = $rubric_item->getItemID();
                     }
                     $html .= '   <li>';
                     $params = array();
                     $params['iid'] = $linked_iid;
                     $user = $this->_environment->getCurrentUser();
                     if ($rubric_item->isNotActivated() and !($rubric_item->getCreatorID() == $user->getItemID() or $user->isModerator())) {
                         $activating_date = $rubric_item->getActivatingDate();
                         if (strstr($activating_date, '9999-00-00')) {
                             $link_creator_text .= ' (' . $this->_translator->getMessage('COMMON_NOT_ACTIVATED') . ')';
                         } else {
                             $link_creator_text .= ' (' . $this->_translator->getMessage('COMMON_ACTIVATING_DATE') . ' ' . getDateInLang($rubric_item->getActivatingDate()) . ')';
                         }
                         $html .= ahref_curl($this->_environment->getCurrentContextID(), $module, 'detail', $params, chunkText($this->_text_as_html_short($rubric_item->getTitle()), 27), $link_creator_text, '', '', '', '', '', 'class="disabled"', '', '', true);
                         unset($params);
                     } else {
                         $html .= ahref_curl($this->_environment->getCurrentContextID(), $module, 'detail', $params, chunkText($this->_text_as_html_short($rubric_item->getTitle()), 27), $link_creator_text);
                         unset($params);
                     }
                     $html .= '</li>' . LF;
                     if ($limit > 0) {
                         $count_shown++;
                     }
                     if ($count_shown > $limit) {
                         $show = false;
                     }
                 }
             }
         }
         if ($limit > 0) {
             $html .= '   <li>';
             $params = array();
             $params['ref_user'] = $this->_item->getItemID();
             $params['mode'] = 'attached';
             $html .= ahref_curl($this->_environment->getCurrentContextID(), $module, 'index', $params, $this->_translator->getMessage('RUBRIC_ALL_ATTACHMENTS', count($ids)));
             unset($params);
             $html .= '</li>' . LF;
         }
         $html .= '</ul>' . LF;
         $html .= '</div>' . LF;
         $html .= ' </div>';
     }
     return $html;
 }
 function _getItemAsHTML($item, $pos = 0, $with_links = TRUE, $view_type = 'released')
 {
     $html = '';
     if ($pos % 2 == 0) {
         $style = 'class="even"';
     } else {
         $style = 'class="odd"';
     }
     $type = $item->getItemType();
     $item_manager = $this->_environment->getManager($type);
     $full_item = $item_manager->getItem($item->getItemID());
     if (is_object($full_item)) {
         $html .= '   <tr class="list">' . LF;
         $html .= '   <td ' . $style . ' style="font-size:8pt;">' . LF;
         $type = $full_item->getType();
         if ($type == 'label') {
             $type = $full_item->getLabelType();
         }
         $fragment = '';
         // there is no anchor defined by default
         $link_created = $this->_translator->getDateInLang($full_item->getModificationDate());
         $text = '';
         $creator = $full_item->getCreatorItem();
         if (isset($creator) and !$creator->isDeleted()) {
             $fullname = $this->_text_as_html_short($creator->getFullname());
         } else {
             $fullname = $this->_translator->getMessage('COMMON_DELETED_USER');
         }
         switch ($type) {
             case CS_DISCARTICLE_TYPE:
                 $linked_iid = $full_item->getDiscussionID();
                 $fragment = 'anchor' . $full_item->getItemID();
                 $discussion_manager = $this->_environment->getDiscussionManager();
                 $new_full_item = $discussion_manager->getItem($linked_iid);
                 break;
             case CS_STEP_TYPE:
                 $linked_iid = $full_item->getToDoID();
                 $fragment = 'anchor' . $full_item->getItemID();
                 $todo_manager = $this->_environment->getToDoManager();
                 $new_full_item = $todo_manager->getItem($linked_iid);
                 break;
             case CS_SECTION_TYPE:
                 $linked_iid = $full_item->getLinkedItemID();
                 $fragment = 'anchor' . $full_item->getItemID();
                 $material_manager = $this->_environment->getMaterialManager();
                 $new_full_item = $material_manager->getItem($linked_iid);
                 break;
             default:
                 $linked_iid = $full_item->getItemID();
                 $new_full_item = $full_item;
         }
         $type = $new_full_item->getType();
         if ($type == 'label') {
             $type = $full_item->getLabelType();
         }
         switch (mb_strtoupper($type, 'UTF-8')) {
             case 'ANNOUNCEMENT':
                 $text .= $this->_translator->getMessage('COMMON_ONE_ANNOUNCEMENT');
                 $img = 'images/commsyicons/32x32/announcement.png';
                 break;
             case 'DATE':
                 $text .= $this->_translator->getMessage('COMMON_ONE_DATE');
                 $img = 'images/commsyicons/32x32/date.png';
                 break;
             case 'DISCUSSION':
                 $text .= $this->_translator->getMessage('COMMON_ONE_DISCUSSION');
                 $img = 'images/commsyicons/32x32/discussion.png';
                 break;
             case 'GROUP':
                 $text .= $this->_translator->getMessage('COMMON_ONE_GROUP');
                 $img = 'images/commsyicons/32x32/group.png';
                 break;
             case 'INSTITUTION':
                 $text .= $this->_translator->getMessage('COMMON_ONE_INSTITUTION');
                 $img = '';
                 break;
             case 'MATERIAL':
                 $text .= $this->_translator->getMessage('COMMON_ONE_MATERIAL');
                 $img = 'images/commsyicons/32x32/material.png';
                 break;
             case 'PROJECT':
                 $text .= $this->_translator->getMessage('COMMON_ONE_PROJECT');
                 $img = '';
                 break;
             case 'TODO':
                 $text .= $this->_translator->getMessage('COMMON_ONE_TODO');
                 $img = 'images/commsyicons/32x32/todo.png';
                 break;
             case 'TOPIC':
                 $text .= $this->_translator->getMessage('COMMON_ONE_TOPIC');
                 $img = 'images/commsyicons/32x32/topic.png';
                 break;
             case 'USER':
                 $text .= $this->_translator->getMessage('COMMON_USER');
                 $img = 'images/commsyicons/32x32/user.png';
                 break;
             default:
                 $text .= $this->_translator->getMessage('COMMON_MESSAGETAG_ERROR') . ' cs_detail_view(' . __LINE__ . ') ';
                 $img = '';
                 break;
         }
         $link_creator_text = $text . ' - ' . $this->_translator->getMessage('COMMON_EDIT_BY') . ' ' . $fullname . ', ' . $link_created;
         $module = Type2Module($type);
         if ($module == CS_USER_TYPE) {
             $link_title = $this->_text_as_html_short($full_item->getFullName());
         } else {
             $link_title = $this->_text_as_html_short($full_item->getTitle());
         }
         $params = array();
         $params['iid'] = $linked_iid;
         $html .= '<div style="float:left;">' . ahref_curl($full_item->getContextID(), $module, 'detail', $params, '<img src="' . $img . '" style="padding-right:3px;" title="' . $link_creator_text . '"/>', $link_creator_text, '_self', $fragment, '', '', '', '', '', '', '') . '</div>';
         $html .= ahref_curl($full_item->getContextID(), $module, 'detail', $params, $link_title, $link_creator_text, '_self', $fragment, '', '', '', '', '', '', '');
         $html .= $this->_getItemChangeStatus($full_item, $full_item->getContextID(), $view_type) . $this->_getItemAnnotationChangeStatus($full_item, $full_item->getContextID(), $view_type);
         if ($view_type == 'released') {
             $html .= '<br/><span style="font-size:8pt;">(' . $this->_translator->getMessage('PRIVATEROOM_RELEASED_FOR') . ': ';
             $external_viewer_array = $full_item->getExternalViewerArray();
             $user_manager = $this->_environment->getUserManager();
             $tmp_html = '';
             foreach ($external_viewer_array as $external_viewer) {
                 $user_manager->setUserIDLimit($external_viewer);
                 $user_manager->setContextLimit($this->_environment->getCurrentPortalID());
                 $user_manager->select();
                 $user_list = $user_manager->get();
                 $user_item = $user_list->getFirst();
                 if (isset($user_item) and is_object($user_item)) {
                     $tmp_html .= $user_item->getFullname() . ', ';
                 }
             }
             if (!empty($tmp_html)) {
                 $html .= substr($tmp_html, 0, -2);
             }
         } else {
             $modifier_item = $full_item->getModificatorItem();
             $html .= '<br/><span style="font-size:8pt;">(' . $this->_translator->getMessage('PRIVATEROOM_RELEASED_FROM') . ': ';
             $html .= $modifier_item->getFullname();
         }
         $html .= ')</span>' . LF;
         $html .= '   </td>' . LF;
         $html .= '   </tr>' . LF;
     }
     return $html;
 }
 public function actionQuery()
 {
     $return = array("items" => array());
     $start = $this->_data["options"]["start"];
     $numEntries = $this->_data["options"]["numEntries"];
     $query = $this->_data["query"];
     if (isset($this->_data["options"]["filter"])) {
         $filter = $this->_data["options"]["filter"];
     } else {
         $filter = array();
     }
     $currentUserItem = $this->_environment->getCurrentUserItem();
     $privateRoomItem = $currentUserItem->getOwnRoom();
     // collect data of interest
     $roomIdArray = array();
     $roomNameArray = array();
     $rubricArray = array();
     if (!empty($filter)) {
         foreach ($filter["rooms"] as $filterRoom) {
             if ($filterRoom["active"]) {
                 $roomIdArray[] = $filterRoom["id"];
                 $roomNameArray[$filterRoom["id"]] = $filterRoom["title"];
             }
         }
     } else {
         // project and group rooms
         $projectRoomList = $currentUserItem->getUserRelatedProjectList();
         $projectRoomItem = $projectRoomList->getFirst();
         while ($projectRoomItem) {
             $roomIdArray[] = $projectRoomItem->getItemID();
             $roomNameArray[$projectRoomItem->getItemID()] = $projectRoomItem->getTitle();
             $projectRoomItem = $projectRoomList->getNext();
         }
         // community rooms
         $communityRoomList = $currentUserItem->getUserRelatedCommunityList();
         $communityRoomItem = $communityRoomList->getFirst();
         while ($communityRoomItem) {
             $roomIdArray[] = $communityRoomItem->getItemID();
             $roomNameArray[$communityRoomItem->getItemID()] = $communityRoomItem->getTitle();
             $communityRoomItem = $communityRoomList->getNext();
         }
         // private room
         //$roomIdArray[] = $privateRoomItem->getItemID();
         //$roomNameArray[$privateRoomItem->getItemID()] = $privateRoomItem->getTitle();
     }
     // determe the rubrics to search in
     if (!empty($filter)) {
         foreach ($filter["rubrics"] as $filterRubric) {
             if ($filterRubric["active"] && in_array($filterRubric["type"], array(CS_DISCUSSION_TYPE, CS_DATE_TYPE, CS_TODO_TYPE))) {
                 $rubricArray[] = $filterRubric["type"];
             }
         }
     } else {
         $rubricArray[] = CS_DISCUSSION_TYPE;
         $rubricArray[] = CS_DATE_TYPE;
         $rubricArray[] = CS_TODO_TYPE;
     }
     /*
      * only three rubrics are handled in the following foreach loop
      * maybe these are the only managers that are able to handle context arrays???
      * however, setting context array limits in other managers seems not to work
      */
     // get search results from all relevant managers
     $searchResults = new cs_list();
     foreach ($rubricArray as $rubric) {
         $manager = $this->_environment->getManager($rubric);
         $manager->setContextArrayLimit($roomIdArray);
         if ($rubric == CS_DATE_TYPE) {
             $manager->setWithoutDateModeLimit();
         }
         if (!empty($query)) {
             $manager->setSearchLimit($query);
         }
         $manager->showNoNotActivatedEntries();
         $manager->select();
         $searchResults->addList($manager->get());
     }
     // redefine rubric array
     if (!empty($filter)) {
         $rubricArray = array();
         foreach ($filter["rubrics"] as $filterRubric) {
             if ($filterRubric["active"] && in_array($filterRubric["type"], array(CS_MATERIAL_TYPE, CS_ANNOUNCEMENT_TYPE, CS_TOPIC_TYPE))) {
                 $rubricArray[] = $filterRubric["type"];
             }
         }
     } else {
         $rubricArray = array(CS_MATERIAL_TYPE, CS_ANNOUNCEMENT_TYPE, CS_TOPIC_TYPE);
     }
     // materials
     foreach ($roomIdArray as $roomId) {
         foreach ($rubricArray as $rubric) {
             $rubricManager = $this->_environment->getManager($rubric);
             $rubricManager->setContextLimit($roomId);
             if (!empty($query)) {
                 $rubricManager->setSearchLimit($query);
             }
             $rubricManager->showNoNotActivatedEntries();
             $rubricManager->select();
             $searchResults->addList($rubricManager->get());
         }
     }
     // announcements
     foreach ($roomIdArray as $roomId) {
         $annoucementManager = $this->_environment->getManager(CS_ANNOUNCEMENT_TYPE);
         $annoucementManager->setContextLimit($roomId);
     }
     // sort list
     $searchResults->sortby("modification_date");
     $searchResults->reverse();
     // prepare return
     $entry = $searchResults->getFirst();
     $count = 0;
     while ($entry) {
         if ($count >= $start && $count < $start + $numEntries) {
             $type = $entry->getItemType();
             if ($type == CS_LABEL_TYPE) {
                 $labelManager = $this->_environment->getLabelManager();
                 $entry = $labelManager->getItem($entry->getItemID());
                 $type = $entry->getLabelType();
             } else {
                 $manager = $this->_environment->getManager($type);
                 $entry = $manager->getItem($entry->getItemID());
             }
             if (isset($entry) and !empty($entry)) {
                 // skip portfolio
                 if ($entry->getType() !== CS_PORTFOLIO_TYPE) {
                     $moddate = $entry->getModificationDate();
                     if ($entry->getCreationDate() != $entry->getModificationDate() && !strstr($moddate, '9999-00-00')) {
                         $mod_date = $this->_environment->getTranslationObject()->getDateInLang($entry->getModificationDate());
                     } else {
                         $mod_date = $this->_environment->getTranslationObject()->getDateInLang($entry->getCreationDate());
                     }
                     if ($type === CS_MATERIAL_TYPE) {
                         $versionId = $entry->getVersionID();
                     } else {
                         $versionId = null;
                     }
                     $return["items"][] = array("itemId" => $entry->getItemID(), "contextId" => $entry->getContextID(), "module" => Type2Module($type), "title" => $entry->getTitle(), "image" => $this->getUtils()->getLogoInformationForType($type), "fileCount" => $entry->getFileList()->getCount(), "modificationDate" => $mod_date, "creator" => $entry->getCreatorItem()->getFullName(), "versionId" => $versionId, "roomName" => $roomNameArray[$entry->getContextID()]);
                 }
             }
         }
         if (isset($entry) && !empty($entry) && $entry->getType() !== CS_PORTFOLIO_TYPE) {
             $count++;
         }
         $entry = $searchResults->getNext();
     }
     $return["total"] = $count;
     $this->setSuccessfullDataReturn($return);
     echo $this->_return;
 }
Esempio n. 5
0
 function _getLinkedItemsAsHTML($item, $link_items, $connection, $is_perspective = false, $always = false, $attach_link = false)
 {
     $current_context = $this->_environment->getCurrentContextItem();
     $user = $this->_environment->getCurrentUserItem();
     $mod = $this->_with_modifying_actions;
     $module = Type2Module($connection);
     $html = '<div>' . LF;
     $html .= '<ul style="list-style-type: circle; font-size:8pt;">  ' . LF;
     if (isset($link_items) and $link_items->isEmpty()) {
         $html .= '   <li><a><span class="disabled">' . $this->_translator->getMessage('COMMON_NONE') . '</span></a></li>' . LF;
     } else {
         $count = $link_items->getCount();
         if (!$is_perspective and $count > 10) {
             // Only show up to five items
             $limit = 9;
             $count_shown = 1;
         } else {
             $limit = 0;
             $count_shown = 0;
         }
         $link_item = $link_items->getFirst();
         while ($link_item and $count_shown <= $limit) {
             // Get link creator
             $link_creator = $link_item->getCreatorItem();
             if (isset($link_creator) and !$link_creator->isDeleted()) {
                 $fullname = $link_creator->getFullname();
             } else {
                 $fullname = $this->_translator->getMessage('COMMON_DELETED_USER');
             }
             $link_created = $this->_translator->getDateInLang($link_item->getCreationDate());
             $link_creator_text = $this->_translator->getMessage('COMMON_LINK_CREATOR') . ' ' . $fullname . ', ' . $link_created;
             // Create the list entry
             $linked_item = $link_item->getLinkedItem($item);
             // Get the linked item
             if (isset($linked_item)) {
                 $fragment = '';
                 // there is no anchor defined by default
                 switch ($connection) {
                     case CS_DISCARTICLE_TYPE:
                         $linked_iid = $linked_item->getDiscussionID();
                         $fragment = $linked_item->getItemID();
                         $discussion_manager = $this->_environment->getDiscussionManager();
                         $linked_item = $discussion_manager->getItem($linked_iid);
                         break;
                     case CS_SECTION_TYPE:
                         $linked_iid = $linked_item->getLinkedItemID();
                         $fragment = $linked_item->getItemID();
                         $material_manager = $this->_environment->getMaterialManager();
                         $linked_item = $material_manager->getItem($linked_iid);
                         break;
                     default:
                         $linked_iid = $linked_item->getItemID();
                 }
                 $html .= '   <li>';
                 $params = array();
                 $params['iid'] = $linked_iid;
                 $user = $this->_environment->getCurrentUser();
                 if ($linked_item->isNotActivated() and !($linked_item->getCreatorID() == $user->getItemID() or $user->isModerator())) {
                     $activating_date = $linked_item->getActivatingDate();
                     if (strstr($activating_date, '9999-00-00')) {
                         $link_creator_text .= ' (' . $this->_translator->getMessage('COMMON_NOT_ACTIVATED') . ')';
                     } else {
                         $link_creator_text .= ' (' . $this->_translator->getMessage('COMMON_ACTIVATING_DATE') . ' ' . getDateInLang($linked_item->getActivatingDate()) . ')';
                     }
                     $html .= ahref_curl($this->_environment->getCurrentContextID(), $module, 'detail', $params, chunkText($linked_item->getTitle(), 27), $link_creator_text, '_self', $fragment, '', '', '', 'class="disabled"', '', '', true);
                     unset($params);
                 } else {
                     $html .= ahref_curl($this->_environment->getCurrentContextID(), $module, 'detail', $params, chunkText($linked_item->getTitle(), 27), $link_creator_text, '_self', $fragment);
                     unset($params);
                 }
                 $html .= '</li>' . LF;
             }
             // Show all linked perspectives
             if ($limit > 0) {
                 $count_shown++;
             }
             $link_item = $link_items->getNext();
         }
         if ($limit > 0) {
             $html .= '   <li>';
             $params = array();
             $params['ref_iid'] = $item->getItemID();
             $params['mode'] = 'attached';
             $html .= ahref_curl($this->_environment->getCurrentContextID(), $module, 'index', $params, $this->_translator->getMessage('RUBRIC_ALL_ATTACHMENTS', $link_items->getCount()));
             unset($params);
             $html .= '</li>' . LF;
         }
     }
     $html .= '</ul> ';
     $html .= '				<div style="text-align:right; border-top:0px solid black; padding-bottom:5px; font-size:8pt; padding-right: 3px; font-size:8pt;">' . LF;
     if ($attach_link) {
         if ($user->isUser() and $mod) {
             $params = array();
             $params['ref_iid'] = $item->getItemID();
             $params['mode'] = 'detailattach';
             $html .= ahref_curl($this->_environment->getCurrentContextID(), $module, 'index', $params, $this->_translator->getMessage('COMMON_ATTACH_LINK')) . LF;
             unset($params);
         } else {
             $html .= $this->_translator->getMessage('COMMON_ATTACH_LINK') . LF;
         }
     }
     $html .= '				</div>' . LF;
     $html .= ' </div>';
     return $html;
 }
Esempio n. 6
0
 /** get the item of the list view as HTML
  * this method returns the single item in HTML-Code
  *
  * overwritten method form the upper class
  *
  * @return string item as HMTL
  */
 function _getItemAsHTML($item, $pos = 0, $with_links = TRUE)
 {
     $html = '';
     if ($pos % 2 == 0) {
         $style = 'class="even"';
     } else {
         $style = 'class="odd"';
     }
     $type = $item->getItemType();
     $item_manager = $this->_environment->getManager($type);
     $full_item = $item_manager->getItem($item->getItemID());
     if (is_object($full_item)) {
         $type = $full_item->getType();
         if ($type == 'label') {
             $type = $full_item->getLabelType();
         }
         $fragment = '';
         // there is no anchor defined by default
         $link_created = $this->_translator->getDateInLang($full_item->getModificationDate());
         $text = '';
         $creator = $full_item->getCreatorItem();
         if (isset($creator) and !$creator->isDeleted()) {
             $fullname = $this->_text_as_html_short($creator->getFullname());
         } else {
             $fullname = $this->_translator->getMessage('COMMON_DELETED_USER');
         }
         $room = $full_item->getContextItem();
         $room_title = $room->getTitle();
         switch ($type) {
             case CS_DISCARTICLE_TYPE:
                 $linked_iid = $full_item->getDiscussionID();
                 $fragment = 'anchor' . $full_item->getItemID();
                 $discussion_manager = $this->_environment->getDiscussionManager();
                 $new_full_item = $discussion_manager->getItem($linked_iid);
                 break;
             case CS_STEP_TYPE:
                 $linked_iid = $full_item->getToDoID();
                 $fragment = 'anchor' . $full_item->getItemID();
                 $todo_manager = $this->_environment->getToDoManager();
                 $new_full_item = $todo_manager->getItem($linked_iid);
                 break;
             case CS_SECTION_TYPE:
                 $linked_iid = $full_item->getLinkedItemID();
                 $fragment = 'anchor' . $full_item->getItemID();
                 $material_manager = $this->_environment->getMaterialManager();
                 $new_full_item = $material_manager->getItem($linked_iid);
                 break;
             default:
                 $linked_iid = $full_item->getItemID();
                 $new_full_item = $full_item;
         }
         $type = $new_full_item->getType();
         if ($type == 'label') {
             $type = $full_item->getLabelType();
         }
         switch (mb_strtoupper($type, 'UTF-8')) {
             case 'ANNOUNCEMENT':
                 $text .= $this->_translator->getMessage('COMMON_ONE_ANNOUNCEMENT');
                 $img = 'images/commsyicons/16x16/announcement.png';
                 break;
             case 'DATE':
                 $text .= $this->_translator->getMessage('COMMON_ONE_DATE');
                 $img = 'images/commsyicons/16x16/date.png';
                 break;
             case 'DISCUSSION':
                 $text .= $this->_translator->getMessage('COMMON_ONE_DISCUSSION');
                 $img = 'images/commsyicons/16x16/discussion.png';
                 break;
             case 'MATERIAL':
                 $text .= $this->_translator->getMessage('COMMON_ONE_MATERIAL');
                 $img = 'images/commsyicons/16x16/material.png';
                 break;
             case 'TODO':
                 $text .= $this->_translator->getMessage('COMMON_ONE_TODO');
                 $img = 'images/commsyicons/16x16/todo.png';
                 break;
             default:
                 $text .= $this->_translator->getMessage('COMMON_MESSAGETAG_ERROR') . ' cs_detail_view(' . __LINE__ . ') ';
                 $img = '';
                 break;
         }
         $module = Type2Module($type);
         $link_title = $this->_text_as_html_short($full_item->getTitle());
         $params = array();
         $html .= '<div id="item_' . $item->getItemID() . '" class="dragable_item" style="width:100%; vertical-align: middle;">' . LF;
         $html .= '   <table ' . $style . ' style="width:100%; border-collapse:collapse;">' . LF;
         $html .= '<tr>' . LF;
         $html .= '<td style="vertical-align:center; padding:3px; width:1%;">' . LF;
         $html .= '<span id="item_' . $item->getItemID() . '_img"><img src="' . $img . '" style="padding-right:3px;" title=""/></span>';
         $html .= '</td>' . LF;
         $html .= '<td>' . LF;
         $params['iid'] = $linked_iid;
         $html .= ahref_curl($full_item->getContextID(), $module, 'detail', $params, $link_title, '', '_self', $fragment, '', '', '', '', '', '', '');
         $html .= $this->_getAdditionalInformationAsHTML($type, $full_item);
         $html .= '</td>' . LF;
         $html .= '</tr>' . LF;
         $html .= '</table>' . LF;
         $html .= '   </div>' . LF;
     }
     return $html;
 }
Esempio n. 7
0
 function _getNewestLinkedItemsAsHTML($item)
 {
     $title_string = $this->_translator->getMessage('COMMON_REFERENCED_LATEST_ENTRIES');
     $link_items = $item->getLatestLinkItemList(10);
     if ($link_items->getCount() > 0) {
         $title_string .= ' (' . $this->_translator->getMessage('COMMON_REFERENCED_LATEST_ONE') . ' ' . $link_items->getCount() . ')';
     }
     $html = '<h3 class="subitemtitle" style="margin-top:0px; margin-bottom:0px;">' . $title_string;
     $html .= '</h3>' . LF;
     $html .= '<ul style="list-style-type: decimal; list-style-position:inside; font-size:8pt; padding-left:0px; margin-left:0px; margin-top:0px; margin-bottom:20px; padding-bottom:0px;">  ' . LF;
     if ($link_items->isEmpty()) {
         $html .= $this->_translator->getMessage('COMMON_NONE') . LF;
     } else {
         $i = 0;
         $link_item = $link_items->getFirst();
         while ($link_item) {
             $link_creator = $link_item->getCreatorItem();
             if (isset($link_creator) and !$link_creator->isDeleted()) {
                 $fullname = $link_creator->getFullname();
             } else {
                 $fullname = $this->_translator->getMessage('COMMON_DELETED_USER');
             }
             $linked_item = $link_item->getLinkedItem($item);
             // Get the linked item
             if (isset($linked_item)) {
                 $fragment = '';
                 // there is no anchor defined by default
                 $type = $linked_item->getType();
                 if ($type == 'label') {
                     $type = $linked_item->getLabelType();
                 }
                 $link_created = $this->_translator->getDateInLang($link_item->getCreationDate());
                 $text = '';
                 switch (mb_strtoupper($type, 'UTF-8')) {
                     case 'ANNOUNCEMENT':
                         $text .= $this->_translator->getMessage('COMMON_ONE_ANNOUNCEMENT');
                         break;
                     case 'DATE':
                         $text .= $this->_translator->getMessage('COMMON_ONE_DATE');
                         break;
                     case 'DISCUSSION':
                         $text .= $this->_translator->getMessage('COMMON_ONE_DISCUSSION');
                         break;
                     case 'GROUP':
                         $text .= $this->_translator->getMessage('COMMON_ONE_GROUP');
                         break;
                     case 'INSTITUTION':
                         $text .= $this->_translator->getMessage('COMMON_ONE_INSTITUTION');
                         break;
                     case 'MATERIAL':
                         $text .= $this->_translator->getMessage('COMMON_ONE_MATERIAL');
                         break;
                     case 'PROJECT':
                         $text .= $this->_translator->getMessage('COMMON_ONE_PROJECT');
                         break;
                     case 'TODO':
                         $text .= $this->_translator->getMessage('COMMON_ONE_TODO');
                         break;
                     case 'TOPIC':
                         $text .= $this->_translator->getMessage('COMMON_ONE_TOPIC');
                         break;
                     case 'USER':
                         $text .= $this->_translator->getMessage('COMMON_ONE_USER');
                         break;
                     default:
                         $text .= $this->_translator->getMessage('COMMON_MESSAGETAG_ERROR') . ' cs_detail_view(692) ';
                         break;
                 }
                 $link_creator_text = $text . ' - ' . $this->_translator->getMessage('COMMON_LINK_CREATOR') . ' ' . $fullname . ', ' . $link_created;
                 switch ($type) {
                     case CS_DISCARTICLE_TYPE:
                         $linked_iid = $linked_item->getDiscussionID();
                         $fragment = $linked_item->getItemID();
                         $discussion_manager = $this->_environment->getDiscussionManager();
                         $linked_item = $discussion_manager->getItem($linked_iid);
                         break;
                     case CS_SECTION_TYPE:
                         $linked_iid = $linked_item->getLinkedItemID();
                         $fragment = $linked_item->getItemID();
                         $material_manager = $this->_environment->getMaterialManager();
                         $linked_item = $material_manager->getItem($linked_iid);
                         break;
                     default:
                         $linked_iid = $linked_item->getItemID();
                 }
                 $params = array();
                 $params['iid'] = $linked_iid;
                 $module = Type2Module($type);
                 $user = $this->_environment->getCurrentUser();
                 if ($linked_item->isNotActivated() and !($linked_item->getCreatorID() == $user->getItemID() or $user->isModerator())) {
                     $activating_date = $linked_item->getActivatingDate();
                     if (strstr($activating_date, '9999-00-00')) {
                         $link_creator_text .= ' (' . $this->_translator->getMessage('COMMON_NOT_ACTIVATED') . ')';
                     } else {
                         $link_creator_text .= ' (' . $this->_translator->getMessage('COMMON_ACTIVATING_DATE') . ' ' . getDateInLang($linked_item->getActivatingDate()) . ')';
                     }
                     $html_text = ahref_curl($this->_environment->getCurrentContextID(), $module, 'detail', $params, $this->_text_as_html_short($this->_compareWithSearchText($linked_item->getTitle())), $link_creator_text, '_self', $fragment, '', '', '', 'class="disabled"', '', '', true);
                     unset($params);
                 } else {
                     $html_text = ahref_curl($this->_environment->getCurrentContextID(), $module, 'detail', $params, $this->_text_as_html_short($this->_compareWithSearchText($linked_item->getTitle())), $link_creator_text, '_self', $fragment);
                     unset($params);
                 }
                 $html .= '      <li style="font-size:10pt;">' . $html_text . '</li>' . LF;
                 $i++;
                 $link_item = $link_items->getNext();
             }
         }
     }
     $html .= '</ul>' . LF . LF;
     return $html;
 }
Esempio n. 8
0
 public function getNetnavigation($item)
 {
     $return = array();
     if (isset($item)) {
         $current_context = $this->_environment->getCurrentContextItem();
         $current_user = $this->_environment->getCurrentUser();
         $translator = $this->_environment->getTranslationObject();
         $converter = $this->_environment->getTextConverter();
         $link_items = $item->getAllLinkItemList();
         // remove items from list the current user is not allowed to see or ???
         $count_item = $link_items->getFirst();
         while ($count_item) {
             $linked_item = $count_item->getLinkedItem($item);
             if (isset($linked_item)) {
                 $type = $linked_item->getType();
             }
             // 					$module = Type2Module($type);
             // 					if($module === CS_USER_TYPE && ($item->getItemType()== CS_GROUP_TYPE || (!$linked_item->isUser() || !$linked_item->maySee($current_user)))) {
             // 						$link_items->removeElement($count_item);
             // 					}
             $count_item = $link_items->getNext();
         }
         $count_link_item = $link_items->getCount();
         $return['count'] = $count_link_item;
         /*
          *
         $this->_right_box_config['title_string'] .= $separator.'"'.$this->_translator->getMessage('COMMON_NETNAVIGATION_ENTRIES').' ('.$count_link_item.')"';
         $this->_right_box_config['desc_string'] .= $separator.'""';
         $this->_right_box_config['size_string'] .= $separator.'"10"';
         	
         if($current_context->isNetnavigationShowExpanded()){
         $this->_right_box_config['config_string'] .= $separator.'true';
         } else {
         $this->_right_box_config['config_string'] .= $separator.'false';
         }
         $html .= '<div class="commsy_panel" style="margin-bottom:1px;">'.LF;
         $html .= '<div class="right_box">'.LF;
         */
         $return['items'] = array();
         if (!$link_items->isEmpty()) {
             $link_item = $link_items->getFirst();
             while ($link_item) {
                 $entry = array('creator' => '');
                 $link_creator = $link_item->getCreatorItem();
                 if (isset($link_creator) && !$link_creator->isDeleted()) {
                     $entry['creator'] = $link_creator->getFullname();
                     // create the list entry
                     $linked_item = $link_item->getLinkedItem($item);
                     if (isset($linked_item)) {
                         $type = $linked_item->getType();
                         if ($type === 'label') {
                             $type = $linked_item->getLabelType();
                         }
                         $link_created = $translator->getDateInLang($link_item->getCreationDate());
                         switch (mb_strtoupper($type, 'UTF-8')) {
                             case 'ANNOUNCEMENT':
                                 $text = $translator->getMessage('COMMON_ONE_ANNOUNCEMENT');
                                 $img = 'announcement.png';
                                 break;
                             case 'DATE':
                                 $text = $translator->getMessage('COMMON_ONE_DATE');
                                 $img = 'date.png';
                                 break;
                             case 'DISCUSSION':
                                 $text = $translator->getMessage('COMMON_ONE_DISCUSSION');
                                 $img = 'discussion.png';
                                 break;
                             case 'GROUP':
                                 $text = $translator->getMessage('COMMON_ONE_GROUP');
                                 $img = 'group.png';
                                 break;
                             case 'INSTITUTION':
                                 $text = $translator->getMessage('COMMON_ONE_INSTITUTION');
                                 $img = '';
                                 break;
                             case 'MATERIAL':
                                 $text = $translator->getMessage('COMMON_ONE_MATERIAL');
                                 $img = 'material.png';
                                 break;
                             case 'PROJECT':
                                 $text = $translator->getMessage('COMMON_ONE_PROJECT');
                                 $img = '';
                                 break;
                             case 'TODO':
                                 $text = $translator->getMessage('COMMON_ONE_TODO');
                                 $img = 'todo.png';
                                 break;
                             case 'TOPIC':
                                 $text = $translator->getMessage('COMMON_ONE_TOPIC');
                                 $img = 'topic.png';
                                 break;
                             case 'USER':
                                 $text = $translator->getMessage('COMMON_ONE_USER');
                                 $img = 'user.png';
                                 break;
                             default:
                                 $text = $translator->getMessage('COMMON_MESSAGETAB_ERROR');
                                 $img = '';
                                 break;
                         }
                         $link_creator_text = $text . ' - ' . $translator->getMessage('COMMON_LINK_CREATOR') . ' ' . $entry['creator'] . ', ' . $link_created;
                         switch ($type) {
                             case CS_DISCARTICLE_TYPE:
                                 $linked_iid = $linked_item->getDiscussionID();
                                 $discussion_manager = $this->_environment->getDiscussionManager();
                                 $linked_item = $discussion_manager->getItem($linked_iid);
                                 break;
                             case CS_SECTION_TYPE:
                                 $linked_iid = $linked_item->getLinkedItemID();
                                 $material_manager = $this->_environment->getMaterialManager();
                                 $linked_item = $material_manager->getItem($linked_iid);
                                 break;
                             default:
                                 $linked_iid = $linked_item->getItemID();
                         }
                         $entry['link_id'] = $link_item->getItemID();
                         $entry['linked_iid'] = $linked_iid;
                         $entry['sorting_place'] = $link_item->getSortingPlace();
                         $module = Type2Module($type);
                         $user = $this->_environment->getCurrentUser();
                         if (!($module == CS_USER_TYPE && (!$linked_item->isUser() || !$linked_item->maySee($user)))) {
                             if ($linked_item->isNotActivated() && !($linked_item->getCreatorID() === $user->getItemID() || $user->isModerator())) {
                                 $activating_date = $linked_item->getActivatingDate();
                                 if (strstr($activating_date, '9999-00-00')) {
                                     $link_creator_text .= ' (' . $translator->getMessage('COMMON_NOT_ACTIVATED') . ')';
                                 } else {
                                     $link_creator_text .= ' (' . $translator->getMessage('COMMON_ACTIVATING_DATE') . ' ' . getDateInLang($linked_item->getActivatingDate()) . ')';
                                 }
                                 if ($module === CS_USER_TYPE) {
                                     $title = $linked_item->getFullName();
                                 } else {
                                     $title = $linked_item->getTitle();
                                 }
                                 $title = $converter->text_as_html_short($title);
                                 $entry['module'] = $module;
                                 $entry['img'] = $img;
                                 $entry['title'] = $link_creator_text;
                                 $entry['link_text'] = $title;
                                 /*
                                  * TODO: check if working
                                 $html .= ahref_curl( $this->_environment->getCurrentContextID(),
                                 		$module,
                                 		'detail',
                                 		$params,
                                 		'<img src="' . $img . '" style="padding-right:3px;" title="' . $link_creator_text . '"/>',
                                 		$link_creator_text,
                                 		'_self',
                                 		$fragment,
                                 		'',
                                 		'',
                                 		'',
                                 		'class="disabled"',
                                 		'',
                                 		'',
                                 		true);
                                 $html .= ahref_curl( $this->_environment->getCurrentContextID(),
                                 		$module,
                                 		'detail',
                                 		$params,
                                 		$link_title,
                                 		$link_creator_text,
                                 		'_self',
                                 		$fragment,
                                 		'',
                                 		'',
                                 		'',
                                 		'class="disabled"',
                                 		'',
                                 		'',
                                 		true);
                                 unset($params);
                                 */
                             } else {
                                 if ($module === CS_USER_TYPE) {
                                     $title = $linked_item->getFullName();
                                 } else {
                                     $title = $linked_item->getTitle();
                                 }
                                 $title = $converter->text_as_html_short($title);
                                 $entry['module'] = $module;
                                 $entry['img'] = $img;
                                 $entry['title'] = $link_creator_text;
                                 $entry['link_text'] = $title;
                                 /*
                                  * TODO: check if needed - $link_creator_text is empty!!!
                                 *
                                 *
                                 *
                                 $html .= ahref_curl( $this->_environment->getCurrentContextID(),
                                 		$module,
                                 		'detail',
                                 		$params,
                                 		'<img src="' . $img . '" style="padding-right:3px;" title="' . $link_creator_text . '"/>',
                                 		$link_creator_text,
                                 		'_self',
                                 		$fragment,
                                 		'',
                                 		'',
                                 		'',
                                 		'style=""');
                                 $html .= ahref_curl( $this->_environment->getCurrentContextID(),
                                 		$module,
                                 		'detail',
                                 		$params,
                                 		$link_title,
                                 		$link_creator_text,
                                 		'_self',
                                 		$fragment,
                                 		'',
                                 		'',
                                 		'',
                                 		'style=""');
                                 unset($params);
                                 */
                             }
                             $return['items'][] = $entry;
                         }
                     }
                 }
                 $link_item = $link_items->getNext();
             }
         }
     }
     return $return;
 }
 protected function getDetailContent()
 {
     $converter = $this->_environment->getTextConverter();
     $translator = $this->_environment->getTranslationObject();
     $return = array();
     $return['title'] = $this->_item->getTitle();
     $return['show_picture'] = false;
     $return['moredetails'] = $this->getCreatorInformationAsArray($this->_item);
     // description
     $desc = $this->_item->getDescription();
     if (!empty($desc)) {
         $converter->setFileArray($this->getItemFileList());
         $desc = $converter->textFullHTMLFormatting($desc);
     }
     $path_shown = false;
     $path_items = array();
     $item_list = $this->_item->getPathItemList();
     if (!$item_list->isEmpty()) {
         $path_shown = true;
         $linked_item = $item_list->getFirst();
         while ($linked_item) {
             $entry = array();
             $entry['iid'] = $linked_item->getItemID();
             $mod = Type2Module($linked_item->getItemType());
             $type = $linked_item->getItemType();
             if ($type === 'date') {
                 $type .= 's';
             }
             $temp_type = mb_strtoupper($type, 'UTF-8');
             switch ($temp_type) {
                 case 'ANNOUNCEMENT':
                     $type = $translator->getMessage('COMMON_ANNOUNCEMENT');
                     break;
                 case 'DATES':
                     $type = $translator->getMessage('COMMON_DATES');
                     break;
                 case 'DISCUSSION':
                     $type = $translator->getMessage('COMMON_DISCUSSION');
                     break;
                 case 'GROUP':
                     $type = $translator->getMessage('COMMON_GROUP');
                     break;
                 case 'INSTITUTION':
                     $type = $translator->getMessage('COMMON_INSTITUTION');
                     break;
                 case 'MATERIAL':
                     $type = $translator->getMessage('COMMON_MATERIAL');
                     break;
                 case 'PROJECT':
                     $type = $translator->getMessage('COMMON_PROJECT');
                     break;
                 case 'TODO':
                     $type = $translator->getMessage('COMMON_TODO');
                     break;
                 case 'TOPIC':
                     $type = $translator->getMessage('COMMON_TOPIC');
                     break;
                 case 'USER':
                     $type = $translator->getMessage('COMMON_USER');
                     break;
                 default:
                     $type = $translator->getMessage('COMMON_MESSAGETAG_ERROR');
                     break;
             }
             if (isset($user) and $linked_item->isNotActivated() && !($linked_item->getCreatorID() === $user->getItemID() || $user->isModerator())) {
                 $activatring_date = $linked_item->getActivatingDate();
                 if (strstr($activating_date, '9999-00-00')) {
                     $link_creator_text = $translator->getMessage('COMMON_NOT_ACTIVATED');
                 } else {
                     $link_creator_text = $translator->getMessage('COMMON_ACTIVATING_DATE') . ' ' . getDateInLang($linked_item->getActivatingDate());
                 }
                 $entry['title'] = $linked_item->getTitle();
                 $entry['link_text'] = $link_creator_text;
                 $entry['not_activated'] = true;
             } else {
                 $entry['title'] = $linked_item->getTitle();
                 $entry['type'] = $type;
                 $entry['mod'] = $mod;
                 $entry['not_activated'] = false;
             }
             $path_items[] = $entry;
             $linked_item = $item_list->getNext();
         }
     }
     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();
         $temp_array[] = $this->_environment->getTranslationObject()->getMessage('COMMON_RIGHTS');
         $temp_array[] = $activating_text;
         $formal[] = $temp_array;
     }
     $temp_array = array();
     $return = array('formal' => $formal, 'title' => $this->_item->getTitle(), 'files' => $this->getFileContent(), 'description' => $desc, 'item_id' => $this->_item->getItemID(), 'path_shown' => $path_shown, 'path_items' => $path_items, 'moredetails' => $this->getCreatorInformationAsArray($this->_item));
     return $return;
 }
Esempio n. 10
0
 function _getAllLinkedItemsAsHTML($spaces = 0)
 {
     $html = '';
     $current_context = $this->_environment->getCurrentContextItem();
     if (!empty($this->_right_box_config['title_string'])) {
         $separator = ',';
     } else {
         $separator = '';
     }
     $item = $this->getItem();
     $link_items = $item->getAllLinkItemList();
     // Löschen der gesperrten Kennungen für die RightBox
     $countItem = $link_items->getFirst();
     while ($countItem) {
         $linked_item = $countItem->getLinkedItem($item);
         if (isset($linked_item)) {
             $fragment = '';
             // there is no anchor defined by default
             $type = $linked_item->getType();
         }
         $module = Type2Module($type);
         $user = $this->_environment->getCurrentUser();
         if ($module == CS_USER_TYPE and (!$linked_item->isUser() or !$linked_item->maySee($user))) {
             $link_items->removeElement($countItem);
         }
         $countItem = $link_items->getNext();
     }
     $count_link_item = $link_items->getCount();
     $this->_right_box_config['title_string'] .= $separator . '"' . $this->_translator->getMessage('COMMON_NETNAVIGATION_ENTRIES') . ' (' . $count_link_item . ')"';
     $this->_right_box_config['desc_string'] .= $separator . '""';
     $this->_right_box_config['size_string'] .= $separator . '"10"';
     if ($current_context->isNetnavigationShowExpanded()) {
         $this->_right_box_config['config_string'] .= $separator . 'true';
     } else {
         $this->_right_box_config['config_string'] .= $separator . 'false';
     }
     $html .= '<div class="commsy_panel" style="margin-bottom:1px;">' . LF;
     $html .= '<div class="right_box">' . LF;
     $connections = $this->getRubricConnections();
     $html .= '         <noscript>';
     $html .= '<div class="right_box_title">' . $this->_translator->getMessage('COMMON_ATTACHED_ENTRIES') . '</div>';
     $html .= '         </noscript>';
     $html .= '      <div class="right_box_main">     ' . LF;
     if ($link_items->isEmpty()) {
         $html .= '  <div style="padding:0px 5px; font-size:8pt;" class="disabled">' . $this->_translator->getMessage('COMMON_NONE') . '&nbsp;</div>' . LF;
     } else {
         $html .= '     <ul style="list-style-type: circle; font-size:8pt; list-style-position:inside; margin:0px; padding:0px;">' . LF;
         $link_item = $link_items->getFirst();
         while ($link_item) {
             $link_creator = $link_item->getCreatorItem();
             if (isset($link_creator) and !$link_creator->isDeleted()) {
                 $fullname = $this->_text_as_html_short($link_creator->getFullname());
             } else {
                 $fullname = $this->_translator->getMessage('COMMON_DELETED_USER');
             }
             // Create the list entry
             $linked_item = $link_item->getLinkedItem($item);
             // Get the linked item
             if (isset($linked_item)) {
                 $fragment = '';
                 // there is no anchor defined by default
                 $type = $linked_item->getType();
                 if ($type == 'label') {
                     $type = $linked_item->getLabelType();
                 }
                 $link_created = $this->_translator->getDateInLang($link_item->getCreationDate());
                 $text = '';
                 switch (mb_strtoupper($type, 'UTF-8')) {
                     case 'ANNOUNCEMENT':
                         $text .= $this->_translator->getMessage('COMMON_ONE_ANNOUNCEMENT');
                         $img = 'images/commsyicons/netnavigation/announcement.png';
                         break;
                     case 'DATE':
                         $text .= $this->_translator->getMessage('COMMON_ONE_DATE');
                         $img = 'images/commsyicons/netnavigation/date.png';
                         break;
                     case 'DISCUSSION':
                         $text .= $this->_translator->getMessage('COMMON_ONE_DISCUSSION');
                         $img = 'images/commsyicons/netnavigation/discussion.png';
                         break;
                     case 'GROUP':
                         $text .= $this->_translator->getMessage('COMMON_ONE_GROUP');
                         $img = 'images/commsyicons/netnavigation/group.png';
                         break;
                     case 'INSTITUTION':
                         $text .= $this->_translator->getMessage('COMMON_ONE_INSTITUTION');
                         $img = '';
                         break;
                     case 'MATERIAL':
                         $text .= $this->_translator->getMessage('COMMON_ONE_MATERIAL');
                         $img = 'images/commsyicons/netnavigation/material.png';
                         break;
                     case 'PROJECT':
                         $text .= $this->_translator->getMessage('COMMON_ONE_PROJECT');
                         $img = '';
                         break;
                     case 'TODO':
                         $text .= $this->_translator->getMessage('COMMON_ONE_TODO');
                         $img = 'images/commsyicons/netnavigation/todo.png';
                         break;
                     case 'TOPIC':
                         $text .= $this->_translator->getMessage('COMMON_ONE_TOPIC');
                         $img = 'images/commsyicons/netnavigation/topic.png';
                         break;
                     case 'USER':
                         $text .= $this->_translator->getMessage('COMMON_USER');
                         $img = 'images/commsyicons/netnavigation/user.png';
                         break;
                     default:
                         $text .= $this->_translator->getMessage('COMMON_MESSAGETAG_ERROR') . ' cs_detail_view(' . __LINE__ . ') ';
                         $img = '';
                         break;
                 }
                 $link_creator_text = $text . ' - ' . $this->_translator->getMessage('COMMON_LINK_CREATOR') . ' ' . $fullname . ', ' . $link_created;
                 switch ($type) {
                     case CS_DISCARTICLE_TYPE:
                         $linked_iid = $linked_item->getDiscussionID();
                         $fragment = $linked_item->getItemID();
                         $discussion_manager = $this->_environment->getDiscussionManager();
                         $linked_item = $discussion_manager->getItem($linked_iid);
                         break;
                     case CS_SECTION_TYPE:
                         $linked_iid = $linked_item->getLinkedItemID();
                         $fragment = $linked_item->getItemID();
                         $material_manager = $this->_environment->getMaterialManager();
                         $linked_item = $material_manager->getItem($linked_iid);
                         break;
                     default:
                         $linked_iid = $linked_item->getItemID();
                 }
                 $html .= '   <li  style="padding-left:5px; list-style-type:none;">';
                 $params = array();
                 $params['iid'] = $linked_iid;
                 $params['link_item_path'] = $this->getItem()->getItemID();
                 $module = Type2Module($type);
                 $user = $this->_environment->getCurrentUser();
                 if ($module == CS_USER_TYPE and (!$linked_item->isUser() or !$linked_item->maySee($user))) {
                     /*$link_title = chunkText($this->_text_as_html_short($linked_item->getFullName()),35);
                     
                                        $html .= ahref_curl( $this->_environment->getCurrentContextID(),
                                                            $module,
                                                            'detail',
                                                            $params,
                                                            '<img src="' . $img . '" style="padding-right:3px;" title="' . $link_creator_text . '"/>',
                                                            $this->_translator->getMessage('USER_STATUS_REJECTED'),
                                                            '_self',
                                                            $fragment,
                                                            '',
                                                            '',
                                                            '',
                                                            'class="disabled"',
                                                            '',
                                                            '',
                                                            true);
                                        $html .= ahref_curl( $this->_environment->getCurrentContextID(),
                                                            $module,
                                                            'detail',
                                                            $params,
                                                            $link_title,
                                                            $this->_translator->getMessage('USER_STATUS_REJECTED'),
                                                            '_self',
                                                            $fragment,
                                                            '',
                                                            '',
                                                            '',
                                                            'class="disabled"',
                                                            '',
                                                            '',
                                                            true); */
                 } else {
                     if ($linked_item->isNotActivated() and !($linked_item->getCreatorID() == $user->getItemID() or $user->isModerator())) {
                         $activating_date = $linked_item->getActivatingDate();
                         if (strstr($activating_date, '9999-00-00')) {
                             $link_creator_text .= ' (' . $this->_translator->getMessage('COMMON_NOT_ACTIVATED') . ')';
                         } else {
                             $link_creator_text .= ' (' . $this->_translator->getMessage('COMMON_ACTIVATING_DATE') . ' ' . getDateInLang($linked_item->getActivatingDate()) . ')';
                         }
                         if ($module == CS_USER_TYPE) {
                             $link_title = chunkText($this->_text_as_html_short($linked_item->getFullName()), 35);
                         } else {
                             $link_title = chunkText($this->_text_as_html_short($linked_item->getTitle()), 35);
                         }
                         $html .= ahref_curl($this->_environment->getCurrentContextID(), $module, 'detail', $params, '<img src="' . $img . '" style="padding-right:3px;" title="' . $link_creator_text . '"/>', $link_creator_text, '_self', $fragment, '', '', '', 'class="disabled"', '', '', true);
                         $html .= ahref_curl($this->_environment->getCurrentContextID(), $module, 'detail', $params, $link_title, $link_creator_text, '_self', $fragment, '', '', '', 'class="disabled"', '', '', true);
                         unset($params);
                     } else {
                         if ($module == CS_USER_TYPE) {
                             $link_title = chunkText($this->_text_as_html_short($linked_item->getFullName()), 35);
                         } else {
                             $link_title = chunkText($this->_text_as_html_short($linked_item->getTitle()), 35);
                         }
                         $html .= ahref_curl($this->_environment->getCurrentContextID(), $module, 'detail', $params, '<img src="' . $img . '" style="padding-right:3px;" title="' . $link_creator_text . '"/>', $link_creator_text, '_self', $fragment, '', '', '', 'style=""');
                         $html .= ahref_curl($this->_environment->getCurrentContextID(), $module, 'detail', $params, $link_title, $link_creator_text, '_self', $fragment, '', '', '', 'style=""');
                         unset($params);
                     }
                 }
                 $html .= '</li>' . LF;
             }
             $link_item = $link_items->getNext();
         }
         $html .= '</ul>' . LF;
     }
     $html .= '<div style="width:235px; font-size:8pt; text-align:right; padding-top:5px;">';
     $current_user = $this->_environment->getCurrentUserItem();
     if ($current_user->isUser() and $this->_with_modifying_actions) {
         $params = array();
         $params = $this->_environment->getCurrentParameterArray();
         $group_manager = $this->_environment->getGroupManager();
         $group_manager->setContextLimit($this->_environment->getCurrentContextID());
         $params['attach_view'] = 'yes';
         $params['attach_type'] = 'item';
         $html .= ahref_curl($this->_environment->getCurrentContextID(), $this->_environment->getCurrentModule(), $this->_environment->getCurrentFunction(), $params, $this->_translator->getMessage('COMMON_ITEM_ATTACH')) . LF;
         unset($params);
     } else {
         $html .= '<span class="disabled">' . $this->_translator->getMessage('COMMON_ITEM_ATTACH') . '</span>' . LF;
     }
     $html .= '</div>' . LF;
     $html .= '      </div>';
     $html .= '      </div>';
     $html .= '      </div>';
     return $html;
 }
Esempio n. 11
0
         $section_item = $section_manager->getItem($iid);
         $sub_iid = 'anchor'.$iid;
         $iid = $section_item->getLinkedItemID();
      }

      // annotation
      elseif ($type == CS_ANNOTATION_TYPE) {
         $annotation_manager = $environment->getAnnotationManager();
         $annotation_item = $annotation_manager->getItem($iid);
         $sub_iid = $iid;
         $iid = $annotation_item->getLinkedItemID();
         $linked_item = $item_manager->getItem($iid);
         $type = $linked_item->getItemType();
      }

      $module = Type2Module($type);
      if ($module == CS_LABEL_TYPE) {
         $label_manager = $environment->getLabelManager();
         $item = $label_manager->getItem($iid);
         $module = $item->getLabelType();
      }

      // redirect to real content
      if ($module == CS_ITEM_TYPE) {
         //illegal iid, go back to start
         $session = $environment->getSessionItem();
         $history = $session->getValue('history');
         redirect($history[0]['context'],$history[0]['module'],$history[0]['function'],$history[0]['parameter']);
      } else {
         $params = array();
         $params['iid'] = $iid;
 public function actionEdit()
 {
     $session = $this->_environment->getSessionItem();
     // get the current user and room
     $current_user = $this->_environment->getCurrentUserItem();
     $room_item = $this->_environment->getCurrentContextItem();
     // get post data
     $this->getPostData();
     // $with_anchor = false;
     // coming back from attaching something
     $backfrom = false;
     if (!empty($_GET['backfrom'])) {
         $backfrom = $_GET['backfrom'];
     }
     // load item from database
     $annotation_item = null;
     if ($this->_item_id !== 'NEW') {
         $annotation_manager = $this->_environment->getAnnotationManager();
         $annotation_item = $annotation_manager->getItem($this->_item_id);
     }
     // get history from session
     $history = $session->getValue('history');
     // save the history
     if (isset($_GET['mode']) && $_GET['mode'] === 'annotate' && $history[0]['module'] !== 'annotation') {
         $session->setValue('annotation_history_context', $history[0]['context']);
         $session->setValue('annotation_history_module', $history[0]['module']);
         $session->setValue('annotation_history_function', $history[0]['function']);
         $session->setValue('annotation_history_parameter', $history[0]['parameter']);
     }
     // check access rights
     $item_manager = $this->_environment->getItemManager();
     if ($this->_item_id !== 'NEW' && !isset($annotation_item)) {
         /*
         * $params = array();
           $params['environment'] = $environment;
           $params['with_modifying_actions'] = true;
           $errorbox = $class_factory->getClass(ERRORBOX_VIEW,$params);
           unset($params);
           $errorbox->setText($translator->getMessage('ITEM_DOES_NOT_EXIST', $current_iid));
           $page->add($errorbox);
         */
     } elseif (!($this->_item_id === 'NEW' && $current_user->isUser() || $room_item->isMaterialOpenForGuests() && $current_user->isGuest() || $this->_item_id !== 'NEW' && isset($annotation_item) && $annotation_item->mayEdit($current_user) || $this->_item_id === 'NEW' && isset($_GET['ref_iid']) && $item_manager->getExternalViewerForItem($_GET['ref_iid'], $current_user->getUserID()))) {
         /*
         *    $params = array();
         							   $params['environment'] = $environment;
         							   $params['with_modifying_actions'] = true;
         							   $errorbox = $class_factory->getClass(ERRORBOX_VIEW,$params);
         							   unset($params);
         							   $errorbox->setText($translator->getMessage('LOGIN_NOT_ALLOWED'));
         							   $page->add($errorbox);
         */
     } else {
         $translator = $this->_environment->getTranslationObject();
         // cancel editing
         if (isOption($this->_command, CS_OPTION_CANCEL)) {
             $context = $session->getValue('annotation_history_context');
             $module = $session->getValue('annotation_history_module');
             $function = $session->getValue('annotation_history_function');
             $param = $session->getValue('annotation_history_parameter');
             $anchor = '';
             if (isset($annotation_item) && $annotation_item !== null) {
                 $anchor = 'anchor' . $annotation_item->getItemID();
             }
             $this->cleanup_session($annotation_item->getItemID());
             redirect($context, $module, $function, $param, $anchor);
             exit;
         }
         // delete item
         if (isOption($this->_command, CS_OPTION_DELETE)) {
             // go back to the origin
             $context = $session->getValue('annotation_history_context');
             $module = $session->getValue('annotation_history_module');
             $function = $session->getValue('annotation_history_function');
             $param = $session->getValue('annotation_history_parameter');
             $this->cleanup_session($annotation_item->getItemID());
             $annotation_item->delete();
             redirect($context, $module, $function, $param);
             exit;
         }
         $post_file_ids = array();
         if (isset($_POST['filelist'])) {
             $post_file_ids = $_POST['filelist'];
         }
         // load form data from postvars
         if (!empty($_POST)) {
             $session_post_vars = $_POST;
             if (isset($post_file_ids) && !empty($post_file_ids)) {
                 $session_post_vars['filelist'] = $post_file_ids;
             }
         } elseif (isset($annotation_item)) {
             /*
             * $form->setItem($annotation_item);
             				
             				         // Files
             				         $file_list = $annotation_item->getFileList();
             				         if ( !$file_list->isEmpty() ) {
             				            $file_array = array();
             				            $file_item = $file_list->getFirst();
             				            while ( $file_item ) {
             				               $temp_array = array();
             				               $temp_array['name'] = $file_item->getDisplayName();
             				               $temp_array['file_id'] = (int)$file_item->getFileID();
             				               $file_array[] = $temp_array;
             				               $file_item = $file_list->getNext();
             				            }
             				            if ( !empty($file_array)) {
             				               $session->setValue($environment->getCurrentModule().'_add_files', $file_array);
             				            }
             				         }
             */
         } elseif ($annotation_item->getItemID() === 'NEW') {
             /*
             * $form->setRefID($_GET['ref_iid']);
             				         if ( !empty($_GET['version']) ) {
             				            $form->setVersion($_GET['version']);
             				         }
             */
         } else {
             include_once 'functions/error_functions.php';
             trigger_error('annotation_edit was called in an unknown manner', E_USER_ERROR);
         }
         if ($session->issetValue($this->_environment->getCurrentModule() . '_add_files')) {
             //$form->setSessionFileArray($session->getValue($environment->getCurrentModule().'_add_files'));
         }
         // save item
         if ($this->_command !== null && (isOption($this->_command, CS_OPTION_SAVE) || isOption($this->_command, CS_OPTION_CHANGE) || isOption($this->_command, CS_OPTION_NEW))) {
             if ($this->checkFormData()) {
                 $user = $this->_environment->getCurrentUserItem();
                 // create new item
                 if ($annotation_item === null) {
                     $annotation_manager = $this->_environment->getAnnotationManager();
                     $annotation_item = $annotation_manager->getNewItem();
                     $annotation_item->setContextID($this->_environment->getCurrentContextID());
                     $annotation_item->setCreatorItem($user);
                     $annotation_item->setCreationDate(getCurrentDateTimeInMySQL());
                 }
                 // set modificator and modification date
                 $annotation_item->setModificatorItem($user);
                 $annotation_item->setModificationDate(getCurrentDateTimeInMySQL());
                 // set attributes
                 if (isset($_POST['form_data']['title'])) {
                     $annotation_item->setTitle($_POST['form_data']['title']);
                 } elseif (isset($_POST['form_data']['annotation_title'])) {
                     $annotation_item->setTitle($_POST['form_data']['title']);
                 }
                 if (isset($_POST['form_data']['description_annotation'])) {
                     $annotation_item->setDescription($_POST['form_data']['description_annotation']);
                 } elseif (isset($_POST['form_data']['annotation_description'])) {
                     $annotation_item->setDescription($_POST['form_data']['annotation_description']);
                 }
                 if (!empty($_POST['ref_iid'])) {
                     $annotation_item->setLinkedItemID($_POST['ref_iid']);
                 }
                 if (!empty($_POST['version'])) {
                     $annotation_item->setLinkedVersionID($_POST['version']);
                 }
                 // set links to connected rubrics
                 if (isset($_POST[CS_MATERIAL_TYPE])) {
                     $annotation_item->setMaterialListByID($_POST[CS_MATERIAL_TYPE]);
                 } else {
                     $annotation_item->setMaterialListByID(array());
                 }
                 // files
                 $this->setFilesForItem($annotation_item, $post_file_ids);
                 // save item
                 $annotation_item->save();
                 // add modifier to all users who ever edited this item
                 $manager = $this->_environment->getLinkModifierItemManager();
                 $manager->markEdited($annotation_item->getItemID());
                 // reset id array
                 $session->setValue('cid' . $this->_environment->getCurrentContextID() . '_annotation_index_ids', array($annotation_item->getItemID()));
                 if (isset($annotation_item) && $annotation_item !== null) {
                     $anchor = 'annotation' . $annotation_item->getItemID();
                 } else {
                     $anchor = '';
                 }
                 $refId = $_POST['ref_iid'];
                 $item_manager = $this->_environment->getItemManager();
                 $type = $item_manager->getItemType($refId);
                 // redirect
                 $this->cleanup_session($this->_item_id);
                 redirect($this->_environment->getCurrentContextID(), Type2Module($type), "detail", array("iid" => $refId), $anchor);
             } else {
                 $refId = $_POST['ref_iid'];
                 $item_manager = $this->_environment->getItemManager();
                 $type = $item_manager->getItemType($refId);
                 // store description in session
                 $sessionKey = 'cid' . $this->_environment->getCurrentContextID() . '_annotation_last_description';
                 if (isset($_POST['form_data']['description_annotation'])) {
                     $session->setValue($sessionKey, $_POST['form_data']['description_annotation']);
                 } else {
                     if (isset($_POST['form_data']['annotation_description'])) {
                         $session->setValue($sessionKey, $_POST['form_data']['annotation_description']);
                     }
                 }
                 redirect($this->_environment->getCurrentContextID(), Type2Module($type), "detail", array("iid" => $refId, "annotation_exception" => "mandatory"), "annotation-1");
             }
         }
     }
 }
 public function actionQuery()
 {
     $return = array("items" => array());
     $start = $this->_data["options"]["start"];
     $numEntries = $this->_data["options"]["numEntries"];
     $itemManager = $this->_environment->getItemManager();
     $userManager = $this->_environment->getUserManager();
     $currentUser = $this->_environment->getCurrentUserItem();
     $translator = $this->_environment->getTranslationObject();
     $released_ids = $itemManager->getExternalViewerEntriesForRoom($currentUser->getOwnRoom()->getItemID());
     $item_list = $itemManager->getItemList($released_ids);
     $item_list->sortby("modification_date");
     $item_list->reverse();
     /*
      * $noticed_manager = $this->_environment->getNoticedManager();
     $noticed_manager->getLatestNoticedByIDArray($released_ids);
     $noticed_manager->getLatestNoticedAnnotationsByIDArray($released_ids);
     */
     // prepare return
     $entry = $item_list->getFirst();
     $count = 0;
     while ($entry) {
         if ($count >= $start && $count < $start + $numEntries) {
             $type = $entry->getItemType();
             if ($type == CS_LABEL_TYPE) {
                 $labelManager = $this->_environment->getLabelManager();
                 $entry = $labelManager->getItem($entry->getItemID());
                 $type = $entry->getLabelType();
             } else {
                 $manager = $this->_environment->getManager($type);
                 $entry = $manager->getItem($entry->getItemID());
             }
             if (isset($entry) and !empty($entry)) {
                 // released for
                 $externalViewerArray = $entry->getExternalViewerArray();
                 $user = "";
                 foreach ($externalViewerArray as $externalViewer) {
                     $userManager->setUserIDLimit($externalViewer);
                     $userManager->setContextLimit($this->_environment->getCurrentPortalID());
                     $userManager->select();
                     $userList = $userManager->get();
                     $userItem = $userList->getFirst();
                     if (isset($userItem) && is_object($userItem)) {
                         if (!empty($user)) {
                             $user .= ", ";
                         }
                         $user .= $userItem->getFullname();
                     }
                 }
                 $releasedFor = $translator->getMessage("PRIVATEROOM_RELEASED_FOR") . ": " . $user;
                 if ($type === CS_MATERIAL_TYPE) {
                     $versionId = $entry->getVersionID();
                 } else {
                     $versionId = null;
                 }
                 $return["items"][] = array("itemId" => $entry->getItemID(), "contextId" => $entry->getContextID(), "module" => Type2Module($type), "title" => $entry->getTitle(), "image" => $this->getUtils()->getLogoInformationForType($type), "releasedFor" => $releasedFor, "versionId" => $versionId);
             }
         }
         $count++;
         $entry = $item_list->getNext();
     }
     $return["total"] = $count;
     $this->setSuccessfullDataReturn($return);
     echo $this->_return;
 }
Esempio n. 14
0
 function _getLinkedItemsAsHTML($link_array, $connection, $is_perspective = false, $always = true, $attach_link = false)
 {
     $current_context = $this->_environment->getCurrentContextItem();
     $user = $this->_environment->getCurrentUserItem();
     $html = '';
     $mod = $this->_with_modifying_actions;
     $module = Type2Module($connection);
     if ($connection != CS_SECTION_TYPE and $connection != CS_DISCARTICLE_TYPE) {
         switch (mb_strtoupper($connection, 'UTF-8')) {
             case 'ANOUNCEMENT':
                 $temp_title = $this->_translator->getMessage('ANNOUNCEMENTS');
                 break;
             case 'DATE':
                 $temp_title = $this->_translator->getMessage('DATES');
                 break;
             case 'DISCUSSION':
                 $temp_title = $this->_translator->getMessage('DISCUSSIONS');
                 break;
             case 'GROUP':
                 $temp_title = $this->_translator->getMessage('GROUPS');
                 break;
             case 'INSTITUTION':
                 $temp_title = $this->_translator->getMessage('INSTITUTIONS');
                 break;
             case 'MATERIAL':
                 $temp_title = $this->_translator->getMessage('MATERIALS');
                 break;
             case 'PROJECT':
                 $temp_title = $this->_translator->getMessage('PROJECTS');
                 break;
             case 'TODO':
                 $temp_title = $this->_translator->getMessage('TODOS');
                 break;
             case 'TOPIC':
                 $temp_title = $this->_translator->getMessage('TOPICS');
                 break;
             case 'USER':
                 $temp_title = $this->_translator->getMessage('USERS');
                 break;
             default:
                 $temp_title = $this->_translator->getMessage('COMMON_MESSAGETAG_ERROR') . ' cs_form_view(2009) ';
                 break;
         }
     } else {
         $temp_title = $this->_translator->getMessage('MATERIALS');
         if ($connection == CS_DISCARTICLE_TYPE) {
             $temp_title = $this->_translator->getMessage('DISCUSSIONS');
         }
     }
     $html .= '		<div class="netnavigation_panel">     ' . LF;
     $html .= '         <noscript>';
     $html .= '<div class="netnavigation_title">' . $temp_title . '</div>';
     $html .= '         </noscript>';
     $html .= '         <div>';
     $html .= '<div class="netnavigation_list" style="border-top:1px solid #B0B0B0;">' . LF;
     if (empty($link_array['value'])) {
         $html .= '<ul style="padding-top:0px;">' . LF;
         $html .= '   <li>';
         $html .= '   <span class="disabled">' . $this->_translator->getMessage('COMMON_NONE') . '</span>' . LF;
         $html .= '   </li>';
         $html .= '   </ul>';
     } else {
         $html .= '<ul style="padding-top:0px; list-style:none; margin-left:0px; padding-left:0px;">' . LF;
         $html .= '   <li>';
         $html .= $this->_getCheckboxGroupAsHTML($link_array);
         $html .= '   </li>';
         $html .= '   </ul>';
     }
     $html .= '</div>' . LF;
     if ($link_array['link_text']) {
         $html .= '<div style="border-top:0px; text-align:center; padding-bottom:3px;">' . LF;
         $params = array();
         $tempMessage = "";
         switch (mb_strtoupper($connection, 'UTF-8')) {
             case 'GROUP':
                 // Button: Gruppen zuordnen (erst ab 20 vorhand. Gruppen) OK
                 $tempMessage = $this->_translator->getMessage('RUBRIC_DO_ATTACH_GROUP_BUTTON');
                 break;
             case 'INSTITUTION':
                 // Button: Institutionen suchen (erst ab 20 vorhand. Institutionen) OK
                 $tempMessage = $this->_translator->getMessage('RUBRIC_DO_ATTACH_INSTITUTION_BUTTON');
                 break;
             case 'MATERIAL':
                 // Button: Materialien zuordnen (erst ab 20 vorhand. Materialien) OK
                 $tempMessage = $this->_translator->getMessage('RUBRIC_DO_ATTACH_MATERIAL_BUTTON');
                 break;
             case 'DATE':
                 // Button: DATEien zuordnen (erst ab 20 vorhand. DATEien) OK
                 $tempMessage = $this->_translator->getMessage('RUBRIC_DO_ATTACH_DATE_BUTTON');
                 break;
             case 'ANNOUNCEMENT':
                 // Button: ANNOUNCEMENTien zuordnen (erst ab 20 vorhand. ANNOUNCEMENTien) OK
                 $tempMessage = $this->_translator->getMessage('RUBRIC_DO_ATTACH_ANNOUNCEMENT_BUTTON');
                 break;
             case 'DISCUSSION':
                 // Button: DISCUSSIONien zuordnen (erst ab 20 vorhand. DISCUSSIONien) OK
                 $tempMessage = $this->_translator->getMessage('RUBRIC_DO_ATTACH_DISCUSSION_BUTTON');
                 break;
             case 'TODO':
                 // Button: TODOien zuordnen (erst ab 20 vorhand. TODOien) OK
                 $tempMessage = $this->_translator->getMessage('RUBRIC_DO_ATTACH_TODO_BUTTON');
                 break;
             case 'PROJECT':
                 // Button: Projekträume zuordnen (erst ab 20 vorhand. Projekträumen) OK
                 $tempMessage = $this->_translator->getMessage('RUBRIC_DO_ATTACH_PROJECT_BUTTON');
                 break;
             case 'TOPIC':
                 // Button: Themen suchen (erst ab 20 vorhand. Themen)OK
                 $tempMessage = $this->_translator->getMessage('RUBRIC_DO_ATTACH_TOPIC_BUTTON');
                 break;
             default:
                 $tempMessage = $this->_translator->getMessage('COMMON_MESSAGETAG_ERROR') . " cs_form_view(2062) ";
                 break;
         }
         $params['option'] = $tempMessage;
         $html .= '<input style="width:150px; font-size:8pt;" type="submit" name="option"';
         $html .= ' value="' . $tempMessage . '"';
         $html .= '/>';
         $html .= '</div>' . LF;
     }
     $html .= '</div>' . LF;
     $html .= '</div>' . LF;
     return $html;
 }
Esempio n. 15
0
 public function actionUpdateLinkedItem()
 {
     $return = array();
     // get request data
     $item_id = $this->_data['item_id'];
     $link_id = $this->_data['link_id'];
     $checked = $this->_data['checked'];
     // get item
     $item_manager = $this->_environment->getItemManager();
     $temp_item = $item_manager->getItem($item_id);
     if (isset($temp_item)) {
         if ($temp_item->getItemType() == 'label') {
             $label_manager = $this->_environment->getLabelManager();
             $label_item = $label_manager->getItem($temp_item->getItemID());
             $manager = $this->_environment->getManager($label_item->getLabelType());
         } else {
             $manager = $this->_environment->getManager($temp_item->getItemType());
         }
         $item = $manager->getItem($item_id);
     }
     // get ids of linked items
     $selected_ids = $this->getLinkedItemIDArray($item);
     // update id array
     if ($checked === true) {
         // add
         $selected_ids[] = $link_id;
         $selected_ids = array_unique($selected_ids);
         // ensure uniqueness
         // get linked item
         $temp_item = $item_manager->getItem($link_id);
         if (isset($temp_item)) {
             $manager = $this->_environment->getManager($temp_item->getItemType());
             $linked_item = $manager->getItem($link_id);
         }
         // collect new item information
         $entry = array();
         $user = $this->_environment->getCurrentUser();
         $converter = $this->_environment->getTextConverter();
         $translator = $this->_environment->getTranslationObject();
         $type = $linked_item->getType();
         if ($type === 'label') {
             $type = $linked_item->getLabelType();
         }
         switch (mb_strtoupper($type, 'UTF-8')) {
             case 'ANNOUNCEMENT':
                 $text = $translator->getMessage('COMMON_ONE_ANNOUNCEMENT');
                 $img = 'announcement.png';
                 break;
             case 'DATE':
                 $text = $translator->getMessage('COMMON_ONE_DATE');
                 $img = 'date.png';
                 break;
             case 'DISCUSSION':
                 $text = $translator->getMessage('COMMON_ONE_DISCUSSION');
                 $img = 'discussion.png';
                 break;
             case 'GROUP':
                 $text = $translator->getMessage('COMMON_ONE_GROUP');
                 $img = 'group.png';
                 break;
             case 'INSTITUTION':
                 $text = $translator->getMessage('COMMON_ONE_INSTITUTION');
                 $img = '';
                 break;
             case 'MATERIAL':
                 $text = $translator->getMessage('COMMON_ONE_MATERIAL');
                 $img = 'material.png';
                 break;
             case 'PROJECT':
                 $text = $translator->getMessage('COMMON_ONE_PROJECT');
                 $img = '';
                 break;
             case 'TODO':
                 $text = $translator->getMessage('COMMON_ONE_TODO');
                 $img = 'todo.png';
                 break;
             case 'TOPIC':
                 $text = $translator->getMessage('COMMON_ONE_TOPIC');
                 $img = 'topic.png';
                 break;
             case 'USER':
                 $text = $translator->getMessage('COMMON_ONE_USER');
                 $img = 'user.png';
                 break;
             default:
                 $text = $translator->getMessage('COMMON_MESSAGETAB_ERROR');
                 $img = '';
                 break;
         }
         $link_creator_text = $text . ' - ' . $translator->getMessage('COMMON_LINK_CREATOR') . ' ' . $entry['creator'];
         switch ($type) {
             case CS_DISCARTICLE_TYPE:
                 $linked_iid = $linked_item->getDiscussionID();
                 $discussion_manager = $this->_environment->getDiscussionManager();
                 $linked_item = $discussion_manager->getItem($linked_iid);
                 break;
             case CS_SECTION_TYPE:
                 $linked_iid = $linked_item->getLinkedItemID();
                 $material_manager = $this->_environment->getMaterialManager();
                 $linked_item = $material_manager->getItem($linked_iid);
                 break;
             default:
                 $linked_iid = $linked_item->getItemID();
         }
         $entry['linked_iid'] = $linked_iid;
         $module = Type2Module($type);
         if ($linked_item->isNotActivated() && !($linked_item->getCreatorID() === $user->getItemID() || $user->isModerator())) {
             $activating_date = $linked_item->getActivatingDate();
             if (strstr($activating_date, '9999-00-00')) {
                 $link_creator_text .= ' (' . $translator->getMessage('COMMON_NOT_ACTIVATED') . ')';
             } else {
                 $link_creator_text .= ' (' . $translator->getMessage('COMMON_ACTIVATING_DATE') . ' ' . getDateInLang($linked_item->getActivatingDate()) . ')';
             }
             if ($module === CS_USER_TYPE) {
                 $title = $linked_item->getFullName();
             } else {
                 $title = $linked_item->getTitle();
             }
             $title = $converter->text_as_html_short($title);
             $entry['module'] = $module;
             $entry['img'] = $img;
             $entry['title'] = $link_creator_text;
             $entry['link_text'] = $title;
         } else {
             if ($module === CS_USER_TYPE) {
                 $title = $linked_item->getFullName();
             } else {
                 $title = $linked_item->getTitle();
             }
             $title = $converter->text_as_html_short($title);
             $entry['module'] = $module;
             $entry['img'] = $img;
             $entry['title'] = $link_creator_text;
             $entry['link_text'] = $title;
         }
         $return['linked_item'] = $entry;
     } else {
         // remove
         if (($offset = array_search($link_id, $selected_ids)) !== false) {
             array_splice($selected_ids, $offset, 1);
         }
     }
     // update item
     if (isset($item)) {
         if ($item->isA(CS_LABEL_TYPE) && $item->getLabelType() == CS_BUZZWORD_TYPE) {
             $item->saveLinksByIDArray($selected_ids);
         } else {
             $item->setLinkedItemsByIDArray($selected_ids);
             $item->save();
         }
     }
     $this->setSuccessfullDataReturn($return);
     echo $this->_return;
 }
 public function actionQuery()
 {
     $return = array("items" => array());
     $start = $this->_data["options"]["start"];
     $numEntries = $this->_data["options"]["numEntries"];
     $itemManager = $this->_environment->getItemManager();
     $currentUser = $this->_environment->getCurrentUserItem();
     // collection room ids
     $room_id_array = array();
     $grouproom_list = $currentUser->getUserRelatedGroupList();
     if (isset($grouproom_list) and $grouproom_list->isNotEmpty()) {
         $grouproom_list->reverse();
         $grouproom_item = $grouproom_list->getFirst();
         while ($grouproom_item) {
             $project_room_id = $grouproom_item->getLinkedProjectItemID();
             if (in_array($project_room_id, $room_id_array)) {
                 $room_id_array_temp = array();
                 foreach ($room_id_array as $value) {
                     $room_id_array_temp[] = $value;
                     if ($value == $project_room_id) {
                         $room_id_array_temp[] = $grouproom_item->getItemID();
                     }
                 }
                 $room_id_array = $room_id_array_temp;
             }
             $grouproom_item = $grouproom_list->getNext();
         }
     }
     $project_list = $currentUser->getUserRelatedProjectList();
     if (isset($project_list) and $project_list->isNotEmpty()) {
         $project_item = $project_list->getFirst();
         while ($project_item) {
             $room_id_array[] = $project_item->getItemID();
             $project_item = $project_list->getNext();
         }
     }
     $community_list = $currentUser->getUserRelatedCommunityList();
     if (isset($community_list) and $community_list->isNotEmpty()) {
         $community_item = $community_list->getFirst();
         while ($community_item) {
             $room_id_array[] = $community_item->getItemID();
             $community_item = $community_list->getNext();
         }
     }
     $room_id_array_without_privateroom = $room_id_array;
     $itemManager->setOrderLimit(true);
     if (isset($room_id_array_without_privateroom) && !empty($room_id_array_without_privateroom)) {
         $new_entry_array = $itemManager->getAllNewPrivateRoomEntriesOfRoomList($room_id_array_without_privateroom);
         $new_entry_list = $itemManager->getPrivateRoomHomeItemList($new_entry_array);
     } else {
         $new_entry_list = new cs_list();
     }
     // sort list
     $new_entry_list->sortby("modification_date");
     $new_entry_list->reverse();
     // prepare return
     $entry = $new_entry_list->getFirst();
     $count = 0;
     while ($entry) {
         if ($count >= $start && $count < $start + $numEntries) {
             $type = $entry->getItemType();
             if ($type == CS_LABEL_TYPE) {
                 $labelManager = $this->_environment->getLabelManager();
                 $entry = $labelManager->getItem($entry->getItemID());
                 $type = $entry->getLabelType();
             } else {
                 $manager = $this->_environment->getManager($type);
                 $entry = $manager->getItem($entry->getItemID());
             }
             if (isset($entry) and !empty($entry)) {
                 // skip portfolio
                 if ($entry->getType() !== CS_PORTFOLIO_TYPE) {
                     $moddate = $entry->getModificationDate();
                     if (mb_strstr($moddate, '9999-00-00')) {
                         $mod_date = "'";
                     } else {
                         if ($entry->getCreationDate() != $entry->getModificationDate()) {
                             $mod_date = $this->_environment->getTranslationObject()->getDateInLang($entry->getModificationDate());
                         } else {
                             $mod_date = $this->_environment->getTranslationObject()->getDateInLang($entry->getCreationDate());
                         }
                     }
                     if ($type === CS_MATERIAL_TYPE) {
                         $versionId = $entry->getVersionID();
                     } else {
                         $versionId = null;
                     }
                     $return["items"][] = array("itemId" => $entry->getItemID(), "contextId" => $entry->getContextID(), "module" => Type2Module($type), "title" => $entry->getTitle(), "image" => $this->getUtils()->getLogoInformationForType($type), "fileCount" => $entry->getFileList()->getCount(), "modificationDate" => $mod_date, "creator" => $entry->getCreatorItem()->getFullName(), "versionId" => $versionId);
                 }
             }
         }
         if (isset($entry) && !empty($entry) && $entry->getType() !== CS_PORTFOLIO_TYPE) {
             $count++;
         }
         $entry = $new_entry_list->getNext();
     }
     $return["total"] = $count;
     $this->setSuccessfullDataReturn($return);
     echo $this->_return;
 }
 public function actionGetListContent()
 {
     $return = array("items" => array());
     $search = $this->_data["search"];
     $start = $this->_data["start"];
     $numEntries = $this->_data["numEntries"];
     $buzzwordIds = $this->_data["buzzwordRestrictions"];
     $tagIds = $this->_data["tagRestrictions"];
     $currentUser = $this->_environment->getCurrentUserItem()->getRelatedPrivateRoomUserItem();
     $itemManager = $this->_environment->getItemManager();
     $privateRoomItem = $currentUser->getOwnRoom();
     $userIdArray = array($currentUser->getItemID());
     $privateRoomIdArray = array($privateRoomItem->getItemID());
     $itemManager->setOrderLimit(true);
     if ($search) {
         $itemManager->setSearchLimit($search);
     }
     if ($buzzwordIds) {
         $itemManager->setBuzzwordLimit($buzzwordIds[0]);
     }
     if ($tagIds) {
         $itemManager->setTagLimit($tagIds[0]);
     }
     /*
     * finaly removed?
     * 
     			if (!empty($sellist) and $sellist != 'new'){
     				$item_manager->setListLimit($sellist);
     			}
     			if (!empty($selmatrix)){
     				$item_manager->setMatrixLimit($selmatrix);
     			}
     */
     $entryList = $itemManager->getAllPrivateRoomEntriesOfUserList($privateRoomIdArray, $userIdArray);
     #pr($entryList);
     // ToDo: Nur Einträge in der Liste belassen, die auch angezeigt werden -> sonst gibt es leere Seiten über die geblättert wird!
     $rubricArray = array(CS_ANNOUNCEMENT_TYPE, CS_DISCUSSION_TYPE, CS_DATE_TYPE, CS_MATERIAL_TYPE, CS_TODO_TYPE);
     $filteredList = new cs_list();
     $entry = $entryList->getFirst();
     while ($entry) {
         if (in_array($entry->getItemType(), $rubricArray)) {
             $filteredList->add($entry);
         }
         $entry = $entryList->getNext();
     }
     // prepare return
     $entry = $filteredList->getFirst();
     $count = 0;
     while ($entry) {
         if ($count >= $start && $count < $start + $numEntries) {
             $type = $entry->getItemType();
             if ($type == CS_LABEL_TYPE) {
                 $labelManager = $this->_environment->getLabelManager();
                 $entry = $labelManager->getItem($entry->getItemID());
                 $type = $entry->getLabelType();
             } else {
                 $manager = $this->_environment->getManager($type);
                 $entry = $manager->getItem($entry->getItemID());
             }
             if ($entry != null) {
                 $moddate = $entry->getModificationDate();
                 if ($entry->getCreationDate() != $entry->getModificationDate() and !strstr($moddate, '9999-00-00')) {
                     $mod_date = $this->_environment->getTranslationObject()->getDateInLang($entry->getModificationDate());
                 } else {
                     $mod_date = $this->_environment->getTranslationObject()->getDateInLang($entry->getCreationDate());
                 }
                 if ($type === CS_MATERIAL_TYPE) {
                     $versionId = $entry->getVersionID();
                 } else {
                     $versionId = null;
                 }
                 $return["items"][] = array("itemId" => $entry->getItemID(), "contextId" => $entry->getContextID(), "module" => Type2Module($type), "title" => $entry->getTitle(), "image" => $this->getUtils()->getLogoInformationForType($type), "fileCount" => $entry->getFileList()->getCount(), "modificationDate" => $mod_date, "versionId" => $versionId);
             }
         }
         $count++;
         $entry = $filteredList->getNext();
     }
     $return["total"] = $count;
     $this->setSuccessfullDataReturn($return);
     echo $this->_return;
 }
 public function actionUpdateLinkedItem()
 {
     $return = array();
     // get request data
     $item_id = $this->_data['item_id'];
     $link_id = $this->_data['link_id'];
     $checked = $this->_data['checked'];
     // get item
     $item_manager = $this->_environment->getItemManager();
     $temp_item = $item_manager->getItem($item_id);
     if (isset($temp_item)) {
         if ($temp_item->getItemType() == 'label') {
             $label_manager = $this->_environment->getLabelManager();
             $label_item = $label_manager->getItem($temp_item->getItemID());
             $manager = $this->_environment->getManager($label_item->getLabelType());
         } else {
             $manager = $this->_environment->getManager($temp_item->getItemType());
         }
         $item = $manager->getItem($item_id);
     }
     // TODO: implement - users are not allowed to remove themself from the "All Members" group
     // get ids of linked items
     $selected_ids = $this->getLinkedItemIDArray($item);
     // get linked item
     $temp_item = $item_manager->getItem($link_id);
     if (isset($temp_item)) {
         $manager = $this->_environment->getManager($temp_item->getItemType());
         $linked_item = $manager->getItem($link_id);
     }
     $type = $linked_item->getType();
     if ($type === 'label') {
         $type = $linked_item->getLabelType();
     }
     // update id array
     if ($checked === true) {
         // add
         $selected_ids[] = $link_id;
         $selected_ids = array_unique($selected_ids);
         // ensure uniqueness
         // collect new item information
         $entry = array();
         $user = $this->_environment->getCurrentUser();
         $converter = $this->_environment->getTextConverter();
         $translator = $this->_environment->getTranslationObject();
         $logoInformation = $this->getUtils()->getLogoInformationForType($type);
         $text = $logoInformation["text"];
         $img = $logoInformation["img"];
         $link_creator_text = $text . ' - ' . $translator->getMessage('COMMON_LINK_CREATOR') . ' ' . $entry['creator'];
         switch ($type) {
             case CS_DISCARTICLE_TYPE:
                 $linked_iid = $linked_item->getDiscussionID();
                 $discussion_manager = $this->_environment->getDiscussionManager();
                 $linked_item = $discussion_manager->getItem($linked_iid);
                 break;
             case CS_SECTION_TYPE:
                 $linked_iid = $linked_item->getLinkedItemID();
                 $material_manager = $this->_environment->getMaterialManager();
                 $linked_item = $material_manager->getItem($linked_iid);
                 break;
             case CS_USER_TYPE:
                 if ($item->getType() == 'label') {
                     $item_type = $item->getLabelType();
                 } else {
                     $item_type = $item->getType();
                 }
                 if (isset($item) && $item_type == 'group' && $item->isGrouproomActivated()) {
                     // room exists in group
                     $group_room = $item->getGroupRoomItem();
                     // build new user_item
                     $user_manager = $this->_environment->getUserManager();
                     $related_user = $user_manager->getItem($link_id);
                     $private_room_user_item = $related_user->getRelatedPrivateRoomUserItem();
                     if (isset($private_room_user_item)) {
                         $user_item = $private_room_user_item->cloneData();
                         $picture = $private_room_user_item->getPicture();
                     } else {
                         $user_item = $related_user->cloneData();
                         $picture = $related_user->getPicture();
                     }
                     $user_item->setVisibleToLoggedIn();
                     $user_item->setContextID($group_room->getItemID());
                     if (!empty($picture)) {
                         $value_array = explode('_', $picture);
                         $value_array[0] = 'cid' . $user_item->getContextID();
                         $new_picture_name = implode('_', $value_array);
                         $disc_manager = $this->_environment->getDiscManager();
                         $disc_manager->copyImageFromRoomToRoom($picture, $user_item->getContextID());
                         $user_item->setPicture($new_picture_name);
                     }
                     // check room entry
                     if (!$group_room->isUser($user_item)) {
                         if ($group_room->checkNewMembersAlways()) {
                             //
                             $user_item->request();
                             $user_item->save();
                         } else {
                             if ($group_room->checkNewMembersWithCode()) {
                                 // user must enter the correct code if he wants to join the room
                                 #$user_item->save();
                             } else {
                                 if ($group_room->checkNewMembersNever()) {
                                     // user is now member of the room
                                     $user_item->makeUser();
                                     $user_item->save();
                                 }
                             }
                         }
                     }
                     #$room_item = $linked_item->getLinkedProjectItem();
                     #$room_item->a
                 }
                 // if we assign a user...
                 if (isset($item) && $item->getType() === CS_TODO_TYPE) {
                     // ...to a task
                     $item->addProcessor($linked_item);
                     break;
                 }
             default:
                 $linked_iid = $linked_item->getItemID();
         }
         $entry['linked_iid'] = $linked_iid;
         $module = Type2Module($type);
         if ($linked_item->isNotActivated() && !($linked_item->getCreatorID() === $user->getItemID() || $user->isModerator())) {
             $activating_date = $linked_item->getActivatingDate();
             if (strstr($activating_date, '9999-00-00')) {
                 $link_creator_text .= ' (' . $translator->getMessage('COMMON_NOT_ACTIVATED') . ')';
             } else {
                 $link_creator_text .= ' (' . $translator->getMessage('COMMON_ACTIVATING_DATE') . ' ' . getDateInLang($linked_item->getActivatingDate()) . ')';
             }
             if ($module === CS_USER_TYPE) {
                 $title = $linked_item->getFullName();
             } else {
                 $title = $linked_item->getTitle();
             }
             $title = $converter->text_as_html_short($title);
             $entry['module'] = $module;
             $entry['img'] = $img;
             $entry['title'] = $link_creator_text;
             $entry['link_text'] = $title;
         } else {
             if ($module === CS_USER_TYPE) {
                 $title = $linked_item->getFullName();
             } else {
                 $title = $linked_item->getTitle();
             }
             $title = $converter->text_as_html_short($title);
             $entry['module'] = $module;
             $entry['img'] = $img;
             $entry['title'] = $link_creator_text;
             $entry['link_text'] = $title;
         }
         $return['linked_item'] = $entry;
     } else {
         // remove
         if ($type === CS_USER_TYPE && $item->getType() === CS_TODO_TYPE) {
             $item->removeProcessor($linked_item);
         } else {
             if ($type === CS_USER_TYPE && $item->getType() === CS_LABEL_TYPE) {
                 $selected_ids[] = $link_id;
                 $selected_ids = array_unique($selected_ids);
                 if ($item->getLabelType() === CS_GROUP_TYPE) {
                     $user_manager = $this->_environment->getUserManager();
                     $user = $user_manager->getItem($link_id);
                     $group_room = $item->getGroupRoomItem();
                     if ($group_room->isUser($user)) {
                         $related_user = $user->getRelatedUserItemInContext($group_room->getItemID());
                         $moderatorList = $group_room->getModeratorList();
                         // dont remove last moderator
                         if (!$related_user->isModerator() && $moderatorList->getCount() > 1) {
                             $related_user->delete();
                             $key = array_search($user->getItemID(), $selected_ids);
                             if ($key !== false) {
                                 unset($selected_ids[$key]);
                             }
                         } else {
                             $return['last_moderator'] = true;
                         }
                     }
                 }
             } else {
                 if (($offset = array_search($link_id, $selected_ids)) !== false) {
                     array_splice($selected_ids, $offset, 1);
                 }
             }
         }
     }
     // update item
     if (isset($item)) {
         if ($item->isA(CS_LABEL_TYPE) && $item->getLabelType() == CS_BUZZWORD_TYPE) {
             $item->saveLinksByIDArray($selected_ids);
         } else {
             $item->setLinkedItemsByIDArray($selected_ids);
             $item->save();
         }
     }
     $this->setSuccessfullDataReturn($return);
     echo $this->_return;
 }
Esempio n. 19
0
 public function actionUpdateLinkedItem()
 {
     $return = array();
     // get request data
     $item_id = $this->_data['item_id'];
     $link_id = $this->_data['link_id'];
     $checked = $this->_data['checked'];
     $contextId = $this->_data["contextId"];
     if ($contextId !== null) {
         $this->_environment->changeContextToPrivateRoom($contextId);
     }
     // get item
     $item_manager = $this->_environment->getItemManager();
     $temp_item = $item_manager->getItem($item_id);
     if (isset($temp_item)) {
         if ($temp_item->getItemType() == 'label') {
             $label_manager = $this->_environment->getLabelManager();
             $label_item = $label_manager->getItem($temp_item->getItemID());
             $manager = $this->_environment->getManager($label_item->getLabelType());
         } else {
             $manager = $this->_environment->getManager($temp_item->getItemType());
         }
         $item = $manager->getItem($item_id);
     }
     // TODO: implement - users are not allowed to remove themself from the "All Members" group
     // get ids of linked items
     $selected_ids = $this->getLinkedItemIDArray($item);
     // update id array
     if ($checked === true) {
         // add
         $selected_ids[] = $link_id;
         $selected_ids = array_unique($selected_ids);
         // ensure uniqueness
         // get linked item
         $temp_item = $item_manager->getItem($link_id);
         if (isset($temp_item)) {
             $manager = $this->_environment->getManager($temp_item->getItemType());
             $linked_item = $manager->getItem($link_id);
         }
         // collect new item information
         $entry = array();
         $user = $this->_environment->getCurrentUser();
         $converter = $this->_environment->getTextConverter();
         $translator = $this->_environment->getTranslationObject();
         $type = $linked_item->getType();
         if ($type === 'label') {
             $type = $linked_item->getLabelType();
         }
         $logoInformation = $this->getUtils()->getLogoInformationForType($type);
         $text = $logoInformation["text"];
         $img = $logoInformation["img"];
         $link_creator_text = $text . ' - ' . $translator->getMessage('COMMON_LINK_CREATOR') . ' ' . $entry['creator'];
         switch ($type) {
             case CS_DISCARTICLE_TYPE:
                 $linked_iid = $linked_item->getDiscussionID();
                 $discussion_manager = $this->_environment->getDiscussionManager();
                 $linked_item = $discussion_manager->getItem($linked_iid);
                 break;
             case CS_SECTION_TYPE:
                 $linked_iid = $linked_item->getLinkedItemID();
                 $material_manager = $this->_environment->getMaterialManager();
                 $linked_item = $material_manager->getItem($linked_iid);
                 break;
             default:
                 $linked_iid = $linked_item->getItemID();
         }
         $entry['linked_iid'] = $linked_iid;
         $module = Type2Module($type);
         if ($linked_item->isNotActivated() && !($linked_item->getCreatorID() === $user->getItemID() || $user->isModerator())) {
             $activating_date = $linked_item->getActivatingDate();
             if (strstr($activating_date, '9999-00-00')) {
                 $link_creator_text .= ' (' . $translator->getMessage('COMMON_NOT_ACTIVATED') . ')';
             } else {
                 $link_creator_text .= ' (' . $translator->getMessage('COMMON_ACTIVATING_DATE') . ' ' . getDateInLang($linked_item->getActivatingDate()) . ')';
             }
             if ($module === CS_USER_TYPE) {
                 $title = $linked_item->getFullName();
             } else {
                 $title = $linked_item->getTitle();
             }
             $title = $converter->text_as_html_short($title);
             $entry['module'] = $module;
             $entry['img'] = $img;
             $entry['title'] = $link_creator_text;
             $entry['link_text'] = $title;
         } else {
             if ($module === CS_USER_TYPE) {
                 $title = $linked_item->getFullName();
             } else {
                 $title = $linked_item->getTitle();
             }
             $title = $converter->text_as_html_short($title);
             $entry['module'] = $module;
             $entry['img'] = $img;
             $entry['title'] = $link_creator_text;
             $entry['link_text'] = $title;
         }
         $return['linked_item'] = $entry;
     } else {
         // remove
         $tmp_array = array();
         foreach ($selected_ids as $id) {
             if ($link_id != $id) {
                 $tmp_array[] = $id;
             }
         }
         $selected_ids = $tmp_array;
         // if(($offset = array_search($link_id, $selected_ids)) !== false) array_splice($selected_ids, $offset, 1);
     }
     // update item
     if (isset($item)) {
         if ($item->isA(CS_LABEL_TYPE) && $item->getLabelType() == CS_BUZZWORD_TYPE) {
             $item->saveLinksByIDArray($selected_ids);
         } else {
             $item->setLinkedItemsByIDArray($selected_ids);
             $item->save();
         }
     }
     $this->setSuccessfullDataReturn($return);
     echo $this->_return;
 }