public function edit()
 {
     if (!isset($this->request->get['id'])) {
         throw new BaseException(t('error_empty_values_passed'));
     }
     $id = (int) $this->request->get['id'];
     $this->load->model('album');
     $album = $this->album_model->read($id);
     $data = array();
     $data['content'] = $this->load->view('album/pictures', array('result' => $album['pictures']));
     $data['sidebar_right'] = H::saveButton(DIR_SITE . $this->site . '/database.db') . $this->load->view('album/album', array('result' => $album['data']));
     $data['form_url'] = '?route=album/save';
     $data['meta_title'] = t('module_' . $this->name);
     $data['breadcrumbs'] = H::breadcrumb(array(array('url' => '?route=' . $this->name, 'title' => t('module_' . $this->name)), array('title' => t('editing'))));
     $this->response->data = $data;
     $this->response->style[] = '/system/module/album/assets/album.css';
     $this->response->script[] = '/system/module/album/assets/album.js';
 }
 public function index()
 {
     $this->addContextMenu('columns', t('count_of_columns'));
     $this->addToContextMenu('columns', array('title' => '1', 'link' => '?route=dashboard/columns&q=1'));
     $this->addToContextMenu('columns', array('title' => '2', 'link' => '?route=dashboard/columns&q=2'));
     $this->addToContextMenu('columns', array('title' => '3', 'link' => '?route=dashboard/columns&q=3'));
     $this->addToContextMenu('columns', array('title' => '4', 'link' => '?route=dashboard/columns&q=4'));
     $widgets = $this->config->get('widgets');
     $exists = str_replace(array(DIR_SYS . 'widget/', '.php'), '', glob(DIR_SYS . 'widget/' . '*.php'));
     $used = array();
     foreach ($widgets as $i => $column) {
         foreach ($column as $j => $widget) {
             if (in_array($widget, $exists)) {
                 $widgets[$i][$j] = $this->loadWidget($widget);
                 $used[] = $widget;
             } else {
                 unset($widgets[$i][$j]);
             }
         }
     }
     if (isset($used)) {
         $unused = array_diff($exists, $used);
         if (!empty($unused)) {
             $unused = $this->getWidgetNames($unused);
         }
     } else {
         $unused = $this->getWidgetNames($exists);
     }
     if (!empty($unused)) {
         $this->addContextMenu('widgets', t('add_widget'));
         foreach ($unused as $widget => $name) {
             $this->addToContextMenu('widgets', array('title' => $name, 'link' => '?route=dashboard/add&widget=' . $widget));
         }
     }
     $data = array();
     $data['content'] = $this->load->view('dashboard/dashboard', array('col_sm' => 12 / count($widgets), 'columns' => $widgets));
     if (count($widgets) < 3) {
         $data['sidebar_left'] = $data['sidebar_right'] = ' ';
     }
     $data['meta_title'] = t('module_dashboard');
     $crumbs = array(array('title' => t('module_dashboard')));
     $data['breadcrumbs'] = H::breadcrumb($crumbs);
     $this->response->data = $data;
 }