| 1 |
<?php |
<?php |
| 2 |
// $Id: metrics.module,v 1.2 2007/08/02 20:46:11 drewish Exp $ |
// $Id: metrics.module,v 1.3 2007/08/20 18:39:09 drewish Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* Implementation of hook_help(). |
* Implementation of hook_help(). |
| 90 |
'type' => MENU_LOCAL_TASK, |
'type' => MENU_LOCAL_TASK, |
| 91 |
); |
); |
| 92 |
$items[] = array( |
$items[] = array( |
| 93 |
'path' => 'admin/content/metrics/'. $property_id .'/ranking', |
'path' => 'admin/content/metrics/'. $property_id .'/rankings', |
| 94 |
'title' => t('Ranking'), |
'title' => t('Rankings'), |
| 95 |
'callback' => 'drupal_get_form', |
'callback' => 'drupal_get_form', |
| 96 |
'callback arguments' => array('metrics_rankings_form', $property), |
'callback arguments' => array('metrics_rankings_form', $property), |
| 97 |
'type' => MENU_LOCAL_TASK, |
'type' => MENU_LOCAL_TASK, |
| 335 |
|
|
| 336 |
/** |
/** |
| 337 |
* Return an array of the metrics computation functions. |
* Return an array of the metrics computation functions. |
| 338 |
|
* |
| 339 |
|
* @param $refresh |
| 340 |
|
* Boolean indicating if the list should be fully recomputed. |
| 341 |
|
* @return |
| 342 |
|
* An array of function names. |
| 343 |
*/ |
*/ |
| 344 |
function _metrics_get_metrics_functions($refresh = FALSE) { |
function _metrics_get_metrics_functions($refresh = FALSE) { |
| 345 |
static $_functions; |
static $_functions; |
| 395 |
return FALSE; |
return FALSE; |
| 396 |
} |
} |
| 397 |
|
|
| 398 |
|
/** |
| 399 |
|
* Module settings form. |
| 400 |
|
*/ |
| 401 |
function metrics_settings_form() { |
function metrics_settings_form() { |
| 402 |
$times = array(6048000, 5443200, 4838400, 4233600, 3628800, 3024000, 2419200, 1814400, 1209600, 604800, 518400, 432000, 345600, 259200, 172800, 86400); |
$times = array(6048000, 5443200, 4838400, 4233600, 3628800, 3024000, 2419200, 1814400, 1209600, 604800, 518400, 432000, 345600, 259200, 172800, 86400); |
| 403 |
$ageoptions = drupal_map_assoc($times, 'format_interval'); |
$ageoptions = drupal_map_assoc($times, 'format_interval'); |
| 536 |
} |
} |
| 537 |
|
|
| 538 |
/** |
/** |
| 539 |
* Property form. |
* Property edit form. |
| 540 |
*/ |
*/ |
| 541 |
function metrics_property_form($edit = array()) { |
function metrics_property_form($edit = array()) { |
| 542 |
|
if (isset($edit['name'])) { |
| 543 |
|
drupal_set_title(check_plain($edit['name'])); |
| 544 |
|
} |
| 545 |
|
|
| 546 |
$form['name'] = array( |
$form['name'] = array( |
| 547 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 548 |
'#title' => t('Property name'), |
'#title' => t('Property name'), |
| 650 |
|
|
| 651 |
|
|
| 652 |
/** |
/** |
| 653 |
* Metrics metric settings. |
* Property metrics form. |
| 654 |
*/ |
*/ |
| 655 |
function metrics_metrics_form($edit = array()) { |
function metrics_metrics_form($edit = array()) { |
| 656 |
|
if (isset($edit['name'])) { |
| 657 |
|
drupal_set_title(check_plain($edit['name'])); |
| 658 |
|
} |
| 659 |
|
|
| 660 |
$function_options = array(0 => '<Select One>'); |
$function_options = array(0 => '<Select One>'); |
| 661 |
foreach (_metrics_get_metrics_functions() as $function) { |
foreach (_metrics_get_metrics_functions() as $function) { |
| 662 |
$info = $function('info'); |
$info = $function('info'); |
| 783 |
|
|
| 784 |
|
|
| 785 |
/** |
/** |
| 786 |
* Metrics metric settings. |
* Property ranking form. |
| 787 |
*/ |
*/ |
| 788 |
function metrics_rankings_form($edit = array()) { |
function metrics_rankings_form($edit = array()) { |
| 789 |
|
if (isset($edit['name'])) { |
| 790 |
|
drupal_set_title(check_plain($edit['name'])); |
| 791 |
|
} |
| 792 |
|
|
| 793 |
$form['property_id'] = array( |
$form['property_id'] = array( |
| 794 |
'#type' => 'value', |
'#type' => 'value', |
| 795 |
'#value' => $edit['property_id'], |
'#value' => $edit['property_id'], |