Files
pmgr/controllers/monetary_sources_controller.php
abijah 365b2295af Added an element for monetary_sources. Not sure if it will get used, but it was easy enough to do.
git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@138 97e9348a-65ac-dc4b-aefc-98561f571b83
2009-06-15 21:45:07 +00:00

78 lines
2.6 KiB
PHP

<?php
class MonetarySourcesController extends AppController {
var $sidemenu_links = array();
/**************************************************************************
**************************************************************************
**************************************************************************
* override: sideMenuLinks
* - Generates controller specific links for the side menu
*/
function sideMenuLinks() {
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
}
/**************************************************************************
**************************************************************************
**************************************************************************
* action: index / all
* - Generate a listing of MonetarySources
*/
function index() { $this->all(); }
function all() { $this->jqGridView('All MonetarySources', 'all'); }
/**************************************************************************
**************************************************************************
**************************************************************************
* virtuals: jqGridData
* - With the application controller handling the jqGridData action,
* these virtual functions ensure that the correct data is passed
* to jqGrid.
*/
function jqGridDataTables(&$params, &$model) {
return array
('link' => array('MonetaryType' => array('fields' => array('MonetaryType.id', 'MonetaryType.name')),
),
);
}
function jqGridRecordLinks(&$params, &$model, &$records, $links) {
$links['MonetarySource'] = array('id');
return parent::jqGridRecordLinks($params, $model, $records, $links);
}
/**************************************************************************
**************************************************************************
**************************************************************************
* action: view
* - Displays information about a specific entry
*/
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid Item.', true));
$this->redirect(array('controller' => 'accounts', 'action'=>'index'));
}
// Get the MonetarySource and related fields
$monetary_source = $this->MonetarySource->find
('first', array
('contain' => array
('MonetaryType',
),
));
// Prepare to render.
$title = "Monetary Source #{$monetary_source['MonetarySource']['id']}";
$this->set(compact('monetary_source', 'title'));
}
}