Ejemplo n.º 1
0
 function setSubItem($item)
 {
     $list = new cs_list();
     $list->add($item);
     $this->setSubItemList($list);
     $this->_sub_item_title_description = $this->_translator->getMessage('COMMON_READABLE_ONLY_USER', $item->getFullName());
 }
Ejemplo n.º 2
0
 function getPathItemList()
 {
     $link_manager = $this->_environment->getLinkItemManager();
     $link_manager->setLinkedItemLimit($this);
     $link_manager->setSortingPlaceLimit();
     $link_manager->sortbySortingPlace();
     $link_manager->select();
     $link_item_list = $link_manager->get();
     include_once 'classes/cs_list.php';
     $retour = new cs_list();
     if (!$link_item_list->isEmpty()) {
         $item = $link_item_list->getFirst();
         while ($item) {
             $retour->add($item->getLinkedItem($this));
             $item = $link_item_list->getNext();
         }
     }
     return $retour;
 }
Ejemplo n.º 3
0
$private_room_manager = $environment->getPrivateRoomManager();
$private_rooms = $private_room_manager->getSortedItemList($item_roomIds,'title');

$group_room_manager = $environment->getGroupRoomManager();
$group_rooms = $group_room_manager->getSortedItemList($item_roomIds,'title');

$rooms = new cs_list();
$rooms->addList($projects);
$rooms->addList($communities);
$rooms->addList($private_rooms);
$rooms->addList($group_rooms);


