public function actionPerformRequest() { $return = array(); $current_user = $this->_environment->getCurrentUser(); $session = $this->_environment->getSessionItem(); // get request data $item_id = $this->_data['item_id']; $module = $this->_data['module']; $current_page = $this->_data['current_page']; $restrictions = $this->_data['restrictions']; // 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); } $current_context = $item !== null ? $item->getContextItem() : $this->_environment->getCurrentContextItem(); // get ids of linked items $selected_ids = $item_id !== "NEW" ? $this->getLinkedItemIDArray($item) : array(); // build item list $item_list = new cs_list(); $item_ids = array(); $count_all = 0; if (!($item_id === "NEW" && $restrictions['only_linked'] === true)) { // get current room modules $room_modules = array(); $current_room_modules = $current_context->getHomeConf(); if (!empty($current_room_modules)) { $room_modules = explode(',', $current_room_modules); } if ($current_context->isPrivateRoom()) { $rubric_array = array(CS_MATERIAL_TYPE, CS_DISCUSSION_TYPE, CS_DISCUSSION_TYPE, CS_DATE_TYPE); } else { $rubric_array = array(); foreach ($room_modules as $room_module) { list($name, $display) = explode('_', $room_module); if ($display != 'none' && !($current_context->isPrivateRoom() && $name == 'user') && !($name == CS_USER_TYPE && ($module == CS_MATERIAL_TYPE || $module == CS_DISCUSSION_TYPE || $module == CS_ANNOUNCEMENT_TYPE || $module == CS_TOPIC_TYPE))) { $rubric_array[] = $name; } } if ($module == CS_USER_TYPE) { $rubric_array = array(); if ($current_context->withRubric(CS_GROUP_TYPE)) { $rubric_array[] = CS_GROUP_TYPE; } if ($current_context->withRubric(CS_INSTITUTION_TYPE)) { $rubric_array[] = CS_INSTITUTION_TYPE; } } } // perform rubric restriction if (!empty($restrictions['rubric']) && $restrictions['rubric'] !== "all") { $rubric_array = array(); $rubric_array[] = $restrictions['rubric']; } if ($restrictions['only_linked'] === true && empty($selected_ids)) { $rubric_array = array(); } // deactivate assigning user to groups if item is a group $current_user_is_grouproom_moderator = false; if ($item && $item->getType() == CS_LABEL_TYPE && $item->getLabelType() == CS_GROUP_TYPE) { if ($item->isGrouproomActivated()) { $group_manager = $this->_environment->getGroupManager(); $group_item = $group_manager->getItem($item->getItemID()); $group_room_item = $group_item->getGroupRoomItem(); $moderator_list = $group_room_item->getModeratorList(); $moderator_item = $moderator_list->getFirst(); while ($moderator_item) { if ($moderator_item->getUserID() == $current_user->getUserID()) { $current_user_is_grouproom_moderator = true; } $moderator_item = $moderator_list->getNext(); } if (!$current_user->isModerator()) { // dont show user and group items if grouproom is activated if (!$current_user_is_grouproom_moderator) { if (($key = array_search('user', $rubric_array)) !== false) { unset($rubric_array[$key]); } } if (($key = array_search('group', $rubric_array)) !== false) { unset($rubric_array[$key]); } } } } foreach ($rubric_array as $rubric) { $rubric_list = new cs_list(); $rubric_manager = $this->_environment->getManager($rubric); if (isset($rubric_manager) && $rubric != CS_MYROOM_TYPE) { if ($rubric != CS_PROJECT_TYPE) { $rubric_manager->setContextLimit($current_context->getItemID()); } if ($rubric == CS_DATE_TYPE) { $rubric_manager->setWithoutDateModeLimit(); } if ($rubric == CS_USER_TYPE) { if (!$current_user->isModerator() && $item->isGrouproomActivated() && !$current_user_is_grouproom_moderator) { continue; } $rubric_manager->setUserLimit(); if ($current_user->isUser()) { $rubric_manager->setVisibleToAllAndCommsy(); } else { $rubric_manager->setVisibleToAll(); } } $count_all += $rubric_manager->getCountAll(); // set restrictions if (!empty($restrictions['search'])) { $rubric_manager->setSearchLimit($restrictions['search']); } if ($restrictions['only_linked'] === true) { $rubric_manager->setIDArrayLimit($selected_ids); } if ($restrictions['type'] == 2) { $rubric_manager->showNoNotActivatedEntries(); } $rubric_manager->selectDistinct(); $rubric_list = $rubric_manager->get(); // show hidden entries only if user is moderator or owner if ($restrictions['type'] != 2 && !$current_user->isModerator()) { // check if user is owner $entry = $rubric_list->getFirst(); while ($entry) { if ($entry->isNotActivated() && $entry->getCreatorID() != $current_user->getItemID()) { // remove item from list $rubric_list->removeElement($entry); } $entry = $rubric_list->getNext(); } } // add rubric list to item list $item_list->addList($rubric_list); $temp_rubric_ids = $rubric_manager->getIDArray(); if (!empty($temp_rubric_ids)) { //$session->setValue('cid'.$environment->getCurrentContextID().'_item_attach_index_ids', $rubric_ids); $item_ids = array_merge($item_ids, $temp_rubric_ids); } } } } $interval = CS_LIST_INTERVAL; $from = $current_page * $interval; // get sublist - paging $sublist = $item_list->getSublist($from, $interval); // prepare return $return['list'] = array(); $item = $sublist->getFirst(); while ($item) { if ($item->getItemType() == CS_USER_TYPE) { $title = $item->getFullName(); } else { $title = $item->getTitle(); } if ($item->getType() == CS_LABEL_TYPE && $item->getLabelType() == CS_GROUP_TYPE && $module == "user" && $current_user->isModerator()) { if ($item->isGrouproomActivated()) { $item = $sublist->getNext(); continue; } } $entry = array(); $entry['item_id'] = $item->getItemID(); $entry['title'] = $title; if ($item->getType() == "date") { $entry['modification_date'] = $item->getDateTime_start(); } else { $entry['modification_date'] = $item->getModificationDate(); } //$entry['modification_date'] = $item->getModificationDate(); $entry['modificator'] = $item->getModificatorItem()->getFullName(); $entry['system_label'] = $item->isSystemLabel(); $entry['checked'] = false; if (in_array($item->getItemID(), $selected_ids)) { $entry['checked'] = true; } $return['list'][] = $entry; $item = $sublist->getNext(); } $return['paging']['pages'] = ceil(count($item_ids) / $interval); $return['num_selected_total'] = count($selected_ids); $this->setSuccessfullDataReturn($return); echo $this->_return; }
if ( $rubric != CS_MYROOM_TYPE ) { $rubric_manager->selectDistinct(); $rubric_list = $rubric_manager->get(); $temp_rubric_ids = $rubric_manager->getIDArray(); } else { $rubric_list = $rubric_manager->getRelatedContextListForUser($current_user->getUserID(),$current_user->getAuthSource(),$environment->getCurrentPortalID());; $temp_rubric_ids = $rubric_list->getIDArray(); } if (isset($_GET['select']) and $_GET['select']=='all'){ if(get_class($rubric_manager) == 'cs_user_manager'){ $selected_ids = $temp_rubric_ids; } } $search_list->addList($rubric_list); if (!empty($temp_rubric_ids)){ $rubric_ids = $temp_rubric_ids; } $session->setValue('cid'.$environment->getCurrentContextID().'_'.$rubric.'_index_ids', $rubric_ids); $campus_search_ids = array_merge($campus_search_ids, $rubric_ids); } } if($interval == 0){ $interval = $search_list->getCount(); } // Set data for view $sublist = $search_list->getSubList($from-1,$interval); $view->setList($sublist); $view->setCountAllShown($search_list->getCount()); $view->setCountAll($count_all);
function getFileListWithFilesFromSteps() { $file_list = new cs_list(); if ($this->getPublic() == '-1') { $translator = $this->_environment->getTranslationObject(); return $file_list; } else { $files = $this->getFileList(); // steps $context_item = $this->_environment->getCurrentContextItem(); if ($context_item->withTodoManagement()) { $step_list = clone $this->getStepItemList(); if ($step_list->isNotEmpty()) { $step_item = $step_list->getFirst(); while ($step_item) { $step_file_list = $step_item->getFileList(); if ($step_file_list->isNotEmpty()) { $file_list->addList($step_file_list); } unset($step_item); $step_item = $step_list->getNext(); } } unset($step_item); unset($step_list); $files->addList($file_list); } $files->sortby('filename'); } return $files; }
/** select items limited by limits * this method returns a list (cs_list) of items within the database limited by the limits. * depends on _performQuery(), which must be overwritten */ function select2($with_linked_items = true) { if (isset($this->_id_array_limit)) { $result = $this->_performQuery2('select', $with_linked_items); $this->_data = new cs_list(); $this->_id_array = NULL; if (!$with_linked_items) { foreach ($result as $query_result) { $item = $this->_buildItem($query_result); $this->_data->add($item); } } else { $link_list = new cs_list(); $item_id_array = array(); foreach ($result as $query_result) { if ($this->_linked_item->getItemID() == $query_result['first_item_id']) { $item_id_array[] = $query_result['second_item_id']; } else { $item_id_array[] = $query_result['first_item_id']; } $item = $this->_buildItem($query_result); $link_list->add($item); } $this->_data = $link_list; } if (isset($this->_order) and !empty($this->_order) and $this->_order == 'sorting_place') { $item = $this->_data->getFirst(); $link_list1 = new cs_list(); $link_list2 = new cs_list(); while ($item) { if ($item->getSortingPlace()) { $link_list1->add($item); } else { $link_list2->add($item); } $item = $this->_data->getNext(); } $link_list1->addList($link_list2); $this->_data = $link_list1; unset($link_list1); unset($link_list2); } } else { parent::select(); } }
} $complete_list = new cs_list(); foreach($file_rubric_array as $file_rubric){ $rubric_manager = $environment->getManager($file_rubric); $rubric_manager->setContextArrayLimit($context_array); if ($file_rubric == CS_DATE_TYPE) { $rubric_manager->setWithoutDateModeLimit(); } if(!empty($_GET['search'])){ $rubric_manager->setSearchLimit($_GET['search']); } $rubric_manager->showNoNotActivatedEntries(); $rubric_manager->select(); $item_list = $rubric_manager->get(); $complete_list->addList($item_list); } // Ankündigungen if((isset($_GET['roomwide_search_type']) and in_array(CS_ANNOUNCEMENT_TYPE, $_GET['roomwide_search_type'])) or !isset($_GET['roomwide_search_type'])){ foreach($context_array as $context){ $rubric_manager = $environment->getManager(CS_ANNOUNCEMENT_TYPE); $rubric_manager->setContextLimit($context); if(!empty($_GET['search'])){ $rubric_manager->setSearchLimit($_GET['search']); } $rubric_manager->showNoNotActivatedEntries(); $rubric_manager->select(); $item_list = $rubric_manager->get(); $complete_list->addList($item_list); }
// show hidded entries only if user is moderator or owner if($sel_activating_status != 2 && !$current_user->isModerator()) { // check if user is owner $entry = $rubric_list->getFirst(); while($entry) { if($entry->isNotActivated() && $entry->getCreatorID() != $current_user->getItemID()) { // remove item from list $rubric_list->removeElement($entry); } $entry = $rubric_list->getNext(); } } $item_list->addList($rubric_list); $temp_rubric_ids = $rubric_manager->getIDArray(); if (!empty($temp_rubric_ids)){ $rubric_ids = $temp_rubric_ids; } $session->setValue('cid'.$environment->getCurrentContextID().'_item_attach_index_ids', $rubric_ids); $item_ids = array_merge($item_ids, $rubric_ids); } } $sublist = $item_list->getSubList($from-1,$interval); $item_attach_index_view->setList($sublist); $item_attach_index_view->setLinkedItemIDArray($selected_ids); $item_attach_index_view->setRefItemID($ref_iid); $item_attach_index_view->setRefItem($item);
function moveRoom(cs_environment $environment, cs_list $afterList, cs_room_item $roomItem, $exec = false, $newPortalId) { $linkedProjectedRoomItems = new cs_list(); if ($exec) { if ($roomItem) { global $environment; $oldPortalId = $roomItem->getContextID(); $portalManager = $environment->getPortalManager(); $oldPortal = $portalManager->getItem($oldPortalId); $userManager = $environment->getUserManager(); $roomList = new cs_list(); $roomList->add($roomItem); // search for associated project rooms in list after this entry if ($roomItem->isCommunityRoom()) { $projectRoomList = $roomItem->getProjectRoomList(); $afterListItem = $afterList->getFirst(); while ($afterListItem) { if ($projectRoomList->inList($afterListItem)) { $linkedProjectedRoomItems->add($afterListItem); } $afterListItem = $afterList->getNext(); } $roomList->addList($linkedProjectedRoomItems); } else if ($roomItem->isGrouproomActive()) { $groupManager = $environment->getGroupManager(); $groupManager->setContextLimit($roomItem->getItemID()); $groupManager->select(); $groupList = $groupManager->get(); if ($groupList->isNotEmpty()) { $groupItem = $groupList->getFirst(); while($groupItem) { if ($groupItem->isGroupRoomActivated()) { $groupRoomItem = $groupItem->getGroupRoomItem(); if (isset($groupRoomItem) && !empty($groupRoomItem)) { $roomList->add($groupRoomItem); } } $groupItem = $groupList->getNext(); } } } $roomNameArray = array(); $userArray = array(); $authSourceArray = array(); $roomListItem = $roomList->getFirst(); while ($roomListItem) { $roomNameArray[$roomListItem->getItemID()] = $roomListItem->getTitle(); $userManager->resetLimits(); $userManager->setContextLimit($roomListItem->getItemID()); $userManager->select(); $userList = $userManager->get(); if ($userList->isNotEmpty()) { $userItem = $userList->getFirst(); while($userItem) { $authSourceArray[$userItem->getAuthSource()] = $userItem->getAuthSource(); $userIdTest = $userItem->getUserID(); if (!empty($userIdTest)) { $userRoomArray[$userItem->getUserID() . "__CS__" . $userItem->getAuthSource()] = $roomListItem->getItemID(); if (empty($userArray[$userItem->getUserID()])) { $portalUserItem = $userItem->getRelatedCommSyUserItem(); if (isset($portalUserItem)) { $userArray[$userItem->getUserID() . "__CS__" . $userItem->getAuthSource()] = $portalUserItem; } } $userIdTest = $userItem->getUserID(); } $userItem = $userList->getNext(); } } $roomListItem = $roomList->getNext(); } $authSourceTranslationArray = array(); $authSourceFindArray = array(); $authSourceItemArray = array(); $newPortal = $portalManager->getItem($newPortalId); $authSourceListNew = $newPortal->getAuthSourceList(); foreach ($authSourceArray as $authSourceId) { $authSourceManager = $environment->getAuthSourceManager(); $authSourceItemOld = $authSourceManager->getItem($authSourceId); $authSourceItemArray[$authSourceItemOld->getItemID()] = $authSourceItemOld; if (!$authSourceListNew->isEmpty()) { $authSourceItemNew = $authSourceListNew->getFirst(); while ($authSourceItemNew) { $authSourceItemArray[$authSourceItemNew->getItemID()] = $authSourceItemNew; if ($authSourceItemOld->isCommSyDefault() && $authSourceItemNew->isCommSyDefault()) { $authSourceTranslationArray[$authSourceItemOld->getItemID()] = $authSourceItemNew->getItemID(); } $authSourceItemNew = $authSourceListNew->getNext(); } } } $authSourceNotTranslationArray = array(); foreach ($authSourceArray as $authSourceId) { if (!array_key_exists($authSourceId, $authSourceTranslationArray)) { $authSourceNotTranslationArray[] = $authSourceId; } } $authSourceManager = $environment->getAuthSourceManager(); foreach ($authSourceNotTranslationArray as $authSourceId) { $authSourceItemOld = $authSourceManager->getItem($authSourceId); $authSourceItemNew = clone $authSourceItemOld; $authSourceItemNew->setItemID(''); $authSourceItemNew->setContextID($newPortalId); $authSourceItemNew->save(); $authSourceTranslationArray[$authSourceItemOld->getItemID()] = $authSourceItemNew->getItemID(); $authSourceItemArray[$authSourceItemNew->getItemID()] = $authSourceItemNew; } $userArrayAll = $userArray; $userArrayNew = array(); $failure = false; $userChangeArray = array(); foreach ($userArrayAll as $key => $userItem) { // does the user exist on current portal? $authentication = $environment->getAuthenticationObject(); $userId = $userItem->getUserID(); $authSource = $userItem->getAuthSource(); $first = true; $go = true; while ($go) { $userManager->resetLimits(); $userManager->setContextLimit($newPortalId); $userManager->setAuthSourceLimit($authSourceTranslationArray[$authSource]); $userManager->setUserIDLimit($userId); $userManager->select(); $userList = $userManager->get(); // commsy auth source, user id already exists if ($userList->isNotEmpty() && $userList->getCount() == 1) { $userItem2 = $userList->getFirst(); // email is equal if ($userItem2->getEmail() == $userItem->getEmail()) { unset($userArray[$userItem->getUserID() . "__CS__" . $userItem->getAuthSource()]); if ($userItem->getUserID() != $userId) { $userChangeArray[$userItem->getUserID() . "__CS__" . $authSourceTranslationArray[$authSource]] = $userId; } else { $userArrayNoChange[$userItem->getUserID() . "__CS__" . $authSourceTranslationArray[$authSource]] = $userItem; } $go = false; } else { // generate new user id if ($first) { $first = false; $userId .= '1'; } else { $count = $userId{mb_strlen($userId) - 1}; $count = (int) $count; $count++; $userId = mb_substr($userId, 0, mb_strlen($userId) - 1); $userId .= $count; } } } elseif ($userList->isNotEmpty() && $userList->getCount() > 1) { include_once('functions/error_functions.php'); trigger_error('ERROR: multiple user id ' . $userId . ' for one portal',E_USER_WARNING); $go = false; $failure = true; } else { // find free user id if ($userItem->getUserID() != $userId) { $userChangeArray[$userItem->getUserID() . "__CS__" . $authSourceTranslationArray[$authSource]] = $userId; } else { $userArrayNoChange[$userItem->getUserID() . "__CS__" . $authSourceTranslationArray[$authSource]] = $userItem; } $go = false; } } } if ($failure) { die("ERROR"); } // commsy auth source // copy auth (user_id and password) and user (normal information) items foreach ($userArray as $key => $userItem) { $keyArray = explode("__CS__", $key); $userIdKey = $keyArray[0]; $authSourceKey = $keyArray[1]; // old auth source $authManager = $authentication->getAuthManager($userItem->getAuthSource()); $authManager->setContextLimit($oldPortalId); $authItemOld = $authManager->getItem($userItem->getUserID()); if (!empty($authItemOld)) { $authItemNew = clone $authItemOld; $authItemNew->setPortalID($newPortalId); $authItemNew->setAuthSourceID($authSourceTranslationArray[$authSourceKey]); if (!empty($userChangeArray[$userIdKey . "__CS__" . $authSourceTranslationArray[$authSourceKey]])) { $authItemNew->setUserID($userChangeArray[$userIdKey . "__CS__" . $authSourceTranslationArray[$authSourceKey]]); } $authManager = $authentication->getAuthManager($authSourceTranslationArray[$authSourceKey]); $authManager->setContextLimit($newPortalId); $userIdAuthNew = $authItemNew->getUserID(); if (!empty($userIdAuthNew)) { $authManager->save($authItemNew); } } unset ($userIdAuthNew); $userItemNew = $userItem->cloneData(); $userItemNew->setContextID($newPortalId); $tempUser = $userManager->getItem($userItem->getCreatorID()); $userItemNew->setCreatorItem($tempUser); if (!empty($userChangeArray[$userIdKey . "__CS__" . $authSourceTranslationArray[$authSourceKey]])) { $userItemNew->setUserID($userChangeArray[$userIdKey . "__CS__" . $authSourceTranslationArray[$authSourceKey]]); } $userIdUserNew = $userItemNew->getUserID(); $userItemNew->setAuthSource($authSourceTranslationArray[$authSourceKey]); if (!empty($userIdUserNew)) { $userItemNew->save(); $userItemNew->setCreatorID2ItemID(); } } // external auth sources foreach ($userArrayNew as $key => $userItem) { $keyArray = explode("__CS__", $key); $userIdKey = $keyArray[0]; $authSourceKey = $keyArray[1]; $userItemnew = $userItem->cloneData(); $userItemNew->setContextID($newPortalId); $tempUser = $userManager->getItem($userItem->getCreatorID()); $userItemNew->setCreatorItem($tempUser); $userIdUserNew = $userItemNew->getUserID(); $userItemNew->setAuthSource($authSourceKey); if (!empty($userIdUserNew)) { $userItemNew->save(); $userItemNew->setCreatorID2ItemID(); } } // change user ids of user in rooms to move // and cahnge auth source of user in rooms to move $roomListItem = $roomList->getFirst(); while ($roomListItem) { $userManager = $environment->getUserManager(); $userManager->resetLimits(); $userManager->setContextLimit($roomListItem->getItemID()); $userManager->select(); $userList = $userManager->get(); if ($userList->isNotEmpty()) { $userItem = $userList->getFirst(); while ($userItem) { $userIdTest = $userItem->getUserID(); if (!empty($userIdTest) && !empty($userChangeArray[$userIdTest . "__CS__" . $authSourceTranslationArray[$userItem->getAuthSource()]])) { $userItem->setUserID($userChangeArray[$userIdTest . "__CS__" . $authSourceTranslationArray[$userItem->getAuthSource()]]); } $newAuthSourceForUser = $authSourceTranslationArray[$userItem->getAuthSource()]; $userItem->setAuthSource($newAuthSourceForUser); $userItem->setChangeModificationOnSave(false); $userItem->setSaveWithoutLinkModifier(); $userItem->save(); $userItem = $userList->getNext(); } } // delete old links from community room to project rooms // before saving on new potal if ($linkedProjectedRoomItems->isEmpty() && $roomListItem->isCommunityRoom()) { $roomListItem->setProjectListByID(array()); $roomListItem->save(); } // move files from old portal folder to new portal folder $oldContext = $roomListItem->getContextID(); $newContext = $newPortalId; if ($oldContext != $newContext) { $discManager = $environment->getDiscManager(); $discManager->moveFiles($roomListItem->getItemID(), $oldContext, $newContext); } $roomListItem->setContextID($newPortalId); // set link between project and community room if ($linkedProjectedRoomItems->isNotEmpty() && $roomListItem->isProjectRoom()) { $tempArray = array(); $tempArray[] = $roomItem->getItemID(); $roomListItem->setCommunityListByID($tempArray); } // save room with new context id $roomListItem->save(); echo ProgressBar::next(); $roomListItem = $roomList->getNext(); } } } else { usleep(1000); echo ProgressBar::next(); } return $linkedProjectedRoomItems; }
// agree movement of room elseif ( $modus == 'agree' ) { $old_portal_id = $item->getContextID(); $portal_manager = $environment->getPortalManager(); $old_portal = $portal_manager->getItem($old_portal_id); $user_manager = $environment->getUserManager(); $copy_links_between_rooms = false; // init room list and room array include_once('classes/cs_list.php'); $room_list = new cs_list(); $room_list->add($item); if ($item->moveWithLinkedRooms()) { $room_list->addList($item->getProjectRoomList()); $copy_links_between_rooms = true; // add group rooms from project room $projectRoomList = $item->getProjectRoomList(); $projectRoom = $projectRoomList->getFirst(); while($projectRoom) { $room_list->addList($projectRoom->getGroupRoomList()); $projectRoom = $projectRoomList->getNext(); } } ############################################ # FLAG: group rooms ############################################ elseif ( $item->isGrouproomActive() ) {
} $project_manager = $environment->getProjectManager(); $projects = $project_manager->getSortedItemList($mat_roomIds,'title'); $community_manager = $environment->getCommunityManager(); $communities = $community_manager->getSortedItemList($mat_roomIds,'title'); $private_room_manager = $environment->getPrivateRoomManager(); $private_rooms = $private_room_manager->getSortedItemList($mat_roomIds,'title'); $group_room_manager = $environment->getGroupRoomManager(); $group_rooms = $group_room_manager->getSortedItemList($mat_roomIds,'title'); $rooms = new cs_list(); $rooms->addList($projects); $rooms->addList($communities); $rooms->addList($private_rooms); $rooms->addList($group_rooms); // Termine des Gemeinschaftsraumes $checkedDateIds = array(); $new_date_list = new cs_list(); if (!empty($date_id_array)) { foreach($date_id_array as $date_id) { $date_item = $date_list->getFirst(); while($date_item) { //include_once('functions/error_functions.php');trigger_error('n i y',E_USER_ERROR); if($date_item->getItemID() == $date_id and $date_item->getContextID() === 0) {
private function _actionPerformRequest($archive_toggle = false) { // archive if ($archive_toggle) { $this->_environment->toggleArchiveMode(); } // archive $return = array(); $current_context = $this->_environment->getCurrentContextItem(); $current_user = $this->_environment->getCurrentUser(); $session = $this->_environment->getSessionItem(); $project_manager = $this->_environment->getProjectManager(); $community_manager = $this->_environment->getCommunityManager(); $private_room_manager = $this->_environment->getPrivateRoomManager(); $group_room_manager = $this->_environment->getGroupRoomManager(); $link_manager = $this->_environment->getLinkManager(); $noticed_manager = $this->_environment->getNoticedManager(); $room_manager = $this->_environment->getProjectManager(); $current_context = $this->_environment->getCurrentContextItem(); $session = $this->_environment->getSession(); $translator = $this->_environment->getTranslationObject(); // get current room modules $current_room_modules = $current_context->getHomeConf(); $room_moduls = array(); if (!empty($current_room_modules)) { $room_modules = explode(",", $current_room_modules); } $modules = array(); foreach ($room_modules as $module) { list($name, $display) = explode("_", $module); if ($display !== "none") { $modules[] = $name; } } $rubric_copy_array = $this->getUtils()->getCopyRubrics(); $item_room_ids = array(); $tmp_id_array = array(); $item_list = new cs_list(); // collect room and item ids foreach ($rubric_copy_array as $rubric) { $item_manager = $this->_environment->getManager($rubric); $item_id_array = $session->getValue($rubric . "_clipboard"); $item_list->addList($item_manager->getItemList($item_id_array)); $item = $item_list->getFirst(); while ($item) { $item_room_ids[] = $item->getContextID(); $item = $item_list->getNext(); } if (is_array($item_id_array)) { $tmp_id_array = array_merge($tmp_id_array, $item_id_array); } } $item_id_array = $tmp_id_array; // create a list of rooms $rooms = new cs_list(); $rooms->addList($project_manager->getSortedItemList($item_room_ids, "title")); $rooms->addList($community_manager->getSortedItemList($item_room_ids, "title")); $rooms->addList($private_room_manager->getSortedItemList($item_room_ids, "title")); $rooms->addList($group_room_manager->getSortedItemList($item_room_ids, "title")); // get item information $new_item_list = new cs_list(); $checked_ids = array(); if (!empty($item_id_array)) { foreach ($item_id_array as $item_id) { $item = $item_list->getFirst(); while ($item) { if ($item->getItemID() == $item_id && $item->getContextID() === 0) { $item_manager = $this->_environment->getManager($item->getItemType()); $item = $item_manager->getItem($item->getItemId()); $new_item_list->add($item); if ($item->getContextID() !== $current_context->getItemID()) { $checked_ids[] = $item->getItemID(); } break; } else { $item = $item_list->getNext(); } } } } $room_sort = $rooms->getFirst(); while ($room_sort) { if (!empty($item_id_array)) { foreach ($item_id_array as $item_id) { $item = $item_list->getFirst(); while ($item) { if ($item->getItemID() == $item_id && $item->getContextID() == $room_sort->getItemId()) { $item_manager = $this->_environment->getManager($item->getItemType()); $item = $item_manager->getItem($item->getItemId()); $new_item_list->add($item); if (isset($item) && $item->getContextID() !== $current_context->getItemID()) { $checked_ids[] = $item->getItemID(); } break; } else { $item = $item_list->getNext(); } } } } $room_sort = $rooms->getNext(); } $item_list = $new_item_list; // prepare return $data = array(); $entry = $item_list->getFirst(); if ($entry) { $last_room_id = $entry->getContextID(); } $index = 0; while ($entry) { if ($entry->isDeleted()) { $entry = $item_list->getNext(); continue; } $room_id = $entry->getContextID(); if ($last_room_id != $room_id) { $index++; } $last_room_id = $room_id; // room data if (!isset($data[$index])) { $data[$index]["room_id"] = $last_room_id; $room = $room_manager->getItem($last_room_id); // if $room is null, try to get a private room if ($room === null) { $room = $private_room_manager->getItem($last_room_id); } $headline = ""; if (empty($room)) { $community_manager->getItem($room_id); $room = $community_manager->getItem($room_id); $headline = $translator->getMessage("COPY_FROM") . " " . $translator->getMessage("COMMON_COMMUNITY_ROOM_TITLE") . " \"" . $room->getTitle() . "\""; } elseif ($room->isPrivateRoom()) { $headline = $translator->getMessage("COPY_FROM_PRIVATEROOM") . " \"" . $current_user->getFullname() . "\""; } elseif ($room->isGroupRoom()) { $headline = $translator->getMessage("COPY_FROM_GROUPROOM") . " \"" . $room->getTitle() . "\""; } else { $headline = $translator->getMessage("COPY_FROM_PROJECTROOM") . " \"" . $room->getTitle() . "\""; } $data[$index]["headline"] = $headline; } // process title $title = $entry->getTitle(); if ($entry->isNotActivated()) { $activating_date = $entry->getActivatingDate(); if (mb_strstr($activating_date, "9999-00-00")) { $title .= BR . $translator->getMessage('COMMON_NOT_ACTIVATED'); } else { $title .= BR . $translator->getMessage('COMMON_NOT_ACTIVATED') . " " . getDateInLang($entry->getActivatingDate()); } } $disabled = false; if ($entry->isNotActivated() && !($entry->getCreatorID() == $current_user->getItemID() || $current_user->isModerator())) { $disabled = true; } // item data $data[$index]["items"][] = array("disabled" => $disabled, "item_id" => $entry->getItemID(), "title" => $title, "rubric" => $this->getUtils()->getLogoInformationForType($entry->getItemType()), "modifier" => $entry->getModificatorItem()->getFullName(), "modification_date" => getDateInLang($entry->getModificationDate())); $entry = $item_list->getNext(); } // archive if ($archive_toggle) { $this->_environment->toggleArchiveMode(); } // archive return $data; }
public function getRoomList($session_id) { $retour = ''; $session_id = $this->_encode_input($session_id); if ($this->_isSessionValid($session_id)) { $this->_environment->setSessionID($session_id); $session = $this->_environment->getSessionItem(); $user_id = $session->getValue('user_id'); $auth_source_id = $session->getValue('auth_source'); $context_id = $session->getValue('commsy_id'); $this->_environment->setCurrentContextID($context_id); $hash_manager = $this->_environment->getHashManager(); $user_manager = $this->_environment->getUserManager(); $user_manager->setContextLimit($context_id); $user_manager->setUserIDLimit($user_id); $user_manager->setAuthSourceLimit($auth_source_id); $user_manager->select(); $user_list = $user_manager->get(); if ($user_list->getCount() == 1) { $user_item = $user_list->getFirst(); if (!empty($user_item)) { $this->_environment->setCurrentUserItem($user_item); } $own_room = $user_item->getOwnRoom(); $list = $own_room->getCustomizedRoomList(); if (!(isset($list) and $list->isNotEmpty())) { $community_list = $user_item->getRelatedCommunityList(); $project_list = $user_item->getRelatedProjectListForMyArea(); $group_list = $user_item->getRelatedGroupList(); $class_factory = $this->_environment->getClassFactory(); include_once 'classes/cs_list.php'; $list = new cs_list(); if (!empty($community_list) and $community_list->isNotEmpty()) { $list->addList($community_list); } if (!empty($project_list) and $project_list->isNotEmpty()) { $list->addList($project_list); } if (!empty($group_list) and $group_list->isNotEmpty()) { $list->addList($group_list); } } unset($user_item); if (isset($list) and $list->isNotEmpty()) { $retour = '<?xml version="1.0" encoding="utf-8"?>' . LF; $retour .= ' <list>' . LF; // portal $item = $this->_environment->getCurrentPortalItem(); $retour .= ' <item>' . LF; $retour .= ' <title><![CDATA[' . $item->getTitle() . ']]></title>' . LF; if ($item->getItemID() > 99) { $retour .= ' <id><![CDATA[' . $item->getItemID() . ']]></id>' . LF; global $c_commsy_domain, $c_commsy_url_path; include_once 'functions/curl_functions.php'; $retour .= ' <url><![CDATA[' . $c_commsy_domain . $c_commsy_url_path . '/' . _curl(false, $item->getItemID(), 'home', 'index', array()) . ']]></url>' . LF; } $retour .= ' </item>' . LF; $retour .= ' <item>' . LF; $retour .= ' <title>-------------------------------</title>' . LF; $retour .= ' <id></id>' . LF; $retour .= ' </item>' . LF; // own room $item = $own_room; $retour .= ' <item>' . LF; $translator = $this->_environment->getTranslationObject(); $retour .= ' <title><![CDATA[' . $translator->getMessage($item->getTitle()) . ']]></title>' . LF; if ($item->getItemID() > 99) { $retour .= ' <id><![CDATA[' . $item->getItemID() . ']]></id>' . LF; global $c_commsy_domain, $c_commsy_url_path; include_once 'functions/curl_functions.php'; $retour .= ' <url><![CDATA[' . $c_commsy_domain . $c_commsy_url_path . '/' . _curl(false, $item->getItemID(), 'home', 'index', array()) . ']]></url>' . LF; // rss if ($item->isRSSOn()) { $own_room_user_item = $item->getOwnerUserItem(); if (!empty($own_room_user_item)) { $rss_hash = $hash_manager->getRSSHashForUser($own_room_user_item->getItemID()); if (!empty($rss_hash)) { global $c_commsy_domain, $c_commsy_url_path; $rss_url = $c_commsy_domain . $c_commsy_url_path . '/rss.php?cid=' . $item->getItemID() . '&hid=' . $rss_hash; $retour .= ' <rss><![CDATA[' . $rss_url . ']]></rss>' . LF; } unset($rss_hash); unset($rss_url); } } } $retour .= ' </item>' . LF; $retour .= ' <item>' . LF; $retour .= ' <title>-------------------------------</title>' . LF; $retour .= ' <id></id>' . LF; $retour .= ' </item>' . LF; $item = $list->getFirst(); while ($item) { $retour .= ' <item>' . LF; $retour .= ' <title><![CDATA[' . $item->getTitle() . ']]></title>' . LF; if ($item->getItemID() > 99) { $retour .= ' <id><![CDATA[' . $item->getItemID() . ']]></id>' . LF; global $c_commsy_domain, $c_commsy_url_path; include_once 'functions/curl_functions.php'; $retour .= ' <url><![CDATA[' . $c_commsy_domain . $c_commsy_url_path . '/' . _curl(false, $item->getItemID(), 'home', 'index', array()) . ']]></url>' . LF; // rss if ($item->isRSSOn()) { $user_room_item = $item->getUserByUserID($user_id, $auth_source_id); if (!empty($user_room_item) and !empty($hash_manager)) { $rss_hash = $hash_manager->getRSSHashForUser($user_room_item->getItemID()); if (!empty($rss_hash)) { global $c_commsy_domain, $c_commsy_url_path; $rss_url = $c_commsy_domain . $c_commsy_url_path . '/rss.php?cid=' . $item->getItemID() . '&hid=' . $rss_hash; $retour .= ' <rss><![CDATA[' . $rss_url . ']]></rss>' . LF; } unset($rss_hash); unset($rss_url); } } } $retour .= ' </item>' . LF; $item = $list->getNext(); } unset($hash_manager); $retour .= ' </list>' . LF; unset($list); $result = $this->_encode_output($retour); } if (!empty($retour)) { $result = $this->_encode_output($retour); } unset($own_room); unset($user_item); } else { $info = 'ERROR: GET ROOM LIST'; $info_text = 'database error: user (' . $user_id . ',' . $auth_source_id . ',' . $context_id . ') not equal'; $result = new SoapFault($info, $info_text); } unset($user_list); unset($user_manager); unset($session); } else { $info = 'ERROR: GET ROOM LIST'; $info_text = 'session id (' . $session_id . ') is not valid'; $result = new SoapFault($info, $info_text); } return $result; }
/** get list of files attached o this item if a list of files has been set (@see setFileList()), get it if an array of file-ids has been set (@see setFileIDArray()), get corresponding files, otherwise get files linked in material_link_file @return cs_list list of file items */ function getFileListWithFilesFromArticles() { $file_list = new cs_list(); // articles $section_list = clone $this->getAllArticles(); if ($section_list->isNotEmpty()) { $section_item = $section_list->getFirst(); while ($section_item) { $section_file_list = $section_item->getFileList(); if ($section_file_list->isNotEmpty()) { $file_list->addList($section_file_list); } unset($section_item); $section_item = $section_list->getNext(); } } unset($section_item); unset($section_list); $file_list->sortby('filename'); return $file_list; }
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; }
public function search ($search_word, $parts_array) { $retour = array(); if ( !empty($search_word) and !empty($parts_array) ) { $current_user_item = $this->_environment->getCurrentUserItem(); $context_id_array = $current_user_item->getContextIDArray(); if ( !empty($context_id_array) ) { include_once('classes/cs_list.php'); $search_list = new cs_list(); foreach ($parts_array as $part) { $manager = $this->_getPartManager($part); if ( isset($manager) ) { $manager->setContextArrayLimit($context_id_array); $manager->setSearchLimit($search_word); $manager->select(); $list = $manager->get(); if ( isset($list) and $list->isNotEmpty() ) { $search_list->addList($list); } unset($list); } } } } $item = $search_list->getFirst(); while ($item) { $item_object = (object) null; $item_object->id = $item->getItemID(); $item_object->type = $item->getItemType(); if ( $item->isA(CS_USER_TYPE) ) { $item_object->title = $item->getFullname(); } else { $item_object->title = $item->getTitle(); } $item_object->url = $item->getItemURL(); $item_object->context_id = $item->getContextID(); $item_object->context_title = $item->getContextItem()->getTitle(); $item_object->user_id = $item->getCreatorID(); $item_object->user_id_mb = $this->_getMBUserID($item->getCreatorID()); if ( empty($item_object->user_id_mb)) { $creator_item = $item->getCreatorItem(); $item_object->user_title = $creator_item->getFullname(); unset($creator_item); } $item_object->item_id = $item->getItemID(); if ( $item->isA(CS_USER_TYPE) ) { $item_object->item_title = $item->getFullname(); } else { $item_object->item_title = $item->getTitle(); } # TBD: Warum gefunden? array_push($retour,$item_object); $item = $search_list->getNext(); } return $retour; }
private function _performIndexedSearch($rubric_array) { $db = $this->_environment->getDBConnector(); $session = $this->_environment->getSessionItem(); $params = $this->_environment->getCurrentParameterArray(); /************************************************************************************ * We can look up all search words in the database to get their ids... ************************************************************************************/ $query = ' SELECT sw_id FROM search_word WHERE 1=1 '; $size = sizeof($this->_search_words); if ($size != 0) { $query .= 'AND ('; for ($i = 0; $i < $size; $i++) { $query .= ' sw_word LIKE "' . encode(AS_DB, $this->_search_words[$i]) . '%" '; if ($i < $size - 1) { $query .= ' OR '; } } $query .= ') '; } $word_ids = $db->performQuery($query); /************************************************************************************ * ...and find items matching these ids * * fortunately, it is possible to limit this selection by rubrics, because all indexed entries are * associated to their proper main item * f.e. - discussionarticles are listed as discussions * - annotations are listed as the item they belong to * - ... ************************************************************************************/ $search_rubrics = $rubric_array; if (!empty($this->_params['selrubric'])) { $search_rubrics = array($this->_params['selrubric']); } $search_rubrics[] = 'file'; $query = ' SELECT si_item_id, si_item_type, si_count FROM search_index WHERE ( '; $size = sizeof($search_rubrics); for ($i = 0; $i < $size; $i++) { $query .= ' si_item_type = "' . mysql_real_escape_string($search_rubrics[$i]) . '"'; if ($i < $size - 1) { $query .= ' OR '; } } $query .= ') AND ('; if (!empty($word_ids)) { $size = sizeof($word_ids); for ($i = 0; $i < $size; $i++) { $query .= ' si_sw_id = ' . $word_ids[$i]['sw_id']; if ($i < $size - 1) { $query .= ' OR '; } } } else { $query .= 'FALSE'; } $query .= ')'; $query .= ' ORDER BY si_count DESC '; $results = $db->performQuery($query); /************************************************************************************ * the result is catched in a way, creating a rubric ordered array * * ...maybe this could be done directly in query ************************************************************************************/ foreach ($results as $result) { $type = $this->rubric2ItemType($result['si_item_type']); if ($type == "file") { // get type of their main item $item_manager = $this->_environment->getItemManager(); $item = $item_manager->getItem($result['si_item_id']); $type = $item->getItemType(); unset($item_manager); } // inline types need to be remapped $map = array("discarticle" => "discussion", "section" => "material", "step" => "todo"); if (isset($map[$type])) { $type = $map[$type]; } $this->_items[$type][$result['si_item_id']] = $result['si_count']; } /************************************************************************************ * if file indexing is on, we merge items here ************************************************************************************/ /* global $ftsearch_enabled; if (isset($ftsearch_enabled) && $ftsearch_enabled === true) { $ftsearch_manager = $this->_environment->getFTSearchManager(); $ftsearch_manager->setSearchStatus(true); $ftsearch_manager->setWords($this->_search_words); $ftItemIdArray = $ftsearch_manager->performFTSearch(); $itemManager = $this->_environment->getItemManager(); $itemList = $itemManager->getItemList($ftItemIdArray); $item = $itemList->getFirst(); while ($item) { $type = $item->getType(); $map = array( "discarticle" => "discussion", "section" => "material", "step" => "todo" ); if (isset($map[$type])) $type = $map[$type]; $this->_items[$type][$item->getItemID()] = 3; // <- this is just a fake value $item = $itemList->getNext(); } }*/ /************************************************************************************ * now we can get all needed information for the matched items ************************************************************************************/ $count_all = 0; $campus_search_ids = array(); $result_list = new cs_list(); /* foreach ($this->items as $type => $detail) { $manager = $this->_environment->getManager($type); $idArray = array_keys($detail); }*/ global $c_plugin_array; foreach ($rubric_array as $rubric) { if (!isset($c_plugin_array) || !in_array(strtolower($rubric), $c_plugin_array)) { $rubric_ids = array(); $rubric_list = new cs_list(); $rubric_manager = $this->_environment->getManager($rubric); /* * TODO: the main idea is to limit requests by the previous detected item ids and only get detailed information for those, * but db managers do not act as expected * * for now, items are filtered afterwards */ // set id array limit //$rubric_manager->setIDArrayLimit(array_keys($items[$rubric])); if ($rubric === CS_PROJECT_TYPE) { $rubric_manager->setQueryWithoutExtra(); } // context limit if ($rubric !== CS_PROJECT_TYPE && $rubric !== CS_MYROOM_TYPE) { $rubric_manager->setContextLimit($this->_environment->getCurrentContextID()); } elseif ($rubric === CS_PROJECT_TYPE && $this->_environment->inCommunityRoom()) { $rubric_manager->setContextLimit($this->_environment->getCurrentPortalID()); $current_community_item = $this->_environment->getCurrentContextItem(); $rubric_manager->setIDArrayLimit($current_community_item->getInternalProjectIDArray()); unset($current_community_item); } // date if ($rubric === CS_DATE_TYPE && $this->_params['selstatus'] === 2) { $rubric_manager->setWithoutDateModeLimit(); } elseif ($rubric === CS_DATE_TYPE && $this->_params['selstatus'] !== 2) { $rubric_manager->setDateModeLimit($this->_params['selstatus']); } if ($this->_params['selgroup']) { $rubric_manager->setGroupLimit($this->_params['selgroup']); } // user if ($rubric === CS_USER_TYPE) { $rubric_manager->setUserLimit(); $current_user = $this->_environment->getCurrentUser(); if ($current_user->isUser()) { $rubric_manager->setVisibleToAllAndCommsy(); } else { $rubric_manager->setVisibleToAll(); } } $count_all = $count_all + $rubric_manager->getCountAll(); foreach ($sel_array as $rubric => $value) { if (!empty($value)) { $rubric_manager->setRubricLimit($rubric, $value); } } // activating status if ($this->_params['sel_activating_status'] !== '1') { $rubric_manager->showNoNotActivatedEntries(); } $rubric_manager->setAttributeLimit($this->_params['selrestriction']); // apply filters if (!empty($this->_params['selbuzzword'])) { $rubric_manager->setBuzzwordLimit($this->_params['selbuzzword']); } // if(!empty($this->_params['seltag'])) { // $rubric_manager->setTagLimit($this->_params['seltag']); // } // get selected seltags $seltag_array = array(); foreach ($params as $key => $value) { if (substr($key, 0, 6) == 'seltag') { // set seltag array $seltag_array[$key] = $value; } } if (!empty($seltag_array)) { $rubric_manager->setTagArrayLimit($seltag_array); } /* * if ( !empty($selcolor) and $selcolor != '2' and $selrubric == "date") { $rubric_manager->setColorLimit('#'.$selcolor); } if ( ($selrubric == "todo") and !empty($selstatus)) { $rubric_manager->setStatusLimit($selstatus); } if (!empty($seluser)) { $rubric_manager->setUserLimit($seluser); } if ( !empty($selfiles) ) { $rubric_manager->setOnlyFilesLimit(); } */ if ($rubric != CS_MYROOM_TYPE) { $rubric_manager->selectDistinct(); $rubric_list = $rubric_manager->get(); $temp_rubric_ids = $rubric_manager->getIDArray(); } else { //$rubric_list = $rubric_manager->getRelatedContextListForUser($current_user->getUserID(),$current_user->getAuthSource(),$environment->getCurrentPortalID());; //$temp_rubric_ids = $rubric_list->getIDArray(); } /* if (isset($_GET['select']) and $_GET['select']=='all'){ if(get_class($rubric_manager) == 'cs_user_manager'){ $selected_ids = $temp_rubric_ids; } } */ $result_list->addList($rubric_list); if (!empty($temp_rubric_ids)) { $rubric_ids = $temp_rubric_ids; } $session->setValue('cid' . $this->_environment->getCurrentContextID() . '_' . $rubric . '_index_ids', $rubric_ids); $campus_search_ids = array_merge($campus_search_ids, $rubric_ids); /* $search_list->addList($rubric_list); if (!empty($temp_rubric_ids)){ $rubric_ids = $temp_rubric_ids; } $session->setValue('cid'.$environment->getCurrentContextID().'_'.$rubric.'_index_ids', $rubric_ids); $campus_search_ids = array_merge($campus_search_ids, $rubric_ids); */ } #$session->setValue('cid'.$environment->getCurrentContextID().'_campus_search_parameter_array', $campus_search_parameter_array); # $session = $this->_environment->getSessionItem(); } // search in indexed files $ftsearch_manager = $this->_environment->getFTSearchManager(); $ftsearch_manager->setSearchStatus(true); $ftsearch_manager->setWords($this->_search_words); $ftItemIdArray = $ftsearch_manager->performFTSearch(); /************************************************************************************ * as said in the todo note, some filtering is applied afterwards ************************************************************************************/ $entry = $result_list->getFirst(); while ($entry) { /* if($entry instanceof cs_group_item) { $entry->setType(CS_GROUP_TYPE); $this->_list->add($entry); }*/ if (isset($this->_items[$entry->getType()][$entry->getItemID()]) || in_array($entry->getItemID(), $ftItemIdArray)) { $this->_list->add($entry); } $entry = $result_list->getNext(); } return $ftItemIdArray; }
$item_manager->setListLimit($sellist); } if (!empty($selbuzzword)){ $item_manager->setBuzzwordLimit($selbuzzword); } if (!empty($selmatrix)){ $item_manager->setMatrixLimit($selmatrix); } if (!empty($searchtext)){ $item_manager->setSearchLimit($searchtext); } if (!empty($last_selected_tag)){ $item_manager->setTagLimit($last_selected_tag); } $new_entry_list = $item_manager->getAllPrivateRoomEntriesOfUserList($privatroom_id_array,$user_id_array); $search_list->addList($new_entry_list); // ToDo: Nur Einträge in der Liste belassen, die auch angezeigt werden -> sonst gibt es leere Seiten über die geblättert wird! $rubric_array = array(); $rubric_array[] = CS_ANNOUNCEMENT_TYPE; $rubric_array[] = CS_DISCUSSION_TYPE; $rubric_array[] = CS_DATE_TYPE; $rubric_array[] = CS_MATERIAL_TYPE; $rubric_array[] = CS_TODO_TYPE; $sort_list = new cs_list(); $sort_item = $new_entry_list->getFirst(); while($sort_item){ if(in_array($sort_item->getItemType(), $rubric_array)){ $sort_list->add($sort_item); }