Commit 0735c2e1 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Merge branch 'grouphomepageview'

parents 63ba66d2 ef12e6d2
......@@ -21,3 +21,4 @@ mahara-*.zip
/debian/mahara-apache2.postrm.debhelper
/debian/mahara-apache2.substvars
/debian/mahara-apache2
.DS_Store
......@@ -28,7 +28,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2009121600;
$config->version = 2010061800;
$config->release = '1.0.2';
?>
......@@ -28,7 +28,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2008040200;
$config->version = 2010061800;
$config->release = '1.0.0';
?>
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2009 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage blocktype-groupinfo
* @author Liip AG
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2010 Liip AG http://www.liip.ch
*
*/
defined('INTERNAL') || die();
$string['title'] = 'Group Info';
$string['description'] = 'Display information about the group';
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2009 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage blocktype-groupinfo
* @author Liip AG
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2010 Liip AG, http://www.liip.ch
*
*/
defined('INTERNAL') || die();
require_once('group.php');
safe_require('artefact', 'file');
class PluginBlocktypeGroupInfo extends SystemBlocktype {
public static function get_title() {
return get_string('title', 'blocktype.groupinfo');
}
public static function get_description() {
return get_string('description', 'blocktype.groupinfo');
}
public static function single_only() {
return true;
}
public static function get_categories() {
return array('general');
}
public static function get_viewtypes() {
return array('grouphomepage');
}
public static function render_instance(BlockInstance $instance, $editing=false) {
$groupid = $instance->get_view()->get('group');
if (!$groupid) {
return '';
}
$data = self::get_data($groupid);
$dwoo = smarty_core();
$dwoo->assign('group', $data['group']);
$dwoo->assign('groupid', $data['group']->id);
$dwoo->assign('membercount', count_records('group_member', 'group', $data['group']->id));
$dwoo->assign('viewcount', count_records('view', 'group', $data['group']->id));
$dwoo->assign('filecount', $data['filecounts']->files);
$dwoo->assign('foldercount', $data['filecounts']->folders);
return $dwoo->fetch('blocktype:groupinfo:groupinfo.tpl');
}
public static function has_instance_config() {
return false;
}
public static function default_copy_type() {
return 'shallow';
}
protected static function get_data($groupid) {
if(!defined('GROUP')) {
define('GROUP', $groupid);
}
// get the currently requested group
$group = group_current_group();
$group->ctime = strftime(get_string('strftimedate'), $group->ctime);
// if the user isn't logged in an the group isn't public don't show anything
if (!is_logged_in() && !$group->public) {
throw new AccessDeniedException();
}
// find the group administrators
$group->admins = get_column_sql("SELECT \"member\"
FROM {group_member}
WHERE \"group\" = ?
AND \"role\" = 'admin'", array($group->id));
$role = group_user_access($group->id);
$group->role = $role;
// logged in user can do stuff
if (is_logged_in()) {
$afterjoin = param_variable('next', 'view');
if ($role) {
if ($role == 'admin') {
$group->membershiptype = 'admin';
$group->requests = count_records('group_member_request', 'group', $group->id);
}
else {
$group->membershiptype = 'member';
}
$group->canleave = group_user_can_leave($group->id);
}
else if ($group->jointype == 'invite'
and $invite = get_record('group_member_invite', 'group', $group->id, 'member', $USER->get('id'))) {
$group->membershiptype = 'invite';
$group->invite = group_get_accept_form('invite', $group->id, $afterjoin);
}
else if ($group->jointype == 'request'
and $request = get_record('group_member_request', 'group', $group->id, 'member', $USER->get('id'))) {
$group->membershiptype = 'request';
}
else if ($group->jointype == 'open') {
$group->groupjoin = group_get_join_form('joingroup', $group->id, $afterjoin);
}
}
$group->settingsdescription = group_display_settings($group);
$filecounts = ArtefactTypeFileBase::count_user_files(null, $group->id, null);
return array('group'=>$group, 'filecounts'=>$filecounts);
}
}
?>
{auto_escape off}
<div class="group-info">
<div class="fr">
{include file="group/groupuserstatus.tpl" group=$group returnto='view'}
</div>
{include file="group/info.tpl"}
</div>
{/auto_escape}
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2009 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage blocktype-groupinfo
* @author Liip AG
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2010 Liip AG http://www.liip.ch
*
*/
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2010061804;
$config->release = '0.9.0';
?>
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2009 Liip AG, and others; see:
* http://wiki.mahara.org/Contributors
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage blocktype-groupmembers
* @author Liip AG
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2009 Liip AG, http://liip.ch
*
*/
defined('INTERNAL') || die();
$string['title'] = 'Group Members';
$string['description'] = 'Display a list of Members in this Group';
$string['show_all'] = 'View all Members of this Group…';
$string['options_rows_title'] = 'Rows';
$string['options_rows_desc'] = 'The amount of rows you want to display.';
$string['options_columns_title'] = 'Columns';
$string['options_columns_desc'] = 'The columns of rows you want to display.';
$string['options_order_title'] = 'Order';
$string['options_order_desc'] = 'You can choose to display the latest group members or a random selection.';
$string['Latest'] = 'Latest';
$string['Random'] = 'Random';
\ No newline at end of file
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2009 Liip AG, and others; see:
* http://wiki.mahara.org/Contributors
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage blocktype-groupmembers
* @author Liip AG
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2009 Liip AG, http://liip.ch
*
*/
defined('INTERNAL') || die();
class PluginBlocktypeGroupMembers extends SystemBlocktype {
public static function get_title () {
return get_string('title', 'blocktype.groupmembers');
}
public static function get_description () {
return get_string('description', 'blocktype.groupmembers');
}
public static function single_only () {
return true;
}
public static function get_categories () {
return array('general');
}
public static function get_viewtypes () {
return array('grouphomepage');
}
public static function render_instance (BlockInstance $instance, $editing = false) {
global $USER;
$configdata = $instance->get('configdata');
$rows = isset($configdata['rows']) ? $configdata['rows'] : 1;
$columns = isset($configdata['columns']) ? $configdata['columns'] : 6;
$order = isset($configdata['order']) ? $configdata['order'] : 'latest';
$groupid = $instance->get_view()->get('group');
require_once('searchlib.php');
$groupmembers = get_group_user_search_results($groupid, '', 0, $rows * $columns, '', $order);
if ($groupmembers['count']) {
$groupmembersarray = array_chunk($groupmembers['data'], $columns);
$smarty = smarty_core();
$smarty->assign_by_ref('groupmembers', $groupmembersarray);
$groupmembers['tablerows'] = $smarty->fetch('blocktype:groupmembers:row.tpl');
} else {
$groupmembers = false;
}
$show_all = array(
'url' => get_config('wwwroot') . 'group/members.php?id=' . $groupid,
'message' => get_string('show_all', 'blocktype.groupmembers')
);
$smarty = smarty_core();
$smarty->assign('groupmembers', $groupmembers);
$smarty->assign('show_all', $show_all);
return $smarty->fetch('blocktype:groupmembers:groupmembers.tpl');
}
public static function has_instance_config() {
return true;
}
public static function instance_config_form($instance) {
$configdata = $instance->get('configdata');
$options = range(0,9);
unset($options[0]);
return array(
'rows' => array(
'type' => 'select',
'title' => get_string('options_rows_title', 'blocktype.groupmembers'),
'description' => get_string('options_rows_desc', 'blocktype.groupmembers'),
'defaultvalue' => isset($configdata['rows']) ? $configdata['rows'] : 1,
'options' => $options,
),
'columns' => array(
'type' => 'select',
'title' => get_string('options_columns_title', 'blocktype.groupmembers'),
'description' => get_string('options_columns_desc', 'blocktype.groupmembers'),
'defaultvalue' => isset($configdata['columns']) ? $configdata['columns'] : 6,
'options' => $options,
),
'order' => array(
'type' => 'select',
'title' => get_string('options_order_title', 'blocktype.groupmembers'),
'description' => get_string('options_order_desc', 'blocktype.groupmembers'),
'defaultvalue' => !empty($configdata['order']) ? $configdata['order'] : 'latest',
'options' => array(
'latest' => get_string('Latest','blocktype.groupmembers'),
'random' => get_string('Random','blocktype.groupmembers'),
),
),
);
}
}
\ No newline at end of file
{auto_escape off}
<div class="friends">
{if $groupmembers}
<table id="userfriendstable" class="center fullwidth">
<tbody>
{$groupmembers.tablerows}
</tbody>
</table>
{/if}
<div class="message"><a href="{$show_all.url}">{$show_all.message|escape}</div>
</div>
{/auto_escape}
{auto_escape off}
{foreach from=$groupmembers item=row}
<tr>
{foreach from=$row item=groupmember}
<td class="{cycle values='r0,r1'} friendcell">
<a href="{$WWWROOT}user/view.php?id={$groupmember['id']}">
<img src="{profile_icon_url user=$groupmember maxwidth=60 maxheight=60}" alt="" title="{$groupmember|display_default_name|escape}">
</a>
<div><a href="{$WWWROOT}user/view.php?id={$groupmember['id']}">{$groupmember|display_default_name|escape}</a></div>
</td>
{/foreach}
</tr>
{/foreach}
{/auto_escape}
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2009 Liip AG, and others; see:
* http://wiki.mahara.org/Contributors
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage blocktype-groupmembers
* @author Liip AG
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2009 Liip AG, http://liip.ch
*
*/
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2010061803;
$config->release = '1.0.0';
\ No newline at end of file
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2009 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage blocktype-groupinfo
* @author Liip AG
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2010 Liip AG http://www.liip.ch
*
*/
defined('INTERNAL') || die();
$string['title'] = 'Group Views';
$string['description'] = 'Display the views shared with the group';
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2009 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage blocktype-groupviews
* @author Liip AG
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2010 Liip AG, http://www.liip.ch
*
*/
defined('INTERNAL') || die();
require_once('group.php');
class PluginBlocktypeGroupViews extends SystemBlocktype {
public static function get_title() {
return get_string('title', 'blocktype.groupviews');
}
public static function get_description() {
return get_string('description', 'blocktype.groupviews');
}
public static function single_only() {
return true;
}
public static function get_categories() {
return array('general');
}
public static function get_viewtypes() {
return array('grouphomepage');
}
public static function hide_title_on_empty_content() {
return true;
}
public static function render_instance(BlockInstance $instance, $editing=false) {
$groupid = $instance->get_view()->get('group');
if (!$groupid) {
return '';
}
$data = self::get_data($groupid);
$dwoo = smarty_core();
$dwoo->assign('group', $data['group']);
$dwoo->assign('groupid', $data['group']->id);
if (isset($data['sharedviews'])) {
$dwoo->assign('sharedviews', $data['sharedviews']->data);
}
if (isset($data['allsubmittedviews'])) {
$dwoo->assign('allsubmittedviews', $data['allsubmittedviews']);
}
if (isset($data['mysubmittedviews'])) {
$dwoo->assign('mysubmittedviews', $data['mysubmittedviews']);
}
if (!$editing && isset($data['group_view_submission_form'])) {
$dwoo->assign('group_view_submission_form', $data['group_view_submission_form']);
}
return $dwoo->fetch('blocktype:groupviews:groupviews.tpl');
}
public static function has_instance_config() {
return false;
}
public static function default_copy_type() {
return 'shallow';
}
protected static function get_data($groupid) {