Simple status box for the sidebar.
[elgg_plugins.git] / explodewidget / lib.php
blob61eea67318b93d4d304f6e59782628f52327cad3
1 <?php
3 /*
4 * Explode integration widget
5 * Curverider, April 2007
6 * Requires Elgg 0.8 or above
7 * info@curverider.co.uk
8 * (Ben Werdmuller)
9 */
11 // Required function, more or less here for fun
12 function explodewidget_pagesetup() {
15 // Let's define our widgets
16 function explodewidget_init() {
18 global $CFG;
19 $CFG->widgets->list[] = array(
20 'name' => __gettext("Explode widget"),
21 'description' => __gettext("Allows you to add Javascript or Flash widgets to your profile."),
22 'type' => "explodewidget::explode"
24 $CFG->widgets->allcontent[] = "explodewidget::explode";
28 /**************************************************************************
29 Widget editing
30 **************************************************************************/
32 // General editing placeholder
33 function explodewidget_widget_edit($widget) {
35 switch($widget->type) {
36 case "explodewidget::explode": return explodewidget_explode_edit($widget);
37 break;
42 // explode editing
43 function explodewidget_explode_edit($widget) {
45 $explode_username = widget_get_data("explodewidget_explode_username",$widget->ident);
47 $body = "<h2>" . __gettext("Explode widget") . "</h2>";
48 $body .= "<p>" . __gettext("This widget allows you to add your Explode friends to your profile. Just enter your username below:") . "</p>";
49 $body .= "<p>" . display_input_field(array("widget_data[explodewidget_explode_username]",$explode_username,"text")) . "</p>";
51 return $body;
55 /**************************************************************************
56 Widget display
57 **************************************************************************/
59 // General display placeholder
60 function explodewidget_widget_display($widget) {
61 switch($widget->type) {
63 case 'explodewidget::explode': return explodewidget_explode_display($widget);
64 break;
69 // explode display
70 function explodewidget_explode_display($widget) {
72 $explode_username = widget_get_data("explodewidget_explode_username",$widget->ident);
74 if (empty($explode_username)) {
75 $body = __gettext("This widget is undefined.");
76 } else {
77 $body = "<script src=\"http://explode.elgg.org/". $explode_username ."/js/\"></script>";
80 return array('title'=>"Explode",'content'=>$body);