Location: PHPKode > projects > ChiCoMaS - Chilek CMS > chicomas/modules/style/functions.php
<?
function CreateCSSFile($CStyle){

	$style_id = $CStyle->style_id;
	$name = $CStyle->name;
	$bgcol = $CStyle->bgcol;
	$bgim = $CStyle->bgim;
	$bgrep = $CStyle->bgrep;
	$bgpos = $CStyle->bgpos;
	$font = $CStyle->font;
	$fsize = $CStyle->fsize;
	if ($fsize>16)
		$fsize = $fsize."%";
	$fcol = $CStyle->fcol;
	$hsize = $CStyle->hsize;
	
	$hcol = $CStyle->hcol;
	$hbgcol = $CStyle->hbgcol;
	$hbgim = $CStyle->hbgim;
	$hbgrep = $CStyle->hbgrep;
	$hbgpos = $CStyle->hbgpos;
	$docbgcol = $CStyle->docbgcol;
	$docbgim = $CStyle->docbgim;
	$docbgrep = $CStyle->docbgrep;
	$docbgpos = $CStyle->docbgpos;
	$docborstyle = $CStyle->docborstyle;
	
	$docborw = $CStyle->docborw;
	$docborcol = $CStyle->docborcol;
	$mmbgcol = $CStyle->mmbgcol;
	$mmborstyle = $CStyle->mmborstyle;
	$mmborw = $CStyle->mmborw;
	$mmborcol = $CStyle->mmborcol;
	$mmfcol = $CStyle->mmfcol;
	$mmhcol = $CStyle->mmhcol;
	$smbgcol = $CStyle->smbgcol;
	$smborstyle = $CStyle->smborstyle;
	$smborw = $CStyle->smborw;
	
	$smborcol = $CStyle->smborcol;
	$smfcol = $CStyle->smfcol;
	$smhcol = $CStyle->smhcol;
	$ah = $CStyle->ah;
	$al = $CStyle->al;
	$av = $CStyle->av;
	$active = $CStyle->active;

	/* Define the style sheet elements */
	$body="\nbody {margin:5px; background-color:$bgcol; ";
	if ($bgim!=""){
		$body.="background-image:url('$bgim'); background-repeat:$bgrep; background-position:$bgpos;";
	}
	$body.="vertical-align:top}\n";
	
	$headers = "\nh3{color: $fcol;}\n";

	$headers .= "\nh4{color: $fcol;}\n";

	$tables = "\ntable {border-collapse:collapse}\n";
	
	$tables .= "\ntd {font-family: $font; font-size:$fsize; color:$fcol; border-width:0px}\n";
	
	$head="\n#head td {font-size:$fsize; color:$hcol; background-color: $hbgcol;";
	
	if ($hbgim!="")
		$head.="background-image:url('$hbgim'); background-repeat:$hbgrep; background-position: $hbgpos;";
	$head.="}\n";
	
	$head.="\n#head a {color:$hcol;}\n";

	$head.="\n#head a:hover {color:$hcol; text-decoration:none}\n";

	$head.="\n#head a:link {color:$hcol; text-decoration:none}\n";

	$head.="\n#head a:visited {color:$hcol; text-decoration:none}\n";
	
	$doctable="\n.indocument {border: $docborstyle $docborw $docborcol; background-color:$docbgcol;";
	
	if ($docbgim!="")
		$doctable.="background-image:url('$docbgim'); background-repeat:$docbgrep; background-position: $docbgpos;";
	$doctable.="}\n";

	$doctd="\n.document {border: $docborstyle $docborw $docborcol}\n";

	$a="\na {font-family:$font; font-size:$fsize; text-decoration:none}\n";

	$ah="\na:hover {color:$ah; text-decoration:underline}\n";

	$al="\na:link {color:$al}\n";

	$av="\na:visited {color:$av}\n";

	$dhtmlmenu = "\n#dhtmlgoodies_menu{font-family:$font; font-size:$fsize; width:160px;}\n";

	$dhtmlmenu .= "\n#dhtmlgoodies_menu li{list-style-type:none; margin:0px;}\n";

	$dhtmlmenu .= "\n#dhtmlgoodies_menu ul{margin:0px; padding:0px;}\n";

	$dhtmlmenu .= "\n#dhtmlgoodies_menu ul li ul{padding-left:10px;}\n";

	$dhtmlmenu .= "\n#dhtmlgoodies_menu	li a{text-decoration:none; color:$mmfcol; height:20px; line-height:20px; vertical-align:middle; border:$mmborstyle $mmborw $mmborcol; background-color:$mmbgcol; margin:1px; padding:1px; display:block;}\n";
	
	$dhtmlmenu .= "\n#dhtmlgoodies_menu	li a:hover,#dhtmlgoodies_menu .activeMainMenuItem{color:#FFF; background-color:$mmhcol;}\n";	
	
	$dhtmlmenu .= "\n.dhtmlgoodies_subMenu{font-family:$font; font-size:$fsize; visibility:hidden; position:absolute; overflow:hidden; border:$smborstyle $smborw $smborcol; background-color:$smbgcol;}\n";

	$dhtmlmenu .= "\n.dhtmlgoodies_subMenu ul{font-family:$font; font-size:$fsize; margin:0px; padding:0px;}\n";

	$dhtmlmenu .= "\n.dhtmlgoodies_subMenu ul li{list-style-type:none; margin:0px; padding:1px;}\n";

	$dhtmlmenu .= "\n.dhtmlgoodies_subMenu ul li a{white-space:nowrap; text-decoration:none; color:$smfcol; height:16px; line-height:16px; padding:1px; display:block;}\n";

	$dhtmlmenu .= "\n.dhtmlgoodies_subMenu ul li a:hover{color:#FFF; background-color:$smhcol;}\n";

	$flags = "\nimg.flags {float:right; width:25px; margin:2px 2px 2px 2px; padding:1px; border:0px solid black; text-align:center;}\n";

	$mainpages = "\np.mainpages {float:left; margin:2px 2px 2px 2px; padding:0px; text-align:left; font-size:$fsize;}\n";

	$subpages = "\np.subpages {float:right; margin:0px 0px 0px 0px; padding:0px; text-align:left;}\n";

	$topmenu = "\np.topmenu {float:left; margin:2px 8px 2px 8px; padding:1px; text-align:left;}\n";

	$navlist = "\n#navlist{ padding: 2px 0; margin-left: 0; border-bottom: 1px solid #778; font: bold 12px; font-family:$font; }\n";

	$navlist .= "\n#navlist li{ list-style: none; margin: 0; display: inline; }\n";

	$navlist .= "\n#navlist li a{ padding: 2px 0.5em; margin-left: 3px; border: 1px solid #778; border-bottom: none; background: #DDE; text-decoration: none; }\n";

	$navlist .= "\n#navlist li a:link { color: #448; }\n";

	$navlist .= "\n#navlist li a:visited { color: #667; }\n";

	$navlist .= "\n#navlist li a:hover{ color: #000; background: #AAE; border-color: #227; }\n";

	$navlist .= "\n#navlist li a#current{ background: white; border-bottom: 1px solid white; }\n";

	$button = "\n.inline-button { _width:12em; font: bold $fsize/1 $font; margin: 0 0.2em; padding: 0.1em 0; _padding:0; border: 1px solid black; white-space:nowrap; text-decoration: none; vertical-align:middle; background: #ccc; color: black; text-align:center; }\n";

	$button .= "\n.inline-button em { _width:1em; _cursor:hand; font-style: normal; margin:0; padding: 0.1em 0.5em; background: white; color: black; }\n";

	$button .= "\n.inline-button span { _width:1em; _cursor:hand; margin:0; padding: 0.1em 0.5em 0.1em 0.3em; }\n";

	$button .= "\n.inline-button:hover { background: #666; color: white; }\n";

	$button .= "\n.inline-button:hover em { background: black; color: white; }\n";

	$button .= "\n.orange { background: orange; color: black; }\n";

	$button .= "\n.orange em { background: white; color: #c60; }\n";

	$button .= "\n.blue { background: #06c; color: white }\n";

	$button .= "\n.blue em { background: white; color: #06c }\n";

	$button .= "\n.green { background: green; color: white }\n";

	$button .= "\n.green em { background: white; color: green }\n";

	$forms .= "\nlabel{ float: left; text-align: justify; margin-right: 1.5em display: block; font-size:$fsize; }\n";

	$forms .= "\ninput { color: #781351; background: #fee3ad; border: 1px solid #781351; cursor:auto ; font-size:$fsize; float: center; text-align: left; }\n";

	$forms .= "\ntextarea { background-color: #fee3ad; border: #781351 1px solid; color: #781351; font-family:$font; font-size: $fsize; font-weight: normal }\n";

	$forms .= "\nselect { background-color: #fee3ad; border: #781351 1px solid; color: #781351; font-family:$font; font-size: $fsize; font-weight: normal }\n";

	$forms .= "\n.submit input { margin-left: 4.5em; color: #000; background: #ffa20f; cursor:pointer; border: 2px outset #d7b9c9 }\n";

	$forms .= "\n.submitimage { border: 0px; background-color:$docbgcol; margin:0.1em 0.1em 0.1em 0.1em; position:absolute; }\n";

	$forms .= "\nfieldset { border: 1px solid $mmborcol; padding: 2px 2px; font-size:$fsize; }\n";

	$forms .= "\nlegend { color:$mmfcol; background:$mmbgcol; border: 1px solid $mmborcol; padding: 2px 6px; font-size:$fsize; }\n";

	$notes = "\n.note { background-color: $docbgcol; font-family:$font; padding-bottom: 1em; border: 1px #cce solid; margin-top: 1em; text-align:center; }\n";

	$notes .= "\n.note h3 { background-color: #ffa20c; font-family:$font; color: #339; padding: 0.25em 1em; border-bottom: 2px white solid; margin-top: 0; }\n";

	$notes .= "\n.note p { padding: 0 1em; }\n";

	$notes .= "\n.note pre { margin: 1em 1em 0 1em; }\n";

	$codes = "\ncode { color: #900; font-family:$font; font-size:$fsize; text-align:left;}\n";

	$codes .= "\npre { background-color: #ddd; white-space: normal; font: 1em $font; padding: 0 1em 1em 1em; border: 2px #222 dotted; margin-top: 1em; overflow: auto; width: 100%; width: auto; float=left;}\n";

	$codes .= "\npre strong { color: #c00; }\n";

	$codes .= "\npre code { display: block; color: black; padding: 1em 0 0 0; margin: 0; }\n";

	$codes .= "\npre .m1 { margin-left: 2em; }\n";

	$codes .= "\npre .m2 { margin-left: 4em; }\n";

	$codes .= "\npre .m3 { margin-left: 6em; }\n";

	$codes .= "\npre .m4 { margin-left: 8em; }\n";

	$codes .= "\npre .m5 { margin-left: 10em; }\n";

	$codes .= "\npre .m6 { margin-left: 12em; }\n";

	$others .= "\n.dropcap { float: left; font: normal 60pt/0.8em $font; color: chocolate; margin-right: 3px; }\n";

	$others .= "\n.rowdata { background-color: #EAECEE; }\n";

	$others .= "\n.rowdatasel { background-color: #D8E1EB; }\n";

	$others .= "\nsmall { font-size: 10; }\n";

//	$codes .= "\n\n";

	$thesheet="$body $headers $tables $head $doctable $doctd $a $ah $al $av $dhtmlmenu $flags $mainpages $subpages $topmenu $navlist $button $forms $notes $codes $others";
	
	$style_file="./style.css";
	$handle=fopen($style_file,"w");
	fwrite($handle,$thesheet);
	fclose($handle);

}


