function views_ui_admin_convert
Page callback for the tools - Views 1 convert page
1 string reference to 'views_ui_admin_convert'
File
-
includes/
convert.inc, line 11
Code
function views_ui_admin_convert() {
if (!db_table_exists('view_view')) {
return t('There are no Views 1 views stored in the database to convert.');
}
$items = array();
$sorts = array();
$header = array(
array(
'data' => t('View name'),
'field' => 'name',
'sort' => 'asc',
),
array(
'data' => t('Description'),
),
array(
'data' => t('Operations'),
),
);
$current_views = views_get_all_views();
$result = db_query("SELECT v.* FROM {view_view} v");
while ($view = db_fetch_object($result)) {
$ops = array();
if (!isset($current_views[$view->name])) {
$ops[] = l(t('Convert'), "admin/build/views1/convert/{$view->name}");
}
else {
$ops[] = t('Converted');
}
$ops[] = l(t('Delete'), "admin/build/views1/delete/{$view->name}");
$item = array();
$item[] = check_plain($view->name);
$item[] = check_plain($view->description);
$item[] = implode(' | ', $ops);
$items[] = $item;
$ts = tablesort_init($header);
switch ($ts['sql']) {
case 'name':
default:
$sorts[] = $item[0];
break;
case 'title':
$sorts[] = $item[1];
break;
}
}
if (!empty($ts)) {
if (strtolower($ts['sort']) == 'desc') {
arsort($sorts);
}
else {
asort($sorts);
}
}
$i = array();
foreach ($sorts as $id => $title) {
$i[] = $items[$id];
}
$output = t('The table below lists Views version 1 views that are stored in the database. You can either convert them to work in Views version 2, or delete them. The views are convertible only if there is no Views 2 view with the same name.');
$output .= theme('table', $header, $i);
$output .= drupal_get_form('views_ui_convert_cleanup_form');
return $output;
}