$checkedIds = array();
$new_item_list = new cs_list();
if (!empty($item_id_array)) {
      foreach($item_id_array as $item_id) {
         $item = $item_list->getFirst();
         while($item) {
            if($item->getItemID() == $item_id and $item->getContextID() === 0) {
               $item_manager = $environment->getManager($item->getItemType());
               $item = $item_manager->getItem($item->getItemId());
               $new_item_list->add($item);
               $current_context = $environment->getCurrentContextID();
               if ($item->getContextID() != $current_context){
                  $checkedIds[] = $item->getItemID();
               }
               break;
            } else {
               $item = $item_list->getNext();
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 5
0
      $room_item->setNotShownInPrivateRoomHome($user->getUserID());
      $room_item->save();
   }
   redirect($environment->getCurrentContextID(),'home','index');
}

$user = $environment->getCurrentUserItem();
$manager = $environment->getPrivateRoomManager();
$current_context_item = $environment->getCurrentContextItem();
$list2 = $current_context_item->getCustomizedRoomList();
if ( !isset($list2) ) {
   // old style (CommSy6)
   $list2 = $manager->getRelatedContextListForUserOnPrivateRoomHome($user);
} else {
   // remove separators
   $list_temp = new cs_list();
   $list_item = $list2->getFirst();
   while($list_item){
      if ( $list_item->getItemID() > 0 ) {
         $list_temp->add($list_item);
      }
      $list_item = $list2->getNext();
   }
   $list2 = $list_temp;
}
if ( isset($_GET['from']) ) {
   $from = $_GET['from'];
}  else {
   $from = 1;
}
Ejemplo n.º 6
0
   $link_name = explode('_', $module);
   if ( $link_name[1] != 'none' ) {
      if ($context_item->_is_perspective($link_name[0]) and $context_item->withRubric($link_name[0])) {
         // Find current institution selection
         $string = 'sel'.$link_name[0];
         if ( isset($_GET[$string]) and $_GET[$string] !='-2') {
            $sel_array[$link_name[0]] = $_GET[$string];
         } else {
            $sel_array[$link_name[0]] = 0;
         }
      }
   }
}


$search_list = new cs_list();
$campus_search_ids = array();
$params = array();
$params['environment'] = $environment;
$params['with_modifying_actions'] = true;
$view = $class_factory->getClass(ITEM_INDEX_VIEW,$params);
unset($params);

$context_item = $environment->getCurrentContextItem();
$current_room_modules = $context_item->getHomeConf();
if ( !empty($current_room_modules) ){
   $room_modules = explode(',',$current_room_modules);
}
$first = '';
$i=1;
$rubric_array = array();
Ejemplo n.º 7
0
 function getAllRoomUsersFromCache($context_id)
 {
     $user_list = new cs_list();
     if (!empty($context_id) and !empty($this->_cache)) {
         foreach ($this->_cache as $user) {
             $user_list->add($user);
         }
     } else {
         $this->resetLimits();
         $this->setContextLimit($this->_environment->getCurrentContextID());
         $this->setUserLimit();
         $this->select();
         $user_list = $this->get();
     }
     return $user_list;
 }
//    (at your option) any later version.
//
//    CommSy is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You have received a copy of the GNU General Public License
//    along with CommSy.
include_once 'classes/cs_link.php';
include_once 'classes/cs_list.php';
if (!isset($environment) and isset($this->_environment)) {
    $environment = $this->_environment;
}
$translator = $environment->getTranslationObject();
$configuration_rubric_extras_link_list = new cs_list();
global $c_html_textarea;
if ($c_html_textarea) {
    $link_item = new cs_link();
    $link_item->setTitle($translator->getMessage('CONFIGURATION_TEXTAREA_TITLE'));
    $link_item->setDescription($translator->getMessage('CONFIGURATION_TEXTAREA_TITLE_DESC'));
    if ($environment->getCurrentBrowser() == 'MSIE' && mb_substr($environment->getCurrentBrowserVersion(), 0, 1) == '6') {
        $link_item->setIconPath('images/commsyicons_msie6/48x48/config/htmltextarea.gif');
        $link_item->setIconPathForNavigation('images/commsyicons_msie6/22x22/config/htmltextarea.gif');
    } else {
        $link_item->setIconPath('images/commsyicons/48x48/config/htmltextarea.png');
        $link_item->setIconPathForNavigation('images/commsyicons/22x22/config/htmltextarea.png');
    }
    $link_item->setContextID($environment->getCurrentContextID());
    $link_item->setModule('configuration');
    $link_item->setFunction('htmltextarea');
	if(in_array(CS_DISCUSSION_TYPE, $_GET['roomwide_search_type'])){
	   $file_rubric_array[] = CS_DISCUSSION_TYPE;
	}
	if(in_array(CS_DATE_TYPE, $_GET['roomwide_search_type'])){
	  $file_rubric_array[] = CS_DATE_TYPE;
	}
	if(in_array(CS_TODO_TYPE, $_GET['roomwide_search_type'])){
	  $file_rubric_array[] = CS_TODO_TYPE;
	}
} else {
	$file_rubric_array[] = CS_DISCUSSION_TYPE;
   $file_rubric_array[] = CS_DATE_TYPE;
   $file_rubric_array[] = CS_TODO_TYPE;
}

$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);
}
Ejemplo n.º 10
0
//    CommSy is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You have received a copy of the GNU General Public License
//    along with CommSy.
include_once 'classes/cs_link.php';
include_once 'classes/cs_list.php';
if (!isset($environment) and isset($this->_environment)) {
    $environment = $this->_environment;
}
if (!isset($translator) and isset($this->_translator)) {
    $translator = $this->_translator;
}
$addon_link_list = new cs_list();
global $c_html_textarea;
if ($c_html_textarea) {
    $link_item = new cs_link();
    $link_item->setTitle($translator->getMessage('CONFIGURATION_TEXTAREA_TITLE'));
    $link_item->setDescription($translator->getMessage('CONFIGURATION_TEXTAREA_TITLE_DESC'));
    $link_item->setIconPath('images/cs_config/CONFIGURATION_TEXTAREA_TITLE.gif');
    $link_item->setContextID($environment->getCurrentContextID());
    $link_item->setModule('configuration');
    $link_item->setFunction('htmltextarea');
    $link_item->setParameter(array());
    $addon_link_list->add($link_item);
}
$context_item = $environment->getCurrentContextItem();
$link_item = new cs_link();
$link_item->setTitle($translator->getMessage('CONFIGURATION_SERVICE_LINK'));
Ejemplo n.º 11
0
$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
$checkedAnnouncementIds = array();
$new_announcement_list = new cs_list();

