Example #1
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // Lock context to user id
     $this->owner = $GLOBALS['user'];
     $this->context_id = $this->owner->id;
     $this->full_access = true;
     if (Config::get()->PERSONALDOCUMENT_OPEN_ACCESS) {
         $username = Request::username('username', $GLOBALS['user']->username);
         $user = User::findByUsername($username);
         if ($user && $user->id !== $GLOBALS['user']->id) {
             $this->owner = $user;
             $this->context_id = $user->id;
             $this->full_access = Config::get()->PERSONALDOCUMENT_OPEN_ACCESS_ROOT_PRIVILEDGED && $GLOBALS['user']->perms === 'root';
             URLHelper::bindLinkParam('username', $username);
         }
     }
     $this->limit = $GLOBALS['user']->cfg->PERSONAL_FILES_ENTRIES_PER_PAGE ?: Config::get()->ENTRIES_PER_PAGE;
     $this->userConfig = DocUsergroupConfig::getUserConfig($GLOBALS['user']->id);
     if ($this->userConfig['area_close'] == 1) {
         $this->redirect('document/closed/index');
     }
     if (Request::isPost()) {
         CSRFProtection::verifySecurityToken();
     }
     if (($ticket = Request::get('studip-ticket')) && !check_ticket($ticket)) {
         $message = _('Bei der Verarbeitung Ihrer Anfrage ist ein Fehler aufgetreten.') . "\n" . _('Bitte versuchen Sie es erneut.');
         PageLayout::postMessage(MessageBox::error($message));
         $this->redirect('document/files/index');
     }
 }
 /**
  * get admin module links
  *
  * returns links add or remove a module from course
  * @access public
  * @return string returns html-code
  */
 function getAdminModuleLinks()
 {
     global $connected_cms, $view, $search_key, $cms_select, $current_module;
     $output .= "<form method=\"POST\" action=\"" . URLHelper::getLink() . "\">\n";
     $output .= CSRFProtection::tokenTag();
     $output .= "<input type=\"HIDDEN\" name=\"view\" value=\"" . htmlReady($view) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"search_key\" value=\"" . htmlReady($search_key) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"cms_select\" value=\"" . htmlReady($cms_select) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"module_type\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getModuleType()) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"module_id\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getId()) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"module_system_type\" value=\"" . htmlReady($this->cms_type) . "\">\n";
     if ($connected_cms[$this->cms_type]->content_module[$current_module]->isConnected()) {
         $output .= "&nbsp;" . Button::create(_('Entfernen'), 'remove');
     } elseif ($connected_cms[$this->cms_type]->content_module[$current_module]->isAllowed(OPERATION_WRITE)) {
         $output .= "<div align=\"left\"><input type=\"CHECKBOX\" value=\"1\" name=\"write_permission\" style=\"vertical-align:middle\">";
         $output .= _("Mit Schreibrechten für alle Dozenten/Tutoren dieser Veranstaltung") . "<br>";
         $output .= "<input type=\"CHECKBOX\" value=\"1\" style=\"vertical-align:middle\" name=\"write_permission_autor\">";
         $output .= _("Mit Schreibrechten für alle Teilnehmer dieser Veranstaltung") . "</div>";
         $output .= Button::create(_('Hinzufügen'), 'add') . "<br>";
     } else {
         $output .= "&nbsp;" . Button::create(_('Hinzufügen'), 'add');
     }
     $output .= "</form>";
     return $output;
     //      $output .= parent::getAdminModuleLinks();
 }
Example #3
0
 public function add_member_action()
 {
     CSRFProtection::verifyRequest();
     $mp = MultiPersonSearch::load('settings_add_deputy');
     $msg = array('error' => array(), 'success' => array());
     foreach ($mp->getAddedUsers() as $_user_id) {
         if (isDeputy($_user_id, $this->user->user_id)) {
             $msg['error'][] = sprintf(_('%s ist bereits als Vertretung eingetragen.'), get_fullname($_user_id, 'full'));
         } else {
             if ($_user_id == $this->user->user_id) {
                 $msg['error'][] = _('Sie können sich nicht als Ihre eigene Vertretung eintragen!');
             } else {
                 if (!addDeputy($_user_id, $this->user->user_id)) {
                     $msg['error'][] = _('Fehler beim Eintragen der Vertretung!');
                 } else {
                     $msg['success'][] = sprintf(_('%s wurde als Vertretung eingetragen.'), get_fullname($_user_id, 'full'));
                 }
             }
         }
     }
     // only show an error messagebox once.
     if (!empty($msg['error'])) {
         PageLayout::postMessage(MessageBox::error(_('Die gewünschte Operation konnte nicht ausgeführt werden.'), $msg['error']));
     }
     if (!empty($msg['success'])) {
         PageLayout::postMessage(MessageBox::success(_('Die gewünschten Personen wurden als Ihre Vertretung eingetragen!'), $msg['success']));
     }
     $this->redirect('settings/deputies/index');
 }
Example #4
0
 /**
  * This method edits existing holidays or creates new holidays
  *
  * @param mixed $id Id of the holiday or null to create one
  */
 public function edit_action($id = null)
 {
     $this->holiday = new SemesterHoliday($id);
     PageLayout::setTitle($this->holiday->isNew() ? _('Ferien anlegen') : _('Ferien bearbeiten'));
     if (Request::isPost()) {
         CSRFProtection::verifyUnsafeRequest();
         $this->holiday->name = Request::get('name');
         $this->holiday->description = Request::get('description');
         $this->holiday->beginn = $this->getTimeStamp('beginn');
         $this->holiday->ende = $this->getTimeStamp('ende', '23:59:59');
         $errors = array();
         if (!$this->holiday->name) {
             $errors[] = _('Bitte geben Sie einen Namen ein.');
         }
         if (!$this->holiday->beginn) {
             $errors[] = _('Bitte geben Sie einen Ferienbeginn ein.');
         }
         if (!$this->holiday->ende) {
             $errors[] = _('Bitte geben Sie ein Ferienende ein.');
         }
         if ($this->holiday->beginn > $this->holiday->ende) {
             $errors[] = _('Das Ferienende liegt vor dem Beginn.');
         }
         if (!empty($errors)) {
             PageLayout::postMessage(MessageBox::error(_('Ihre eingegebenen Daten sind ungültig.'), $errors));
         } elseif ($this->holiday->isDirty() && !$this->holiday->store()) {
             PageLayout::postMessage(MessageBox::error(_('Die Ferien konnten nicht gespeichert werden.')));
         } else {
             PageLayout::postMessage(MessageBox::success(_('Die Ferien wurden erfolgreich gespeichert.')));
             $this->relocate('admin/holidays');
         }
     }
 }
Example #5
0
 /**
  * This method edits an existing semester or creates a new semester.
  *
  * @param mixed $id Id of the semester or null to create a semester.
  */
 public function edit_action($id = null)
 {
     $this->semester = new Semester($id);
     PageLayout::setTitle($this->semester->isNew() ? _('Semester anlegen') : _('Semester bearbeiten'));
     if (Request::isPost()) {
         CSRFProtection::verifyUnsafeRequest();
         // Extract values
         $this->semester->name = Request::get('name');
         $this->semester->description = Request::get('description');
         $this->semester->semester_token = Request::get('token');
         $this->semester->beginn = $this->getTimeStamp('beginn');
         $this->semester->ende = $this->getTimeStamp('ende', '23:59:59');
         $this->semester->vorles_beginn = $this->getTimeStamp('vorles_beginn');
         $this->semester->vorles_ende = $this->getTimeStamp('vorles_ende', '23:59:59');
         // Validate
         $errors = $this->validateSemester($this->semester);
         // If valid, try to store the semester
         if (empty($errors) && $this->semester->isDirty() && !$this->semester->store()) {
             $errors[] = _('Fehler bei der Speicherung Ihrer Daten. Bitte überprüfen Sie Ihre Angaben.');
         }
         // Output potential errors or show success message and relocate
         if (count($errors) === 1) {
             $error = reset($errors);
             PageLayout::postMessage(MessageBox::error($error));
         } elseif (!empty($errors)) {
             $message = _('Ihre eingegebenen Daten sind ungültig.');
             PageLayout::postMessage(MessageBox::error($message, $errors));
         } else {
             $message = _('Das Semester wurde erfolgreich gespeichert.');
             PageLayout::postMessage(MessageBox::success($message));
             $this->relocate('admin/semester');
         }
         $this->errors = $errors;
     }
 }
