Source for file CMS_CSSCLASS.phpclass
Documentation is available at CMS_CSSCLASS.phpclass
* Class file CMS_CSSSTYLE.phpclass
* @project Open CSP-Management
* @author Peter Krebs <pitlinz@users.sourceforge.net>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: CMS_CSSCLASS.phpclass,v 1.4 2008/06/20 15:29:53 pitlinz Exp $
* @requires CMS_TABLEOBJ.phpclass
* @requires CMS_CSSSTYLE.phpclass
* handels CSS Class 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
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
* @var CMS_CSSSTYLE $myStyleObj
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* cunstructor methods */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
* if $aId <> null the object is populated
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
* inserts a new row to the table
* @param string $gDBIDX Index of $GLOBALS to the db object
* @param bool $debug show debug info
* @returns int returns the autoIncFld ID if exists or 1 on success
$this->setDBField('CSS_OWNER',$GLOBALS['OCSP_OBJ']['USER']->getId());
ocsp_logError(__FILE__
,__LINE__
,"no database connection",E_ERROR);
$s_query =
"SELECT IFNULL(MAX(CSS_ORDERNR),0)+1 FROM ".
$this->myTable;
$s_query.=
" WHERE PROJ_ID=".
$this->getProjId();
if (!($i_orderNr=
intval($this->myDBObj->quickQuery($s_query,0)))) {
$thihs->setDBField('CSS_ORDERNR',$i_orderNr);
$b_chkSort=
TRUE; // move other classes down after insert
if (($a_id=
parent::dbInsert($gDBIDX,$debug))) {
// move all other classes down if we have
$s_cmd =
"UPDATE ".
$this->myTable.
" SET CSS_ORDERNR=CSS_ORDERNR+1";
$s_cmd.=
" AND CSS_ID <> ".
$this->getId();
$this->myDBObj->executeCmd($s_cmd);
* @param boolean $ignorPopulated (if false the table MUST have been populated)
function dbReplace($debug=
FALSE,$ignorPopulated=
FALSE)
$this->setDBField('CSS_OWNER',$GLOBALS['OCSP_OBJ']['USER']->getId());
return parent::dbReplace($debug,$ignorPopulated);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
* moves a class up in the style (decrease sortorder)
* NOTE: changes to other classes are stored imediatly to the db
* the object values are only stored if $autoSave is TRUE
* @param boolean $autoSave
function moveUp($autoSave=
TRUE,$debug=
FALSE) {
ocsp_logError(__FILE__
,__LINE__
,"no database connection",E_ERROR);
$s_query.=
" AND CSS_ORDERNR <= ".
$this->getDBField('CSS_ORDERNR');
$s_query.=
" AND CSS_ID <> ".
$this->getId();
$s_query.=
" AND PROJ_ID = ".
$this->getProjId();
$s_query.=
" ORDER BY CSS_ORDERNR DESC";
if ($a_class=
$this->myDBObj->quickQuery($s_query)) {
$s_cmd =
"UPDATE ".
$this->myTable.
" SET CSS_ORDERNR=CSS_ORDERNR+1";
// douplicated CSS_ORDERNR increase the other classes order nr.
$s_cmd.=
" AND CSS_ID <> ".
$this->getId();
$s_cmd.=
" AND CSS_ID=".
intval($a_class['CSS_ID']);
$this->myDBObj->executeCmd($s_cmd);
if ($debug) echoDebug(__FILE__
,"NO RESULT FOR: $s_query");
* moves a class down in the style (increas sortorder)
* NOTE: changes to other classes are stored imediatly to the db
* the object values are only stored if $autoSave is TRUE
* @param boolean $autoSave
function moveDown($autoSave=
TRUE,$debug=
FALSE) {
ocsp_logError(__FILE__
,__LINE__
,"no database connection",E_ERROR);
$s_query.=
" AND CSS_ORDERNR >= ".
$this->getDBField('CSS_ORDERNR');
$s_query.=
" AND CSS_ID <> ".
$this->getId();
$s_query.=
" AND PROJ_ID = ".
$this->getProjId();
$s_query.=
" ORDER BY CSS_ORDERNR ASC";
if ($a_class=
$this->myDBObj->quickQuery($s_query)) {
// douplicated CSS_ORDERNR increase the other classes order nr.
$s_cmd =
"UPDATE ".
$this->myTable.
" SET CSS_ORDERNR=CSS_ORDERNR+1";
$s_cmd.=
" AND CSS_ID <> ".
intval($a_class['CSS_ID']);
$s_cmd =
"UPDATE ".
$this->myTable.
" SET CSS_ORDERNR=CSS_ORDERNR-1";
$s_cmd.=
" AND CSS_ID=".
intval($a_class['CSS_ID']);
if ($debug) echoDebug(__FILE__
,"CMD: $s_cmd");
$this->myDBObj->executeCmd($s_cmd);
if ($debug) echoDebug(__FILE__
,"NO RESULT FOR: $s_query");
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
* returns the id of the style
* returns a pointer to the style object
if ($debug) echoDebug(__FILE__
,"return existing object");
if ($debug) echoDebug(__FILE__
,"generate new object");
* @param CMS_CSSSTYLE $aStyle
Documentation generated on Thu, 08 Jan 2009 17:38:46 +0100 by phpDocumentor 1.4.0a2