<?php
if (!defined('_VALID_MOS') && !defined('_JEXEC')) die('Direct Access to ' . basename(__FILE__)
    . ' is not allowed.');

/**
 *
 * @package  MediaLibrary
 * @copyright 2021 Andrey Kvasnevskiy-OrdaSoft(akbet@mail.ru); Rob de Cleen(rob@decleen.com);
 * Homepage: https://ordasoft.com
 * @version: 4.6 Free
 * @license GNU General Public license version 2 or later; see LICENSE.txt
 *
 */

if(isset($cat_name) && $cat_name!=""){
    $category_url_part = "task=".$cat_name;
} else{
    $category_url_part = "task=all_authors";
}
global $doc, $hide_js, $database, $mainframe, $Itemid, $medialibrary_configuration, $mosConfig_live_site,
   $mosConfig_absolute_path, $my, $option;
global $limit, $total, $limitstart, $paginations;
$show_author_photo = $GLOBALS['author_photo_show'];
$doc->addStyleSheet($mosConfig_live_site . '/components/com_medialibrary/includes/medialibrary.css');
$doc->addStyleSheet($mosConfig_live_site . '/components/com_medialibrary/includes/custom.css');
?>

<noscript>
    Javascript is required to use MediaLibrary 
    <a href="https://ordasoft.com/media-library-joomla-extension">
        Media Library - Manager Software for create library manager website .
    </a>,
    <a href="https://ordasoft.com/media-library-joomla-extension">
        MediaLibrary this is media portal software for create media website for rent, sell medias
    </a>
</noscript>


<div id="medialibrary">

<style type="text/css">
   .catname{width: <?php echo $medialibrary_configuration['foto']['width_author']; ?>px;}
   .okno_autors img{width:<?php echo $medialibrary_configuration['foto']['width_author']; ?>px;
   height: <?php echo $medialibrary_configuration['foto']['high_author']; ?>px;}
</style>

  <div class="ml-row media-tools-container ">

      <form id="orderForm" action="<?php echo sefRelToAbs("index.php"); ?>" method="get" name="orderForm" class="select-type-autors ml-collumn-lg-12 ml-collumn-md-12 ml-collumn-sm-12 ml-collumn-xs-12">
          <?php  echo $typeshow_filter?>
          <input type="hidden" name="option" value="com_medialibrary" />
          <input type="hidden" name="view" value="all_authors" />
          <input type="hidden" name="Itemid" value="<?php echo $Itemid;?>" />
          <input type="hidden" name="boxchecked" value="0" />
      </form>


      <?php if (!$params->get('printItem')) {// don't show buttons on print
      ?>

            <div class="button-output-information ml-collumn-lg-12 ml-collumn-md-12 ml-collumn-sm-12 ml-collumn-xs-12">

            <?php
            if($currentcat->img != null && $currentcat->align == 'left' && $params->get( 'show_cat_pic') ){
            ?>
            <div>
              <img src="<?php echo $currentcat->img; ?>" align="<?php echo $currentcat->align; ?>" alt="?"/>
            </div>
        <?php
            }
             if($currentcat->descrip != ''){
            ?>
            <div>
              <?php echo $currentcat->descrip; ?>
            </div>
        <?php
        }
              if($currentcat->img != null && $currentcat->align == 'right'){
            ?>
            <div>
              <img src="<?php echo $currentcat->img; ?>" align="<?php echo $currentcat->align; ?>" alt="?" />
            </div>
        <?php
          }
        ?>



      </div>
      <?php
      }// don't show buttons on print
      ?>
    </div>

  

  <div id="gallery">
    <?php
    $total = count($all_authors);
    foreach($all_authors as $author) {
    $link = 'index.php?option=' . $option . '&amp;task=view_author&pid=' . $author->id
      . '&amp;Itemid=' . $Itemid;
    $imageURL = $author->imageURL;
    $k = true;
?>

  <div class="catname <?php if ($k == 3) {$k = 0; }
    $k++;
    echo 'myclass-' . "$k"; ?>" >
        <div class="cat2">
           <div class="authors">
           <a href="<?php echo sefRelToAbs($link); ?>" >
      <?php if (strlen($author->people_name) > 20)
              echo substr($author->people_name, 0, 20), '...';
            else {
              echo $author->people_name;
            } ?>
            </a>
       </div>
          </div>

   <div class="cont-photo">
      <div class="okno_autors">
      <a href="<?php echo sefRelToAbs($link);?>" >
   <?php
    if ($imageURL != '') {
        if ($imageURL != '' && substr($imageURL, 0, 4) != "http") {
            $imageURL = $mosConfig_live_site . '' . $imageURL;
        }
        echo '<img height="' . $medialibrary_configuration['foto']['high_author'] . '"
                  width="' . $medialibrary_configuration['foto']['width_author'] . '" src="'
                    . $imageURL . '" border="0">';
    } else {
        echo '<img  height="' . $medialibrary_configuration['foto']['high_author'] . '"
                    width="' . $medialibrary_configuration['foto']['width_author'] . '" src="' .
                    $mosConfig_live_site.'/components/com_medialibrary/images/' . _MEDIALIBRARY_NO_PICTURE_AUTHOR
                      . '" alt="no-img_author.png" border="0"  />';
    }
?>
           </a>
  </div>
      </div>
        </div>
            <?php
} ?>
           </div>

    <?php if (!$params->get('printItem')) {// don't show buttons on print  ?>


          <div class="pagination-custom pagination-custom_letter my_pagination my_pagination-small my_pagination-centered">
              <?php
              foreach($list_str as $a) {
              echo $a;
              }?>

          </div>


            <?php if ($pageNav !=null && $pageNav->total > $pageNav->limit ) { ?>

                <div id="ml-paginator-custom" class="pagination-custom">
                    <?php echo $pageNav->getPagesLinks( ); //for 1.6 ?>
                </div>

            <?php } ?>

<?php if ($params->get('back_button')!= ''): ?>
        <div style="text-align: center;" class="back_button">
          <?php mosHTML::BackButton ( $params, $hide_js ); ?>
        </div>
<?php endif ?>

  <?php }// don't show buttons on print ?>

</div>