Example #6
0
 function navigator ($print_view = false) {
     global $cssSw, $view_mode;
     $semester = SemesterData::GetSemesterArray();
     unset($semester[0]);
     if (!$print_view){
     ?>
     <table border="0" celpadding="2" cellspacing="0" width="99%" align="center">
     <form method="POST" name="schedule_form" action="<?echo URLHelper::getLink('?navigate=TRUE&quick_view=view_sem_schedule&quick_view_mode='.$view_mode) ?>">
         <?= CSRFProtection::tokenTag() ?>
         <tr>
             <td class="<? $cssSw->switchClass(); echo $cssSw->getClass() ?>" width="4%">&nbsp;
             </td>
             <td class="<? echo $cssSw->getClass() ?>" width="96%" colspan="3"><font size=-1><b><?=_("Semester:")?></b></font>
             </td>
         </tr>
         <tr>
             <td class="<? echo $cssSw->getClass() ?>" width="4%" rowspan="2">&nbsp;
             </td>
             <td class="<? echo $cssSw->getClass() ?>" width="40%" valign="bottom">
             <font size="-1">
             <?=SemesterData::GetSemesterSelector(array('name' => 'sem_schedule_choose', 'onChange' => 'document.schedule_form.submit()'), $this->semester['semester_id'],'semester_id',false)?>
             <?= Button::create(_('Auswählen'), 'jump') ?><br>
             </font>
             </td>
             <td class="<? echo $cssSw->getClass() ?>" width="30%" valign="middle">
             <font size="-1">
             <?=_("Ein Semester als Liste ausgeben")?>
             </font>
             </td>
             <td class="<? echo $cssSw->getClass() ?>">
                 <?= Button::create(_('Ausgeben'), 'sem_schedule_start_list') ?><br>
             </td>
         </tr>
         <tr>
         <td class="<? echo $cssSw->getClass() ?>" width="40%" valign="middle">
             <label>
             <input type="radio" onChange="document.schedule_form.submit()" style="vertical-align:bottom" <?=($this->timespan == 'course_time' ? 'checked' : '')?> name="sem_time_choose" value="course_time">
             <?=_("Vorlesungszeit")?>
             </label>
             <label>
             <input type="radio" onChange="document.schedule_form.submit()" style="vertical-align:bottom" <?=($this->timespan == 'sem_time' ? 'checked' : '')?> name="sem_time_choose" value="sem_time">
             <?=_("vorlesungsfreie Zeit")?>
             </label>
             </td>
             <td class="<? echo $cssSw->getClass() ?>" width="30%" valign="middle"><font size="-1">
                 <?=_("<i>oder</i> ein Semester grafisch ausgeben")?>
             </font>
             </td>
             <td class="<? echo $cssSw->getClass() ?>">
                 <?= Button::create(_('Ausgeben'), 'sem_schedule_start_graphical') ?><br>
             </td>
         </tr>
         <tr>
             <td class="<? echo $cssSw->getClass() ?>" colspan="4"><font size="-1">&nbsp;</font>
             </td>
         </tr>
     </table>
 <?
     }
 }
 function navigator ($print_view = false) {
     global $cssSw, $view_mode;
     if (!$print_view){
     ?>
     <table border="0" celpadding="2" cellspacing="0" width="99%" align="center">
     <form method="POST" name="schedule_form" action="<?= URLHelper::getLink('?navigate=TRUE&quick_view=view_group_schedule&quick_view_mode='.$view_mode) ?>">
         <?= CSRFProtection::tokenTag() ?>
         <tr>
             <td class="<? $cssSw->switchClass(); echo $cssSw->getClass() ?>" width="4%">&nbsp;
             </td>
             <td class="<? echo $cssSw->getClass() ?>" width="96%" colspan="3"><font size=-1><b><?=_("Semester:")?></b></font>
             </td>
         </tr>
         <tr>
             <td class="<? echo $cssSw->getClass() ?>" width="4%" rowspan="2">&nbsp;
             </td>
             <td class="<? echo $cssSw->getClass() ?>" width="40%" valign="top">
                 <?= SemesterData::GetSemesterSelector(array('name' => 'sem_schedule_choose', 'onChange' => 'document.schedule_form.submit()'), $this->semester['semester_id'],'semester_id',false)?>
                 <?= Button::create(_('Auswählen'), 'jump') ?><br>
                 <label>
                 <input type="radio" onChange="document.schedule_form.submit()" style="vertical-align:bottom" <?=($this->timespan == 'course_time' ? 'checked' : '')?> name="sem_time_choose" value="course_time">
                 <?=_("Vorlesungszeit")?>
                 </label>
                 <label>
                 <input type="radio" onChange="document.schedule_form.submit()" style="vertical-align:bottom" <?=($this->timespan == 'sem_time' ? 'checked' : '')?> name="sem_time_choose" value="sem_time">
                 <?=_("vorlesungsfreie Zeit")?>
                 </label>
             </td>
             <td class="<? echo $cssSw->getClass() ?>" width="60%" valign="top">
                 <?=_("Eine Raumgruppe auswählen")?>:<br>
                 <select name="group_schedule_choose_group" onChange="document.schedule_form.submit()">
                 <?
                 $room_group = RoomGroups::GetInstance();
                 foreach($room_group->getAvailableGroups() as $gid){
                     echo '<option value="'.$gid.'" '
                         . ($this->group_id == $gid ? 'selected' : '') . '>'
                         .htmlReady(my_substr($room_group->getGroupName($gid),0,85))
                         .' ('.$room_group->getGroupCount($gid).')</option>';
                 }
                 ?>
                 </select>
                 <?= Button::create(_('Auswählen')) ?>
             </font>
             </td>
             <td class="<? echo $cssSw->getClass() ?>" valign="middle">
                 
             </td>                    
         </tr>
         <tr>
             <td class="<? echo $cssSw->getClass() ?>" colspan="4"><font size="-1">&nbsp;</font>
             </td>
         </tr>
     </table>
 <?
     }
 }
 function navigator ($print_view = false) {
     global $cssSw, $view_mode,$view;
     $start_time = $this->start_time;
     if (!$print_view){
     ?>
     <table border="0" celpadding="2" cellspacing="0" width="99%" align="center">
     <form method="POST" name="schedule_form" action="<?echo URLHelper::getLink('?navigate=TRUE&quick_view='.$view.'&quick_view_mode='.$view_mode) ?>">
         <?= CSRFProtection::tokenTag() ?>
         <tr>
             <td class="<? $cssSw->switchClass(); echo $cssSw->getClass() ?>" width="4%">&nbsp;
             </td>
             <td class="<? echo $cssSw->getClass() ?>" width="96%" colspan="3"><font size=-1><b><?=_("Datum:")?></b></font>
             </td>
         </tr>
         <tr>
             <td class="<? echo $cssSw->getClass() ?>" width="4%" rowspan="2">&nbsp;
             </td>
             <td class="<? echo $cssSw->getClass() ?>" width="40%" valign="middle">
                 <!--CHANGE for Datepicker-->
                 <input type="text" id="schedule_begin_date" name="schedule_begin_date" size="10" value="<?echo date("d",$start_time).'.'.date("m",$start_time).'.'.date("Y",$start_time);; ?>">
                 <script>
                     jQuery('#schedule_begin_date').datepicker();
                 </script>                    
                 <!--
                 <input type="text" name="schedule_begin_day" size=2 maxlength=2 value="<?echo date("d",$start_time); ?>">.
                 <input type="text" name="schedule_begin_month" size=2 maxlength=2 value="<?echo date("m",$start_time); ?>">.
                 <input type="text" name="schedule_begin_year" size=4 maxlength=4 value="<?echo date("Y",$start_time); ?>">
                 -->
                 <?= Button::create(_('Auswählen'), 'jump') ?><br>
             </td>
             <td class="<? echo $cssSw->getClass() ?>" width="60%" valign="bottom">
                 <?= ($view_mode == 'oobj' ? _("Eine Ressourcengruppe auswählen") : _("Eine Raumgruppe auswählen")) ?>:<br>
                 <select name="group_schedule_choose_group" onChange="document.schedule_form.submit()">
                 <? foreach($this->resources_groups->getAvailableGroups() as $gid) :
                     echo '<option value="'.$gid.'" '
                         . ($this->group_id == $gid ? 'selected' : '') . '>'
                         .htmlReady(my_substr($this->resources_groups->getGroupName($gid),0,80))
                         .' ('.$this->resources_groups->getGroupCount($gid).')</option>';
                 endforeach ?>
                 </select>
                 <?= Button::create(_('Auswählen')) ?>
             </td>
             <td class="<? echo $cssSw->getClass() ?>" valign="middle">
                 
             </td>
         </tr>
         <tr>
             <td class="<? echo $cssSw->getClass() ?>" colspan="4"><font size="-1">&nbsp;</font>
             </td>
         </tr>
     </table>
 <?
     }
 }
 /**
  * get admin module links
  *
  * returns links add or remove a module from course
  * @access public
  * @return string returns html-code
  */
 function getAdminModuleLinks()
 {
     global $connected_cms, $view, $search_key, $cms_select, $current_module;
     if (!$connected_cms[$this->cms_type]->content_module[$current_module]->isDummy()) {
         $result = $connected_cms[$this->cms_type]->soap_client->getPath($connected_cms[$this->cms_type]->content_module[$current_module]->getId());
     }
     if ($result) {
         $output .= "<i>Pfad: " . htmlReady($result) . "</i><br><br>";
     }
     $output .= "<form method=\"POST\" action=\"" . URLHelper::getLink() . "\">\n";
     $output .= CSRFProtection::tokenTag();
     $output .= "<input type=\"HIDDEN\" name=\"view\" value=\"" . htmlReady($view) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"search_key\" value=\"" . htmlReady($search_key) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"cms_select\" value=\"" . htmlReady($cms_select) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"module_type\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getModuleType()) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"module_id\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getId()) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"module_system_type\" value=\"" . htmlReady($this->cms_type) . "\">\n";
     if ($connected_cms[$this->cms_type]->content_module[$current_module]->isConnected()) {
         $output .= "&nbsp;" . Button::create(_('Entfernen'), 'remove');
     } elseif ($connected_cms[$this->cms_type]->content_module[$current_module]->isAllowed(OPERATION_WRITE)) {
         $output .= "<div align=\"left\">";
         if ($connected_cms[$this->cms_type]->content_module[$current_module]->isAllowed(OPERATION_COPY) and !in_array($connected_cms[$this->cms_type]->content_module[$current_module]->module_type, array("lm", "htlm", "sahs", "cat", "crs", "dbk"))) {
             $output .= "<input type=\"CHECKBOX\" name=\"copy_object\" value=\"1\">";
             $output .= _("Als Kopie anlegen") . "&nbsp;";
             $output .= Icon::create('info-circle', 'inactive', ['title' => _('Wenn Sie diese Option wählen, wird eine identische Kopie als eigenständige Instanz des Lernmoduls erstellt. Anderenfalls wird ein Link zum Lernmodul gesetzt.')])->asImg();
             $output .= "<br>";
         }
         $output .= "<input type=\"RADIO\" name=\"write_permission\" value=\"none\" checked>";
         $output .= _("Keine Schreibrechte") . "&nbsp;";
         $output .= Icon::create('info-circle', 'inactive', ['title' => _('Nur der/die BesitzerIn des Lernmoduls hat Schreibzugriff für Inhalte und Struktur des Lernmoduls. Tutor/-innen und Lehrende können die Verknüpfung zur Veranstaltung wieder löschen.')])->asImg();
         $output .= "<br>";
         $output .= "<input type=\"RADIO\" name=\"write_permission\" value=\"dozent\">";
         $output .= _("Mit Schreibrechten für alle Lehrenden dieser Veranstaltung") . "&nbsp;";
         $output .= Icon::create('info-circle', 'inactive', ['title' => _('Lehrende haben Schreibzugriff für Inhalte und Struktur des Lernmoduls. Tutor/-innen und Lehrende können die Verknüpfung zur Veranstaltung wieder löschen.')])->asImg();
         $output .= "<br>";
         $output .= "<input type=\"RADIO\" name=\"write_permission\" value=\"tutor\">";
         $output .= _("Mit Schreibrechten für alle Lehrenden und Tutor/-innen dieser Veranstaltung") . "&nbsp;";
         $output .= Icon::create('info-circle', 'inactive', ['title' => _('Lehrende und Tutor/-innen haben Schreibzugriff für Inhalte und Struktur des Lernmoduls. Tutor/-innen und Lehrende können die Verknüpfung zur Veranstaltung wieder löschen.')])->asImg();
         $output .= "<br>";
         $output .= "<input type=\"RADIO\" name=\"write_permission\" value=\"autor\">";
         $output .= _("Mit Schreibrechten für alle Personen dieser Veranstaltung") . "&nbsp;";
         $output .= Icon::create('info-circle', 'inactive', ['title' => _('Lehrende, Tutor/-innen und Teilnehmer/-innen haben Schreibzugriff für Inhalte und Struktur des Lernmoduls. Tutor/-innen und Lehrende können die Verknüpfung zur Veranstaltung wieder löschen.')])->asImg();
         $output .= "</div>";
         $output .= "</div><br>" . Button::create(_('Hinzufügen'), 'add') . "<br>";
     } else {
         $output .= "&nbsp;" . Button::create(_('Hinzufügen'), 'add');
     }
     $output .= "</form>";
     return $output;
 }
