Exemple #1
0
 /**
  * Displays a page.
  */
 public function index_action($id = null)
 {
     Navigation::activateItem('/course/literature/view');
     PageLayout::setTitle($_SESSION['SessSemName']["header_line"] . " - " . _("Literatur"));
     $this->list = StudipLitList::GetFormattedListsByRange($_SESSION["SessionSeminar"], object_get_visit($_SESSION["SessionSeminar"], "literature"));
     $this->_range_id = $_SESSION["SessionSeminar"];
 }
Exemple #2
0
 public function index_action()
 {
     if (Request::isPost() && Request::option("termin_id") && Request::get("topic_title")) {
         $date = new CourseDate(Request::option("termin_id"));
         $seminar_id = $date['range_id'];
         $title = Request::get("topic_title");
         $topic = CourseTopic::findByTitle($seminar_id, $title);
         if (!$topic) {
             $topic = new CourseTopic();
             $topic['title'] = $title;
             $topic['seminar_id'] = $seminar_id;
             $topic['author_id'] = $GLOBALS['user']->id;
             $topic['description'] = "";
             $topic->store();
         }
         $success = $date->addTopic($topic);
         if ($success) {
             PageLayout::postMessage(MessageBox::success(_("Thema wurde hinzugefügt.")));
         } else {
             PageLayout::postMessage(MessageBox::info(_("Thema war schon mit dem Termin verknüpft.")));
         }
     }
     Navigation::activateItem('/course/schedule/dates');
     object_set_visit_module("schedule");
     $this->last_visitdate = object_get_visit(Course::findCurrent()->id, 'schedule');
     $this->dates = Course::findCurrent()->getDatesWithExdates();
     $this->lecturer_count = Course::findCurrent()->countMembersWithStatus('dozent');
 }
Exemple #3
0
 /**
  * Set the seminar denoted by the passed id as visited by the currently 
  * logged in user
  * 
  * @param string $seminar_id
  */
 static function setVisit($seminar_id)
 {
     $type = get_object_type($seminar_id, words('fak inst sem'));
     if ($type === 'fak') {
         $type = 'inst';
     }
     if (self::getVisit($seminar_id) < object_get_visit($seminar_id, $type, false, false)) {
         self::setVisitdates($seminar_id);
     }
 }
Exemple #4
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     global $perm;
     checkObject();
     checkObjectModule("participants");
     $this->course_id = $_SESSION['SessSemName'][1];
     $this->course_title = $_SESSION['SessSemName'][0];
     $this->user_id = $GLOBALS['auth']->auth['uid'];
     // Check dozent-perms
     if ($perm->have_studip_perm('dozent', $this->course_id)) {
         $this->is_dozent = true;
     }
     // Check tutor-perms
     if ($perm->have_studip_perm('tutor', $this->course_id)) {
         $this->is_tutor = true;
     }
     // Check autor-perms
     if ($perm->have_studip_perm('autor', $this->course_id)) {
         $this->is_autor = true;
     }
     if ($this->is_tutor) {
         PageLayout::setHelpKeyword("Basis.VeranstaltungenVerwaltenTeilnehmer");
     } else {
         PageLayout::setHelpKeyword("Basis.InVeranstaltungTeilnehmer");
     }
     // Check lock rules
     $this->dozent_is_locked = LockRules::Check($this->course_id, 'dozent');
     $this->tutor_is_locked = LockRules::Check($this->course_id, 'tutor');
     $this->is_locked = LockRules::Check($this->course_id, 'participants');
     // Layoutsettings
     PageLayout::setTitle(sprintf('%s - %s', Course::findCurrent()->getFullname(), _("Teilnehmende")));
     PageLayout::addScript('members.js');
     SkipLinks::addIndex(Navigation::getItem('/course/members')->getTitle(), 'main_content', 100);
     object_set_visit_module('participants');
     $this->last_visitdate = object_get_visit($this->course_id, 'participants');
     // Check perms and set the last visit date
     if (!$this->is_tutor) {
         $this->last_visitdate = time() + 10;
     }
     // Get the max-page-value for the pagination
     $this->max_per_page = Config::get()->ENTRIES_PER_PAGE;
     $this->status_groups = array('dozent' => get_title_for_status('dozent', 2), 'tutor' => get_title_for_status('tutor', 2), 'autor' => get_title_for_status('autor', 2), 'user' => get_title_for_status('user', 2), 'accepted' => get_title_for_status('accepted', 2), 'awaiting' => _("Wartende Personen"), 'claiming' => _("Wartende Personen"));
     // StatusGroups for the view
     $this->decoratedStatusGroups = array('dozent' => get_title_for_status('dozent', 1), 'autor' => get_title_for_status('autor', 1), 'tutor' => get_title_for_status('tutor', 1), 'user' => get_title_for_status('user', 1));
     //check for admission / waiting list
     update_admission($this->course_id);
     // Create new MembersModel, to get additionanl informations to a given Seminar
     $this->members = new MembersModel($this->course_id, $this->course_title);
     $this->members->checkUserVisibility();
     // Set default sidebar image
     $sidebar = Sidebar::get();
     $sidebar->setImage('sidebar/person-sidebar.png');
 }
