protected function view_table() { $form = new ctr_form('name'); $table = new ctr_table(); $row = new ctr_row(); $text = new ctr_textbox(); $button = new ctr_button(); $row->add($text, 6); $row->add($button, 6); $db = new cls_database(); $db->do_query('select * from users'); $table->add_source($db->get_array()); $form->add($table); return array('tittle', $form->draw()); }
protected function view_themes($themes, $themes_info, $active_theme) { $form = new ctr_form("core_manage_themes"); $tab = new ctr_tabbar(); $table = new ctr_table(); foreach ($themes as $key => $theme) { $row = new ctr_row(); //add id to table for count rows $lbl_id = new ctr_label($key + 1); $row->add($lbl_id, 1, 1); //add theme name $lbl_theme_name = new ctr_label($themes_info[$key]['name']); $row->add($lbl_theme_name, 2); //add author of theme $lbl_author = new ctr_label($themes_info[$key]['author']); $row->add($lbl_author, 2); //add active theme button if ($theme != $active_theme) { $btn_active = new ctr_button(); $btn_active->configure('LABEL', _('Active this')); $btn_active->configure('TYPE', 'success'); $btn_active->configure('P_ONCLICK_PLUGIN', 'core'); $btn_active->configure('P_ONCLICK_FUNCTION', 'btn_change_theme'); $row->add($btn_active, 1); } $table->add_row($row); } //add headers to table $table->configure('HEADERS', array(_('ID'), _('Name'), _('Author'), _('Options'))); $table->configure('HEADERS_WIDTH', array(1, 2, 3, 4)); $form->add($table); $tab->add($form); return array(_('Appearance'), $tab->draw()); //Assign variables $this->raintpl->assign("label_themes", _('Themes')); $this->raintpl->assign("label_disable", _('Disable')); $this->raintpl->assign("label_enable", _('Enable')); $this->raintpl->assign("label_install", _('Install new theme')); $this->raintpl->assign("label_name", _('Name')); $this->raintpl->assign("label_screen", _('Splash screen')); $this->raintpl->assign("label_author", _('Author')); $this->raintpl->assign("label_options", _('Options')); $this->raintpl->assign("active_theme", $active_theme); $this->raintpl->assign("themes", $themes_info); $this->raintpl->assign("theme_count", max(array_keys($themes_info))); //draw and return back content //return array(_('Themes'),$this->raintpl->draw('core_appearance', true ) ); }