Esempio n. 1
0
 function run()
 {
     $site_pages = $this->_get_site_page_data();
     if ($site_pages) {
         $ta = new TableAdmin();
         $ta->init_view_no_db(array('page_url' => 'URL', 'created_by' => 'Created By Username', 'author' => 'Author', 'last_edited_by' => 'Last Edited Username', 'last_modified' => 'Last Modified'), true);
         $ta->set_data_from_array($site_pages);
         $ta->set_show_actions_first_cell(false);
         $ta->set_show_actions_last_cell(false);
         $ta->set_fields_that_allow_sorting(array('last_modified'));
         $ta->set_fields_to_entity_convert(array('created_by', 'author', 'last_edited_by', 'last_modified'));
         $ta->run();
     } elseif (!$this->_get_validated_site_id()) {
         echo '<p>You can only use this module in the context of a Reason site to which you have proper access privileges.</p>';
     } else {
         echo '<p>The site does not have any valid pages.</p>';
     }
 }
 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;
 }