コード例 #1
0
<?php

// Load Elgg framework
@(require_once "../../includes.php");
$id = optional_param('id', 0, PARAM_INT);
if (isloggedin()) {
    if ($widget = get_record('widgets', 'ident', $id)) {
        // Page owner = where the widget resides
        $page_owner = $widget->owner;
        // Do we have permission to touch this?
        // If so, wipe it!
        if (run("permissions:check", "profile")) {
            widget_destroy($widget->ident);
            widget_reorder($page_owner, $widget->location, $widget->location_id, $widget->column);
        }
    }
}
$result = '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>';
$result .= '<answer>';
$result .= '<wid>' . $id . '</wid>';
$result .= '</answer>';
header('Content-Type: application/xml');
print $result;
コード例 #2
0
        http://elgg.org/
*/
// Load Elgg framework
@(require_once "../../includes.php");
// We need to be logged on for this!
if (isloggedin()) {
    // Define context
    define("context", "dashboard");
    // Load global variables
    global $CFG, $page_owner;
    // Get widget details
    $insert = optional_param('insert', 0, PARAM_INT);
    $before = optional_param('before', 0, PARAM_INT);
    $insert_widget = get_record("widgets", "ident", $insert);
    $before_widget = get_record("widgets", "ident", $before);
    if (is_object($insert_widget) && is_object($before_widget)) {
        // Page owner = where the widget resides
        $page_owner = $insert_widget->owner;
        // Do we have permission to touch this?
        // If so, reorder widgets!
        if (run("permissions:check", "profile")) {
            $insert_widget->display_order = $before_widget->display_order - 5;
            update_record('widgets', $insert_widget);
            widget_reorder($page_owner, $insert_widget->location, $insert_widget->location_id);
        }
    }
    // no real need to return a response, but just in case
    // someone looks for one
    header("Content-Type: application/xml");
    print '<ajax-response>Success!</ajax-response>';
}
コード例 #3
0
// We need to be logged on for this!
if (isloggedin()) {
    // Define context
    define("context", "dashboard");
    // Load global variables
    global $CFG, $PAGE, $db, $page_owner, $messages;
    // Get widget details
    $ident = optional_param('wid', 0, PARAM_INT);
    $widget = get_record('widgets', 'ident', $ident);
    // Page owner = where the widget resides
    $page_owner = $widget->owner;
    // Do we have permission to touch this?
    // If so, wipe it!
    if (run("permissions:check", "profile")) {
        widget_destroy($widget->ident);
        widget_reorder($page_owner, $widget->location, $widget->location_id);
    }
    // Get the username of the widget owner
    $username = user_info("username", $widget->owner);
    // Add a message
    $messages[] = __gettext("Widget deleted.");
    $_SESSION['messages'] = $messages;
    // Redirect back to the relevant location
    switch ($widget->location) {
        case 'profile':
        case '':
            $redirect_url = $CFG->wwwroot . $username . "/profile/";
            break;
        default:
            // get module from the widget type
            $module = '';
コード例 #4
0
ファイル: add.php プロジェクト: BackupTheBerlios/tulipan-svn
if (run("permissions:check", "profile")) {
    // Load external data
    $action = trim(optional_param('action'));
    $widget_type = trim(optional_param('widget_type'));
    // If we've been asked to add an item, do that
    if (!empty($action) && $action == "widgets:add" && !empty($widget_type)) {
        $widget = new stdClass();
        $widget->owner = $page_owner;
        $widget->type = $widget_type;
        $widget->access = $CFG->default_access;
        $widget->location = "profile";
        $widget->location_id = 0;
        $widget_id = insert_record('widgets', $widget);
        $messages[] = __gettext("Widget added.");
        $_SESSION['messages'] = $messages;
        widget_reorder($page_owner, 'profile', 0);
        $username = user_info("username", $page_owner);
        header("Location: " . $CFG->wwwroot . "mod/widget/edit.php?wid=" . $widget_id);
        exit;
    }
    // Iterate through the types of widgets we can add
    if (is_array($CFG->widgets->list) && !empty($CFG->widgets->list)) {
        $body = "<p>" . __gettext("Select a widget type from the list below:") . "</p>";
        foreach ($CFG->widgets->list as $widget) {
            if (!$widget['type']) {
                $widget['type'] = $widget['id'];
            }
            $body .= "<form action=\"" . $CFG->wwwroot . "mod/profile/add.php\" method=\"post\" >";
            $body .= "<div class=\"widget\">\n";
            $body .= "<h2>" . $widget['name'] . "</h2>";
            $body .= "<p>" . $widget['description'] . "</p>";
コード例 #5
0
ファイル: lib.php プロジェクト: BackupTheBerlios/tulipan-svn
function widget_move_after($widget, $display_order, $column)
{
    $widget->display_order = $display_order + 1;
    $widget->wcolumn = $column;
    update_record('widgets', $widget);
    widget_reorder($widget->owner, $widget->location, $widget->location_id, $widget->wcolumn);
}