| 1 |
<?php |
<?php |
| 2 |
// $Id: workflow_named_transitions.module,v 1.1 2008/09/08 15:31:51 deekayen Exp $ |
// $Id$ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 10 |
|
|
| 11 |
/** |
/** |
| 12 |
* Implementation of hook_menu(). |
* Implementation of hook_menu(). |
|
* |
|
|
* @return array |
|
| 13 |
*/ |
*/ |
| 14 |
function workflow_named_transitions_menu() { |
function workflow_named_transitions_menu() { |
| 15 |
$items = array(); |
$items = array(); |
| 16 |
|
|
| 17 |
$items['admin/build/workflow/labels'] = array( |
$items['admin/build/workflow/labels'] = array( |
| 18 |
'title' => 'Edit labels', |
'title' => 'Edit labels', |
| 19 |
|
'description' => 'Edit the labels on workflow transitions.', |
| 20 |
'access callback' => 'user_access', |
'access callback' => 'user_access', |
| 21 |
'access arguments' => array('administer workflow'), |
'access arguments' => array('administer workflow'), |
| 22 |
'page callback' => 'workflow_named_transitions_edit_labels_page', |
'page callback' => 'workflow_named_transitions_edit_labels_page', |
| 24 |
); |
); |
| 25 |
$items['admin/build/workflow/labels/%'] = array( |
$items['admin/build/workflow/labels/%'] = array( |
| 26 |
'title' => 'Edit labels', |
'title' => 'Edit labels', |
| 27 |
|
'description' => '', |
| 28 |
'access callback' => 'user_access', |
'access callback' => 'user_access', |
| 29 |
'access arguments' => array('administer workflow'), |
'access arguments' => array('administer workflow'), |
| 30 |
'page callback' => 'drupal_get_form', |
'page callback' => 'drupal_get_form', |
| 38 |
/** |
/** |
| 39 |
* Lists options of workflows to edit labels on. |
* Lists options of workflows to edit labels on. |
| 40 |
* |
* |
| 41 |
* @return string |
* @return |
| 42 |
|
* string of links to edit labels |
| 43 |
*/ |
*/ |
| 44 |
function workflow_named_transitions_edit_labels_page() { |
function workflow_named_transitions_edit_labels_page() { |
| 45 |
$output = ''; |
$output = ''; |
| 53 |
} |
} |
| 54 |
|
|
| 55 |
/** |
/** |
| 56 |
* Label edit form, segmented in fieldsets, where each fieldset represents |
* Label edit form, where each fieldset represents a starting workflow state. |
| 57 |
* a starting workflow state. Each contains the transitions with that starting |
* |
| 58 |
* workflow state. |
* Each contains the transitions with that starting workflow state. |
| 59 |
* |
* |
| 60 |
* @return array |
* @return |
| 61 |
|
* array of form items for editing labels on transitions |
| 62 |
*/ |
*/ |
| 63 |
function workflow_named_transitions_edit_labels_form($request, $workflow) { |
function workflow_named_transitions_edit_labels_form($request, $workflow) { |
| 64 |
if (!is_numeric($workflow)) { |
if (!is_numeric($workflow)) { |
| 99 |
/** |
/** |
| 100 |
* Implementation of hook_theme(). |
* Implementation of hook_theme(). |
| 101 |
* |
* |
| 102 |
* @return unknown |
* @return |
| 103 |
|
* array to register the form to edit transition labels |
| 104 |
*/ |
*/ |
| 105 |
function workflow_named_transitions_theme() { |
function workflow_named_transitions_theme() { |
| 106 |
return array( |
return array( |
| 111 |
} |
} |
| 112 |
|
|
| 113 |
/** |
/** |
| 114 |
* Formats the label form into two column table rows. The transition is |
* Formats the label form into two column table rows. |
| 115 |
* the first table cell, followed by the label field. Otherwise, the |
* |
| 116 |
* default display would be a form field with the transition as the FAPI |
* The transition is the first table cell, followed by the |
| 117 |
* title, and the form field as the content in a list format. |
* label field. Otherwise, the default display would be a |
| 118 |
|
* form field with the transition as the FAPI title, and the |
| 119 |
|
* form field as the content in a list format. |
| 120 |
* |
* |
| 121 |
* @see workflow_named_transitions_edit_labels_form() |
* @see workflow_named_transitions_edit_labels_form() |
| 122 |
*/ |
*/ |
| 165 |
} |
} |
| 166 |
|
|
| 167 |
/** |
/** |
| 168 |
* Queries the database for an array of transition IDs (tid), their starting and |
* Queries the database for an array of transition labels. |
| 169 |
* ending workflow states, and the label, if any, set by the admin for each transition. |
* |
| 170 |
|
* IDs (tid), their starting and ending workflow states, and the label, |
| 171 |
|
* if any, set by the admin for each transition. |
| 172 |
* |
* |
| 173 |
* @return array |
* @return |
| 174 |
|
* array of transitions tid, to_state, from_state, and label |
| 175 |
*/ |
*/ |
| 176 |
function workflow_named_transitions_get_transitions($workflow) { |
function workflow_named_transitions_get_transitions($workflow) { |
| 177 |
$query = "SELECT wt.tid, from_states.state AS from_state, to_states.state AS to_state, wnt.label |
$query = "SELECT wt.tid, from_states.state AS from_state, to_states.state AS to_state, wnt.label |