public function display() { if (count($this->filterElements) > 0) { $this->views(); } print "<form id=\"" . $this->pageName . "-filter\" action=\"\" method=\"get\">"; $this->search_box($this->searchBox->getButtonText(), $this->searchBox->getInputName()); if (count($this->searchBox->getHiddenFields()) > 0) { $hf = $this->searchBox->getHiddenFields(); foreach ($hf as $hfs) { printf("<input type=\"hidden\" name=\"%s\" value=\"%s\" />", $hfs['name'], $hfs['value']); } } $this->prepare_items(); parent::display(); print "</form>"; }
public static function ThemeLayoutsMain() { wp_register_script('gf-theme-layout', PLUGIN_URL . 'js/themelayout.js'); wp_enqueue_script('gf-theme-layout'); $trans = array('not_empty' => GFontsLang::GetTranslation('Layout settings name could not be empty')); wp_localize_script('gf-theme-layout', 'objTrans', $trans); $table = new K8_UI_Table(); $action = $table->current_action(); $v = true; if ($action != false) { $v = self::ThemeLayoutsMainAction($action); } if (!$v) { return false; } $rowActions[] = array(__('Edit name', self::PLUGIN_SLUG), '?page=' . self::PLUGIN_THEME_LAYOUTS . '&action=edit', 'id'); $rowActions[] = array(__('Delete', self::PLUGIN_SLUG), '?page=' . self::PLUGIN_THEME_LAYOUTS . '&action=delete', 'id'); $rowActions[] = array(__('Set layout as active', self::PLUGIN_SLUG), '?page=' . self::PLUGIN_THEME_LAYOUTS . '&action=activate', 'id'); $rowActions2[] = array(__('Preview', self::PLUGIN_SLUG), get_home_url() . '?layoutpreview=1', 'id'); $table->setBaseUrl('admin.php')->setPageName(self::PLUGIN_THEME_LAYOUTS)->setFontSize(17)->addColumn(null, null, 'layout', true)->addColumn(__('Name', self::PLUGIN_SLUG), true, 'gtl_name', false, array('?page=' . self::PLUGIN_THEME_LAYOUTS . '&action=edit', 'id'), $rowActions)->addColumn(__('Theme', self::PLUGIN_SLUG), true, 'gtl_layout', false, array('?page=' . self::PLUGIN_THEME_LAYOUTS . '&action=edit', 'id'), $rowActions2, false, true); $searchBox = new K8_UI_Table_SearchBox(); $searchBox->setButtonText(__("Search layouts", self::PLUGIN_SLUG))->setInputName('layout_name')->addHiddenField('page', self::PLUGIN_THEME_LAYOUTS); $table->setSearchBox($searchBox); $table->addBulkAction('delete', __('Delete', self::PLUGIN_SLUG)); $table->addBulkAction('export', __('Export', self::PLUGIN_SLUG)); $ds = new GFontsThemeLayoutsDataSource(); if (isset($_GET['s'])) { $ds->setFilterField('gtl_name')->setFilterValue($_GET['s']); } if (isset($_GET['orderby'])) { $ds->setOrderBy($_GET['orderby'])->setOrderDirection($_GET['order']); } else { $ds->setOrderBy('gtl_name')->setOrderDirection('asc'); } $table->setDataSource($ds); print "<a class=\"button\" href=\"?page=" . self::PLUGIN_THEME_LAYOUTS . "&action=resetcurrentlayout\" onclick=\"return ResetCurrentLayoutSettings('" . __('Are you sure you want to reset current layout settings?', self::PLUGIN_SLUG) . "');\">" . __("Reset Current Power Posts Layout settings", self::PLUGIN_SLUG) . "</a> "; print "<form id=\"gf-lsave\" method=\"post\" action=\"?page=" . self::PLUGIN_THEME_LAYOUTS . "&action=savecurrent\" style=\"display: inline;\">"; print "<a class=\"button\" href=\"#\" onclick=\"return SaveCurrentLayoutSettings('" . __('Are you sure you want to save current layout settings?', self::PLUGIN_SLUG) . "' );\">" . __("Save current layout settings", self::PLUGIN_SLUG) . "</a> "; print "<input type=\"text\" name=\"gf_layout_name\" id=\"gf_layout_name\" value=\"\" /> <label for=\"gf_layout_name\">" . __('Layout settings name', self::PLUGIN_SLUG) . "</label>"; print "</form>"; print "<br/>"; $table->display(); }