Esempio n. 1
0
 if ($this->params->get(JRequest::getVar('view') . '_show_cover', 1) == 1) {
     $cover = new PlayJoomHelperCover();
     $coverthumb = $cover->getCoverHTMLTag($item, $SamplerCheck);
 }
 $albumsting = base64_encode($item->album);
 $artiststing = base64_encode($item->artist);
 if (isset($this->genre->title)) {
     $cat_string = '&cat=' . base64_encode($this->genre->title);
 } else {
     $cat_string = null;
 }
 $albumlink = JRoute::_('index.php?option=com_playjoom&view=album&album=' . $albumsting . '&artist=' . $artiststing . '&Itemid=' . JRequest::getVar('Itemid') . $cat_string . '&catid=' . JRequest::getVar('catid'));
 $artistlink = JRoute::_('index.php?option=com_playjoom&view=artist&artist=' . $artiststing . '&Itemid=' . JRequest::getVar('Itemid') . $cat_string . '&catid=' . JRequest::getVar('catid'));
 //Prepare for artist information
 //Check for albumname as sampler
 $checkResult = PlayJoomHelper::checkForSampler($item->album, $item->artist);
 if ($checkResult) {
     $artistname = JText::_('COM_PLAYJOOM_ALBUM_SAMPLER');
 } else {
     $artistname = $item->artist;
 }
 $counter++;
 echo '<tr class="row' . $i % 2 . '">';
 echo '<td valign="top">' . $counter . '</td>';
 echo '<td valign="top"><a href="' . $artistlink . '">' . $artistname . '</a></td>';
 echo '<td valign="top"><a href="' . $albumlink . '" title="Continue to the album view">' . $coverthumb . $item->album . '</a></td>';
 if ($numbers_of_title_genre >= 1) {
     echo '<td valign="top">';
     //list of titles
     $album_item = PlayJoomModelGenre::getAlbumItems($item->album);
     echo '<ul class="circle">';
Esempio n. 2
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')));
$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;
Esempio n. 3
0
// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
JPluginHelper::importPlugin('playjoom');
$counter = null;
$coverwidth = $this->params->get('maxsize_cover');
$coverstate = $this->params->get('show_cover');
$dispatcher = JDispatcher::getInstance();
foreach ($this->items as $i => $item) {
    if (JFile::exists($item->pathatlocal . DIRECTORY_SEPARATOR . $item->file)) {
        if ($coverstate == 1) {
            $coverthumb = PlayJoomHelper::getCoverThumb($item->album, $item->artist, JPATH_BASE . DS . 'tmp' . DS . 'tmp_img_albumtumb' . $i, $coverwidth, $i) . '<br />';
        } else {
            $coverthumb = null;
        }
        //Check for albumname as sampler
        if (PlayJoomHelper::checkForSampler($item->album, $item->artist)) {
            $albumname = JText::_('COM_PLAYJOOM_ALBUM_SAMPLER');
        } else {
            $albumname = $item->album;
        }
        //Create strings
        $albumsting = base64_encode($item->album);
        $genresting = base64_encode($item->category_title);
        $artiststing = base64_encode($item->artist);
        //Create links
        $albumlink = 'index.php?option=com_playjoom&view=album&album=' . $albumsting . '&artist=' . $artiststing . '&Itemid=' . JRequest::getVar('Itemid');
        $genrelink = 'index.php?option=com_playjoom&view=genre&cat=' . $genresting . '&catid=' . $item->catid . '&Itemid=' . JRequest::getVar('Itemid');
        $artistlink = 'index.php?option=com_playjoom&view=artist&artist=' . $artiststing . '&Itemid=' . JRequest::getVar('Itemid');
        $counter++;
        echo '<tr>';
        echo '<td>' . $counter . '</td>';
Esempio n. 4
0
    }
    $year = $item->year;
    $add = $item->add_datetime;
}
//Configuration of the modal windows
$modal_artist_config = "{handler: 'iframe', size: {x: " . $this->params->get('modal_infoabout_size_v', 600) . ", y: " . $this->params->get('modal_infoabout_size_h', 500) . "}}";
$modal_album_config = "{handler: 'iframe', size: {x: " . $this->params->get('modal_infoabout_size_v', 600) . ", y: " . $this->params->get('modal_infoabout_size_h', 500) . "}}";
$modal_genre_config = "{handler: 'iframe', size: {x: " . $this->params->get('modal_infoabout_size_v', 600) . ", y: " . $this->params->get('modal_infoabout_size_h', 500) . "}}";
/*
 * - Check for additional infos
 * - and whether the button is active
 */
if (isset($genresting)) {
    $AboutInfo = array('artist' => $artiststing, 'album' => JRequest::getVar('album'), 'genre' => $genresting);
}
if ($this->params->get('show_additional_info_arist', 1) == 1 && !PlayJoomHelper::checkForSampler($item->album, $item->artist)) {
    $ArtistChecker = PlayJoomHelper::getInfoButton('artist', $AboutInfo, $modal_artist_config, $this->params);
} else {
    $ArtistChecker = null;
}
if ($this->params->get('show_additional_info_album', 1) == 1) {
    $AlbumChecker = PlayJoomHelper::getInfoButton('album', $AboutInfo, $modal_album_config, $this->params);
} else {
    $AlbumChecker = null;
}
if ($this->params->get('show_additional_info_genre') == 0) {
    $GenreChecker = PlayJoomHelper::getInfoButton('genre', $AboutInfo, $modal_genre_config, $this->params);
} else {
    $GenreChecker = null;
}
if (isset($album, $year, $artist, $artistname, $genre)) {
Esempio n. 5
0
    /**
     * Get the message
     * @return object The message to be displayed to the user
     */
    protected function getListQuery()
    {
        //Get User objects
        $user = JFactory::getUser();
        //For getting the xml parameters
        $app = JFactory::getApplication();
        $params = $app->getParams();
        //Get url queries
        $album = base64_decode(JRequest::getVar('album'));
        $artist = base64_decode(JRequest::getVar('artist'));
        // Create a new query object.
        $db = $this->getDbo();
        $query = $db->getQuery(true);
        // Select the required fields from the table.
        $query->select($this->getState('list.select', 'a.id, a.title, a.hits, a.artist, a.album, a.title, a.year, a.add_datetime, a.length, a.catid, a.alias,
			      		                         a.file, a.tracknumber, a.mediatype, a.filesize, a.filesize, a.pathatlocal, a.bit_rate, a.sample_rate,
			      		                         a.channelmode, a.channels, a.add_datetime, a.add_by, a.access, a.mod_datetime, a.mod_by, a.access_datetime'));
        $query->from('#__jpaudiotracks AS a');
        // Join over the categories.
        $query->select('c.title AS category');
        $query->join('LEFT', '#__categories AS c ON c.id = a.catid');
        // Join over the covers.
        $query->select('cb.id AS cover_id');
        $query->join('LEFT', '#__jpcoverblobs AS cb ON cb.id = a.coverid');
        /*
         * Join over the users.
         */
        $query->select('CASE WHEN a.add_by > \'0\' THEN ua.username END AS add_user');
        $query->join('LEFT', '#__users AS ua ON ua.id = a.add_by');
        $query->select('CASE WHEN a.mod_by > \'0\' THEN um.username END AS mod_user');
        $query->join('LEFT', '#__users AS um ON um.id = a.mod_by');
        // Join on voting table
        $query->select('ROUND( v.rating_sum / v.rating_count ) AS rating, v.rating_count as rating_count');
        $query->join('LEFT', '#__jpaudiotracks_rating AS v ON a.id = v.track_id');
        //Check for albumname as sampler
        if (!PlayJoomHelper::checkForSampler($album, $artist)) {
            $query->where('(a.album = "' . $album . '" AND a.artist = "' . $artist . '")');
        } else {
            $query->where('a.album = "' . $album . '"');
        }
        // 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 . ')');
        }
        //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 . '');
            }
        }
        $query->order('a.tracknumber');
        return $query;
    }
Esempio n. 6
0
 public static function getAlbumCover($album, $artist = null)
 {
     $dispatcher = JDispatcher::getInstance();
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $query->select('cb.album, cb.artist, cb.width, cb.height, cb.mime, cb.data');
     $query->from('#__jpcoverblobs as cb');
     if (!PlayJoomHelper::checkForSampler($album, $artist)) {
         $dispatcher->trigger('onEventLogging', array(array('method' => __METHOD__ . ":" . __LINE__, 'message' => 'Get cover data from database for values -> album: ' . $album . ', artist: ' . $artist, 'priority' => JLog::INFO, 'section' => 'site')));
         $query->where('(cb.album = "' . $album . '" AND cb.artist = "' . $artist . '")');
     } else {
         $query->where('cb.album = "' . $album . '"');
     }
     $db->setQuery($query);
     return $db->loadObject();
 }
Esempio n. 7
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;
 }