Exemple #5
0
/**
* This function saves the actual time as last visitdate for the given object, user and type
*
* @param    string  the id of the object (i.e. seminar_id, news_id, vote_id)
* @param    string  the type of visited object or module (i.e. news, documents, wiki - see /lib/classes/Modules.class.php for definitions)
* @param    string  the user who visited the object - if not given, the actual user is used
*
*/
function object_set_visit($object_id, $type, $user_id = '')
{
    global $user;
    if (!$user_id) {
        $user_id = $user->id;
    }

    $last_visit = object_get_visit($object_id, $type, FALSE, false , $user_id);

    if ($last_visit === false) {
        $last_visit = 0;
    }

    $query = "INSERT INTO object_user_visits (object_id, user_id, type, visitdate, last_visitdate)
              VALUES (?, ?, ?, UNIX_TIMESTAMP(), ?) ON DUPLICATE KEY UPDATE visitdate=UNIX_TIMESTAMP(), last_visitdate=?";
    $statement = DBManager::get()->prepare($query);
    $statement->execute(array($object_id, $user_id, $type, $last_visit, $last_visit));

    return object_get_visit($object_id, $type, FALSE, false, $user_id, true);
}
Exemple #6
0
<?php

/*
 *  Copyright (c) 2012  Rasmus Fuhse <*****@*****.**>
 * 
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License as
 *  published by the Free Software Foundation; either version 2 of
 *  the License, or (at your option) any later version.
 */
if (!$last_visit) {
    $last_visit = object_get_visit($_SESSION['SessionSeminar'], "forum");
}
$author = $posting->getUser();
$author_name = $author->getName();
$author_url = $author->getURL();
?>
<li class="comment posting<?php 
echo $posting['mkdate'] > $last_visit ? " new" : "";
?>
" id="posting_<?php 
echo $posting->getId();
?>
" mkdate="<?php 
echo htmlReady($posting['mkdate']);
?>
" data-autor="<?php 
echo htmlReady($posting['user_id']);
?>
">
    <div class="avatar">
Exemple #7
0
<? $is_new = ($evaluation->chdate >= object_get_visit($evaluation->id, 'eval', false, false)) && ($evaluation->author_id != $GLOBALS['user']->id);
?>
<article class="<?php 
echo ContentBoxHelper::classes($evaluation->id, $is_new);
?>
" id="<?php 
echo $evaluation->id;
?>
" data-visiturl="<?php 
echo URLHelper::getScriptLink('dispatch.php/vote/visit');
?>
">
    <header>
        <h1>
            <a href="<?php 
echo ContentBoxHelper::switchhref($evaluation->id, array('contentbox_type' => 'eval'));
?>
">
                <?php 
echo htmlReady($evaluation->title);
?>
            </a>
        </h1>
        <nav>
            <a href="<?php 
echo $evaluation->author ? URLHelper::getLink('dispatch.php/profile', array('username' => $evaluation->author->username)) : '';
?>
">
                <?php 
echo $evaluation->author ? htmlReady($evaluation->author->getFullName()) : '';
Exemple #8
0
 /**
  * displays a paginated member overview of a studygroup
  *
  * @param string id of a studypgroup
  * @param string page number the current page
  *
  * @return void
  *
  */
 function members_action()
 {
     $id = $_SESSION['SessionSeminar'];
     PageLayout::setTitle(getHeaderLine($_SESSION['SessionSeminar']) . ' - ' . _("Teilnehmende"));
     Navigation::activateItem('/course/members');
     PageLayout::setHelpKeyword('Basis.StudiengruppenBenutzer');
     Request::set('choose_member_parameter', $this->flash['choose_member_parameter']);
     object_set_visit_module('participants');
     $this->last_visitdate = object_get_visit($id, 'participants');
     $sem = Course::find($id);
     $this->anzahl = StudygroupModel::countMembers($id);
     $this->groupname = $sem->getFullname();
     $this->sem_id = $id;
     $this->groupdescription = $sem->beschreibung;
     $this->moderators = $sem->getMembersWithStatus('dozent');
     $this->tutors = $sem->getMembersWithStatus('tutor');
     $this->autors = $sem->getMembersWithStatus('autor');
     $this->accepted = $sem->admission_applicants->findBy('status', 'accepted');
     $this->sem_class = Course::findCurrent()->getSemClass();
     $inviting_search = new SQLSearch("SELECT auth_user_md5.user_id, {$GLOBALS['_fullname_sql']['full_rev']} as fullname, username, perms " . "FROM auth_user_md5 " . "LEFT JOIN user_info ON (auth_user_md5.user_id = user_info.user_id) " . "LEFT JOIN seminar_user ON (auth_user_md5.user_id = seminar_user.user_id AND seminar_user.Seminar_id = '" . addslashes($id) . "') " . "WHERE perms  NOT IN ('root', 'admin') " . "AND " . get_vis_query() . " AND (username LIKE :input OR Vorname LIKE :input " . "OR CONCAT(Vorname,' ',Nachname) LIKE :input " . "OR CONCAT(Nachname,' ',Vorname) LIKE :input " . "OR Nachname LIKE :input OR {$GLOBALS['_fullname_sql']['full_rev']} LIKE :input) " . "ORDER BY fullname ASC", _("Nutzer suchen"), "user_id");
     $this->rechte = $GLOBALS['perm']->have_studip_perm("tutor", $id);
     $actions = new ActionsWidget();
     if ($this->rechte) {
         $mp = MultiPersonSearch::get('studygroup_invite_' . $id)->setLinkText(_('Neue Gruppenmitglieder-/innen einladen'))->setLinkIconPath("")->setTitle(_('Neue Gruppenmitglieder/-innen einladen'))->setExecuteURL($this->url_for('course/studygroup/execute_invite/' . $id, array('view' => Request::get('view'))))->setSearchObject($inviting_search)->addQuickfilter(_('Adressbuch'), User::findCurrent()->contacts->pluck('user_id'))->setNavigationItem('/course/members')->render();
         $element = LinkElement::fromHTML($mp, Icon::create('community+add', 'clickable'));
         $actions->addElement($element);
     }
     if ($this->rechte || $sem->getSemClass()['studygroup_mode']) {
         $actions->addLink(_('Nachricht an alle Gruppenmitglieder verschicken'), $this->url_for('course/studygroup/message/' . $id), Icon::create('mail', 'clickable'), array('data-dialog' => 1));
     }
     if ($actions->hasElements()) {
         Sidebar::get()->addWidget($actions);
     }
     $this->invitedMembers = StudygroupModel::getInvitations($id);
 }
Exemple #9
0
function create_zip_from_newest_files() {
    global $SessSemName;
    $db = DBManager::get();
    $result = $db->query("SELECT filename FROM dokumente WHERE chdate > ".object_get_visit($SessSemName[1], "documents")." OR mkdate > ".object_get_visit($SessSemName[1], "documents"))->fetchAll();
}
 /**
  * set changedate
  *
  * sets changedate for view
  * @access public
  * @param string $module_chdate changedate
  */
 function setChangeDate($module_chdate)
 {
     global $SessSemName;
     $this->change_date = $module_chdate;
     if (object_get_visit($SessSemName[1], "elearning_interface") < $this->change_date) {
         $this->module_new = true;
     } else {
         $this->module_new = false;
     }
 }
