Your IP : 172.28.240.42


Current Path : /var/www/html/clients/kampol.e-nk.ru/OLD/components/com_easygallery/
Upload File :
Current File : /var/www/html/clients/kampol.e-nk.ru/OLD/components/com_easygallery/easygallery.html.php

<?php
defined( '_VALID_MOS' ) or die( 'Restricted access' );

class HTML_easygallery {

  /**
   * Show categorie, images and subcategories
   *
   * @param <var>mosCategory</var> $row
   * @param array $subcats
   * @param array $photos
   */
  function showCategory($row, $subcats, $photos, $params)
  {
    global $option, $mainframe, $eg_thumbnail_path, $tmpl, $eg_thumbnail_width, $Itemid;

    $mainframe->setPageTitle(sprintf(EG_SHOWCATEGORY, $row->name));
    $mainframe->addCustomHeadTag('<link href="'. $mainframe->getCfg('live_site') . '/components/com_easygallery/style.css" rel="stylesheet" type="text/css" />');
    ?>
    <div class="componentheading" style="border-bottom:1px solid #FFFFFF">
    <?php echo sprintf(EG_SHOWCATEGORY, $row->name); ?>
    </div>

    <?php
    echo $row->description;
    echo "<div style=\"line-height:27px;\"> <b>".$row->name."</b></div>";

    HTML_easygallery::fixPathway($row->id);

    //show subcategories
    if(count($subcats) > 0)
    {
      $tmpl->readTemplatesFromFile("subcats.tpl");

      $tmpl->displayParsedTemplate('cat-header');

      for($i=0,$n=count($subcats);$i<$n;$i++){
        $cat = $subcats[$i];

        $tmpl->clearTemplate('cat-sub');

        $tmpl->addVar('cat-sub', 'IMAGE_SRC', $mainframe->getCfg('live_site') . $eg_thumbnail_path . '/' . $cat->photo_path);
        $tmpl->addVar('cat-sub', 'IMAGE_TEXT', $cat->photo_name);
        $tmpl->addVar('cat-sub', 'CAT_NAME', $cat->name);
        $tmpl->addVar('cat-sub', 'CAT_DESCRIPTION', $cat->description);
        $tmpl->addVar('cat-sub', 'IMAGE_WIDTH', $eg_thumbnail_width + 5);
        $tmpl->addVar('cat-sub', 'VIEW_CAT_URL', sefRelToAbs('index.php?option=' . $option . '&amp;task=category&amp;cid=' . $cat->id . '&amp;Itemid=' . $Itemid));
        $tmpl->addVar('cat-sub', 'EG_VIEW_CATEGORY', EG_VIEW_CATEGORY);

        $tmpl->displayParsedTemplate('cat-sub');
      }
    }

    //show photo's
    if(count($photos) > 0)
    {

      $tmpl->readTemplatesFromFile("photos.tpl");
      for($i=0,$n=count($photos);$i<$n;$i++)
      {

        $photo = $photos[$i];
                // $pathToImage = $mainframe->getCfg('live_site') . $eg_thumbnail_path . '/' . $photo->path;
                 $pathToImage = getcwd() . $eg_thumbnail_path . '/' . $photo->path;

                 if (is_file($pathToImage))
                 {
        $tmpl->addVar('list-photo', 'IMAGE_SRC', $mainframe->getCfg('live_site') . $eg_thumbnail_path . '/' . $photo->path);
        $tmpl->addVar('list-photo', 'IMAGE_ALT', $photo->name);
        $tmpl->addVar('list-photo', 'VIEW_IMAGE_URL', sefRelToAbs('index.php?option=' . $option . '&amp;task=view&amp;cid=' . $photo->id . '&amp;Itemid=' . $Itemid));
        $dd = $mainframe->getCfg('live_site') . $eg_thumbnail_path . '/' . $photo->path;

        if($params->get('image_name'))
        {
        // $tmpl->addVar('list-photo', 'IMAGE_NAME', $photo->name);
        }
        $tmpl->parseTemplate('list-photo','a');
                 }

      }

      $tmpl->displayParsedTemplate('list-photos');


    }

  }

