<?php
//v1.0.4 www.bcoos.net 2006/10 GPL
// exoops.info Licence: GPL
function b_partner_img_show($options) {
	global $db, $myts;
	
	$block  = array();
	$block['title'] = _MB_PARTNER_TITLE1;
	
	$block['content'] = "";
	$sql = "SELECT url, image, title FROM ".$db->prefix("partner")." WHERE status='1' ";
	if ($options[1] == 1) { $sql .= "ORDER BY RAND() "; }
	$sql .= " LIMIT ".$options[0]; 
	$result = $db->query($sql);
	$block['content'] .= "<table cellspacing='5' >";
	while ($row = $db->fetchRow($result)) {
		list ($url, $image, $title) = $row;
		$block['content'] .= "<tr><td><a href='".$url."'><img src='".XOOPS_URL."/modules/partner/cache/images/".$image."' alt='".$title."' ></a></td></tr>";
	} 
	$block['content'] .= "</table>";
return $block;
}
function b_partner_img_edit($options) {
global $db;
	$form = "<table border='0'>";
	$form .= "<tr><td>"._LIMIT."</td><td><input type='text' class='text' size='3' maxlength='2' name='options[0]' value='".$options[0]."'></td></tr>";
	$form .=  "<tr><td>"._MB_PARTNER_RAND."</td><td>";
	
	$chk   = "";
	if ($options[1] == 0) { $chk = " checked='checked'"; }
	$form .= "<input type='radio' class='radio' name='options[1]' value='0'".$chk." />"._NO."";
	$chk   = "";
	if ($options[1] == 1) { $chk = " checked='checked'"; }
	$form .= "<input type='radio' class='radio' name='options[1]' value='1'".$chk." />"._YES."</td></tr></table>";
return $form;
}
function b_partner_text_show($options) {
global $db, $myts;
	$block  = array();
	$block['title'] = _MB_PARTNER_TITLE1;
	
	$block['content'] = "";
	$sql = "SELECT url, title FROM ".$db->prefix("partner")." WHERE status='1' ";
	if ($options[1] == 1) { $sql .= "ORDER BY RAND()"; }
	$sql .= " LIMIT ".$options[0]; 
	$result = $db->query($sql);
	while ($row = $db->fetchRow($result)) {
		list ($url, $title) = $row;
		$block['content'] .= "&nbsp;<strong><big>&middot;</big></strong> <a href='".$url."'>".$title."</a><br />";
	} 
		
return $block;
}
function b_partner_text_edit($options) {
global $db;
	$form = "<table border='0'>";
	$form .= "<tr><td>"._LIMIT."</td><td><input type='text' class='text' size='3' maxlength='2' name='options[0]' value='".$options[0]."'></td></tr>";
	$form .=  "<tr><td>"._MB_PARTNER_RAND."</td><td>";
	
	$chk   = "";
	if ($options[1] == 0) { $chk = " checked='checked'"; }
	$form .= "<input type='radio' class='radio' name='options[1]' value='0'".$chk." />"._NO."";
	$chk   = "";
	if ($options[1] == 1) { $chk = " checked='checked'"; }
	$form .= "<input type='radio' class='radio' name='options[1]' value='1'".$chk." />"._YES."</td></tr></table>";
return $form;
}
?>
