<?php
defined('_JEXEC') or die;

/**
 *
 * @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 ($authors->published == 0) JError::raiseError(404, _MEDIALIBRARY_RESULT_NOT_FOUND);
global $doc, $hide_js, $database, $mainframe, $Itemid, $medialibrary_configuration,
  $mosConfig_live_site, $mosConfig_absolute_path, $my, $option;
if ($option == 'com_simplemembership') showTabs_b();
$doc->addStyleSheet($mosConfig_live_site . '/components/com_medialibrary/includes/medialibrary.css');
JPluginHelper::importPlugin('content');
$dispatcher = JDispatcher::getInstance();
?>

<noscript>
    Javascript is required to use MediaLibrary 
    <a href="https://ordasoft.com/media-library-joomla-extension">
        Media Library Software for create virtual library.
    </a>,
    <a href="https://ordasoft.com/media-library-joomla-extension">
        MediaLibrary this is software for create media store website for rent, sell audio, video, game and other digital product 
    </a>
</noscript>


<div id="medialibrary">

<div class="componentheading<?php echo $params->get('pageclass_sfx'); ?>">
<?php //echo $currentcat->header;
 ?>
</div>
  <?php
  if(isset($cat_name) && $cat_name!=""){
    $category_url_part = "task=".$cat_name;
} else{
    $category_url_part = "task=view_author";
}

  if (!$params->get('printItem')) {// don't show buttons on print
  ?>
   <div class="button-output-information">

        <?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
        }
        ?>
        <?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 ?>


     
<?php
// for 1.6
$cat_link_arr = array();
?>
    <?php positions_ml($params->get('view01')); ?>

<?php positions_ml($params->get('view02')); ?>

   <?php positions_ml($params->get('view03')); ?>



<table width="100%" border="0" align="center" class="contentpane<?php
  echo $params->get('pageclass_sfx'); ?> actor_info">

    <tr>
        <td>
            <?php
//for local images

$imageURL = $authors->imageURL;
if ($imageURL != '' && substr($imageURL, 0, 4) != "http") {
    $imageURL = JURI::root() . '' . $imageURL;
}

if ($imageURL != '') {
    echo '<img class="bl_view_book_book_image" src="';
    echo $imageURL . '" alt="' . $authors->people_name . '" border="0"
                    height="' . $medialibrary_configuration['foto']['high_author'] . '" width="'
                    . $medialibrary_configuration['foto']['width_author']. '"/>';
} else {
    echo '<img class="bl_view_book_book_image" src="';
    echo  $mosConfig_live_site . '/components/com_medialibrary/images/' .
          _MEDIALIBRARY_NO_PICTURE_AUTHOR . '" alt="no-img_author.png" border="0" height="'
          . $medialibrary_configuration['foto']['high_author'] . '" width="'
          . $medialibrary_configuration['foto']['width_author'] . '"/>';
}
?>
        </td>
    </tr>
       <?php if ($authors->people_name != '') { ?>
        <tr>
            <td><span class="view_author_name">
            <?php echo $authors->people_name; ?></span></td>
        </tr>
<?php
} 

if ($author_description != '' && $books_titles != '') {?>
        <tr>
            <td>
            <div class="author_description">
                <?php
    JPluginHelper::importPlugin('content');
    $dispatcher = JDispatcher::getInstance();
    positions_ml($params->get('viewdescription'));
    $err_state = ini_get('display_errors');
    ini_set('display_errors', 'Off');
    $idesc = $author_description; //load the desc into a variable
    $plug_row->text = $idesc; // load the var into plugin_row object
    $results = $dispatcher->trigger('onPrepareContent', array(&$plug_row, &$plug_params), true);
      //run mambot onPrepareContent on plug_row object
    $idesc = $plug_row->text; //get new content from plug_row object to value
    echo $idesc; //echo new content out
    ini_set('display_errors', $err_state);
?>
</div>
            </td>
        </tr>

    <?php
} else { ?>
         <tr>
           <td>
          <?php
    foreach($rows as $row2) {
        $link1 = "index.php?option=com_medialibrary&amp;task=view&amp;id=" . $row2->id . "&amp;catid="
          . $row2->catid . "&amp;Itemid=" . $Itemid;
           //print_r($link1);exit;
?>
               <a href="<?php echo sefRelToAbs($link1); ?>" target="_self"><?php echo $row2->title;
                ?></a><br/>
                  <?php
    } ?>
           </td>
         </tr>
<?php
}
?>
</table>


    <?php positions_ml($params->get('view04')); ?>

            <?php


    positions_ml($params->get('view05'));
?>
</div>
