Пример #1
0
/**
 * Setup for dashboard for my account
 */
function setup_myaccount_dashboard()
{
    add_dashboard_widget('myaccount', 'account_dashboard_messages', 'Messages', 'account_dashboard_messages');
    add_dashboard_widget('myaccount', 'account_dashboard_user_content', 'Your Content', 'account_dashboard_user_content');
    add_dashboard_widget('myaccount', 'account_dashboard_recent_video_comments', 'Recent Video Comments', 'account_dashboard_recent_video_comments', 'account_dashboard_recent_video_comments_callback');
    /* Handle form submission here */
    if (confirm_config_form_submission()) {
        $place = mysql_clean(post('place'));
        $id = mysql_clean(post('id'));
        $importance = mysql_clean(post('importance'));
        if ($place and $id and $importance) {
            $dashboard = get_dashboard($place);
            if ($dashboard[$importance] and $dashboard[$importance][$id]) {
                $widget = $dashboard[$importance][$id];
                __call_widget_options_callback($widget);
                redirect_to(queryString('', array('configure')));
                exit('Redirecting ...');
            }
        }
    }
}
        $input_error = 1;
    }
    if ($input_error != 1) {
        $selected_id = get_post('selected_id');
        $widget_app = get_post('widget_app');
        $column_id = input_num('column_id');
        $sort_no = input_num('sort_no');
        $collapsed = get_post('collapsed');
        $widget = get_post('widget');
        $description = get_post('description');
        $param = $widgetObject->save_param();
        if ($selected_id != -1 && !empty($selected_id)) {
            update_dashboard_widget($selected_id, $widget_app, $userid, $column_id, $sort_no, $collapsed, $widget, $description, $param);
            $note = _('Selected widget has been updated');
        } else {
            add_dashboard_widget($widget_app, $userid, $column_id, $sort_no, $collapsed, $widget, $description, $param);
            $note = _('New widget has been added');
        }
        //run the sql from either of the above possibilites
        display_notification($note);
        $Mode = 'RESET';
    }
}
if ($Mode == 'Delete') {
    delete_dashboard_widget($selected_id);
    display_notification(_('Selected widget has been deleted'));
    $Mode = 'RESET';
}
if ($Mode == 'RESET') {
    $selected_id = -1;
    unset($_POST);