Commit be498131 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Make display of group type/visibility settings smaller & more descriptive


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 0d21d69a
...@@ -41,7 +41,7 @@ $group->admins = get_column_sql("SELECT member ...@@ -41,7 +41,7 @@ $group->admins = get_column_sql("SELECT member
$filecounts = ArtefactTypeFileBase::count_user_files(null, $group->id, null); $filecounts = ArtefactTypeFileBase::count_user_files(null, $group->id, null);
$group->grouptypedescription = get_string('grouptypedescription', 'group', get_string('name', 'grouptype.' . $group->grouptype), get_string('membershiptype.'.$group->jointype, 'group')); $group->settingsdescription = group_display_settings($group);
$smarty = smarty_core(); $smarty = smarty_core();
$smarty->assign('group', $group); $smarty->assign('group', $group);
......
...@@ -78,7 +78,7 @@ if (is_logged_in()) { ...@@ -78,7 +78,7 @@ if (is_logged_in()) {
} }
} }
$group->grouptypedescription = get_string('grouptypedescription', 'group', get_string('name', 'grouptype.' . $group->grouptype), get_string('membershiptype.'.$group->jointype, 'group')); $group->settingsdescription = group_display_settings($group);
$filecounts = ArtefactTypeFileBase::count_user_files(null, $group->id, null); $filecounts = ArtefactTypeFileBase::count_user_files(null, $group->id, null);
......
...@@ -67,10 +67,10 @@ $string['Admin'] = 'Admin'; ...@@ -67,10 +67,10 @@ $string['Admin'] = 'Admin';
$string['grouptype'] = 'Group type'; $string['grouptype'] = 'Group type';
$string['publiclyviewablegroup'] = 'Publicly Viewable Group?'; $string['publiclyviewablegroup'] = 'Publicly Viewable Group?';
$string['publiclyviewablegroupdescription'] = 'Allow people who are not logged-in to view this group, including the forums?'; $string['publiclyviewablegroupdescription'] = 'Allow people who are not logged-in to view this group, including the forums?';
$string['publicvisibility'] = 'Publicly visible'; $string['Type'] = 'Type';
$string['publiclyvisible'] = 'Publicly visible';
$string['usersautoadded'] = 'Users auto-added?'; $string['usersautoadded'] = 'Users auto-added?';
$string['usersautoaddeddescription'] = 'Automatically put all new users into this group?'; $string['usersautoaddeddescription'] = 'Automatically put all new users into this group?';
$string['grouptypedescription'] = '%s > %s';
$string['hasrequestedmembership'] = 'has requested membership of this group'; $string['hasrequestedmembership'] = 'has requested membership of this group';
$string['hasbeeninvitedtojoin'] = 'has been invited to join this group'; $string['hasbeeninvitedtojoin'] = 'has been invited to join this group';
...@@ -314,4 +314,5 @@ $string['membersdescription:controlled'] = 'This is a controlled membership grou ...@@ -314,4 +314,5 @@ $string['membersdescription:controlled'] = 'This is a controlled membership grou
// View submission // View submission
$string['submit'] = 'Submit'; $string['submit'] = 'Submit';
$string['allowssubmissions'] = 'Allows submissions';
?> ?>
...@@ -824,7 +824,7 @@ function group_prepare_usergroups_for_display($groups, $returnto='mygroups') { ...@@ -824,7 +824,7 @@ function group_prepare_usergroups_for_display($groups, $returnto='mygroups') {
else if ($group->membershiptype == 'invite') { else if ($group->membershiptype == 'invite') {
$group->invite = group_get_accept_form('invite' . $i++, $group->id, $returnto); $group->invite = group_get_accept_form('invite' . $i++, $group->id, $returnto);
} }
$group->grouptypedescription = get_string('grouptypedescription', 'group', get_string('name', 'grouptype.' . $group->grouptype), get_string('membershiptype.'.$group->jointype, 'group')); $group->settingsdescription = group_display_settings($group);
} }
} }
...@@ -1307,6 +1307,20 @@ function group_get_user_course_groups($userid=null) { ...@@ -1307,6 +1307,20 @@ function group_get_user_course_groups($userid=null) {
} }
function group_allows_submission($grouptype) { function group_allows_submission($grouptype) {
return get_field('grouptype', 'submittableto', 'name', $grouptype); static $grouptypes = null;
if (is_null($grouptypes)) {
$grouptypes = get_records_assoc('grouptype');
}
return (bool) $grouptypes[$grouptype]->submittableto;
}
function group_display_settings($group) {
$string = get_string('membershiptype.'.$group->jointype, 'group');
if (group_allows_submission($group->grouptype)) {
$string .= ', ' . get_string('allowssubmissions', 'group');
}
if ($group->public) {
$string .= ', ' . get_string('publiclyvisible', 'group');
}
return $string;
} }
?>
{auto_escape off} {auto_escape off}
<h3><a href="{$WWWROOT}group/view.php?id={$group->id|escape}">{$group->name|escape}</a></h3> <h3><a href="{$WWWROOT}group/view.php?id={$group->id|escape}">{$group->name|escape}</a></h3>
<h6>{foreach name=admins from=$group->admins item=id}<a href="{$WWWROOT}user/view.php?id={$id|escape}">{$id|display_name|escape}</a>{if !$.foreach.admins.last}, {/if}{/foreach}</h6> <h6>{foreach name=admins from=$group->admins item=id}<a href="{$WWWROOT}user/view.php?id={$id|escape}">{$id|display_name|escape}</a>{if !$.foreach.admins.last}, {/if}{/foreach}</h6>
<div>{str tag="grouptype" section="group"}: {$group->grouptypedescription}</div> <div>{$group->settingsdescription}</div>
<div>{str tag="publicvisibility" section="group"}: {if $group->public}{str tag="yes"}{else}{str tag="no"}{/if}</div>
{$group->description} {$group->description}
<div>{str tag="memberslist" section="group"} <div>{str tag="memberslist" section="group"}
{foreach name=members from=$group->members item=member} {foreach name=members from=$group->members item=member}
......
...@@ -4,8 +4,7 @@ ...@@ -4,8 +4,7 @@
<img src="{$WWWROOT}thumb.php?type=profileicon&amp;maxsize=20&amp;id={$id|escape}" alt=""> <img src="{$WWWROOT}thumb.php?type=profileicon&amp;maxsize=20&amp;id={$id|escape}" alt="">
<a href="{$WWWROOT}user/view.php?id={$id|escape}">{$id|display_name|escape}</a>{if !$.foreach.admins.last}, {/if} <a href="{$WWWROOT}user/view.php?id={$id|escape}">{$id|display_name|escape}</a>{if !$.foreach.admins.last}, {/if}
{/foreach}</li> {/foreach}</li>
<li><label>{str tag="grouptype" section="group"}:</label> {$group->grouptypedescription}</li> <li>{$group->settingsdescription}</li>
<li><label>{str tag="publicvisibility" section="group"}:</label> {if $group->public}{str tag="yes"}{else}{str tag="no"}{/if}</li>
<li><label>{str tag=Created section=group}:</label> {$group->ctime}</li> <li><label>{str tag=Created section=group}:</label> {$group->ctime}</li>
<li><span><label>{str tag=Members section=group}:</label> {$membercount}&nbsp;</span> <li><span><label>{str tag=Members section=group}:</label> {$membercount}&nbsp;</span>
<span><label>{str tag=Views section=view}:</label> {$viewcount}&nbsp;</span> <span><label>{str tag=Views section=view}:</label> {$viewcount}&nbsp;</span>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment