Example #1
0
 /**
  * removes tour step
  * 
  * @param String $tour_id    tour id
  * @param String $step_nr    number of step
  */
 function delete_step($tour_id, $step_nr)
 {
     if (!$this->help_admin) {
         return $this->render_nothing();
     }
     $output = '';
     if (Request::submitted('yes')) {
         CSRFProtection::verifySecurityToken();
         header('X-Action: complete');
         $this->tour->deleteStep($step_nr);
     } elseif (Request::submitted('no')) {
         header('X-Action: complete');
     } else {
         header('X-Action: question');
         $output = createQuestion2(sprintf(_('Wollen Sie Schritt %s wirklich löschen?'), $step_nr), array('confirm_delete_tour_step' => 1, 'tour_id' => $tour_id, 'step_nr' => $step_nr), array(), '');
     }
     return $output;
 }
Example #2
0
<? use Studip\Button, Studip\LinkButton ?>
<? if(!empty($flash['question_text'])) : ?>
    <? $form_content = array('news_isvisible' => htmlReady(serialize($news_isvisible)),
              'news_selectable_areas' => htmlReady(serialize($area_options_selectable)),
              'news_selected_areas' => htmlReady(serialize($area_options_selected)),
              'news_basic_js' => '',
              'news_comments_js' => '',
              'news_areas_js' => '',
              'news_allow_comments' => $news['allow_comments'],
              'news_topic' => $news['topic'],
              'news_body' => $news['body'],
              'news_startdate' => ($news['date']) ? date('d.m.Y', $news['date']) : "",
              'news_enddate' => ($news['expire']) ? date('d.m.Y', $news['date']+$news['expire']) : "",
              'news_allow_comments' => $news['allow_comments']) ?>
    <?php 
echo createQuestion2($flash['question_text'], array_merge($flash['question_param'], $form_content), $form_content, URLHelper::getURL('dispatch.php/' . $route . '#anker'));
?>
<? endif ?>
<form action="<?php 
echo URLHelper::getURL('dispatch.php/' . $route . '#anker');
?>
" method="POST" rel="<?php 
echo Request::isXhr() ? 'update_dialog' : '';
?>
">
<?php 
echo CSRFProtection::tokenTag();
?>
<input type="hidden" name="news_basic_js" value="">
<input type="hidden" name="news_comments_js" value="">
<input type="hidden" name="news_areas_js" value="">
Example #3
0
<? if ($msg) parse_msg($msg); ?>
<? if(!empty($flash['delete'])) : ?>
    <?php 
echo createQuestion2(sprintf(_('Wollen Sie die/den "%s" wirklich austragen?'), $status_groups[$flash['status']]), array('users' => $flash['delete']), array(), $controller->url_for(sprintf('course/members/cancel_subscription/collection/%s', $flash['status'])));
?>
<? endif ?>

<? if (count($dozenten) > 0) : ?>
    <?php 
echo $this->render_partial('course/members/dozent_list');
?>
<? endif ?>

<? if (count($tutoren) > 0) : ?>
    <br />
    <?php 
echo $this->render_partial('course/members/tutor_list');
?>
<? endif ?>

<? if ($is_tutor && $semAdmissionEnabled) : ?>
    <p style="float: right">
        <? //TODO?>
        <strong><?php 
echo _('Teilnahmebeschränkte Veranstaltung');
?>
</strong> -
        <?php 
echo _('max. Teilnehmeranzahl');
?>
 <?php 
Example #4
0
 /**
  *  This actions removes a new widget from the start page
  *
  * @param string $widgetId
  * @param string $approveDelete
  * @param string $studipticket
  *
  * @return void
  */
 function delete_action($id)
 {
     if (Request::isPost()) {
         if (Request::submitted('yes')) {
             $name = WidgetHelper::getWidgetName($id);
             if (WidgetHelper::removeWidget($id, $name, $GLOBALS['user']->id)) {
                 $message = sprintf(_('Widget "%s" wurde entfernt.'), $name);
                 PageLayout::postMessage(MessageBox::success($message));
             } else {
                 $message = sprintf(_('Widget "%s" konnte nicht entfernt werden.'), $name);
                 PageLayout::postMessage(MessageBox::error($message));
             }
         }
     } else {
         $message = sprintf(_('Sind Sie sicher, dass Sie das Widget "%s" von der Startseite entfernen möchten?'), WidgetHelper::getWidgetName($id));
         $this->flash['question'] = createQuestion2($message, array(), array(), $this->url_for('start/delete/' . $id));
     }
     $this->redirect('start');
 }
