public function show_seminar_avatar($eventname, $search_item)
 {
     if ($search_item->type === "seminar") {
         $search_item->avatar = CourseAvatar::getAvatar($search_item->entry_id)->getURL(Avatar::MEDIUM);
         $seminar = new Seminar($search_item->entry_id);
         $date = $seminar->getDatesHTML(array('link_to_dates' => false));
         $search_item->presentation = "<div>";
         $key = 0;
         foreach ($seminar->getMembers('dozent') as $dozent) {
             if ($key > 0) {
                 $search_item->presentation .= ", ";
             }
             $search_item->presentation .= '<a href="' . URLHelper::getLink("about.php", array('username' => $dozent['username'])) . '">' . htmlReady($dozent['Vorname'] . " " . $dozent['Nachname']) . '</a>';
             $key++;
         }
         $search_item->presentation .= "</div>";
         $search_item->presentation .= "<div>";
         $search_item->presentation .= htmlReady(get_semester($search_item->entry_id) . ". ");
         if ($date) {
             $search_item->presentation .= _("Termine") . ": " . $date;
         }
         $search_item->presentation .= "</div>";
         if ($GLOBALS['perm']->have_perm("admin")) {
             $search_item->tools[] = '<a href="' . URLHelper::getLink("dispatch.php/course/basicdata/view", array('cid' => $search_item->entry_id)) . '" title="' . _("Grunddaten bearbeiten") . '">' . Assets::img("icons/16/blue/edit.png", array('class' => "text-bottom")) . "</a>";
             $search_item->tools[] = '<a href="' . URLHelper::getLink("dispatch.php/course/study_areas/show", array('cid' => $search_item->entry_id)) . '" title="' . _("Studienbereiche festlegen") . '">' . Assets::img("icons/16/blue/grouping.png", array('class' => "text-bottom")) . "</a>";
             $search_item->tools[] = '<a href="' . URLHelper::getLink("raumzeit.php", array('cid' => $search_item->entry_id)) . '" title="' . _("Zeiten/Räume") . '">' . Assets::img("icons/16/blue/date.png", array('class' => "text-bottom")) . "</a>";
             $search_item->tools[] = '<a href="' . URLHelper::getLink("dispatch.php/course/room_requests", array('cid' => $search_item->entry_id)) . '" title="' . _("Raumanfragen") . '">' . Assets::img("icons/16/blue/room_request.png", array('class' => "text-bottom")) . "</a>";
         }
     }
 }
예제 #2
0
    $messaging = new messaging;

    foreach ($_SESSION['resources_data']["requests_working_on"] as $val) {
        //$request_ids[] = $val["request_id"];
        $request_data[$val["request_id"]] = $val;
    }

    $reqObj = new RoomRequest($_sendMessage['request_id']);
    $semObj = new Seminar($_sendMessage['seminar_id']);

    // first we have to get all users to which the message will be sent
    // -> creator of request

    $users = Array($reqObj->getUserId());
    if ($reqObj->reply_recipients == 'lecturer') {
         $users = array_merge($users, array_keys($semObj->getMembers('dozent')));
    }

    // the room-request has been declined
    if ($_sendMessage['type'] == 'declined') {
        $decline_message = Request::get('decline_message');
        if ($semObj->seminar_number) {
            $message = sprintf(_("ABGELEHNTE RAUMANFRAGE: Ihre Raumanfrage zur Veranstaltung %s (%s) wurde abgelehnt.") . "\n\n" .
                _("Nachricht des Raumadministrators:") . "\n" . $decline_message, $semObj->getName(), $semObj->seminar_number);
        } else {
            $message = sprintf(_("ABGELEHNTE RAUMANFRAGE: Ihre Raumanfrage zur Veranstaltung %s wurde abgelehnt.") . "\n\n" .
                _("Nachricht des Raumadministrators:") . "\n" . $decline_message, $semObj->getName());
        }

        if ($reqObj->getTerminId()) {
            $termin = new SingleDate($reqObj->getTerminId());
예제 #3
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>
        <?
    }
예제 #4
0
파일: studygroup.php 프로젝트: ratbird/hope
 /**
  * displays a form for editing studygroups with corresponding data
  *
  * @param string id of a studygroup
  *
  * @return void
  */
 function edit_action($id)
 {
     global $perm;
     $this->flash->keep('deactivate_modules');
     $this->flash->keep('deactivate_plugins');
     PageLayout::setHelpKeyword('Basis.StudiengruppenBearbeiten');
     // if we are permitted to edit the studygroup get some data...
     if ($perm->have_studip_perm('dozent', $id)) {
         PageLayout::setTitle(getHeaderLine($id) . ' - ' . _('Studiengruppe bearbeiten'));
         Navigation::activateItem('/course/admin/main');
         $sem = new Seminar($id);
         $this->sem_id = $id;
         $this->sem = $sem;
         $this->sem_class = $GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$sem->status]['class']];
         $this->tutors = $sem->getMembers('tutor');
         $this->available_modules = StudygroupModel::getInstalledModules();
         $this->available_plugins = StudygroupModel::getInstalledPlugins();
         $this->enabled_plugins = StudygroupModel::getEnabledPlugins($id);
         $this->modules = new Modules();
         $this->founders = StudygroupModel::getFounders($id);
         $this->deactivate_modules_names = "";
         if ($this->flash['deactivate_modules']) {
             $amodules = new AdminModules();
             foreach ($this->flash['deactivate_modules'] as $key) {
                 $this->deactivate_modules_names .= "- " . $amodules->registered_modules[$key]['name'] . "\n";
             }
         }
         if ($this->flash['deactivate_plugins']) {
             foreach ($this->flash['deactivate_plugins'] as $key => $name) {
                 $plugin = PluginManager::getInstance()->getPluginById($key);
                 $p_warning = $plugin->deactivationWarning($id);
                 $this->deactivate_modules_names .= "- " . $name . ($p_warning ? " : " . $p_warning : "") . "\n";
             }
         }
         $actions = new ActionsWidget();
         $actions->addLink(_('Neue Studiengruppe anlegen'), $this->url_for('course/wizard?studygroup=1'), Icon::create('studygroup+add', 'clickable'));
         if ($GLOBALS['perm']->have_studip_perm('tutor', $id)) {
             $actions->addLink(_('Bild ändern'), $this->url_for('course/avatar/update/' . $id), Icon::create('edit', 'clickable'));
         }
         $actions->addLink(_('Diese Studiengruppe löschen'), $this->url_for('course/studygroup/delete/' . $id), Icon::create('trash', 'clickable'));
         Sidebar::get()->addWidget($actions);
     } else {
         $this->redirect(URLHelper::getURL('seminar_main.php?auswahl=' . $id));
     }
 }
