1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
<?php
/**
* Elgg thewire view page
*
* @package ElggTheWire
*
*/
//grab the current site message
$site_message = elgg_get_entities(array('types' => 'object', 'subtypes' => 'sitemessage', 'limit' => 1));
if ($site_message) {
$mes = $site_message[0];
$message = $mes->description;
$dateStamp = elgg_view_friendly_time($mes->time_created);
$delete = elgg_view("output/confirmlink",array(
'href' => "action/riverdashboard/delete?message=" . $mes->guid,
'text' => elgg_echo('delete'),
'confirm' => elgg_echo('deleteconfirm'),
));
}
//if there is a site message
if ($site_message) {
echo "<h3>" . elgg_echo("sitemessages:announcements") . "</h3>";
echo "<p><small>" . elgg_echo("sitemessages:posted") . ": " . $dateStamp;
//if admin display the delete link
if (isadminloggedin()) {
echo " " . $delete . " ";
}
echo "</small></p>";
//display the message
echo "<p>" . $message . "</p>";
//display the input form to add a new message
if (isadminloggedin()) {
//action
$action = "riverdashboard/add";
$link = elgg_echo("sitemessages:add");
$input_area = elgg_view('input/plaintext', array('internalname' => 'sitemessage', 'value' => ''));
$submit_input = elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('save')));
$form_body = <<<EOT
<p><a class="collapsibleboxlink">{$link}</a></p>
<div class="collapsible_box">
{$input_area}<br />{$submit_input}
</div>
EOT;
//display the form
echo elgg_view('input/form', array('action' => "action/$action", 'body' => $form_body));
}//end of admin if statement
//if there is no message, add a form to create one
} else {
if (isadminloggedin()) {
//action
$action = "riverdashboard/add";
$link = elgg_echo("sitemessages:add");
$input_area = elgg_view('input/text', array('internalname' => 'sitemessage', 'value' => ''));
$submit_input = elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('save')));
$form_body = <<<EOT
<p><a class="collapsibleboxlink">{$link}</a></p>
<div class="collapsible_box">
{$input_area}<br />{$submit_input}
</div>
EOT;
//display the form
echo elgg_view('input/form', array('action' => "action/$action", 'body' => $form_body));
}//end of admin check
}//end of main if
|