<?php
class PodaciPoslovnogProstoraController extends AppController {

	var $name = 'PodaciPoslovnogProstora';
	var $uses = array();
	
	var $paginate = array(
        'limit' => 250
  );
		
  var $components = array(
	    'Filter' => array(
	        'index,updatePrice' => array(
				'name' => array(
        	        'form_options' => array('label' => 'Name'),
	            	'filter_options' => array('fields' => array('Setting.name'), 'operator' => 'like^'),
				),
	        )
        ),
	);
	
	function beforeFilter(){
		$l_id = $this->Session->read('Auth.User.id');
		if(empty($l_id)){
			$this->redirect(array('action' => '../home/'));
			return;
		}
		
		$rez = mysql_query('select user_level_id from users where id = '.$l_id);
		$row = mysql_fetch_array($rez);
		
		if($row['user_level_id'] == 30){
			$this->Session->setFlash(__('Nemate ovlasti za pristup postavkama!', true));
			$this->redirect(array('action' => '../home/'));
			return;
		}
		
		parent::beforeFilter();
		
		if(isset($_SESSION['Auth']['User']['id']) && $_SESSION['Auth']['User']['id'] > 0){
			$this->Auth->allow('index');
		}
	}

	function index() {
	}

	function view($id = null) {
	}

	function updatePrice($num) {
	}
	
	function add() {
	}
	
	function update($upId,$upValue = '' ){
		$this->redirect(array('action' => 'index'));
	}
	
	function edit($id = null) {
	}

	function delete($id = null) {
	}

}