| 1 |
<?php |
<?php |
| 2 |
// $Id: stormtimetracking.module,v 1.10.4.13 2008/08/25 09:04:46 robertogerola Exp $ |
// $Id: stormtimetracking.module,v 1.10.4.14 2008/08/26 07:21:32 robertogerola Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 10 |
|
|
| 11 |
switch ($path) { |
switch ($path) { |
| 12 |
case "admin/help#stormtimetracking": |
case "admin/help#stormtimetracking": |
| 13 |
$o = '<p>'. t("Provides timetracking support for Storm") .'</p>'; |
$o = '<p>'. storm_t("Provides timetracking support for Storm", 'timetracking') .'</p>'; |
| 14 |
break; |
break; |
| 15 |
} |
} |
| 16 |
|
|
| 146 |
$items = array(); |
$items = array(); |
| 147 |
|
|
| 148 |
$items['storm/timetrackings'] = array( |
$items['storm/timetrackings'] = array( |
| 149 |
'title' => t('Timetrackings'), |
'title' => storm_t('Timetrackings', 'timetracking'), |
| 150 |
'description' => t('Storm Timetrackings'), |
'description' => storm_t('Storm Timetrackings', 'timetracking'), |
| 151 |
'page callback' => 'stormtimetracking_list', |
'page callback' => 'stormtimetracking_list', |
| 152 |
'access arguments' => array('Storm timetracking: access'), |
'access arguments' => array('Storm timetracking: access'), |
| 153 |
'type' => MENU_NORMAL_ITEM, |
'type' => MENU_NORMAL_ITEM, |
| 155 |
); |
); |
| 156 |
|
|
| 157 |
$items['storm/timetrackings/report/%/%'] = array( |
$items['storm/timetrackings/report/%/%'] = array( |
| 158 |
'title' => t('Timetrackings'), |
'title' => storm_t('Timetrackings', 'timetracking'), |
| 159 |
'page arguments' => array(3, 4), |
'page arguments' => array(3, 4), |
| 160 |
'description' => t('Storm Timetrackings'), |
'description' => storm_t('Storm Timetrackings', 'timetracking'), |
| 161 |
'page callback' => 'stormtimetracking_list_report', |
'page callback' => 'stormtimetracking_list_report', |
| 162 |
'access arguments' => array('Storm timetracking: access'), |
'access arguments' => array('Storm timetracking: access'), |
| 163 |
'type' => MENU_CALLBACK, |
'type' => MENU_CALLBACK, |
| 190 |
function stormtimetracking_node_info() { |
function stormtimetracking_node_info() { |
| 191 |
return array( |
return array( |
| 192 |
'stormtimetracking' => array( |
'stormtimetracking' => array( |
| 193 |
'name' => t('Timetracking'), |
'name' => storm_t('Timetracking', 'timetracking'), |
| 194 |
'module' => 'stormtimetracking', |
'module' => 'stormtimetracking', |
| 195 |
'description' => t("A timetracking for Storm."), |
'description' => storm_t("A timetracking for Storm.", 'timetracking'), |
| 196 |
'title_label' => t("Title"), |
'title_label' => storm_t("Title", 'timetracking'), |
| 197 |
'body_label' => t("Description"), |
'body_label' => storm_t("Description", 'timetracking'), |
| 198 |
) |
) |
| 199 |
); |
); |
| 200 |
} |
} |
| 320 |
} |
} |
| 321 |
$form['group2']['organization_nid'] = array( |
$form['group2']['organization_nid'] = array( |
| 322 |
'#type' => 'select', |
'#type' => 'select', |
| 323 |
'#title' => t('Organization'), |
'#title' => storm_t('Organization', 'timetracking'), |
| 324 |
'#default_value' => $node->organization_nid, |
'#default_value' => $node->organization_nid, |
| 325 |
'#options' => $organizations, |
'#options' => $organizations, |
| 326 |
'#required' => true, |
'#required' => true, |
| 338 |
$projects = array(0 => '-') + $projects; |
$projects = array(0 => '-') + $projects; |
| 339 |
$form['group2']['project_nid'] = array( |
$form['group2']['project_nid'] = array( |
| 340 |
'#type' => 'select', |
'#type' => 'select', |
| 341 |
'#title' => t('Project'), |
'#title' => storm_t('Project', 'timetracking'), |
| 342 |
'#default_value' => $node->project_nid, |
'#default_value' => $node->project_nid, |
| 343 |
'#options' => $projects, |
'#options' => $projects, |
| 344 |
'#process' => array('storm_dependent_select_process'), |
'#process' => array('storm_dependent_select_process'), |
| 350 |
$tasks = array(0 => '-') + $tasks; |
$tasks = array(0 => '-') + $tasks; |
| 351 |
$form['group2']['task_nid'] = array( |
$form['group2']['task_nid'] = array( |
| 352 |
'#type' => 'select', |
'#type' => 'select', |
| 353 |
'#title' => t('Task'), |
'#title' => storm_t('Task', 'timetracking'), |
| 354 |
'#default_value' => $node->task_nid, |
'#default_value' => $node->task_nid, |
| 355 |
'#options' => $tasks, |
'#options' => $tasks, |
| 356 |
'#process' => array('storm_dependent_select_process'), |
'#process' => array('storm_dependent_select_process'), |
| 367 |
} |
} |
| 368 |
$form['group2']['ticket_nid'] = array( |
$form['group2']['ticket_nid'] = array( |
| 369 |
'#type' => 'select', |
'#type' => 'select', |
| 370 |
'#title' => t('Ticket'), |
'#title' => storm_t('Ticket', 'timetracking'), |
| 371 |
'#default_value' => $node->ticket_nid, |
'#default_value' => $node->ticket_nid, |
| 372 |
'#options' => array(0 => '-') + $tickets, |
'#options' => array(0 => '-') + $tickets, |
| 373 |
'#process' => array('storm_dependent_select_process'), |
'#process' => array('storm_dependent_select_process'), |
| 381 |
|
|
| 382 |
$form['group3']['trackingdate'] = array( |
$form['group3']['trackingdate'] = array( |
| 383 |
'#type' => 'date', |
'#type' => 'date', |
| 384 |
'#title' => t('Date'), |
'#title' => storm_t('Date', 'timetracking'), |
| 385 |
'#default_value' => _storm_gmtimestamp_to_date($node->trackingdate), |
'#default_value' => _storm_gmtimestamp_to_date($node->trackingdate), |
| 386 |
); |
); |
| 387 |
|
|
| 388 |
$form['group3']['timebegin'] = array( |
$form['group3']['timebegin'] = array( |
| 389 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 390 |
'#title' => t('Time begin'), |
'#title' => storm_t('Time begin', 'timetracking'), |
| 391 |
'#size' => 5, |
'#size' => 5, |
| 392 |
'#maxlength' => 5, |
'#maxlength' => 5, |
| 393 |
'#default_value' => $node->timebegin, |
'#default_value' => $node->timebegin, |
| 395 |
|
|
| 396 |
$form['group3']['timeend'] = array( |
$form['group3']['timeend'] = array( |
| 397 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 398 |
'#title' => t('Time end'), |
'#title' => storm_t('Time end', 'timetracking'), |
| 399 |
'#size' => 5, |
'#size' => 5, |
| 400 |
'#maxlength' => 5, |
'#maxlength' => 5, |
| 401 |
'#default_value' => $node->timeend, |
'#default_value' => $node->timeend, |
| 403 |
|
|
| 404 |
$form['group3']['duration'] = array( |
$form['group3']['duration'] = array( |
| 405 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 406 |
'#title' => t('Duration (hours)'), |
'#title' => storm_t('Duration (h)', 'timetracking'), |
| 407 |
'#default_value' => $node->duration, |
'#default_value' => $node->duration, |
| 408 |
'#size' => 10, |
'#size' => 10, |
| 409 |
'#maxlength' => 5, |
'#maxlength' => 5, |
| 411 |
|
|
| 412 |
$form['billable'] = array( |
$form['billable'] = array( |
| 413 |
'#type' => 'checkbox', |
'#type' => 'checkbox', |
| 414 |
'#title' => t('Billable'), |
'#title' => storm_t('Billable', 'timetracking'), |
| 415 |
'#default_value' => $node->billable, |
'#default_value' => $node->billable, |
| 416 |
'#weight' => -17, |
'#weight' => -17, |
| 417 |
); |
); |
| 522 |
} |
} |
| 523 |
|
|
| 524 |
function stormtimetracking_view($node, $teaser = FALSE, $page = FALSE) { |
function stormtimetracking_view($node, $teaser = FALSE, $page = FALSE) { |
| 525 |
$node = node_prepare($node, $teaser); |
return theme('stormtimetracking_view', $node, $teaser, $page); |
|
$node->content['stormtimetracking'] = array( |
|
|
'#value' => theme('stormtimetracking_view', $node, $teaser = FALSE, $page = FALSE), |
|
|
'#weight' => 1, |
|
|
); |
|
|
|
|
|
return $node; |
|
| 526 |
} |
} |
| 527 |
|
|