Beispiel #1
0
 /**
  * Method for to create a info readme file about the album
  *
  * @param array $items album items
  */
 public function createInfoFile($items)
 {
     $dispatcher = JDispatcher::getInstance();
     $dispatcher->trigger('onEventLogging', array(array('method' => __METHOD__ . ":" . __LINE__, 'message' => 'Starting for create info text file.', 'priority' => JLog::INFO, 'section' => 'site')));
     $PJContent = "Album Infos:\r\n";
     $PJContent .= base64_decode(JRequest::getVar('name')) . ", " . base64_decode(JRequest::getVar('artist')) . "\r\n";
     $PJContent .= "------------------------------------------------------------------------------\r\n";
     foreach ($items as $i => $item) {
         if (JFile::exists($item->pathatlocal . DIRECTORY_SEPARATOR . $item->file)) {
             $PJContent .= $item->artist . ", " . $item->album . " - " . $item->tracknumber . " - " . $item->title . " (" . PlayJoomHelper::Playtime($item->length) . ")\r\n";
         } else {
             $dispatcher->trigger('onEventLogging', array(array('method' => __METHOD__ . ":" . __LINE__, 'message' => 'Track ' . $item->title . ' isn´t available!', 'priority' => JLog::WARNING, 'section' => 'site')));
         }
     }
     $PJContent .= "\r\n";
     $PJContent .= "\r\n";
     $About = array('artist' => JRequest::getVar('artist'), 'album' => JRequest::getVar('name'), 'type' => JRequest::getVar('type'));
     require_once JPATH_COMPONENT . '/apis/lastfm.php';
     $ContentExist = PlayJoomLastfmHelper::CheckLastfmContent('album', $About);
     if ($ContentExist == true) {
         $PJContent .= "About the album:\r\n";
         $PJContent .= "------------------------------------------------------------------------------\r\n";
         $PJContent .= PlayJoomLastfmHelper::GetLastfmContent('album', $About)->album->wiki->content;
         $PJContent .= "------------------------------------------------------------------------------\r\n";
     }
     $ContentExist = PlayJoomLastfmHelper::CheckLastfmContent('artist', $About);
     if ($ContentExist == true) {
         $PJContent .= "About the artist / band:\r\n";
         $PJContent .= "------------------------------------------------------------------------------\r\n";
         $PJContent .= PlayJoomLastfmHelper::GetLastfmContent('artist', $About)->artist->bio->content;
         $PJContent .= "------------------------------------------------------------------------------\r\n";
     }
     $PJContent .= "\r\n";
     $PJContent .= "\r\n";
     $PJContent .= "------------------------------------------------------------------------------\r\n";
     $PJContent .= "Archiv created by PlayJoom Server.\r\n";
     $PJContent .= PlayJoomHelper::GetInstallInfo("description", "playjoom.xml") . "\r\n";
     $PJContent .= "\r\n";
     $PJContent .= "\r\n";
     $PJContent .= "Version: " . PlayJoomHelper::GetInstallInfo("version", "playjoom.xml") . "\r\n";
     $PJContent .= "copyright: " . PlayJoomHelper::GetInstallInfo("copyright", "playjoom.xml") . "\r\n";
     $PJContent .= "web: " . PlayJoomHelper::GetInstallInfo("authorUrl", "playjoom.xml") . "\r\n";
     $this->data[] = $PJContent;
 }