Example #10
0
 /**
  * get module-links for admin
  *
  * returns links to remove or add module to object
  * @access public
  * @return string html-code
  */
 function getAdminModuleLinks()
 {
     global $connected_cms, $view, $search_key, $cms_select, $current_module;
     $output .= "<form method=\"POST\" action=\"" . URLHelper::getLink() . "\">\n";
     $output .= CSRFProtection::tokenTag();
     $output .= "<input type=\"HIDDEN\" name=\"view\" value=\"" . htmlReady($view) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"search_key\" value=\"" . htmlReady($search_key) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"cms_select\" value=\"" . htmlReady($cms_select) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"module_type\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getModuleType()) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"module_id\" value=\"" . htmlReady($connected_cms[$this->cms_type]->content_module[$current_module]->getId()) . "\">\n";
     $output .= "<input type=\"HIDDEN\" name=\"module_system_type\" value=\"" . htmlReady($this->cms_type) . "\">\n";
     if ($connected_cms[$this->cms_type]->content_module[$current_module]->isConnected()) {
         $output .= "&nbsp;" . Button::create(_('Entfernen'), 'remove');
     } else {
         $output .= "&nbsp;" . Button::create(_('Hinzufügen'), 'add');
     }
     $output .= "</form>";
     return $output;
 }
Example #11
0
<form action="<?php 
echo URLHelper::getLink($url, array(), true);
?>
" method="<?php 
echo $method;
?>
">
    <?php 
echo $method == 'post' ? CSRFProtection::tokenTag() : '';
?>
    <select class="sidebar-selectlist" size="<?php 
echo (int) $size ?: 8;
?>
" name="<?php 
echo htmlReady($name);
?>
" onKeyDown="if (event.keyCode === 13) { jQuery(this).closest('form')[0].submit(); }" <?php 
echo $size == 1 ? 'onchange' : 'onClick';
?>
="jQuery(this).closest('form')[0].submit();" size="10" style="max-width: 200px;cursor:pointer" class="text-top" aria-label="<?php 
echo _("Wählen Sie ein Objekt aus. Sie gelangen dann zur neuen Seite.");
?>
">
    <? foreach ($elements as $element): ?>
        <option <?php 
echo $value == $element->getid() ? 'selected' : '';
?>
 value="<?php 
echo htmlReady($element->getid());
?>
"><?php 
Example #12
0
    protected static function homePage()
    {
        ?>
        <html>
            <head>
                <?php 
        if (file_exists("jquery-2.2.0.min.js")) {
            $jquery = "jquery-2.2.0.min.js";
        } else {
            $jquery = "https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js";
        }
        ?>
                <script type="text/javascript" src="<?php 
        echo $jquery;
        ?>
"></script>
                <script type="text/javascript">
                    var csrf_token = "<?php 
        echo CSRFProtection::getCSRFToken();
        ?>
";
                    $(document).ready(function ($) {
                        var rules_table = {
                            add_rows: function (data) {
                                for (alias in data) {
                                    this.add_row(alias, data[alias]);
                                }
                            },
                            add_row: function (alias, data) {
                                var table = $('#real_rules');
                                var rule = $('#sample_rule').clone();
                                rule.attr('id', false);
                                rule.find('.rule_serial_number').text(table.find('tr').length + 1);
                                rule.find('.rule_enabled').prop('checked', "true" == data.enabled);
                                rule.find('.rule_http_status_code').find(':contains(' + data.http_status_code + ')').prop('selected', true);
                                rule.find('.rule_alias').val(alias);
                                rule.find('.rule_url').val(data.url);
                                table.append(rule);
                            },
                            createRows: function (number) {
                                var table = $('#real_rules');
                                for (var i = 1; i <= number; i++) {
                                    var rule = $('#sample_rule').clone();
                                    rule.attr('id', false);
                                    rule.find('.rule_serial_number').text(table.find('tr').length + 1);
                                    rule.find('.rule_enabled').prop('checked', true);
                                    table.append(rule);
                                }
                            },
                            reloadIndex: function () {
                                var table = $('#real_rules');
                                var a = 1;
                                table.find('.rule_serial_number').each(function () {
                                    $(this).text(a++);
                                });
                            },
                            empty: function () {
                                var table = $('#real_rules');
                                table.children('tr').remove();
                            }
                        }

                        var redirect_rules = {
                            load: function () {
                                return $.ajax({
                                    url: '',
                                    method: 'POST',
                                    data: {action: 'get_redirect_rules'},
                                    async: false,
                                }).responseText;
                            },
                            update: function (data) {
                                return $.ajax({
                                    url: '',
                                    method: 'POST',
                                    data: {action: 'update_redirect_rules', data: data, csrf_token: csrf_token},
                                    async: false,
                                }).responseText;
                            }
                        }


                        jQuery('#op_mom').click(function () {
                            if (!(confirm("Press F5, You Idiot!\n\nCan you do this?"))) {
                                location.reload();
                            }
                        });

                        jQuery('#rows_add').click(function () {
                            rules_table.createRows(5);
                        });

                        jQuery(document).on('click', '.rule_delete', function () {
                            $(this).closest('tr').remove();
                            rules_table.reloadIndex();
                        });

                        jQuery('#update_rules').click(function () {
                            $('#loader').css('display', 'block');
                            jQuery('#update_rules').val('Updating..');
                            var table = $('#real_rules');
                            var data = {};
                            table.children('tr').each(function () {
                                var tr = $(this);
                                if (tr.find('.rule_alias').val() && tr.find('.rule_url').val()) {
                                    data[tr.find('.rule_alias').val()] = {
                                        enabled: tr.find('.rule_enabled').prop('checked'),
                                        http_status_code: tr.find('.rule_http_status_code option:selected').val(),
                                        url: tr.find('.rule_url').val(),
                                    };
                                }
                            });

                            var data = redirect_rules.update(data);
                            var json = $.parseJSON(data);
                            rules_table.empty();
                            rules_table.add_rows(json);
                            rules_table.createRows(2);
                            $('#loader').css('display', 'none');
                            jQuery('#update_rules').val('Update');
                            alert('Updated');
                        });

                        var data = redirect_rules.load();
                        var json = $.parseJSON(data);
                        rules_table.add_rows(json);
                        rules_table.createRows(2);
                        $('#loader').css('display', 'none');
                    });

                </script>
            </head>
            <body>
                <div id="loader" style="height:100%; width:100%; position: fixed; background-color: white;">
                    <h1 style="position: fixed; top:35%; left:45%">Loading...</h1>
                </div>
                <h1>Welcome to SURLS: Simple URL Shortener </h1>
                <table>
                    <thead>
                        <tr><th>S.No.</th><th>Enabled</th><th>Status Code</th><th>Alias (No Space)</th><th>URL</th></tr>
                    </thead>
                    <tbody id="real_rules">
                    </tbody>
                    <tfoot style="display: none;">
                        <tr id="sample_rule">
                            <td><label class="rule_serial_number"></label></td>
                            <td><input type="checkbox" class="rule_enabled"/></td>
                            <td><select class="rule_http_status_code">
                                    <option value="302">302</option><option value="301">301</option>
                                </select></td>
                            <td><input type="text" class="rule_alias" style="width:200px" /></td>
                            <td><input type="text" class="rule_url" style="width:500px" /></td>
                            <td><input type="submit" class="rule_delete" value="Delete"/></td>
                        </tr>
                    </tfoot>
                </table>
                <input type="submit" id="rows_add" value="Add more rows"/><br />
                <br />
                <input id="update_rules" style="width:100%;height:35px" type="submit" value="Update"/><br /><br />
                <input id="op_mom" style="width:100%;height:35px" type="submit" value="Refresh"/>
            </body>
        </html>
        <?php 
    }
 /**
 * creates the content for all item-types
 *
 * @access  private
 * @param   string   $itemID the item-heas id
 * @return  string   the item content (html)
 */
 function getItemContent($itemID)
 {
     $content = "";
     if ($this->getItemMessage($itemID)) {
         $table = new HTML("table");
         $table->addAttr("width", "99%");
         $table->addAttr("cellpadding", "2");
         $table->addAttr("cellspacing", "2");
         $table->addAttr("style", "font-size:10pt;");
         $tr = new HTML("tr");
         $td = new HTML("td");
         $td->addHTMLContent($this->getItemMessage($itemID));
         $tr->addContent($td);
         $table->addContent($tr);
         $content .= "<br>" . $table->createContent();
     }
     $content .= "<form action=\"" . URLHelper::getLink($this->getSelf("item_id={$itemID}", 1)) . "\" method=\"POST\" style=\"display:inline;\">\n";
     $content .= CSRFProtection::tokenTag();
     $content .= "<br>";
     $mode = $this->getInstance($itemID);
     switch ($mode) {
         case ROOT_BLOCK:
             $content .= $this->createTitleInput(ROOT_BLOCK) . $this->createGlobalFeatures() . $this->createButtonbar(ROOT_BLOCK);
             break;
         case ARRANGMENT_BLOCK:
             $content .= $this->createTitleInput(ARRANGMENT_BLOCK);
             $group =& $this->tree->getGroupObject($itemID);
             if ($children = $group->getChildren()) {
                 if ($this->getInstance($children[0]->getObjectID()) == ARRANGMENT_BLOCK) {
                     $show = ARRANGMENT_BLOCK;
                 } else {
                     $show = QUESTION_BLOCK;
                 }
             } else {
                 $show = "both";
             }
             $content .= $this->createButtonbar($show);
             break;
         case QUESTION_BLOCK:
             $content .= $this->createTitleInput(QUESTION_BLOCK) . $this->createQuestionFeatures() . $this->createQuestionForm() . $this->createButtonbar(NULL);
             break;
     }
     $content .= "</form>\n";
     return $content;
 }
Example #14
0
 function deleteGroup_action()
 {
     if (Request::submitted('delete')) {
         CSRFProtection::verifyRequest();
         $this->group->delete();
         $this->redirect('contact/index');
     }
 }
Example #15
0
function mail_explain()
{
    echo _('Sie haben Ihre E-Mail-Adresse geändert. Um diese frei zu schalten müssen Sie den Ihnen an Ihre neue Adresse zugeschickten Aktivierungs Schlüssel im unten stehenden Eingabefeld eintragen.');
    echo '<br><form action="' . URLHelper::getLink() . '" method="post">' . CSRFProtection::tokenTag() . '<input type="text" name="key"><input name="uid" type="hidden" value="' . htmlReady(Request::option('uid')) . '"><br>' . Button::createAccept() . '</form><br><br>';
}
Example #16
0
}
?>
        <? endif ?>
        <? endif ?>
        <label for="infotext" class="caption">
            <?php 
echo _('Weitere Hinweise für die Teilnehmenden:');
?>
        </label>
        <textarea cols="60" rows="3" name="infotext"><?php 
echo $courseset ? htmlReady($courseset->getInfoText()) : '';
?>
</textarea>
    </fieldset>
        <div class="submit_wrapper" data-dialog-button>
            <?php 
echo CSRFProtection::tokenTag();
?>
            <?php 
echo Button::createAccept(_('Speichern'), 'submit', $instant_course_set_view ? array('data-dialog' => '') : array());
?>
            <?php 
