/home/coolpkct/www/websites/cake3.cool.rocks/admin/commands/librarybrowseimages.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>');
 $sep = DIRECTORY_SEPARATOR;
 require_once "commands{$sep}command.php" ;
 require_once "classes{$sep}pagefactory.php";
 require_once "classes{$sep}screenfactory.php";
 require_once "classes{$sep}themeset.php";
 
/**
 * Command - browse images
 *
 * @package Showkase
 */
 class LibraryBrowseImages extends Command {
 
    /**
     * This is called by a setting in ckeditorconfig.js
     * The callback is passed in the request as CKEditorFuncNum
     */
    function doExecute( Request $request )
    {
        $config = SkConfig::getInstance();
        $pageRef = 'library';
        $pageType = 'library';
        $pagePath = $config->getRelativeLibraryPath().DIRECTORY_SEPARATOR;
        $pageFactory = new PageFactory(new ThemeSet());
        $page = $pageFactory->make($pageType, $pageRef, $pagePath);
        //$page->gallery->rebuild();
        $imageObjects = $page->gallery->getImageObjects();
        $context['imageCount'] = count($page->gallery->getImageObjects());
        $context['callback'] = $request->getProperty('CKEditorFuncNum');
        $screenFactory = new ScreenFactory();
        $screen = $screenFactory->makeImagesScreen('libraryBrowse', $page);
        print $screen->getHtml($context);
    }
}