function plugin_hook_output_all($hook_function, $params = null, $separator = '', $with_config_check = true, $except = array()) { if (!empty($separator) and $separator == 'ARRAY') { $retour = array(); } else { $retour = ''; } global $environment; global $c_plugin_array; if (isset($c_plugin_array) and !empty($c_plugin_array)) { $first = true; foreach ($c_plugin_array as $plugin) { if (!in_array($plugin, $except)) { $output = plugin_hook_output($plugin, $hook_function, $params, $with_config_check); if (!empty($output)) { if (!empty($separator) and $separator == 'ARRAY' and is_array($output)) { $retour = array_merge($retour, $output); } elseif (!empty($separator) and $separator == 'MULTIARRAY' and is_array($output)) { $retour[] = $output; } elseif (!empty($separator) and $separator == 'ONE') { $retour = $output; break; } else { if ($first) { $first = false; } else { $retour .= $separator; } $retour .= $output; } } } } } return $retour; }
break; case 'MYROOM': $tempMessage = $translator->getMessage('COMMON_PAGETITLE_MYROOM'); break; case 'PROJECT': $tempMessage = $translator->getMessage('COMMON_PAGETITLE_PROJECT'); break; case 'SECTION': $tempMessage = $translator->getMessage('COMMON_PAGETITLE_SECTION'); break; case 'TODO': $tempMessage = $translator->getMessage('COMMON_PAGETITLE_TODO'); break; case 'TOPIC': $tempMessage = $translator->getMessage('COMMON_PAGETITLE_TOPIC'); break; case 'USER': $tempMessage = $translator->getMessage('COMMON_PAGETITLE_USER'); break; default: $text = ''; if ($environment->isPlugin($environment->getCurrentModule())) { $text = plugin_hook_output($environment->getCurrentModule(), 'getDisplayName'); } if (!empty($text)) { $tempMessage .= $text; } else { $tempMessage = $translator->getMessage('COMMON_MESSAGETAG_ERROR'); } break; }
/** create the form, INTERNAL * this methods creates the form with the form definitions */ function _createForm() { $new_private_room = false; if ($this->_environment->inPrivateRoom()) { $new_private_room = $this->_environment->inConfigArray('c_use_new_private_room', $this->_environment->getCurrentContextID()); if (!isset($new_private_room)) { $new_private_room = $this->_environment->inConfigArray('c_use_new_private_room', $this->_environment->getCurrentPortalID()); } if (!isset($new_private_room)) { $new_private_room = false; } } $view_mod_array = array(); $view_mod_array[0]['text'] = $this->_translator->getMessage('RUBRIC_CONFIG_SHORT'); $view_mod_array[0]['value'] = 'short'; $view_mod_array[1]['text'] = $this->_translator->getMessage('RUBRIC_CONFIG_TINY'); $view_mod_array[1]['value'] = 'tiny'; $view_mod_array[2]['text'] = $this->_translator->getMessage('RUBRIC_CONFIG_NO'); $view_mod_array[2]['value'] = 'nodisplay'; $first = true; $second = false; $third = false; $text = '<table style="border: 0px solid black;"><tr style="border: 0px solid black;"><td style="border: 0px solid black; vertical-align:top;" summary="Layout">' . $this->_translator->getMessage('CONFIGURATION_RUBRIC_DESC') . '</td><td style="border: 0px solid black;">' . '<img src="images/configuration_rubric.jpg" width="400px;" style=" border:1px solid black; vertical-align: middle;"/>' . '</td></tr></table>'; $room = $this->_environment->getCurrentContextItem(); $default_rubrics = $room->getAvailableDefaultRubricArray(); $plugin_list = $this->_environment->getRubrikPluginClassList($this->_environment->getCurrentPortalID()); if (isset($plugin_list) and $plugin_list->isNotEmpty()) { $plugin_class = $plugin_list->getFirst(); while ($plugin_class) { if (!in_array($plugin_class->getIdentifier(), $default_rubrics) and ($this->_environment->inPrivateRoom() and $plugin_class->inPrivateRoom() or $this->_environment->inProjectRoom() and $plugin_class->inProjectRoom() or $this->_environment->inCommunityRoom() and $plugin_class->inCommunityRoom() or $this->_environment->inGroupRoom() and $plugin_class->inGroupRoom())) { $default_rubrics[] = mb_strtolower($plugin_class->getIdentifier()); } $plugin_class = $plugin_list->getNext(); } } if (count($default_rubrics) > 8) { $count = 8; } else { $count = count($default_rubrics); } for ($i = 0; $i < $count; $i++) { $nameArray[0] = 'module[' . $i . ']'; $nameArray[1] = 'view[' . $i . ']'; $desc = ''; if ($first) { $first = false; $desc = $this->_translator->getMessage('INTERNAL_MODULE_CONF_DESC_SHORT', $this->_translator->getMessage('MODULE_CONFIG_SHORT')); $second = true; } elseif ($second) { $second = false; $desc = $this->_translator->getMessage('INTERNAL_MODULE_CONF_DESC_TINY', $this->_translator->getMessage('MODULE_CONFIG_TINY')); $third = true; } elseif ($third) { $third = false; $desc = $this->_translator->getMessage('INTERNAL_MODULE_CONF_DESC_NONE', $this->_translator->getMessage('MODULE_CONFIG_NONE')); } } $rubric_array = array(); $i = 1; $select_array[0]['text'] = '----------'; $select_array[0]['value'] = 'none'; foreach ($default_rubrics as $rubric) { if ($this->_environment->inPrivateRoom() and $rubric == 'user') { $select_array[$i]['text'] = $this->_translator->getMessage('COMMON_MY_USER_DESCRIPTION'); } else { switch (mb_strtoupper($rubric, 'UTF-8')) { case 'ANNOUNCEMENT': $select_array[$i]['text'] = $this->_translator->getMessage('ANNOUNCEMENT_INDEX'); break; case 'DATE': if ($new_private_room) { $select_array[$i]['text'] = $this->_translator->getMessage('MYCALENDAR_INDEX'); } else { $select_array[$i]['text'] = $this->_translator->getMessage('DATE_INDEX'); } break; case 'DISCUSSION': $select_array[$i]['text'] = $this->_translator->getMessage('DISCUSSION_INDEX'); break; case 'GROUP': $select_array[$i]['text'] = $this->_translator->getMessage('GROUP_INDEX'); break; case 'INSTITUTION': $select_array[$i]['text'] = $this->_translator->getMessage('INSTITUTION_INDEX'); break; case 'MATERIAL': $select_array[$i]['text'] = $this->_translator->getMessage('MATERIAL_INDEX'); break; case 'MYROOM': $select_array[$i]['text'] = $this->_translator->getMessage('MYROOM_INDEX'); break; case 'PROJECT': $select_array[$i]['text'] = $this->_translator->getMessage('PROJECT_INDEX'); break; case 'TODO': $select_array[$i]['text'] = $this->_translator->getMessage('TODO_INDEX'); break; case 'TOPIC': $select_array[$i]['text'] = $this->_translator->getMessage('TOPIC_INDEX'); break; case 'USER': $select_array[$i]['text'] = $this->_translator->getMessage('USER_INDEX'); break; case 'ENTRY': $select_array[$i]['text'] = $this->_translator->getMessage('ENTRY_INDEX'); break; default: $text = ''; if ($this->_environment->isPlugin($rubric)) { $text = plugin_hook_output($rubric, 'getDisplayName'); } if (!empty($text)) { $select_array[$i]['text'] = $text; } elseif (!$this->_environment->isPlugin($rubric)) { $select_array[$i]['text'] = $this->_translator->getMessage('COMMON_MESSAGETAG_ERROR' . ' ' . __FILE__ . '(' . __LINE__ . ')'); } break; } } $select_array[$i]['value'] = $rubric; $i++; } // sorting $sort_by = 'text'; usort($select_array, create_function('$a,$b', 'return strnatcasecmp($a[\'' . $sort_by . '\'],$b[\'' . $sort_by . '\']);')); $home_conf = $this->_environment->getCurrentContextItem()->getHomeConf(); $home_conf_array = explode(',', $home_conf); $i = 0; $value_array = array(); foreach ($home_conf_array as $rubric_conf) { $rubric_conf_array = explode('_', $rubric_conf); if ($rubric_conf_array[1] != 'none') { $value_array[] = true; } else { $value_array[] = false; } } for ($j = $i + 1; $j < $count; $j++) { $value_array[] = false; } for ($i = 0; $i < $count; $i++) { if ($i > 0) { $this->_form->combine(); } $this->_form->addSelect('rubric_' . $i, $select_array, '', $this->_translator->getMessage('COMMON_CHOOSE_RUBRIC'), '', '', '', '', '', true, '', '', '', '', '', false, '', 'id="id' . $i . '" onChange="javascript:cs_toggleSelect(' . $i . ')"'); if (!$this->_environment->inPrivateRoom()) { $this->_form->combine('horizontal'); if ($value_array[$i]) { $disabled = false; } else { $disabled = true; } $this->_form->addSelect('show_' . $i, $view_mod_array, '', '', '', '', '', '', '', true, '', '', '', '', '', $disabled, '', 'id="nr' . $i . '" '); } } if ($this->_environment->inProjectRoom() or $this->_environment->inGroupRoom() or $this->_environment->inCommunityRoom()) { $this->_form->addTextField('time_spread', '', $this->_translator->getMessage('INTERNAL_TIME_SPREAD'), $this->_translator->getMessage('INTERNAL_TIME_SPREAD_DESC'), '3', '3', true); } // buttons $this->_form->addButtonBar('option', $this->_translator->getMessage('PREFERENCES_SAVE_BUTTON'), ''); }
/** create the form, INTERNAL * this methods creates the form with the form definitions */ function _createForm() { $first = true; $second = false; $third = false; $text = '<table style="border: 0px solid black;"><tr style="border: 0px solid black;"><td style="border: 0px solid black; vertical-align:top;" summary="Layout">' . $this->_translator->getMessage('CONFIGURATION_RUBRIC_DESC') . '</td><td style="border: 0px solid black;">' . '<img src="images/configuration_rubric.jpg" width="400px;" style=" border:1px solid black; vertical-align: middle;"/>' . '</td></tr></table>'; $count = 8; if ($this->_environment->inCommunityRoom() or $this->_environment->inGroupRoom()) { $count = 7; } for ($i = 0; $i < $count; $i++) { $nameArray[0] = 'module[' . $i . ']'; $nameArray[1] = 'view[' . $i . ']'; $desc = ''; if ($first) { $first = false; $desc = $this->_translator->getMessage('INTERNAL_MODULE_CONF_DESC_SHORT', $this->_translator->getMessage('MODULE_CONFIG_SHORT')); $second = true; } elseif ($second) { $second = false; $desc = $this->_translator->getMessage('INTERNAL_MODULE_CONF_DESC_TINY', $this->_translator->getMessage('MODULE_CONFIG_TINY')); $third = true; } elseif ($third) { $third = false; $desc = $this->_translator->getMessage('INTERNAL_MODULE_CONF_DESC_NONE', $this->_translator->getMessage('MODULE_CONFIG_NONE')); } } $room = $this->_environment->getCurrentContextItem(); $default_rubrics = $room->getAvailableDefaultRubricArray(); $rubric_array = array(); $i = 1; $select_array[0]['text'] = '----------'; $select_array[0]['value'] = 'none'; foreach ($default_rubrics as $rubric) { if ($this->_environment->inPrivateRoom() and $rubric == 'user') { $select_array[$i]['text'] = $this->_translator->getMessage('COMMON_MY_USER_DESCRIPTION'); } else { switch (mb_strtoupper($rubric, 'UTF-8')) { case 'ANNOUNCEMENT': $select_array[$i]['text'] = $this->_translator->getMessage('ANNOUNCEMENT_INDEX'); break; case 'DATE': $select_array[$i]['text'] = $this->_translator->getMessage('DATE_INDEX'); break; case 'DISCUSSION': $select_array[$i]['text'] = $this->_translator->getMessage('DISCUSSION_INDEX'); break; case 'GROUP': $select_array[$i]['text'] = $this->_translator->getMessage('GROUP_INDEX'); break; case 'INSTITUTION': $select_array[$i]['text'] = $this->_translator->getMessage('INSTITUTION_INDEX'); break; case 'MATERIAL': $select_array[$i]['text'] = $this->_translator->getMessage('MATERIAL_INDEX'); break; case 'MYROOM': $select_array[$i]['text'] = $this->_translator->getMessage('MYROOM_INDEX'); break; case 'PROJECT': $select_array[$i]['text'] = $this->_translator->getMessage('PROJECT_INDEX'); break; case 'TODO': $select_array[$i]['text'] = $this->_translator->getMessage('TODO_INDEX'); break; case 'TOPIC': $select_array[$i]['text'] = $this->_translator->getMessage('TOPIC_INDEX'); break; case 'USER': $select_array[$i]['text'] = $this->_translator->getMessage('USER_INDEX'); break; default: $text = ''; if ($this->_environment->isPlugin($rubric)) { $text = plugin_hook_output($rubric, 'getDisplayName'); } if (!empty($text)) { $select_array[$i]['text'] = $text; } else { $select_array[$i]['text'] = $this->_translator->getMessage('COMMON_MESSAGETAG_ERROR' . ' cs_configuration_rubric_form(' . __LINE__ . ') '); } break; } } $select_array[$i]['value'] = $rubric; $i++; } // sorting $sort_by = 'text'; usort($select_array, create_function('$a,$b', 'return strnatcasecmp($a[\'' . $sort_by . '\'],$b[\'' . $sort_by . '\']);')); for ($i = 0; $i < $count; $i++) { if ($i > 0) { $this->_form->combine('horizontal'); } $this->_form->addSelect('rubric_' . $i, $select_array, '', '', '', '', false, false); } // buttons $this->_form->addButtonBar('option', $this->_translator->getMessage('COMMON_SAVE_BUTTON'), ''); }
/** * gets information for displaying room rubrics in navigation bar */ protected function getRubricInformation() { // init return with home $return = array(); $return[] = array('name' => 'home', 'translate' => false, 'active' => $this->_environment->getCurrentModule() == 'home', 'span_prefix' => 'ho'); // get rubrics $rubrics = $this->getRubrics(); // these prefixes are needed for building up the span id $span_lookup = array(CS_ANNOUNCEMENT_TYPE => 'an', CS_DATE_TYPE => 'te', CS_MATERIAL_TYPE => 'ma', CS_DISCUSSION_TYPE => 'di', CS_USER_TYPE => 'pe', CS_GROUP_TYPE => 'gr', CS_TODO_TYPE => 'au', CS_TOPIC_TYPE => 'th', CS_PROJECT_TYPE => 'pr', CS_INSTITUTION_TYPE => 'in'); foreach ($rubrics as $rubric) { list($suffix, $postfix) = explode('_', $rubric); if ($postfix !== 'none') { $name = ''; $translate = true; if ($this->_environment->isPlugin($suffix)) { $name = plugin_hook_output($suffix, 'getDisplayName'); $translate = false; } else { $name = $suffix; } if (empty($name)) { die('rubric name could not be found'); } // append return $return[] = array('name' => $name, 'translate' => $translate, 'active' => $this->_environment->getCurrentModule() == $name, 'span_prefix' => $span_lookup[$name]); } } return $return; }
/** get the linkbar as HTML * this method returns the linkbar as HTML - internal, do not use * * @return string linkbar as HTML */ function _getLinkRowAsHTML($bottom = false) { $new_private_room = $this->_environment->inConfigArray('c_use_new_private_room', $this->_environment->getCurrentContextID()); $html = LF . '<!-- BEGIN TABS -->' . LF; $html .= '<div id="tabs_frame" >' . LF; if ($bottom) { $html .= '<div class="tabs_bottom">' . LF; } else { $html .= '<div id="tabs">' . LF; } $html .= '<div style="float:right; margin:0px; padding:0px 12px;">' . LF; // configuration $context_user = $this->_environment->getCurrentUserItem(); if ($context_user->isModerator() and !$context_user->isOnlyReadUser()) { if ($this->_environment->getCurrentBrowser() == 'MSIE' && mb_substr($this->_environment->getCurrentBrowserVersion(), 0, 1) == '6') { $image = '<img src="images/commsyicons_msie6/config_home.gif" style="vertical-align:bottom;" alt="' . $this->_translator->getMessage('COMMON_CONFIGURATION') . '"/>'; } else { $image = '<img src="images/config_home.png" style="vertical-align:bottom;" alt="' . $this->_translator->getMessage('COMMON_CONFIGURATION') . '"/>'; } $html .= ahref_curl($this->_environment->getCurrentContextID(), 'configuration', 'index', '', $image, $this->_translator->getMessage('COMMON_CONFIGURATION')) . LF; // $show_user_config = false; // // tasks // $manager = $this->_environment->getTaskManager(); // $manager->resetLimits(); // $manager->setContextLimit($this->_environment->getCurrentContextID()); // $manager->setStatusLimit('REQUEST'); // $manager->select(); // $tasks = $manager->get(); // $task = $tasks->getFirst(); // $show_user_config = false; // $count_new_accounts = 0; // while($task){ // $mode = $task->getTitle(); // $task = $tasks->getNext(); // if ($mode == 'TASK_USER_REQUEST'){ // $count_new_accounts ++; // $show_user_config = true; // } // } // if ($show_user_config){ // $params = array(); // $params['selstatus']='1'; // if ($count_new_accounts < 16){ // if(($this->_environment->getCurrentBrowser() == 'MSIE') && (mb_substr($this->_environment->getCurrentBrowserVersion(),0,1) == '6')){ // $image = '<img src="images/commsyicons_msie6/account_'.$count_new_accounts.'_home.gif" style="vertical-align:bottom;" alt="'.$this->_translator->getMessage('HOME_LOGIN_NEW_ACCOUNT_LINK',$count_new_accounts).'"/>'; // } else { // $image = '<img src="images/account_'.$count_new_accounts.'_home.png" style="vertical-align:bottom;" alt="'.$this->_translator->getMessage('HOME_LOGIN_NEW_ACCOUNT_LINK',$count_new_accounts).'"/>'; // } // }else{ // if(($this->_environment->getCurrentBrowser() == 'MSIE') && (mb_substr($this->_environment->getCurrentBrowserVersion(),0,1) == '6')){ // $image = '<img src="images/commsyicons_msie6/account_16_home.gif" style="vertical-align:bottom;" alt="'.$this->_translator->getMessage('HOME_LOGIN_NEW_ACCOUNT_LINK',$count_new_accounts).'"/>'; // } else { // $image = '<img src="images/account_16_home.png" style="vertical-align:bottom;" alt="'.$this->_translator->getMessage('HOME_LOGIN_NEW_ACCOUNT_LINK',$count_new_accounts).'"/>'; // } // } // $html .= ahref_curl($this->_environment->getCurrentContextID(), // 'account', // 'index', // $params, // $image, // $this->_translator->getMessage('HOME_LOGIN_NEW_ACCOUNT_LINK',$count_new_accounts)).LF; // }else{ // if(($this->_environment->getCurrentBrowser() == 'MSIE') && (mb_substr($this->_environment->getCurrentBrowserVersion(),0,1) == '6')){ // $image = '<img src="images/commsyicons_msie6/config_account_home.gif" style="vertical-align:bottom;" alt="'.$this->_translator->getMessage('HOME_LOGIN_NEW_ACCOUNT_LINK').'"/>'; // } else { // $image = '<img src="images/config_account_home.png" style="vertical-align:bottom;" alt="'.$this->_translator->getMessage('HOME_LOGIN_NEW_ACCOUNT_LINK').'"/>'; // } // $html .= ahref_curl($this->_environment->getCurrentContextID(), // 'account', // 'index', // '', // $image, // $this->_translator->getMessage('ACCOUNT_INDEX')).LF; // } } // Wiki, Chat $current_context = $this->_environment->getCurrentContextItem(); if ($current_context->showWikiLink() and $current_context->existWiki() and $current_context->issetWikiHomeLink() or $current_context->showChatLink() or $current_context->showHomepageLink()) { $current_context = $this->_environment->getCurrentContextItem(); if ($current_context->showWikiLink() and $current_context->existWiki() and $current_context->issetWikiHomeLink()) { global $c_pmwiki_path_url; if ($this->_environment->getCurrentBrowser() == 'MSIE' && mb_substr($this->_environment->getCurrentBrowserVersion(), 0, 1) == '6') { $image = '<img src="images/commsyicons_msie6/pmwiki_home.gif" style="vertical-align:bottom;" alt="' . $this->_translator->getMessage('COMMON_WIKI_LINK') . '"/>'; } else { $image = '<img src="images/pmwiki_home.png" style="vertical-align:bottom;" alt="' . $this->_translator->getMessage('COMMON_WIKI_LINK') . '"/>'; } $title = $this->_translator->getMessage('COMMON_WIKI_LINK') . ': ' . $current_context->getWikiTitle(); $url_session_id = ''; if ($current_context->withWikiUseCommSyLogin()) { $session_item = $this->_environment->getSessionItem(); $url_session_id = '?commsy_session_id=' . $session_item->getSessionID(); unset($session_item); } $html .= ' ' . '<a title="' . $title . '" href="' . $c_pmwiki_path_url . '/wikis/' . $current_context->getContextID() . '/' . $current_context->getItemID() . '/' . $url_session_id . '" target="_blank">' . $image . '</a>' . LF; } if ($current_context->showChatLink()) { global $c_etchat_enable; if (!empty($c_etchat_enable) and $c_etchat_enable) { $current_user = $this->_environment->getCurrentUserItem(); if (isset($current_user) and $current_user->isReallyGuest()) { if ($this->_environment->getCurrentBrowser() == 'MSIE' && mb_substr($this->_environment->getCurrentBrowserVersion(), 0, 1) == '6') { $image = '<img src="images/commsyicons_msie6/etchat_grey_home.gif" style="vertical-align:bottom;" alt="' . $this->_translator->getMessage('CHAT_CHAT') . '" title="' . $this->_translator->getMessage('CHAT_CHAT') . '"/>'; } else { $image = '<img src="images/etchat_grey_home.png" style="vertical-align:bottom;" alt="' . $this->_translator->getMessage('CHAT_CHAT') . '" title="' . $this->_translator->getMessage('CHAT_CHAT') . '"/>'; } $html .= ' ' . $image; // TBD: icon ausgrauen } else { if ($this->_environment->getCurrentBrowser() == 'MSIE' && mb_substr($this->_environment->getCurrentBrowserVersion(), 0, 1) == '6') { $image = '<img src="images/commsyicons_msie6/etchat_home.gif" style="vertical-align:bottom;" alt="' . $this->_translator->getMessage('CHAT_CHAT') . '" title="' . $this->_translator->getMessage('CHAT_CHAT') . '"/>'; } else { $image = '<img src="images/etchat_home.png" style="vertical-align:bottom;" alt="' . $this->_translator->getMessage('CHAT_CHAT') . '" title="' . $this->_translator->getMessage('CHAT_CHAT') . '"/>'; } $html .= ' ' . ahref_curl($this->_environment->getCurrentContextID(), 'context', 'forward', array('tool' => 'etchat'), $image, '', 'chat', '', '', 'onclick="window.open(href, target, \'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=yes, width=970, height=600\');"') . LF; } } } } // Wordpress $current_context = $this->_environment->getCurrentContextItem(); if ($current_context->showWordpressLink() and $current_context->existWordpress() and $current_context->issetWordpressHomeLink() or $current_context->showChatLink() or $current_context->showHomepageLink()) { $current_context = $this->_environment->getCurrentContextItem(); if ($current_context->showWordpressLink() and $current_context->existWordpress() and $current_context->issetWordpressHomeLink()) { #global $c_wordpress_path_url; $wordpress_path_url = $context_item->getWordpressUrl(); if ($this->_environment->getCurrentBrowser() == 'MSIE' && mb_substr($this->_environment->getCurrentBrowserVersion(), 0, 1) == '6') { $image = '<img src="images/commsyicons_msie6/wordpress_home.gif" style="vertical-align:bottom;" alt="' . $this->_translator->getMessage('COMMON_WORDPRESS_LINK') . '"/>'; } else { $image = '<img src="images/wordpress_home.png" style="vertical-align:bottom;" alt="' . $this->_translator->getMessage('COMMON_WORDPRESS_LINK') . '"/>'; } $title = $this->_translator->getMessage('COMMON_WORDPRESS_LINK') . ': ' . $current_context->getWordpressTitle(); $url_session_id = ''; if ($current_context->withWordpressUseCommSyLogin()) { $session_item = $this->_environment->getSessionItem(); $url_session_id = '?commsy_session_id=' . $session_item->getSessionID(); unset($session_item); } $html .= ' ' . '<a title="' . $title . '" href="' . $wordpress_path_url . '/' . $current_context->getContextID() . '_' . $current_context->getItemID() . '/' . $url_session_id . '" target="_blank">' . $image . '</a>' . LF; } } // plugins for moderators an users $html .= plugin_hook_output_all('getExtraActionAsHTML', array(), LF) . LF; // rss link $current_context_item = $this->_environment->getCurrentContextItem(); $current_user_item = $this->_environment->getCurrentUserItem(); $show_rss_link = false; if ($current_context_item->isLocked() or $current_context_item->isClosed()) { // do nothing } elseif ($current_context_item->isOpenForGuests()) { $show_rss_link = true; } elseif ($current_user_item->isUser()) { $show_rss_link = true; } $hash_string = ''; if (!$current_context_item->isOpenForGuests() and $current_user_item->isUser()) { $hash_manager = $this->_environment->getHashManager(); $hash_string = '&hid=' . $hash_manager->getRSSHashForUser($current_user_item->getItemID()); } if (!$current_context_item->isRSSOn()) { $show_rss_link = false; } if ($show_rss_link) { if ($this->_environment->getCurrentBrowser() == 'MSIE' && mb_substr($this->_environment->getCurrentBrowserVersion(), 0, 1) == '6') { $html .= '<a href="rss.php?cid=' . $current_context_item->getItemID() . $hash_string . '" target="_blank"><img src="images/rss.gif" style="vertical-align:bottom;" alt="' . $this->_translator->getMessage('RSS_SUBSCRIBE_LINK') . '" title="' . $this->_translator->getMessage('RSS_SUBSCRIBE_LINK') . '"/></a>'; } else { $html .= '<a href="rss.php?cid=' . $current_context_item->getItemID() . $hash_string . '" target="_blank"><img src="images/rss.png" style="vertical-align:bottom;" alt="' . $this->_translator->getMessage('RSS_SUBSCRIBE_LINK') . '" title="' . $this->_translator->getMessage('RSS_SUBSCRIBE_LINK') . '"/></a>'; } } // my profile(if user rubric is not active) $available_rubrics = $current_context_item->getAvailableRubrics(); if (!in_array('user', $available_rubrics)) { // user rubric is not active, so add link in tablist if (!$current_context_item->isOpenForGuests() && $current_user_item->isUser() && $this->_with_modifying_actions) { $params = array(); $params['iid'] = $current_user_item->getItemID(); $image = '<img src="images/user.png" style="vertical-align:bottom; padding-left: 2px;" alt="' . $this->_translator->getMessage('USER_OWN_INFORMATION') . '"/>'; $html .= ahref_curl($current_context_item->getItemID(), CS_USER_TYPE, 'detail', $params, $image, $this->_translator->getMessage('USER_OWN_INFORMATION')) . LF; unset($params); //$html .= '<a href="commsy.php?cid=' . $current_context_item->getItemID() . '&mod=user&fct=detail&iid=' . $current_user_item->getItemID() . '">keks</a>'; } } $html .= '</div>' . LF; $html .= '<div id="tablist">' . LF; $session = $this->_environment->getSession(); $history = $session->getValue('history'); if (isset($history) and isset($history[1]) and !empty($history[1])) { $h_module = $history[1]['module']; } else { $h_module = ''; } $first = true; $with_icons = false; foreach ($this->_links as $link) { $link_title = ''; if ($current_context_item->isPrivateRoom()) { switch ($link['module']) { case 'topic': if ($with_icons) { if ($this->_environment->getCurrentBrowser() == 'MSIE' && mb_substr($this->_environment->getCurrentBrowserVersion(), 0, 1) == '6') { $link_title .= '<img src="images/commsyicons_msie6/16x16/topic.gif" style="vertical-align:bottom;"/>'; } else { $link_title .= '<img src="images/commsyicons/16x16/topic.png" style="vertical-align:bottom;"/>'; } } $link_title .= $link['title']; break; case 'material': if ($with_icons) { if ($this->_environment->getCurrentBrowser() == 'MSIE' && mb_substr($this->_environment->getCurrentBrowserVersion(), 0, 1) == '6') { $link_title .= '<img src="images/commsyicons_msie6/16x16/material.gif" style="vertical-align:bottom;"/>'; } else { $link_title .= '<img src="images/commsyicons/16x16/material.png" style="vertical-align:bottom;"/>'; } } $link_title .= $link['title']; break; case 'date': if ($with_icons) { if ($this->_environment->getCurrentBrowser() == 'MSIE' && mb_substr($this->_environment->getCurrentBrowserVersion(), 0, 1) == '6') { $link_title .= '<img src="images/commsyicons_msie6/16x16/date.gif" style="vertical-align:bottom;"/>'; } else { $link_title .= '<img src="images/commsyicons/16x16/date.png" style="vertical-align:bottom;"/>'; } } $link_title .= $link['title']; break; case 'myroom': if ($with_icons) { if ($this->_environment->getCurrentBrowser() == 'MSIE' && mb_substr($this->_environment->getCurrentBrowserVersion(), 0, 1) == '6') { $link_title .= '<img src="images/commsyicons_msie6/16x16/room.gif" style="vertical-align:bottom;"/>'; } else { $link_title .= '<img src="images/commsyicons/16x16/room.png" style="vertical-align:bottom;"/>'; } } $link_title .= $this->_translator->getMessage('PRIVATEROOMS'); break; case 'todo': if ($with_icons) { if ($this->_environment->getCurrentBrowser() == 'MSIE' && mb_substr($this->_environment->getCurrentBrowserVersion(), 0, 1) == '6') { $link_title .= '<img src="images/commsyicons_msie6/16x16/todo.gif" style="vertical-align:bottom;"/>'; } else { $link_title .= '<img src="images/commsyicons/16x16/todo.png" style="vertical-align:bottom;"/>'; } } $link_title .= $link['title']; break; default: $link_title = ''; $text = ''; if ($this->_environment->isPlugin($link['module'])) { if ($with_icons) { $icon_plugin = plugin_hook_output($link['module'], 'getRubricNavIcon'); if (!empty($icon_plugin)) { $text .= '<img src="' . $icon_plugin . '" style="vertical-align:bottom;"/>'; } } $text .= plugin_hook_output($link['module'], 'getDisplayName'); } if (!empty($text)) { $link_title .= $text; } else { $link_title .= $link['title']; } break; } } else { if ($with_icons) { if ($this->_environment->getCurrentBrowser() == 'MSIE' && mb_substr($this->_environment->getCurrentBrowserVersion(), 0, 1) == '6') { switch ($link['module']) { case 'user': $link_title = '<img src="images/commsyicons_msie6/16x16/user.gif" style="vertical-align:bottom;"/>'; break; case 'discussion': $link_title = '<img src="images/commsyicons_msie6/16x16/discussion.gif" style="vertical-align:bottom;"/>'; break; case 'material': $link_title = '<img src="images/commsyicons_msie6/16x16/material.gif" style="vertical-align:bottom;"/>'; break; case 'date': $link_title = '<img src="images/commsyicons_msie6/16x16/date.gif" style="vertical-align:bottom;"/>'; break; case 'announcement': $link_title = '<img src="images/commsyicons_msie6/16x16/announcement.gif" style="vertical-align:bottom;"/>'; break; case 'group': $link_title = '<img src="images/commsyicons_msie6/16x16/group.gif" style="vertical-align:bottom;"/>'; break; case 'institution': $link_title = '<img src="images/commsyicons_msie6/16x16/group.gif" style="vertical-align:bottom;"/>'; break; case 'todo': $link_title = '<img src="images/commsyicons_msie6/16x16/todo.gif" style="vertical-align:bottom;"/>'; break; case 'topic': $link_title = '<img src="images/commsyicons_msie6/16x16/topic.gif" style="vertical-align:bottom;"/>'; break; case 'project': $link_title = '<img src="images/commsyicons_msie6/16x16/room.gif" style="vertical-align:bottom;"/>'; break; default: $link_title = ''; } } else { switch ($link['module']) { case 'user': $link_title = '<img src="images/commsyicons/16x16/user.png" style="vertical-align:bottom;"/>'; break; case 'discussion': $link_title = '<img src="images/commsyicons/16x16/discussion.png" style="vertical-align:bottom;"/>'; break; case 'material': $link_title = '<img src="images/commsyicons/16x16/material.png" style="vertical-align:bottom;"/>'; break; case 'date': $link_title = '<img src="images/commsyicons/16x16/date.png" style="vertical-align:bottom;"/>'; break; case 'announcement': $link_title = '<img src="images/commsyicons/16x16/announcement.png" style="vertical-align:bottom;"/>'; break; case 'group': $link_title = '<img src="images/commsyicons/16x16/group.png" style="vertical-align:bottom;"/>'; break; case 'institution': $link_title = '<img src="images/commsyicons/16x16/group.png" style="vertical-align:bottom;"/>'; break; case 'todo': $link_title = '<img src="images/commsyicons/16x16/todo.png" style="vertical-align:bottom;"/>'; break; case 'topic': $link_title = '<img src="images/commsyicons/16x16/topic.png" style="vertical-align:bottom;"/>'; break; case 'project': $link_title = '<img src="images/commsyicons/16x16/room.png" style="vertical-align:bottom;"/>'; break; default: $link_title = ''; } } } $link_title .= $link['title']; } if ($new_private_room) { if ($this->_environment->inPrivateRoom() and ($link['module'] == 'date' or $link['module'] == 'todo')) { $link_title = '<img src="images/commsyicons/16x16/date.png" style="vertical-align:bottom;"/>'; $link_title = $this->_translator->getMessage('MYCALENDAR_INDEX'); } } if ($first) { $first = false; } if ($this->_module == 'buzzwords') { // Get linked rubric if (isset($_GET['module']) and !empty($_GET['module'])) { $linked_rubric = $_GET['module']; $session->setValue($this->_environment->getCurrentModule() . '_linked_rubric', $linked_rubric); } elseif ($session->issetValue($this->_environment->getCurrentModule() . '_linked_rubric')) { $linked_rubric = $session->getValue($this->_environment->getCurrentModule() . '_linked_rubric'); } else { $linked_rubric = ''; } } if ($this->_module == 'tag') { // Get linked rubric if (isset($_GET['module']) and !empty($_GET['module'])) { $linked_rubric = $_GET['module']; $session->setValue($this->_environment->getCurrentModule() . '_linked_rubric', $linked_rubric); } elseif ($session->issetValue($this->_environment->getCurrentModule() . '_linked_rubric')) { $linked_rubric = $session->getValue($this->_environment->getCurrentModule() . '_linked_rubric'); } else { $linked_rubric = ''; } } $current_context_id = $this->_environment->getCurrentContextID(); $current_portal_id = $this->_environment->getCurrentPortalID(); if ($current_context_item->isOpenForGuests() or $this->_current_user->isUser()) { if ($this->_module == $link['module'] or $this->_module == 'discarticle' and $link['module'] == 'discussion' or $this->_module == 'material' and $link['module'] == 'search' or $this->_module == 'section' and $link['module'] == 'material' or $this->_module == 'version' and $link['module'] == 'material' or $this->_module == 'buzzwords' and $link['module'] == $linked_rubric or $this->_module == 'tag' and $link['module'] == $linked_rubric or $this->_module == 'labels' and $link['module'] == 'material' or $this->_module == 'version_material' and $link['module'] == 'material' or $this->_module == 'version_archive' and $link['module'] == 'search' or $this->_module == 'clipboard' and $link['module'] == 'material' or $this->_module == 'auth' and $link['module'] == 'contact' or $this->_module == 'user' and $link['module'] == 'contact' or $this->_module == 'rubric' and $this->_function == 'mail' and $link['module'] == $h_module or $this->_module == 'todo' and $link['module'] == 'date' and $this->_environment->inPrivateRoom() and $new_private_room or $this->_module == 'discussion' and $link['module'] == 'entry' and $this->_environment->inPrivateRoom() and $new_private_room or $this->_module == 'material' and $link['module'] == 'entry' and $this->_environment->inPrivateRoom() and $new_private_room or $this->_module == 'announcement' and $link['module'] == 'entry' and $this->_environment->inPrivateRoom() and $new_private_room or $this->_module == 'topic' and $link['module'] == 'entry' and $this->_environment->inPrivateRoom() and $new_private_room) { $ahref = ahref_curl($this->_environment->getCurrentContextID(), $link['module'], $link['function'], $link['parameter'], $link_title, $link['explanation'], '', '', '', '', '', 'class="navlist_current"'); } elseif ($this->_module == 'annotation') { if (isset($history) and isset($history[1]) and !empty($history[1])) { $h_module = $history[1]['module']; } else { $h_module = ''; } if ($session->issetValue('annotation_history_module')) { $h_module = $session->getValue('annotation_history_module'); } if ($link['module'] == $h_module) { $ahref = ahref_curl($this->_environment->getCurrentContextID(), $link['module'], $link['function'], $link['parameter'], $link_title, $link['explanation'], '', '', '', '', '', 'class="navlist_current"'); } else { $ahref = ahref_curl($this->_environment->getCurrentContextID(), $link['module'], $link['function'], $link['parameter'], $link_title, $link['explanation'], '', '', '', '', '', 'class="navlist"'); } } elseif ($this->_module == 'context' and $this->_function == 'info_text_edit') { if (isset($history) and isset($history[0]) and !empty($history[0])) { $h_module = $history[0]['module']; } else { $h_module = ''; } if ($link['module'] == $h_module) { $ahref = ahref_curl($this->_environment->getCurrentContextID(), $link['module'], $link['function'], $link['parameter'], $link_title, $link['explanation'], '', '', '', '', '', 'class="navlist_current"'); } else { $ahref = ahref_curl($this->_environment->getCurrentContextID(), $link['module'], $link['function'], $link['parameter'], $link_title, $link['explanation'], '', '', '', '', '', 'class="navlist"'); } } else { $ahref = ahref_curl($this->_environment->getCurrentContextID(), $link['module'], $link['function'], $link['parameter'], $link_title, $link['explanation'], '', '', '', '', '', 'class="navlist"'); } if ($link['module'] != 'todo' or $current_context_item->withRubric(CS_TODO_TYPE)) { $html .= $ahref; } } else { $html .= ' <span >' . $link_title . '</span>' . LF; } } // CommSy 7 -> '+'-Link in Rubrileiste fuer Moderatoren // if($current_user_item->isModerator()){ // $html .= ahref_curl($this->_environment->getCurrentContextID(), 'configuration', 'rubric_options', '', '+', '','','','','','','class="navlist"'); // } $html .= '</div>' . LF; $html .= '</div>' . LF; $html .= '</div>' . LF; $html .= '<!-- END TABS -->' . LF; unset($current_user_item); unset($current_context_item); return $html; }
protected function performListOption($rubric) { $this->getPostData(); #pr($_POST); #pr($this->_list_attached_ids); #pr($_POST); $environment = $this->_environment; $session = $environment->getSessionItem(); $translator = $environment->getTranslationObject(); // Find current option /*if ( isset($_POST['option']) ) { $option = $_POST['option']; } elseif ( isset($_GET['option']) ) { $option = $_GET['option']; } else { $option = ''; } // Find out what to do if ( isset($_POST['delete_option']) ) { $delete_command = $_POST['delete_option']; }elseif ( isset($_GET['delete_option']) ) { $delete_command = $_GET['delete_option']; } else { $delete_command = ''; }*/ // $option and $delete_command are replaced by $this->$_list_command // LIST ACTIONS // initiate selected array of IDs $selected_ids = array(); $mode = $this->getViewMode(); if ($mode == '') { $session->unsetValue('cid' . $environment->getCurrentContextID() . '_' . $environment->getCurrentModule() . '_selected_ids'); } elseif ($mode == 'list_actions') { if ($session->issetValue('cid' . $environment->getCurrentContextID() . '_' . $environment->getCurrentModule() . '_selected_ids')) { $selected_ids = $session->getValue('cid' . $environment->getCurrentContextID() . '_' . $environment->getCurrentModule() . '_selected_ids'); } } // Update attached items from cookie (requires JavaScript in browser) if (isset($_COOKIE['attach'])) { foreach ($_COOKIE['attach'] as $key => $val) { setcookie('attach[' . $key . ']', '', time() - 3600); if ($val == '1') { if (!in_array($key, $selected_ids)) { $selected_ids[] = $key; } } else { $idx = array_search($key, $selected_ids); if ($idx !== false) { unset($selected_ids[$idx]); } } } } // Update attached items from form post (works always) /*if ( isset($_POST['attach']) ) { foreach ( $_POST['shown'] as $shown_key => $shown_val ) { if ( array_key_exists($shown_key, $_POST['attach']) ) { if ( !in_array($shown_key, $selected_ids) ) { $selected_ids[] = $shown_key; } } else { $idx = array_search($shown_key, $selected_ids); if ( $idx !== false ) { unset($selected_ids[$idx]); } } } }*/ // new version if (!empty($this->_list_attached_ids)) { foreach ($this->_list_shown_ids as $shown_key => $shown_val) { if (array_key_exists($shown_key, $this->_list_attached_ids)) { if (!in_array($shown_key, $selected_ids)) { $selected_ids[] = $shown_key; } } else { $idx = array_search($shown_key, $selected_ids); if ($idx !== false) { unset($selected_ids[$idx]); } } } } unset($this->_list_attached_ids); // Cancel editing /*if ( isOption($delete_command, $translator->getMessage('COMMON_CANCEL_BUTTON')) ) { $params = $environment->getCurrentParameterArray(); redirect($environment->getCurrentContextID(), $rubric, 'index', $params); } // Delete item elseif ( isOption($delete_command, $translator->getMessage('COMMON_DELETE_BUTTON')) ) { if ($session->issetValue('cid'.$environment->getCurrentContextID(). '_'.$environment->getCurrentModule(). '_deleted_ids')) { $selected_ids = $session->getValue('cid'.$environment->getCurrentContextID(). '_'.$environment->getCurrentModule(). '_deleted_ids'); } $manager = $environment->getManager($rubric); foreach ($selected_ids as $id) { $item = $manager->getItem($id); $item->delete(); } $session->unsetValue('cid'.$environment->getCurrentContextID(). '_'.$environment->getCurrentModule(). '_deleted_ids'); $params = $environment->getCurrentParameterArray(); unset($params['mode']); unset($params['select']); $selected_ids = array(); redirect($environment->getCurrentContextID(), $rubric, 'index', $params); }*/ if ($this->_list_command_confirm == CS_LISTOPTION_CONFIRM_CANCEL) { $params = $environment->getCurrentParameterArray(); redirect($environment->getCurrentContextID(), $rubric, 'index', $params); } elseif ($this->_list_command_confirm == CS_LISTOPTION_CONFIRM_DELETE) { if ($session->issetValue('cid' . $environment->getCurrentContextID() . '_' . $environment->getCurrentModule() . '_deleted_ids')) { $selected_ids = $session->getValue('cid' . $environment->getCurrentContextID() . '_' . $environment->getCurrentModule() . '_deleted_ids'); } $manager = $environment->getManager($rubric); foreach ($selected_ids as $id) { $item = $manager->getItem($id); $item->delete(); } $session->unsetValue('cid' . $environment->getCurrentContextID() . '_' . $environment->getCurrentModule() . '_deleted_ids'); $params = $environment->getCurrentParameterArray(); unset($params['mode']); unset($params['select']); $selected_ids = array(); redirect($environment->getCurrentContextID(), $rubric, 'index', $params); } /*if ( isOption($option,$translator->getMessage('COMMON_LIST_ACTION_BUTTON_GO')) and !isset($_GET['show_copies']) and $_POST['index_view_action'] != '-1' and !empty($selected_ids) ) { // prepare action process switch ($_POST['index_view_action']) { case 1: $action = 'ENTRY_MARK_AS_READ'; $error = false; $rubric_manager = $environment->getManager($rubric); $noticed_manager = $environment->getNoticedManager(); foreach ($selected_ids as $id) { $item = $rubric_manager->getItem($id); $version_id = $item->getVersionID(); $noticed_manager->markNoticed($id, $version_id ); $annotation_list =$item->getAnnotationList(); if ( !empty($annotation_list) ){ $annotation_item = $annotation_list->getFirst(); while($annotation_item){ $noticed_manager->markNoticed($annotation_item->getItemID(),'0'); $annotation_item = $annotation_list->getNext(); } } } break; case 2: $action = 'ENTRY_COPY'; // Copy to clipboard foreach ($selected_ids as $id) { if ( !in_array($id, $this->_list_parameter_arrray['clipboard_id_array']) ) { $this->_list_parameter_arrray['clipboard_id_array'][] = $id; } } $session->setValue($rubric.'_clipboard', $this->_list_parameter_arrray['clipboard_id_array']); break; case 3: $user = $environment->getCurrentUserItem(); if( $user->isModerator() ){ $session->setValue('cid'.$environment->getCurrentContextID(). '_'.$environment->getCurrentModule(). '_deleted_ids', $selected_ids); $params = $environment->getCurrentParameterArray(); $params['mode'] = 'list_actions'; //Reimplementierung notwendig # $page->addDeleteBox(curl($environment->getCurrentContextID(),$rubric,'index',$params),'index',$selected_ids); // unset($params); } break; case 'download': include_once('include/inc_rubric_download.php'); break; default: if ( !empty($_POST['index_view_action']) and ( $environment->isPlugin($_POST['index_view_action']) or $environment->isPlugin(substr($_POST['index_view_action'],0,strpos($_POST['index_view_action'],'_'))) )) { $plugin = ''; if ( $environment->isPlugin($_POST['index_view_action']) ) { $plugin = $_POST['index_view_action']; } else { $plugin = substr($_POST['index_view_action'],0,strpos($_POST['index_view_action'],'_')); } plugin_hook_plugin($plugin,'performListAction',$_POST); } else { $params = $environment->getCurrentParameterArray(); unset($params['mode']); redirect($environment->getCurrentContextID(), $rubric, 'index', $params); } } if ($_POST['index_view_action'] != '3'){ $selected_ids = array(); $session->unsetValue('cid'.$environment->getCurrentContextID(). '_'.$environment->getCurrentModule(). '_selected_ids'); } }*/ // prepare action process if (!empty($this->_list_command)) { switch ($this->_list_command) { case CS_LISTOPTION_MARK_AS_READ: $error = false; $rubric_manager = $environment->getManager($rubric); $noticed_manager = $environment->getNoticedManager(); foreach ($selected_ids as $id) { $item = $rubric_manager->getItem($id); $version_id = $item->getVersionID(); $noticed_manager->markNoticed($id, $version_id); $annotation_list = $item->getAnnotationList(); if (!empty($annotation_list)) { $annotation_item = $annotation_list->getFirst(); while ($annotation_item) { $noticed_manager->markNoticed($annotation_item->getItemID(), '0'); $annotation_item = $annotation_list->getNext(); } } } break; case CS_LISTOPTION_COPY: // get current clipboard content $clipboardIdArray = array(); if ($session->issetValue($rubric . "_clipboard")) { $clipboardIdArray = $session->getValue($rubric . "_clipboard"); } // if not already set, add id to clipboard foreach ($selected_ids as $id) { if (!in_array($id, $clipboardIdArray)) { $clipboardIdArray[] = $id; } } $session->setValue($rubric . "_clipboard", $clipboardIdArray); $params = $environment->getCurrentParameterArray(); redirect($environment->getCurrentContextID(), $environment->getCurrentModule(), $environment->getCurrentFunction(), $params); break; case CS_LISTOPTION_DELETE: $user = $environment->getCurrentUserItem(); if ($user->isModerator()) { $session->setValue('cid' . $environment->getCurrentContextID() . '_' . $environment->getCurrentModule() . '_deleted_ids', $selected_ids); $params = $environment->getCurrentParameterArray(); $params['mode'] = 'list_actions'; //Reimplementierung notwendig # $page->addDeleteBox(curl($environment->getCurrentContextID(),$rubric,'index',$params),'index',$selected_ids); // unset($params); $this->assign('confirm', 'list_action', $this->_list_command); } break; case CS_LISTOPTION_TODO_DONE: $error = false; $todo_manager = $environment->getTodosManager(); $noticed_manager = $environment->getNoticedManager(); foreach ($selected_ids as $id) { $todo_item = $todo_manager->getItem($id); $todo_item->setStatus('3'); $todo_item->save(); $version_id = $todo_item->getVersionID(); $noticed_manager->markNoticed($id, $version_id); } break; case CS_LISTOPTION_TODO_IN_PROGRESS: $error = false; $todo_manager = $environment->getTodosManager(); $noticed_manager = $environment->getNoticedManager(); foreach ($selected_ids as $id) { $todo_item = $todo_manager->getItem($id); $todo_item->setStatus('2'); $todo_item->save(); $version_id = $todo_item->getVersionID(); $noticed_manager->markNoticed($id, $version_id); } break; case CS_LISTOPTION_TODO_NOT_STARTED: $error = false; $todo_manager = $environment->getTodosManager(); $noticed_manager = $environment->getNoticedManager(); foreach ($selected_ids as $id) { $todo_item = $todo_manager->getItem($id); $todo_item->setStatus('1'); $todo_item->save(); $version_id = $todo_item->getVersionID(); $noticed_manager->markNoticed($id, $version_id); } break; case CS_LISTOPTION_DOWNLOAD: //include_once("classes/controller/action/cs_download_action_controller.php"); //$class_factory = $environment->getClassFactory(); // include_once('include/inc_rubric_download.php'); break; case CS_LISTOPTION_EMAIL_SEND: $current_user = $environment->getCurrentUser(); $user_item_id = $current_user->getItemID(); $action_array = array(); $action_array['user_item_id'] = $user_item_id; $action_array['action'] = 'USER_EMAIL_SEND'; $action_array['backlink']['cid'] = $environment->getCurrentContextID(); $action_array['backlink']['mod'] = $environment->getCurrentModule(); $action_array['backlink']['fct'] = $environment->getCurrentFunction(); $action_array['backlink']['par'] = ''; $action_array['selected_ids'] = $selected_ids; $params = array(); $params['step'] = 1; $session->setValue('index_action', $action_array); redirect($environment->getCurrentContextID(), $environment->getCurrentModule(), 'action', $params); break; default: if (!empty($this->_list_command) and ($environment->isPlugin($this->_list_command) or $environment->isPlugin(substr($this->_list_command, 0, strpos($this->_list_command, '_'))))) { $plugin = ''; if ($environment->isPlugin($this->_list_command)) { $plugin = $this->_list_command; } else { $plugin = substr($this->_list_command, 0, strpos($this->_list_command, '_')); } $_POST['form_data']['index_view_action'] = $this->_list_command; $retour = plugin_hook_output($plugin, 'performListAction', $_POST['form_data']); if (!empty($retour)) { $this->assign('list', 'plugin_retour', $retour); } } else { $params = $environment->getCurrentParameterArray(); unset($params['mode']); redirect($environment->getCurrentContextID(), $rubric, 'index', $params); } } if ($this->_list_command != CS_LISTOPTION_DELETE) { $selected_ids = array(); $session->unsetValue('cid' . $environment->getCurrentContextID() . '_' . $environment->getCurrentModule() . '_selected_ids'); unset($this->_list_attached_ids); #$session->save(); } } }
public function initPopup($data) { $current_context = $this->_environment->getCurrentContextItem(); $current_portal = $this->_environment->getCurrentPortalItem(); $current_user = $this->_environment->getCurrentUser(); $translator = $this->_environment->getTranslationObject(); //rubric_choice $room = $this->_environment->getCurrentContextItem(); $default_rubrics = $room->getAvailableDefaultRubricArray(); $rubric_array = array(); $i = 1; $select_array[0]['text'] = '----------'; $select_array[0]['value'] = 'none'; foreach ($default_rubrics as $rubric) { if ($this->_environment->inPrivateRoom() and $rubric == 'user') { $select_array[$i]['text'] = $this->_translator->getMessage('COMMON_MY_USER_DESCRIPTION'); } else { switch (mb_strtoupper($rubric, 'UTF-8')) { case 'ANNOUNCEMENT': $select_array[$i]['text'] = $translator->getMessage('ANNOUNCEMENT_INDEX'); break; case 'DATE': $select_array[$i]['text'] = $translator->getMessage('DATE_INDEX'); break; case 'DISCUSSION': $select_array[$i]['text'] = $translator->getMessage('DISCUSSION_INDEX'); break; case 'GROUP': $select_array[$i]['text'] = $translator->getMessage('GROUP_INDEX'); break; case 'INSTITUTION': $select_array[$i]['text'] = $translator->getMessage('INSTITUTION_INDEX'); break; case 'MATERIAL': $select_array[$i]['text'] = $translator->getMessage('MATERIAL_INDEX'); break; case 'PROJECT': $select_array[$i]['text'] = $translator->getMessage('PROJECT_INDEX'); break; case 'TODO': $select_array[$i]['text'] = $translator->getMessage('TODO_INDEX'); break; case 'TOPIC': $select_array[$i]['text'] = $translator->getMessage('TOPIC_INDEX'); break; case 'USER': $select_array[$i]['text'] = $translator->getMessage('USER_INDEX'); break; default: $text = ''; if ($this->_environment->isPlugin($rubric)) { $text = plugin_hook_output($rubric, 'getDisplayName'); } if (!empty($text)) { $select_array[$i]['text'] = $text; } else { $select_array[$i]['text'] = $translator->getMessage('COMMON_MESSAGETAG_ERROR' . ' cs_configuration_rubric_form(' . __LINE__ . ') '); } break; } } $select_array[$i]['value'] = $rubric; $i++; } // sorting $sort_by = 'text'; usort($select_array, create_function('$a,$b', 'return strnatcasecmp($a[\'' . $sort_by . '\'],$b[\'' . $sort_by . '\']);')); $this->_rubric_array = $select_array; // time pulses if ($current_context->isProjectRoom() and $this->_environment->inProjectRoom() or $current_context->isProjectRoom() and $this->_environment->inCommunityRoom() and $current_context->showTime() or $this->_environment->getCurrentModule() == CS_PROJECT_TYPE and ($this->_environment->inCommunityRoom() or $this->_environment->inPortal()) and $current_context->showTime() or $this->_environment->inGroupRoom() and $current_portal->showTime()) { if ($this->_environment->inPortal()) { $portal_item = $current_context; } else { $portal_item = $current_context->getContextItem(); } if ($portal_item->showTime()) { $current_time_title = $portal_item->getTitleOfCurrentTime(); if (isset($current_context)) { $time_list = $current_context->getTimeList(); if ($time_list->isNotEmpty()) { $time_item = $time_list->getFirst(); $linked_time_title = $time_item->getTitle(); } } if (!empty($linked_time_title) && $linked_time_title < $current_time_title) { $start_time_title = $linked_time_title; } else { $start_time_title = $current_time_title; } $time_list = $portal_item->getTimeList(); if ($time_list->isNotEmpty()) { $time_item = $time_list->getFirst(); $context_time_list = $current_context->getTimeList(); while ($time_item) { // check if checked $checked = false; if ($context_time_list->isNotEmpty()) { $context_time_item = $context_time_list->getFirst(); while ($context_time_item) { if ($context_time_item->getItemID() === $time_item->getItemID()) { $checked = true; break; } $context_time_item = $context_time_list->getNext(); } } if ($time_item->getTitle() >= $start_time_title) { $this->_time_array[] = array('text' => $translator->getTimeMessage($time_item->getTitle()), 'value' => $time_item->getItemID(), 'checked' => $checked); } $time_item = $time_list->getNext(); } // continuous $this->_time_array[] = array('text' => $translator->getMessage('COMMON_CONTINUOUS'), 'value' => 'cont', 'checked' => $current_context->isContinuous()); } } } // assignment if ($this->_environment->inProjectRoom()) { $community_room_array = array(); // get community list and build up select options $community_list = $current_portal->getCommunityList(); $community_room_array[] = array('text' => $translator->getMessage('PREFERENCES_NO_COMMUNITY_ROOM'), 'value' => '-1', 'checked' => false); $community_room_array[] = array('text' => '--------------------', 'value' => 'disabled', 'checked' => false, 'disabled' => true); if ($community_list->isNotEmpty()) { $community_item = $community_list->getFirst(); while ($community_item) { if ($community_item->isAssignmentOnlyOpenForRoomMembers()) { if (!$community_item->isUser($current_user)) { $community_room_array[] = array('text' => $community_item->getTitle(), 'value' => 'disabled', 'disabled' => true); } else { $community_room_array[] = array('text' => $community_item->getTitle(), 'value' => $community_item->getItemID(), 'disabled' => false); } } else { $community_room_array[] = array('text' => $community_item->getTitle(), 'value' => $community_item->getItemID(), 'disabled' => false); } $community_item = $community_list->getNext(); } } $this->_community_room_array = $community_room_array; $shown_community_room_array = array(); /* if (!empty($this->_session_community_room_array)) { foreach ( $this->_session_community_room_array as $community_room ) { $temp_array['text'] = $community_room['name']; $temp_array['value'] = $community_room['id']; $community_room_array[] = $temp_array; } } else{ */ $community_room_list = $current_context->getCommunityList(); if ($community_room_list->getCount() > 0) { $community_room_item = $community_room_list->getFirst(); while ($community_room_item) { $shown_community_room_array[] = array('text' => $community_room_item->getTitle(), 'value' => $community_room_item->getItemID()); $community_room_item = $community_room_list->getNext(); } } /* } */ $this->_shown_community_room_array = $shown_community_room_array; } global $c_theme; $default_color_value = 'default'; if (isset($c_theme) and !empty($c_theme) and $c_theme != 'default') { $default_color_value = $c_theme; } // color schemes // $this->_color_array[] = array( // 'text' => $translator->getMessage('COMMON_COLOR_DEFAULT'), // 'value' => $default_color_value, // 'disabled' => false // ); // $this->_color_array[] = array( // 'text' => '-----', // 'value' => '-1', // 'disabled' => true // ); /* $temp_color_array = array(); for($i=1; $i <= 26; $i++) { $translation = $translator->getMessage('COMMON_COLOR_SCHEMA_' . $i); $temp_color_array[$translation] = array( 'text' => $translation, 'value' => 'COMMON_COLOR_SCHEMA_' . $i, 'disabled' => false ); }*/ global $theme_array; foreach ($theme_array as $theme) { $temp_color_array[$theme['value']] = $theme; } ksort($temp_color_array); $this->_color_array = array_merge($this->_color_array, $temp_color_array); $this->_color_array[] = array('text' => $translator->getMessage('COMMON_COLOR_DEFAULT'), 'value' => $default_color_value, 'disabled' => false); $this->_color_array[] = array('text' => '-----', 'value' => '-1', 'disabled' => true); $this->_color_array[] = array('text' => $translator->getMessage('COMMON_COLOR_SCHEMA_OWN'), 'value' => 'individual', 'disabled' => false); /* $current_portal_item = $this->_environment->getCurrentPortalItem(); /* // set configuration $account = array(); // set user item if($this->_environment->inCommunityRoom() || $this->_environment->inProjectRoom()) { $this->_user = $this->_environment->getPortalUserItem(); } else { $this->_user = $this->_environment->getCurrentUserItem(); } // disable merge form only for root $this->_config['show_merge_form'] = true; if(isset($this->_user) && $this->_user->isRoot()) { $this->_config['show_merge_form'] = false; } // auth source if(!isset($current_portal_item)) $current_portal_item = $this->_environment->getServerItem(); #$this->_show_auth_source = $current_portal_item->showAuthAtLogin(); # muss angezeigt werden, sonst koennen mit der aktuellen Programmierung # keine Acounts mit gleichen Kennungen aber unterschiedlichen Quellen # zusammengelegt werden $this->_config['show_auth_source'] = true; $auth_source_list = $current_portal_item->getAuthSourceListEnabled(); if(isset($auth_source_list) && !$auth_source_list->isEmpty()) { $auth_source_item = $auth_source_list->getFirst(); while($auth_source_item) { $this->_data['auth_source_array'][] = array( 'value' => $auth_source_item->getItemID(), 'text' => $auth_source_item->getTitle()); $auth_source_item = $auth_source_list->getNext(); } } $this->_data['default_auth_source'] = $current_portal_item->getAuthDefault(); // password change form $this->_config['show_password_change_form'] = false; $current_auth_source_item = $current_portal_item->getAuthSource($this->_user->getAuthSource()); if( (isset($current_auth_source_item) && $current_auth_source_item->allowChangePassword()) || $this->_user->isRoot()) { $this->_config['show_password_change_form'] = true; } // account change form $this->_config['show_account_change_form'] = false; if( (isset($current_auth_source_item) && $current_auth_source_item->allowChangeUserID()) || $this->_user->isRoot()) { $this->_config['show_account_change_form'] = true; } // mail form $this->_config['show_mail_change_form'] = false; if($this->_user->isModerator()) { $this->_config['show_mail_change_form'] = true; } */ // assign template vars $this->assignTemplateVars(); }
case 'TODO': $tempMessage = $translator->getMessage('COMMON_TODO_INDEX'); break; case 'TOPIC': $tempMessage = $translator->getMessage('COMMON_TOPIC_INDEX'); break; case 'USER': $tempMessage = $translator->getMessage('COMMON_USER_INDEX'); break; case 'ENTRY': $tempMessage = $translator->getMessage('COMMON_ENTRY_INDEX'); break; default: $text = ''; if ($environment->isPlugin($link_name[0])) { $text = plugin_hook_output($link_name[0], 'getDisplayName'); } if (!empty($text)) { $tempMessage = $text; } else { $tempMessage = $translator->getMessage('COMMON_MESSAGETAG_ERROR' . ' ' . __FILE__ . ' (' . __LINE__ . ') '); } break; } $page->addAction($tempMessage, '', $link_name[0], 'index'); } } } // authentication (bookmarks) $current_user = $environment->getCurrentUserItem(); if (!$current_user->isUser() and !$context_item_current->isOpenForGuests()) {
private function getDetailActions() { $current_context = $this->_environment->getCurrentContextItem(); $current_user = $this->_environment->getCurrentUserItem(); $return = array('edit' => false, 'delete' => false, 'mail' => false, 'copy' => false, 'new' => false, 'locked' => false); // edit if (isset($this->_item) and $this->_item->mayEdit($current_user) && $this->_with_modifying_actions && !$this->_item->isSystemLabel()) { $return['edit'] = true; } else { $checkLocking = $this->_environment->getConfiguration('c_item_locking'); $checkLocking = $checkLocking ? $checkLocking : false; if ($checkLocking && method_exists($this->_item, "getLockingDate")) { $lockingDate = $this->_item->getLockingDate(); if ($lockingDate) { $editDate = new DateTime($lockingDate); $compareDate = new DateTime(); $compareDate->modify("-20 minutes"); $return['locked'] = $compareDate < $editDate; $userManager = $this->_environment->getUserManager(); $lockingUser = $userManager->getItem($this->_item->getLockingUserId()); $return['locked_user_name'] = $lockingUser->getFullName(); $return['locked_date'] = $this->_environment->getTranslationObject()->getDateTimeinLang($lockingDate); } } } // delete if (isset($this->_item) and $this->_item->mayEdit($current_user) && $this->_with_modifying_actions && (!$this->_item->isA(CS_LABEL_TYPE) || !$this->_item->isSystemLabel())) { $return['delete'] = true; } else { } $this->getAdditionalActions($return); // mail if (!$this->_environment->inPrivateRoom()) { $module = 'rubric'; //$text = $this->_translator->getMessage('COMMON_EMAIL_TO'); if ($current_user->isUser() && $this->_with_modifying_actions) { $return['mail'] = true; } else { } } // copy if ($current_user->isUser() && isset($this->_item) and !in_array($this->_item->getItemID(), $this->_clipboard_id_array)) { $return['copy'] = true; } else { } // TODO: dont forget print, download - which are always allowed // TODO: // actions from rubric plugins if ($current_context->isPluginActive("voyeur")) { $plugin_actions = plugin_hook_output('voyeur', 'getDetailActionAsHTML', NULL, ' | '); if (!empty($plugin_actions)) { if ($current_context->isPrivateRoom()) { $plugin_actions = str_replace("iid=", "iid=" . $this->_item->getItemID(), $plugin_actions); } $return['plugins'] = true; $return['plugins_html'] = $plugin_actions; } } $except[] = 'voyeur'; $plugin_actions = plugin_hook_output_all('getDetailActionAsHTML', NULL, ' | ', '', $except); if (!empty($plugin_actions)) { $return['plugins'] = true; $return['plugins_html'] = $plugin_actions; } // new $current_module = $this->_environment->getCurrentModule(); if ($current_user->isUser() && $this->_with_modifying_actions && $current_module != CS_USER_TYPE) { $return['new'] = true; } else { } if ($current_context->isMaterialOpenForGuests() && $current_user->isGuest()) { $return['edit'] = false; $return['delete'] = false; $return['mail'] = false; $return['copy'] = false; } // grouproom if ($this->_item->getType() == 'label' && $this->_item->getLabelType() == 'group') { if ($this->_item->isGroupRoomActivated()) { $return['grouproom'] = $this->_item->getGroupRoomItemID(); } else { $return['grouproom'] = false; } } // download $return['downloadparams'] = $this->_environment->getCurrentParameterArray(); $return['downloadparams']['download'] = 'zip'; $return['downloadparams']['mode'] = 'print'; //TODO: //$html .= $this->_initDropDownMenus(); return $return; }