if (!empty($announcement_id_array)) {
      foreach($announcement_id_array as $announcement_id) {
         $announcement_item = $announcement_list->getFirst();
         while($announcement_item) {
            //include_once('functions/error_functions.php');trigger_error('n i y',E_USER_ERROR);
            if($announcement_item->getItemID() == $announcement_id and $announcement_item->getContextID() === 0) {
               $announcement_item = $announcement_manager->getItem($announcement_item->getItemId());
               $new_announcement_list->add($announcement_item);
               $current_context = $environment->getCurrentContextID();
               if ($announcement_item->getContextID() != $current_context){
                  $checkedAnnouncementIds[] = $announcement_item->getItemID();
               }
               break;
            } else {
Ejemplo n.º 12
0
 private function _getAllOpenContexts($user_item)
 {
     $own_room_item = $user_item->getOwnRoom();
     if (isset($own_room_item)) {
         $customized_room_array = $own_room_item->getCustomizedRoomIDArray();
     }
     if (isset($customized_room_array[0])) {
         return $this->_getCustomizedRoomList($user_item);
     } else {
         $this->translatorChangeToPortal();
         $selected = false;
         $selected_future = 0;
         $selected_future_pos = -1;
         $retour = array();
         $temp_array = array();
         $temp_array['item_id'] = -1;
         $temp_array['title'] = '';
         $retour[] = $temp_array;
         unset($temp_array);
         $temp_array = array();
         $community_list = $user_item->getRelatedCommunityList();
         if ($community_list->isNotEmpty()) {
             $temp_array['item_id'] = -1;
             $temp_array['title'] = $this->_translator->getMessage('MYAREA_COMMUNITY_INDEX') . '';
             $retour[] = $temp_array;
             unset($temp_array);
             $community_item = $community_list->getFirst();
             while ($community_item) {
                 $temp_array = array();
                 $temp_array['item_id'] = $community_item->getItemID();
                 $title = $community_item->getTitle();
                 $temp_array['title'] = $title;
                 if ($community_item->getItemID() == $this->_environment->getCurrentContextID() and !$selected) {
                     $temp_array['selected'] = true;
                     $selected = true;
                 }
                 $retour[] = $temp_array;
                 unset($temp_array);
                 unset($community_item);
                 $community_item = $community_list->getNext();
             }
             $temp_array = array();
             $temp_array['item_id'] = -1;
             $temp_array['title'] = '';
             $retour[] = $temp_array;
             unset($community_list);
         }
         $portal_item = $this->_environment->getCurrentPortalItem();
         if ($portal_item->showTime()) {
             $project_list = $user_item->getRelatedProjectListSortByTimeForMyArea();
             include_once 'classes/cs_list.php';
             $new_project_list = new cs_list();
             $grouproom_array = array();
             $project_grouproom_array = array();
             if ($project_list->isNotEmpty()) {
                 $room_item = $project_list->getFirst();
                 while ($room_item) {
                     if ($room_item->isA(CS_GROUPROOM_TYPE)) {
                         $grouproom_array[$room_item->getItemID()] = $room_item->getTitle();
                         $linked_project_item_id = $room_item->getLinkedProjectItemID();
                         $project_grouproom_array[$linked_project_item_id][] = $room_item->getItemID();
                     } else {
                         $new_project_list->add($room_item);
                     }
                     unset($room_item);
                     $room_item = $project_list->getNext();
                 }
                 unset($project_list);
                 $project_list = $new_project_list;
                 unset($new_project_list);
             }
             $future = true;
             $future_array = array();
             $no_time = false;
             $no_time_array = array();
             $current_time = $portal_item->getTitleOfCurrentTime();
             $with_title = false;
         } else {
             $project_list = $user_item->getRelatedProjectListForMyArea();
             include_once 'classes/cs_list.php';
             $new_project_list = new cs_list();
             $grouproom_array = array();
             $project_grouproom_array = array();
             if ($project_list->isNotEmpty()) {
                 $room_item = $project_list->getFirst();
                 while ($room_item) {
                     if ($room_item->isA(CS_GROUPROOM_TYPE)) {
                         $grouproom_array[$room_item->getItemID()] = $room_item->getTitle();
                         $linked_project_item_id = $room_item->getLinkedProjectItemID();
                         $project_grouproom_array[$linked_project_item_id][] = $room_item->getItemID();
                     } else {
                         $new_project_list->add($room_item);
                     }
                     unset($room_item);
                     $room_item = $project_list->getNext();
                 }
                 unset($project_list);
                 $project_list = $new_project_list;
                 unset($new_project_list);
             }
         }
         unset($user_item);
         if ($project_list->isNotEmpty()) {
             $temp_array['item_id'] = -1;
             $temp_array['title'] = $this->_translator->getMessage('MYAREA_PROJECT_INDEX') . '';
             $retour[] = $temp_array;
             unset($temp_array);
             $project_item = $project_list->getFirst();
             while ($project_item) {
                 $temp_array = array();
                 if ($project_item->isA(CS_PROJECT_TYPE)) {
                     $temp_array['item_id'] = $project_item->getItemID();
                     $title = $project_item->getTitle();
                     $temp_array['title'] = $title;
                     if ($project_item->getItemID() == $this->_environment->getCurrentContextID() and (!$selected or $selected_future == $project_item->getItemID())) {
                         $temp_array['selected'] = true;
                         if (!empty($selected_future) and $selected_future != 0 and $selected_future_pos != -1) {
                             $selected_future = 0;
                             unset($future_array[$selected_future_pos]['selected']);
                         }
                         $selected = true;
                     }
                     // grouprooms
                     if (isset($project_grouproom_array[$project_item->getItemID()]) and !empty($project_grouproom_array[$project_item->getItemID()]) and $project_item->isGrouproomActive()) {
                         $group_result_array = array();
                         $project_grouproom_array[$project_item->getItemID()] = array_unique($project_grouproom_array[$project_item->getItemID()]);
                         foreach ($project_grouproom_array[$project_item->getItemID()] as $value) {
                             $group_temp_array = array();
                             $group_temp_array['item_id'] = $value;
                             $group_temp_array['title'] = '- ' . $grouproom_array[$value];
                             if ($value == $this->_environment->getCurrentContextID() and (!$selected or $selected_future == $value)) {
                                 $group_temp_array['selected'] = true;
                                 $selected = true;
                                 if (!empty($selected_future) and $selected_future != 0 and $selected_future_pos != -1) {
                                     $selected_future = 0;
                                     unset($future_array[$selected_future_pos]['selected']);
                                 }
                             }
                             $group_result_array[] = $group_temp_array;
                             unset($group_temp_array);
                         }
                     }
                 } else {
                     $with_title = true;
                     $temp_array['item_id'] = -2;
                     $title = $project_item->getTitle();
                     if (!empty($title) and $title != 'COMMON_NOT_LINKED') {
                         $temp_array['title'] = $this->_translator->getTimeMessage($title);
                     } else {
                         $temp_array['title'] = $this->_translator->getMessage('COMMON_NOT_LINKED');
                         $no_time = true;
                     }
                     if (!empty($title) and $title == $current_time) {
                         $future = false;
                     }
                 }
                 if ($portal_item->showTime()) {
                     if ($no_time) {
                         $no_time_array[] = $temp_array;
                         if (isset($group_result_array) and !empty($group_result_array)) {
                             $no_time_array = array_merge($no_time_array, $group_result_array);
                             unset($group_result_array);
                         }
                     } elseif ($future) {
                         if ($temp_array['item_id'] != -2) {
                             $future_array[] = $temp_array;
                             if (!empty($temp_array['selected']) and $temp_array['selected']) {
                                 $selected_future = $temp_array['item_id'];
                                 $selected_future_pos = count($future_array) - 1;
                             }
                             if (isset($group_result_array) and !empty($group_result_array)) {
                                 $future_array = array_merge($future_array, $group_result_array);
                                 unset($group_result_array);
                             }
                         }
                     } else {
                         $retour[] = $temp_array;
                         if (isset($group_result_array) and !empty($group_result_array)) {
                             $retour = array_merge($retour, $group_result_array);
                             unset($group_result_array);
                         }
                     }
                 } else {
                     $retour[] = $temp_array;
                     if (isset($group_result_array) and !empty($group_result_array)) {
                         $retour = array_merge($retour, $group_result_array);
                         unset($group_result_array);
                     }
                 }
                 unset($temp_array);
                 unset($project_item);
                 $project_item = $project_list->getNext();
             }
             unset($project_list);
             if ($portal_item->showTime()) {
                 // special case, if no room is linked to a time pulse
                 if (isset($with_title) and !$with_title) {
                     $temp_array = array();
                     $temp_array['item_id'] = -2;
                     $temp_array['title'] = $this->_translator->getMessage('COMMON_NOT_LINKED');
                     $retour[] = $temp_array;
                     unset($temp_array);
                     $retour = array_merge($retour, $future_array);
                     $future_array = array();
                 }
                 if (!empty($future_array)) {
                     $future_array2 = array();
                     $future_array3 = array();
                     foreach ($future_array as $element) {
                         if (!in_array($element['item_id'], $future_array3)) {
                             $future_array3[] = $element['item_id'];
                             $future_array2[] = $element;
                         }
                     }
                     $future_array = $future_array2;
                     unset($future_array2);
                     unset($future_array3);
                     $temp_array = array();
                     $temp_array['title'] = $this->_translator->getMessage('COMMON_IN_FUTURE');
                     $temp_array['item_id'] = -2;
                     $future_array_begin = array();
                     $future_array_begin[] = $temp_array;
                     $future_array = array_merge($future_array_begin, $future_array);
                     unset($temp_array);
                     $retour = array_merge($retour, $future_array);
                 }
                 if (!empty($no_time_array)) {
                     $retour = array_merge($retour, $no_time_array);
                 }
             }
         }
         unset($portal_item);
         $this->translatorChangeToCurrentContext();
         return $retour;
     }
 }
Ejemplo n.º 13
0
$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);


// Materialien des Gemeinschaftsraumes
$checkedMaterialIds = array();
$new_material_list = new cs_list();

if (!empty($material_id_array)) {
      foreach($material_id_array as $material_id) {
         $material_item = $material_list->getFirst();
         while($material_item) {
            //include_once('functions/error_functions.php');trigger_error('n i y',E_USER_ERROR);
            if($material_item->getItemID() == $material_id and $material_item->getContextID() === 0) {
                //Get latest Version
               $latest_version = $material_manager->getLatestVersionID($material_item->getItemId());
               $material_item = $material_manager->getItemByVersion($material_item->getItemId(),$latest_version);
               $new_material_list->add($material_item);
               $current_context = $environment->getCurrentContextID();
               if ($material_item->getContextID() != $current_context){
                  $checkedMaterialIds[] = $material_item->getItemID();
               }
Ejemplo n.º 14
0
 function getSubList($position, $length)
 {
     $sub_list = new cs_list();
     $sub_data_array = array_slice($this->_data, $position, $length);
     foreach ($sub_data_array as $sub_data_item) {
         $sub_list->add($sub_data_item);
     }
     return $sub_list;
 }
Ejemplo n.º 15
0
      redirect($environment->getCurrentContextID(),'home', 'index', $params);
   }

   // 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();
         }
      }

      ############################################
Ejemplo n.º 16
0
 /**
  * Returns all existing task for an item
  */
 function getTaskListForItem($item)
 {
     $item_id = $item->getItemID();
     $query = 'SELECT * FROM ' . $this->addDatabasePrefix('tasks') . ' WHERE linked_item_id="' . encode(AS_DB, $item_id) . '"';
     $result = $this->_db_connector->performQuery($query);
     $task_list = new cs_list();
     foreach ($result as $query_result) {
         $task_item = $this->_buildItem($query_result);
         $task_list->add($task_item);
         unset($task_item);
     }
     unset($item);
     return $task_list;
 }
 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;
 }
Ejemplo n.º 18
0
$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) {
               $date_item = $date_manager->getItem($date_item->getItemId());
               $new_date_list->add($date_item);
               $current_context = $environment->getCurrentContextID();
               if ($date_item->getContextID() != $current_context){
                  $checkedDateIds[] = $date_item->getItemID();
               }
               break;
            } else {
//    (at your option) any later version.
//
//    CommSy is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You have received a copy of the GNU General Public License
//    along with CommSy.
include_once 'classes/cs_link.php';
include_once 'classes/cs_list.php';
if (!isset($environment) and isset($this->_environment)) {
    $environment = $this->_environment;
}
$translator = $environment->getTranslationObject();
$room_link_list = new cs_list();
$link_item = new cs_link();
$link_item->setTitle($translator->getMessage('COMMON_ROOM_META'));
$current_context = $environment->getCurrentContextItem();
$link_item->setIconPath('images/cs_config/COMMON_ROOM_META.gif');
$link_item->setDescription($translator->getMessage('COMMON_ROOM_META_DESC'));
$link_item->setContextID($environment->getCurrentContextID());
$link_item->setModule('configuration');
$link_item->setFunction('preferences');
$link_item->setParameter(array());
$room_link_list->add($link_item);
if ($environment->inPortal()) {
    $link_item = new cs_link();
    $link_item->setTitle($translator->getMessage('CONFIGURATION_PORTAL_HOME'));
    $link_item->setDescription($translator->getMessage('CONFIGURATION_PORTAL_HOME_DESC'));
    $link_item->setIconPath('images/cs_config/CONFIGURATION_ROOM_HOME.gif');
Ejemplo n.º 20
0
   $dates_manager->selectDistinct();
} else {
   $dates_manager->select();
}

$list = $dates_manager->get();        // returns a cs_list of dates_items

if (($seldisplay_mode=='calendar' or $seldisplay_mode == 'calendar_month') and !($mode == 'formattach' or $mode == 'detailattach') ){
   $current_user = $environment->getCurrentUserItem();

   // only access display config, if user is not root
   if( !$current_user->isRoot() and $environment->inPrivateRoom() ) {
     $myentries_array = $current_context->getMyCalendarDisplayConfig();

     if(in_array("mycalendar_dates_assigned_to_me", $myentries_array)){
      $temp_list = new cs_list();
       $current_user = $environment->getCurrentUserItem();
       $current_user_list = $current_user->getRelatedUserList();

       $temp_element = $list->getFirst();
       while($temp_element){
        $temp_user = $current_user_list->getFirst();
        while($temp_user){
           if($temp_element->isParticipant($temp_user)){
             $temp_list->add($temp_element);
           }
           $temp_user = $current_user_list->getNext();
        }
        $temp_element = $list->getNext();
       }
Ejemplo n.º 21
0
 /** select all versions of a material
  * this method returns a list (cs_list) of materials in specific versions
  *
  * @param integer material_id item-id of material
  *
  * @return cs_list version_list of versions of the material
  */
 function getVersionList($material_id)
 {
     $version_list = new cs_list();
     $query = 'SELECT * FROM ' . $this->addDatabasePrefix('materials');
     $query .= ' WHERE ' . $this->addDatabasePrefix('materials') . '.item_id="' . encode(AS_DB, $material_id) . '"';
     if ($this->_delete_limit == true) {
         $query .= ' AND ' . $this->addDatabasePrefix('materials') . '.deleter_id IS NULL';
     }
     $query .= " ORDER BY " . $this->addDatabasePrefix("materials") . ".version_id DESC";
     $result = $this->_db_connector->performQuery($query);
     if (!isset($result)) {
         include_once 'functions/error_functions.php';
         trigger_error('Problems selecting versions of a material from query: "' . $query . '"', E_USER_WARNING);
     } else {
         foreach ($result as $query_result) {
             $material_item = $this->_buildItem($query_result);
             $version_list->add($material_item);
         }
     }
     return $version_list;
 }
Ejemplo n.º 22
0
//    GNU General Public License for more details.
//
//    You have received a copy of the GNU General Public License
//    along with CommSy.

// Get data from database
$item_manager = $environment->getItemManager();
$item_manager->setContextLimit($environment->getCurrentContextID());
$item_manager->setCommunityHomeLimit();
$item_manager->setIntervalLimit(20);
$item_manager->select();
$item_list = $item_manager->get();            // returns a cs_list of items
#$ids = $item_manager->getIDs();

$item = $item_list->getFirst();
$new_item_list = new cs_list();
while($item){
   $type = $item->getItemType();
#   $item_manager = $environment->getManager();
#   $new_item = $labelmanager->getItem($item->getItemID());
#   $new_item_list->add($new_item);

   switch ($type){
      case 'label':
         $labelmanager = $environment->getLabelmanager();
         $new_item = $labelmanager->getItem($item->getItemID());
         $new_item_list->add($new_item);
         break;
      case 'materials':
         $materialmanager = $environment->getMaterialmanager();
         $new_item = $materialmanager->getItem($item->getItemID());
Ejemplo n.º 23
0
 function getSortedItemList($id_array, $sortBy)
 {
     if (empty($id_array)) {
         return new cs_list();
     } else {
         $query = 'SELECT * FROM ' . $this->addDatabasePrefix($this->_db_table) . ' WHERE ' . $this->addDatabasePrefix($this->_db_table) . '.item_id IN ("' . implode('", "', encode(AS_DB, $id_array)) . '") AND ' . $this->addDatabasePrefix($this->_db_table) . '.type LIKE "community"';
         $query .= " ORDER BY " . $sortBy;
         $result = $this->_db_connector->performQuery($query);
         if (!isset($result)) {
             include_once 'functions/error_functions.php';
             trigger_error('Problems selecting list of ' . $this->_room_type . ' items.', E_USER_WARNING);
         } else {
             $list = new cs_list();
             // filter items with highest version_id, doing this in MySQL would be too expensive
             foreach ($result as $rs) {
                 $list->add($this->_buildItem($rs));
             }
         }
         return $list;
     }
 }
Ejemplo n.º 24
0
    unset($params['attach_view']);
    unset($params['attach_type']);
    unset($params['from']);
    unset($params['pos']);
    unset($params['mode']);
    unset($params['return_attach_item_list']);
    if ( $environment->getCurrentModule() == type2module(CS_DATE_TYPE) ) {
       unset($params['date_option']);
    }
    if ( $environment->getCurrentModule() == type2module(CS_TODO_TYPE) ) {
       unset($params['todo_option']);
    }
    redirect($environment->getCurrentContextID(),$environment->getCurrentModule(), $environment->getCurrentFunction(), $params);
}

$item_list = new cs_list();
$item_ids = array();
$count_all = 0;
$params = array();
$params['environment'] = $environment;
$params['with_modifying_actions'] = true;
$item_attach_index_view = $class_factory->getClass(ITEM_ATTACH_INDEX_VIEW,$params);
unset($params);

$context_item = $environment->getCurrentContextItem();
$current_room_modules = $context_item->getHomeConf();
if ( !empty($current_room_modules) ){
   $room_modules = explode(',',$current_room_modules);
} else {
   $room_modules =  $default_room_modules;
}
Ejemplo n.º 25
0
//
//    CommSy is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation; either version 2 of the License, or
//    (at your option) any later version.
//
//    CommSy is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You have received a copy of the GNU General Public License
//    along with CommSy.
include_once 'classes/cs_link.php';
include_once 'classes/cs_list.php';
$admin_link_list = new cs_list();
if (!isset($environment) and isset($this->_environment)) {
    $environment = $this->_environment;
}
if (!isset($translator) and isset($this->_translator)) {
    $translator = $this->_translator;
}
if (!$environment->inServer() and !$environment->inPrivateRoom()) {
    $link_item = new cs_link();
    $link_item->setDescription($translator->getMessage('ROOM_MEMBER_ADMIN_DESC'));
    $link_item->setIconPath('images/cs_config/ROOM_MEMBER_ADMIN.gif');
    $link_item->setTitle($translator->getMessage('ROOM_MEMBER_ADMIN'));
    $link_item->setContextID($environment->getCurrentContextID());
    $link_item->setModule('account');
    $link_item->setFunction('index');
    $link_item->setParameter(array());
Ejemplo n.º 26
0
	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;
	}
Ejemplo n.º 27
0
 public function getNetnavigationForUser($item)
 {
     $return = array();
     $current_context = $this->_environment->getCurrentContextItem();
     $current_user = $this->_environment->getCurrentUser();
     $translator = $this->_environment->getTranslationObject();
     $converter = $this->_environment->getTextConverter();
     if ($current_context->isProjectRoom()) {
         $link_items = $item->getLinkItemList(CS_GROUP_TYPE);
     } elseif ($current_context->isCommunityRoom()) {
         $link_items = $item->getLinkItemList(CS_INSTITUTION_TYPE);
     } else {
         $link_items = new cs_list();
     }
     // 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;
 }
Ejemplo n.º 28
0
 function getTempItemListBySessionID($session_id)
 {
     $file_list = new cs_list();
     $query = 'SELECT * FROM ' . $this->addDatabasePrefix('files');
     $query .= ' WHERE 1';
     $query .= ' AND ' . $this->addDatabasePrefix('files') . '.temp_upload_session_id="' . encode(AS_DB, $session_id) . '"';
     $result = $this->_db_connector->performQuery($query);
     if (!isset($result)) {
         include_once 'functions/error_functions.php';
         trigger_error('Problems getting temp files with session id [' . $session_id . '].', E_USER_WARNING);
         $file = array();
     } elseif (!empty($result[0])) {
         foreach ($result as $file_results) {
             $temp_file = $this->_buildItem($file_results);
             $file_list->add($temp_file);
         }
     }
     return $file_list;
 }
 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;
 }
Ejemplo n.º 30
0
 /** 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();
     }
 }