function CreateCSSEditFile($CStyle){
	$style_id = $CStyle->style_id;
	$name = $CStyle->name;
	$bgcol = $CStyle->bgcol;
	$bgim = $CStyle->bgim;
	$bgrep = $CStyle->bgrep;
	$bgpos = $CStyle->bgpos;
	$font = $CStyle->font;
	$fsize = $CStyle->fsize;
	if ($fsize>16)
		$fsize = $fsize."%";
	$fcol = $CStyle->fcol;
	$hsize = $CStyle->hsize;
	
	$hcol = $CStyle->hcol;
	$hbgcol = $CStyle->hbgcol;
	$hbgim = $CStyle->hbgim;
	$hbgrep = $CStyle->hbgrep;
	$hbgpos = $CStyle->hbgpos;
	$docbgcol = $CStyle->docbgcol;
	$docbgim = $CStyle->docbgim;
	$docbgrep = $CStyle->docbgrep;
	$docbgpos = $CStyle->docbgpos;
	$docborstyle = $CStyle->docborstyle;
	
	$docborw = $CStyle->docborw;
	$docborcol = $CStyle->docborcol;
	$mmbgcol = $CStyle->mmbgcol;
	$mmborstyle = $CStyle->mmborstyle;
	$mmborw = $CStyle->mmborw;
	$mmborcol = $CStyle->mmborcol;
	$mmfcol = $CStyle->mmfcol;
	$mmhcol = $CStyle->mmhcol;
	$smbgcol = $CStyle->smbgcol;
	$smborstyle = $CStyle->smborstyle;
	$smborw = $CStyle->smborw;
	
	$smborcol = $CStyle->smborcol;
	$smfcol = $CStyle->smfcol;
	$smhcol = $CStyle->smhcol;
	$ah = $CStyle->ah;
	$al = $CStyle->al;
	$av = $CStyle->av;
	$active = $CStyle->active;

	$body="body {margin:5px; background-color:$docbgcol; ";
	if ($docbgim!=""){
		$docbgim=str_replace("./","../",$docbgim);
		$body.="background-image:url('$docbgim'); background-repeat:$docbgrep; background-position:$docbgpos;";
	}
	$body.="vertical-align:top; font-family: $font; font-size: $fsize; color:$fcol}";
	
	$table="table {border-collapse: collapse}";
	
	$a="a {font-family:$font; font-size:$fsize; text-decoration:none; color:$al}";
	
	$theeditsheet="$body \n $table \n $a \n $ahe \n $ale \n $ave";
	
	$handle=fopen("./styleedit.css","w");
	fwrite($handle, $theeditsheet);
	fclose($handle);
}

?>
Return current item: ChiCoMaS - Chilek CMS