Added a monetary_sources controller/view. Don't know if we'll really want this, since it might just make the most sense to embed its actions within ledger entry. We'll keep it for now.

git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@94 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-10 21:24:05 +00:00
parent ab766c2dc5
commit 8bce19d8c4
2 changed files with 104 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
<?php
class MonetarySourcesController extends AppController {
var $paginate = array('limit' => 100,
'group' => 'Entry.id',
'order' => array('Entry.stamp' => 'ASC'));
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: 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'));
}
}

View File

@@ -0,0 +1,57 @@
<?php /* -*- mode:PHP -*- */ ?>
<div class="monetary-source view">
<?php
; // Editor alignment
/**********************************************************************
**********************************************************************
**********************************************************************
**********************************************************************
* MonetarySource Detail Main Section
*/
$javascript->link(array('jquery'), false);
$type = $monetarySource['MonetaryType'];
$source = $monetarySource['MonetarySource'];
$rows = array(array('ID', $source['id']),
array('Name', $source['name']),
array('Type', $type['name']),
array('Tillable', $type['tillable'] ? 'Yes' : 'No'),
array('Comment', $source['comment']));
echo $this->element('table',
array('class' => 'item monetary-source detail',
'caption' => 'Monetary Source Detail',
'rows' => $rows,
'column_class' => array('field', 'value')));
/**********************************************************************
* MonetarySource Info Box
*/
?>
<DIV CLASS="infobox">
</DIV>
<DIV CLASS="detail supporting">
<?php
; // Editor alignment
/**********************************************************************
**********************************************************************
**********************************************************************
**********************************************************************
* Supporting Elements Section
*/
/* End "detail supporting" DIV */ ?>
</DIV>
</div>