echo LinkButton::createCancel(_('Abbrechen'), $controller->url_for('admission/courseset'));
?>
        </div>

</form>
<? if (Request::get('is_copy')) :?>
    <script>STUDIP.Admission.toggleNotSavedAlert();</script>
<? endif ?>
Example #17
0
 /**
  * updates studygroups with respect to the corresponding form data
  *
  * @param string id of a studygroup
  *
  * @return void
  */
 function update_action($id)
 {
     global $perm;
     // if we are permitted to edit the studygroup get some data...
     if ($perm->have_studip_perm('dozent', $id)) {
         $errors = array();
         $admin = $perm->have_studip_perm('admin', $id);
         $founders = StudygroupModel::getFounders($id);
         $sem = new Seminar($id);
         $sem_class = $GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$sem->status]['class']];
         CSRFProtection::verifyUnsafeRequest();
         if (Request::get('abort_deactivate')) {
             // let's do nothing and go back to the studygroup
             return $this->redirect('course/studygroup/edit/' . $id);
         } else {
             if (Request::get('really_deactivate')) {
                 $modules = Request::optionArray('deactivate_modules');
                 $plugins = Request::optionArray('deactivate_plugins');
                 // really deactive modules
                 // 1. Modules
                 if (is_array($modules)) {
                     $mods = new Modules();
                     $admin_mods = new AdminModules();
                     $bitmask = $sem->modules;
                     foreach ($modules as $key) {
                         $module_name = $sem_class->getSlotModule($key);
                         if ($module_name && ($sem_class->isModuleMandatory($module_name) || !$sem_class->isModuleAllowed($module_name))) {
                             continue;
                         }
                         $mods->clearBit($bitmask, $mods->registered_modules[$key]["id"]);
                         $methodDeactivate = "module" . ucfirst($key) . "Deactivate";
                         if (method_exists($admin_mods, $methodDeactivate)) {
                             $admin_mods->{$methodDeactivate}($sem->id);
                             $studip_module = $sem_class->getModule($key);
                             if (is_a($studip_module, "StandardPlugin")) {
                                 PluginManager::getInstance()->setPluginActivated($studip_module->getPluginId(), $id, false);
                             }
                         }
                     }
                     $sem->modules = $bitmask;
                     $sem->store();
                 }
                 // 2. Plugins
                 if (is_array($plugins)) {
                     $plugin_manager = PluginManager::getInstance();
                     $available_plugins = StudygroupModel::getInstalledPlugins();
                     foreach ($plugins as $class) {
                         $plugin = $plugin_manager->getPlugin($class);
                         // Deaktiviere Plugin
                         if ($available_plugins[$class] && !$sem_class->isModuleMandatory($class) && !$sem_class->isSlotModule($class)) {
                             $plugin_manager->setPluginActivated($plugin->getPluginId(), $id, false);
                         }
                     }
                 }
                 // Success message
                 $this->flash['success'] .= _("Inhaltselement(e) erfolgreich deaktiviert.");
                 return $this->redirect('course/studygroup/edit/' . $id);
             } else {
                 if (Request::submitted('replace_founder')) {
                     // retrieve old founder
                     $old_dozent = current(StudygroupModel::getFounder($id));
                     // remove old founder
                     StudygroupModel::promote_user($old_dozent['uname'], $id, 'tutor');
                     // add new founder
                     $new_founder = Request::option('choose_founder');
                     StudygroupModel::promote_user(get_username($new_founder), $id, 'dozent');
                     //checks
                 } else {
                     // test whether we have a group name...
                     if (!Request::get('groupname')) {
                         $errors[] = _("Bitte Gruppennamen angeben");
                         //... if so, test if this is not taken by another group
                     } else {
                         $query = "SELECT 1 FROM seminare WHERE name = ? AND Seminar_id != ?";
                         $statement = DBManager::get()->prepare($query);
                         $statement->execute(array(Request::get('groupname'), $id));
                         if ($statement->fetchColumn()) {
                             $errors[] = _("Eine Veranstaltung/Studiengruppe mit diesem Namen existiert bereits. Bitte wählen Sie einen anderen Namen");
                         }
                     }
                     if (count($errors)) {
                         $this->flash['errors'] = $errors;
                         $this->flash['edit'] = true;
                         // Everything seems fine, let's update the studygroup
                     } else {
                         $sem->name = Request::get('groupname');
                         // seminar-class quotes itself
                         $sem->description = Request::get('groupdescription');
                         // seminar-class quotes itself
                         $sem->read_level = 1;
                         $sem->write_level = 1;
                         $sem->visible = 1;
                         if (Request::get('groupaccess') == 'all') {
                             $sem->admission_prelim = 0;
                         } else {
                             $sem->admission_prelim = 1;
                             if (Config::get()->STUDYGROUPS_INVISIBLE_ALLOWED && Request::get('groupaccess') == 'invisible') {
                                 $sem->visible = 0;
                             }
                             $sem->admission_prelim_txt = _("Die ModeratorInnen der Studiengruppe können Ihren Aufnahmewunsch bestätigen oder ablehnen. Erst nach Bestätigung erhalten Sie vollen Zugriff auf die Gruppe.");
                         }
                         // get the current bitmask
                         $mods = new Modules();
                         $admin_mods = new AdminModules();
                         $bitmask = $sem->modules;
                         // de-/activate modules
                         $available_modules = StudygroupModel::getInstalledModules();
                         $orig_modules = $mods->getLocalModules($sem->id, "sem");
                         $active_plugins = Request::getArray("groupplugin");
                         $deactivate_modules = array();
                         foreach (array_keys($available_modules) as $key) {
                             $module_name = $sem_class->getSlotModule($key);
                             if (!$module_name || $module_name && ($sem_class->isModuleMandatory($module_name) || !$sem_class->isModuleAllowed($module_name))) {
                                 continue;
                             }
                             if (!$module_name) {
                                 $module_name = $key;
                             }
                             if ($active_plugins[$module_name]) {
                                 // activate modules
                                 $mods->setBit($bitmask, $mods->registered_modules[$key]["id"]);
                                 if (!$orig_modules[$key]) {
                                     $methodActivate = "module" . ucfirst($key) . "Activate";
                                     if (method_exists($admin_mods, $methodActivate)) {
                                         $admin_mods->{$methodActivate}($sem->id);
                                         $studip_module = $sem_class->getModule($key);
                                         if (is_a($studip_module, "StandardPlugin")) {
                                             PluginManager::getInstance()->setPluginActivated($studip_module->getPluginId(), $id, true);
                                         }
                                     }
                                 }
                             } else {
                                 // prepare for deactivation
                                 // (user will have to confirm)
                                 if ($orig_modules[$key]) {
                                     $deactivate_modules[] = $key;
                                 }
                             }
                         }
                         $this->flash['deactivate_modules'] = $deactivate_modules;
                         $sem->modules = $bitmask;
                         $sem->store();
                         // de-/activate plugins
                         $available_plugins = StudygroupModel::getInstalledPlugins();
                         $plugin_manager = PluginManager::getInstance();
                         $deactivate_plugins = array();
                         foreach ($available_plugins as $key => $name) {
                             $plugin = $plugin_manager->getPlugin($key);
                             $plugin_id = $plugin->getPluginId();
                             if ($active_plugins[$key] && $name && $sem_class->isModuleAllowed($key)) {
                                 $plugin_manager->setPluginActivated($plugin_id, $id, true);
                             } else {
                                 if ($plugin_manager->isPluginActivated($plugin_id, $id) && !$sem_class->isSlotModule($key)) {
                                     $deactivate_plugins[$plugin_id] = $key;
                                 }
                             }
                         }
                         $this->flash['deactivate_plugins'] = $deactivate_plugins;
                     }
                 }
             }
         }
     }
     if (!$this->flash['errors'] && !$deactivate_modules && !$deactivate_plugins) {
         // Everything seems fine
         $this->flash['success'] = _("Die Änderungen wurden erfolgreich übernommen.");
     }
     // let's go to the studygroup
     $this->redirect('course/studygroup/edit/' . $id);
 }
Example #18
0
 /**
  * Delete a group
  */
 public function sortAlphabetic_action($group_id)
 {
     $this->check('edit');
     $this->group = new Statusgruppen($group_id);
     if (Request::submitted('confirm')) {
         CSRFProtection::verifySecurityToken();
         $this->group->sortMembersAlphabetic();
         $this->redirect('admin/statusgroups/index');
     }
 }
Example #19
0
 /**
  * Saves the given user list to database.
  * 
  * @param String $userlistId user list to save
  */
 public function save_action($userlistId = '')
 {
     CSRFProtection::verifyUnsafeRequest();
     $userlist = new AdmissionUserList($userlistId);
     $userlist->setName(Request::get('name'))->setFactor(Request::float('factor'))->setUsers(Request::getArray('users'))->setOwnerId($GLOBALS['user']->id);
     if ($userlist->store()) {
         PageLayout::postSuccess(_('Die Personenliste wurde gespeichert.'));
     } else {
         PageLayout::postError(_('Die Personenliste konnte nicht gespeichert werden.'));
     }
     $this->redirect('admission/userlist');
 }
Example #20
0
    function navigator()
    {
        global $cssSw, $view_mode;

        //match start_time & end_time for a whole week
        $dow = date ("w", $this->start_time);
        if (date ("w", $this->start_time) >1)
            $offset = 1 - date ("w", $this->start_time);
        if (date ("w", $this->start_time) <1)
            $offset = -6;
        $start_time = mktime (0, 0, 0, date("n",$this->start_time), date("j", $this->start_time)+$offset+($this->week_offset*7), date("Y", $this->start_time));
        $end_time = mktime (23, 59, 0, date("n",$start_time), date("j", $start_time)+6, date("Y", $start_time));

        ?>
        <table border=0 celpadding=2 cellspacing=0 width="99%" align="center">
            <form method="POST" action="<?echo URLHelper::getLink('?navigate=TRUE&quick_view=view_schedule&quick_view_mode='.$view_mode)?>">
            <?= CSRFProtection::tokenTag() ?>
            <tr>
                <td class="<? $cssSw->switchClass(); echo $cssSw->getClass() ?>" width="4%">&nbsp;
                </td>
                <td class="<? echo $cssSw->getClass() ?>" width="96%" colspan="2"><font size=-1><b><?=_("Zeitraum:")?></b></font>
                </td>
            </tr>
            <tr>
                <td class="<? echo $cssSw->getClass() ?>" width="4%" rowspan="2">&nbsp;
                </td>
                <td class="<? echo $cssSw->getClass() ?>" width="30%" rowspan="2" valign="middle"><font size=-1>
                    <font size=-1>Beginn:
                    <input type="text" id="startTime" name="startTime" size="8" value="<?if($start_time) : ?><?=date('j.n.Y', $start_time)?><?endif;?>">
                    <script>
                        jQuery("#startTime").datepicker();
                    </script>
                    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;<?= Button::create(_('Auswählen'), 'jump') ?>
                </td>
                <td class="<? echo $cssSw->getClass() ?>" width="66%" valign="bottom"><font size=-1>
                    <input type="text" name="schedule_length_factor" size=2 maxlength=2 / value="<? if (!$this->length_factor) echo "1"; else echo $this->length_factor; ?>">
                    &nbsp; <select name="schedule_length_unit">
                        <option <? if ($this->length_unit  == "d") echo "selected" ?> value="d"><?=_("Tag(e)")?></option>
                        <option <? if ($this->length_unit  == "w") echo "selected" ?> value="w"><?=_("Woche(n)")?></option>
                        <option <? if ($this->length_unit  == "m") echo "selected" ?> value="m"><?=_("Monat(e)")?></option>
                        <option <? if ($this->length_unit  == "y") echo "selected" ?> value="y"><?=_("Jahre(e)")?></option>
                    </select>
                    <?= Button::create(_('Als Liste ausgeben'), 'start_list') ?>
                </td>
            </tr>
            <tr>
                <td class="<? echo $cssSw->getClass() ?>" width="66%" valign="bottom">
                    <i>oder</i>
                    <?= Button::create(_('Eine Woche grafisch ausgeben'), 'start_graphical') ?>
                </td>
            </tr>
        </table>
    <?
    }
