public function sweaver_plugin_images::sweaver_menu_callback in Sweaver 6
Same name and namespace in other branches
- 7 plugins/sweaver_plugin_images/sweaver_plugin_images.inc \sweaver_plugin_images::sweaver_menu_callback()
Menu callback.
Overrides sweaver_plugin::sweaver_menu_callback
File
- plugins/
sweaver_plugin_images/ sweaver_plugin_images.inc, line 146 - Images plugin.
Class
- sweaver_plugin_images
- @file Images plugin.
Code
public function sweaver_menu_callback() {
$form = array();
$form['sweaver_plugin_images_tab'] = array(
'#type' => 'checkbox',
'#title' => t('Editor tab'),
'#description' => t('Toggle this checkbox if you want to enable the images tab on the editor.'),
'#default_value' => variable_get('sweaver_plugin_images_tab', TRUE),
);
// Use imagecache on images ?
if (function_exists('imagecache_presets')) {
$form['sweaver_plugin_images_imagecache'] = array(
'#type' => 'checkbox',
'#title' => t('Allow to see imagecached version of images'),
'#description' => t('Toggle this checkbox if you want to create imagecached versions of the images uploaded by the Images plugin.'),
'#default_value' => variable_get('sweaver_plugin_images_imagecache', FALSE),
);
}
else {
$form['imagecache_disabled'] = array(
'#type' => 'markup',
'#value' => '<p>' . t('If you enable the imagecache module, all images can be made available with all imagecache preset variants.') . '</p>',
);
$form['sweaver_plugin_images_imagecache'] = array(
'#type' => 'value',
'#value' => 0,
);
}
$form['sweaver_plugin_handle_images'] = array(
'#type' => 'hidden',
'#value' => variable_get('sweaver_plugin_handle_images', 'sweaver_plugin_images'),
);
$form = system_settings_form($form);
// Images list
$rows = array();
$output = '<p>' . l(t('Add new image'), 'admin/settings/sweaver/images/add') . '</p>';
$query = 'SELECT ti.fid, ti.description, f.filepath FROM {sweaver_image} ti
INNER JOIN {files} f on f.fid = ti.fid order by description ASC';
$result = db_query($query);
while ($image = db_fetch_object($result)) {
$row = array();
$row[] = check_plain($image->description);
$operations = l(t('View'), file_create_url($image->filepath)) . ' - ';
$operations .= l(t('Edit'), 'admin/settings/sweaver/images/edit/' . $image->fid, array(
'alias' => TRUE,
)) . ' - ';
$operations .= l(t('Delete'), 'admin/settings/sweaver/images/delete/' . $image->fid, array(
'alias' => TRUE,
));
$row[] = $operations;
$rows[] = $row;
}
if (!empty($rows)) {
// Output table.
$header = array(
t('Image'),
t('Operations'),
);
$output .= theme('table', $header, $rows);
}
else {
$output .= '<p>' . t('No images uploaded.') . '</p>';
}
$form['images_list'] = array(
'#type' => 'markup',
'#value' => $output,
);
return $form;
}