Example #1
0
   /**
	* feature/unfeature groups
	*/
	function featureg($cid=null, $publish=1)
	{
		global $option;
  		$db =& JFactory::getDBO();
		$my = & JFactory::getUser();
		$app = & JFactory::getApplication();

		if (count( $cid ) < 1) {
			$action = $publish == 1 ? 'featureg' : ($publish == -1 ? 'archive' : 'unfeatureg');
			echo "<script> alert('Select an item to $action'); window.history.go(-1);</script>\n";
			exit;
		}

		$total = count ( $cid );
		$cids = implode( ',', $cid );

		$db->setQuery( "UPDATE #__hwdvidsgroups"
						. "\nSET featured =" . intval( $publish )
						. "\n WHERE id IN ( $cids )"
						. "\n AND ( checked_out = 0 OR ( checked_out = $my->id ) )"
						);
		if (!$db->query()) {
			echo "<script> alert('".$db->getErrorMsg()."'); window.history.go(-1); </script>\n";
			exit();
		}

		switch ( $publish ) {
			case 1:
				$msg = $total ._HWDVIDS_ALERT_ADMIN_GFEAT." ";
				break;

			case 0:
			default:
				$msg = $total ._HWDVIDS_ALERT_ADMIN_GUNFEAT." ";
				break;
		}

		if (count( $cid ) == 1) {
			$row = new hwdvids_group( $db );
			$row->checkin( $cid[0] );
		}

		$app->enqueueMessage($msg);
		$app->redirect( JURI::root( true ) . '/administrator/index.php?option='.$option.'&task=groups' );
	}
Example #2
0
    /**
     * Outputs frontpage HTML
     *
     * @return       Nothing
     */
    function editGroup()
	{
		global $mosConfig_live_site, $mainframe, $Itemid;
		$c = hwd_vs_Config::get_instance();
		$db = & JFactory::getDBO();
		$my = & JFactory::getUser();
		$acl= & JFactory::getACL();

		if (!hwd_vs_access::checkAccess($c->gtree_grup, $c->gtree_grup_child, 4, 0, _HWDVIDS_TITLE_NOACCESS, _HWDVIDS_ALERT_REGISTERFORGRUP, _HWDVIDS_ALERT_GRUP_NOT_AUTHORIZED, "exclamation.png", 0, "core.frontend.group")) {return;}

		$groupid = JRequest::getInt( 'groupid', 0 );

		$row = new hwdvids_group($db);
		$row->load( $groupid );

		//check valid user
		if ($row->adminid != $my->id) {
			$mainframe->enqueueMessage(_HWDVIDS_ALERT_NOPERM);
			$mainframe->redirect( JURI::root() . 'index.php?option=com_hwdvideoshare&task=groups&Itemid='.$Itemid );
		}

		//Videos that are approved(converted) and published in this group
		$query = 'SELECT user.*, mem.memberid'
				. ' FROM #__hwdvidsgroup_membership AS `mem`'
				. ' LEFT JOIN #__hwdvidsgroups AS `group` ON mem.groupid = group.id'
				. ' LEFT JOIN #__users AS `user` ON user.id = mem.memberid'
				. ' WHERE mem.groupid = '.$row->id
				;
		$db->SetQuery($query);
		$grp_members = $db->loadObjectList();
		echo $db->getErrorMsg();

		hwd_vs_html::editGroupInfo($row, $grp_members);
  	}