git-svn-id: file:///svn-source/pmgr/branches/initial_20090526/site@65 97e9348a-65ac-dc4b-aefc-98561f571b83
119 lines
3.7 KiB
PHP
119 lines
3.7 KiB
PHP
<?php
|
|
|
|
class PaymentsController extends AppController {
|
|
var $paginate = array('limit' => 100,
|
|
'group' => 'Payment.id',
|
|
'order' => array('Payment.id' => 'ASC'));
|
|
|
|
var $sidemenu_links =
|
|
array(array('name' => 'Payments', 'header' => true),
|
|
array('name' => 'Cleared', 'url' => array('controller' => 'payments', 'action' => 'cleared')),
|
|
array('name' => 'Unresolved', 'url' => array('controller' => 'payments', 'action' => 'unresolved')),
|
|
);
|
|
|
|
|
|
/**************************************************************************
|
|
**************************************************************************
|
|
**************************************************************************
|
|
* override: sideMenuLinks
|
|
* - Generates controller specific links for the side menu
|
|
*/
|
|
function sideMenuLinks() {
|
|
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
|
}
|
|
|
|
|
|
/**************************************************************************
|
|
**************************************************************************
|
|
**************************************************************************
|
|
* action: index
|
|
* - Lists all payments
|
|
*/
|
|
|
|
function index() {
|
|
$this->all();
|
|
}
|
|
|
|
|
|
/**************************************************************************
|
|
**************************************************************************
|
|
**************************************************************************
|
|
* action: cleared
|
|
* - Lists cleared payments
|
|
*/
|
|
|
|
function cleared() {
|
|
$this->all();
|
|
}
|
|
|
|
|
|
/**************************************************************************
|
|
**************************************************************************
|
|
**************************************************************************
|
|
* action: unresolved
|
|
* - Lists unresolved payments
|
|
*/
|
|
|
|
function unresolved() {
|
|
$this->all();
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
**************************************************************************
|
|
**************************************************************************
|
|
* action: all
|
|
* - Lists all payments
|
|
*/
|
|
|
|
function all() {
|
|
$this->paginate = array_merge
|
|
($this->paginate,
|
|
array('link' =>
|
|
array(// Models
|
|
'PaymentType',
|
|
'Receipt',
|
|
),
|
|
));
|
|
|
|
$title = 'All Payments';
|
|
$this->set('title', $title); $this->set('heading', $title);
|
|
$this->set('payments', $this->paginate());
|
|
$this->render('index');
|
|
}
|
|
|
|
|
|
/**************************************************************************
|
|
**************************************************************************
|
|
**************************************************************************
|
|
* action: view
|
|
* - Displays information about a specific payment
|
|
*/
|
|
|
|
function view($id = null) {
|
|
if (!$id) {
|
|
$this->Session->setFlash(__('Invalid Item.', true));
|
|
$this->redirect(array('action'=>'index'));
|
|
}
|
|
|
|
$this->Payment->Behaviors->attach('Containable');
|
|
$this->Payment->contain
|
|
(array(// Models
|
|
'PaymentType',
|
|
'Receipt',
|
|
)
|
|
);
|
|
$payment = $this->Payment->read(null, $id);
|
|
//pr($payment);
|
|
|
|
/* $this->sidemenu_links[] = */
|
|
/* array('name' => 'Operations', 'header' => true); */
|
|
/* $this->sidemenu_links[] = */
|
|
/* array('name' => 'Move-Out', 'url' => array('controller' => 'payments', 'action' => 'move-out')); */
|
|
|
|
$title = 'Payment #' . $payment['Payment']['id'];
|
|
$this->set(compact('payment', 'title'));
|
|
}
|
|
}
|