Ejemplo n.º 1
0
 *
 * @PlayJoom Component
 * @copyright Copyright (C) 2010-2011 by www.teglo.info
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @date $Date: 2013-09-10 19:13:25 +0200 (Di, 10 Sep 2013) $
 * @revision $Revision: 842 $
 * @author $Author: toto $
 * @headurl $HeadURL: http://dev.teglo.info/svn/playjoom/components/com_playjoom/views/album/tmpl/default_cover.php $
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
$item = (object) array('artist' => base64_decode(JRequest::getVar('artist')), 'album' => base64_decode(JRequest::getVar('album')));
$SamplerCheck = PlayJoomHelper::checkForSampler($item->album, $item->artist);
//Get Album cover
if ($this->params->get(JRequest::getVar('view') . '_show_cover', 1) == 1) {
    $cover = new PlayJoomHelperCover();
    $coverthumb = $cover->getCoverHTMLTag($item, $SamplerCheck, $this->params);
}
echo '<div class="cover-row">';
//Output cover image
echo '<div class="coverimg">';
echo $coverthumb;
echo '</div>';
$length_counter = null;
$size_counter = null;
foreach ($this->items as $i => $item) {
    //Couters for the total line
    $length_counter = $length_counter + $item->length;
    $size_counter = $size_counter + $item->filesize;
    //calculate the average values
    if (isset($i) && $i >= 3) {
Ejemplo n.º 2
0
                $GenreChecker = PlayJoomHelper::getInfoButton('genre', $AboutInfo, $modal_genre_config, $this->params);
            } else {
                $GenreChecker = null;
            }
            $counter = $counter + 1;
            echo '<fieldset class="batch">';
            echo '<legend><a href="' . $artistlink . '" title="Continue to the artist view" class="ArtistLink">' . $item->artist . '</a>' . $ArtistChecker . '&nbsp;|&nbsp;<a href="' . $genrelink . '" class="GenreLink" title="Continue to the genre view">' . $item->category_title . '</a>' . $GenreChecker . '</legend>';
            echo '<ul class="ListOfAlbums">';
            foreach ($album_list as $j => $albenitem) {
                $cover_counter = $cover_counter + 1;
                $albumsting = base64_encode($albenitem->album);
                $artiststing = base64_encode($albenitem->artist);
                $albumlink = 'index.php?option=com_playjoom&view=album&album=' . $albumsting . '&artist=' . $artiststing . '&Itemid=' . JRequest::getVar('Itemid');
                //create album string
                $AlbumLenght = strlen($albenitem->album);
                if ($AlbumLenght > 14) {
                    $AlbumName = substr($albenitem->album, 0, 11) . '...';
                } else {
                    $AlbumName = $albenitem->album;
                }
                //Get Album thumbnail
                if ($this->params->get(JRequest::getVar('view') . '_show_cover', 1) == 1) {
                    $cover = new PlayJoomHelperCover();
                    $coverthumb = $cover->getCoverHTMLTag($albenitem, $SamplerCheck);
                }
                echo '<li class="AlbumList"><a href="' . $albumlink . '" title="Continue to the album view">' . $coverthumb . '<br />' . $AlbumName . '</a> (' . $albenitem->year . ')</li>';
            }
            echo '</ul>';
            echo '</fieldset>';
        }
}
Ejemplo n.º 3
0
 * of works licensed under the GNU General Public License or other free or open
 * source software licenses. See COPYRIGHT.php for copyright notices and
 * details.
 *
 * @PlayJoom Component
 * @copyright Copyright (C) 2010-2011 by www.teglo.info
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @date $Date: 2013-09-10 19:13:25 +0200 (Di, 10 Sep 2013) $
 * @revision $Revision: 842 $
 * @author $Author: toto $
 * @headurl $HeadURL: http://dev.teglo.info/svn/playjoom/components/com_playjoom/views/album/tmpl/default_cover.php $
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
$item = (object) array('artist' => base64_decode(JRequest::getVar('artist')), 'album' => base64_decode(JRequest::getVar('album')));
if ($this->params->get(JRequest::getVar('view') . '_show_cover', 1) == 1) {
    $Cover = new PlayJoomHelperCover();
    $CoverData = $Cover->getAlbumCover($item);
    if ($this->params->get('save_cover_tmp', 0) == 1) {
        $file = JApplication::stringURLSafe($item->artist . '-' . $item->album);
        $path = $Cover->getFilePath();
        if (!$Cover->checkFileExists($path, $file, $this->params)) {
            $Cover->createCoverfile($CoverData, $path, $file, $this->params);
        }
    }
    $coverthumb = $Cover->getCoverThumb($CoverData, $item, $this->params);
} else {
    $coverthumb = null;
}
//Output cover image
echo $coverthumb;
Ejemplo n.º 4
0
 if ($genre_item) {
     //Create genre link
     $genrelink = JRoute::_('index.php?option=com_playjoom&view=genre&catid=' . $item->catid . '&Itemid=' . JRequest::getVar('Itemid'));
     echo '<div class="albumsview">';
     echo '<h2 class="genres_title"><a href="' . $genrelink . '" title="Continue to the genre view">' . $item->category_title . '</a></h2>';
     echo '<ul class="list_of_albums' . $this->params->get('genres_show_cover') . '">';
     foreach ($genre_item as $j => $item_entrie) {
         if ($j < $this->params->get('NumberOfAlbums')) {
             $SamplerCheck = PlayJoomHelper::checkForSampler($item_entrie->album, $item_entrie->artist);
             //Create album link
             $albumsting = base64_encode($item_entrie->album);
             $artiststing = base64_encode($item_entrie->artist);
             $albumlink = JRoute::_('index.php?option=com_playjoom&view=album&cat=' . base64_encode($item->category_title) . '&catid=' . $item->catid . '&album=' . $albumsting . '&artist=' . $artiststing . '&Itemid=' . JRequest::getVar('Itemid'));
             //Get Album thumbnail
             if ($this->params->get(JRequest::getVar('view') . '_show_cover', 1) == 1) {
                 $cover = new PlayJoomHelperCover();
                 $coverthumb = $cover->getCoverHTMLTag($item_entrie, $SamplerCheck);
             }
             //Prepare for artist information
             //Check for albumname as sampler
             if ($SamplerCheck) {
                 $artist = JText::_('COM_PLAYJOOM_ALBUM_SAMPLER');
             } else {
                 $artist = $item_entrie->artist;
             }
             //create artist string
             $NameLenght = strlen($artist);
             if ($NameLenght > 15) {
                 $ArtistName = substr($artist, 0, 14) . '...';
             } else {
                 $ArtistName = $artist;
Ejemplo n.º 5
0
 /**
  * Album Search method
  *
  * The sql must return the following fields that are used in a common display
  * routine: href, title, section, add_datetime
  *
  * @param string Target search string
  * @param string mathcing option, exact|any|all
  * @param string ordering option, newest|oldest|popular|alpha|category
  * @param mixed An array if the search it to be restricted to areas, null if search all
  */
 function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
 {
     $db = JFactory::getDbo();
     $user = JFactory::getUser();
     $groups = implode(',', $user->getAuthorisedViewLevels());
     $tag = JFactory::getLanguage()->getTag();
     //For getting the xml parameters
     $params = JComponentHelper::getParams('com_playjoom');
     require_once JPATH_SITE . '/components/com_playjoom/helpers/route.php';
     require_once JPATH_SITE . '/components/com_playjoom/helpers/playjoom.php';
     require_once JPATH_SITE . '/components/com_playjoom/helpers/logging.php';
     $searchText = $text;
     if (is_array($areas)) {
         if (!array_intersect($areas, array_keys($this->onContentSearchAreas()))) {
             return array();
         }
     }
     //Get plugin params
     $sContent = null;
     $sArchived = null;
     $limit = $this->params->def('pj_albums_search_limit', 50);
     $nullDate = $db->getNullDate();
     $date = JFactory::getDate();
     $now = $date->toSql();
     $text = trim($text);
     if ($text == '') {
         return array();
     }
     $section = JText::_('PLG_SEARCH_ALBUMS');
     $wheres = array();
     switch ($phrase) {
         case 'exact':
             $text = $db->Quote($db->escape($text, true), false);
             $wheres2 = array();
             $wheres2[] = 'a.album LIKE ' . $text;
             $where = '(' . implode(') OR (', $wheres2) . ')';
             break;
         case 'all':
         case 'any':
         default:
             $words = explode(' ', $text);
             $wheres = array();
             foreach ($words as $word) {
                 $word = $db->Quote('%' . $db->escape($word, true) . '%', false);
                 $wheres2 = array();
                 $wheres2[] = 'a.album LIKE ' . $word;
                 $wheres[] = implode(' OR ', $wheres2);
             }
             $where = '(' . implode($phrase == 'all' ? ') AND (' : ') OR (', $wheres) . ')';
             break;
     }
     $morder = '';
     switch ($ordering) {
         case 'oldest':
             $order = 'a.add_datetime ASC';
             break;
         case 'popular':
             $order = 'a.hits DESC';
             break;
         case 'alpha':
             $order = 'a.album ASC';
             break;
         case 'category':
             $order = 'c.title ASC, a.artist ASC';
             $morder = 'a.album ASC';
             break;
         case 'newest':
         default:
             $order = 'a.add_datetime DESC';
             break;
     }
     $rows = array();
     $query = $db->getQuery(true);
     $query->clear();
     $query->select('a.id, a.catid, a.pathatlocal, a.file, a.title AS tracktitle, a.album AS album, a.artist AS artist, a.metadesc, a.metakey, a.add_datetime AS created,' . 'CONCAT_WS(" / ", ' . $db->Quote($section) . ', c.title) AS section, "1" AS browsernav');
     $query->from('#__jpaudiotracks AS a');
     $query->innerJoin('#__categories AS c ON c.id=a.catid');
     $query->where('(' . $where . ')');
     $query->group('a.album,a.artist');
     $query->order($order);
     //Filtering by user
     if (JAccess::check($user->get('id'), 'core.admin') != 1) {
         //Get user id
         $users = $user->get('id');
         $userCheck = $params->get('show_all_users', 1);
         $userCheck = (int) $userCheck + $params->get('show_nobody', 1);
         if ($userCheck == 1) {
             if ($params->get('show_all_users', 1)) {
                 $query->where('add_by >= 1');
             }
             if ($params->get('show_nobody', 1)) {
                 $users = '0,' . $users;
                 $query->where('add_by IN (' . $users . ')');
             }
         } elseif ($userCheck == 0) {
             $query->where('add_by = ' . $users . '');
         }
     }
     // Implement View Level Access
     if (!$user->authorise('core.admin') && !$params->get('show_noauth', 1)) {
         $groups = implode(',', $user->getAuthorisedViewLevels());
         $groups = '0,' . $groups;
         $query->where('a.access IN (' . $groups . ')');
     }
     $db->setQuery($query, 0, $limit);
     $list = $db->loadObjectList();
     $limit -= count($list);
     if (isset($list)) {
         JLoader::import('helpers.cover', JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_playjoom');
         $Cover = new PlayJoomHelperCover();
         foreach ($list as $key => $item) {
             //Get Album thumbnail
             $SamplerCheck = PlayJoomHelper::checkForSampler($item->album, $item->artist);
             if ($this->params->get(JRequest::getVar('view') . '_show_cover', 1) == 1) {
                 $cover = new PlayJoomHelperCover();
                 $coverthumb = $cover->getCoverHTMLTag($item, $SamplerCheck);
             } else {
                 $coverthumb = null;
             }
             $list[$key]->href = 'index.php?option=com_playjoom&view=album&album=' . base64_encode($item->album) . '&artist=' . base64_encode($item->artist);
             $list[$key]->title = $item->album . ' (' . $item->artist . ')';
             $list[$key]->coverimg = $coverthumb;
             $list[$key]->browsernav = '2';
         }
     }
     $rows[] = $list;
     $results = array();
     if (count($rows)) {
         foreach ($rows as $row) {
             $new_row = array();
             foreach ($row as $key => $track) {
                 if (count($row) == 1) {
                     JFactory::getApplication()->redirect($track->href);
                 } else {
                     if (JFile::exists($track->pathatlocal . DIRECTORY_SEPARATOR . $track->file)) {
                         $new_row[] = $track;
                     }
                 }
             }
             $results = array_merge($results, (array) $new_row);
         }
     }
     return $results;
 }
Ejemplo n.º 6
0
 /**
  * Method for to get the html tag for cover images
  *
  * @param array $albenitem albenitem Contents of a album
  * @param boolean If album a sampler then value is true.
  */
 public function getCoverHTMLTag($albenitem, $SamplerCheck)
 {
     $file = JApplication::stringURLSafe($albenitem->artist . '-' . $albenitem->album);
     $path = self::getFilePath();
     if ($this->params->get('save_cover_tmp', 0) == 1) {
         if (!self::checkFileExists($path, $file)) {
             $cover_data = self::getAlbumCover($albenitem, $SamplerCheck);
             if ($cover_data) {
                 self::createCoverfile($cover_data, $path, $file);
             } else {
                 //If no cover data available, then create a standard cover tag
                 return self::createStdCoverHTMLTag($albenitem);
             }
         }
         $cover_state = self::checkFileExists($path, $file);
         $cover_size = self::getTmpCoverSize($cover_state, $path, $file);
         return self::createTmpCoverTag(DIRECTORY_SEPARATOR . $file . '.' . $cover_state, $title = 'Cover for album: ' . $albenitem->album . '(' . $albenitem->artist . ')', $alt = 'Cover for album: ' . $albenitem->album . '(' . $albenitem->artist . ')', $cover_size[0], $cover_size[1]);
     } else {
         // Get a reference to the global cache object.
         $cache = JFactory::getCache('com_playjoom', '');
         // Check the cached results.
         if (!$cache->get($path . DIRECTORY_SEPARATOR . $file)) {
             $cover_data = self::getAlbumCover($albenitem, $SamplerCheck);
             if ($cover_data) {
                 $cover_base64 = PlayJoomHelperCover::ResampleImage($cover_data);
                 // Store the data in cache.
                 $cache->store(self::createDBCoverTag($cover_base64, $title = 'Cover for album: ' . $albenitem->album . '(' . $albenitem->artist . ')', $alt = 'Cover for album: ' . $albenitem->album . '(' . $albenitem->artist . ')', $this->params->get(JRequest::getVar('view') . '_cover_size', 100), self::calcImageSize($cover_data->width, $cover_data->height)), $path . DIRECTORY_SEPARATOR . $file);
                 return self::createDBCoverTag($cover_base64, $title = 'Cover for album: ' . $albenitem->album . '(' . $albenitem->artist . ')', $alt = 'Cover for album: ' . $albenitem->album . '(' . $albenitem->artist . ')', $this->params->get(JRequest::getVar('view') . '_cover_size', 100), self::calcImageSize($cover_data->width, $cover_data->height));
             } else {
                 //If no cover data available, then create a standard cover tag
                 return self::createStdCoverHTMLTag($albenitem);
             }
         } else {
             return $cache->get($path . DIRECTORY_SEPARATOR . $file);
         }
     }
 }