function theme_flag_actions_page in Flag 6.2
Same name and namespace in other branches
- 5 flag_actions.module \theme_flag_actions_page()
- 6 flag_actions.module \theme_flag_actions_page()
- 7.3 flag_actions.module \theme_flag_actions_page()
- 7.2 flag_actions.module \theme_flag_actions_page()
Theme the list of actions currently in place for flags.
1 theme call to theme_flag_actions_page()
- flag_actions_page in ./
flag_actions.module - Menu callback for admin/build/flags/actions.
File
- ./
flag_actions.module, line 254 - Actions support for the Flag module.
Code
function theme_flag_actions_page($actions, $add_action_form) {
$rows = array();
foreach ($actions as $action) {
$flag = flag_get_flag($action->flag);
// Build a sample string representing repeating actions.
if ($action->repeat_threshold) {
$repeat_count = 3;
$repeat_subtract = $action->event == 'flag' ? 1 : -1;
$repeat_samples = array();
for ($n = 1; $n < $repeat_count + 2; $n++) {
$sample = $action->threshold + $n * $action->repeat_threshold * $repeat_subtract;
if ($sample > 0) {
$repeat_samples[] = $sample;
}
}
if (count($repeat_samples) > $repeat_count) {
$repeat_samples[$repeat_count] = '…';
}
$repeat_string = implode(', ', $repeat_samples);
}
else {
$repeat_string = '-';
}
$row = array();
$row[] = $flag
->get_title();
$row[] = ($action->event == 'flag' ? '≥ ' : '< ') . $action->threshold;
$row[] = $repeat_string;
$row[] = empty($action->missing) ? $action->description : '<div class="error">' . $action->description . '</div>';
$row[] = l(t('edit'), 'admin/build/flags/actions/configure/' . $action->aid);
$row[] = l(t('delete'), 'admin/build/flags/actions/delete/' . $action->aid);
$rows[] = $row;
}
if (empty($rows)) {
$rows[] = array(
array(
'data' => t('Currently no flag actions. Use the <em>Add new flag action</em> form to add an action.'),
'colspan' => 6,
),
);
}
$header = array(
t('Flag'),
t('Threshold'),
t('Repeats'),
t('Action'),
array(
'data' => t('Operations'),
'colspan' => 2,
),
);
$output = '';
$output .= theme('table', $header, $rows);
$output .= $add_action_form;
return $output;
}