/** * */ function viewCategory($rows, $pageNav, $total, $cat_id, $cat, $subcats) { global $Itemid, $smartyvs, $mainframe; $c = hwd_vs_Config::get_instance(); if ($c->showrating == 1 || $c->showviews == 1 || $c->showduration == 1 || $c->showuplder == 1) { $infowidth = 150; } else { $infowidth = 0; } // load the menu name jimport( 'joomla.application.menu' ); $menu = &JMenu::getInstance('site'); $mparams = &$menu->getParams($Itemid); $mparams_pt = $mparams->get( 'page_title', ''); jimport( 'joomla.document.document' ); $doc = & JFactory::getDocument(); $active = &$menu->getActive(); if (!empty($mparams_pt)) { $metatitle = $mparams_pt; } else if (!empty($active->name)) { $metatitle = $active->name; } else { $metatitle = _HWDVIDS_META_DEFAULT; } // set the page/meta title $doc->setTitle( $metatitle." - "._HWDVIDS_META_CATS." - ".$cat->category_name ); $doc->setMetaData( 'title' , $metatitle." - "._HWDVIDS_META_CATS." - ".$cat->category_name ); hwd_vs_tools::generateActiveLink(2); hwd_vs_tools::generateBreadcrumbs($cat, $cat->category_name); $smartyvs->assign("category_id", $cat->id); $smartyvs->assign("category_name", $cat->category_name); $smartyvs->assign("category_description", $cat->category_description); $smartyvs->assign("category_nov", $cat->num_vids); if (count($rows) > 0) { $smartyvs->assign("print_videolist", 1); $list = hwd_vs_tools::generateVideoListFromSql($rows); $smartyvs->assign("list", $list); } $page = $total - $c->vpp; $pageNavigation = null; if ( $page > 0 ) { $link = "index.php?option=com_hwdvideoshare&task=viewcategory&cat_id=".$cat_id."&Itemid=".$Itemid; $pageNavigation.= $pageNav->getPagesLinks($link)."<br />"; $pageNavigation.= $pageNav->getPagesCounter(); } $smartyvs->assign("pageNavigation", $pageNavigation); if (count($subcats) > 0) { $smartyvs->assign("print_subcats", 1); $k=0; for ($i=0, $m=count($subcats); $i < $m; $i++) { $row = $subcats[$i]; $subcatlist[$i]->level = 0; $subcatlist[$i]->thumbnail = hwd_vs_tools::generateCategoryThumbnailLink( $row, $k, $c->thumbwidth, $c->thumbwidth*$c->tar_fb, null); $subcatlist[$i]->title = hwd_vs_tools::generateCategoryLink($row->id, $row->category_name); $subcatlist[$i]->num_vids = $row->num_vids; $subcatlist[$i]->num_subcats = $row->num_subcats; $subcatlist[$i]->description = hwd_vs_tools::truncateText($row->category_description, $c->truncdesc); $subcatlist[$i]->k = $k; $k = 1 - $k; } $smartyvs->assign("subcatlist", $subcatlist); } if ($c->custordering == 1) { $smartyvs->assign("print_orderselect", 1); } if (count($rows) == 0 && count($subcats) > 0) { templateSetCategoryTab('subcategories'); } else { templateSetCategoryTab('videos'); } $smartyvs->display('category_view.tpl'); return; }
/** * Generates the human readable allowed video formats string * * @return $code */ function generateVideoDetails($row, $player_width=null, $player_height=null, $thumb_width=null, $hwdvsItemid=null, $tooltip=null, $lightbox=null, $autoplay=null) { global $hwdvsItemid, $option, $mainframe, $smartyvs; $c = hwd_vs_Config::get_instance(); $my = & JFactory::getUser(); if (!isset($row->username)) { $row->username = ""; } if (!isset($row->name)) { $row->name = ""; } if (!isset($row->avatar)) { $row->avatar = null; } if ($c->cbint == 3) { $row->avatar = $row->username; } $quality = JRequest::getWord( 'quality', '' ); if (empty($quality)) { if ($c->usehq == "1" || $c->usehq == "3") { $quality = "hd"; } else if ($c->usehq == "0" || $c->usehq == "2") { $quality = "sd"; } } $details->id = intval($row->id); $details->titleText = stripslashes($row->title); $details->title = hwd_vs_tools::generateVideoLink( $row->id, $row->title, $hwdvsItemid, null, 10000 ); $details->player = hwd_vs_tools::generateVideoPlayer($row, $player_width, $player_height, $autoplay, $quality); $details->videourl = hwd_vs_tools::generateVideoUrl($row); $details->embedcode = hwd_vs_tools::generateEmbedCode($row); $details->socialbmlinks = hwd_vs_tools::generateSocialBookmarks(); $details->duration = $row->video_length; $details->ratingsystem = hwd_vs_tools::generateRatingSystem($row); $details->favouritebutton = hwd_vs_tools::generateFavouriteButton($row); $details->thumbnail = hwd_vs_tools::generateVideoThumbnailLink($row->id, $row->video_id, $row->video_type, $row->thumbnail, 0, $thumb_width, null, null, null, $hwdvsItemid, null, $tooltip, $lightbox); $details->avatar = hwd_vs_tools::generateAvatar($row->user_id, $row->avatar, 0); $details->category = hwd_vs_tools::generateCategoryLink($row->category_id); $details->description_truncated = hwd_vs_tools::truncateText($row->description, $c->trunvdesc); $details->rating = hwd_vs_tools::generateRatingImg($row->updated_rating); $details->deletevideo = hwd_vs_tools::generateDeleteVideoLink($row); $details->editvideo = hwd_vs_tools::generateEditVideoLink($row); $details->publishvideo = hwd_vs_tools::generatePublishVideoLink($row); $details->approvevideo = hwd_vs_tools::generateApproveVideoLink($row); $details->views = intval($row->number_of_views); $details->upload_date = strftime("%l%P - %b %e, %Y", strtotime($row->date_uploaded)); $details->sendToFriend = hwd_vs_tools::sendToFriend($row); $details->uploader = hwd_vs_tools::generateUserFromID($row->user_id, $row->username, $row->name); $details->k = 0; $details->addtogroup = hwd_vs_tools::generateAddToGroupButton($row); $details->nextprev = hwd_vs_tools::generateNextPrevLinks($row); $details->switchquality = hwd_vs_tools::generateSwitchQuality($row); $details->downloadoriginal = hwd_vs_tools::generateDownloadVideoLink($row); $details->vieworiginal = hwd_vs_tools::generateViewOriginalLink($row); $details->reportmedia = hwd_vs_tools::generateReportMediaButton($row); $details->tags = hwd_vs_tools::generateTagListString($row->tags); $details->favourties = hwd_vs_tools::generateFavouriteButton($row); $details->addtoplaylist = hwd_vs_tools::generateAddToPlaylistButton($row); if ($option == "com_hwdvideoshare") { $details->comments = hwd_vs_tools::generateVideoComments($row); } if ($c->showdesc == "1") { $smartyvs->assign("print_description", 1); $details->description = stripslashes($row->description); //$item = JTable::getInstance('content'); //$dispatcher = JDispatcher::getInstance(); //$params = new JParameter(''); //JPluginHelper::importPlugin('content'); //$item->parameters = new JParameter(''); //$item->text = $details->description; //// Apply content plugins to custom text //$results = $dispatcher->trigger('onPrepareContent', array ($item, $params, 0)); //$details->description = $item->text; } return $details; }