// Suchi & Berg GmbH // +---------------------------------------------------------------------------+ // This program 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 any later version. // +---------------------------------------------------------------------------+ // This program 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 should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // +---------------------------------------------------------------------------+ use Studip\Button, Studip\LinkButton; require '../lib/bootstrap.php'; page_open(["sess" => "Seminar_Session", "auth" => "Seminar_Auth", "perm" => "Seminar_Perm", "user" => "Seminar_User"]); $perm->check(Config::get()->SEM_TREE_ADMIN_PERM ?: 'admin'); if (!$perm->is_fak_admin()){ $perm->perm_invalid(0,0); page_close(); die; } include 'lib/seminar_open.php'; // initialise Stud.IP-Session PageLayout::setTitle(_('Veranstaltungshierachie bearbeiten')); Navigation::activateItem('/admin/locations/sem_tree'); // Start of Output ob_start(); $view = DbView::getView('sem_tree'); $the_tree = new StudipSemTreeViewAdmin(Request::option('start_item_id')); $search_obj = new StudipSemSearch(); $_open_items =& $the_tree->open_items; $_open_ranges =& $the_tree->open_ranges; $_possible_open_items = []; if (!Config::GetInstance()->getValue('SEM_TREE_ALLOW_BRANCH_ASSIGN')){ if(is_array($_open_items)){ foreach($_open_items as $item_id => $value){ if(!$the_tree->tree->getNumKids($item_id)) $_possible_open_items[$item_id] = $value; } } } else { $_possible_open_items = $_open_items; } // allow add only for items where user has admin permission and which are not hidden if (is_array($_possible_open_items)) { foreach ($_possible_open_items as $item_id => $value) { if (!$the_tree->isItemAdmin($item_id) || $the_tree->tree->isHiddenItem($item_id)) { unset($_possible_open_items[$item_id]); } } } if ($search_obj->search_done){ if ($search_obj->search_result->numRows > 50){ PageLayout::postError(_("Es wurden mehr als 50 Veranstaltungen gefunden! Bitte schränken Sie Ihre Suche weiter ein.")); } elseif ($search_obj->search_result->numRows > 0){ PageLayout::postSuccess(sprintf( _("Es wurden %s Veranstaltungen gefunden, und in Ihre Merkliste eingefügt"), $search_obj->search_result->numRows )); if (is_array($_SESSION['_marked_sem']) && count($_SESSION['_marked_sem'])){ $_SESSION['_marked_sem'] = array_merge( (array)$_SESSION['_marked_sem'], (array)$search_obj->search_result->getDistinctRows("seminar_id") ); } else { $_SESSION['_marked_sem'] = $search_obj->search_result->getDistinctRows("seminar_id"); } } else { PageLayout::postInfo(_("Es wurden keine Veranstaltungen gefunden, auf die Ihre Suchkriterien zutreffen.")); } } if (Request::option('cmd') === "MarkList"){ $sem_mark_list = Request::quotedArray('sem_mark_list'); if ($sem_mark_list){ if (Request::quoted('mark_list_aktion') == "del"){ $count_del = 0; for ($i = 0; $i < count($sem_mark_list); ++$i){ if (isset($_SESSION['_marked_sem'][$sem_mark_list[$i]])){ ++$count_del; unset($_SESSION['_marked_sem'][$sem_mark_list[$i]]); } } PageLayout::postSuccess(sprintf( _("%s Veranstaltung(en) wurde(n) aus Ihrer Merkliste entfernt."), $count_del )); } else { $tmp = explode("_",Request::quoted('mark_list_aktion')); $item_ids[0] = $tmp[1]; if ($item_ids[0] === "all"){ $item_ids = []; foreach ($_possible_open_items as $key => $value){ if($key !== 'root') $item_ids[] = $key; } } for ($i = 0; $i < count($item_ids); ++$i){ $count_ins = 0; for ($j = 0; $j < count($sem_mark_list); ++$j){ if ($sem_mark_list[$j]){ $count_ins += StudipSemTree::InsertSemEntry($item_ids[$i], $sem_mark_list[$j]); } } $_msg .= sprintf( _("%s Veranstaltung(en) in " .htmlReady($the_tree->tree->tree_data[$item_ids[$i]]['name']) . " eingetragen.
"), $count_ins ); } if ($_msg) { PageLayout::postSuccess($_msg); } $the_tree->tree->init(); } } } if ($the_tree->mode === "MoveItem" || $the_tree->mode === "CopyItem"){ if ($_msg){ $_msg .= "§"; } if ($the_tree->mode === "MoveItem"){ $text = _("Der Verschiebemodus ist aktiviert. Bitte wählen Sie ein Einfügesymbol %s aus, um das Element %s an diese Stelle zu verschieben.%s"); } else { $text = _("Der Kopiermodus ist aktiviert. Bitte wählen Sie ein Einfügesymbol %s aus, um das Element %s an diese Stelle zu kopieren.%s"); } PageLayout::postInfo(sprintf( $text , Icon::create('arr_2right', 'sort', ['title' => _('Einfügesymbol')])->asImg(), htmlReady($the_tree->tree->tree_data[$the_tree->move_item_id]['name']), "
" . LinkButton::createCancel( _('Abbrechen'), $the_tree->getSelf("cmd=Cancel&item_id=$the_tree->move_item_id"), ['title' => _("Verschieben / Kopieren abbrechen")] ) ."
" )); } ?> attributes_default = ['style' => '']; // $search_obj->search_fields['type']['size'] = 30 ; echo $search_obj->getFormStart(URLHelper::getLink($the_tree->getSelf()), ['class' => 'default narrow']); ?>
getFormEnd();?>
showSemTree(); ?>
" method="post" class="default">
_("Gewählte Aktion starten"), 'style' => 'vertical-align:middle;margin:3px;', 'class' => 'accept button' ] ); ?>
setTitle(_('Merkliste')); $widget->addElement(new WidgetElement($content)); Sidebar::get()->addWidget($widget); $template = $GLOBALS['template_factory']->open('layouts/base.php'); $template->content_for_layout = ob_get_clean(); echo $template->render(); page_close();