Exemplo n.º 1
0
 public function SearchDisplay()
 {
     global $langmessage, $gpLayouts, $gp_index, $gp_menu;
     $this->inherit_info = \gp\admin\Menu\Tools::Inheritance_Info();
     switch ($this->curr_menu_id) {
         case 'search':
             $show_list = $this->GetSearchList();
             break;
         case 'hidden':
             $show_list = \gp\admin\Menu\Tools::GetAvailable();
             break;
         case 'nomenus':
             $show_list = $this->GetNoMenus();
             break;
         default:
             $show_list = array_keys($gp_index);
             break;
     }
     $show_list = array_values($show_list);
     //to reset the keys
     $show_list = array_reverse($show_list);
     //show newest first
     $max = count($show_list);
     while ($this->search_page * $this->search_max_per_page > $max) {
         $this->search_page--;
     }
     $start = $this->search_page * $this->search_max_per_page;
     $stop = min(($this->search_page + 1) * $this->search_max_per_page, $max);
     ob_start();
     echo '<div class="gp_search_links">';
     echo '<span class="showing">';
     echo sprintf($langmessage['SHOWING'], $start + 1, $stop, $max);
     echo '</span>';
     echo '<span>';
     if ($start !== 0 || $stop < $max) {
         for ($i = 0; $i * $this->search_max_per_page < $max; $i++) {
             $class = '';
             if ($i == $this->search_page) {
                 $class = ' class="current"';
             }
             echo $this->Link('Admin/Menu', $i + 1, 'page=' . $i, 'data-cmd="gpajax"' . $class);
         }
     }
     echo $this->Link('Admin/Menu/Ajax', $langmessage['create_new_file'], 'cmd=AddHidden', array('title' => $langmessage['create_new_file'], 'data-cmd' => 'gpabox'));
     echo '</span>';
     echo '</div>';
     $links = ob_get_clean();
     echo $links;
     echo '<table class="bordered striped">';
     echo '<thead>';
     echo '<tr><th>';
     echo $langmessage['file_name'];
     echo '</th><th>';
     echo $langmessage['Content Type'];
     echo '</th><th>';
     echo $langmessage['Child Pages'];
     echo '</th><th>';
     echo $langmessage['File Size'];
     echo '</th><th>';
     echo $langmessage['Modified'];
     echo '</th></tr>';
     echo '</thead>';
     echo '<tbody>';
     if (count($show_list) > 0) {
         for ($i = $start; $i < $stop; $i++) {
             $title = $show_list[$i];
             $this->SearchDisplayRow($title);
         }
     }
     echo '</tbody>';
     echo '</table>';
     if (count($show_list) == 0) {
         echo '<p>';
         echo $langmessage['Empty'];
         echo '</p>';
     }
     echo '<br/>';
     echo $links;
 }
Exemplo n.º 2
0
 /**
  * Display current layout, list of available layouts and list of titles affected by the layout setting for $title
  *
  */
 public function SelectLayout($url, $query_string)
 {
     global $gp_titles, $gpLayouts, $langmessage, $config, $gp_index;
     $index = $_REQUEST['index'];
     $title = \gp\tool::IndexToTitle($index);
     if (!$title) {
         echo $langmessage['OOPS'];
         return;
     }
     $this->title = $title;
     $Inherit_Info = \gp\admin\Menu\Tools::Inheritance_Info();
     $curr_layout = \gp\admin\Menu\Tools::CurrentLayout($index);
     $curr_info = $gpLayouts[$curr_layout];
     echo '<div class="inline_box">';
     echo '<h3>';
     echo $langmessage['current_layout'] . ': &nbsp; ';
     echo '<span class="layout_color_id" style="background-color:' . $curr_info['color'] . ';" title="' . $curr_info['color'] . '"></span> &nbsp; ';
     echo str_replace('_', ' ', $curr_info['label']);
     echo '</h3>';
     if (!empty($gp_titles[$index]['gpLayout'])) {
         echo '<p>';
         if (isset($Inherit_Info[$index]['parent_layout'])) {
             $parent_layout = $Inherit_Info[$index]['parent_layout'];
         } else {
             $parent_layout = $config['gpLayout'];
         }
         $parent_info = $gpLayouts[$parent_layout];
         echo $langmessage['restore'] . ': ';
         $span = '<span class="layout_color_id" style="background-color:' . $parent_info['color'] . ';" title="' . $parent_info['color'] . '"></span> ';
         echo \gp\tool::Link($url, $span . $parent_info['label'], $query_string . 'cmd=restorelayout&index=' . urlencode($index), array('data-cmd' => 'postlink', 'title' => $langmessage['restore']), 'restore');
         echo '</p>';
     }
     echo '<table class="bordered full_width">';
     echo '<tr><th>';
     echo $langmessage['available_layouts'];
     echo '</th><th>';
     echo $langmessage['theme'];
     echo '</th></tr>';
     if (count($gpLayouts) < 2) {
         echo '<tr><td colspan="2">';
         echo $langmessage['Empty'];
         echo '</td></tr>';
         echo '</table>';
         echo \gp\tool::Link('Admin_Theme_Content', $langmessage['new_layout']);
         echo '</div>';
         return;
     }
     foreach ($gpLayouts as $layout => $info) {
         if ($layout == $curr_layout) {
             continue;
         }
         echo '<tr><td>';
         echo '<span class="layout_color_id" style="background-color:' . $info['color'] . ';" title="' . $info['color'] . '">';
         echo '</span> ';
         if ($layout != $curr_layout) {
             echo \gp\tool::Link($url, $info['label'], $query_string . 'cmd=uselayout&index=' . urlencode($index) . '&layout=' . urlencode($layout), array('data-cmd' => 'postlink'), 'use_' . $layout);
         }
         echo '</td><td>';
         echo $info['theme'];
         echo '</td></tr>';
     }
     echo '</table>';
     //show affected pages
     $affected = self::GetAffectedFiles($index);
     echo '<br/>';
     echo '<table class="bordered full_width">';
     echo '<tr><th>' . $langmessage['affected_files'] . '</th></tr></table>';
     echo '<p class="sm">' . $langmessage['about_layout_change'] . '</p>';
     echo '<p class="admin_note" style="width:35em">';
     $label = \gp\tool::GetLabelIndex($index, false);
     echo \gp\tool::LabelSpecialChars($label);
     $i = 0;
     foreach ($affected as $affected_label) {
         $i++;
         echo ', ' . $affected_label;
     }
     echo '</p>';
     echo '<p>';
     echo ' <input type="submit" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" /> ';
     echo '</p>';
     echo '<p class="admin_note">';
     echo '<b>' . $langmessage['see_also'] . '</b> ';
     echo \gp\tool::Link('Admin_Theme_Content', $langmessage['layouts']);
     echo '</p>';
     echo '</div>';
 }