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
acb61dbc
Commit
acb61dbc
authored
Mar 25, 2008
by
Penny Leach
Committed by
Penny Leach
Sep 15, 2008
Browse files
idiot, forgot to add the rest of the files in the last commit
parent
804b06a8
Changes
4
Hide whitespace changes
Inline
Side-by-side
htdocs/blocktype/wall/lang/en.utf8/blocktype.wall.php
View file @
acb61dbc
...
...
@@ -30,5 +30,9 @@ $string['title'] = 'Wall';
$string
[
'description'
]
=
'Display an area where people can leave you comments'
;
$string
[
'noposts'
]
=
'No wall posts to display'
;
$string
[
'makeprivate'
]
=
'Private?'
;
$string
[
'viewwall'
]
=
'View wall'
;
$string
[
'backtoprofile'
]
=
'Back to profile'
;
$string
[
'wall'
]
=
'Wall'
;
$string
[
'wholewall'
]
=
'View whole wall'
;
?>
htdocs/blocktype/wall/lib.php
View file @
acb61dbc
...
...
@@ -49,28 +49,10 @@ class PluginBlocktypeWall extends SystemBlocktype {
}
public
static
function
render_instance
(
BlockInstance
$instance
,
$editing
=
false
)
{
global
$USER
;
$owner
=
$instance
->
get_view
()
->
get
(
'owner'
);
$userid
=
(
!
empty
(
$USER
)
?
$USER
->
get
(
'id'
)
:
0
);
$sql
=
'
SELECT bwp.*,u.firstname,u.lastname,u.preferredname
FROM {blocktype_wall_post} bwp
JOIN {usr} u ON bwp.from = u.id
WHERE bwp.instance = ? AND u.deleted = 0
'
.
((
$owner
!=
$userid
)
?
'
AND bwp.private = 0 '
:
''
)
.
'
ORDER BY bwp.postdate DESC
'
;
$params
=
array
(
$instance
->
get
(
'id'
));
$smarty
=
smarty_core
();
if
(
$records
=
get_records_sql_array
(
$sql
,
$params
,
0
,
10
))
{
$smarty
->
assign
(
'wallposts'
,
array_map
(
create_function
(
'$item'
,
'$item->displayname = display_name($item); return $item;'
),
$records
));
$smarty
->
assign
(
'instanceid'
,
$instance
->
get
(
'id'
));
if
(
$posts
=
self
::
wallpost_fetch_posts
(
$instance
))
{
$smarty
->
assign
(
'wallposts'
,
$posts
);
}
else
{
$smarty
->
assign
(
'wallmessage'
,
get_string
(
'noposts'
,
'blocktype.wall'
));
...
...
@@ -135,8 +117,6 @@ class PluginBlocktypeWall extends SystemBlocktype {
public
static
function
wallpost_submit
(
Pieform
$form
,
$values
)
{
global
$USER
;
log_debug
(
"Inserting a new wall post!"
);
log_debug
(
$values
);
$record
=
(
object
)
array
(
'instance'
=>
$values
[
'instance'
],
'from'
=>
$USER
->
get
(
'id'
),
...
...
@@ -148,6 +128,37 @@ class PluginBlocktypeWall extends SystemBlocktype {
insert_record
(
'blocktype_wall_post'
,
$record
);
redirect
(
'/user/view.php'
);
}
public
static
function
wallpost_fetch_posts
(
BlockInstance
$instance
)
{
global
$USER
;
$owner
=
$instance
->
get_view
()
->
get
(
'owner'
);
$userid
=
(
!
empty
(
$USER
)
?
$USER
->
get
(
'id'
)
:
0
);
$sql
=
'
SELECT bwp.*,'
.
db_format_tsfield
(
'postdate'
)
.
',
u.firstname,u.lastname,u.preferredname
FROM {blocktype_wall_post} bwp
JOIN {usr} u ON bwp.from = u.id
WHERE bwp.instance = ? AND u.deleted = 0
'
.
((
$owner
!=
$userid
)
?
'
AND bwp.private = 0 '
:
''
)
.
'
ORDER BY bwp.postdate DESC
'
;
$params
=
array
(
$instance
->
get
(
'id'
));
$smarty
=
smarty_core
();
$smarty
->
assign
(
'instanceid'
,
$instance
->
get
(
'id'
));
if
(
$records
=
get_records_sql_array
(
$sql
,
$params
,
0
,
10
))
{
return
array_map
(
create_function
(
'$item'
,
'$item->displayname = display_name($item); return $item;'
),
$records
);
return
$records
;
}
return
false
;
}
}
?>
htdocs/blocktype/wall/theme/default/inlineposts.tpl
View file @
acb61dbc
...
...
@@ -5,11 +5,14 @@
{
if
$wallposts
}
{
foreach
from
=
$wallposts
item
=
wallpost
}
<div
id=
"wallpost"
>
<div
id=
"icon"
><img
src=
"
{
$WWWROOT
}
/
thumb.php?type=profileicon&maxwidth=50&maxheight=50&id=
{
$wallpost
->
from
}
"
/></div>
<div
id=
"icon"
><img
src=
"
{
$WWWROOT
}
thumb.php?type=profileicon&maxwidth=50&maxheight=50&id=
{
$wallpost
->
from
}
"
/></div>
<div
id=
"text"
>
{
$wallpost
->
text
|
escape
}
</div>
<div
id=
"postedon"
>
{
$wallpost
->
postdate
|
format_date
}
</div>
<div
id=
"controls"
>
controls
</div>
</div>
{/
foreach
}
{
if
!
$wholewall
}
<a
href=
"
{
$WWWROOT
}
blocktype/wall/wall.php?id=
{
$instanceid
}
"
>
{
str
tag
=
'wholewall'
section
=
'blocktype.wall'
}
</a>
{/
if
}
{/
if
}
</div>
htdocs/blocktype/wall/wall.php
View file @
acb61dbc
...
...
@@ -40,6 +40,7 @@ $owner->displayname = display_name($owner);
$smarty
=
smarty
();
$smarty
->
assign
(
'owner'
,
$owner
);
$smarty
->
assign
(
'wholewall'
,
true
);
if
(
$posts
=
PluginBlocktypeWall
::
wallpost_fetch_posts
(
$block
))
{
$smarty
->
assign
(
'wallposts'
,
$posts
);
}
...
...
Write
Preview
Supports
Markdown
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