| 1 |
<?php |
<?php |
| 2 |
// $Id: dashboard.module,v 1.34 2009/09/04 09:10:38 drumm Exp $ |
// $Id: dashboard.module,v 1.35 2009/09/04 11:19:46 drumm Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 12 |
* Implement hook_menu(). |
* Implement hook_menu(). |
| 13 |
*/ |
*/ |
| 14 |
function dashboard_menu() { |
function dashboard_menu() { |
|
// Rebuild the widget registry. |
|
|
db_query("DELETE FROM {dashboard_widget_registry}"); |
|
|
foreach (module_implements('dashboard_widget') as $module) { |
|
|
foreach (module_invoke($module, 'dashboard_widget') as $widget) { |
|
|
$widget['module'] = $module; |
|
|
drupal_write_record('dashboard_widget_registry', $widget); |
|
|
} |
|
|
} |
|
|
|
|
| 15 |
$items = array( |
$items = array( |
| 16 |
'admin/settings/dashboard' => array( |
'admin/settings/dashboard' => array( |
| 17 |
'title' => 'Dashboard', |
'title' => 'Dashboard', |
| 282 |
} |
} |
| 283 |
|
|
| 284 |
/** |
/** |
|
* Unknown. |
|
|
*/ |
|
|
function dashboard_drupalorg_crosssite_page_tools() { |
|
|
// Find widgets for the current path. |
|
|
$item = menu_get_item(); |
|
|
$result = db_query("SELECT path, module, name, title FROM {dashboard_widget_registry} WHERE path = '%s' ORDER BY title", $item['path']); |
|
|
$widgets = array(); |
|
|
while ($widget = db_fetch_object($result)) { |
|
|
$widgets[] = $widget; |
|
|
} |
|
|
|
|
|
if (count($widgets) > 0) { |
|
|
if (user_access('access user dashboard')) { |
|
|
return array( |
|
|
'dashboard-add-widget profile' => array( |
|
|
'href' => 'dashboard', |
|
|
'title' => t('Add to Dashboard'), |
|
|
'attributes' => array('class' => 'add'), |
|
|
), |
|
|
); |
|
|
} |
|
|
else { |
|
|
return array( |
|
|
'dashboard-add profile' => array( |
|
|
'href' => 'user', |
|
|
'title' => t('Log in to Add to Dashboard'), |
|
|
'attributes' => array('class' => 'add'), |
|
|
), |
|
|
); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
/** |
|
| 285 |
* Add dashboard.js for user profile page. |
* Add dashboard.js for user profile page. |
| 286 |
*/ |
*/ |
| 287 |
function dashboard_user($op, &$edit, &$account, $category = NULL) { |
function dashboard_user($op, &$edit, &$account, $category = NULL) { |