Exemple #11
0
            </a>
        <? endif; ?>
        <? if ($rss_id): ?>
            <a href="<?php 
echo URLHelper::getLink('rss.php', array('id' => $rss_id));
?>
">
                <?php 
echo Icon::create('rss', 'clickable', ['title' => _('RSS-Feed')])->asImg();
?>
            </a>
        <? endif; ?>
        </nav>
    </header>
    <? foreach ($news as $new): ?>
    <? $is_new = ($new['chdate'] >= object_get_visit($new->id, 'news', false, false))
            && ($new['user_id'] != $GLOBALS['user']->id); ?>
    <article class="<?php 
echo ContentBoxHelper::classes($new->id, $is_new);
?>
" id="<?php 
echo $new->id;
?>
" data-visiturl="<?php 
echo URLHelper::getScriptLink('dispatch.php/news/visit');
?>
">
        <header>
            <h1>
                <a href="<?php 
echo ContentBoxHelper::href($new->id, array('contentbox_type' => 'news'));
Exemple #12
0
    print "<tr><td class=\"blank\" colspan=\"3\" width=\"100%\">";

    //when changing, uploading or show all (for download selector), create a form
    if ((($change) || ($folder_system_data["cmd"]=="all")) && (!$folder_system_data["upload"])) {
        echo "<form method=\"post\" action=\"".URLHelper::getLink('#anker')."\">";
        echo CSRFProtection::tokenTag();
        }


    if ($folder_system_data["cmd"]=="all") {
        print "<p class=\"info\">";
        printf (_("Hier sehen Sie alle Dateien, die zu dieser %s eingestellt wurden. Um eine neue Datei hoch zu laden, wählen Sie bitte links die Ordneransicht."), $SessSemName["art_generic"]);
        print "</p>";
    }

    $lastvisit = object_get_visit($SessSemName[1], "documents");

    $query = "SELECT COUNT(*)
              FROM dokumente
              WHERE seminar_id = ? AND user_id != ? AND url=''
              AND range_id NOT IN(?) AND GREATEST(mkdate, IFNULL(chdate, 0)) > ?";
    $statement = DBManager::get()->prepare($query);
    $statement->execute(array(
        $range_id, $user->id, $folder_tree->getUnreadableFolders($user->id) ?: '', $lastvisit
    ));
    $result = $statement->fetchColumn();
    if ($result > 0) {
        print "<p class=\"info\">";
        print _("Es gibt ");
        print "<b>".($result > 1 ? $result : _('eine'))."</b>";
        print _(" neue/geänderte Dateie(n). Jetzt ");
Exemple #13
0
 public static function getStudygroups()
 {
     $courses = array();
     $modules = new Modules();
     $studygroups = User::findCurrent()->course_memberships->filter(function ($c) {
         return $c->course->getSemClass()->offsetGet('studygroup_mode');
     })->toGroupedArray('seminar_id');
     $param_array = 'name seminar_id visible veranstaltungsnummer start_time duration_time status visible ';
     $param_array .= 'chdate admission_binding modules admission_prelim';
     $courses = Course::findAndMapMany(function ($course) use($param_array, $studygroups, $modules) {
         $ret = $course->toArray($param_array);
         $ret['sem_class'] = $course->getSemClass();
         $ret['start_semester'] = $course->start_semester->name;
         $ret['end_semester'] = $course->end_semester->name;
         $ret['obj_type'] = 'sem';
         $ret['last_visitdate'] = object_get_visit($course->id, 'sem', 'last');
         $ret['visitdate'] = object_get_visit($course->id, 'sem', '');
         $ret['user_status'] = $studygroups[$course->id]['status'];
         $ret['gruppe'] = $studygroups[$course->id]['gruppe'];
         $ret['modules'] = $modules->getLocalModules($course->id, 'sem', $course->modules, $course->status);
         MyRealmModel::getObjectValues($ret);
         return $ret;
     }, array_keys($studygroups));
     return $courses;
 }
Exemple #14
0
/**
* List all topics in this seminar's wiki
*
* @param  mode  string  Either "all" or "new", affects default sorting and page title.
* @param  sortby  string  Different sortings of entries.
**/
function listPages($mode, $sortby = NULL) {
    global $SessSemName;

    if ($mode=="all") {
        $selfurl = "?view=listall";
        $sort = "ORDER by lastchange DESC"; // default sort order for "all pages"
        $nopages = _("In dieser Veranstaltung wurden noch keine WikiSeiten angelegt.");
    } else if ($mode=="new") {
        $lastlogindate = object_get_visit($SessSemName[1], "wiki");
        $selfurl = "?view=listnew";
        $sort = "ORDER by lastchange"; // default sort order for "new pages"
        $nopages = _("Seit Ihrem letzten Login gab es keine Änderungen.");
    } else {
        throw new InvalidArgumentException(_('Fehler! Falscher Anzeigemodus:') . $mode);
    }

    $titlesortlink = "title";
    $versionsortlink = "version";
    $changesortlink = "lastchange";

    switch ($sortby) {
        case 'title':
            // sort by keyword, prepare link for descending sorting
            $sort = " ORDER BY keyword";
            $titlesortlink = "titledesc";
            break;
        case 'titledesc':
            // sort descending by keyword, prep link for asc. sort
            $sort = " ORDER BY keyword DESC";
            break;
        case 'version':
            $sort = " ORDER BY lastversion DESC, keyword ASC";
            $versionsortlink = "versiondesc";
            break;
        case 'versiondesc':
            $sort = " ORDER BY lastversion, keyword ASC";
            break;
        case 'lastchange':
            // sort by change date, default: newest first
            $sort = " ORDER BY lastchange DESC, keyword ASC";
            $changesortlink = "lastchangedesc";
            break;
        case 'lastchangedesc':
            // sort by change date, oldest first
            $sort = " ORDER BY lastchange, keyword ASC";
            break;
    }

    if ($mode=="all") {
        $query = "SELECT keyword, MAX(chdate) AS lastchange, MAX(version) AS lastversion
                  FROM wiki
                  WHERE range_id = ?
                  GROUP BY keyword
                  {$sort}";
        $parameters = array($SessSemName[1]);
    } else if ($mode=="new") {
        $query = "SELECT keyword, MAX(chdate) AS lastchange, MAX(version) AS lastversion
                  FROM wiki
                  WHERE range_id = ? AND chdate > ?
                  GROUP BY keyword
                  {$sort}";
        $parameters = array($SessSemName[1], $lastlogindate);
    }
    $statement = DBManager::get()->prepare($query);
    $statement->execute($parameters);
    $pages = $statement->fetchAll(PDO::FETCH_ASSOC);

    // show pages
    showPageFrameStart();
    begin_blank_table();

    if (count($pages) == 0) {
        PageLayout::postMessage(MessageBox::info($nopages));
    } else {
        echo "<tr><td class=\"blank\" colspan=\"2\">&nbsp;</td></tr>\n";
        echo "<tr><td class=\"blank\" colspan=\"2\">";
        echo "<table id=\"main_content\" role=\"main\" width=\"99%\" border=\"0\"  cellpadding=\"2\" cellspacing=\"0\" align=\"center\">";
        echo "<tr height=28>";
        $s = "<td class=\"content_title\" width=\"%d%%\" align=\"%s\">%s</td>";
        printf($s, 3, "left", "&nbsp;");
        printf($s, 39,"left",  "<font size=-1><b><a href=\"".URLHelper::getLink("$selfurl&sortby=$titlesortlink")."\">"._("Titel")."</a></b></font>");
        printf($s, 10,"center",  "<font size=-1><b><a href=\"".URLHelper::getLink("$selfurl&sortby=$versionsortlink")."\">"._("Änderungen")."</a></b></font>");
        printf($s, 15,"left",  "<font size=-1><b><a href=\"".URLHelper::getLink("$selfurl&sortby=$changesortlink")."\">"._("Letzte Änderung")."</a></b></font>");
        printf($s, 25,"left",  "<font size=-1><b>"._("von")."</b></font>");
        echo "</tr>";

        $query = "SELECT user_id, version
                  FROM wiki
                  WHERE range_id = ? AND keyword = ? AND chdate = ?";
        $meta_statement = DBManager::get()->prepare($query);

        $c=1;
        foreach ($pages as $page) {
            $class = ($c++ % 2) ? "table_row_even" : "table_row_odd";

            $keyword    = $page['keyword'];
            $lastchange = $page['lastchange'];

            $meta_statement->execute(array($SessSemName[1], $keyword, $lastchange));
            $temp = $meta_statement->fetch(PDO::FETCH_ASSOC);
            $meta_statement->closeCursor();

            $user_id = $temp['user_id'];
            $version = $temp['version'];

            $tdheadleft="<td class=\"$class\" align=\"left\"><font size=\"-1\">";
            $tdheadcenter="<td class=\"$class\" align=\"center\"><font size=\"-1\">";
            $tdtail="</font></td>";
            print("<tr>".$tdheadleft."&nbsp;"."$tdtail");
            print($tdheadleft."<a href=\"".URLHelper::getLink("?keyword=" . urlencode($keyword) . "")."\">");
            print(htmlReady($keyword) ."</a>");
            print($tdtail);
            print($tdheadcenter.$version . $tdtail);
            print($tdheadleft.date("d.m.Y, H:i", $lastchange));
            if ($mode=="new" && $version > 1) {
                print("&nbsp;(<a href=\"".URLHelper::getLink("?view=diff&keyword=".urlencode($keyword)."&versionssince=$lastlogindate")."\">"._("Änderungen")."</a>)");
            }
            print($tdtail);
            print($tdheadleft.get_fullname($user_id,'full',TRUE).$tdtail."</tr>");
        }
        echo '</tr></table>';
    }
    echo "</table><p>&nbsp;</p>";

    $sidebar = Sidebar::get();

    if ($mode=="all"){
        $help_url = format_help_url("Basis.VerschiedenesFormat");

        $widget = new ExportWidget();
        $widget->addLink(_('PDF-Ausgabe aller Wiki-Seiten'),
                         URLHelper::getLink('?keyword=' . urlencode($keyword) . '&view=exportall_pdf&version=' . $version . '&sortby=' . $sortby),
                         Icon::create('file-pdf', 'clickable'),
                         array('target' => '_blank'));
        $widget->addLink(_('Druckansicht aller Wiki-Seiten'),
                         URLHelper::getLink('?keyword=' . urlencode($keyword) . '&view=wikiprintall&version=' . $version),
                         Icon::create('print', 'clickable'),
                         array('target' => '_blank'));
        $sidebar->addWidget($widget);
    }
#    end_blank_table();
    showPageFrameEnd(array());
}
Exemple #15
0
<? if (Config::get()->NEWS_DISPLAY >= 2 || $new->havePermission('edit')): ?>
    <span title="<?php 
echo _('Aufrufe');
?>
" class='news_visits' style="color: #050">
        <?php 
echo object_return_views($new['news_id']);
?>
    </span>
<? endif; ?>

<?
if ($new['allow_comments']) :
    $num = StudipComment::NumCommentsForObject($new['news_id']);
    $visited = object_get_visit($new['news_id'], 'news', false, false);
    $isnew = StudipComment::NumCommentsForObjectSinceLastVisit($new['news_id'], $visited, $GLOBALS['user']->id);
    ?>
    <? if ($num): ?>
        <? if ($isnew): ?>
            <span class="news_comments_indicator" title="<?php 
echo sprintf(_('%s neue(r) Kommentar(e)'), $isnew);
?>
">
                <?php 
echo Icon::create("chat", "new")->asImg();
?>
        <? else: ?>
            <span class="news_comments_indicator" title="<?php 
echo sprintf(_('%s Kommentare'), $num);
?>