예제 #5
0
파일: helpers.php 프로젝트: ratbird/hope
 function resource_message_action($resource_id)
 {
     $r_perms = new ResourceObjectPerms($resource_id, $GLOBALS['user']->id);
     if (!$r_perms->havePerm('admin')) {
         throw new AccessDeniedException();
     }
     $this->resource = new ResourceObject($resource_id);
     $title = sprintf(_("Nutzer von %s benachrichtigen"), htmlReady($this->resource->getName()));
     $form_fields['start_day'] = array('type' => 'text', 'size' => '10', 'required' => true, 'caption' => _("Belegungen berücksichtigen von"));
     $form_fields['start_day']['attributes'] = array('onMouseOver' => 'jQuery(this).datepicker();this.blur();', 'onChange' => '$(this).closest("form").submit();');
     $form_fields['start_day']['default_value'] = strftime('%x');
     $form_fields['end_day'] = array('type' => 'text', 'size' => '10', 'required' => true, 'caption' => _("Belegungen berücksichtigen bis"));
     $form_fields['end_day']['attributes'] = array('onMouseOver' => 'jQuery(this).datepicker();this.blur();', 'onChange' => '$(this).closest("form").submit();');
     $form_fields['end_day']['default_value'] = strftime('%x', strtotime('+6 months'));
     $form_fields['subject'] = array('type' => 'text', 'size' => '200', 'attributes' => array('style' => 'width:100%'), 'required' => true, 'caption' => _("Betreff"));
     $form_fields['subject']['default_value'] = $this->resource->getName();
     $form_fields['message'] = array('caption' => _("Nachricht"), 'type' => 'textarea', 'required' => true, 'attributes' => array('rows' => 4, 'style' => 'width:100%'));
     $form_buttons['save_close'] = array('caption' => _('OK'), 'info' => _("Benachrichtigung verschicken und Dialog schließen"));
     $form = new StudipForm($form_fields, $form_buttons, 'resource_message', false);
     $start_time = strtotime($form->getFormFieldValue('start_day'));
     $end_time = strtotime($form->getFormFieldValue('end_day'));
     $assign_events = new AssignEventList($start_time, $end_time, $resource_id, '', '', TRUE, 'all');
     $rec = array();
     while ($event = $assign_events->nextEvent()) {
         if ($owner_type = $event->getOwnerType()) {
             if ($owner_type == 'date') {
                 $seminar = new Seminar(Seminar::GetSemIdByDateId($event->getAssignUserId()));
                 foreach ($seminar->getMembers('dozent') as $dozent) {
                     $rec[$dozent['username']][] = strftime('%x %R', $event->begin) . ' - ' . strftime('%R', $event->end) . ' ' . $seminar->getName();
                 }
             } else {
                 $rec[get_username($event->getAssignUserId())][] = strftime('%x %R', $event->begin) . ' - ' . strftime('%R', $event->end);
             }
         }
     }
     if ($form->isSended() && count($rec) && $form->getFormFieldValue('message')) {
         $messaging = new Messaging();
         $ok = $messaging->insert_message($form->getFormFieldValue('message'), array_keys($rec), $GLOBALS['user']->id, null, null, null, '', $form->getFormFieldValue('subject'), true);
         PageLayout::postMessage(MessageBox::success(sprintf(_("Die Nachricht wurde an %s Nutzer verschickt"), $ok)));
         return $this->redirect(URLHelper::getUrl('resources.php?view=resources'));
     }
     if (!count($rec)) {
         PageLayout::postMessage(MessageBox::error(sprintf(_("Im Zeitraum %s - %s wurden keine Belegungen gefunden!"), strftime('%x', $start_time), strftime('%x', $end_time))));
         $this->no_receiver = true;
     } else {
         $submessage = array();
         foreach ($rec as $username => $slots) {
             $submessage[] = get_fullname_from_uname($username, 'full_rev_username', true) . ' ' . sprintf(_('(%s Belegungen)'), count($slots));
         }
         PageLayout::postMessage(MessageBox::info(sprintf(_("Benachrichtigung an %s Nutzer verschicken"), count($rec)), $submessage, true));
     }
     $this->form = $form;
     $this->response->add_header('X-Title', $title);
 }
