本文整理汇总了PHP中PluginEngine::getPlugins方法的典型用法代码示例。如果您正苦于以下问题:PHP PluginEngine::getPlugins方法的具体用法?PHP PluginEngine::getPlugins怎么用?PHP PluginEngine::getPlugins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginEngine
的用法示例。
在下文中一共展示了PluginEngine::getPlugins方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: before_filter
/**
* This function is called before any output is generated or any other
* actions are performed. Initializations happen here.
*
* @param $action Name of the action to perform
* @param $args Arguments for the given action
*/
public function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
$this->modules = array();
// Set Navigation
PageLayout::setHelpKeyword("Basis.ProfileModules");
PageLayout::setTitle(_("Mehr Funktionen"));
PageLayout::addSqueezePackage('lightbox');
Navigation::activateItem('/profile/modules');
// Get current user.
$this->username = Request::username('username', $GLOBALS['user']->username);
$this->user_id = get_userid($this->username);
$this->plugins = array();
$blubber = PluginEngine::getPlugin('Blubber');
// Add blubber to plugin list so status can be updated.
if ($blubber) {
$this->plugins[] = $blubber;
}
// Get homepage plugins from database.
$this->plugins = array_merge($this->plugins, PluginEngine::getPlugins('HomepagePlugin'));
// Show info message if user is not on his own profile
if ($this->user_id != $GLOBALS['user']->id) {
$current_user = User::find($this->user_id);
$message = sprintf(_('Daten von: %s %s (%s), Status: %s'), htmlReady($current_user->Vorname), htmlReady($current_user->Nachname), htmlReady($current_user->username), htmlReady($current_user->perms));
PageLayout::postMessage(MessageBox::info($message));
}
$this->setupSidebar();
}
示例2: get_plugin_navigations
/**
* Loads all possible standard plugins for the given seminars and adds
* a navigation entry for each one.
*
* @param array $seminars List of seminars
* @return array Extended list of seminars
*/
protected function get_plugin_navigations($seminars)
{
foreach ($seminars as $id => $seminar) {
foreach (PluginEngine::getPlugins('StandardPlugin', $id) as $plugin) {
$seminars[$id]['navigations'][] = $plugin->getIconNavigation($id, time(), $GLOBALS['user']->id);
}
}
return $seminars;
}
示例3: count_table_rows
* * L O G I N - P A G E ( N O B O D Y - U S E R ) * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
PageLayout::setHelpKeyword("Basis.Startseite");
// set keyword for new help
PageLayout::setTitle(_("Startseite"));
Navigation::activateItem('/start');
PageLayout::setTabNavigation(NULL);
// disable display of tabs
// Start of Output
include 'lib/include/html_head.inc.php';
// Output of html head
include 'lib/include/header.php';
$index_nobody_template = $GLOBALS['template_factory']->open('index_nobody');
$index_nobody_template->set_attributes(array('num_active_courses' => count_table_rows('seminare'), 'num_registered_users' => count_table_rows('auth_user_md5'), 'num_online_users' => get_users_online_count(10)));
if (Request::get('logout')) {
$index_nobody_template->set_attribute('logout', true);
}
echo '<div><div class="index_container">';
echo $index_nobody_template->render();
$layout = $GLOBALS['template_factory']->open('shared/index_box');
// Prüfen, ob PortalPlugins vorhanden sind.
$portalplugins = PluginEngine::getPlugins('PortalPlugin');
foreach ($portalplugins as $portalplugin) {
$template = $portalplugin->getPortalTemplate();
if ($template) {
echo $template->render(NULL, $layout);
$layout->clear_attributes();
}
}
page_close();
include 'lib/include/html_end.inc.php';
示例4: getToplistEntries
protected function getToplistEntries($sem_status)
{
$sql_where_query_seminare = " WHERE 1 ";
$parameters = array();
if (!$GLOBALS['perm']->have_perm(get_config('SEM_VISIBILITY_PERM'))) {
$sql_where_query_seminare .= " AND seminare.visible = 1 ";
}
if ($_SESSION['sem_portal']['bereich'] != 'all' && count($sem_status)) {
$sql_where_query_seminare .= " AND seminare.status IN (?) ";
$parameters[] = $sem_status;
}
switch ($_SESSION['sem_portal']["toplist"]) {
case 4:
default:
$query = "SELECT seminar_id, name, mkdate AS count\n FROM seminare\n {$sql_where_query_seminare}\n ORDER BY mkdate DESC\n LIMIT 5";
$statement = DBManager::get()->prepare($query);
$statement->execute($parameters);
$top_list = $statement->fetchAll(PDO::FETCH_ASSOC);
//$toplist = $this->getToplist(_('neueste Veranstaltungen'), $query, 'date', $parameters);
break;
case 1:
$query = "SELECT seminare.seminar_id, seminare.name, COUNT(seminare.seminar_id) AS count\n FROM seminare\n LEFT JOIN seminar_user USING (seminar_id)\n {$sql_where_query_seminare}\n GROUP BY seminare.seminar_id\n ORDER BY count DESC\n LIMIT 5";
$statement = DBManager::get()->prepare($query);
$statement->execute($parameters);
$top_list = $statement->fetchAll(PDO::FETCH_ASSOC);
//$toplist = $this->getToplist(_('Teilnehmeranzahl'), $query, 'count', $parameters);
break;
case 2:
$query = "SELECT dokumente.seminar_id, seminare.name, COUNT(dokumente.seminar_id) AS count\n FROM seminare\n INNER JOIN dokumente USING (seminar_id)\n {$sql_where_query_seminare}\n GROUP BY dokumente.seminar_id\n ORDER BY count DESC\n LIMIT 5";
$statement = DBManager::get()->prepare($query);
$statement->execute($parameters);
$top_list = $statement->fetchAll(PDO::FETCH_ASSOC);
//$toplist = $this->getToplist(_('die meisten Materialien'), $query, 'count', $parameters);
break;
case 3:
$cache = StudipCacheFactory::getCache();
$hash = '/sem_portal/most_active';
$top_list = unserialize($cache->read($hash));
if (!$top_list) {
// get TopTen of seminars from all ForumModules and add up the
// count for seminars with more than one active ForumModule
// to get a combined toplist
$seminars = array();
foreach (PluginEngine::getPlugins('ForumModule') as $plugin) {
$new_seminars = $plugin->getTopTenSeminars();
foreach ($new_seminars as $sem) {
if (!isset($seminars[$sem['seminar_id']])) {
$seminars[$sem['seminar_id']] = $sem;
$seminars[$sem['seminar_id']]['name'] = $seminars[$sem['seminar_id']]['display'];
} else {
$seminars[$sem['seminar_id']]['count'] += $sem['count'];
}
}
}
// sort the seminars by the number of combined postings
usort($seminars, function ($a, $b) {
if ($a['count'] == $b['count']) {
return 0;
}
return $a['count'] > $b['count'] ? -1 : 1;
});
$top_list = $seminars;
// use only the first five seminars
$top_list = array_slice($top_list, 0, 5);
$cache->write($hash, serialize($top_list), 5 * 60);
}
break;
}
return $top_list;
}
示例5: forum_kings
private static function forum_kings()
{
$kings = array();
// sum up postings for all users from all ForumModules available
foreach (PluginEngine::getPlugins('ForumModule') as $plugin) {
$table = $plugin->getEntryTableInfo();
$query = "SELECT user_id AS id, COUNT(*) AS num FROM " . $table['table'] . " GROUP BY user_id";
$new_kings = self::select_kings($query);
foreach ($new_kings as $user_id => $num) {
if (!isset($kings[$user_id])) {
$kings[$user_id] = $num;
} else {
$kings[$user_id] += $num;
}
}
}
return $kings;
}
示例6: index_action
/**
* Entry point of the controller that displays all the information of the selected or current user
* @return void
*/
public function index_action()
{
// Template Index_Box for render-partials
$layout = $GLOBALS['template_factory']->open('shared/content_box');
$this->shared_box = $layout;
// if he has not yet stored into user_info, he comes in with no values
if ($this->current_user->mkdate === null) {
$this->current_user->store();
}
if (get_config('NEWS_RSS_EXPORT_ENABLE')) {
$news_author_id = StudipNews::GetRssIdFromUserId($this->current_user->user_id);
if ($news_author_id) {
PageLayout::addHeadElement('link', array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => 'RSS', 'href' => 'rss.php?id=' . $news_author_id));
}
}
// Get Avatar
$this->avatar = Avatar::getAvatar($this->current_user->user_id)->getImageTag(Avatar::NORMAL);
// GetScroreList
if (get_config('SCORE_ENABLE')) {
if ($this->current_user->user_id === $GLOBALS['user']->id || $this->current_user->score) {
$this->score = Score::GetMyScore($this->current_user);
$this->score_title = Score::getTitel($this->score, $this->current_user->geschlecht);
}
}
// Additional user information
$this->public_email = get_visible_email($this->current_user->user_id);
$this->motto = $this->profile->getVisibilityValue('motto');
$this->private_nr = $this->profile->getVisibilityValue('privatnr', 'private_phone');
$this->private_cell = $this->profile->getVisibilityValue('privatcell', 'private_cell');
$this->privadr = $this->profile->getVisibilityValue('privadr', 'privadr');
$this->homepage = $this->profile->getVisibilityValue('Home', 'homepage');
// skype informations
if (get_config('ENABLE_SKYPE_INFO') && $this->profile->checkVisibility('skype_name')) {
$this->skype_name = UserConfig::get($this->current_user->user_id)->SKYPE_NAME;
$this->skype_status = UserConfig::get($this->current_user->user_id)->SKYPE_ONLINE_STATUS && $this->profile->checkVisibility('skype_online_status');
}
// get generic datafield entries
$this->shortDatafields = $this->profile->getShortDatafields();
$this->longDatafields = $this->profile->getLongDatafields();
// get working station of an user (institutes)
$this->institutes = $this->profile->getInstitutInformations();
// get studying informations of an user
if ($this->current_user->perms != 'dozent') {
$study_institutes = UserModel::getUserInstitute($this->current_user->user_id, true);
if (count($study_institutes) > 0 && $this->profile->checkVisibility('studying')) {
$this->study_institutes = $study_institutes;
}
}
if ($this->current_user->user_id == $this->user->user_id && $GLOBALS['has_denoted_fields']) {
$this->has_denoted_fields = true;
}
// get kings informations
if (Config::Get()->SCORE_ENABLE) {
if ($this->current_user->user_id === $GLOBALS['user']->id || $this->current_user->score) {
$kings = $this->profile->getKingsInformations();
if ($kings != null) {
$this->kings = $kings;
}
}
}
$show_admin = $this->perm->have_perm('autor') && $this->user->user_id == $this->current_user->user_id || isDeputyEditAboutActivated() && isDeputy($this->user->user_id, $this->current_user->user_id, true);
if ($this->profile->checkVisibility('news') or $show_admin === true) {
$response = $this->relay('news/display/' . $this->current_user->user_id);
$this->news = $response->body;
}
// calendar
if (get_config('CALENDAR_ENABLE')) {
if (!in_array($this->current_user->perms, words('admin root'))) {
if ($this->profile->checkVisibility('termine')) {
$response = $this->relay('calendar/contentbox/display/' . $this->current_user->user_id);
$this->dates = $response->body;
}
}
}
// include and show votes and tests
if (get_config('VOTE_ENABLE') && $this->profile->checkVisibility('votes')) {
$response = $this->relay('questionnaire/widget/' . $this->current_user->user_id . "/user");
$this->votes = $response->body;
}
// Hier werden Lebenslauf, Hobbys, Publikationen und Arbeitsschwerpunkte ausgegeben:
$ausgabe_felder = array('lebenslauf' => _('Lebenslauf'), 'hobby' => _('Hobbys'), 'publi' => _('Publikationen'), 'schwerp' => _('Arbeitsschwerpunkte'));
$ausgabe_inhalt = array();
foreach ($ausgabe_felder as $key => $value) {
if ($this->profile->checkVisibility($key)) {
$ausgabe_inhalt[$value] = $this->current_user[$key];
}
}
$this->ausgabe_inhalt = array_filter($ausgabe_inhalt);
// Anzeige der Seminare, falls User = dozent
if ($this->current_user['perms'] == 'dozent') {
$this->seminare = array_filter($this->profile->getDozentSeminars());
}
// Hompageplugins
$homepageplugins = PluginEngine::getPlugins('HomepagePlugin');
foreach ($homepageplugins as $homepageplugin) {
if ($homepageplugin->isActivated($this->current_user->user_id, 'user')) {
//.........这里部分代码省略.........
示例7: getAvailableWidgets
/**
* getAvailableWidgets - fetches all widgets that are not already in use.
*
* @param string $user_id the user to check
*
* @return array All available widgets.
*/
static function getAvailableWidgets($user_id = null)
{
$all_widgets = PluginEngine::getPlugins('PortalPlugin');
$used_widgets = is_null($user_id) ? array() : DBManager::get()->fetchFirst("SELECT `pluginid` FROM `widget_user` WHERE `range_id`=? ORDER BY `pluginid`", array($user_id));
$available = array();
foreach ($all_widgets as $widget) {
if (!in_array($widget->getPluginId(), $used_widgets)) {
$available[$widget->getPluginId()] = $widget;
}
}
return $available;
}
示例8: getPluginNavigationForSeminar
function getPluginNavigationForSeminar($seminar_id, $visitdate)
{
static $plugin_navigation;
if (!$plugin_navigation[$seminar_id]) {
$plugin_navigation[$seminar_id] = array();
$plugins = PluginEngine::getPlugins('StandardPlugin', $seminar_id);
foreach ($plugins as $plugin) {
$nav = $plugin->getIconNavigation($seminar_id, $visitdate, $GLOBALS['user']->id);
if ($nav instanceof Navigation) {
$plugin_navigation[$seminar_id][get_class($plugin)] = $nav;
}
}
}
return $plugin_navigation[$seminar_id];
}
示例9: delete_action
//.........这里部分代码省略.........
// Institute has sub institutes?
if (count($institute->sub_institutes)) {
PageLayout::postMessage(MessageBox::error(_('Diese Einrichtung kann nicht gelöscht werden, da sie den Status Fakultät hat und noch andere Einrichtungen zugeordnet sind!')));
return $this->redirect('institute/basicdata/index/' . $i_id);
}
// Is the user allowed to delete faculties?
if ($institute->is_fak && !$GLOBALS['perm']->have_perm('root')) {
PageLayout::postMessage(MessageBox::error(_('Sie haben nicht die Berechtigung Fakultäten zu löschen!')));
return $this->redirect('institute/basicdata/index/' . $i_id);
}
// Save users, name and number of courses
$user_ids = $institute->members->pluck('user_id');
$i_name = $institute->name;
$i_courses = count($institute->courses);
// Delete that institute
if (!$institute->delete()) {
PageLayout::postMessage(MessageBox::error(_('Die Einrichtung konnte nicht gelöscht werden.')));
} else {
$details = array();
// logging - put institute's name in info - it's no longer derivable from id afterwards
log_event('INST_DEL', $i_id, NULL, $i_name);
// set a suitable default institute for each user
foreach ($user_ids as $user_id) {
log_event('INST_USER_DEL', $i_id, $user_id);
checkExternDefaultForUser($user_id);
}
if (count($user_ids)) {
$details[] = sprintf(_('%u Mitarbeiter gelöscht.'), count($user_ids));
}
// Report number of formerly associated courses
if ($i_courses) {
$details[] = sprintf(_('%u Beteiligungen an Veranstaltungen gelöscht'), $i_courses);
}
// delete literatur
$del_lit = StudipLitList::DeleteListsByRange($i_id);
if ($del_lit) {
$details[] = sprintf(_('%u Literaturlisten gelöscht.'), $del_lit['list']);
}
// delete news-links
StudipNews::DeleteNewsRanges($i_id);
//delete entry in news_rss_range
StudipNews::UnsetRssId($i_id);
//updating range_tree
$query = "UPDATE range_tree SET name = ?, studip_object = '', studip_object_id = '' WHERE studip_object_id = ?";
$statement = DBManager::get()->prepare($query);
$statement->execute(array(_('(in Stud.IP gelöscht)'), $i_id));
if (($db_ar = $statement->rowCount()) > 0) {
$details[] = sprintf(_('%u Bereiche im Einrichtungsbaum angepasst.'), $db_ar);
}
// Statusgruppen entfernen
if ($db_ar = DeleteAllStatusgruppen($i_id) > 0) {
$details[] = sprintf(_('%s Funktionen/Gruppen gelöscht.'), $db_ar);
}
//kill the datafields
DataFieldEntry::removeAll($i_id);
//kill all wiki-pages
$removed_wiki_pages = 0;
foreach (array('', '_links', '_locks') as $area) {
$query = "DELETE FROM wiki{$area} WHERE range_id = ?";
$statement = DBManager::get()->prepare($query);
$statement->execute(array($i_id));
$removed_wiki_pages += $statement->rowCount();
}
if ($removed_wiki_pages > 0) {
$details[] = sprintf(_('%u Wikiseiten gelöscht.'));
}
// kill all the ressources that are assigned to the Veranstaltung (and all the linked or subordinated stuff!)
if (get_config('RESOURCES_ENABLE')) {
$killAssign = new DeleteResourcesUser($i_id);
$killAssign->delete();
}
// delete all configuration files for the "extern modules"
if (get_config('EXTERN_ENABLE')) {
$counts = ExternConfig::DeleteAllConfigurations($i_id);
if ($counts) {
$details[] = sprintf(_('%u Konfigurationsdateien für externe Seiten gelöscht.'), $counts);
}
}
// delete all contents in forum-modules
foreach (PluginEngine::getPlugins('ForumModule') as $plugin) {
$plugin->deleteContents($i_id);
// delete content irrespective of plugin-activation in the seminar
if ($plugin->isActivated($i_id)) {
// only show a message, if the plugin is activated, to not confuse the user
$details[] = sprintf(_('Einträge in %s gelöscht.'), $plugin->getPluginName());
}
}
// Delete assigned documents
$db_ar = delete_all_documents($i_id);
if ($db_ar > 0) {
$details[] = sprintf(_('%u Dokumente gelöscht.'), $db_ar);
}
//kill the object_user_vists for this institut
object_kill_visits(null, $i_id);
// Report success with details
$message = sprintf(_('Die Einrichtung "%s" wurde gelöscht!'), $i_name);
PageLayout::postMessage(MessageBox::success($message, $details));
}
$this->redirect('institute/basicdata/index?cid=');
}
示例10: indicator
function indicator($key)
{
$cache = StudipCacheFactory::getCache();
if ($found_in_cache = $cache->read(__METHOD__ . $key)) {
return $found_in_cache;
}
$template = $this->template_factory->open('indicator');
$indicator['seminar_all'] = array("count" => array('count_table_rows', 'seminare'), "title" => _("Aktive Veranstaltungen"), "detail" => _("alle Veranstaltungen, die nicht archiviert wurden"));
$indicator['seminar_archived'] = array("count" => array('count_table_rows', 'archiv'), "title" => _("Archivierte Veranstaltungen"), "detail" => _("alle Veranstaltungen, die archiviert wurden"));
$indicator['institute_secondlevel_all'] = array("query" => "SELECT COUNT(*) FROM Institute WHERE Institut_id != fakultaets_id", "title" => _("beteiligte Einrichtungen"), "detail" => _("alle Einrichtungen außer den Fakultäten"));
$indicator['institute_firstlevel_all'] = array("query" => "SELECT COUNT(*) FROM Institute WHERE Institut_id = fakultaets_id", "title" => _("beteiligte Fakultäten"), "detail" => _("alle Fakultäten"));
$indicator['user_admin'] = array("query" => "SELECT COUNT(*) FROM auth_user_md5 WHERE perms='admin'", "title" => _("registrierte Administratoren"), "detail" => "");
$indicator['user_dozent'] = array("query" => "SELECT COUNT(*) FROM auth_user_md5 WHERE perms='dozent'", "title" => _("registrierte Dozenten"), "detail" => "");
$indicator['user_tutor'] = array("query" => "SELECT COUNT(*) FROM auth_user_md5 WHERE perms='tutor'", "title" => _("registrierte Tutoren"), "detail" => "");
$indicator['user_autor'] = array("query" => "SELECT COUNT(*) FROM auth_user_md5 WHERE perms='autor'", "title" => _("registrierte Autoren"), "detail" => "");
$indicator['document'] = array("query" => "SELECT COUNT(*) FROM dokumente WHERE url = ''", "title" => _("Dokumente"), "detail" => "");
$indicator['link'] = array("query" => "SELECT COUNT(*) FROM dokumente WHERE url != ''", "title" => _("verlinkte Dateien"), "detail" => "");
$indicator['litlist'] = array("count" => array('count_table_rows', 'lit_list'), "title" => _("Literaturlisten"), "detail" => "", "constraint" => get_config('LITERATURE_ENABLE'));
$indicator['termin'] = array("count" => array('count_table_rows', 'termine'), "title" => _("Termine"), "detail" => "");
$indicator['news'] = array("count" => array('count_table_rows', 'news'), "title" => _("Ankündigungen"), "detail" => "");
$indicator['vote'] = array("count" => array('count_table_rows', 'questionnaires'), "title" => _("Fragebögen"), "detail" => "", "constraint" => get_config('VOTE_ENABLE'));
$indicator['evaluation'] = array("count" => array('count_table_rows', 'eval'), "title" => _("Evaluationen"), "detail" => "", "constraint" => get_config('VOTE_ENABLE'));
$indicator['wiki_pages'] = array("query" => "SELECT COUNT(DISTINCT keyword) AS count FROM wiki", "title" => _("Wiki-Seiten"), "detail" => "", "constraint" => get_config('WIKI_ENABLE'));
$indicator['resource'] = array("count" => array('count_table_rows', 'resources_objects'), "title" => _("Ressourcen-Objekte"), "detail" => _("von Stud.IP verwaltete Ressourcen wie Räume oder Geräte"), "constraint" => Config::get()->RESOURCES_ENABLE);
if ($key == 'posting') {
$count = 0;
// sum up number of postings for all availabe ForumModules
foreach (PluginEngine::getPlugins('ForumModule') as $plugin) {
$count += $plugin->getNumberOfPostings();
}
$template->title = _('Forenbeiträge');
$template->detail = _('Anzahl Beiträge aller verwendeten Foren');
$template->count = $count;
} else {
// iterate over the other indicators
if (in_array($key, array_keys($indicator))) {
if (!isset($indicator[$key]['constraint']) || $indicator[$key]['constraint']) {
if ($indicator[$key]['query']) {
$result = $this->db->query($indicator[$key]['query']);
$rows = $result->fetch(PDO::FETCH_NUM);
$template->count = $rows[0];
} else {
$template->count = call_user_func($indicator[$key]['count'][0], $indicator[$key]['count'][1]);
}
$template->title = $indicator[$key]['title'];
if ($indicator[$key]['detail']) {
$template->detail = $indicator[$key]['detail'];
}
} else {
return "";
}
} else {
return "";
}
}
$ret = $template->render();
$cache->write(__METHOD__ . $key, $ret);
return $ret;
}
示例11: setForum
function setForum($newForumValue)
{
// only do something, if we enable the link to a thread in a forum
if ($newForumValue) {
// find the ForumModule which takes the role of the CoreForum in the current Seminar
$sem = Seminar::getInstance($this->seminar_id);
$forum_slot = $GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$sem->status]['class']]->getSlotModule('forum');
foreach (PluginEngine::getPlugins('ForumModule') as $plugin) {
if (get_class($plugin) == $forum_slot) {
// only link if there is none yet
if (!$plugin->getLinkToThread($this->issue_id)) {
$plugin->setThreadForIssue($this->issue_id, $this->title, $this->description);
$this->messages[] = sprintf(_("Ordner im Forum für das Thema \"%s\" angelegt."), $this->toString());
}
}
}
}
}
示例12: getAllNotifications
function getAllNotifications($user_id = NULL)
{
if (is_null($user_id)) {
$user_id = $GLOBALS['user']->id;
}
$my_sem = array();
$query = "SELECT s.Seminar_id, s.Name, s.chdate, s.start_time, s.modules, s.status as sem_status, su.status,s.admission_prelim, su.notification, IFNULL(visitdate, :threshold) AS visitdate " . "FROM seminar_user su " . "LEFT JOIN seminare s USING (Seminar_id) " . "LEFT JOIN object_user_visits ouv ON (ouv.object_id = su.Seminar_id AND ouv.user_id = :user_id AND ouv.type = 'sem') " . "WHERE su.user_id = :user_id AND su.status != 'user' AND su.notification <> 0";
if (get_config('DEPUTIES_ENABLE')) {
$query .= " UNION SELECT s.Seminar_id, CONCAT(s.Name, ' [Vertretung]') as Name, s.chdate, s.start_time, s.modules, s.status as sem_status, 'dozent' as status, s.admission_prelim, d.notification, IFNULL(visitdate, :threshold) AS visitdate " . "FROM deputies d " . "LEFT JOIN seminare s ON (d.range_id = s.Seminar_id) " . "LEFT JOIN object_user_visits ouv ON (ouv.object_id = d.range_id AND ouv.user_id = :user_id AND ouv.type = 'sem') " . "WHERE d.user_id = :user_id AND d.notification <> 0";
}
$statement = DBManager::get()->prepare($query);
$statement->bindValue(':user_id', $user_id);
$statement->bindValue(':threshold', ($threshold = Config::get()->NEW_INDICATOR_THRESHOLD) ? strtotime("-{$threshold} days 0:00:00") : 0);
$statement->execute();
while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
$seminar_id = $row['Seminar_id'];
$modules = $this->getLocalModules($seminar_id, 'sem', $row['modules'], $row['sem_status']);
$modulesInt = array_sum($modules);
//korrigiert wg. SemClass::isSlotMandatory() Kram
$my_sem[$seminar_id] = array('name' => $row['Name'], 'chdate' => $row['chdate'], 'start_time' => $row['start_time'], 'modules' => $modules, 'modulesInt' => $modulesInt, 'visitdate' => $row['visitdate'], 'obj_type' => 'sem', 'notification' => $row['notification'], 'sem_status' => $row['sem_status'], 'status' => $row['status'], 'prelim' => $row['admission_prelim']);
unset($seminar_id);
unset($modules);
unset($modulesInt);
}
$m_enabled_modules = $this->getGlobalEnabledNotificationModules('sem');
$m_extended = 0;
foreach ($this->registered_notification_modules as $m_data) {
$m_extended += pow(2, $m_data['id']);
}
get_my_obj_values($my_sem, $user_id);
$news = array();
foreach ($my_sem as $seminar_id => $s_data) {
$m_notification = $s_data['modulesInt'] + $m_extended & $s_data['notification'];
$n_data = array();
foreach ($m_enabled_modules as $m_name => $m_data) {
if ($this->isBit($m_notification, $m_data['id'])) {
if ($m_name != 'plugins') {
$data = $this->getModuleText($m_name, $seminar_id, $s_data, 'sem');
if ($data) {
$n_data[] = $data;
}
} else {
$sem_class = $GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$s_data['sem_status']]["class"]];
if (is_object($sem_class)) {
foreach (PluginEngine::getPlugins('StandardPlugin', $seminar_id) as $plugin) {
if (!$sem_class->isSlotModule($plugin)) {
$data = $this->getPluginText($plugin, $seminar_id, $s_data, 'plugins');
if ($data) {
$n_data[] = $data;
}
}
}
}
}
}
}
if (count($n_data)) {
$news[$s_data['name']] = $n_data;
}
}
if (count($news)) {
$template = $GLOBALS['template_factory']->open('mail/notification_html');
$template->set_attribute('lang', getUserLanguagePath($user_id));
$template->set_attribute('news', $news);
$template_text = $GLOBALS['template_factory']->open('mail/notification_text');
$template_text->set_attribute('news', $news);
return array('text' => $template_text->render(), 'html' => $template->render());
} else {
return FALSE;
}
}
示例13: sendMessage
private static function sendMessage($message, $stat, $value, $sampleRate)
{
// cannot proceed without loaded PluginEngine
if (!class_exists('PluginEngine')) {
return;
}
if ($sampleRate < 1) {
$rand = mt_rand() / mt_getrandmax();
if ($rand > $sampleRate) {
return;
}
}
// cache the activated MetricsPlugins
if (!self::$metricPlugins) {
self::$metricPlugins = \PluginEngine::getPlugins('MetricsPlugin');
}
// call every MetricPlugin
foreach (self::$metricPlugins as $plugin) {
call_user_func_array(array($plugin, $message), array($stat, $value, $sampleRate));
}
}
示例14: toStringStudipInfo
function toStringStudipInfo ($preview) {
if ($preview) {
$studip_info = $this->elements["StudipInfo"]->toString(array("content" =>
$this->config->getValue("StudipInfo", "homeinst") . " "));
$studip_info .= sprintf("<a href=\"\"%s>%s</a><br>\n",
$this->config->getAttributes("LinkInternSimple", "a"),
_("Heimatinstitut"));
$studip_info .= $this->elements["StudipInfo"]->toString(array("content" =>
$this->config->getValue("StudipInfo", "involvedinst") . " "));
$studip_info .= str_repeat(_("Beteiligte Institute") . " ", 5) . "<br>\n";
$studip_info .= $this->elements["StudipInfo"]->toString(array("content" =>
$this->config->getValue("StudipInfo", "countuser") . " "));
$studip_info .= "23<br>\n";
$studip_info .= $this->elements["StudipInfo"]->toString(array("content" =>
$this->config->getValue("StudipInfo", "countpostings") . " "));
$studip_info .= "42<br>\n";
$studip_info .= $this->elements["StudipInfo"]->toString(array("content" =>
$this->config->getValue("StudipInfo", "countdocuments") . " "));
$studip_info .= "7<br>\n";
}
else {
$query="SELECT i.Institut_id, i.Name, i.url FROM seminare LEFT JOIN Institute i
USING(institut_id) WHERE Seminar_id = ?";
$parameters = array($this->seminar_id);
$statement = DBManager::get()->prepare($query);
$statement->execute($parameters);
$res = $statement->fetch(PDO::FETCH_ASSOC);
$own_inst = $res['Institut_id'];
$studip_info = $this->elements["StudipInfo"]->toString(array("content" =>
$this->config->getValue("StudipInfo", "homeinst") . " "));
if ($res['url']) {
$link_inst = htmlReady($res['url']);
if (!preg_match('{^https?://.+$}', $link_inst))
$link_inst = "http://$link_inst";
$studip_info .= sprintf("<a href=\"%s\"%s target=\"_blank\">%s</a>", $link_inst,
$this->config->getAttributes("LinkInternSimple", "a"),
htmlReady($res['Name']));
}else
$studip_info .= htmlReady($res['Name']);
$studip_info .= "<br>\n";
$query = "SELECT Name, url FROM seminar_inst LEFT JOIN Institute i USING(institut_id)
WHERE seminar_id = ? AND i.institut_id!='$own_inst'";
$parameters = array($this->seminar_id);
$statement = DBManager::get()->prepare($query);
$statement->execute($parameters);
$involved_insts = NULL;
foreach ($statement->fetchAll(PDO::FETCH_ASSOC) as $res) {
if ($res['url']) {
$link_inst = htmlReady($res['url']);
if (!preg_match('{^https?://.+$}', $link_inst))
$link_inst = "http://$link_inst";
$involved_insts[] = sprintf("<a href=\"%s\"%s target=\"_blank\">%s</a>",
$link_inst, $this->config->getAttributes("LinkInternSimple", "a"),
htmlReady($res['Name']));
}
else
$involved_insts[] = $res['Name'];
}
if ($involved_insts) {
$involved_insts = implode(", ", $involved_insts);
$studip_info .= $this->elements["StudipInfo"]->toString(array("content" =>
$this->config->getValue("StudipInfo", "involvedinst") . " "));
$studip_info .= $involved_insts . "<br>\n";
}
$query = "SELECT count(*) as count_user FROM seminar_user WHERE Seminar_id = ?";
$parameters = array($this->seminar_id);
$statement = DBManager::get()->prepare($query);
$statement->execute($parameters);
$res = $statement->fetch(PDO::FETCH_ASSOC);
if ($res['count_user']) {
$studip_info .= $this->elements["StudipInfo"]->toString(array("content" =>
$this->config->getValue("StudipInfo", "countuser") . " "));
$studip_info .= $res['count_user'] . "<br>\n";
}
// get postings for all ForumModules
foreach (PluginEngine::getPlugins('ForumModule') as $plugin) {
$postings += $plugin->getNumberOfPostingsForSeminar($this->seminar_id);
}
if ($postings) {
$studip_info .= $this->elements["StudipInfo"]->toString(array("content" =>
$this->config->getValue("StudipInfo", "countpostings") . " "));
$studip_info .= $postings . "<br>\n";
}
$query = "SELECT count(*) as count_documents FROM dokumente WHERE seminar_id = ?";
$parameters = array($this->seminar_id);
//.........这里部分代码省略.........
示例15: setObjectVisits
/**
* This function reset all visits on every available modules
* @param $object
* @param $object_id
* @param $user_id
* @return bool
*/
public static function setObjectVisits(&$object, $object_id, $user_id, $timestamp = null)
{
// load plugins, so they have a chance to register themselves as observers
PluginEngine::getPlugins('StandardPlugin');
$query = "INSERT INTO object_user_visits\n (object_id, user_id, type, visitdate, last_visitdate)\n (\n SELECT news_id, :user_id, 'news', :timestamp, 0\n FROM news_range\n WHERE range_id = :id\n ) UNION (\n SELECT vote_id, :user_id, 'vote', :timestamp, 0\n FROM vote\n WHERE range_id = :id\n ) UNION (\n SELECT eval_id, :user_id, 'eval', :timestamp, 0\n FROM eval_range\n WHERE range_id = :id\n )\n ON DUPLICATE KEY UPDATE last_visitdate = IFNULL(visitdate, 0), visitdate = :timestamp";
$statement = DBManager::get()->prepare($query);
$statement->bindValue(':user_id', $user_id);
$statement->bindValue(':timestamp', $timestamp ?: time());
// Update all activated modules
foreach (words('forum documents schedule participants literature wiki scm elearning_interface') as $type) {
if ($object['modules'][$type]) {
object_set_visit($object_id, $type);
}
}
// Update news, votes and evaluations
$statement->bindValue('id', $object_id);
$statement->execute();
// Update object itself
object_set_visit($object_id, $object['obj_type']);
return true;
}