Source for file CLI_STAFF_TYPE.phpclass
Documentation is available at CLI_STAFF_TYPE.phpclass
* Class file CLI_STAFF_TYPE.phpclass
* @project Open CSP-Management
* @author Peter Krebs <p.krebs@wpus.at>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: CLI_STAFF_TYPE.phpclass,v 1.11 2008/12/02 15:08:57 peterkrebs Exp $
// ---------------------------------------------------------
// ---------------------------------------------------------
require_once __OCSP_DEFAULTCONFPATH__.
"client.conf.phpinc";
* Class file CLI_STAFF_TYPE.phpclass
* @project Open CSP-Management
* @author Peter Krebs <p.krebs@wpus.at>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
* @constant string CLASS_SRC_FILE
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
/*** class vars ------------------------------------------------------ */
* identity map of loaded types
* @var array $loadedTypes
/*** class methods --------------------------------------------------- */
* returns a type out of self::$loadedCliStaffTypes
if ($debug) echoDebugMethod(__FILE__
,"static","CLI_STAFF_TYPE::getInstance({$aId}");
if (isset
(self::$loadedCliStaffTypes[$aId]) &&
pcf_is_instance_of(self::$loadedCliStaffTypes[$aId],'CLI_STAFF_TYPE'))
return self::$loadedCliStaffTypes[$aId];
self::$loadedCliStaffTypes[$aId] =
self::factoryFromId($aId,$debug);
return self::$loadedCliStaffTypes[$aId];
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
/*** compostion --------------------------------------------------- */
/*** attributes -------------------------------------------------- */
* source file of the class
* @staticvar string $classSrcFile
* @staticvar string $myTable name of the db table
* @var CLI_TYPE $myClientType
* @deprecated since pk-08-11-20 use $this->getClientTypeObj
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
* factories a type object from the id
if ($debug) echoDebugMethod(__FILE__
,"static","CLI_STAFF_TYPE::factoryFromId({$aId}");
$obj_ret->setId(intval($aId));
$obj_ret->dbPopulate($debug);
* init the object and populate if an id is submitted
* @param int $cliId CLI_ID
* @deprecated since pk-08-07-30
* returns the name of the staff
return (empty($s_ret) ?
"Mitarbeiter" :
$s_ret);
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* returns an Array with profiles available for the staff type
* @requires CLI_PROFILE.phpclass
$arr_filter['CLP_KEYTABLE']=
"T_CLI_STAFF";
$arr_filter['?CTY_ID']=
"(CTY_ID=0 OR CTY_ID=".
$this->getCtyId().
")";
$arr_filter['CSTTYPE_ID']=
$this->getId();
$arr_filter['?CSTTYPE_ID']=
"(CSTTYPE_ID = 0 OR CSTTYPE_ID=".
$this->getId().
")";
if ($arr_pfRows=
OCSP_OBJ::defaultReadDBObj()->getArray("T_CLI_PROFILES",$arr_filter,0,0,"CLP_SORTORDER,CLP_TITLE",$debug))
foreach($arr_pfRows as $arr_row)
$arr_ret[$arr_row['CLP_ID']]->setDBRow($arr_row);
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* @param CLI_TYPE $aTypeObj
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* factory a staff object if (!intval($this->getId()) the default type of $client is used)
* @param mixed $client (CLIENT object or client id)
$str_query =
"SELECT * FROM " .
$this->myTable;
$str_query .=
" WHERE (CTY_ID=" .
$this->getCtyId() .
" OR CTY_ID=0)";
$str_query .=
" ORDER BY CTY_ID DESC,CTY_SORTORDER";
if ($arr_row =
$this->myDBObj->quickQuery($str_query))
$str_cmd =
"\$obj_staff = new $str_className(\$client," .
intval($cstId) .
",\$debug);";
$obj_staff->setTypeObj($this);
$staffRow['CSTTYPE_ID'] =
$this->getId();
$str_cmd =
"\$obj_staff = new $str_className();";
$obj_staff->setTypeObj($this);
$obj_staff->setDBRow($staffRow,TRUE);
* includes the client class source file
* @global array $OCSP_CONF
$s_Src=
$OCSP_CONF['PROJECTPATH'].
$s_Src;
if ($debug) echoDebug(__FILE__
,"Source: ".
$s_Src);
* returns the class name of the client object defined by the type
* and ensures the class exists
if (empty($s_className)) {
$s_className=
"CLI_STAFF";
$s_className=
(class_exists($s_className) ?
$s_className :
"CLI_STAFF");
if ($debug) echoDebug(__FILE__
,"<p>Returning: <b>".
$s_className.
"</b></p>");
* generates a new client object with this type
* @return CLI_STAFF or an instance of it
$s_cmd=
"\$o_staff=new ".
$s_className.
"();";
if ($debug) echoDebug(__FILE__
,"<blockquote><p>".
$s_cmd.
"</p></blockquote>");
$o_staff->setDBRow($cstRow,((intval($cstRow['CLI_ID']) &&
intval($cstRow['CST_ID'])) ?
TRUE:
FALSE),$debug);
$o_staff->setTypeObj($this);
// ------------------------------------------------------
// ------------------------------------------------------
* @param boolean $useTblDefault if true and not set CSTTYPE_FRM_ADMIN the default form for T_CLI_STAFF is returned else NULL
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"return form ".
$obj_form->getName());
$o_ret=
NULL; // as we return a pointer
* returns the form used to handele values in T_CLI_USER AND T_SYS_USER
* if no form id is set the default form for T_SYS_USER is returned
// ------------------------------------------------------
// ------------------------------------------------------
* returns if the current user can show staffs of this type
* returns if the current user can edit staffs of this type
* returns if the current user can delete clients of this type
* return if a user can edit his own client data
return (intval($this->getId()) ?
FALSE :
TRUE); // for systems not using CLI_STAFF_TYPEs
Documentation generated on Thu, 08 Jan 2009 17:38:23 +0100 by phpDocumentor 1.4.0a2