function cloud_zoom_admin_overview in Cloud Zoom 6
The admin overview page callback - provides a table of fields configured with the cloud_zoom display settings
1 string reference to 'cloud_zoom_admin_overview'
- cloud_zoom_menu in ./
cloud_zoom.module - Implementation of hook_menu().
File
- ./
cloud_zoom.admin.inc, line 12 - This file contains al the admin-only function
Code
function cloud_zoom_admin_overview() {
// Load the common file for the dependency checker
module_load_include('inc', 'cloud_zoom', 'cloud_zoom.common');
if (($check = cloud_zoom_dependency_check()) && !$check['exists']) {
drupal_set_message(t('The JQuery Cloud Zoom library is not preset. Please install it into: %path', array(
'%path' => $check['path'],
)), 'error');
}
// Get the settings
$cloud_zoom_presets = cloud_zoom_get_settings();
// Get the Imagecache presets
$imagecache_presets = imagecache_presets();
// Define an error semaphore - this is used to store multiple errors being outputter
$error_semaphore = TRUE;
$error_string = '<span class="error">' . t('Not Set!') . '</span>';
// Create a row for every preset
$rows = array();
foreach ($cloud_zoom_presets as $preset) {
// Generate the settings list (or the default text)
if (empty($preset['settings'])) {
$settings_list = t('Default Settings');
}
else {
$items = array();
foreach ($preset['settings'] as $k => $v) {
$items[] = t('!setting_name: !setting_value', array(
'!setting_name' => $k,
'!setting_value' => $v,
));
}
$settings_list = theme('item_list', $items, t('Overrides'));
}
if ($error_semaphore) {
$error_semaphore = isset($preset['view_preset']) && imagecache_preset_by_name($preset['view_preset']) && isset($preset['zoom_preset']) && imagecache_preset_by_name($preset['zoom_preset']);
}
// Build the Ops list
switch ($preset['storage']) {
default:
case CLOUD_ZOOM_STORAGE_NORMAL:
$storage = t('Normal');
$ops = array(
l(t('Edit'), 'admin/settings/cloudzoom/' . $preset['name'] . '/edit'),
l(t('Delete'), 'admin/settings/cloudzoom/' . $preset['name'] . '/delete'),
);
break;
case CLOUD_ZOOM_STORAGE_DEFAULT:
$storage = t('Default');
$ops = array(
l(t('Override'), 'admin/settings/cloudzoom/' . $preset['name'] . '/edit'),
);
break;
case CLOUD_ZOOM_STORAGE_OVERRIDE:
$storage = t('Normal');
$ops = array(
l(t('Edit'), 'admin/settings/cloudzoom/' . $preset['name'] . '/edit'),
l(t('Revert'), 'admin/settings/cloudzoom/' . $preset['name'] . '/revert'),
);
break;
}
// Create a table row
$rows[] = array(
check_plain($preset['name']),
isset($preset['view_preset']) ? check_plain($preset['view_preset']) : $error_string,
isset($preset['zoom_preset']) ? check_plain($preset['zoom_preset']) : $error_string,
$settings_list,
$storage,
implode(' | ', $ops),
);
}
if (!$error_semaphore) {
drupal_set_message(t('There are errors that need addressing below'), 'error');
}
// Define the headers
$headers = array(
t('Preset'),
t('View Preset'),
t('Zoom Preset'),
t('Settings'),
t('Storage'),
t('Ops'),
);
// Return a table
return theme('table', $headers, $rows);
}