  /**
   * Show photo
   *
   * @param <var>dbPhoto</var> $row
   */
  function showPhoto($row, $params)
  {
    global $option, $eg_image_path, $tmpl, $mainframe, $eg_max_width, $eg_max_height;

    HTML_easygallery::fixPathway($row->cid, $row);

    $mainframe->setPageTitle(sprintf(EG_VIEW_PHOTO, $row->name));
    $mainframe->addCustomHeadTag('<link href="'. $mainframe->getCfg('live_site') . '/components/com_easygallery/style.css" rel="stylesheet" type="text/css" />');

    echo '<div class="componentheading">' . sprintf(EG_VIEW_PHOTO, $row->name) . '</div>';

    $tmpl->readTemplatesFromFile("photos.tpl");
    $tmpl->displayParsedTemplate('view-header');

    $tmpl->addVar('view-photo', 'IMAGE_SRC', $mainframe->getCfg('live_site') . $eg_image_path . '/' . $row->path);

    if($params->get('image_name'))
    {
    @$tmpl->addVar('view-photo', 'IMAGE_NAME', $photo->name);
    }
    $tmpl->addVar('view-photo', 'IMAGE_ALT', $row->name);
    if($params->get('image_desc')){
      $tmpl->addVar('view-photo', 'IMAGE_DESCRIPTION', $row->description);
    }
    $tmpl->addVar('view-photo', 'MAX_WIDTH', $eg_max_width);
    $tmpl->addVar('view-photo', 'MAX_HEIGHT', $eg_max_height);

    //language things..
    $tmpl->addVar('view-photo', 'EG_PHOTO_THIS', EG_PHOTO_THIS);
    $tmpl->addVar('view-photo', 'EG_PHOTO_PIXELS', EG_PHOTO_PIXELS);
    $tmpl->addVar('view-photo', 'EG_PHOTO_AND', EG_PHOTO_AND);
    $tmpl->addVar('view-photo', 'EG_PHOTO_LARGE', EG_PHOTO_LARGE);
    $tmpl->addVar('view-photo', 'EG_PHOTO_CLICK', EG_PHOTO_CLICK);
    $tmpl->addVar('view-photo', 'EG_PHOTO_HERE', EG_PHOTO_HERE);
    $tmpl->addVar('view-photo', 'EG_PHOTO_TO_VIEW', EG_PHOTO_TO_VIEW);
    $tmpl->displayParsedTemplate('view-photo');




    HTML_easygallery::printNavigation($row, $params);

    mosHTML::BackButton ( $params );
  }

  /**
   * Echo pathway
   *
   * @param int current categoryid
   */
  function fixPathway($cid, $photo = null){
    global $database, $mainframe, $Itemid, $option;

    $query = "SELECT * FROM #__categories WHERE section = 'com_easygallery' AND published = 1";
    $database->setQuery($query);
    $cats = $database->loadObjectList('id');
    echo $database->getErrorMsg();



   // if (isset($cid))
   /// {
    $cat = @$cats[$cid];
  //  }

    $pathway = array();
    while($cat->parent_id != 0)
    { //echo and move level up
      $cat = $cats[$cat->parent_id];
      $pathway[] = '<a href="' . sefRelToAbs('index.php?option=' . $option . '&amp;task=category&amp;cid=' . $cat->id . '&amp;Itemid=' . $Itemid) . '" class="pathway">' . $cat->name . '</a>';
    }



    $pathway = array_reverse($pathway);
    for($i=0,$n=count($pathway);$i<$n;$i++){
      $mainframe->appendPathWay($pathway[$i]);
    }
    if(!is_null($photo)){
      //photo view, echo linked category
      $mainframe->appendPathWay('<a href="' . sefRelToAbs('index.php?option=' . $option . '&amp;task=category&amp;cid=' . $cats[$cid]->id . '&amp;Itemid=' . $Itemid) . '" class="pathway">' . $cats[$cid]->name . '</a>');
     // $mainframe->appendPathWay($photo->name);
    } else {
      @$mainframe->appendPathWay($cats[$cid]->name);
    }
  }

