public static function getRecordDataById($type, $id) { $record = get_record($type, 'id', $id); if (!$record || $record->deleted) { return false; } $record->description = str_replace(array("\r\n", "\n", "\r"), ' ', strip_tags($record->description)); $record->groupadmins = group_get_admins(array($id)); return $record; }
function group_get_groupinfo_data($group) { safe_require('artefact', 'file'); safe_require('interaction', 'forum'); $group->admins = group_get_admins(array($group->id)); $group->settingsdescription = group_display_settings($group); if (get_config('allowgroupcategories')) { $group->categorytitle = $group->category ? get_field('group_category', 'title', 'id', $group->category) : ''; } if (group_can_list_members($group, group_user_access($group->id))) { $group->membercount = count_records('group_member', 'group', $group->id); } $group->viewcount = count_records('view', 'group', $group->id); $group->filecounts = ArtefactTypeFileBase::count_user_files(null, $group->id, null); $group->forumcounts = PluginInteractionForum::count_group_forums($group->id); $group->topiccounts = PluginInteractionForum::count_group_topics($group->id); $group->postcounts = PluginInteractionForum::count_group_posts($group->id); return $group; }
$i++; $forums[$temp]->moderators[] = $forums[$i]->moderator; unset($forums[$i]); } } $i = 0; foreach ($forums as $forum) { $forum->feedlink = get_config('wwwroot') . 'interaction/forum/atom.php?type=f&id=' . $forum->id; if ($membership) { $forum->subscribe = pieform(array('name' => 'subscribe_forum' . ($i == 0 ? '' : $i), 'plugintype' => 'interaction', 'pluginname' => 'forum', 'validatecallback' => 'subscribe_forum_validate', 'successcallback' => 'subscribe_forum_submit', 'autofocus' => false, 'renderer' => 'div', 'class' => 'form-as-button', 'elements' => array('submit' => array('type' => 'button', 'usebuttontag' => true, 'class' => 'btn-default btn-sm', 'renderelementsonly' => true, 'value' => $forum->subscribed ? '<span class="icon icon-lg icon-times left text-danger"></span> ' . get_string('Unsubscribe', 'interaction.forum') : '<span class="icon icon-lg icon-star left"></span> ' . get_string('Subscribe', 'interaction.forum'), 'help' => false), 'forum' => array('type' => 'hidden', 'value' => $forum->id), 'redirect' => array('type' => 'hidden', 'value' => 'index'), 'group' => array('type' => 'hidden', 'value' => $groupid), 'type' => array('type' => 'hidden', 'value' => $forum->subscribed ? 'unsubscribe' : 'subscribe')))); $i++; } } } $feedlink = get_config('wwwroot') . 'interaction/forum/atom.php?type=g&id=' . $group->id; $headers = array(); if ($group->public) { $headers[] = '<link rel="alternate" type="application/atom+xml" href="' . $feedlink . '">'; } $smarty = smarty(array(), $headers); $smarty->assign('groupid', $groupid); $smarty->assign('publicgroup', $group->public); $smarty->assign('feedlink', $feedlink); $smarty->assign('heading', $group->name); $smarty->assign('headingclass', 'page-header'); $smarty->assign('subsectionheading', get_string('nameplural', 'interaction.forum')); $smarty->assign('rsswithtitle', true); $smarty->assign('admin', $membership == 'admin'); $smarty->assign('groupadmins', group_get_admins(array($groupid))); $smarty->assign('forums', $forums); $smarty->display('interaction:forum:index.tpl');