Beispiel #1
0
 public function GenerateOutput()
 {
     global $langmessage;
     \gp\tool::ShowingGallery();
     echo '<h2>';
     echo \gp\tool\Output::ReturnText('galleries');
     echo '</h2>';
     $wrap = \gp\admin\Tools::CanEdit($this->page->gp_index);
     if ($wrap) {
         echo \gp\tool\Output::EditAreaLink($edit_index, 'Admin/Galleries', $langmessage['edit']);
         echo '<div class="editable_area cf" id="ExtraEditArea' . $edit_index . '">';
         // class="edit_area" added by javascript
     }
     $image_text = \gp\tool\Output::ReturnText('image');
     $images_text = \gp\tool\Output::ReturnText('images');
     $list = '';
     $shown = 0;
     foreach ($this->galleries as $title => $info) {
         //page is hidden
         if (!$this->GalleryVisible($title, $info)) {
             continue;
         }
         $count = '';
         if (is_array($info)) {
             $icon = $info['icon'];
             if ($info['count'] == 1) {
                 $count = $info['count'] . ' ' . \gp\tool\Output::ReturnText('image');
             } elseif ($info['count'] > 1) {
                 $count = $info['count'] . ' ' . \gp\tool\Output::ReturnText('images');
             }
         } else {
             $icon = $info;
         }
         if (empty($icon)) {
             continue;
         }
         $icon = rawurldecode($icon);
         //prevent double encoding
         if (strpos($icon, '/thumbnails/') === false) {
             $thumbPath = \gp\tool::GetDir('/data/_uploaded/image/thumbnails' . $icon . '.jpg');
         } else {
             $thumbPath = \gp\tool::GetDir('/data/_uploaded' . $icon);
         }
         $label = \gp\tool::GetLabel($title);
         $title_attr = ' title="' . \gp\tool::GetBrowserTitle($title) . '"';
         $label_img = ' <img src="' . $thumbPath . '" alt=""/>';
         $list .= '<li>' . \gp\tool::Link($title, $label_img, '', $title_attr) . '<div>' . \gp\tool::Link($title, $label, '', $title_attr) . '<p>' . $count . '</p>' . '</div>' . '</li>';
     }
     if (!empty($list)) {
         echo '<ul class="gp_gallery gp_galleries">';
         echo $list;
         echo '</ul>';
     }
     if ($wrap) {
         echo '</div>';
     }
     $this->PostSave();
 }
Beispiel #2
0
 /**
  * Return formatted content for the $section_data
  * @return string
  *
  */
 static function SectionToContent($section_data, $section_num)
 {
     $section_data = \gp\tool\Plugins::Filter('SectionToContent', array($section_data, $section_num));
     switch ($section_data['type']) {
         case 'text':
             return self::TextContent($section_data['content']);
         case 'include':
             return self::IncludeContent($section_data);
         case 'gallery':
             \gp\tool::ShowingGallery();
             return $section_data['content'];
     }
     return $section_data['content'];
 }
Beispiel #3
0
 /**
  * Display after commands have been executed
  *
  */
 public function DefaultDisplay()
 {
     //add to all pages in case a user adds a gallery
     \gp\tool\Plugins::Action('GenerateContent_Admin');
     \gp\tool::ShowingGallery();
     $sections_count = count($this->file_sections);
     $this->file_sections = array_values($this->file_sections);
     $section_num = 0;
     while ($section_num < $sections_count) {
         echo $this->GetSection($section_num);
     }
 }