function get_display() { $i = 0; foreach ($this->options as $k => $val) { if (!isset($this->option_info[$k])) { trigger_error('Please set option_info for each option!'); continue; } // build our checkbox //$store_key[$key] = "ture"; $val = $this->option_info[$k]['values']; $id = $this->option_info[$k]['id']; $checkbox = '<input type="checkbox" id="' . $this->name . $i . '" name="' . $this->name . '[]" value="' . htmlspecialchars($k, ENT_QUOTES) . '"'; if (in_array($k, $this->value)) { $checkbox .= ' checked="checked"'; } //if ( $this->_is_current_value($k) ) $checkbox .= ' checked="checked"'; //if ( $this->_is_disabled_option($k) ) $checkbox .= ' disabled="disabled"'; $checkbox .= ' /> ' . $id; $e = new entity($id); $checkbox .= '<p class="name">Name: ' . $e->get_value('name') . '</p>'; $owner = get_owner_site_id($id); if ($owner) { $site = new entity($owner); $checkbox .= '<p class="site">Site: ' . $site->get_value('name') . '</p>'; } else { $checkbox .= '<p class="site">(No owner site)</p>'; } $data[] = array('Find and Replace?' => $checkbox) + $val; $i++; } // data now contains the raw data needed for our table admin work; $entity_convert_fields = array_keys(reset($this->option_info)); $ta = new TableAdmin(); $ta->init_from_array($data); $ta->set_fields_that_allow_sorting(array()); $ta->set_fields_to_entity_convert(array()); // we are using html in our fields ob_start(); $ta->run(); $str = ob_get_contents(); ob_end_clean(); return $str; }
$data_pages[$page_type_no_page]['page_type'] = $page_type_no_page; $pt = @$rpt->get_page_type($page_type_no_page); $data_pages[$page_type_no_page]['location'] = is_object($pt) ? $pt->get_location() : ""; $data_pages[$page_type_no_page]['url'] = ''; $data_pages[$page_type_no_page]['count'] = 0; } // let's sort our data set $sort_field = isset($_GET['table_sort_field']) && check_against_array($_GET['table_sort_field'], array('page_type', 'count', 'url', 'location')) ? $_GET['table_sort_field'] : 'count'; $sort_order = isset($_GET['table_sort_order']) && check_against_array($_GET['table_sort_order'], array('desc', 'asc')) ? $_GET['table_sort_order'] : 'desc'; // do our manual sorting $sort_func = "_sort_" . $sort_field . "_" . $sort_order; uasort($data_pages, $sort_func); $table_admin = new TableAdmin(); $table_admin->set_show_actions_first_cell(false); $table_admin->set_fields_to_entity_convert(array('count', 'page_type', 'location')); $table_admin->init_from_array($data_pages, true); $table_admin->run(); echo '</body>'; echo '</html>'; function _sort_count_desc($a, $b) { if ($a['count'] == $b['count']) { return 0; } return $a['count'] > $b['count'] ? -1 : 1; } function _sort_count_asc($a, $b) { if ($a['count'] == $b['count']) { return 0; }