Example #21
0
 /**
  * Deletes the given entry from step registry.
  * @param $id ID of the entry to delete
  */
 public function delete_action($id)
 {
     CSRFProtection::verifyUnsafeRequest();
     if (Request::submitted('delete')) {
         $step = CourseWizardStepRegistry::find($id);
         if ($step) {
             $name = $step->name;
             if (CourseWizardStepRegistry::unregisterStep($id)) {
                 PageLayout::postMessage(MessageBox::success(sprintf(_('Der Schritt "%s" wurde gelöscht.'), $name)));
             } else {
                 PageLayout::postMessage(MessageBox::error(sprintf(_('Der Schritt %s konnte nicht gelöscht werden.'), $name)));
             }
         }
     }
     $this->redirect($this->url_for('admin/coursewizardsteps'));
 }
Example #22
0
 /**
  * save tour data
  * 
  * @param String $tour_id    tour id
  */
 function save_action($tour_id = '')
 {
     // check permission
     $GLOBALS['perm']->check('root');
     // initialize
     Navigation::activateItem('/admin/config/tour');
     $this->tour = new HelpTour($tour_id);
     if ($tour_id and $this->tour->isNew()) {
         throw new AccessDeniedException(_('Die Tour mit der angegebenen ID existiert nicht.'));
     }
     if (Request::submitted('save_tour_details')) {
         CSRFProtection::verifySecurityToken();
         $this->tour->name = trim(Request::get('tour_name'));
         $this->tour->description = trim(Request::get('tour_description'));
         if (Request::option('tour_language')) {
             $this->tour->language = Request::option('tour_language');
         }
         $this->tour->type = Request::option('tour_type');
         $this->tour->settings->access = Request::option('tour_access');
         $this->tour->roles = implode(',', Request::getArray('tour_roles'));
         if ($this->tour->isNew()) {
             $this->tour->global_tour_id = md5(uniqid('help_tours', 1));
             $this->tour->settings->active = 0;
         }
         $this->tour->author_email = $GLOBALS['user']->Email;
         $this->tour->studip_version = $GLOBALS['SOFTWARE_VERSION'];
         if ($this->tour->validate()) {
             $this->tour->store();
             if (!count($this->tour->steps)) {
                 $step_data = array('title' => '', 'tip' => _('(Neue Tour)'), 'interactive' => 0, 'route' => trim(Request::get('tour_startpage')), 'css_selector' => '', 'action_prev' => '', 'action_next' => '', 'orientation' => '', 'mkdate' => time(), 'author_email' => $GLOBALS['user']->Email);
                 $this->tour->addStep($step_data, 1);
                 $this->tour_startpage = trim(Request::get('tour_startpage'));
             }
             PageLayout::postMessage(MessageBox::success(_('Die Angaben wurden gespeichert.')));
         } else {
             $roles = '';
             if (count(Request::getArray('tour_roles'))) {
                 foreach (Request::getArray('tour_roles') as $role) {
                     $roles .= '&tour_roles[]=' . $role;
                 }
             }
             $this->redirect('tour/admin_details?tour_name=' . Request::get('tour_name') . '&tour_language=' . Request::get('tour_language') . '&tour_description=' . Request::get('tour_description') . '&tour_type=' . Request::get('tour_type') . '&tour_access=' . Request::get('tour_access') . '&tour_startpage=' . Request::get('tour_startpage') . $roles);
         }
     }
     $this->redirect('tour/admin_details/' . $this->tour->tour_id);
 }
Example #23
0
    function editContent ($content, $submit, $class = "") {
        if (!$class) {
            $this->css->resetClass();
            $this->css->switchClass();
            $class = $this->css->getClass();
        }

        $out = "\n<!-- BEGIN Content -->\n";
        $out .= "<tr><td class=\"$class\" width=\"100%\" align=\"left\">\n";
        $out .= '<form name="edit_form" action="' . URLHelper::getLink('?com=store#anker') .  '" method="post">';
        $out .= CSRFProtection::tokenTag();
        $out .= "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\">\n";
        $out .= "<tr>" . printcontent("100%", FALSE, $content, "", FALSE) . "</tr>";
        $out .= "$submit</table>\n</form>\n</td></tr>\n";
        $out .= "<!-- END Content -->\n";

        return $out;
    }
Example #24
0
 /**
  * Does the current rule allow the given user to register as participant
  * in the given course? Here, a given password (via the getInput method) is
  * compared to the stored encrypted one.
  *
  * @param  String userId
  * @param  String courseId
  * @return Boolean
  */
 public function ruleApplies($userId, $courseId)
 {
     $errors = array();
     if ($this->checkTimeFrame()) {
         if (Request::get('pwarule_password') === null) {
             $errors[] = _('Die Eingabe eines Passwortes ist erforderlich.');
         } else {
             CSRFProtection::verifyUnsafeRequest();
             $pwcheck = $this->hasher->CheckPassword(Request::get('pwarule_password'), $this->getPassword());
             //migrated passwords
             $pwcheck_m = $this->hasher->CheckPassword(md5(Request::get('pwarule_password')), $this->getPassword());
             if (!($pwcheck || $pwcheck_m)) {
                 $errors[] = $this->getMessage();
             }
         }
     }
     return $errors;
 }
Example #25
0
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
// +---------------------------------------------------------------------------+

use Studip\Button, Studip\LinkButton;

require_once ("$PATH_EXPORT/export_xslt_vars.inc.php");   // XSLT-Variablen

$semester = new SemesterData;

$export_pagename = _("Datenexport - Startseite");

$export_info = _("Bitte wählen Sie Datenart und Einrichtung.") . "<br>";

$export_pagecontent .= "<form method=\"POST\" action=\"" . URLHelper::getURL() . "\">";

$export_pagecontent .= CSRFProtection::tokenTag();

$export_pagecontent .="<br><b>". _("Bitte wählen Sie eine Einrichtung: ") .  "</b><br><select name=\"range_id\">";

// Prepare institutes statement for faculty
$query = "SELECT Institut_id, Name
          FROM Institute
          WHERE fakultaets_id = ? AND institut_id != fakultaets_id
          ORDER BY Name";
$inst_statement = DBManager::get()->prepare($query);

// Prepare and execute faculties statement
$query = "SELECT Institut_id, Name, fakultaets_id
          FROM Institute
          WHERE fakultaets_id = Institut_id
          ORDER BY Name";
