function votingapi_actions_admin_page in Voting API 5
1 string reference to 'votingapi_actions_admin_page'
File
- ./
votingapi_actions_ui.inc, line 5
Code
function votingapi_actions_admin_page() {
$numSets = 25;
votingapi_rebuild_action_cache();
foreach (_votingapi_load_action_sets_from_db() as $set) {
$vasid = $set['vasid'];
$name = $set['name'];
$links = array();
$links['votingapi_actions_edit'] = array(
'title' => theme('image', drupal_get_path('module', 'votingapi_actions') . '/icons/gtk-edit.png'),
'html' => TRUE,
'href' => "admin/settings/voting_actions/edit/{$vasid}",
'attributes' => array(
'title' => t('Edit this action set'),
),
);
$links['votingapi_actions_export'] = array(
'title' => theme('image', drupal_get_path('module', 'votingapi_actions') . '/icons/document-save.png'),
'html' => TRUE,
'href' => "admin/settings/voting_actions/export/{$name}",
'attributes' => array(
'title' => t('Export this action set'),
),
);
$links['votingapi_actions_delete'] = array(
'title' => theme('image', drupal_get_path('module', 'votingapi_actions') . '/icons/edit-delete.png'),
'html' => TRUE,
'href' => "admin/settings/voting_actions/delete/{$name}",
'attributes' => array(
'title' => t('Delete this action set'),
),
);
$items[] = array(
$name,
theme('links', $links),
);
$used[$name] = true;
}
if (empty($items)) {
$items[] = array(
'data' => array(
'<p class="description">' . t("No action sets have currently been defined. !click to create one.", array(
'!click' => l(t('Click here'), 'admin/settings/voting_actions/add'),
)) . '</p>',
),
'colspan' => '2',
);
}
$output = theme('table', array(
t('Name'),
t('Actions'),
), $items, array(
"cellpadding" => "4",
), t('User-Defined Action Sets'));
$output .= theme('pager', NULL, $numSets, 1);
$items = array();
$default_actions = _votingapi_load_action_sets_from_modules();
$set_status = variable_get('votingapi_action_status', array());
foreach ($default_actions as $name => $set) {
if ($used[$name]) {
$status = t('Overridden');
}
else {
if (isset($set_status[$name])) {
if ($set_status[$name]) {
$status = 'Enabled';
}
else {
$status = 'Disabled';
}
}
else {
if ($set['enabled']) {
$status = 'Enabled';
}
else {
$status = 'Disabled';
}
}
}
if ($status == 'Enabled') {
$links = array();
$links['votingapi_actions_add'] = array(
'title' => theme('image', drupal_get_path('module', 'votingapi_actions') . '/icons/edit-paste.png'),
'html' => TRUE,
'href' => "admin/settings/voting_actions/add/{$name}",
'attributes' => array(
'title' => t('Clone this action set'),
),
);
$links['votingapi_actions_export'] = array(
'title' => theme('image', drupal_get_path('module', 'votingapi_actions') . '/icons/document-save.png'),
'html' => TRUE,
'href' => "admin/settings/voting_actions/export/{$name}",
'attributes' => array(
'title' => t('Export this action set'),
),
);
$links['votingapi_actions_disable'] = array(
'title' => theme('image', drupal_get_path('module', 'votingapi_actions') . '/icons/process-stop.png'),
'html' => TRUE,
'href' => "admin/settings/voting_actions/disable/{$name}",
'attributes' => array(
'title' => t('Disable this action set'),
),
);
}
else {
if ($status == 'Disabled') {
$links = array();
$links['votingapi_actions_add'] = array(
'title' => theme('image', drupal_get_path('module', 'votingapi_actions') . '/icons/edit-paste.png'),
'html' => TRUE,
'href' => "admin/settings/voting_actions/add/{$name}",
'attributes' => array(
'title' => t('Clone this action set'),
),
);
$links['votingapi_actions_export'] = array(
'title' => theme('image', drupal_get_path('module', 'votingapi_actions') . '/icons/document-save.png'),
'html' => TRUE,
'href' => "admin/settings/voting_actions/export/{$name}",
'attributes' => array(
'title' => t('Export this action set'),
),
);
$links['votingapi_actions_enable'] = array(
'title' => theme('image', drupal_get_path('module', 'votingapi_actions') . '/icons/media-playback-start.png'),
'html' => TRUE,
'href' => "admin/settings/voting_actions/enable/{$name}",
'attributes' => array(
'title' => t('Enable this action set'),
),
);
}
else {
if ($status == 'Overridden') {
$links = array();
}
}
}
$items[] = array(
$name,
$set['source'],
$status,
theme('links', $links),
);
}
if (empty($items)) {
$items[] = array(
'data' => array(
'<p class="description">' . t('No default action sets are available.') . '</p>',
),
'colspan' => '4',
);
}
$output .= theme('table', array(
t('Name'),
t('Source'),
t('Status'),
t('Actions'),
), $items, array(
"cellpadding" => "4",
), t('Default Action Sets'));
$output .= theme('pager', NULL, $numSets, 2);
return $output;
}