Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
81f9f076
Commit
81f9f076
authored
Aug 29, 2008
by
Richard Mansfield
Browse files
Set GROUP in smarty constructor when GROUP is defined; change some templates to use it
parent
51e9db1f
Changes
20
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/file/groupfiles.php
View file @
81f9f076
...
...
@@ -33,11 +33,10 @@ safe_require('artefact', 'file');
$javascript
=
ArtefactTypeFileBase
::
get_my_files_js
(
param_integer
(
'folder'
,
null
));
$groupid
=
param_integer
(
'group'
);
define
(
'INGROUP'
,
$groupid
);
define
(
'GROUP'
,
param_integer
(
'group'
));
$group
=
group_current_group
();
if
(
!
group_user_access
(
$groupid
))
{
if
(
!
group_user_access
(
$group
->
id
))
{
throw
new
AccessDeniedException
();
}
define
(
'TITLE'
,
$group
->
name
.
' - '
.
get_string
(
'groupfiles'
,
'artefact.file'
));
...
...
@@ -45,13 +44,13 @@ define('TITLE', $group->name . ' - ' . get_string('groupfiles', 'artefact.file')
require_once
(
get_config
(
'docroot'
)
.
'interaction/lib.php'
);
$groupdata
=
json_encode
(
$group
);
$grouproles
=
json_encode
(
array_values
(
group_get_role_info
(
$groupid
)));
$grouproles
=
json_encode
(
array_values
(
group_get_role_info
(
$group
->
id
)));
$javascript
.
=
<<<GROUPJS
var group = {$groupdata};
group.roles = {$grouproles};
browser.setgroup({$groupid});
uploader.setgroup({$groupid});
browser.setgroup({$group
->
id});
uploader.setgroup({$group
->
id});
GROUPJS;
$smarty
=
smarty
(
...
...
@@ -60,12 +59,11 @@ $smarty = smarty(
array
(),
array
(
'sideblocks'
=>
array
(
interaction_sideblock
(
$groupid
),
interaction_sideblock
(
$group
->
id
),
),
)
);
$smarty
->
assign
(
'heading'
,
$group
->
name
.
' - '
.
get_string
(
'Files'
,
'artefact.file'
));
$smarty
->
assign
(
'groupid'
,
$groupid
);
$smarty
->
assign
(
'INLINEJAVASCRIPT'
,
$javascript
);
$smarty
->
display
(
'artefact:file:index.tpl'
);
...
...
htdocs/artefact/file/theme/default/index.tpl
View file @
81f9f076
...
...
@@ -2,7 +2,7 @@
{
include
file
=
"sidebar.tpl"
}
{
include
file
=
"columnleftstart.tpl"
}
{
if
$
groupid
}
{
if
$
GROUP
}
<h2>
{
$heading
}
</h2>
{
elseif
$institution
}
<h2>
{
$heading
}
</h2>
...
...
htdocs/group/changerole.php
View file @
81f9f076
...
...
@@ -30,28 +30,28 @@ require(dirname(dirname(__FILE__)) . '/init.php');
require_once
(
'group.php'
);
require_once
(
get_config
(
'docroot'
)
.
'interaction/lib.php'
);
$groupid
=
param_integer
(
'group'
);
define
(
'GROUP'
,
param_integer
(
'group'
));
$group
=
group_current_group
();
$userid
=
param_integer
(
'user'
);
$newrole
=
param_alpha
(
'role'
,
null
);
define
(
'INGROUP'
,
$groupid
);
$group
=
group_current_group
();
if
(
!
$user
=
get_record
(
'usr'
,
'id'
,
$userid
,
'deleted'
,
0
))
{
throw
new
UserNotFoundException
(
"Couldn't find user with id
$userid
"
);
}
$currentrole
=
group_user_access
(
$groupid
,
$userid
);
$currentrole
=
group_user_access
(
$group
->
id
,
$userid
);
if
(
!
$currentrole
)
{
throw
new
UserNotFoundException
(
"Couldn't find user with id
$userid
in group
$groupid
"
);
throw
new
UserNotFoundException
(
"Couldn't find user with id
$userid
in group
$group
->
id
"
);
}
$role
=
group_user_access
(
$groupid
);
$role
=
group_user_access
(
$group
->
id
);
if
(
$role
!=
'admin'
)
{
throw
new
AccessDeniedException
();
}
$roles
=
group_get_role_info
(
$groupid
);
$roles
=
group_get_role_info
(
$group
->
id
);
$rolechange_available
=
false
;
foreach
(
$roles
as
&
$r
)
{
$disabled
=
(
$r
->
role
==
$currentrole
)
||
(
!
group_can_change_role
(
$groupid
,
$userid
,
$r
->
role
));
$disabled
=
(
$r
->
role
==
$currentrole
)
||
(
!
group_can_change_role
(
$group
->
id
,
$userid
,
$r
->
role
));
if
(
!
$disabled
)
{
$rolechange_available
=
true
;
}
...
...
@@ -63,7 +63,7 @@ foreach ($roles as &$r) {
if
(
!
$rolechange_available
)
{
$SESSION
->
add_info_msg
(
'This user has no roles they can change to'
);
redirect
(
'/group/members.php?id='
.
$groupid
);
redirect
(
'/group/members.php?id='
.
$group
->
id
);
}
$changeform
=
pieform
(
array
(
...
...
@@ -100,9 +100,7 @@ function changerole_submit(Pieform $form, $values) {
define
(
'TITLE'
,
$group
->
name
.
' - '
.
get_string
(
'changerole'
,
'group'
));
$smarty
=
smarty
(
array
(),
array
(),
array
(),
array
(
'sideblocks'
=>
array
(
interaction_sideblock
(
$groupid
,
$role
))));
$smarty
->
assign
(
'group'
,
$group
);
$smarty
->
assign
(
'groupid'
,
$groupid
);
$smarty
=
smarty
(
array
(),
array
(),
array
(),
array
(
'sideblocks'
=>
array
(
interaction_sideblock
(
$group
->
id
,
$role
))));
$smarty
->
assign
(
'subtitle'
,
get_string
(
'changeroleofuseringroup'
,
'group'
,
display_name
(
$user
),
$group
->
name
));
$smarty
->
assign
(
'changeform'
,
$changeform
);
...
...
htdocs/group/members.php
View file @
81f9f076
...
...
@@ -31,15 +31,14 @@ require_once('group.php');
require_once
(
'searchlib.php'
);
require_once
(
get_config
(
'docroot'
)
.
'interaction/lib.php'
);
$id
=
param_integer
(
'id'
);
define
(
'GROUP'
,
param_integer
(
'id'
)
)
;
$membershiptype
=
param_alpha
(
'membershiptype'
,
null
);
define
(
'INGROUP'
,
$id
);
$group
=
group_current_group
();
define
(
'TITLE'
,
$group
->
name
.
' - '
.
get_string
(
'Members'
,
'group'
));
$role
=
group_user_access
(
$id
);
$role
=
group_user_access
(
$
group
->
id
);
if
(
!
empty
(
$membershiptype
)
&&
$role
!=
'admin'
)
{
throw
new
AccessDeniedException
();
...
...
@@ -49,13 +48,11 @@ if (!empty($membershiptype) && $role != 'admin') {
$query
=
trim
(
param_variable
(
'query'
,
''
));
$offset
=
param_integer
(
'offset'
,
0
);
$limit
=
param_integer
(
'limit'
,
10
);
list
(
$html
,
$pagination
,
$count
,
$offset
,
$membershiptype
)
=
group_get_membersearch_data
(
$id
,
$query
,
$offset
,
$limit
,
$membershiptype
);
list
(
$html
,
$pagination
,
$count
,
$offset
,
$membershiptype
)
=
group_get_membersearch_data
(
$
group
->
id
,
$query
,
$offset
,
$limit
,
$membershiptype
);
$smarty
=
smarty
(
array
(
'groupmembersearch'
),
array
(),
array
(),
array
(
'sideblocks'
=>
array
(
interaction_sideblock
(
$id
,
$role
)),
'sideblocks'
=>
array
(
interaction_sideblock
(
$
group
->
id
,
$role
)),
));
$smarty
->
assign
(
'group'
,
$group
);
$smarty
->
assign
(
'groupid'
,
$id
);
$smarty
->
assign
(
'query'
,
$query
);
$smarty
->
assign
(
'results'
,
$html
);
$smarty
->
assign
(
'pagination'
,
$pagination
[
'html'
]);
...
...
htdocs/group/view.php
View file @
81f9f076
...
...
@@ -33,9 +33,7 @@ require_once(get_config('docroot') . 'interaction/lib.php');
require_once
(
get_config
(
'libroot'
)
.
'view.php'
);
safe_require
(
'artefact'
,
'file'
);
$id
=
param_integer
(
'id'
);
define
(
'INGROUP'
,
$id
);
define
(
'GROUP'
,
param_integer
(
'id'
));
$group
=
group_current_group
();
define
(
'TITLE'
,
$group
->
name
);
...
...
@@ -44,9 +42,9 @@ $group->ctime = strftime(get_string('strftimedate'), $group->ctime);
$group
->
admins
=
get_column_sql
(
"SELECT member
FROM
{
group_member
}
WHERE
\"
group
\"
= ?
AND role = 'admin'"
,
array
(
$id
));
AND role = 'admin'"
,
array
(
$
group
->
id
));
$role
=
group_user_access
(
$id
);
$role
=
group_user_access
(
$
group
->
id
);
if
(
$role
)
{
if
(
$role
==
'admin'
)
{
$group
->
membershiptype
=
'admin'
;
...
...
@@ -95,10 +93,10 @@ $foruminfo = get_records_sql_array('
ORDER BY
p.ctime DESC
LIMIT 5;
'
,
array
(
$id
));
$smarty
=
smarty
(
array
(),
array
(),
array
(),
array
(
'sideblocks'
=>
array
(
interaction_sideblock
(
$id
,
$role
))));
'
,
array
(
$
group
->
id
));
$smarty
=
smarty
(
array
(),
array
(),
array
(),
array
(
'sideblocks'
=>
array
(
interaction_sideblock
(
$
group
->
id
,
$role
))));
$smarty
->
assign
(
'group'
,
$group
);
$smarty
->
assign
(
'groupid'
,
$id
);
$smarty
->
assign
(
'groupid'
,
$
group
->
id
);
$smarty
->
assign
(
'foruminfo'
,
$foruminfo
);
$smarty
->
assign
(
'membercount'
,
count_records
(
'group_member'
,
'group'
,
$group
->
id
));
$smarty
->
assign
(
'viewcount'
,
count_records
(
'view'
,
'group'
,
$group
->
id
));
...
...
htdocs/interaction/edit.php
View file @
81f9f076
...
...
@@ -48,7 +48,7 @@ else {
$groupid
=
param_integer
(
'group'
);
define
(
'TITLE'
,
get_string
(
'addtitle'
,
'interaction.'
.
$plugin
));
}
define
(
'
IN
GROUP'
,
$groupid
);
define
(
'GROUP'
,
$groupid
);
safe_require
(
'interaction'
,
$plugin
);
if
(
!
$group
=
get_record
(
'group'
,
'id'
,
$groupid
,
'deleted'
,
0
))
{
...
...
htdocs/interaction/forum/deletepost.php
View file @
81f9f076
...
...
@@ -54,7 +54,7 @@ $post = get_record_sql(
array
(
0
,
$postid
)
);
define
(
'
IN
GROUP'
,
$post
->
group
);
define
(
'GROUP'
,
$post
->
group
);
if
(
!
$post
)
{
...
...
htdocs/interaction/forum/editpost.php
View file @
81f9f076
...
...
@@ -78,7 +78,7 @@ if (!$parent) {
throw
new
NotFoundException
(
get_string
(
'cantfindpost'
,
'interaction.forum'
,
$parentid
));
}
define
(
'
IN
GROUP'
,
$parent
->
group
);
define
(
'GROUP'
,
$parent
->
group
);
$breadcrumbs
=
array
(
array
(
...
...
htdocs/interaction/forum/index.php
View file @
81f9f076
...
...
@@ -33,7 +33,7 @@ require_once('pieforms/pieform.php');
require_once
(
get_config
(
'docroot'
)
.
'interaction/lib.php'
);
$groupid
=
param_integer
(
'group'
);
define
(
'
IN
GROUP'
,
$groupid
);
define
(
'GROUP'
,
$groupid
);
$group
=
group_current_group
();
$membership
=
group_user_access
(
$groupid
);
...
...
htdocs/interaction/forum/topic.php
View file @
81f9f076
...
...
@@ -47,7 +47,7 @@ $topic = get_record_sql(
array
(
0
,
$USER
->
get
(
'id'
),
$USER
->
get
(
'id'
),
$topicid
)
);
define
(
'
IN
GROUP'
,
$topic
->
groupid
);
define
(
'GROUP'
,
$topic
->
groupid
);
if
(
!
$topic
)
{
throw
new
NotFoundException
(
get_string
(
'cantfindtopic'
,
'interaction.forum'
,
$topicid
));
...
...
htdocs/interaction/forum/view.php
View file @
81f9f076
...
...
@@ -52,7 +52,7 @@ $forum = get_record_sql(
array
(
0
,
$userid
,
$forumid
)
);
define
(
'
IN
GROUP'
,
$forum
->
groupid
);
define
(
'GROUP'
,
$forum
->
groupid
);
if
(
!
$forum
)
{
throw
new
InteractionInstanceNotFoundException
(
get_string
(
'cantfindforum'
,
'interaction.forum'
,
$forumid
));
...
...
htdocs/lib/group.php
View file @
81f9f076
...
...
@@ -865,10 +865,10 @@ function group_param_userid($userid) {
function
group_current_group
()
{
static
$group
;
if
(
defined
(
'
IN
GROUP'
))
{
$group
=
get_record_select
(
'group'
,
'id = ? AND deleted = 0'
,
array
(
IN
GROUP
),
'*, '
.
db_format_tsfield
(
'ctime'
));
if
(
defined
(
'GROUP'
))
{
$group
=
get_record_select
(
'group'
,
'id = ? AND deleted = 0'
,
array
(
GROUP
),
'*, '
.
db_format_tsfield
(
'ctime'
));
if
(
!
$group
)
{
throw
new
GroupNotFoundException
(
get_string
(
'groupnotfound'
,
'group'
,
IN
GROUP
));
throw
new
GroupNotFoundException
(
get_string
(
'groupnotfound'
,
'group'
,
GROUP
));
}
}
else
{
...
...
htdocs/lib/view.php
View file @
81f9f076
...
...
@@ -1800,7 +1800,7 @@ class View {
public
static
function
set_nav
(
$group
,
$institution
)
{
if
(
$group
)
{
define
(
'MENUITEM'
,
'groups/views'
);
define
(
'
IN
GROUP'
,
$group
);
define
(
'GROUP'
,
$group
);
}
else
if
(
$institution
)
{
define
(
'INSTITUTIONALADMIN'
,
1
);
...
...
htdocs/lib/web.php
View file @
81f9f076
...
...
@@ -374,8 +374,8 @@ EOF;
$smarty
->
assign
(
'PAGEHELPNAME'
,
$help
[
0
]);
$smarty
->
assign
(
'PAGEHELPICON'
,
$help
[
1
]);
}
if
(
defined
(
'
IN
GROUP'
))
{
$smarty
->
assign
(
'
IN
GROUP'
,
INGROUP
);
if
(
defined
(
'GROUP'
))
{
$smarty
->
assign
(
'GROUP'
,
group_current_group
()
);
}
// ---------- sideblock stuff ----------
...
...
@@ -1679,7 +1679,7 @@ function main_nav() {
),
);
if
(
defined
(
'
IN
GROUP'
))
{
if
(
defined
(
'GROUP'
))
{
require_once
(
'group.php'
);
foreach
(
group_get_menu_tabs
()
as
$k
=>
$v
)
{
$menu
[]
=
$v
;
...
...
htdocs/theme/default/templates/group/changerole.tpl
View file @
81f9f076
...
...
@@ -2,7 +2,7 @@
{
include
file
=
"sidebar.tpl"
}
{
include
file
=
"columnleftstart.tpl"
}
<h2>
{
$
group
->
name
|
escape
}
</h2>
<h2>
{
$
GROUP
->
name
|
escape
}
</h2>
<h3>
{
$subtitle
|
escape
}
</h3>
{
$changeform
}
...
...
htdocs/theme/default/templates/group/members.tpl
View file @
81f9f076
...
...
@@ -2,10 +2,10 @@
{
include
file
=
"sidebar.tpl"
}
{
include
file
=
"columnleftstart.tpl"
}
<h2>
{
$
group
->
name
|
escape
}
-
{
str
tag
=
'Members'
section
=
'group'
}
</h2>
<h2>
{
$
GROUP
->
name
|
escape
}
-
{
str
tag
=
'Members'
section
=
'group'
}
</h2>
<form
action=
"
{
$WWWROOT
}
group/members.php"
method=
"post"
>
<input
type=
"hidden"
id=
"groupid"
name=
"id"
value=
"
{
$
group
->
id
|
escape
}
"
>
<input
type=
"hidden"
id=
"groupid"
name=
"id"
value=
"
{
$
GROUP
->
id
|
escape
}
"
>
<div
class=
"searchform center"
style=
"margin-bottom: .5em;"
>
<label>
{
str
tag
=
'Query'
section
=
'admin'
}
:
<input
type=
"text"
name=
"query"
id=
"query"
value=
"
{
$query
|
escape
}
"
>
...
...
htdocs/theme/default/templates/group/view.tpl
View file @
81f9f076
...
...
@@ -2,9 +2,9 @@
{
include
file
=
"sidebar.tpl"
}
{
include
file
=
"columnleftstart.tpl"
}
<h2>
{
$
group
->
name
|
escape
}
</h2>
<h2>
{
$
GROUP
->
name
|
escape
}
</h2>
{
if
$
group
->
description
}
<p
id=
"group-description"
>
{
$
group
->
description
}
</p>
{/
if
}
{
if
$
GROUP
->
description
}
<p
id=
"group-description"
>
{
$
GROUP
->
description
}
</p>
{/
if
}
<ul
id=
"group-info"
>
<li><strong>
{
str
tag
=
groupadmins
section
=
group
}
:
</strong>
{
foreach
name
=
admins
from
=
$group
->
admins
item
=
id
}
...
...
htdocs/theme/default/templates/header.tpl
View file @
81f9f076
...
...
@@ -82,10 +82,10 @@
</ul>
</div>
</div>
<div
id=
"subnav"
{
if
$
IN
GROUP
}
class=
"group"
{/
if
}
>
<div
id=
"subnav"
{
if
$GROUP
}
class=
"group"
{/
if
}
>
{
if
$MAINNAVSELECTED.submenu
}
<ul>
{
if
$
IN
GROUP
}
<li
class=
"groupname"
>
{
str
tag
=
"Group"
section
=
"group"
}
:
</li>
{/
if
}
{
if
$GROUP
}
<li
class=
"groupname"
>
{
str
tag
=
"Group"
section
=
"group"
}
:
</li>
{/
if
}
{
foreach
from
=
$MAINNAVSELECTED.submenu
item
=
item
}
<li
{
if
$item.selected
}
class=
"selected"
{/
if
}
><a
href=
"
{
$WWWROOT
}{
$item.url
|
escape
}
"
>
{
$item.title
|
escape
}
</a></li>
{/
foreach
}
</ul>
{/
if
}
...
...
htdocs/theme/default/templates/view/index.tpl
View file @
81f9f076
...
...
@@ -6,8 +6,8 @@
{
$createviewform
}
<form
method=
"post"
action=
"
{
$WWWROOT
}
view/choosetemplate.php"
>
<input
type=
"submit"
class=
"submit"
value=
"
{
str
tag
=
"copyaview"
section
=
"view"
}
"
>
{
if
$
groupid
}
<input
type=
"hidden"
name=
"group"
value=
"
{
$
group
id
}
"
/>
{
if
$
GROUP
}
<input
type=
"hidden"
name=
"group"
value=
"
{
$
GROUP
->
id
}
"
/>
{
elseif
$institution
}
<input
type=
"hidden"
name=
"institution"
value=
"
{
$institution
}
"
>
{/
if
}
...
...
@@ -89,7 +89,7 @@
{
else
}
<table
id=
"myviewstable"
{
if
$member
}
class=
"groupviews"
{/
if
}
>
<tr>
<td>
{
if
$
groupid
}{
str
tag
=
"noviewstosee"
section
=
"group"
}{
elseif
$institution
}{
str
tag
=
"noviews"
}{
else
}{
str
tag
=
"noviews"
section
=
"view"
}{/
if
}
</td>
<td>
{
if
$
GROUP
}{
str
tag
=
"noviewstosee"
section
=
"group"
}{
elseif
$institution
}{
str
tag
=
"noviews"
}{
else
}{
str
tag
=
"noviews"
section
=
"view"
}{/
if
}
</td>
</tr>
</table>
{/
if
}
...
...
htdocs/view/groupviews.php
View file @
81f9f076
...
...
@@ -40,23 +40,23 @@ require_once('pieforms/pieform.php');
$limit
=
param_integer
(
'limit'
,
5
);
$offset
=
param_integer
(
'offset'
,
0
);
$groupid
=
param_integer
(
'group'
);
define
(
'INGROUP'
,
$groupid
);
define
(
'GROUP'
,
param_integer
(
'group'
));
$group
=
group_current_group
();
define
(
'TITLE'
,
$group
->
name
.
' - '
.
get_string
(
'groupviews'
,
'view'
));
$member
=
group_user_access
(
$groupid
);
$member
=
group_user_access
(
$group
->
id
);
$shared
=
param_boolean
(
'shared'
,
0
)
&&
$member
;
$can_edit
=
group_user_can_edit_views
(
$groupid
);
$can_edit
=
group_user_can_edit_views
(
$group
->
id
);
$smarty
=
smarty
();
$smarty
->
assign
(
'heading'
,
$group
->
name
.
' - '
.
get_string
(
'views'
));
if
(
$can_edit
)
{
$data
=
View
::
get_myviews_data
(
$limit
,
$offset
,
$groupid
);
$data
=
View
::
get_myviews_data
(
$limit
,
$offset
,
$group
->
id
);
}
else
{
$data
=
View
::
view_search
(
null
,
$groupid
,
null
,
null
,
$limit
,
$offset
);
$data
=
View
::
view_search
(
null
,
$group
->
id
,
null
,
null
,
$limit
,
$offset
);
}
$userid
=
$USER
->
get
(
'id'
);
...
...
@@ -70,13 +70,11 @@ $pagination = build_pagination(array(
'resultcounttextplural'
=>
get_string
(
'views'
,
'view'
)
));
$smarty
->
assign
(
'groupid'
,
$groupid
);
$smarty
->
assign
(
'groupviews'
,
1
);
$smarty
->
assign
(
'groupname'
,
$group
->
name
);
$smarty
->
assign
(
'member'
,
$member
);
$smarty
->
assign
(
'views'
,
$data
->
data
);
$smarty
->
assign
(
'pagination'
,
$pagination
[
'html'
]);
$smarty
->
assign
(
'createviewform'
,
pieform
(
create_view_form
(
$groupid
)));
$smarty
->
assign
(
'createviewform'
,
pieform
(
create_view_form
(
$group
->
id
)));
if
(
$can_edit
)
{
// && !$shared) {
$smarty
->
display
(
'view/index.tpl'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment