* @package BcWe core
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
*/
$module["panel"]["name"]="Panel Class";
$module["panel"]["ver"]="0.3.5";
class panel {
var $sidebar="";
var $page="";
var $bodyext="";
var $title="";
var $content="";
var $meta="";
var $form="";
var $foot="";
var $head="";
var $menu_items ="";
function page($additional_title="",$meta=""){
global $config,$db,$core;
return '
'.$config['sitetitle'].'
'.$this->meta.'
bodyext.'>
'.$this->menu().'
'.$this->page.'
'.$this->foot.'
';
}
function parse_page(){
$this->page.="".$this->title."
".$this->content."
";
$this->title="";
$this->content="";
echo $this->page();
exit();
}
function menu_item($panel,$text, $img=""){
global $config, $userdata, $userinfo, $session, $meta;
if($panel=="group_only"){
$this->menu_items.="".$text." ";
}elseif($panel=="admin_home"){
$this->menu_items.=" ".$text." ";
}elseif($panel=="page_home"){
$this->menu_items.=" ".$text." ";
}else{
if($img!=""){
$this->menu_items.=" ".$text." ";
}else{
$this->menu_items.="".$text." ";
}
}
}
function admin_message($title,$message,$redirect=FALSE,$panel="",$time="4"){
global $config,$session,$lang;
$session->page_begin("Admin Message", True);
if($panel!="" && $redirect){
$this->content=$message."".$lang->_('CLICKREDIRECT')." ";
}elseif($panel!="" && !$redirect){
$this->content=$message."".$lang->_('CLICKCONTINUE')." ";
}else{
$this->content=$message;
}
if($redirect && $panel!="")
$this->meta.=" ";
$this->title=$title;
$this->parse_page();
}
function menu(){
return '';
}
function form ($args = array(),$return=FALSE,$extra=""){
$method = $args["method"] ? $args["method"] : 'post';
$action = $args["action"] ? $args["action"] : $_SERVER['PHP_SELF'];
$form = '';
if(!$return){
$this->content .= $form;
}else{
return $form;
}
}
function button ($text = '', $name='', $extra='', $return=FALSE)
{
$fld = ' ';
if(!$return){
$this->content .= $fld;
}else{
return $fld;
}
}
function radio ($args=array(),$extra="",$return=FALSE)
{
$name = $args["name"] ? $args["name"] : 'radiobutton';
$value = $args["value"];
if($value!=""){
$extra .= ' value="'.$value.'"';
}
$fld=$this->radioOrCheck ("radio",$name,$extra,$return);
if($return){
return $fld;
}
}
function checkbox ($args=array(),$extra="",$return=FALSE)
{
$name = $args["name"] ? $args["name"] : 'checkbox';
$value = $args["value"];
if($value!=""){
$extra .= ' value="'.$value.'"';
}
$fld=$this->radioOrCheck ("checkbox",$name,$extra,$return);
if($return){
return $fld;
}
}
/* private */
function radioOrCheck ($type,$name="",$extra="",$return=FALSE)
{
$fld = ' ';
if(!$return){
$this->content .= $fld;
}else{
return $fld;
}
}
function field ($args=array(),$extra="",$return=FALSE)
{
$typ = $args["typ"] ? $args["typ"] : 'text';
$name = $args["name"] ? $args["name"] : 'textfield';
$value = $args["value"] ? $args["value"] : '';
$fld = ' '; // html: form field
if(!$return){
$this->content .= $fld;
}else{
return $fld;
}
}
function submit ($args=array(),$extra="",$return=FALSE)
{
$name = $args["name"] ? $args["name"] : 'submit';
$fld = ' '; // html: form submit button
if(!$return){
$this->content .= $fld;
}else{
return $fld;
}
}
/*
$args[value] used for default text (as in "field" function)
*/
function textarea ($args = array(),$extra="",$return=FALSE)
{
$name = $args["name"] ? $args["name"] : 'field';
$rows = $args["rows"] ? $args["rows"] : '3';
$cols = $args["cols"] ? $args["cols"] : '30';
$text = $args["value"] ? $args["value"] : '';
$fld = '';
if(!$return){
$this->content .= $fld;
}else{
return $fld;
}
}
/*
$values = array containing values (key = processing value, data = displaying value)
*/
function select ($values=array(),$selected="",$name="",$extra="",$return=FALSE)
{
$fld='';
foreach($values as $name=>$val){
if($val==$selected){
$fld.=''.$name.' ';
}else{
$fld.=''.$name.' ';
}
}
$fld.=" ";
if(!$return){
$this->content .= $fld;
}else{
return $fld;
}
}
}
?>