$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) {
        $length_average = $length_counter / $i;
        $size_average = $size_counter / $i;
        if ($i == count($this->items) - 1) {
            echo '<ul class="album-sum">';
            echo '<li>' . JText::_('COM_PLAYJOOM_ALBUM_NO_TRACKS') . '&nbsp;' . count($this->items) . '</li>';
            echo '<li>' . JText::_('COM_PLAYJOOM_ALBUM_TOTAL') . '&nbsp;' . PlayJoomHelper::Playtime($length_counter) . ' ' . JText::_('COM_PLAYJOOM_ALBUM_MINUTES_SHORT') . '</li>';
            echo '<li>' . JText::_('COM_PLAYJOOM_ALBUM_AVERAGE') . '&nbsp;' . PlayJoomHelper::Playtime($length_average) . ' ' . JText::_('COM_PLAYJOOM_ALBUM_MINUTES_SHORT') . '</li>';
            echo '</ul>';
        }
    }
}
echo '</div>';
 $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">';
     foreach ($album_item as $j => $item_entrie) {
         if (JFile::exists($item->pathatlocal . DIRECTORY_SEPARATOR . $item->file)) {
             if ($j < $numbers_of_title_genre) {
                 //Check for displaying the running time
                 if ($running_time_genre == 1) {
                     $running_time = ' [' . PlayJoomHelper::Playtime($item_entrie->length) . '&nbsp;' . JText::_('COM_PLAYJOOM_ALBUM_MINUTES_SHORT') . ']';
                 } else {
                     $running_time = null;
                 }
                 //Check for displaying the hits
                 if ($hits_genre == 1) {
                     $hits = ' [' . $item_entrie->hits . ']';
                 } else {
                     $hits = null;
                 }
                 //Plugins integration
                 $this->events = new stdClass();
                 $results = $dispatcher->trigger('onPrepareTrackLink', array(&$item_entrie, $this->params));
                 $this->events->PrepareTrackLink = trim(implode("\n", $results));
                 $results = $dispatcher->trigger('onBeforeTrackLink', array(&$item_entrie, $this->params));
                 $this->events->BeforeTrackLink = trim(implode("\n", $results));
            $return = JRequest::getVar('return', '', 'method', 'base64');
            $return = base64_decode($return);
            if (!JURI::isInternal($return)) {
                $return = '';
            }
            // Redirect the user.
            $app->redirect(JRoute::_($return, false));
        } else {
            $app->redirect(JRoute::_('index.php?option=com_users&view=login&return=' . base64_encode($uri), false));
        }
    }
    //Create PJ links
    $artiststing = base64_encode($item->artist);
    $albumsting = base64_encode($item->album);
    $album_link = PlayJoomHelperRoute::getPJlink('albums', '&album=' . $albumsting . '&artist=' . $artiststing);
    $artist_link = PlayJoomHelperRoute::getPJlink('artists', '&artist=' . $artiststing);
    if (JFile::exists($item->pathatlocal . DIRECTORY_SEPARATOR . $item->file)) {
        echo '<li><a href="index.php?option=com_playjoom&view=broadcast&id=' . $item->track_id . '" title="Continue to play this title" target="_blank" class="direct_link">' . $item->title . '</a>&nbsp;<span class="trackminutes">[' . PlayJoomHelper::Playtime($item->length) . ']</span><img src="components/com_playjoom/images/icons/application_form_delete.png" alt="delete icon" width="16px" height="16px" style="margin-right:3px;margin-top:2px;vertical-align:bottom;" /><a href="index.php?option=com_playjoom&view=adminplaylist&layout=deltrack&id=' . $item->track_id . '&listid=' . JRequest::getVar('listid') . '&Itemid=' . JRequest::getVar('Itemid') . '" title="Continue to delete this track from the playlist">Delete</a></li>';
        echo '<li class="artistalbumline">' . JText::_('COM_PLAYJOOM_PLAYJOOM_HEADING_ARTIST') . ': <a href="' . $artist_link . '" title="Continue to the artist view">' . $item->artist . '</a>, ' . JText::_('COM_PLAYJOOM_PLAYJOOM_HEADING_ALBUM') . ': <a href="' . $album_link . '" title="Continue to the album view">' . $item->album . '</a></li>';
        echo '<li class="addline">' . JText::_('COM_PLAYJOOM_PLAYJOOM_HEADING_CREATE') . ' ' . $item->add_date . '</li>';
        echo '<li class="divider"></li>';
        $length_counter = $length_counter + $item->length;
        $track_counter = $track_counter + 1;
    } else {
        echo '<li>' . $item->track_id . ' ' . JText::_('COM_PLAYJOOM_PLAYLIST_NOT_AVAILABLE') . ', ' . $item->title . '<br><img src="components/com_playjoom/images/icons/application_form_delete.png" alt="delete icon" width="16px" height="16px" style="margin-right:3px;margin-top:2px;vertical-align:bottom;" /><a href="index.php?option=com_playjoom&view=adminplaylist&layout=deltrack&id=' . $item->track_id . '&listid=' . JRequest::getVar('listid') . '&Itemid=' . JRequest::getVar('Itemid') . '" title="Continue to delete this track from the playlist">Delete</a></li>';
        echo '<li class="divider"></li>';
    }
}
echo '<li class="divider"></li>';
echo '<li>' . JText::_('COM_PLAYJOOM_PLAYLIST_TOTAL') . '<br />' . $track_counter . ' ' . JText::_('COM_PLAYJOOM_PLAYLIST_TRACKS') . ' - ' . PlayJoomHelper::Playtime($length_counter) . ' ' . JText::_('COM_PLAYJOOM_PLAYLIST_MINUTES') . '</li>';
    $artist_link = PlayJoomHelperRoute::getPJlink('artists', '&artist=' . $artiststing);
    //Plugins integration
    $this->events = new stdClass();
    $results = $dispatcher->trigger('onBeforeTrackLink', array(&$item, $this->params));
    $this->events->BeforeTrackLink = trim(implode("\n", $results));
    $results = $dispatcher->trigger('onAfterTrackLink', array(&$item, $this->params));
    $this->events->AfterTrackLink = trim(implode("\n", $results));
    if (JFile::exists($item->pathatlocal . DIRECTORY_SEPARATOR . $item->file)) {
        //table row only if the file exists
        echo '<tr class="row' . $i % 2 . '">';
        echo '<td>' . $this->events->BeforeTrackLink . '<a href="index.php?option=com_playjoom&view=broadcast&id=' . $item->track_id . '" title="Continue to play this title" target="_blank" class="direct_link">' . $item->title . '</a>&nbsp;[' . PlayJoomHelper::Playtime($item->length) . ']<br /><img src="components/com_playjoom/images/icons/application_form_delete.png" alt="delete icon" width="16px" height="16px" style="margin-right:3px;margin-top:2px;vertical-align:bottom;" /><a href="index.php?option=com_playjoom&view=adminplaylist&layout=deltrack&id=' . $item->track_id . '&listid=' . JRequest::getVar('listid') . '&Itemid=' . JRequest::getVar('Itemid') . '" title="Continue to delete this track from the playlist">Delete</a>' . $this->events->AfterTrackLink . '</td>';
        echo '<td><a href="' . $artist_link . '" title="Continue to the artist view">' . $item->artist . '</a></td>';
        echo '<td><a href="' . $album_link . '" title="Continue to the album view">' . $item->album . '</a></td>';
        echo '<td>' . $item->genre . '</td>';
        echo '<td>' . $item->add_date . '</td>';
        echo '</tr>';
        $length_counter = $length_counter + $item->length;
        $track_counter = $track_counter + 1;
    } else {
        //table row for the files that doesn´t exists or available
        echo '<tr class="row' . $i % 2 . '">';
        echo '<td>' . $item->track_id . '</td>';
        echo '<td colspan="6">' . JText::_('COM_PLAYJOOM_PLAYLIST_NOT_AVAILABLE') . ', ' . $item->title . '<br><img src="components/com_playjoom/images/icons/application_form_delete.png" alt="delete icon" width="16px" height="16px" style="margin-right:3px;margin-top:2px;vertical-align:bottom;" /><a href="index.php?option=com_playjoom&view=adminplaylist&layout=deltrack&id=' . $item->track_id . '&listid=' . JRequest::getVar('listid') . '&Itemid=' . JRequest::getVar('Itemid') . '" title="Continue to delete this track from the playlist">Delete</a></td>';
        echo '</tr>';
    }
}
//$track_counter = $i +1;
echo '<tr>';
echo '<td colspan="5" align="right">' . JText::_('COM_PLAYJOOM_PLAYLIST_TOTAL') . '<br />' . $track_counter . ' ' . JText::_('COM_PLAYJOOM_PLAYLIST_TRACKS') . ' - ' . PlayJoomHelper::Playtime($length_counter) . ' ' . JText::_('COM_PLAYJOOM_PLAYLIST_MINUTES') . '</td>';
//echo '<td colspan="2" valign="bottom">'.PlayJoomHelper::Playtime($length_counter).' '.JText::_('COM_PLAYJOOM_PLAYLIST_MINUTES').'</td>';
echo '</tr>';
        }
        //Plugins integration
        $this->events = new stdClass();
        $results = $dispatcher->trigger('onInTrackbox', array($item, $this->params));
        $this->events->InTrackbox = trim(implode("\n", $results));
        $results = $dispatcher->trigger('onPrepareTrackLink', array(&$item, $this->params, $item->title));
        $this->events->PrepareTrackLink = trim(implode("\n", $results));
        $results = $dispatcher->trigger('onBeforeTrackLink', array(&$item, $this->params));
        $this->events->BeforeTrackLink = trim(implode("\n", $results));
        $results = $dispatcher->trigger('onAfterTrackLink', array(&$item, $this->params));
        $this->events->AfterTrackLink = trim(implode("\n", $results));
        //Check for Trackcontrol
        if (JPluginHelper::isEnabled('playjoom', 'trackcontrol') == false) {
            $TitleLink = $item->title;
        } else {
            $TitleLink = $this->events->PrepareTrackLink;
        }
        $track_text = '<span class="trackno">' . sprintf("%02d", $item->tracknumber) . ' - ' . $this->events->BeforeTrackLink . '<span class="tracktitle">' . $TitleLink . '</span>&nbsp;<span class="trackminutes">[' . PlayJoomHelper::Playtime($item->length) . ' ' . JText::_('COM_PLAYJOOM_ALBUM_MINUTES_SHORT') . ']</span>' . $this->events->AfterTrackLink . ' <span class="add2playlist"><a href="index.php?option=com_playjoom&amp;view=addtoplaylist&amp;layout=modal&amp;tmpl=component&amp;id=' . $item->id . '" class="modal" style="margin-left: 45px;" rel="' . $modal_add2playlist_config . '">' . JText::_('COM_PLAYJOOM_ALBUM_ADD2PLAYLIST') . '</span></a>';
        echo '<div class="title">';
        echo JHtml::_('PlayJoomSliders.addSlide', 'moduleOptions', $track_text, JText::_('COM_PLAYJOOM_ALBUM_MORE_INFO'), 'collapse' . $i++, '');
        echo '</div>';
        echo '<div class="accordion-content">';
        echo $content_left;
        echo $content_right;
        echo $this->events->InTrackbox;
        echo '</div>';
        echo JHtml::_('PlayJoomSliders.endSlide');
    }
}
echo JHtml::_('PlayJoomSliders.endAccordion');
echo '</div>';
Beispiel #7
0
$appParams = $app->getParams();
// require helper file
JLoader::register('PlayJoomHelper', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'playjoom.php');
if (!$moduleclass_sfx) {
    $moduleclass = 'side-nav';
} else {
    $moduleclass = $moduleclass_sfx;
}
echo '<ul class="' . $moduleclass . '">';
foreach ($list as $item) {
    if ($params->get('show_hits') == 1) {
        $show_hits = '[' . $item->hits . ']';
    } else {
        $show_hits = null;
    }
    if ($params->get('show_album') == 1) {
        $show_album = '(' . $item->album . ')';
    } else {
        $show_album = null;
    }
    if ($params->get('show_length') == 1) {
        $show_length = PlayJoomHelper::Playtime($item->length) . ' ' . JText::_('COM_PLAYJOOM_ALBUM_MINUTES_SHORT');
    } else {
        $show_length = null;
    }
    echo '<li>';
    echo '<a href="' . $item->link . '">' . $item->artist . ' - ' . $item->title . ' - ' . $show_length . ' ' . $show_album . ' ' . $show_hits . '</a>';
    echo '</li>';
    echo '<li class="divider"></li>';
}
echo '</ul>';
     if (JPluginHelper::isEnabled('playjoom', 'trackcontrol') == false) {
         $NoLink = sprintf("%02d", $i + 1);
         $TitleLink = $tag_item->title;
     } else {
         if (isset($tag_item->id)) {
             $NoLink = '<a href="index.php?option=com_playjoom&amp;view=broadcast&amp;id=' . $tag_item->id . '" target="_blank" class="direct_link">' . sprintf("%02d", $i + 1) . '</a>';
             $TitleLink = $this->events->PrepareTrackLink;
         } else {
             $NoLink = null;
             $TitleLink = null;
         }
     }
     echo '<li class="cat-list-row' . $i % 2 . ' clearfix" >';
     //$track_text = '<span class="trackno">'.$NoLink.'</span>'.$itemElement->events->BeforeTrackLink.'<span class="tracktitle">'.$TitleLink.'</span>'.$itemElement->events->AfterTrackLink.'<span class="trackminutes">['.PlayJoomHelper::Playtime($tag_item_arr->length).' '.JText::_('COM_PLAYJOOM_ALBUM_MINUTES_SHORT').']</span><span class="add2playlist"><a href="index.php?option=com_playjoom&amp;view=addtoplaylist&amp;layout=modal&amp;tmpl=component&amp;id='.$tag_item->id.'" class="modal" style="margin-left: 45px;" rel="'.$modal_add2playlist_config.'">'.JText::_('COM_PLAYJOOM_ALBUM_ADD2PLAYLIST').'</span></a>';
     if ($NoLink && $TitleLink && $tag_item_arr->length) {
         $track_text = '<span class="trackno">' . $NoLink . '</span>' . $this->events->BeforeTrackLink . '<span class="tracktitle">' . $TitleLink . '</span>' . $this->events->AfterTrackLink . '<span class="trackminutes">[' . PlayJoomHelper::Playtime($tag_item_arr->length) . ' ' . JText::_('COM_PLAYJOOM_ALBUM_MINUTES_SHORT') . ']</span>';
         echo $track_text;
     }
 }
 array_push($tag_items_arr, $tag_item);
 $images = json_decode($item->core_images);
 if ($this->params->get('tag_list_show_item_image', 1) == 1 && !empty($images->image_intro)) {
     echo '<img src="' . htmlspecialchars($images->image_intro) . '" alt="' . htmlspecialchars($images->image_intro_alt) . '">';
 }
 if ($this->params->get('tag_list_show_item_description', 1)) {
     echo '<span class="tag-body">';
     echo JHtml::_('string.truncate', $item->core_body, $this->params->get('tag_list_item_maximum_characters'));
     echo '</span>';
 }
 echo '<div class="clear"></div>';
 echo '</li>';