Put overflow hidden and a fixed width on profile widgets to stop large img coming...
[elgg.git] / mod / widget / move.php
blobffba1ec3542908d9159703bf83525f691d8d6d37
1 <?php
3 /*
5 Elgg Dashboard
6 http://elgg.org/
8 */
10 // Load Elgg framework
11 @require_once("../../includes.php");
13 // We need to be logged on for this!
15 if (isloggedin()) {
17 // Define context
18 define("context","widget");
20 // Load global variables
21 global $CFG, $PAGE, $db, $page_owner, $messages;
23 // Get widget details
25 $ident = optional_param('wid',0,PARAM_INT);
26 $widget = get_record("widgets", "ident", $ident);
28 // Get moving instructions
29 $move = optional_param('_widget_move');
31 // Page owner = where the widget resides
32 $page_owner = $widget->owner;
34 // Do we have permission to touch this?
35 // If so, move it
36 if (run("permissions:check","profile")) {
38 if ($move == "up") {
39 widget_moveup($widget);
40 } else if ($move == "down") {
41 widget_movedown($widget);
42 } else if ($move == "1") {
43 widget_move_before($widget,$widget->display_order,0);
44 } else if ($move == "2") {
45 widget_move_before($widget,$widget->display_order,1);
49 // Get the username of the widget owner
50 $username = user_info("username",$widget->owner);
52 // Add a message
53 $messages[] = __gettext("Widget moved.");
54 $_SESSION['messages'] = $messages;
56 // Redirect back to the relevant location
57 switch( $widget->location ) {
58 case 'profile':
59 case '':
60 $redirect_url = $CFG->wwwroot . $username . "/profile/";
61 break;
62 default:
63 // get module from the widget type
64 $module = '';
65 $mod_pos = strpos($widget->type,"::");
66 if ($mod_pos) {
67 $module = substr($widget->type,0,$mod_pos);
69 $redirect_url = widget_get_display_url($module).'?'.widget_get_display_query();
70 break;
73 header("Location: " . $redirect_url);
74 exit;