本文整理汇总了PHP中SidebarController类的典型用法代码示例。如果您正苦于以下问题:PHP SidebarController类的具体用法?PHP SidebarController怎么用?PHP SidebarController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SidebarController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
public function view()
{
if (!$this->loadData()) {
$this->dataError();
sendBack();
}
$mappingrule = $this->_uses[$this->modeltype];
$this->view->set('clickaction', 'view');
$this->view->set('mappingrule', $mappingrule);
$childrules = new DataMappingRuleCollection(new DataMappingRule());
$sh = $this->setSearchHandler($childrules);
$sh->addConstraint(new Constraint('parent_id', '=', $mappingrule->id));
parent::index($childrules, $sh);
$sidebar = new SidebarController($this->view);
$sidebar->addList('actions', array($mappingrule->name => array('tag' => 'View All Mapping Rules', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'index'))));
$sidebarlist = array();
$sidebarlist[$mappingrule->name] = array('tag' => 'view', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'view', 'id' => $mappingrule->id));
$sidebarlist['edit'] = array('tag' => 'edit', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'edit', 'id' => $mappingrule->id));
$sidebarlist['delete'] = array('tag' => 'delete', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'delete', 'id' => $mappingrule->id));
$sidebar->addList($mappingrule->external_system . ' ' . $mappingrule->name, $sidebarlist);
if (!is_null($mappingrule->parent_id)) {
$mappingrule->addLinkRule(array('data_translations' => array()));
}
$this->sidebarRelatedItems($sidebar, $mappingrule);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
$this->view->set('page_title', $this->getPageName());
}
示例2: view
public function view()
{
$flash = Flash::Instance();
// Preserve any search criteria selection so that the context is maintained
$s_data = array();
if (isset($this->_data['id'])) {
$s_data['wh_transfer_id'] = $this->_data['id'];
}
$whtransfer = new WHTransfer();
$whtransfer->load($this->_data['id']);
$this->view->set('whtransfer', $whtransfer);
$from_store = WHLocation::getStoreLocation($whtransfer->from_whlocation_id);
$this->view->set('from_store', $from_store);
$to_store = WHLocation::getStoreLocation($whtransfer->to_whlocation_id);
$this->view->set('to_store', $to_store);
$this->setSearch('whtransfersSearch', 'useDefault', $s_data);
parent::index(new WHTransferlineCollection($this->_templateobject));
$sidebar = new SidebarController($this->view);
$sidebarlist = array();
$sidebarlist['awaiting'] = array('link' => array_merge($this->_modules, array('controller' => 'WHTransfers', 'action' => 'selectWHTransfers')), 'tag' => 'View Transfers Awaiting Despatch');
$sidebarlist['completed'] = array('link' => array_merge($this->_modules, array('controller' => 'WHTransfers', 'action' => 'viewWHTransfers')), 'tag' => 'View Completed Transfers');
if ($whtransfer->awaitingTransfer()) {
$sidebarlist['edit'] = array('link' => array_merge($this->_modules, array('controller' => 'WHTransfers', 'action' => 'transferStock', 'id' => $whtransfer->id)), 'tag' => 'Action this Transfer');
}
if ($whtransfer->transferred()) {
$sidebarlist['edit'] = array('link' => array_merge($this->_modules, array('controller' => 'WHTransfers', 'action' => 'printaction', 'printaction' => 'printTransferNote', 'filename' => 'WHT' . $whtransfer->transfer_number, 'id' => $whtransfer->id)), 'tag' => 'Reprint Transfer Note');
}
$sidebar->addList('Actions', $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例3: view
public function view()
{
if (!$this->loadData()) {
$this->dataError();
sendBack();
}
$account = $this->_uses[$this->modeltype];
$glbalance = $account->glbalance();
$this->view->set('glbalance', $glbalance);
$sidebar = new SidebarController($this->view);
$sidebarlist = array();
$sidebarlist['view_all'] = array('tag' => 'View All Accounts', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'index'));
$sidebarlist['receiveany'] = array('link' => array('modules' => $this->_modules, 'controller' => 'cbtransactions', 'action' => 'receive_payment', 'cb_account_id' => $account->id), 'tag' => 'receive_payment');
$sidebarlist['makeany'] = array('link' => array('modules' => $this->_modules, 'controller' => 'cbtransactions', 'action' => 'make_payment', 'cb_account_id' => $account->id), 'tag' => 'make_payment');
$sidebarlist['moveany'] = array('link' => array('modules' => $this->_modules, 'controller' => 'cbtransactions', 'action' => 'move_money'), 'tag' => 'move_money');
$sidebar->addList('actions', $sidebarlist);
$sidebarlist = array();
$idfield = $account->idField;
$idfieldValue = $account->{$account->idField};
$sidebarlist[$account->name] = array('tag' => $account->name, 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'view', $idfield => $idfieldValue));
$sidebarlist['reconcile'] = array('tag' => 'reconcile', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'reconcile', $idfield => $idfieldValue));
$sidebarlist['viewtrans'] = array('link' => array('modules' => $this->_modules, 'controller' => 'cbtransactions', 'action' => 'index', 'cb_account_id' => $idfieldValue), 'tag' => 'view_transactions');
$sidebarlist['receive_payment'] = array('link' => array('modules' => $this->_modules, 'controller' => 'cbtransactions', 'action' => 'receive_payment', 'cb_account_id' => $idfieldValue, 'currency_id' => $account->currency_id), 'tag' => 'receive_payment');
$sidebarlist['make_payment'] = array('link' => array('modules' => $this->_modules, 'controller' => 'cbtransactions', 'action' => 'make_payment', 'cb_account_id' => $idfieldValue, 'currency_id' => $account->currency_id), 'tag' => 'make_payment');
$sidebarlist['move_money'] = array('link' => array('modules' => $this->_modules, 'controller' => 'cbtransactions', 'action' => 'move_money', 'cb_account_id' => $idfieldValue), 'tag' => 'move_money');
$params = new GLParams();
if ($params->base_currency() != $account->currency_id) {
$sidebarlist['revaluation'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'revaluation', $idfield => $idfieldValue), 'tag' => 'revaluation');
}
$sidebar->addList($account->name, $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例4: index
public function index()
{
$errors = array();
$s_data = array();
// Set context from calling module
if (isset($this->_data['cbaccount_id'])) {
$s_data['cbaccount_id'] = $this->_data['cbaccount_id'];
}
if (isset($this->_data['company_id'])) {
$s_data['company_id'] = $this->_data['company_id'];
}
if (isset($this->_data['source'])) {
$s_data['source'] = $this->_data['source'];
}
if (isset($this->_data['status'])) {
$s_data['status'] = $this->_data['status'];
}
if (isset($this->_data['frequency'])) {
$s_data['frequency'] = $this->_data['frequency'];
}
$this->setSearch('PeriodicPaymentsSearch', 'useDefault', $s_data);
$this->view->set('clickaction', 'edit');
parent::index(new PeriodicPaymentCollection($this->_templateobject));
$sidebar = new SidebarController($this->view);
$sidebarlist = array();
$sidebarlist['new'] = array('tag' => 'New Payment', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'new'));
$sidebar->addList('Actions', $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例5: _new
public function _new()
{
$flash = Flash::Instance();
parent::_new();
$gl_params = $this->_uses[$this->modeltype];
$unassigned = $gl_params->unassignedParams();
if (count($unassigned) > 0) {
$this->view->set('unassigned', $unassigned);
} elseif (count($unassigned) == 0 && $this->_data['action'] == 'new') {
$flash->addMessage('All parameters have been assigned');
sendTo($this->name, 'index', $this->_modules);
} elseif ($this->_data['action'] == 'new') {
$flash->addError('Error getting Parameter List');
sendback();
}
if (isset($_POST[$this->modeltype]['paramdesc'])) {
$this->selectlist($_POST[$this->modeltype]['paramdesc']);
} elseif ($gl_params->isLoaded()) {
$this->selectlist($gl_params->paramdesc);
$this->view->set('selected', $gl_params->paramvalue_id);
} else {
$this->selectlist(key($unassigned));
}
$sidebar = new SidebarController($this->view);
$sidebarlist = array();
$sidebarlist['view'] = array('tag' => 'View Parameters', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'index')));
$sidebar->addList('Actions', $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例6: view
public function view()
{
if (!$this->loadData()) {
$this->dataError();
sendBack();
}
$mfshiftoutput = $this->_uses[$this->modeltype];
$this->view->set('model', $mfshiftoutput);
$mfshiftwaste = new MFShiftWasteCollection();
$sh = $this->setSearchHandler($mfshiftwaste);
$sh->setFields(array('id', 'waste_type', 'qty', 'uom_name'));
$sh->addConstraint(new Constraint('mf_shift_outputs_id', '=', $mfshiftoutput->id));
parent::index($mfshiftwaste, $sh);
$this->view->set('clickaction', 'edit');
$this->view->set('clickcontroller', 'mfshiftwastes');
$this->view->set('page_title', $this->getPageName('', 'View'));
$sidebar = new SidebarController($this->view);
$sidebarlist = array();
$sidebarlist['viewallshifts'] = array('tag' => 'View All Shifts', 'link' => array('modules' => $this->_modules, 'controller' => 'mfshifts', 'action' => 'index'));
$sidebarlist['newshift'] = array('tag' => 'Add New Shift', 'link' => array('modules' => $this->_modules, 'controller' => 'mfshifts', 'action' => 'new'));
$sidebar->addList('Actions', $sidebarlist);
$sidebarlist = array();
$sidebarlist['viewshift'] = array('tag' => 'View Shift', 'link' => array('modules' => $this->_modules, 'controller' => 'mfshifts', 'action' => 'view', 'id' => $mfshiftoutput->mf_shift_id));
$sidebarlist['edit'] = array('tag' => 'Edit Output', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'edit', 'id' => $mfshiftoutput->id));
$sidebarlist['delete'] = array('tag' => 'Delete Output', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'delete', 'id' => $mfshiftoutput->id));
$sidebarlist['addwastet'] = array('tag' => 'Add Waste', 'link' => array('modules' => $this->_modules, 'controller' => 'mfshiftwastes', 'action' => 'new', 'mf_shift_outputs_id' => $mfshiftoutput->id));
$sidebar->addList('Current Shift Output', $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例7: view
public function view()
{
if (!$this->loadData()) {
$this->dataError();
sendBack();
}
$transaction = $this->_uses[$this->modeltype];
$id = $transaction->id;
if ($transaction->bin_controlled == 't') {
sendTo('WHBins', 'index', $this->_modules, array('whlocation_id' => $this->_data['id']));
}
$this->view->set('transaction', $transaction);
$sidebar = new SidebarController($this->view);
$sidebarlist = array();
$sidebarlist['stores'] = array('tag' => 'All Stores', 'link' => array_merge($this->_modules, array('controller' => 'WHStores', 'action' => 'index')));
$sidebarlist['locations'] = array('tag' => 'Locations for Store ' . $transaction->whstore, 'link' => array_merge($this->_modules, array('controller' => 'WHStores', 'action' => 'view', 'id' => $transaction->whstore_id)));
$sidebar->addList('Show', $sidebarlist);
$sidebarlist = array();
$sidebarlist['edit'] = array('tag' => 'Edit', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'edit', 'id' => $id)));
if ($transaction->isBinControlled() && $transaction->bins->count() == 0 || !$transaction->isBinControlled() && $transaction->balances->count() == 0) {
$sidebarlist['delete'] = array('tag' => 'Delete', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'delete', 'id' => $id, 'whstore_id' => $transaction->whstore_id)));
}
$sidebar->addList('This Location', $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
$this->view->set('page_title', $this->getPageName('Location'));
}
示例8: view
public function view()
{
if (!$this->loadData()) {
sendback();
}
$ledgercategory = $this->_uses[$this->modeltype];
$idfield = $ledgercategory->idField;
$id = $ledgercategory->{$idfield};
// Check if Ledger Category is used by Ledger Accounts
$ledgeraccount = new LedgerCategory('ledger_category_accounts');
$ledgeraccount->idField = 'company_id';
$ledgeraccount->identifierField = 'name';
$cc = new ConstraintChain();
$cc->add(new Constraint('category_id', '=', $ledgercategory->category_id));
$ledgeraccounts = $ledgeraccount->getAll($cc);
$sidebar = new SidebarController($this->view);
$sidebarlist = array();
$sidebarlist['all'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'index'), 'tag' => 'view_ledger_categories');
$sidebarlist['new'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'new'), 'tag' => 'new_ledger_category');
if (count($ledgeraccounts) == 0) {
$sidebarlist['edit'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'edit', $idfield => $ledgercategory->{$idfield}), 'tag' => 'edit_ledger_category');
$sidebarlist['delete'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'delete', $idfield => $ledgercategory->{$idfield}), 'tag' => 'delete_ledger_category');
}
$sidebar->addList('Actions', $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
$this->view->set('model', $ledgercategory);
$this->view->set('count', count($ledgeraccounts));
}
示例9: index
public function index()
{
$this->view->set('clickaction', 'view');
$errors = array();
$s_data = array();
// Set context from calling module
if (isset($this->_data['username'])) {
$s_data['username'] = $this->_data['username'];
}
if (isset($this->_data['glcentre_id'])) {
$s_data['glcentre_id'] = $this->_data['glcentre_id'];
}
$this->setSearch('poauthlimitsSearch', 'useDefault', $s_data);
$username = $this->search->getValue('username');
$glcentre_id = $this->search->getValue('glcentre_id');
parent::index(new POAuthLimitCollection($this->_templateobject));
$sidebar = new SidebarController($this->view);
$actions = array();
$actions['new'] = array('tag' => 'New Authorisation Limit', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'new'));
if (isset($s_data['username']) && $s_data['username'] != '') {
$actions['forperson'] = array('tag' => 'New Authorisation Limit for this person', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'new', 'username' => $username));
}
if (isset($s_data['glcentre_id']) && $s_data['glcentre_id'] != '0') {
$actions['foraccount'] = array('tag' => 'New Authorisation Limit for this GL Centre', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'new', 'glcentre_id' => $s_data['glcentre_id']));
}
$sidebar->addList('Actions', $actions);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例10: view
public function view()
{
$flash = Flash::Instance();
if (MEMCACHED_ENABLED) {
// fetch the item from the cache
$cache = Cache::Instance();
$item = $cache->get($this->_data['id']);
} else {
$flash->addError("Cache is disabled");
sendBack();
}
// make sure we've got something
if ($item === FALSE) {
$flash->addError("Cache item doesn't exist");
sendBack();
}
// ammend output depending on the data type
if (is_object($item) || is_array($item)) {
$item = print_r($item, TRUE);
} else {
$item = var_export($item, TRUE);
}
// set smarty variables
$this->view->set('item', $item);
$this->view->set('title', $this->_data['id']);
// set sidebar
$sidebar = new SidebarController($this->view);
$sidebar->addList('Actions', array('view_all_caches' => array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'index'), 'tag' => 'view_all_caches'), 'flush_cache' => array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'delete', 'id' => $this->_data['id']), 'tag' => 'delete_key')));
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例11: view
public function view()
{
if (!$this->loadData()) {
$this->dataError();
sendBack();
}
$accesslist = $this->_uses[$this->modeltype];
// $this->addSidebar($systempolicy);
$policy_permissions = new SystemPolicyControlListCollection();
$sh = $this->setSearchHandler($policy_permissions);
$sh->addConstraint(new Constraint('access_lists_id', '=', $accesslist->{$accesslist->idField}));
parent::index($policy_permissions, $sh);
$this->view->set('no_ordering', true);
$sidebar = new SidebarController($this->view);
$sidebarlist = array();
$sidebarlist['alllists'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'index'), 'tag' => 'View All System Access Lists');
$sidebar->addList('Actions', $sidebarlist);
$sidebarlist = array();
$sidebarlist['edit'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'edit', 'id' => $accesslist->{$accesslist->idField}), 'tag' => 'edit_access_list');
$sidebarlist['delete'] = array('link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'delete', 'id' => $accesslist->{$accesslist->idField}), 'tag' => 'delete_access_list');
$sidebarlist['addpermission'] = array('link' => array('modules' => $this->_modules, 'controller' => 'systempolicycontrollists', 'action' => '_new', 'object_policies_id' => $accesslist->{$accesslist->idField}), 'tag' => 'add_policy_permission');
$sidebar->addList('This Policy', $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例12: index
public function index()
{
$errors = array();
$s_data = array();
// Preserve any search criteria selection so that the context is maintained
if (isset($this->_data['Search'])) {
$s_data = $this->_data['Search'];
} elseif (!isset($this->_data['orderby']) && !isset($this->_data['page'])) {
// Either this is the first entry to the page or the search has been cleared
// and orderby or paging is not selected
// so set context from calling module
$currentPeriod = GLPeriod::getPeriod(date('Y-m-d'));
if ($currentPeriod && count($currentPeriod) > 0) {
$s_data['glperiods_id'] = array($currentPeriod['id']);
}
if (isset($this->_data['glaccount_id'])) {
$s_data['glaccount_id'] = $this->_data['glaccount_id'];
}
if (isset($this->_data['glcentre_id'])) {
$s_data['glcentre_id'] = $this->_data['glcentre_id'];
}
}
$this->setSearch('glbalancesSearch', 'useDefault', $s_data);
$this->view->set('clickaction', 'edit');
parent::index(new GLBudgetCollection($this->_templateobject));
$sidebar = new SidebarController($this->view);
$sidebarlist = array();
$sidebarlist['new'] = array('tag' => 'New Budget', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'new')));
$sidebarlist['viewaccounts'] = array('tag' => 'View All Accounts', 'link' => array_merge($this->_modules, array('controller' => 'glaccounts', 'action' => 'index')));
$sidebarlist['viewcentres'] = array('tag' => 'View All Centres', 'link' => array_merge($this->_modules, array('controller' => 'glcentres', 'action' => 'index')));
$sidebar->addList('Actions', $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例13: view
public function view()
{
if (!$this->loadData()) {
$this->dataError();
sendBack();
}
$transaction = $this->_uses[$this->modeltype];
$id = $transaction->id;
$this->view->set('transaction', $transaction);
$elements = new MFCentreCollection(new MFCentre());
$sh = $this->setSearchHandler($elements);
$sh->addConstraint(new Constraint('mfdept_id', '=', $id));
parent::index($elements, $sh);
$sidebar = new SidebarController($this->view);
$sidebarlist = array();
$sidebarlist['all'] = array('tag' => 'All Departments', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'index')));
$sidebar->addList('Show', $sidebarlist);
$sidebarlist = array();
$sidebarlist['edit'] = array('tag' => 'Edit', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'edit', 'id' => $id)));
if ($elements->count() == 0) {
$sidebarlist['delete'] = array('tag' => 'Delete', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'delete', 'id' => $id)));
}
$sidebarlist['add'] = array('tag' => 'Add Centre', 'link' => array_merge($this->_modules, array('controller' => 'MFCentres', 'action' => 'new', 'mfdept_id' => $id)));
$sidebar->addList('This Department', $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
$this->view->set('clickaction', 'view');
$this->view->set('clickcontroller', 'MFCentres');
}
示例14: index
public function index()
{
$flash = Flash::Instance();
// Preserve any search criteria selection so that the context is maintained
$s_data = array();
if (isset($this->_data['id'])) {
$s_data['wh_transfer_id'] = $this->_data['id'];
}
$this->view->set('clickaction', 'view');
$whtransfer = new WHTransfer();
$whtransfer->load($this->_data['id']);
$this->view->set('whtransfer', $whtransfer);
$from_store = WHLocation::getStoreLocation($whtransfer->from_whlocation_id);
$this->view->set('from_store', $from_store);
$to_store = WHLocation::getStoreLocation($whtransfer->to_whlocation_id);
$this->view->set('to_store', $to_store);
$this->setSearch('whtransfersSearch', 'useDefault', $s_data);
parent::index(new WHTransferlineCollection($this->_templateobject));
$sidebar = new SidebarController($this->view);
$sidebarlist = array();
$sidebarlist['all'] = array('tag' => 'View All Transfers', 'link' => array_merge($this->_modules, array('controller' => 'WHTransfers', 'action' => 'index')));
if ($whtransfer->awaitingTransfer()) {
$sidebarlist['edit'] = array('tag' => 'Edit this Transfer', 'link' => array_merge($this->_modules, array('controller' => 'WHTransfers', 'action' => 'edit', 'id' => $whtransfer->id)));
$sidebarlist['cancel'] = array('tag' => 'Cancel this Transfer', 'link' => array_merge($this->_modules, array('controller' => 'WHTransfers', 'action' => 'cancel', 'id' => $whtransfer->id)));
}
$sidebar->addList('Actions', $sidebarlist);
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
}
示例15: index
public function index()
{
// Cater for no module to edit.
if (empty($this->_data['for_module'])) {
$this->_data['for_module'] = 'shared';
}
$sidebarList['shared'] = array('tag' => 'Shared', 'link' => array('module' => 'dashboard', 'controller' => 'preferences', 'action' => 'index', 'for_module' => 'shared'));
$accessObject =& AccessObject::Instance(EGS_USERNAME);
$module = DataObjectFactory::Factory('ModuleObject');
$modules = $module->getAll();
$sidebar = new SidebarController($this->view);
foreach ($modules as $module) {
if (!class_exists(ucfirst($module) . 'Preferences')) {
continue;
}
if ($accessObject->hasPermission($module, 'preferences')) {
$sidebarList[$module] = array('tag' => ucfirst($module) . ' Preferences', 'link' => array('module' => 'dashboard', 'controller' => 'preferences', 'action' => 'index', 'for_module' => $module));
}
}
if (empty($sidebarList)) {
$flash = Flash::Instance();
$flash->addError('There are no preferences you can edit');
sendTo('index', 'index', array('dashboard'));
} else {
$sidebar->addList('Modules', $sidebarList);
}
$this->view->register('sidebar', $sidebar);
$this->view->set('sidebar', $sidebar);
$module = $this->getPreferenceClass($this->_data['for_module']);
$this->view->set('templateCode', $module->generateTemplate());
$this->view->set('page_title', $this->getPageName($this->_data['for_module'], 'Preferences for'));
}