phpDocumentor PHPShopCore
[ class tree: PHPShopCore ] [ all elements ]

Source for file photo.core.php

Documentation is available at photo.core.php

  1. <?php
  2. /**
  3.  * Обработчик фото галереи
  4.  * @author PHPShop Software
  5.  * @version 1.1
  6.  * @package PHPShopCore
  7.  */
  8. class PHPShopPhoto extends PHPShopCore {
  9.     /**
  10.      * @var Int  Кол-во фото в длину
  11.      */
  12.     var $ilim=4;
  13.  
  14.     /**
  15.      * Конструктор
  16.      */
  17.     function PHPShopPhoto({
  18.  
  19.         // Имя Бд
  20.         $this->objBase=$GLOBALS['SysValue']['base']['table_name23'];
  21.  
  22.         // Отладка
  23.         $this->debug=false;
  24.  
  25.         // Список экшенов
  26.         $this->action=array("nav"=>"CID");
  27.  
  28.         // Массив для обработки хлебных крошек
  29.         $this->navigationArray='CatalogPhoto';
  30.  
  31.         // БД для хлебных крошек
  32.         $this->navigationBase='base.table_name22';
  33.         parent::PHPShopCore();
  34.     }
  35.  
  36.     /**
  37.      * Экшен по умолчанию, заглушка
  38.      */
  39.     function index({
  40.  
  41.         // Подключаем шаблон ошибки
  42.         $this->parseTemplate($this->getValue('templates.error_page_forma'));
  43.     }
  44.  
  45.     /**
  46.      * Экшен выборки информации при наличии переменной навигации CID
  47.      */
  48.     function CID({
  49.  
  50.         // ID категории
  51.         $this->category=PHPShopSecurity::TotalClean($this->PHPShopNav->getId(),1);
  52.         $this->PHPShopPhotoCategory &new PHPShopPhotoCategory($this->category);
  53.         $this->category_name=$this->PHPShopPhotoCategory->getName();
  54.  
  55.         $PHPShopOrm &new PHPShopOrm($this->getValue('base.table_name22'));
  56.         $PHPShopOrm->debug=$this->debug;
  57.         $row=$PHPShopOrm->select(array('id,name'),array('parent_to'=>"=".$this->category,'enabled'=>"='1'"),false,array('limit'=>1));
  58.  
  59.         // Если фото
  60.         if(empty($row['id'])) {
  61.  
  62.             $this->ListPhoto();
  63.         }
  64.         // Если каталоги
  65.         else {
  66.  
  67.             $this->ListCategory();
  68.         }
  69.     }
  70.  
  71.  
  72.     /**
  73.      * Вывод списка фото
  74.      */
  75.     function ListPhoto({
  76.         $disp='';
  77.         $i=0;
  78.  
  79.         // Выборка данных
  80.         $this->dataArray=$this->PHPShopOrm->select(array('*'),array('category'=>'='.$this->category,'enabled'=>"='1'"),
  81.                 array('order'=>'num'),array('limit'=>100));
  82.         if(is_array($this->dataArray))
  83.             foreach($this->dataArray as $row{
  84.  
  85.                 $name_s=str_replace(".","s.",$row['name']);
  86.  
  87.                 if(is_file($_SERVER['DOCUMENT_ROOT'].$name_s))
  88.                     $realsize getimagesize($_SERVER['DOCUMENT_ROOT'].$name_s);
  89.  
  90.                 $disp.='<TD valign="top" align="center" style="width:90px;">
  91.  <a class="highslide" onclick="return hs.expand(this)" target="_blank" href="'.$row['name'].'">
  92.  <img width="'.$realsize[0].'" height="89" src="'.$name_s.'" border="0"></a><div class="highslide-caption">'.$row['info'].'</div>
  93. </TD>';
  94.                 if ($i<$this->ilim-1{
  95.                     $i++;
  96.                 else {
  97.                     $i=0;
  98.                     $disp.='</TR><TR>';
  99.                 }
  100.  
  101.  
  102.             }
  103.  
  104.         // Если есть описание каталога
  105.         if(!empty($this->LoadItems['CatalogPhoto'][$this->category]['content_enabled']))
  106.             $content=$this->PHPShopPhotoCategory->getContent();
  107.  
  108.         $d='<script type="text/javascript" src="/highslide/highslide-p.js"></script>
  109. <link rel="stylesheet" type="text/css" href="/highslide/highslide.css" />
  110.  
  111. <script type="text/javascript">
  112. hs.registerOverlay({
  113.   html: \'<div class="closebutton" onclick="return hs.close(this)" title="Закрыть"></div>\',
  114.   position: \'top right\',
  115.   fade: 2 // fading the semi-transparent overlay looks bad in IE
  116. });
  117.  
  118.  
  119. hs.graphicsDir = \'/highslide/graphics/\';
  120. hs.wrapperClassName = \'borderless\';
  121. </script>
  122. <p>'.$content.'<p>
  123. <table border="0" cellspacing="0" cellpadding="0" >
  124. <tr height="94">
  125. '.$disp.'
  126. </tr>
  127. </table>';
  128.  
  129.         $this->set('pageContent',$d);
  130.         $this->set('pageTitle',$this->category_name);
  131.  
  132.         // Мета
  133.         $this->title=$this->category_name." - ".$this->PHPShopSystem->getValue("name");
  134.  
  135.         // Навигация хлебные крошки
  136.         $this->navigation($row['parent_to'],$this->category_name);
  137.  
  138.         // Подключаем шаблон
  139.         $this->parseTemplate($this->getValue('templates.page_page_list'));
  140.  
  141.     }
  142.  
  143.     /**
  144.      * Вывод списка категорий фото
  145.      */
  146.     function ListCategory({
  147.  
  148.         // Выборка данных
  149.         $PHPShopOrm &new PHPShopOrm($this->getValue('base.table_name22'));
  150.         $PHPShopOrm->debug=$this->debug;
  151.         $dataArray=$PHPShopOrm->select(array('name','id'),array('parent_to'=>'='.$this->category),array('order'=>'num'),array('limit'=>100));
  152.         if(is_array($dataArray))
  153.             foreach($dataArray as $row{
  154.                 $dis.="<li><a href=\"/photo/CID_".$row['id'].".html\" title=\"".$row['name']."\">".$row['name']."</a></li>";
  155.             }
  156.  
  157.         $disp="<h1>".$this->category_name."</h1>";
  158.  
  159.         // Если есть описание каталога
  160.         if(!empty($this->LoadItems['CatalogPhoto'][$this->category]['content_enabled']))
  161.             $disp.=$this->PHPShopPhotoCategory->getContent();
  162.  
  163.         $disp.="<ul>$dis</ul>";
  164.  
  165.  
  166.         $this->set('pageContent',$disp);
  167.         $this->set('pageTitle',$this->category_name);
  168.  
  169.         // Мета
  170.         $this->title=$this->category_name." - ".$this->PHPShopSystem->getValue("name");
  171.  
  172.  
  173.         // Навигация хлебные крошки
  174.         $this->navigation($this->category,$this->category_name);
  175.  
  176.         // Подключаем шаблон
  177.         $this->parseTemplate($this->getValue('templates.page_page_list'));
  178.     }
  179.  
  180. }
  181.  
  182. /**
  183.  * Фото галерея
  184.  * Упрощенный доступ к категориями фото галереи
  185.  * @author PHPShop Software
  186.  * @version 1.0
  187.  * @package PHPShopObj
  188.  */
  189. class PHPShopPhotoCategory extends PHPShopObj {
  190.  
  191.     /**
  192.      * Конструктор
  193.      * @param int $objID ИД категории
  194.      */
  195.     function PHPShopPhotoCategory($objID{
  196.         $this->objID=$objID;
  197.         $this->objBase=$GLOBALS['SysValue']['base']['table_name22'];
  198.         parent::PHPShopObj();
  199.     }
  200.  
  201.     /**
  202.      * Выдача имени категории
  203.      * @return string
  204.      */
  205.     function getName({
  206.         return parent::getParam("name");
  207.     }
  208.  
  209.     /**
  210.      * Выдача описания категории
  211.      * @return string
  212.      */
  213.     function getContent({
  214.         return parent::getParam("content");
  215.     }
  216. }
  217. ?>

Documentation generated on Thu, 17 Feb 2011 15:58:46 +0300 by phpDocumentor 1.4.3