<?php
/*
OsShare v1 ,
Coded By Paimpozhil B. , SaravanaKumar M.S.
*/
class LinksitesController extends AppController {
var $name = 'Linksites';
var $helpers = array('Html', 'Form' );
var $layout = 'admin';
var $uses = array("Linksite");
function index() {
$this->Linksite->recursive = 0;
$this->set('linksites', $this->paginate());
}
function view($id = null) {
if(!$id) {
$this->Session->setFlash('Invalid Linksite.');
$this->redirect(array('action'=>'index'), null, true);
}
$this->set('linksite', $this->Linksite->read(null, $id));
}
function add() {
if(!empty($this->data)) {
$this->cleanUpFields();
$this->Linksite->create();
if($this->Linksite->save($this->data)) {
$this->Session->setFlash('The Linksite has been saved');
$this->redirect(array('action'=>'index'), null, true);
} else {
$this->Session->setFlash('The Linksite could not be saved. Please, try again.');
}
}
}
function edit($id = null) {
if(!$id && empty($this->data)) {
$this->Session->setFlash('Invalid Linksite');
$this->redirect(array('action'=>'index'), null, true);
}
if(!empty($this->data)) {
$this->cleanUpFields();
if($this->Linksite->save($this->data)) {
$this->Session->setFlash('The Linksite saved');
$this->redirect(array('action'=>'index'), null, true);
} else {
$this->Session->setFlash('The Linksite could not be saved. Please, try again.');
}
}
if(empty($this->data)) {
$this->data = $this->Linksite->read(null, $id);
}
}
function delete($id = null) {
if(!$id) {
$this->Session->setFlash('Invalid id for Linksite');
$this->redirect(array('action'=>'index'), null, true);
}
if($this->Linksite->del($id)) {
$this->Session->setFlash('Linksite #'.$id.' deleted');
$this->redirect(array('action'=>'index'), null, true);
}
}
}
?>