function computing_code in Drupal Computing 7
Return value
array status and control code. see Java too.
4 calls to computing_code()
- views_handler_field_computing_control::render in ./
computing.views.inc - Render the field.
- views_handler_field_computing_status::render in ./
computing.views.inc - Render the field.
- views_handler_filter_computing_control::get_value_options in ./
computing.views.inc - Child classes should be used to override this function and set the 'value options', unless 'options callback' is defined as a valid function or static public method to generate these values.
- views_handler_filter_computing_status::get_value_options in ./
computing.views.inc - Child classes should be used to override this function and set the 'value options', unless 'options callback' is defined as a valid function or static public method to generate these values.
File
- ./
computing.module, line 13
Code
function computing_code($group = 'all', $name_only = FALSE) {
$code = array(
// status code, set by 3rd party program. see java file too.
'status' => array(
'OKOK' => array(
'name' => t('Successful'),
'description' => t('Command runs successfully.'),
),
'FAIL' => array(
'name' => t('Failed'),
'description' => t('Command failed.'),
),
'RUNG' => array(
'name' => t('Running'),
'description' => t('Command is running.'),
),
'STOP' => array(
'name' => t('Stopped'),
'description' => t('Command is canceled, or forced to stop.'),
),
'NRCG' => array(
'name' => t('Unrecognizable'),
'description' => t('Command is not recognizable in this application.'),
),
'INTR' => array(
'name' => t('Interrupted'),
'description' => t('Unexpected internal error, or program problem.'),
),
),
// control code, set by drupal to be read by 3rd party program. see java file too.
'control' => array(
'REDY' => array(
'name' => t('Ready'),
'description' => t('Command is ready to be executed, pulled by non-PHP program.'),
),
'CNCL' => array(
'name' => t('Cancel'),
'description' => t('Command should be canceled.'),
),
'REMT' => array(
'name' => t('Remote'),
'description' => t('Command to be executed by an external remote program.'),
),
'CMLN' => array(
'name' => t('CLI'),
'description' => t('Command created from the command line running mode.'),
),
'CODE' => array(
'name' => t('Code'),
'description' => t('Command created from direct program call.'),
),
),
);
if (!$name_only) {
if ($group == 'all') {
return $code;
}
else {
return $code[$group];
}
}
else {
$name_only = array();
foreach ($code as $group_name => $group_value) {
foreach ($group_value as $code_name => $code_value) {
$name_only[$group_name][$code_name] = $code_value['name'];
}
}
if ($group == 'all') {
return $name_only;
}
else {
return $name_only[$group];
}
}
}