/home/coolpkct/www/websites/cake3.cool.rocks/admin/classes/advancedscreen.php
<?php
 /**
 * Part of Showkase web site management package
 *
 * @package Showkase
 * @author Jack Hardie {@link http://www.jhardie.com}
 * @copyright Copyright (c) 2012, SimpleViewer Inc.
 */
defined('SK_ACCESS')||die('<h1>403: Forbidden</h1>');

/**
 * Sort screen
 *
 * @package Showkase
 */
class AdvancedScreen extends Screen
{
    /**
     * constructor
     * @param string gallery type
     */
    function __construct($pageType, $page)
    {
        parent::__construct('Showkase &ndash; advanced', 'advanced', 'pages advanced '.$pageType);
        $this->pageType = $pageType;
        $this->page = $page;
        $bbClass = ucfirst($page->getPluginType().'Buttonbar');
        $bb = new $bbClass();
        $this->subNavHtml = $bb->getHtml();
    }

    /**
     * get html for images screen
     * Note that some class names are significant for manager.js
     *
     * @access public
     * @return string html
     * @param string gallery reference number
     * @param array image data
     */
    public function getContentHtml($context)
    {
        $headerHtml = '
        <h2>'.htmlspecialchars($this->page->getNavName(), ENT_QUOTES, 'UTF-8').'</h2>
        <h3>'.$context['pageTypes'][$this->page->getPageType()]['name'].'</h3>';
        $rebuildGalleryPrompt =
            $this->page->isGallery()
            ? 'Scan the image directory and rebuild the gallery data.'
            : '';
        $html = '
      <div class="subhead">
        <div class="hgroup">
          '.$headerHtml.'
        </div>
        <ul class="buttons">
          <li><button type="button" onclick="window.location=\'index.php\';" class="btn btn-danger">Cancel</button></li>
        </ul>
      </div>
';
        if ($this->page->isGallery() && $this->page->isSupportedPageType()) {
            $html .= '     
      <table class="showkase-actions">
        <thead>
          <tr>
            <th colspan="2">Gallery repairs and updates</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td><a href="#" class="popper"  title="Rebuild" data-content="Rebuild the gallery settings and create new thumbnails." >Rebuild this '.$context['pageTypes'][$this->pageType]['shortName'].' gallery</a></td>
            <td class="commit"><a href="index.php?cmd=advanced&amp;rebuild=true&amp;token='.$context['token'].'">Rebuild</a></td>
          </tr>
        </tbody>
      </table>
';
        }
        $viewers = '';
        foreach ($context['pageTypes'] as $type=>$pageTypeData) {
            if ($type == 'link') continue;
            if ($type == $this->pageType) continue;
            if (isset($pageTypeData['exposed']) && strtolower($pageTypeData['exposed']) == 'false') continue;
            $isGallery =
              isset($context['pageTypes'][$type]['category'])
              && strtolower($context['pageTypes'][$type]['category']) == 'gallery';
            if ($isGallery !== $this->page->isGallery()) continue;
            $viewers .= '
          <tr>
           <td>'.$pageTypeData['name'].'</td>
           <td class="commit"><a href="index.php?cmd=advanced&amp;type='.$type.'&amp;token='.$context['token'].'">Change</a></td>
          </tr>
  ';
        }
        if ($viewers != '') {
            $html .= '
    <table class="showkase-actions">
      <thead>
        <tr>
          <th colspan="2">
            <a href="#" class="popper"  title="Change Page Type" data-content="Some settings may be lost when you change page types. Backup your web site first." >Change page type from '.$context['pageTypes'][$this->pageType]['name'].' to</a>
          </th>
        </tr>
      </thead>
      <tbody>
        '.$viewers.'
      </tbody>
    </table>';
        } else {
            $html .= '<p>No options available in this theme.</p>';
        }
        return $html;
    }
}