  /**
   * print previous and next buttons
   *
   * @param <var>dbPhoto</var> $row
   * @param <var>mosParameters</var> $params
   */
  function printNavigation($row, $params){
    global $option, $Itemid;

    $link_part = 'index.php?option=' . $option . '&amp;task=view&amp;cid=';
    print "<div style=\"position:absolute;top:770px;left:215px;background-color:#6498CA;padding-left:10px;padding-right:10px;\">";
    if ( $row->prev ) {
                        $row->prev = sefRelToAbs( $link_part . $row->prev . '&amp;Itemid=' . $Itemid );
                } else {
                        $row->prev = 0;
                }
    if ($row->prev != "0")
    {
    print chr(171)." <a href=\"".$row->prev."#top\">ïðåäûäóùàÿ</a>";
    }
                if ( $row->next ) {
                        $row->next = sefRelToAbs( $link_part . $row->next . '&amp;Itemid=' . $Itemid );
                } else {
                        $row->next = 0;
                }
    if ($row->next != "0")
    {
    print " &nbsp; &nbsp; | &nbsp; &nbsp; <a href=\"".$row->next."#top\">ñëåäóþùàÿ</a> ".chr(187);
    }
    else
    {
    print " &nbsp; &nbsp; | &nbsp; &nbsp; <a href=\"http://kampol.e-nk.ru/index.php?option=com_easygallery&Itemid=72\">Âåðíóòüñÿ â ôîòîãàëåðåþ</a> ".chr(187);
    }

    print "</div>";

    /* on image: created by Faydix, www.faydix.com */
    print '<div style="position:absolute;left:225px;top:400px;">';
    if ($row->prev != "0")
    {
    print "<a href=\"".$row->prev."#top\"><img src=\"/prev.gif\" border=0 width=14 height=18 title=\"Ïðåäûäóùàÿ ôîòîãðàôèÿ\"></a>";
    }
    if ($row->next != "0")
    {
    print " &nbsp; &nbsp; <a href=\"".$row->next."#top\"><img src=\"/next.gif\" border=0 width=14 height=18 title=\"Ñëåäóþùàÿ ôîòîãðàôèÿ\"></a>";
    }
    print '</div>';

                if ( $params->get( 'item_navigation' ) && ( $row->prev || $row->next ) ) {
                        ?>
                        <table align="center" style="margin-top: 25px;">
                        <tr>
                                <?php
                                if ( $row->prev ) {
                                        ?>
                                        <th class="pagenav_prev">
                                                <a href="<?php echo $row->prev; ?>">
                                                        <?php echo _ITEM_PREVIOUS; ?></a>
                                        </th>
                                        <?php
                                }

                                if ( $row->prev && $row->next ) {
                                        ?>
                                        <td width="50">&nbsp;

                                        </td>
                                        <?php
                                }

                                if ( $row->next ) {
                                        ?>
                                        <th class="pagenav_next">
                                                <a href="<?php echo $row->next; ?>">
                                                        <?php echo _ITEM_NEXT; ?></a>
                                        </th>
                                        <?php
                                }
                                ?>
                        </tr>
                        </table>
                        <?php
                }
  }

  /**
   * Show copyright notices
   */
  function showCopyright(){
    global $mainframe;

    /**
     * Visible copyright notices, you can remove it if you like
     * I would appreciate it very much if you could leave this present,
     * this is something your users will never see
     */
    $mainframe->addMetaTag('Generator', '');
  }
}