| 1 |
<?php |
<?php |
| 2 |
// $Id: uts_path.module,v 1.16 2009/01/15 06:54:28 boombatower Exp $ |
// $Id: uts_path.module,v 1.17 2009/05/26 16:10:21 boombatower Exp $ |
| 3 |
/** |
/** |
| 4 |
* @file |
* @file |
| 5 |
* Collect the user path taken to complete a task and compare to defined ideal path. |
* Collect the user path taken to complete a task and compare to defined ideal path. |
| 211 |
$form['uts_path']['record'] = array( |
$form['uts_path']['record'] = array( |
| 212 |
'#type' => 'submit', |
'#type' => 'submit', |
| 213 |
'#value' => t('Record steps'), |
'#value' => t('Record steps'), |
| 214 |
'#submit' => array('node_form_submit', 'uts_path_open_record_ideal'), |
'#submit' => array('node_form_submit', 'uts_path_open_record_ideal'), |
| 215 |
'#weight' => -9, |
'#weight' => -9, |
| 216 |
); |
); |
| 217 |
$form['uts_path']['clear'] = array( |
$form['uts_path']['clear'] = array( |
| 230 |
$form_state['rebuild'] = FALSE; // Reset changed rebuild attribute, so that #redirect still works. |
$form_state['rebuild'] = FALSE; // Reset changed rebuild attribute, so that #redirect still works. |
| 231 |
|
|
| 232 |
variable_set('uts_path_ideal_recorder', UTS_PATH_RECORDER_OPEN); |
variable_set('uts_path_ideal_recorder', UTS_PATH_RECORDER_OPEN); |
| 233 |
variable_set('uts_path_ideal_recorder_task_nid', $node->nid); |
variable_set('uts_path_ideal_recorder_task_nid', $form_state['nid']); |
| 234 |
|
|
| 235 |
// TODO Figure out how to make ideal path recorder work cleanly in base environment. |
// TODO Figure out how to make ideal path recorder work cleanly in base environment. |
| 236 |
/* |
/* |
| 260 |
* @return string HTML output. |
* @return string HTML output. |
| 261 |
*/ |
*/ |
| 262 |
function uts_path_render_ideal($task_nid) { |
function uts_path_render_ideal($task_nid) { |
|
$result = db_query('SELECT path, breadcrumb, title |
|
|
FROM {uts_path_ideal} |
|
|
WHERE task_nid = %d |
|
|
ORDER BY weight ASC', $task_nid); |
|
|
$header = array(t('Path'), t('Breadcrumb'), t('Title')); |
|
| 263 |
$rows = array(); |
$rows = array(); |
| 264 |
while ($record = db_fetch_array($result)) { |
if ($task_nid) { |
| 265 |
$rows[] = $record; |
$result = db_query('SELECT path, breadcrumb, title |
| 266 |
|
FROM {uts_path_ideal} |
| 267 |
|
WHERE task_nid = %d |
| 268 |
|
ORDER BY weight ASC', $task_nid); |
| 269 |
|
$header = array(t('Path'), t('Breadcrumb'), t('Title')); |
| 270 |
|
while ($record = db_fetch_array($result)) { |
| 271 |
|
$rows[] = $record; |
| 272 |
|
} |
| 273 |
} |
} |
| 274 |
return (count($rows) > 0 ? theme('table', $header, $rows) : t('No path to display.')); |
return (count($rows) > 0 ? theme('table', $header, $rows) : t('No path to display.')); |
| 275 |
} |
} |