public function initialize()
 {
     $this->_action = 'menuitem_add';
     $name = new Text('name');
     $name->setFilters(array('striptags', 'string'));
     $name->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off', 'id' => 'menuitem_name'));
     $name->setLabel('Name');
     $url = new Text('url');
     $url->setFilters(array('striptags', 'string'));
     $url->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off'));
     $url->setLabel('URL');
     $icon = new Text('icon');
     $icon->setFilters(array('striptags', 'string'));
     $icon->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off'));
     $icon->setLabel('Icon');
     $device = new Select('device_id', Devices::find(), array('using' => array('id', 'name'), 'useEmpty' => true, 'emptyText' => 'None', 'emptyValue' => 0));
     $device->setLabel('Device');
     $menuId = new Hidden('menu_id');
     $menuId->setDefault(1);
     $this->add($name);
     $this->add($url);
     $this->add($icon);
     $this->add($device);
     $this->add($menuId);
 }
 /**
  * Shows the dashboard view
  */
 public function indexAction()
 {
     $this->view->menu = Menus::findFirst(array('conditions' => 'id = ?1', 'order' => 'name', 'bind' => array(1 => 1)));
     $this->view->devices = Devices::find(array('order' => 'name ASC'));
     $this->view->movies = KodiMovies::getLatestMovies();
     $this->view->albums = KodiMusic::getLatestAlbums();
     $this->view->episodes = KodiTVShowEpisodes::getLatestEpisodes();
     $this->executionTime = -microtime(true);
     $this->view->phpsysinfoData = PHPSysInfo::getData($this->config);
     $this->view->PHPSysinfoExecutionTime = round($this->executionTime + microtime(true), 2) . 's';
 }
 public function initialize($menuitems)
 {
     $this->_action = 'menu';
     foreach ($menuitems as $menuItem) {
         $name = new Text('menuitem[' . $menuItem->id . '][name]');
         $name->setFilters(array('striptags', 'string'));
         $name->setAttributes(array('class' => 'form-control'));
         $name->setDefault($menuItem->name);
         $url = new Text('menuitem[' . $menuItem->id . '][url]');
         $url->setFilters(array('striptags', 'string'));
         $url->setAttributes(array('class' => 'form-control'));
         $url->setDefault($menuItem->url);
         $icon = new Text('menuitem[' . $menuItem->id . '][icon]');
         $icon->setFilters(array('striptags', 'string'));
         $icon->setAttributes(array('class' => 'form-control'));
         $icon->setDefault($menuItem->icon);
         $device = new Select('menuitem[' . $menuItem->id . '][device]', Devices::find(), array('using' => array('id', 'name'), 'useEmpty' => true, 'emptyText' => 'None', 'emptyValue' => 0));
         $device->setDefault($menuItem->device_id);
         $id = new Hidden('menuitem[' . $menuItem->id . '][id]');
         $id->setDefault($menuItem->id);
         $this->add($name);
         $this->add($url);
         $this->add($icon);
         $this->add($device);
         $this->add($id);
     }
 }