Esempio n. 1
0
    /**
     *
     */
    function viewGroup($rows, $pageNav, $total, $members, $groupdetails)
    {
		global $mainframe, $Itemid, $smartyvs;
		$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_GRPS." - ".$groupdetails->group_name );
		$doc->setMetaData( 'title' , $metatitle." - "._HWDVIDS_META_GRPS." - ".$groupdetails->group_name );
		hwd_vs_tools::generateActiveLink(3);
		hwd_vs_tools::generateBreadcrumbs();

		$smartyvs->assign("group_name", stripslashes($groupdetails->group_name));
		$smartyvs->assign("group_description", stripslashes($groupdetails->group_description));


		$group->totalmembers = $groupdetails->total_members;
		$group->totalvideos = $groupdetails->total_videos;
		$group->administrator = hwd_vs_tools::generateUserFromID($groupdetails->adminid, $groupdetails->username, $groupdetails->name);


		$group->groupmembership = hwd_vs_tools::generateGroupMembershipStatus($groupdetails);
		$group->reportgroup = hwd_vs_tools::generateReportGroupButton($groupdetails);
		$group->deletegroup = hwd_vs_tools::generateDeleteGroupButton($groupdetails);
		$group->editgroup = hwd_vs_tools::generateEditGroupButton($groupdetails);

		$smartyvs->assign("group", $group);




		if (count($members) > 0) {
			$smartyvs->assign("print_memberslist", 1);

			for ($i=0, $n=count($members); $i < $n; $i++) {
				$row = $members[$i];
				$memberslist[$i]->id = $row->id;
				$memberslist[$i]->username = $row->username;
			}

			$smartyvs->assign("memberslist", $memberslist);
		}



		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&Itemid=".$Itemid."&task=viewgroup&group_id=".$groupdetails->id;
			$pageNavigation.= $pageNav->getPagesLinks($link)."<br />";
			$pageNavigation.= $pageNav->getPagesCounter();
		}
		$smartyvs->assign("pageNavigation", $pageNavigation);











		$group->comments = hwd_vs_tools::generateGroupComments($groupdetails);

		$smartyvs->display('group_view.tpl');
		return;



    }
    /**
     * Generates the array of information for a standard group list from sql queries
     *
     * @param array  $rows  the list from a standard sql queries
     * @return       $code  the array prepared for Smarty template
     */
	function generateGroupListFromSql( $rows )
	{
		global $hwdvsItemid;
		$c = hwd_vs_Config::get_instance();

		$code = array();
		$k = 0;
		for ($i=0, $n=count($rows); $i < $n; $i++) {
			$row = $rows[$i];

			if (!isset($row->avatar)) { $row->avatar=null; }

			$code[$i]->thumbnail = hwd_vs_tools::generateGroupThumbnailLink($row, $k, null, null, null);
			$code[$i]->avatar = hwd_vs_tools::generateAvatar($row->adminid, $row->avatar, $k, null, null, null);
			$code[$i]->grouptitle = hwd_vs_tools::generateGroupLink($row->id, $row->group_name);
			$code[$i]->groupdescription = hwd_vs_tools::truncateText(strip_tags($row->group_description), $c->trunvdesc);
			$code[$i]->totalmembers = $row->total_members;
			$code[$i]->totalvideos = $row->total_videos;
			$code[$i]->administrator = hwd_vs_tools::generateUserFromID($row->adminid, $row->username, $row->name);
			$code[$i]->groupmembership = hwd_vs_tools::generateGroupMembershipStatus($row);
			$code[$i]->reportgroup = hwd_vs_tools::generateReportGroupButton($row);
			$code[$i]->datecreated = $row->date;
			$code[$i]->deletegroup = hwd_vs_tools::generateDeleteGroupLink($row);
			$code[$i]->editgroup = hwd_vs_tools::generateEditGroupLink($row);
			$code[$i]->k = $k;
			$k = 1 - $k;
		}
		return $code;
    }