Source for file CMS_CSSSTYLE.phpclass
Documentation is available at CMS_CSSSTYLE.phpclass
* Class file CMS_CSSSTYLE.phpclass
* @project Open CSP-Management
* @author Peter Krebs <pitlinz@users.sourceforge.net>
* @copyright (c) 2002-2003 by Peter Krebs and Landesverlag Unternehmensservice
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* handels CSS Style Files
* @project Open CSP-Management
* @author Peter Krebs <pitlinz@users.sourceforge.net>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @staticvar string $myTable name of the db table
* @staticvar string $myClassSrcFile if is set the DBMS_FORM get the class object
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
* @staticvar string $myCSSClassTbl
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* cunstructor methods */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
* init the object and populates the object if aId
* if $aId is set the object is populated with the id
* if $name is set and $aId is not set the object is populated
* by calling $this::populateFromName()
* returns if populate found a row in the database
* @param int $aId id of an existing template
* @param string $gDBIDX GLOBALS database Object index
function CMS_CSSSTYLE($id=
0,$name=
"",$projId=
0,$debug=
FALSE)
} else if (!empty($name)) {
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
* returns the name of the style
* returns the javascript code for the style
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
* populates the object form the unique key STY_NAME
* @param string $gDBIDX GLOBALS database Object index
* @return mixed (int) $this->getId() or FALSE
ocsp_logError(__FILE__
,__LINE__
,"no database connection",E_ERROR);
$str_query=
$query=
"SELECT * FROM ".
$this->myTable.
" WHERE STY_NAME=".
$this->myDBObj->qs_getSlashedValue($name);
if ($arr_row=
$this->myDBObj->quickQuery($str_query))
* updates the database and clears the cache
* @param boolean $ignorPopulated (if false the table MUST have been populated)
function dbReplace($debug=
FALSE,$ignorPopulated=
FALSE)
return parent::dbReplace($debug,$ignorPopulated);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
* @param int $aId (to enable static cals if not called static $this->getId() is used)
if (isset
($GLOBALS['PROJECT']['WEBCACHEPATH'])) {
$cachFile=
$GLOBALS['PROJECT']['WEBCACHEPATH'].
"styles/0-default.css"; // default
$cachFile=
$GLOBALS['PROJECT']['WEBCACHEPATH'].
"styles/".
$aId.
"-default.css"; // project default
$cachFile=
$GLOBALS['PROJECT']['WEBCACHEPATH'].
"styles/".
$int_projId.
"-id-".
$aId.
".css";
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
* resorts the classes of the style
ocsp_logError(__FILE__
,__LINE__
,"no database connection",E_ERROR);
$s_query.=
" ORDER BY PROJ_ID,CSS_ORDERNR";
if ($o_cursor=
$this->myDBObj->query($s_query)) {
while($a_row=
$o_cursor->fetchArrayFld()) {
if (intval($a_row['PROJ_ID']) !=
$i_projId) {
$i_ordNr=
1;$i_projId=
intval($a_row['PROJ_ID']);
if (intval($a_row['CSS_ORDERNR']) !=
$i_ordNr)
$a_row['CSS_ORDERNR'] =
$i_ordNr;
$a_row['CSS_LASTCHANGE'] =
$this->myDBObj->qs_getNowStmt();
if ($debug) echoDebug(__FILE__
,"ERROR in Query: $s_query");
* returns the css code for the style
function getCSSCode($media=
"",$projId=-
1,$debug=
FALSE)
ocsp_logError(__FILE__
,__LINE__
,"no database connection",E_ERROR);
if (!empty($s_cssTxtCode))
$s_ret.=
"/* __STY_TEXT__START__ */\n".
$s_cssTxtCode.
"\n/* __STY_TEXT__END__ */\n";
$s_query.=
" WHERE STY_ID=".
$this->getId();
if (!empty($media) &&
(strtoupper($media) !=
"ALL"))
$s_query.=
" AND CSS_MEDIA=".
$this->myDBObj->qs_getSlashedValue($media);
$s_query.=
" AND PROJ_ID=".
intval($projId);
$s_query.=
" ORDER BY CSS_ORDERNR,CSS_MEDIA";
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"<p>Query: $s_query</p>");
if ($o_cssCursor=
$this->myDBObj->query($s_query))
$s_aktMedia=
"";$b_mediaOpen=
FALSE;
while($a_css=
$o_cssCursor->fetchArrayFld())
if (empty($a_css['CSS_MEDIA'])) $a_css['CSS_MEDIA']=
"all"; // ensure all is set
if ($a_css['CSS_MEDIA'] !=
$s_aktMedia)
if ($b_mediaOpen) // close it
$s_aktMedia=
$a_css['CSS_MEDIA'];
$s_ret.=
"@media ".
$s_aktMedia.
" {\n";
$s_ret.=
"\t".
trim($a_css['CSS_NAME']).
" {\n";
foreach($a_defLines as $s_line)
if (!empty($s_line)) $s_ret.=
"\t\t".
trim($s_line).
";\n";
* returns an array with the css definitinons
ocsp_logError(__FILE__
,__LINE__
,"no database connection",E_ERROR);
$s_query.=
" WHERE STY_ID=".
$this->getId();
$s_query.=
" ORDER BY CSS_ORDERNR,CSS_MEDIA";
if ($obj_cursor=
$this->myDBObj->query($s_query))
while($arr_Row=
$obj_cursor->fetchArrayFld())
if ($arr_tmp=
explode(";",$arr_Row['CSS_DEFINITION']))
foreach($arr_tmp as $str_line)
$str_def.=
$c_sep.
trim($str_line);
'CSS_NAME' =>
$arr_Row['CSS_NAME'],
'CSS_BROWSER' =>
$arr_Row['CSS_BROWSER'],
'CSS_MEDIA' =>
$arr_Row['CSS_MEDIA'],
'PROJ_ID' =>
$arr_Row['PROJ_ID'],
'CSS_DEFINITION'=>
$str_def
Documentation generated on Thu, 08 Jan 2009 17:38:48 +0100 by phpDocumentor 1.4.0a2