public function index() { $errors = array(); $s_data = array(); // Set context from calling module if (isset($this->_data['whstore_id'])) { $s_data['whstore_id'] = $this->_data['whstore_id']; } $this->setSearch('whlocationsSearch', 'useDefault', $s_data); $id = $this->search->getValue('whstore_id'); $this->view->set('clickaction', 'view'); parent::index(new WHLocationCollection($this->_templateobject)); $store = new WHStore(); $store->load($id); $this->view->set('whstore', $store); $sidebar = new SidebarController($this->view); $sidebarlist = array(); $sidebarlist['stores'] = array('tag' => 'View All Stores', 'link' => array_merge($this->_modules, array('controller' => 'WHStores', 'action' => 'index'))); $sidebarlist['new'] = array('tag' => 'New Location for ' . $store->getIdentifierValue(), 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'new', 'whstore_id' => $id))); $sidebarlist['edit'] = array('tag' => 'Edit ' . $store->getIdentifierValue(), 'link' => array_merge($this->_modules, array('controller' => 'WHStores', 'action' => 'edit', 'id' => $id))); if ($store->locations->count() === 0) { $sidebarlist['delete'] = array('tag' => 'Delete ' . $store->getIdentifierValue(), 'link' => array_merge($this->_modules, array('controller' => 'WHStores', 'action' => 'delete', 'id' => $id))); } $sidebar->addList('Actions', $sidebarlist); $this->view->register('sidebar', $sidebar); $this->view->set('sidebar', $sidebar); }
function populate() { $store = new WHStore(); $this->contents['whstore'] = $store->getAll(); }
public function _new() { parent::_new(); $this->view->set('addresses', WHStore::getAddresses()); }