<?php

$cs_lang = cs_translate('multislide');

cs_scriptload('lightbox', 'javascript', 'js/slimbox2.js');
cs_scriptload('lightbox', 'stylesheet', 'css/slimbox2.css');

$access_id = empty($_REQUEST['where']) ? 0 : $_REQUEST['where'];
settype($access_id,'integer');
$start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start'];
$cs_sort[1] = 'multislide_id DESC';
$cs_sort[2] = 'multislide_id ASC';
$sort = empty($_REQUEST['sort']) ? 1 : $_REQUEST['sort'];
$order = $cs_sort[$sort];
$where = empty($access_id) ? 0 : "multislide_access >= '" . $access_id . "'";
$multislide_count = cs_sql_count(__FILE__,'multislide',$where);

$data['head']['total'] = $multislide_count;
$data['head']['pages'] = cs_pages('multislide','manage',$multislide_count,$start,$where,$sort);

$data['url']['new_multislidepage'] = cs_url('multislide','create');
$data['url']['form'] = cs_url('multislide','manage');

$data['head']['message'] = cs_getmsg();

$data['sort']['id'] = cs_sort('multislide','manage',$start,$access_id,1,$sort);

$select = 'multislide_id, multislide_picture, multislide_description, multislide_access';
$cs_multislide = cs_sql_select(__FILE__,'multislide',$select,$where,$order,$start,$account['users_limit']);
$multislide_loop = count($cs_multislide);

for($run=0; $run<$multislide_loop; $run++) {

  $cs_multislide[$run]['multislide_id'] = $cs_multislide[$run]['multislide_id'];
	$cs_multislide[$run]['if']['extern'] = cs_substr($cs_multislide[$run]['multislide_picture'],0,7) == 'uploads' ? true : false;
  $stat_access = $cs_multislide[$run]['multislide_access'];
  $cs_multislide[$run]['multislide_access'] = $stat_access . ' - ' . $cs_lang['lev_'.$stat_access];
  $cs_multislide[$run]['url_delete'] = cs_url('multislide','remove','id='.$cs_multislide[$run]['multislide_id']);
  $cs_multislide[$run]['url_edit'] = cs_url('multislide','edit','id='.$cs_multislide[$run]['multislide_id']);
  $cs_multislide[$run]['url_view'] = cs_url('multislide','view','id='.$cs_multislide[$run]['multislide_id']);
}

$data['multislide'] = $cs_multislide;
echo cs_subtemplate(__FILE__,$data,'multislide','manage');