Example #5
0
 /**
  * show institute basicdata page
  *
  * @param mixed $i_id Optional institute id 
  * @throws AccessDeniedException
  */
 public function index_action($i_id = false)
 {
     PageLayout::setTitle(_('Verwaltung der Grunddaten'));
     Navigation::activateItem('/admin/institute/details');
     //get ID from an open Institut
     $i_view = $i_id ?: Request::option('i_view', $GLOBALS['SessSemName'][1]);
     if (!$i_view) {
         require_once 'lib/admin_search.inc.php';
         // This search just died a little inside, so it should be safe to
         // continue here but we nevertheless return just to be sure
         return;
     } elseif ($i_view === 'new') {
         closeObject();
     }
     //  allow only inst-admin and root to view / edit
     if ($i_view && !$GLOBALS['perm']->have_studip_perm('admin', $i_view) && $i_view !== 'new') {
         throw new AccessDeniedException();
     }
     //Change header_line if open object
     $header_line = getHeaderLine($i_view);
     if ($header_line) {
         PageLayout::setTitle($header_line . ' - ' . PageLayout::getTitle());
     }
     if (Request::get('i_trykill')) {
         $message = _('Sind Sie sicher, dass Sie diese Einrichtung löschen wollen?');
         $post['i_kill'] = 1;
         $post['studipticket'] = get_ticket();
         $this->question = createQuestion2($message, $post, array(), $this->url_for('institute/basicdata/delete/' . $i_view));
     }
     $lockrule = LockRules::getObjectRule($i_view);
     if ($lockrule->description && LockRules::CheckLockRulePermission($i_view, $lockrule['permission'])) {
         PageLayout::postMessage(MessageBox::info(formatLinks($lockrule->description)));
     }
     // Load institute data
     $institute = new Institute($i_view === 'new' ? null : $i_view);
     //add the free administrable datafields
     $datafields = array();
     $localEntries = DataFieldEntry::getDataFieldEntries($institute->id, 'inst');
     if ($localEntries) {
         $invalidEntries = $this->flash['invalid_entries'] ?: array();
         foreach ($localEntries as $entry) {
             if (!$entry->isVisible()) {
                 continue;
             }
             $color = '#000000';
             if (in_array($entry->getId(), $invalidEntries)) {
                 $color = '#ff0000';
             }
             $datafields[] = array('color' => $color, 'title' => $entry->getName(), 'value' => $GLOBALS['perm']->have_perm($entry->isEditable()) && !LockRules::Check($institute['Institut_id'], $entry->getId()) ? $entry->getHTML('datafields') : $entry->getDisplayValue());
         }
     }
     // Read faculties if neccessary
     if (count($institute->sub_institutes) === 0) {
         if ($GLOBALS['perm']->have_perm('root')) {
             $this->faculties = Institute::findBySQL('Institut_id = fakultaets_id ORDER BY Name ASC', array($i_view));
         } else {
             $temp = User::find($GLOBALS['user']->id)->institute_memberships->findBy('inst_perms', 'admin')->pluck('institute');
             $institutes = SimpleORMapCollection::createFromArray($temp);
             $faculties = $institutes->filter(function ($institute) {
                 return $institute->is_fak;
             });
             $this->faculties = $faculties;
         }
     }
     // Indicates whether the current user is allowed to delete the institute
     $this->may_delete = $i_view !== 'new' && !(count($institute->home_courses) || count($institute->sub_institutes)) && ($GLOBALS['perm']->have_perm('root') || $GLOBALS['perm']->is_fak_admin() && get_config('INST_FAK_ADMIN_PERMS') == 'all');
     if (!$this->may_delete) {
         //Set infotext for disabled delete-button
         $reason_txt = _('Löschen nicht möglich.');
         if (count($institute->home_courses) > 0) {
             $reason_txt .= ' ';
             $reason_txt .= sprintf(ngettext('Es ist eine Veranstaltung zugeordnet.', 'Es sind %u Veranstaltungen zugeordnet.', count($institute->home_courses)), count($institute->home_courses));
         }
         if (count($institute->sub_institutes) > 0) {
             $reason_txt .= ' ';
             $reason_txt .= sprintf(ngettext('Es ist eine Einrichtung zugeordnet.', 'Es sind %u Einrichtungen zugeordnet.', count($institute->sub_institutes)), count($institute->sub_institutes));
         }
     }
     // Indicates whether the current user is allowed to change the faculty
     $this->may_edit_faculty = $GLOBALS['perm']->is_fak_admin() && !LockRules::Check($institute['Institut_id'], 'fakultaets_id') && ($GLOBALS['perm']->have_studip_perm('admin', $institute['fakultaets_id']) || $i_view === 'new');
     // Prepare template
     $this->institute = $institute;
     $this->i_view = $i_view;
     $this->datafields = $datafields;
     $this->reason_txt = $reason_txt;
 }
