Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

Commit

Permalink
Fixed submit bug and User Plugin initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kristofvanroy committed Apr 13, 2010
1 parent 34b6248 commit bbdb785
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 3 deletions.
10 changes: 7 additions & 3 deletions nice_dash.pages.inc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ function nice_dash_dashboard_page() {
$widgets = module_invoke_all('nice_dash_widgets');

if($widgets){
foreach($widgets as $key => $value){
$widget_values = nice_dash_widget_values($key);
$regions[$widget_values['region']] .= call_user_func($value['callback']);

// Order them in the query
$result = db_query("SELECT * FROM {nice_dash_widget_values} ORDER BY weight");

while($row = db_fetch_array($result)){
$regions[$row['region']] .= call_user_func($widgets[$row['widget_key']]['callback']);
}
}

Expand Down Expand Up @@ -70,6 +73,7 @@ function nice_dash_dashboard_settings_form_submit(&$form, &$form_state) {
if (sizeof($values['widgets']) > 0) {
foreach($values['widgets'] as $key){
$widget = new stdClass();
$update_keys = array();

// Check if row exists
$wid = db_result(db_query("SELECT wid FROM {nice_dash_widget_values} WHERE widget_key = '%s'", $key));
Expand Down
5 changes: 5 additions & 0 deletions plugins/nice_dash_user/nice_dash_user.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name = Nice Dash User Plugin
description = User widgets for Nice Dash
package = Nice dashboard
dependencies[] = nice_dash
core = 6.x
26 changes: 26 additions & 0 deletions plugins/nice_dash_user/nice_dash_user.module
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

/**
* Implementation of hook_views_api().
*/
function nice_dash_user_views_api() {
return array(
'api' => 2,
'path' => drupal_get_path('module', 'nice_dash_user'),
);
}

/**
* Implementation of hook_nice_dash_widgets()
*/
function nice_dash_user_nice_dash_widgets(){
module_load_include('inc', 'nice_dash_user', 'nice_dash_user.widgets');

$widgets['user_latest'] = array(
'title' => t('Latest registered users'),
'callback' => 'nice_dash_user_widget_latest',
//'file' => 'nice_dash_content.widgets.inc'
);

return $widgets;
}
7 changes: 7 additions & 0 deletions plugins/nice_dash_user/nice_dash_user.views_default.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

/**
* Implementation of hook_views_default_views().
*/
function nice_dash_user_views_default_views() {
}
14 changes: 14 additions & 0 deletions plugins/nice_dash_user/nice_dash_user.widgets.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

/**
* Callback for the Nice Dash: unpublish widget
*/
function nice_dash_user_widget_latest(){
$output .= '<div class="admin-panel">';
$output .= '<h3>'.t('Latest registered users').'</h3>';
$output .= views_embed_view('nice_dash_user','block_1');
$output .= '</div>';

return $output;

}

0 comments on commit bbdb785

Please sign in to comment.