Example #26
0
    /**
     *
     * @param $request_id
     */
    function showRequest($request_id)
    {
        global $cssSw, $perm;

        $reqObj = new RoomRequest($request_id);
        $semObj = new Seminar($reqObj->getSeminarId());
        $sem_link = $perm->have_studip_perm('tutor', $semObj->getId()) ?
            "seminar_main.php?auswahl=" . $semObj->getId() :
            "dispatch.php/course/details/?sem_id=" . $semObj->getId() . "&send_from_search=1&send_from_search_page="
            . URLHelper::getLink("resources.php?working_on_request=$request_id");
        ?>
        <form method="POST" action="<?echo URLHelper::getLink('?working_on_request=' . $request_id);?>">
        <?php 
echo CSRFProtection::tokenTag();
?>
        <input type="hidden" name="view" value="edit_request">
        <table border=0 celpadding=2 cellspacing=0 width="99%" align="center">
            <tr>
                <td class="<? $cssSw->switchClass(); echo $cssSw->getClass() ?>" width="4%">&nbsp;
                </td>
                <td class="<? echo $cssSw->getClass() ?>" colspan="2" width="96%" valign="top">
                    <a href="<?php 
echo URLHelper::getLink($sem_link);
?>
">
                        <b><?php 
echo $semObj->seminar_number ? htmlReady($semObj->seminar_number) . ':' : '';
echo htmlReady($semObj->getName());
?>
</b>
                    </a>
                    <font size="-1">
                        <br>
                        <?
                        $names = $this->selectSemInstituteNames($semObj->getInstitutId());

                        print "&nbsp;&nbsp;&nbsp;&nbsp;"._("Art der Anfrage").": ".$reqObj->getTypeExplained()."<br>";
                        print "&nbsp;&nbsp;&nbsp;&nbsp;"._("Erstellt von").": <a href=\"".URLHelper::getLink('dispatch.php/profile?username='******'%x %H:%M', $reqObj->mkdate) . '<br>';
                        print "&nbsp;&nbsp;&nbsp;&nbsp;"._("Letzte Änderung") . ": ". strftime('%x %H:%M', $reqObj->chdate) . '<br>';
                        print "&nbsp;&nbsp;&nbsp;&nbsp;"._("Letzte Änderung von") . ": <a href=\"".URLHelper::getLink('dispatch.php/profile?username='******': ';
                        foreach ($semObj->getMembers('dozent') as $doz) {
                            if ($dozent){
                                echo ", ";
                            }
                            echo '<a href ="'. URLHelper::getLink('dispatch.php/profile?username='******'username']). '">'.HtmlReady($doz['fullname'])."</a>";
                            $dozent = true;
                        }
                        print "<br>";
                        print "&nbsp;&nbsp;&nbsp;&nbsp;"._("verantwortliche Einrichtung").": ".htmlReady($names['inst_name'])."<br>";
                        print "&nbsp;&nbsp;&nbsp;&nbsp;"._("verantwortliche Fakultät").": ".htmlReady($names['fak_name'])."<br>";
                        print "&nbsp;&nbsp;&nbsp;&nbsp;"._("aktuelle Teilnehmerzahl").": ".$semObj->getNumberOfParticipants('total').'<br>';
                        ?>
                    </font>
                </td>
            </tr>
            <tr>
                <td class="<? $cssSw->switchClass(); echo $cssSw->getClass() ?>" width="4%">&nbsp;
                </td>
                <td class="<? echo $cssSw->getClass() ?>" width="35%" valign="top">
                    <font size="-1"><b><?php 
echo _("angeforderte Belegungszeiten");
?>
:</b><br><br>
                    <?
                    $dates = $semObj->getGroupedDates($reqObj->getTerminId(),$reqObj->getMetadateId());
                    if ($dates['first_event']) {
                            $i = 1;
                            if(is_array($dates['info']) && sizeof($dates['info']) > 0 ){
                                 foreach ($dates['info'] as $info) {
                                      $name = $info['name'];
                                      if ($info['weekend']) $name = '<span style="color:red">'. $info['name'] . '</span>';
                                          printf ("<font color=\"blue\"><i><b>%s</b></i></font>. %s<br>", $i, $name);
                                      $i++;
                                 }
                            }

                            if ($reqObj->getType() != 'date') {
                                echo _("regelmäßige Buchung ab").": ".strftime("%x", $dates['first_event']);
                            }
                     } else {
                            print _("nicht angegeben");
                     }
                    ?>
                    </font>
                </td>
                <td style="border-left:1px dotted black; background-color: #f3f5f8" width="51%" rowspan="4" valign="top">
                    <table cellpadding="2" cellspacing="0" border="0" width="90%">
                        <tr>
                            <td width="70%">
                                <font size="-1"><b><?php 
echo _("angeforderter Raum");
?>
:</b></font>
                            </td>
                            <?
                            unset($resObj);
                            $cols=0;
                            if (is_array($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["groups"]))
                                foreach ($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["groups"] as $key => $val) {
                                    $cols++;
                                    print "<td width=\"1%\" align=\"left\"><font size=\"-1\" color=\"blue\"><i><b>".$cols.".</b></i></font></td>";
                                }
                            ?>
                            <td width="29%" align="right">
                                <!--<font style="font-size:10px;color:blue;"><?//=_("Kapazität")?></font>-->
                            </td>
                        </tr>
                        <tr>
                            <td width="70%">
                            <?
                            if ($request_resource_id = $reqObj->getResourceId()) {
                                $resObj = ResourceObject::Factory($request_resource_id);
                                print $resObj->getFormattedLink($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["first_event"]);
                                print tooltipicon(_('Der ausgewählte Raum bietet folgende der wünschbaren Eigenschaften:')
                                                  . "\n" . $resObj->getPlainProperties(TRUE),
                                                  $resObj->getOwnerId() == 'global');
                                if ($resObj->getOwnerId() == 'global') {
                                    print ' [global]';
                                }
                            } else
                                print _("Es wurde kein Raum angefordert.");

                            ?>
                            </td>
                            <?
                            $i=0;
                            if(is_array($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["groups"]) && sizeof($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["groups"]) > 0 )
                             foreach ($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["groups"] as $key => $val) {
                                print "<td width=\"1%\" nowrap><font size=\"-1\">";
                                if ($request_resource_id) {
                                    if ($request_resource_id == $val["resource_id"]) {
                                        print Icon::create('accept', 'accept', ['title' => _("Dieser Raum ist augenblicklich gebucht"), TRUE])->asImg();
                                        echo '<input type="radio" name="selected_resource_id['. $i .']" value="'. $request_resource_id .'" checked="checked">';
                                    } else {
                                        $overlap_status = $this->showGroupOverlapStatus($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["detected_overlaps"][$request_resource_id], $val["events_count"], $val["overlap_events_count"][$request_resource_id], $val["termin_ids"]);
                                        print $overlap_status["html"];
                                        printf ("<input type=\"radio\" name=\"selected_resource_id[%s]\" value=\"%s\" %s %s>",
                                            $i, $request_resource_id,
                                            ($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["selected_resources"][$i] == $request_resource_id) ? "checked" : "",
                                            ($overlap_status["status"] == 2 || !ResourcesUserRoomsList::CheckUserResource($request_resource_id)) ? "disabled" : "");
                                    }
                                } else
                                    print "&nbsp;";
                                print "</font></td>";
                                $i++;
                             }

                            ?>
                            <td width="29%" align="right">
                                <?
                                if (is_object($resObj)) {
                                    $seats = $resObj->getSeats();
                                    $requested_seats = $reqObj->getSeats();
                                    if ((is_numeric($seats)) && (is_numeric($requested_seats))) {
                                        $percent_diff = (100 / $requested_seats) * $seats;
                                        if ($percent_diff > 0)
                                            $percent_diff = "+".$percent_diff;
                                        if ($percent_diff < 0)
                                            $percent_diff = "-".$percent_diff;
                                        print "<font style=\"font-size:10px;\">".round($percent_diff)."%</font>";
                                    }
                                }
                                ?>
                            </td>
                        </tr>
                        <?
                        if (get_config('RESOURCES_ENABLE_GROUPING')) {
                            $room_group = RoomGroups::GetInstance();
                            $group_id = $_SESSION['resources_data']['actual_room_group'];
                            ?>
                        <tr>
                            <td style="border-top:1px solid;" width="100%" colspan="<?php 
echo $cols + 2;
?>
">
                                <font size="-1"><b><?php 
echo _("Raumgruppe berücksichtigen");
?>
:</b></font>
                            </td>
                        </tr>
                        <tr>
                        <td colspan="<?php 
echo $cols;
?>
"><font size="-1">
                        <select name="request_tool_choose_group">
                        <option <?php 
echo is_null($group_id) ? 'selected' : '';
?>
 value="-"><?php 
echo _("Keine Raumgruppe anzeigen");
?>
</option>
                        <?
                        foreach($room_group->getAvailableGroups() as $gid){
                        echo '<option value="'.$gid.'" '
                            . (!is_null($group_id) && $group_id == $gid ? 'selected' : '') . '>'
                            .htmlReady(my_substr($room_group->getGroupName($gid),0,45))
                            .' ('.$room_group->getGroupCount($gid).')</option>';
                        }
                        ?>
                        </select>
                        </font>
                        </td>
                        <td colspan="2"><font size="-1">
                        <?php 
echo Button::create(_('Auswählen'), 'request_tool_group');
?>
<br>
                        </font>
                        </td>
                        </tr>
                        <?
                        if ($room_group->getGroupCount($group_id)){
                            foreach ($room_group->getGroupContent($group_id) as $key) {
                        ?>
                        <tr>
                            <td width="70%">
                                <?
                                $resObj = ResourceObject::Factory($key);
                                print $resObj->getFormattedLink($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["first_event"]);
                                print tooltipicon(_('Der ausgewählte Raum bietet folgende der wünschbaren Eigenschaften:')
                                                  . "\n" . $resObj->getPlainProperties(TRUE),
                                                  $resObj->getOwnerId() == 'global');
                                if ($resObj->getOwnerId() == 'global') {
                                    print ' [global]';
                                }
                            ?>
                            </td>
                            <?
                            $i=0;
                            if (is_array($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["groups"])) {
                                foreach ($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["groups"] as $key2 => $val2) {
                                    print "<td width=\"1%\" nowrap><font size=\"-1\">";
                                    if ($key == $val2["resource_id"]) {
                                        print Icon::create('accept', 'accept', ['title' => _("Dieser Raum ist augenblicklich gebucht"), TRUE])->asImg();
                                        echo '<input type="radio" name="selected_resource_id['. $i .']" value="'. $key .'" checked="checked">';
                                    } else {
                                        $overlap_status = $this->showGroupOverlapStatus($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["detected_overlaps"][$key], $val2["events_count"], $val2["overlap_events_count"][$resObj->getId()], $val2["termin_ids"]);
                                        print $overlap_status["html"];
                                        printf ("<input type=\"radio\" name=\"selected_resource_id[%s]\" value=\"%s\" %s %s>", $i, $key,
                                        ($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["selected_resources"][$i] == $key) ? "checked" : "",
                                        ($overlap_status["status"] == 2 || !ResourcesUserRoomsList::CheckUserResource($key)) ? "disabled" : "");
                                    }
                                    print "</font></td>";
                                    $i++;
                                }
                            }
                            ?>
                            <td width="29%" align="right">
                                <?
                                if (is_object($resObj)) {
                                    $seats = $resObj->getSeats();
                                    $requested_seats = $reqObj->getSeats();
                                    if ((is_numeric($seats)) && (is_numeric($requested_seats))) {
                                        $percent_diff = (100 / $requested_seats) * $seats;
                                        if ($percent_diff > 0)
                                            $percent_diff = "+".$percent_diff;
                                        if ($percent_diff < 0)
                                            $percent_diff = "-".$percent_diff;
                                        print "<font style=\"font-size:10px;\">".round($percent_diff)."%</font>";
                                    }
                                }
                                ?>
                            </td>
                        </tr>
                        <?
                                }
                            }
                        }
                        ?>
                        <tr>
                            <td style="border-top:1px solid;" width="100%" colspan="<?php 
echo $cols + 2;
?>
">
                                <font size="-1"><b><?php 
echo _("weitere passende Räume");
?>
:</b>
                                </font>
                            </td>
                        </tr>
                        <?
                        if (is_array($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["considered_resources"]))
                            foreach ($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["considered_resources"] as $key=>$val) {
                                if ($val["type"] == "matching")
                                    $matching_rooms[$key] = TRUE;
                                if ($val["type"] == "clipped")
                                    $clipped_rooms[$key] = TRUE;
                                if ($val["type"] == "grouped")
                                    $grouped_rooms[$key] = TRUE;
                            }

                        if (sizeof($matching_rooms)) {
                            // filter list to [search_limit_low]...[search_limit_high]
                            $search_limit_low = $_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["search_limit_low"];
                            $search_limit_high = $_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["search_limit_high"];
                            $matching_rooms = array_slice($matching_rooms, $search_limit_low, $search_limit_high - $search_limit_low);
                            foreach ($matching_rooms as $key=>$val) {
                            ?>
                        <tr>
                            <td width="70%">
                                <?
                                $resObj = ResourceObject::Factory($key);
                                print $resObj->getFormattedLink($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["first_event"]);
                                print tooltipicon(_('Der ausgewählte Raum bietet folgende der wünschbaren Eigenschaften:')
                                                  . "\n" . $resObj->getPlainProperties(TRUE),
                                                  $resObj->getOwnerId() == 'global');
                                if ($resObj->getOwnerId() == 'global') {
                                    print ' [global]';
                                }
                            ?>
                            </td>
                            <?
                            $i=0;
                            if (is_array($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["groups"])) {
                                foreach ($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["groups"] as $key2 => $val2) {
                                    print "<td width=\"1%\" nowrap><font size=\"-1\">";
                                    if ($key == $val2["resource_id"]) {
                                        print Icon::create('accept', 'accept', ['title' => _("Dieser Raum ist augenblicklich gebucht"), TRUE])->asImg();
                                        echo '<input type="radio" name="selected_resource_id['. $i .']" value="'. $key .'" checked="checked">';
                                    } else {
                                        $overlap_status = $this->showGroupOverlapStatus($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["detected_overlaps"][$key], $val2["events_count"], $val2["overlap_events_count"][$resObj->getId()], $val2["termin_ids"]);
                                        print $overlap_status["html"];
                                        printf ("<input type=\"radio\" name=\"selected_resource_id[%s]\" value=\"%s\" %s %s>",
                                        $i, $key, ($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["selected_resources"][$i] == $key) ? "checked" : "",
                                        ($overlap_status["status"] == 2 || !ResourcesUserRoomsList::CheckUserResource($key)) ? "disabled" : "");
                                    }
                                    print "</font></td>";
                                    $i++;
                                }
                            }
                            ?>
                            <td width="29%" align="right">
                                <?
                                if (is_object($resObj)) {
                                    $seats = $resObj->getSeats();
                                    $requested_seats = $reqObj->getSeats();
                                    if ((is_numeric($seats)) && (is_numeric($requested_seats))) {
                                        $percent_diff = (100 / $requested_seats) * $seats;
                                        if ($percent_diff > 0)
                                            $percent_diff = "+".$percent_diff;
                                        if ($percent_diff < 0)
                                            $percent_diff = "-".$percent_diff;
                                        print "<font style=\"font-size:10px;\">".round($percent_diff)."%</font>";
                                    }
                                }
                                ?>
                            </td>
                        </tr>
                            <?
                            }
                            ?>
                        <tr>
                            <td colspan="<?php 
echo $cols + 2;
?>
" align="center">
                                <font size="-1">
                                    <?php 
echo _("zeige Räume");
?>
                                    <a href="<?php 
echo URLHelper::getLink('?dec_limit_low=1');
?>
">-</a>
                                    <input type="text" name="search_rooms_limit_low" size="1" value="<?php 
echo $_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["search_limit_low"] + 1;
?>
">
                                    <a href="<?php 
echo URLHelper::getLink('?inc_limit_low=1');
?>
">+</a>

                                    bis
                                    <a href="<?php 
echo URLHelper::getLink('?dec_limit_high=1');
?>
">-</a>
                                    <input type="text" name="search_rooms_limit_high" size="1" value="<?php 
echo $_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["search_limit_high"];
?>
">
                                    <a href="<?php 
echo URLHelper::getLink('?inc_limit_high=1');
?>
">+</a>

                                    <?php 
echo Icon::create('arr_2up', 'sort', ['title' => 'ausgewählten Bereich anzeigen'])->asInput(array('name' => 'matching_rooms_limit_submit'));
?>
                                </font>
                            </td>
                        </tr>
                            <?
                        } else
                            print "<tr><td width=\"100%\" colspan=\"".($cols+1)."\"><font size=\"-1\">"._("keine gefunden")."</font></td></tr>";

                        //Clipped Rooms
                        if (sizeof($clipped_rooms)) {
                        ?>
                        <tr>
                            <td style="border-top:1px solid;" width="100%" colspan="<?php 
echo $cols + 2;
?>
">
                                <font size="-1"><b><?php 
echo _("Räume aus der Merkliste");
?>
:</b></font>
                            </td>
                        </tr>
                        <?
                            foreach ($clipped_rooms as $key=>$val) {
                        ?>
                        <tr>
                            <td width="70%">
                                <?
                                $resObj = ResourceObject::Factory($key);
                                print $resObj->getFormattedLink($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["first_event"]);
                                print tooltipicon(_('Der ausgewählte Raum bietet folgende der wünschbaren Eigenschaften:')
                                                  . "\n" . $resObj->getPlainProperties(TRUE),
                                                  $resObj->getOwnerId() == 'global');
                                if ($resObj->getOwnerId() == 'global') {
                                    print ' [global]';
                                }
                            ?>
                            </td>
                            <?
                            $i=0;
                            if (is_array($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["groups"])) {
                                foreach ($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["groups"] as $key2 => $val2) {
                                    print "<td width=\"1%\" nowrap><font size=\"-1\">";
                                    if ($key == $val2["resource_id"]) {
                                        print Icon::create('accept', 'clickable', ['title' => _('Dieser Raum ist augenblicklich gebucht'), TRUE])->asImg();
                                    } else {
                                        $overlap_status = $this->showGroupOverlapStatus($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["detected_overlaps"][$key], $val2["events_count"], $val2["overlap_events_count"][$resObj->getId()], $val2["termin_ids"]);
                                        print $overlap_status["html"];
                                        printf ("<input type=\"radio\" name=\"selected_resource_id[%s]\" value=\"%s\" %s %s>",
                                        $i, $key,
                                        ($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["selected_resources"][$i] == $key) ? "checked" : "",
                                        ($overlap_status["status"] == 2 || !ResourcesUserRoomsList::CheckUserResource($key)) ? "disabled" : "");
                                    }
                                    print "</font></td>";
                                    $i++;
                                }
                            }
                            ?>
                            <td width="29%" align="right">
                                <?
                                if (is_object($resObj)) {
                                    $seats = $resObj->getSeats();
                                    $requested_seats = $reqObj->getSeats();
                                    if ((is_numeric($seats)) && (is_numeric($requested_seats))) {
                                        $percent_diff = (100 / $requested_seats) * $seats;
                                        if ($percent_diff > 0)
                                            $percent_diff = "+".$percent_diff;
                                        if ($percent_diff < 0)
                                            $percent_diff = "-".$percent_diff;
                                        print "<font style=\"font-size:10px;\">".round($percent_diff)."%</font>";
                                    }
                                }
                                ?>
                            </td>
                        </font></td>
                        </tr>
                        <?
                            }
                        }
                        ?>
                    </table>
                </td>
            </tr>
            <tr>
                <td class="<? $cssSw->switchClass(); echo $cssSw->getClass() ?>" width="4%">&nbsp;
                </td>
                <td class="<? echo $cssSw->getClass() ?>" width="35%" valign="top">
                    <font size="-1"><b><?php 
echo _("gewünschte Raumeigenschaften");
?>
:</b><br><br>
                    <?
                    $properties = $reqObj->getProperties();
                    if (sizeof($properties)) {
                    ?>
                        <table width="99%" cellspacing="0" cellpadding="2" border="0">
                        <?

                        foreach ($properties as $key=>$val) {
                            ?>
                            <tr>
                                <td width="70%">
                                    <li><font size="-1"><?php 
echo htmlReady($val["name"]);
?>
</font></li>
                                </td>
                                <td width="30%"><font size="-1">
                                <?
                                switch ($val["type"]) {
                                    case "bool":
                                        /*printf ("%s", ($val["state"]) ?  htmlReady($val["options"]) : " - ");*/
                                    break;
                                    case "num":
                                    case "text":
                                        print htmlReady($val["state"]);
                                    break;
                                    case "select":
                                        $options=explode (";",$val["options"]);
                                        foreach ($options as $a) {
                                            if ($val["state"] == $a)
                                                print htmlReady($a);
                                        }
                                    break;
                                }
                                ?></font>
                                </td>
                            </tr>
                            <?
                        }
                        ?>
                        </table>
                        <?
                    } else
                        print _("Es wurden keine Raumeigenschaften gewünscht.");
                    ?>
                    </font>
                </td>
            </tr>
            <tr>
                <td class="<? $cssSw->switchClass(); echo $cssSw->getClass() ?>" width="4%">&nbsp;
                </td>
                <td class="<? echo $cssSw->getClass() ?>" width="35%" valign="top">
                    <font size="-1"><b><?php 
echo _("Kommentar des Anfragenden");
?>
:</b><br><br>
                    <?
                    if ($comment = $reqObj->getComment())
                        print $comment;
                    else
                        print _("Es wurde kein Kommentar eingegeben");
                    ?>
                    </font>
                </td>

            </tr>
            <tr>
                <td class="<? $cssSw->switchClass(); echo $cssSw->getClass() ?>" width="4%">&nbsp;
                </td>
                <td class="<? echo $cssSw->getClass() ?>" width="35%" valign="top">

                    <?
                    $user_status_mkdate = $reqObj->getUserStatus($GLOBALS['user']->id);
                    ?>
                    <b><?php 
echo "Benachrichtigungen";
?>
:</b><br>
                    <input type="radio" onChange="jQuery(this).closest('form').submit()" name="reply_recipients" id="reply_recipients_requester" value="requester" checked>
                    <label for="reply_recipients_requester">
                    <?php 
echo _("Ersteller");
?>
                    </label>
                    <input type="radio" onChange="jQuery(this).closest('form').submit()" name="reply_recipients" id="reply_recipients_lecturer" value="lecturer" <?php 
echo $reqObj->reply_recipients == 'lecturer' ? 'checked' : '';
?>
>
                    <label for="reply_recipients_lecturer">
                    <?php 
echo _("Ersteller und alle Lehrenden");
?>
                    </label>
                    <br>
                    <b><?php 
echo "Anfrage markieren";
?>
:</b><br>
                    <input type="radio" onChange="jQuery(this).closest('form').submit()" name="request_user_status" id="request_user_status_0" value="0" checked>
                    <label for="request_user_status_0">
                    <?php 
echo _("unbearbeitet");
?>
                    </label>
                    <input type="radio" onChange="jQuery(this).closest('form').submit()" name="request_user_status" id="request_user_status_1" value="1" <?php 
echo $user_status_mkdate ? 'checked' : '';
?>
>
                    <label for="request_user_status_1">
                    <?php 
echo _("bearbeitet");
?>
                    </label>
                    <br><br>
                    <b><?php 
echo _("Kommentar zur Belegung (intern)");
?>
:</b><br><br>
                    <textarea name="comment_internal" style="width: 90%" rows="2"></textarea>
                </td>
            </tr>

            <tr>
                <td class="<? $cssSw->switchClass(); echo $cssSw->getClass() ?>" width="4%">&nbsp;
                </td>
                <td class="<? echo $cssSw->getClass() ?>" colspan="2" width="96%" valign="top" align="center">
                    <div class="button-group">
                <?
                // can we dec?
                if ($_SESSION['resources_data']["requests_working_pos"] > 0) {
                    $d = -1;
                    if ($_SESSION['resources_data']["skip_closed_requests"])
                        while ((!$_SESSION['resources_data']["requests_open"][$_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"] + $d]["request_id"]]) && ($_SESSION['resources_data']["requests_working_pos"] + $d > 0))
                            $d--;
                    if ((sizeof($_SESSION['resources_data']["requests_open"]) > 1) && (($_SESSION['resources_data']["requests_open"][$_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"] + $d]["request_id"]]) || (!$_SESSION['resources_data']["skip_closed_requests"])))
                        $inc_possible = TRUE;
                }


                if ($inc_possible) {
                    echo Button::create('<< ' . _('Zurück'), 'dec_request');
                }


                echo Button::createCancel(_('Abbrechen'), 'cancel_edit_request');
                echo Button::create(_('Löschen'), 'delete_request');

                if ((($reqObj->getResourceId()) || (sizeof($matching_rooms)) || (sizeof($clipped_rooms)) || (sizeof($grouped_rooms))) &&
                    ((is_array($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["groups"])) || ($_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"]]["assign_objects"]))) {
                    echo Button::createAccept(_('Speichern'), 'save_state');
                    echo Button::createCancel(_('Ablehnen'), 'suppose_decline_request');
                }

                // can we inc?
                if ($_SESSION['resources_data']["requests_working_pos"] < sizeof($_SESSION['resources_data']["requests_working_on"])-1) {
                    $i = 1;
                    if ($_SESSION['resources_data']["skip_closed_requests"])
                        while ((!$_SESSION['resources_data']["requests_open"][$_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"] + $i]["request_id"]]) && ($_SESSION['resources_data']["requests_working_pos"] + $i < sizeof($_SESSION['resources_data']["requests_working_on"])-1))
                            $i++;
                    if ((sizeof($_SESSION['resources_data']["requests_open"]) > 1) && (($_SESSION['resources_data']["requests_open"][$_SESSION['resources_data']["requests_working_on"][$_SESSION['resources_data']["requests_working_pos"] + $i]["request_id"]]) || (!$_SESSION['resources_data']["skip_closed_requests"])))
                        $dec_possible = TRUE;
                }

                if ($dec_possible) {
                    echo Button::create(_('Weiter') . ' >>', 'inc_request');
                }
                ?>
                    </div>

                <?
                if (sizeof($_SESSION['resources_data']["requests_open"]) > 1)
                    printf ("<br><font size=\"-1\">" . _("<b>%s</b> von <b>%s</b> Anfragen in der Bearbeitung wurden noch nicht aufgelöst.") . "</font>", sizeof($_SESSION['resources_data']["requests_open"]), sizeof($_SESSION['resources_data']["requests_working_on"]));
                    printf ("<br><font size=\"-1\">" . _("Aktueller Request: ")."<b>%s</b></font>", $_SESSION['resources_data']["requests_working_pos"]+1);
                ?>
                </td>
            </tr>
        </table>
        </form>
        <br><br>
        <?
    }
Example #27
0
File: scm.php Project: ratbird/hope
 /**
  * Edits or creates a page.
  *
  * @param mixed $id Id of the page to edit; a new page will be created if
  *                  this parameter is omitted.
  */
 public function edit_action($id = null)
 {
     if (Request::submitted('submit')) {
         CSRFProtection::verifyUnsafeRequest();
         $scm = new StudipScmEntry($id);
         $scm->tab_name = Request::get('tab_name_template') ?: Request::get('tab_name');
         $scm->content = Studip\Markup::purifyHtml(Request::get('content'));
         $scm->user_id = $GLOBALS['user']->id;
         $scm->range_id = $GLOBALS['SessSemName'][1];
         if ($scm->isNew()) {
             $temp = StudipScmEntry::findByRange_id($GLOBALS['SessSemName'][1], 'ORDER BY position ASC');
             $scms = SimpleORMapCollection::createFromArray($temp);
             $max = max($scms->pluck('position'));
             $scm->position = $max + 1;
         }
         if ($scm->store() !== false) {
             $message = MessageBox::success(_('Die Änderungen wurden übernommen.'));
             PageLayout::postMessage($message);
         }
         $this->redirect('course/scm/' . $scm->id);
     }
     $this->scm = new StudipScmEntry($id);
     $this->set_title(_('Informationsseite bearbeiten') . ': ' . $this->scm->tab_name);
     Navigation::activateItem('/course/scm/' . $this->scm->id);
 }
Example #28
0
/**
 * generates proper text for confirmation question and removes range_id from news
 *
 *
 * @param $remove_array array with $news_id as key and array of range_ids as value
 * @param string $range_id
 * @return string text for confirmation question or empty string after removal
 */
function remove_news($remove_array)
{
    $confirmed = false;
    $question_text = array();
    if (!is_array($remove_array)) {
        return false;
    }
    if (Request::submitted('yes') and Request::isPost()) {
        CSRFProtection::verifySecurityToken();
        $confirmed = true;
    }
    foreach ($remove_array as $news_id => $ranges) {
        $remove_news = new StudipNews($news_id);
        $remove_news_title = $remove_news->getValue('topic');
        if (!is_array($ranges)) {
            $ranges = array($ranges);
        }
        // should we delete news completely
        if (count($ranges) == count($remove_news->getRanges())) {
            $text = delete_news($news_id);
            if ($text) {
                $question_text[] = $text;
            }
            // or just remove range_id(s)?
        } else {
            $text = '';
            if ($confirmed and !$remove_news->isNew() and count($ranges)) {
                foreach ($ranges as $key => $range_id) {
                    if ($remove_news->havePermission('unassign', $range_id)) {
                        $remove_news->deleteRange($range_id);
                    } else {
                        unset($ranges[$key]);
                        PageLayout::postMessage(MessageBox::error(sprintf(_('Keine Berechtigung zum Entfernen der Ankündigung "%s" aus diesem Bereich.'), htmlReady($remove_news->getValue('topic')))));
                    }
                    if (count($ranges)) {
                        if (count($ranges) == 1) {
                            PageLayout::postMessage(MessageBox::success(sprintf(_('Ankündigung "%s" wurde aus dem Bereich entfernt.'), htmlReady($remove_news->getValue('topic')))));
                        } else {
                            PageLayout::postMessage(MessageBox::success(sprintf(_('Ankündigung "%s" wurde aus %s Bereichen entfernt.'), htmlReady($remove_news->getValue('topic')), count($ranges))));
                        }
                        $remove_news->store();
                    }
                }
            } elseif (!$confirmed) {
                if (count($ranges) == 1) {
                    $text = sprintf(_('- Die Ankündigung "%s" wird aus dem aktiven Bereich entfernt. ' . 'Sie wird dadurch nicht endgültig gelöscht. Es wird nur die Zuordnung entfernt.'), $remove_news_title) . "\n";
                } elseif (count($ranges) > 1) {
                    $text = sprintf(_('- Die Ankündigung "%s" wird aus den %s gewählten Bereichen entfernt. ' . 'Sie wird dadurch nicht endgültig gelöscht. Es werden nur die Zuordnungen entfernt.'), $remove_news_title, count($ranges)) . "\n";
                }
            }
            if ($text) {
                $question_text[] = $text;
            }
        }
    }
    if (count($question_text) > 1) {
        return _('Wollen Sie die folgenden Aktionen jetzt ausführen?') . "\n" . implode($question_text);
    } elseif (count($question_text) == 1) {
        return _('Wollen Sie diese Aktion jetzt ausführen?') . "\n" . implode($question_text);
    }
}
Example #29
0
 public function propose_usage_action($plugin_id)
 {
     $this->plugin = new MarketPlugin($plugin_id);
     // Submit propose usage
     if (Request::submitted('propose')) {
         CSRFProtection::verifyUnsafeRequest();
         MarketPluginUsage::create(array('plugin_id' => $plugin_id, 'user_id' => User::findCurrent()->id, 'name' => Request::get('used_at')));
         $this->redirect('presenting/details/' . $plugin_id);
     }
     $this->most_used = DBManager::get()->fetchFirst('SELECT name FROM pluginmarket_plugin_usages WHERE user_id = ? AND name NOT IN (SELECT name FROM pluginmarket_plugin_usages WHERE plugin_id = ?) GROUP BY name ORDER BY count(*)', array(User::findCurrent()->id, $plugin_id));
 }
 function getEditItemContent()
 {
     $content .= "\n<form name=\"item_form\" action=\"" . URLHelper::getLink($this->getSelf("cmd=InsertItem&item_id={$this->edit_item_id}")) . "\" method=\"POST\">";
     $content .= CSRFProtection::tokenTag();
     $content .= "\n<input type=\"HIDDEN\" name=\"parent_id\" value=\"{$this->tree->tree_data[$this->edit_item_id]['parent_id']}\">";
     if ($this->tree->isElement($this->edit_item_id)) {
         $content .= "\n<tr><td class=\"table_row_odd\"style=\"border-top: 1px solid black;border-left: 1px solid black;border-right: 1px solid black;\" ><b>" . _("Anmerkung zu einem Eintrag bearbeiten:") . "</b></td></tr>";
         $edit_name = "note";
         $rows = 5;
         $content .= "<tr><td class=\"table_row_even\" style=\"border-bottom: 1px solid black;border-left: 1px solid black;border-right: 1px solid black;\"><textarea name=\"edit_{$edit_name}\" style=\"width:99%\" rows=\"{$rows}\">" . htmlReady($this->tree->tree_data[$this->edit_item_id][$edit_name]) . "</textarea></td></tr>";
     } else {
         $content .= "\n<tr><td class=\"table_row_odd\" style=\"border-top: 1px solid black;border-left: 1px solid black;border-right: 1px solid black;\" ><b>" . _("Name der Liste bearbeiten:") . "</b></td></tr>";
         $content .= "<tr><td class=\"table_row_even\" align=\"center\" style=\"border-left: 1px solid black;border-right: 1px solid black;\"><input type=\"text\" name=\"edit_name\" style=\"width:99%\" value=\"" . htmlReady($this->tree->tree_data[$this->edit_item_id]['name']) . "\"></td></tr>";
         $edit_name = "format";
         $rows = 2;
         $content .= "\n<tr><td class=\"table_row_odd\" style=\"border-left: 1px solid black;border-right: 1px solid black;\" ><b>" . _("Formatierung der Liste bearbeiten:") . "</b>&nbsp;";
         $content .= Icon::create('info-circle', 'inactive', ['title' => $this->format_info])->asImg(['class' => 'text-top']);
         $content .= "</td></tr>";
         $content .= "<tr><td class=\"table_row_even\" align=\"center\" style=\"border-left: 1px solid black;border-right: 1px solid black;\"><textarea name=\"edit_{$edit_name}\" style=\"width:99%\" rows=\"{$rows}\">" . htmlReady($this->tree->tree_data[$this->edit_item_id][$edit_name]) . "</textarea></td></tr>";
         $content .= "\n<tr><td class=\"table_row_odd\" style=\"border-bottom: 1px solid black;;border-left: 1px solid black;border-right: 1px solid black;\" >\n            <b>" . _("Sichtbarkeit der Liste:") . "</b>&nbsp;&nbsp;&nbsp;\n            <input type=\"radio\" name=\"edit_visibility\" value=\"1\" style=\"vertical-align:bottom\" " . ($this->tree->tree_data[$this->edit_item_id]['visibility'] ? "checked" : "") . ">" . _("Ja") . "&nbsp;<input type=\"radio\" name=\"edit_visibility\" value=\"0\" style=\"vertical-align:bottom\" " . (!$this->tree->tree_data[$this->edit_item_id]['visibility'] ? "checked" : "") . ">" . _("Nein") . "</td></tr>";
     }
     $content .= "<tr><td class=\"table_row_even\">&nbsp;</td></tr><tr><td class=\"table_row_even\" align=\"center\">" . Button::createAccept(_('Speichern'), array('title' => _("Einstellungen speichern"))) . "&nbsp;" . LinkButton::createCancel(_('Abbrechen'), URLHelper::getURL($this->getSelf("cmd=Cancel&item_id=" . $this->edit_item_id)), array('Aktion abbrechen' => _('Aktion abbrechen'))) . '</td></tr>';
     $content .= "\n</form>";
     return $content;
 }