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
10b1c1bc
Commit
10b1c1bc
authored
Jan 05, 2009
by
Richard Mansfield
Browse files
Override block instance titles for 'My Friends', etc profile block types (bug #3085)
parent
6e996933
Changes
9
Hide whitespace changes
Inline
Side-by-side
htdocs/blocktype/lib.php
View file @
10b1c1bc
...
...
@@ -55,6 +55,14 @@ abstract class PluginBlocktype extends Plugin {
public
static
abstract
function
get_title
();
/**
* Allows block types to override the instance's title.
*
* For example: My Views, My Groups, My Friends, Wall
*/
public
static
function
override_instance_title
(
BlockInstance
$instance
)
{
}
public
static
abstract
function
get_description
();
public
static
abstract
function
get_categories
();
...
...
@@ -438,7 +446,8 @@ class BlockInstance {
$smarty
=
smarty_core
();
$smarty
->
assign
(
'id'
,
$this
->
get
(
'id'
));
$smarty
->
assign
(
'title'
,
$this
->
get
(
'title'
));
$title
=
call_static_method
(
generate_class_name
(
'blocktype'
,
$this
->
get
(
'blocktype'
)),
'override_instance_title'
,
$this
);
$smarty
->
assign
(
'title'
,
$title
?
$title
:
$this
->
get
(
'title'
));
$smarty
->
assign
(
'column'
,
$this
->
get
(
'column'
));
$smarty
->
assign
(
'order'
,
$this
->
get
(
'order'
));
...
...
@@ -472,7 +481,8 @@ class BlockInstance {
$smarty
=
smarty_core
();
$smarty
->
assign
(
'id'
,
$this
->
get
(
'id'
));
$smarty
->
assign
(
'title'
,
$this
->
get
(
'title'
));
$title
=
call_static_method
(
generate_class_name
(
'blocktype'
,
$this
->
get
(
'blocktype'
)),
'override_instance_title'
,
$this
);
$smarty
->
assign
(
'title'
,
$title
?
$title
:
$this
->
get
(
'title'
));
// If this block is for just one artefact, we set the title of the
// block to be a link to view more information about that artefact
...
...
htdocs/blocktype/myfriends/lang/en.utf8/blocktype.myfriends.php
View file @
10b1c1bc
...
...
@@ -27,5 +27,6 @@
defined
(
'INTERNAL'
)
||
die
();
$string
[
'title'
]
=
'My Friends'
;
$string
[
'otherusertitle'
]
=
"%s's Friends"
;
$string
[
'description'
]
=
'Display your friends'
;
?>
htdocs/blocktype/myfriends/lib.php
View file @
10b1c1bc
...
...
@@ -154,6 +154,15 @@ class PluginBlocktypeMyfriends extends SystemBlocktype {
return
$view
->
get
(
'owner'
)
!=
null
;
}
public
static
function
override_instance_title
(
BlockInstance
$instance
)
{
global
$USER
;
$ownerid
=
$instance
->
get_view
()
->
get
(
'owner'
);
if
(
$ownerid
==
$USER
->
get
(
'id'
))
{
return
get_string
(
'title'
,
'blocktype.myfriends'
);
}
return
get_string
(
'otherusertitle'
,
'blocktype.myfriends'
,
display_name
(
$ownerid
,
null
,
true
));
}
}
?>
htdocs/blocktype/mygroups/lang/en.utf8/blocktype.mygroups.php
View file @
10b1c1bc
...
...
@@ -27,5 +27,6 @@
defined
(
'INTERNAL'
)
||
die
();
$string
[
'title'
]
=
'My Groups'
;
$string
[
'otherusertitle'
]
=
"%s's Groups"
;
$string
[
'description'
]
=
'Display a list of the groups you belong to'
;
?>
htdocs/blocktype/mygroups/lib.php
View file @
10b1c1bc
...
...
@@ -78,6 +78,15 @@ class PluginBlocktypeMyGroups extends SystemBlocktype {
return
$view
->
get
(
'owner'
)
!=
null
;
}
public
static
function
override_instance_title
(
BlockInstance
$instance
)
{
global
$USER
;
$ownerid
=
$instance
->
get_view
()
->
get
(
'owner'
);
if
(
$ownerid
==
$USER
->
get
(
'id'
))
{
return
get_string
(
'title'
,
'blocktype.mygroups'
);
}
return
get_string
(
'otherusertitle'
,
'blocktype.mygroups'
,
display_name
(
$ownerid
,
null
,
true
));
}
}
?>
htdocs/blocktype/myviews/lang/en.utf8/blocktype.myviews.php
View file @
10b1c1bc
...
...
@@ -27,5 +27,6 @@
defined
(
'INTERNAL'
)
||
die
();
$string
[
'title'
]
=
'My Views'
;
$string
[
'otherusertitle'
]
=
"%s's Views"
;
$string
[
'description'
]
=
'Display all your views that are visible to the person viewing your profile'
;
?>
htdocs/blocktype/myviews/lib.php
View file @
10b1c1bc
...
...
@@ -111,6 +111,15 @@ class PluginBlocktypeMyviews extends SystemBlocktype {
return
$view
->
get
(
'owner'
)
!=
null
;
}
public
static
function
override_instance_title
(
BlockInstance
$instance
)
{
global
$USER
;
$ownerid
=
$instance
->
get_view
()
->
get
(
'owner'
);
if
(
$ownerid
==
$USER
->
get
(
'id'
))
{
return
get_string
(
'title'
,
'blocktype.myviews'
);
}
return
get_string
(
'otherusertitle'
,
'blocktype.myviews'
,
display_name
(
$ownerid
,
null
,
true
));
}
}
?>
htdocs/blocktype/wall/lang/en.utf8/blocktype.wall.php
View file @
10b1c1bc
...
...
@@ -27,6 +27,7 @@
defined
(
'INTERNAL'
)
||
die
();
$string
[
'title'
]
=
'Wall'
;
$string
[
'otherusertitle'
]
=
"%s's Wall"
;
$string
[
'description'
]
=
'Display an area where people can leave you comments'
;
$string
[
'noposts'
]
=
'No wall posts to display'
;
$string
[
'makeyourpostprivate'
]
=
'Make your post private?'
;
...
...
htdocs/blocktype/wall/lib.php
View file @
10b1c1bc
...
...
@@ -181,6 +181,15 @@ class PluginBlocktypeWall extends SystemBlocktype {
return
$view
->
get
(
'type'
)
==
'profile'
;
}
public
static
function
override_instance_title
(
BlockInstance
$instance
)
{
global
$USER
;
$ownerid
=
$instance
->
get_view
()
->
get
(
'owner'
);
if
(
$ownerid
==
$USER
->
get
(
'id'
))
{
return
get_string
(
'title'
,
'blocktype.wall'
);
}
return
get_string
(
'otherusertitle'
,
'blocktype.wall'
,
display_name
(
$ownerid
,
null
,
true
));
}
}
?>
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