예제 #6
0
파일: schedule.php 프로젝트: ratbird/hope
 /**
  * Return an entry for the specified course.
  *
  * @param string  $seminar_id  the ID of the course
  * @param string  $user_id     the ID of the user
  * @param mixed   $cycle_id    either false or the ID of the cycle
  * @param mixed   $semester    filter for this semester
  *
  * @return array  the course's entry
  */
 static function getSeminarEntry($seminar_id, $user_id, $cycle_id = false, $semester = false)
 {
     $ret = array();
     $filterStart = 0;
     $filterEnd = 0;
     // filter dates (and their rooms) if semester is passed
     if ($semester) {
         $filterStart = $semester['vorles_beginn'];
         $filterEnd = $semester['vorles_ende'];
     }
     $sem = new Seminar($seminar_id);
     foreach ($sem->getCycles() as $cycle) {
         if (!$cycle_id || $cycle->getMetaDateID() == $cycle_id) {
             $entry = array();
             $entry['id'] = $seminar_id . '-' . $cycle->getMetaDateId();
             $entry['cycle_id'] = $cycle->getMetaDateId();
             $entry['start_formatted'] = sprintf("%02d", $cycle->getStartStunde()) . ':' . sprintf("%02d", $cycle->getStartMinute());
             $entry['end_formatted'] = sprintf("%02d", $cycle->getEndStunde()) . ':' . sprintf("%02d", $cycle->getEndMinute());
             $entry['start'] = (int) $cycle->getStartStunde() * 100 + $cycle->getStartMinute();
             $entry['end'] = (int) $cycle->getEndStunde() * 100 + $cycle->getEndMinute();
             $entry['day'] = $cycle->getDay();
             $entry['content'] = $sem->getNumber() . ' ' . $sem->getName();
             $entry['title'] = $cycle->getDescription();
             // check, if the date is assigned to a room
             if ($rooms = $cycle->getPredominantRoom($filterStart, $filterEnd)) {
                 $entry['title'] .= implode('', getPlainRooms(array_slice($rooms, 0, 1))) . (sizeof($rooms) > 1 ? ', u.a.' : '');
             } else {
                 if ($rooms = $cycle->getFreeTextPredominantRoom($filterStart, $filterEnd)) {
                     unset($rooms['']);
                     if (!empty($rooms)) {
                         $entry['title'] .= '(' . implode('), (', array_slice(array_keys($rooms), 0, 3)) . ')';
                     }
                 }
             }
             // add the lecturer
             $lecturers = array();
             $members = $sem->getMembers('dozent');
             foreach ($members as $member) {
                 $lecturers[] = $member['Nachname'];
             }
             $entry['content'] .= " (" . implode(', ', array_slice($lecturers, 0, 3)) . (sizeof($members) > 3 ? ' et al.' : '') . ')';
             $entry['url'] = URLHelper::getLink('dispatch.php/calendar/schedule/entry/' . $seminar_id . '/' . $cycle->getMetaDateId());
             $entry['onClick'] = "function (id) {\n                    var ids = id.split('-');\n                    STUDIP.Schedule.showSeminarDetails(ids[0], ids[1]);\n                }";
             // check the settings for this entry
             $stmt2 = DBManager::get()->prepare("SELECT sc.*, IF(su.user_id IS NULL, 'virtual', 'sem') as type\n                    FROM schedule_seminare as sc\n                    LEFT JOIN seminar_user as su ON (su.user_id = sc.user_id AND su.Seminar_id = sc.seminar_id)\n                    WHERE sc.seminar_id = ? AND sc.user_id = ? AND sc.metadate_id = ?");
             $stmt2->execute(array($sem->getId(), $user_id, $cycle->getMetaDateId()));
             if ($details = $stmt2->fetch()) {
                 if ($details['type'] == 'virtual') {
                     $entry['color'] = $details['color'] ? $details['color'] : DEFAULT_COLOR_VIRTUAL;
                     $entry['icons'][] = array('image' => 'virtual.png', 'title' => _("Dies ist eine vorgemerkte Veranstaltung"));
                 } else {
                     $entry['color'] = $details['color'] ? $details['color'] : DEFAULT_COLOR_SEM;
                 }
                 $entry['type'] = $details['type'];
                 $entry['visible'] = $details['visible'];
             } else {
                 $entry['type'] = 'sem';
                 $entry['color'] = DEFAULT_COLOR_SEM;
                 $entry['visible'] = 1;
             }
             // show an unhide icon if entry is invisible
             if (!$entry['visible']) {
                 $entry['url'] .= '/?show_hidden=1';
                 $bind_url = URLHelper::getLink('dispatch.php/calendar/schedule/bind/' . $seminar_id . '/' . $cycle->getMetaDateId() . '/?show_hidden=1');
                 $entry['icons'][] = array('url' => $bind_url, 'image' => Icon::create('visibility-invisible', 'info_alt')->asImagePath(16), 'onClick' => "function(id) { window.location = '" . $bind_url . "'; }", 'title' => _("Diesen Eintrag wieder einblenden"));
             } else {
                 if ($entry['type'] != 'virtual') {
                     $unbind_url = URLHelper::getLink('dispatch.php/calendar/schedule/unbind/' . $seminar_id . '/' . $cycle->getMetaDateId());
                     $entry['icons'][] = array('url' => $unbind_url, 'image' => Icon::create('visibility-visible', 'info_alt')->asImagePath(16), 'onClick' => "function(id) { window.location = '" . $unbind_url . "'; }", 'title' => _("Diesen Eintrag ausblenden"));
                 }
             }
             $ret[] = $entry;
         }
     }
     return $ret;
 }
예제 #7
0
파일: studygroup.php 프로젝트: ratbird/hope
 /**
  * If a new user applies, an application note to all moderators and founders
  * of a studygroup will be automatically sent while calling this function.
  * The note contains the user's name and a direct link to the member page of the studygroup.
  *
  * @param string $sem_id id of a seminar / studygroup
  * @param strimg $user_id id of the applicant
  *
  * @return int                 number of recipients
  */
 function applicationNotice($sem_id, $user_id)
 {
     $sem = new Seminar($sem_id);
     $dozenten = $sem->getMembers();
     $tutors = $sem->getMembers('tutor');
     $recipients = array();
     $msging = new Messaging();
     foreach (array_merge($dozenten, $tutors) as $uid => $user) {
         $recipients[] = $user['username'];
     }
     if (studip_strlen($sem->getName()) > 32) {
         //cut subject if to long
         $subject = sprintf(_("[Studiengruppe: %s...]"), studip_substr($sem->getName(), 0, 30));
     } else {
         $subject = sprintf(_("[Studiengruppe: %s]"), $sem->getName());
     }
     if (StudygroupModel::isInvited($user_id, $sem_id)) {
         $subject .= " " . _("Einladung akzeptiert");
         $message = sprintf(_("%s hat die Einladung zur Studiengruppe %s akzeptiert. Klicken Sie auf den untenstehenden Link, um direkt zur Studiengruppe zu gelangen.\n\n [Direkt zur Studiengruppe]%s"), get_fullname($user_id), $sem->getName(), URLHelper::getlink($GLOBALS['ABSOLUTE_URI_STUDIP'] . "dispatch.php/course/studygroup/members/" . $sem->id, array('cid' => $sem->id)));
     } else {
         $subject .= " " . _("Neuer Mitgliedsantrag");
         $message = sprintf(_("%s möchte der Studiengruppe %s beitreten. Klicken Sie auf den untenstehenden Link, um direkt zur Studiengruppe zu gelangen.\n\n [Direkt zur Studiengruppe]%s"), get_fullname($user_id), $sem->getName(), URLHelper::getlink($GLOBALS['ABSOLUTE_URI_STUDIP'] . "dispatch.php/course/studygroup/members/" . $sem->id, array('cid' => $sem->id)));
     }
     return $msging->insert_message($message, $recipients, "____%system%____", '', '', '', '', $subject);
 }