Ejemplo n.º 1
0
function js_hover(Event $aterm)
{
    global $user;

    $jscript_text = '<b>' . _("Zusammenfassung:") . ' </b>'
            . htmlReady($aterm->getTitle()) . '<hr>';

    if ($aterm instanceof SeminarEvent || $aterm instanceof SeminarCalendarEvent) {
        $jscript_text .= '<b>' . _("Veranstaltung:") . ' </b> '
                . htmlReady($aterm->getSemName()) . '<br>';
    }
    if ($aterm->getDescription()) {
        $jscript_text .= '<b>' . _("Beschreibung:") . ' </b> '
                . htmlReady(mila($aterm->getDescription(), 300)) . '<br>';
    }
    if ($categories = $aterm->toStringCategories()) {
        $jscript_text .= '<b>' . _("Kategorie:") . ' </b> '
                . htmlReady($categories) . '<br>';
    }
    if ($aterm->getLocation()) {
        $jscript_text .= '<b>' . _("Ort:") . ' </b> '
                . htmlReady($aterm->getLocation()) . '<br>';
    }
    if (!($aterm instanceof SeminarEvent)) {
        if ($aterm->toStringPriority()) {
            $jscript_text .= '<b>' . _("Priorität:") . ' </b>'
                    . htmlReady($aterm->toStringPriority()) . '<br>';
        }
        $jscript_text .= '<b>' . _("Zugriff:") . ' </b>'
                . htmlReady($aterm->toStringAccessibility()) . '<br>';
        $jscript_text .= '<b>' . _("Wiederholung:") . ' </b>'
                . htmlReady($aterm->toStringRecurrence()) . '<br>';
        
        if (get_config('CALENDAR_GROUP_ENABLE')) {
            $jscript_text .= sprintf(_('<span style="font-weight: bold;">Eingetragen am:</span> %s von %s'),
                strftime('%x, %X', $aterm->getMakeDate()),
                    htmlReady(get_fullname($aterm->getAuthorId(), 'no_title')))
                . '<br>';
            if ($aterm->getMakeDate() < $aterm->getChangeDate()) {
                $jscript_text .= sprintf(_('<span style="font-weight: bold;">Zuletzt bearbeitet am:</span> %s von %s'),
                    strftime('%x, %X', $aterm->getChangeDate()),
                        htmlReady(get_fullname($aterm->getEditorId(), 'no_title')))
                    . '<br>';
            }
        } else {
            $jscript_text .= sprintf(_('<span style="font-weight: bold;">Eingetragen am:</span> %s'),
                    strftime('%x, %X', $aterm->getMakeDate())) . '<br>';
            if ($aterm->getMakeDate() < $aterm->getChangeDate()) {
                $jscript_text .= sprintf(_('<span style="font-weight: bold;">Zuletzt bearbeitet am:</span> %s'),
                    strftime('%x, %X', $aterm->getChangeDate())) . '<br>';
            }
        }
    } else {
        // related groups
        $related_groups = $aterm->getRelatedGroups();
        if (sizeof($related_groups)) {
            $jscript_text .= '<b>' . _("Betroffene Gruppen:") . ' </b>'
                    . htmlReady(implode(', ', array_map(
                            function ($group) { return $group->name; },
                            $related_groups))) . '<br>';
        }
    }
    
    $jscript_text .= '<br>';

    return " onmouseover=\"STUDIP.CalendarDialog.openCalendarHover('" . JSReady($aterm->toStringDate('SHORT_DAY'), 'inline-single') . "', '" . JSReady($jscript_text, 'inline-single') . "', this);\" onmouseout=\"STUDIP.CalendarDialog.closeCalendarHover();\"";
}
Ejemplo n.º 2
0
/**
 * Returns a given text as an array of html attributes used as tooltip
 *
 * title and alt attribute is default, with_popup means a JS alert box
 * activated on click
 *
 * @param        string  $text
 * @param        boolean $with_alt    return text with alt attribute
 * @param        boolean $with_popup  return text with JS alert box on click
 * @return       string
 */
function tooltip2($text, $with_alt = TRUE, $with_popup = FALSE)
{
    $ret = array();
    if ($with_popup) {
        $ret['onClick'] = "alert('" . JSReady($text, "alert") . "');";
    }
    $text = preg_replace("/(\n\r|\r\n|\n|\r)/", " ", $text);
    $text = htmlReady($text);
    if ($with_alt) {
        $ret['alt'] = $text;
    }
    $ret['title'] = $text;
    return $ret;
}