Example #6
0
 /**
  * General handler for bulk actions. Support the following actions:
  *
  * - Download
  * - Move
  * - Copy
  * - Delete
  *
  * @param String $folder_id Directory entry id of the origin folder
  */
 public function bulk_action($folder_id, $page = 1)
 {
     $ids = Request::optionArray('ids');
     FileHelper::checkAccess($ids);
     if (empty($ids)) {
         $this->redirect('document/files/index/' . $folder_id . '/' . $page);
     } else {
         if (Request::submitted('download')) {
             $this->flash['ids'] = $ids;
             $this->redirect('document/download/flashed');
         } else {
             if (Request::submitted('move')) {
                 $this->flash['move-ids'] = $ids;
                 $this->redirect('document/files/move/flashed/' . $folder_id);
             } else {
                 if (Request::submitted('copy')) {
                     $this->flash['copy-ids'] = $ids;
                     $this->redirect('document/files/copy/flashed/' . $folder_id);
                 } else {
                     if (Request::submitted('delete')) {
                         if (Request::submitted('yes')) {
                             if ($folder_id === $this->context_id) {
                                 $dir = new RootDirectory($this->context_id);
                             } else {
                                 $entry = new DirectoryEntry($folder_id);
                                 $dir = $entry->file;
                             }
                             foreach ($ids as $id) {
                                 $entry = new DirectoryEntry($id);
                                 $dir->unlink($entry->name);
                             }
                             PageLayout::postMessage(MessageBox::success(_('Die Dateien wurden erfolgreich gelöscht.')));
                         } elseif (!Request::submitted('no')) {
                             $question = createQuestion2(_('Sollen die markierten Dateien wirklich gelöscht werden?'), array('delete' => 'true', 'ids' => $ids), array(), $this->url_for('document/files/bulk/' . $folder_id));
                             $this->flash['question'] = $question;
                             $this->flash['marked-ids'] = $ids;
                         }
                         $this->redirect('document/files/index/' . $folder_id . '/' . $page);
                     }
                 }
             }
         }
     }
 }
Example #7
0
<? use Studip\Button, Studip\LinkButton; ?>
<? if (!empty($flash['question_text'])) : ?>
    <?php 
echo createQuestion2($flash['question_text'], array_merge($flash['question_param'], array('news_filter_term' => htmlReady($news_searchterm), 'news_filter_start' => $news_startdate, 'news_filter_end' => $news_enddate, 'news_filter' => 'set')), array('news_filter_term' => htmlReady($news_searchterm), 'news_filter_start' => $news_startdate, 'news_filter_end' => $news_enddate, 'news_filter' => 'set'), $controller->url_for('news/admin_news/' . $area_type));
?>
<? endif ?>
<div class="news_admin">

    <form action="<?php 
echo $controller->url_for('news/admin_news/' . $area_type);
?>
" id="admin_news_form" method="POST">
        <input type="hidden" name="news_filter" value="set">
        <input type="hidden" name="news_filter_term" value="<?php 
echo htmlReady($news_searchterm);
?>
">
        <input type="hidden" name="news_filter_start" value="<?php 
echo $news_startdate;
?>
">
        <input type="hidden" name="news_filter_end" value="<?php 
echo $news_enddate;
?>
">
        <?php 
echo CSRFProtection::tokenTag();
?>
        <table class="default">
            <caption><?php 
echo _('Meine Ankündigungen');
Example #8
0
 /**
  * Deletes a folder.
  *
  * @param String $folder_id Directory entry id of the folder
  */
 public function delete_action($folder_id)
 {
     if (!$this->full_access) {
         throw new AccessDeniedException();
     }
     FileHelper::checkAccess($folder_id);
     $parent_id = FileHelper::getParentId($folder_id) ?: $this->context_id;
     if (!Request::isPost()) {
         $message = $folder_id === 'all' ? _('Soll der gesamte Dateibereich inklusive aller Order und Dateien wirklich gelöscht werden?') : _('Soll der Ordner inklusive aller darin enthaltenen Dateien wirklich gelöscht werden?');
         $question = createQuestion2($message, array(), array(), $this->url_for('document/folder/delete/' . $folder_id));
         $this->flash['question'] = $question;
     } elseif (Request::isPost() && Request::submitted('yes')) {
         if ($folder_id === 'all') {
             $entry = RootDirectory::find($this->context_id);
             foreach ($entry->listFiles() as $file) {
                 $entry->unlink($file->name);
             }
             PageLayout::postMessage(MessageBox::success(_('Der Dateibereich wurde geleert.')));
         } else {
             $entry = DirectoryEntry::find($folder_id);
             $entry->directory->unlink($entry->name);
             PageLayout::postMessage(MessageBox::success(_('Der Ordner wurde gelöscht.')));
         }
     }
     $this->redirect('document/files/index/' . $parent_id);
 }