Commit 2e3b0475 authored by Langston Ball's avatar Langston Ball

refs #2806 - more removal of cruft

parent af05f011
<?php
/**
* Application level Controller
*
* This file is application-wide controller file. You can put all
* application-wide controller-related methods here.
*
* @link https://cakephp.org CakePHP(tm) Project
* @package app.Controller
* @since CakePHP(tm) v 0.2.9
*/
App::uses('Controller', 'Controller');
/**
* Application Controller
*
* Add your application-wide methods in the class below, your controllers
* will inherit them.
*
* @package app.Controller
* @link https://book.cakephp.org/2.0/en/controllers.html#the-app-controller
*/
class AppController extends Controller {
}
<?php
App::uses('AppController', 'Controller');
/**
* Arrays Controller
*/
class ArraysController extends AppController {
/**
* Scaffold
*
* @var mixed
*/
public $scaffold;
}
<?php
App::uses('AppController', 'Controller');
/**
* Devices Controller
*
* @property Device $Device
* @property PaginatorComponent $Paginator
*/
class DevicesController extends AppController {
/**
* Components
*
* @var array
*/
public $components = array('Paginator', 'RequestHandler');
/**
* index method
*
* @return void
*/
public function index() {
$this->Device->recursive = 0;
$this->set('devices', $this->Paginator->paginate());
$this->set('_serialize', 'devices');
}
/**
* view method
*
* @throws NotFoundException
* @param string $id
* @return void
*/
public function view($id = null) {
if (!$this->Device->exists($id)) {
throw new NotFoundException(__('Invalid device'));
}
$options = array('conditions' => array('Device.' . $this->Device->primaryKey => $id));
$selectedDevice = $this->Device->find('first', $options);
$this->set(compact('device', 'selectedDevice'));
$this->set('_serialze', 'selectedDevice');
}
}
<?php
App::uses('AppController', 'Controller');
/**
* Lmcearrays Controller
*/
class LmcearraysController extends AppController {
/**
* Scaffold
*
* @var mixed
*/
public $scaffold;
}
<?php
App::uses('AppController', 'Controller');
/**
* Rooms Controller
*
* @property Room $Room
* @property PaginatorComponent $Paginator
*/
class RoomsController extends AppController {
/**
* Components
*
* @var array
*/
public $components = array('Paginator');
/**
* index method
*
* @return void
*/
public function index() {
$this->Room->recursive = 0;
$this->set('rooms', $this->Paginator->paginate());
}
/**
* view method
*
* @throws NotFoundException
* @param string $id
* @return void
*/
public function view($id = null) {
if (!$this->Room->exists($id)) {
throw new NotFoundException(__('Invalid room'));
}
$options = array('conditions' => array('Room.' . $this->Room->primaryKey => $id));
$this->set('room', $this->Room->find('first', $options));
}
/**
* add method
*
* @return void
*/
public function add() {
if ($this->request->is('post')) {
$this->Room->create();
if ($this->Room->save($this->request->data)) {
$this->Flash->success(__('The room has been saved.'));
return $this->redirect(array('action' => 'index'));
} else {
$this->Flash->error(__('The room could not be saved. Please, try again.'));
}
}
$commandGroups = $this->Room->CommandGroup->find('list');
$users = $this->Room->User->find('list');
$this->set(compact('commandGroups', 'users'));
}
/**
* edit method
*
* @throws NotFoundException
* @param string $id
* @return void
*/
public function edit($id = null) {
if (!$this->Room->exists($id)) {
throw new NotFoundException(__('Invalid room'));
}
if ($this->request->is(array('post', 'put'))) {
if ($this->Room->save($this->request->data)) {
$this->Flash->success(__('The room has been saved.'));
return $this->redirect(array('action' => 'index'));
} else {
$this->Flash->error(__('The room could not be saved. Please, try again.'));
}
} else {
$options = array('conditions' => array('Room.' . $this->Room->primaryKey => $id));
$this->request->data = $this->Room->find('first', $options);
}
$commandGroups = $this->Room->CommandGroup->find('list');
$users = $this->Room->User->find('list');
$this->set(compact('commandGroups', 'users'));
}
/**
* delete method
*
* @throws NotFoundException
* @param string $id
* @return void
*/
public function delete($id = null) {
$this->Room->id = $id;
if (!$this->Room->exists()) {
throw new NotFoundException(__('Invalid room'));
}
$this->request->allowMethod('post', 'delete');
if ($this->Room->delete()) {
$this->Flash->success(__('The room has been deleted.'));
} else {
$this->Flash->error(__('The room could not be deleted. Please, try again.'));
}
return $this->redirect(array('action' => 'index'));
}
}
<?php
App::uses('AppController', 'Controller');
/**
* Devices Controller
*/
class StatusController extends AppController {
public $components = array('RequestHandler');
public $uses = array('Device', 'Room');
function index(){
$lights = $this->Device->find('all' ,
array(
'conditions' => array('DeviceTemplate.FK_DeviceCategory' => 73 )
));
$roomList = $this->Room->find('all');
$systemStatus = array(
'systemstate' =>"online",
'lights' => $lights,
'rooms' =>$roomList,
'avequipment'=>array(),
'climate' => array(),
'irrigation'=> array(),
'cameras' => array(),
'security'=>array()
);
$this->set(compact('systemStatus'));
$this->set('_serialize', array('systemStatus'));
}
}
<?php
App::uses('AppController', 'Controller');
/**
* Users Controller
*
* @property User $User
* @property PaginatorComponent $Paginator
*/
class UsersController extends AppController {
/**
* Components
*
* @var array
*/
public $components = array('Paginator');
/**
* index method
*
* @return void
*/
public function index() {
$this->User->recursive = 0;
$this->set('users', $this->Paginator->paginate());
}
/**
* view method
*
* @throws NotFoundException
* @param string $id
* @return void
*/
public function view($id = null) {
if (!$this->User->exists($id)) {
throw new NotFoundException(__('Invalid user'));
}
$options = array('conditions' => array('User.' . $this->User->primaryKey => $id));
$this->set('user', $this->User->find('first', $options));
}
/**
* add method
*
* @return void
*/
public function add() {
if ($this->request->is('post')) {
$this->User->create();
if ($this->User->save($this->request->data)) {
$this->Flash->success(__('The user has been saved.'));
return $this->redirect(array('action' => 'index'));
} else {
$this->Flash->error(__('The user could not be saved. Please, try again.'));
}
}
$devices = $this->User->Device->find('list');
$installations = $this->User->Installation->find('list');
$rooms = $this->User->Room->find('list');
$this->set(compact('devices', 'installations', 'rooms'));
}
/**
* edit method
*
* @throws NotFoundException
* @param string $id
* @return void
*/
public function edit($id = null) {
if (!$this->User->exists($id)) {
throw new NotFoundException(__('Invalid user'));
}
if ($this->request->is(array('post', 'put'))) {
if ($this->User->save($this->request->data)) {
$this->Flash->success(__('The user has been saved.'));
return $this->redirect(array('action' => 'index'));
} else {
$this->Flash->error(__('The user could not be saved. Please, try again.'));
}
} else {
$options = array('conditions' => array('User.' . $this->User->primaryKey => $id));
$this->request->data = $this->User->find('first', $options);
}
$devices = $this->User->Device->find('list');
$installations = $this->User->Installation->find('list');
$rooms = $this->User->Room->find('list');
$this->set(compact('devices', 'installations', 'rooms'));
}
/**
* delete method
*
* @throws NotFoundException
* @param string $id
* @return void
*/
public function delete($id = null) {
$this->User->id = $id;
if (!$this->User->exists()) {
throw new NotFoundException(__('Invalid user'));
}
$this->request->allowMethod('post', 'delete');
if ($this->User->delete()) {
$this->Flash->success(__('The user has been deleted.'));
} else {
$this->Flash->error(__('The user could not be deleted. Please, try again.'));
}
return $this->redirect(array('action' => 'index'));
}
}
<?xml version="1.0" encoding="utf-8" ?>
<dwsync>
<file name="DevicesController.php" server="192.168.80.1//var/www/lmce-api/" local="131604774847915589" remote="131604774600000000" Dst="1" />
<file name="LmcearraysController.php" server="192.168.80.1//var/www/lmce-api/" local="131602860000000000" remote="131602860000000000" Dst="1" />
<file name="ArraysController.php" server="192.168.80.1//var/www/lmce-api/" local="131602860000000000" remote="131602860000000000" Dst="1" />
<file name="StatusController.php" server="192.168.80.1//var/www/lmce-api/" local="131604698026816902" remote="131604697800000000" Dst="1" />
<file name="RoomsController.php" server="192.168.80.1//var/www/lmce-api/" local="131603902200000000" remote="131603902200000000" Dst="1" />
<file name="AppController.php" server="192.168.80.1//var/www/lmce-api/" local="131581233000000000" remote="131581233000000000" Dst="1" />
<file name="UsersController.php" server="192.168.80.1//var/www/lmce-api/" local="131604790800000000" remote="131604790800000000" Dst="1" />
</dwsync>
\ No newline at end of file
<?php
/**
* Application model for Cake.
*
* This file is application-wide model file. You can put all
* application-wide model-related methods here.
*
* @link https://cakephp.org CakePHP(tm) Project
* @package app.Model
* @since CakePHP(tm) v 0.2.9
*/
App::uses('Model', 'Model');
/**
* Application model for Cake.
*
* Add your application-wide methods in the class below, your models
* will inherit them.
*
* @package app.Model
*/
class AppModel extends Model {
}
<?php
App::uses('AppModel', 'Model');
/**
* Array Model
*
* @property Psc $Psc
*/
class LmceArray extends AppModel {
/**
* Use table
*
* @var mixed False or table name
*/
public $useTable = 'LmceArray';
/**
* Primary key field
*
* @var string
*/
public $primaryKey = 'PK_Array';
/**
* Validation rules
*
* @var array
*/
public $validate = array(
'Description' => array(
'notBlank' => array(
'rule' => array('notBlank'),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => false,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
'Define' => array(
'notBlank' => array(
'rule' => array('notBlank'),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => false,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
'CommandGroup' => array(
'numeric' => array(
'rule' => array('numeric'),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => false,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
);
// The Associations below have been created with all possible keys, those that are not needed can be removed
/**
* belongsTo associations
*
* @var array
*/
public $belongsTo = array(
'Psc' => array(
'className' => 'Psc',
'foreignKey' => 'psc_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
}
<?php
App::uses('AppModel', 'Model');
/**
* Command Model
*
* @property CommandParameter $CommandParameter
* @property DeviceCommandGroup $DeviceCommandGroup
* @property Device $Device
* @property Device $Device
*/
class Command extends AppModel {
/**
* Use table
*
* @var mixed False or table name
*/
public $useTable = 'Command';
/**
* Primary key field
*
* @var string
*/
public $primaryKey = 'PK_Command';
/**
* Validation rules
*
* @var array
*/
public $validate = array(
'Description' => array(
'notBlank' => array(
'rule' => array('notBlank'),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => false,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
'Category' => array(
'numeric' => array(
'rule' => array('numeric'),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => false,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
'AVCommand' => array(
'numeric' => array(
'rule' => array('numeric'),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => false,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
'Log' => array(
'boolean' => array(
'rule' => array('boolean'),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => false,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
);
// The Associations below have been created with all possible keys, those that are not needed can be removed
/**
* belongsTo associations
*
* @var array
*/
public $belongsTo = array(
'CommandCategory' => array (
'className'=>'CommandCategory',
'foreignKey' => 'FK_CommandCategory'
)
);
/**
* hasAndBelongsToMany associations
*
* @var array
*/
public $hasAndBelongsToMany = array(
'CommandParameter' => array(
'className' => 'CommandParameter',
'joinTable' => 'Command_CommandParameter',
'foreignKey' => 'FK_Command',
'associationForeignKey' => 'FK_CommandParameter',
'unique' => 'keepExisting',
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'finderQuery' => '',
),
'Device' => array(
'className' => 'Device',
'joinTable' => 'Device_Command',
'foreignKey' => 'FK_Command',
'associationForeignKey' => 'FK_Device',
'unique' => 'keepExisting',
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'finderQuery' => '',
)
);
}
<?php
App::uses('AppModel', 'Model');
/**
* CommandCategory Model
*/
class CommandCategory extends AppModel {
/**
* Use table
*
* @var mixed False or table name
*/
public $useTable = 'CommandCategory';
/**
* Primary key field
*
* @var string
*/
public $primaryKey = 'PK_CommandCategory';
// The Associations below have been created with all possible keys, those that are not needed can be removed
/**
* belongsTo associations
*
* @var array
*/
public $hasMany = array (
"Command" => array (
'className'=> 'Command',
'foreignKey' =>'FK_CommandCategory'
)
);
}
<?php
App::uses('AppModel', 'Model');
class CommandDevice extends AppModel {
public $belongsTo = array(
'Command', 'DeviceTemplate'
);
}
?>
\ No newline at end of file
<?php
App::uses('AppModel', 'Model');
/**
* Device Model
*
* @property DeviceCategory $DeviceCategory
* @property DeviceCommandGroup $DeviceCommandGroup
* @property DeviceTemplate $DeviceTemplate
* @property DeviceTemplate $DeviceTemplate
* @property DeviceTemplate $DeviceTemplate
* @property DeviceTemplate $DeviceTemplate
* @property DeviceTemplate $DeviceTemplate
* @property DeviceTemplate $DeviceTemplate
* @property DeviceTemplate $DeviceTemplate
* @property Command $Command
* @property CommandGroup $CommandGroup
* @property DeviceData $DeviceData
* @property DeviceGroup $DeviceGroup
* @property EntertainArea $EntertainArea
*/
class Device extends AppModel {
public $_hidden = array('psc_user', 'FK_DesignObj');
/**
* Use table
*
* @var mixed False or table name
*/
public $useTable = 'Device';
/**
* Primary key field
*
* @var string
*/
public $primaryKey = 'PK_Device';
/**