ACC SHELL

Path : /srv/www/vhosts/tsisystem/app/controllers/
File Upload :
Current File : //srv/www/vhosts/tsisystem/app/controllers/configs_controller.php

<?php // -*- mode: php; indent-tabs-mode: t -*-
class ConfigsController extends AppController
{
	//var $scaffold;
	var $name = 'Configs';

	function index()
	{
		$this->Config->recursive = 0;
		$this->set('configs', $this->Config->findAll());
	}

	function add()
	{
		if(empty($this->data))
		{
			$this->set('configs', null);
		}
		else
		{
			$this->cleanUpFields();
			if($this->Config->save($this->data))
			{
				if(is_object($this->Session))
				{
					$this->Session->setFlash('The Config has been saved');
					$this->redirect($this->viewPath.'/index');
				}
				else
				{
					$this->flash('Config saved.', $this->viewPath.'/index');
				}
			}
			else
			{
				if(is_object($this->Session))
				{
					$this->Session->setFlash('Please correct errors below.');
				}
				$data = $this->data;
				$this->set('configs', $data);
			}
		}
	}

	function edit($id)
	{
		if(empty($this->data))
		{
			$data = $this->Config->read(null, $id);
			$this->set('configs', $data );
		}
		else
		{
			$this->cleanUpFields();
			if($this->Config->save($this->data))
			{
				if(is_object($this->Session))
				{
					$this->Session->setFlash('The Config has been saved');
					$this->redirect($this->viewPath.'/index');
				}
				else
				{
					$this->flash('Config saved.', $this->viewPath.'/index');
				}
			}
			else
			{
				if(is_object($this->Session))
				{
					$this->Session->setFlash('Please correct errors below.');
				}
				$data = $this->data;
				$this->set('configs', $data);
			}
		}
	}

	function view($id)
	{
		$this->set('configs', $this->Config->read(null, $id));
	}

	function delete($id)
	{
		$this->Config->del($id);
		$this->redirect('/configs/index');
	}

    /**
     * Settings for presentation's main page
     */
    function main()
    {

    }

}
?>

ACC SHELL 2018