public function widgets() { $this->check_authority(); $this->load->model('mwidget'); $this->load->model('msettings'); $gen_settings = $this->msettings->get_set_gen(); $wid_areas = get_layout_wid_areas($gen_settings[0]->theme); if (isset($_GET['area'])) { $area = $_GET['area']; if (in_array_r($area, $wid_areas, FALSE)) { $data['links'] = $this->get_dash_nav(); $data['wid_list'] = $this->mwidget->get_widget_list(); $data['wid_areas'] = $wid_areas; $data['wid_area_wids'] = get_widgets($area); $title = "Manage Widgets"; $page = 'dashboard/widgets/widgets'; $this->page_build($title, 'dashboard', $page, $data); } else { //Error 401 - Invalid/missing data $url = current_url() . '?area=' . $wid_areas[0]['id'] . '&msgcode=401'; redirect($url, 'refresh'); } } else { $url = current_url() . '?area=' . $wid_areas[0]['id']; redirect($url, 'refresh'); } }
public function add() { $this->check_authority(); if (isset($_POST['wid_id']) and isset($_POST['parent'])) { $wid_id = $_POST['wid_id']; $area = $_POST['parent']; $this->load->model('mwidget'); $this->load->model('msettings'); $gen_settings = $this->msettings->get_set_gen(); $wid_areas = get_layout_wid_areas($gen_settings[0]->theme); $area_wids = get_widgets($area); $wid_list = $this->mwidget->get_widget_list(); if (null != $this->mwidget->get_widget_list($wid_id) and in_array_r($area, $wid_areas)) { $wid_info = $this->mwidget->get_widget_list($wid_id); $title = $wid_info[0]->desc; $xtbl = $wid_info[0]->child_tbl; $pos = count($area_wids) + 1; $add = $this->mwidget->add_widget($wid_id, $title, $area, $pos, $xtbl); if (true == $add) { $data['wid_list'] = $this->mwidget->get_widget_list(); $data['wid_area_wids'] = get_widgets($area); $this->load->view($this->wid_dir . 'widgets_list', $data); } } } }