Initial checkin
This commit is contained in:
commit
d75eb444fc
4304 changed files with 369634 additions and 0 deletions
252
inc/panel.class.php
Normal file
252
inc/panel.class.php
Normal file
|
@ -0,0 +1,252 @@
|
|||
<?php
|
||||
/**
|
||||
* Project: BeCast Webengine - simple site engine
|
||||
* File: /inc/panel.class.php
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* @link http://www.becast.at
|
||||
* @copyright 2009 becast.at
|
||||
* @author Bernhard Jaud <bernhard at becast dot at>
|
||||
* @package BeCast Webengine core
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
* @version $Id: panel.class.php 128 2010-02-21 22:03:37Z genuineparts $
|
||||
*/
|
||||
|
||||
$module["panel"]["name"]="Panel Class";
|
||||
$module["panel"]["ver"]="0.3.4";
|
||||
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 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>'.$config['sitetitle'].'</title>
|
||||
<link rel="stylesheet" type="text/css" href="admin.css" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
'.$this->meta.'
|
||||
</head>
|
||||
<body '.$this->bodyext.'>
|
||||
<div id="container">
|
||||
'.$this->menu().'
|
||||
<div id="content">
|
||||
'.$this->page.'
|
||||
</div>
|
||||
<div id="footer">
|
||||
© 2016 - 2025 Becast.at | mySQL Queries: '.$db->querys().'
|
||||
<br/>
|
||||
Powered by
|
||||
<a href="http://www.becast.at">BeCast WebEngine</a>
|
||||
'.$core->ver_major.'.'.$core->ver_minor.".".$core->ver_rev.' - '.$core->ver_codename.'
|
||||
</div>
|
||||
</div>
|
||||
'.$this->foot.'
|
||||
</body>
|
||||
</html>';
|
||||
}
|
||||
|
||||
function parse_page(){
|
||||
$this->page.="<h2>".$this->title."</h2>
|
||||
<p>".$this->content."</p>";
|
||||
$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.="<li><strong>".$text."</strong></li>";
|
||||
}elseif($panel=="admin_home"){
|
||||
$this->menu_items.="<li><a href=\"".$config["path"]."/admin/index.php\"><img src=\"".$config["path"]."/admin/images/icons/".$img.".png\" /> ".$text."</a></li>";
|
||||
}elseif($panel=="page_home"){
|
||||
$this->menu_items.="<li><a href=\"".$config["path"]."/index.php\"><img src=\"".$config["path"]."/admin/images/icons/".$img.".png\" /> ".$text."</a></li>";
|
||||
}else{
|
||||
if($img!=""){
|
||||
$this->menu_items.="<li><a href=\"".$config["path"]."/admin/index.php?panel=".$panel."\"><img src=\"".$config["path"]."/admin/images/icons/".$img.".png\" /> ".$text."</a></li>";
|
||||
}else{
|
||||
$this->menu_items.="<li><a href=\"".$config["path"]."/admin/index.php?panel=".$panel."\">".$text."</a></li>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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."<br /><a href=\"".$config["path"]."/admin/index.php?panel=".$panel."\">".$lang->_('CLICKREDIRECT')."</a>";
|
||||
}elseif($panel!="" && !$redirect){
|
||||
$this->content=$message."<br /><a href=\"".$config["path"]."/admin/index.php?panel=".$panel."\">".$lang->_('CLICKCONTINUE')."</a>";
|
||||
}else{
|
||||
$this->content=$message;
|
||||
}
|
||||
if($redirect && $panel!="")
|
||||
$this->meta.="<meta http-equiv=\"refresh\" content=\"".$time."; URL=".$config["path"]."/admin/index.php?panel=".$panel."\" />";
|
||||
$this->title=$title;
|
||||
$this->parse_page();
|
||||
|
||||
}
|
||||
|
||||
function menu(){
|
||||
|
||||
return '<div id="menu">
|
||||
<ul>'.$this->menu_items.'</ul></div>';
|
||||
|
||||
}
|
||||
|
||||
function form ($args = array(),$return=FALSE,$extra=""){
|
||||
|
||||
$method = $args["method"] ? $args["method"] : 'post';
|
||||
$action = $args["action"] ? $args["action"] : $_SERVER['PHP_SELF'];
|
||||
$form = '<form action="' .$action. '" method="' .$method. '"' .$extra. '>';
|
||||
if(!$return){
|
||||
$this->content .= $form;
|
||||
}else{
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
function formClose ()
|
||||
{
|
||||
|
||||
$form = '</form>';
|
||||
if(!$return){
|
||||
$this->content .= $form;
|
||||
}else{
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
|
||||
function button ($text = '', $name='', $extra='', $return=FALSE)
|
||||
{
|
||||
|
||||
$fld = '<input type="button" name="'.$name.'" value="'.$text.'" ' .$extra. ' />';
|
||||
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 = '<input type="'.$type.'" name="'.$name.'" ' .$extra. ' />';
|
||||
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 = '<input type="' .$typ. '" name="' .$name. '" value="' .$value. '"' .$extra. ' />'; // 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 = '<input type="submit" name="'.$name.'" ' .$extra. ' />'; // 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 = '<textarea name="' .$name. '" rows="' .$rows. '" cols="' .$cols. '"' .$extra. '>' .$text. '</textarea>';
|
||||
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='<select name="'.$name.'" '.$extra.'>';
|
||||
foreach($values as $name=>$val){
|
||||
if($val==$selected){
|
||||
$fld.='<option value="'.$val.'" selected="selected">'.$name.'</option>';
|
||||
}else{
|
||||
$fld.='<option value="'.$val.'">'.$name.'</option>';
|
||||
}
|
||||
}
|
||||
$fld.="</select>";
|
||||
if(!$return){
|
||||
$this->content .= $fld;
|
||||
}else{
|
||||
return $fld;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue