Source for file DBMS_FIELD_PAGESELECT.phpclass
Documentation is available at DBMS_FIELD_PAGESELECT.phpclass
* Class file DBMS_FIELD_PAGESELECT.phpclass
* @project Open CSP-Management
* @author Peter Krebs (pk)<pitlinz@users.sourceforge.net>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: DBMS_FIELD_PAGESELECT.phpclass,v 1.6 2008/08/12 08:22:38 pitlinz Exp $
// --------------------------------------------------------
// --------------------------------------------------------
* handels fields which are foreign keys to a page
* shows a select box to select pages
* @project Open CSP-Management
* @author Peter Krebs (pk)<pitlinz@users.sourceforge.net>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: DBMS_FIELD_PAGESELECT.phpclass,v 1.6 2008/08/12 08:22:38 pitlinz Exp $
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
* @constant string CLASS_SRC_FILE
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
/*** class vars ------------------------------------------------------ */
* @staticvar array $ps_sprojSelectModes PRIVATE project select modes
protected static $ps_sprojSelectModes=
array(
'LABEL' =>
"NUR IM PROJEKT (\${\$arrName})",
'LABEL' =>
"NUR GET PROJEKT (\$_GET['PROJ_ID'])",
'LABEL' =>
"ALLE PROJEKTE",
/*** class methods --------------------------------------------------- */
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
/*** compostion --------------------------------------------------- */
* the current selected page
/*** attributes --------------------------------------------------- */
* source file of the class
* @var string $classSrcFile
* @staticvar string $lookupTable
protected $lookupTable =
"T_CMS_PAGE p LEFT OUTER JOIN T_CMS_MENU m USING(MEN_ID)";
* @staticvar string $$lookupShowField
protected $lookupShowField =
"CONCAT(IFNULL(PAG_TITLE,'NO TITLE'),' (',PAG_ID,')')";
* @staticvar string $lookupField
* @staticvar string $lookupSort
* @staticvar string $nullLabel
* @staticvar string $whereAnd
* @var int $myProjSelectMode add the project to the select list
* @var bool $showExpired show expired pages
* @var boolean $showSysDefault
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
* returns the DOM id of the menu select
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
* returns an array of field to bie shown in the edit form
* by using editTbl_echoForm
* the array is in the form:
* [FLDLAB] (complete html code with <td></td>)
* [FLDVAL] (complete html code with <td></td>)
// <pk-07-02-16> set some default values
unset
($a_ret['SELECT']['FLD_MULTISEL']);
$a_ret['DBLOOKUP']['FLD_LUTBL']['FLDVAL']=
$this->lookupTable;
$a_ret['DBLOOKUP']['FLD_VALFLD']['FLDVAL']=
$this->lookupField;
$a_ret['DBLOOKUP']['FLD_SHOWLSTSORT']['FLDVAL']=
"ORDER BY m.MEN_ID, PAG_SORTORDER,<input name=\"sortAdd\" value=\"".
htmlspecialchars($this->sortAdd).
"\" size=\"40\">";
unset
($a_ret['DBLOOKUP']['PARENTFIELD']);
unset
($a_ret['DBLOOKUP']['IDENTFIELD']);
$a_ret['DBLOOKUP']['FLD_PROJECTSEL']['FLDLAB']=
"Projektanzeige: ";
$a_ret['DBLOOKUP']['FLD_PROJECTSEL']['FLDVAL']=
"<select name=\"myProjSelectMode\" size=\"1\">\n";
foreach(self::$ps_sprojSelectModes as $key =>
$val) {
$a_ret['DBLOOKUP']['FLD_PROJECTSEL']['FLDVAL'].=
"\t<option value=\"$key\"";
if ($key ==
$this->myProjSelectMode) $a_ret['DBLOOKUP']['FLD_PROJECTSEL']['FLDVAL'].=
"selected ";
$a_ret['DBLOOKUP']['FLD_PROJECTSEL']['FLDVAL'].=
">".
t_admin($val['LABEL']).
"</option>\n";
$a_ret['DBLOOKUP']['FLD_PROJECTSEL']['FLDVAL'].=
"</select>\n";
$a_ret['DBLOOKUP']['FLD_OUTDATEDPAGES']=
array(
'FLDLAB'=>
"Abgelaufene Seiten:",
'FLDVAL'=>
"<input type=\"checkbox\" name=\"showExpiredPages\" value=\"1\" ".
(($this->showExpiredPages) ?
"checked" :
"").
" >Seiten mit Anzeigen bis < jetzt nicht anzeigen"
unset
($a_ret['FTBL_POPUPS']);
* save the filed definition form
* @return bool <code>parent::save()</code>
* @version pk-07-02-16 allow set of some values
$this->lookupShowField =
"CONCAT(IFNULL(PAG_TITLE,'NO TITLE'),' (',PAG_ID,')')";
if (!empty($this->sortAdd)) $this->lookupSort.=
",".
$this->sortAdd;
$this->showExpiredPages =
((isset
($_POST['showExpiredPages']) &&
intval($_POST['showExpiredPages'])) ?
TRUE :
FALSE );
$this->showSysDefault =
((isset
($_POST['showSysDefault']) &&
intval($_POST['showSysDefault'])) ?
TRUE:
FALSE);
$this->allowNullSelect =
$this->allowNull; /* <pk-03-10-22 /> */
// -------------------------------------------------
// -------------------------------------------------
* returns the field value
* @param string $aValue the value
* @param array $err error array
* @param string $arrName global data array name used for global ${$arrName}
function getValue($aValue,&$err,$arrName=
"DBVAL",$debug=
FALSE) {
$err[$this->myName]['MSG']=
t_admin("Die Seite ist nicht mehr verfügbar");
if ($this->allowNullSelect) {
// -------------------------------------------------
// html rendering methods
// -------------------------------------------------
* returns one page option
* @param CMS_PAGE $pagObj
$str_ret =
"<option value=\"" .
$pagObj->getId() .
"\"";
if ($pagObj->getId() ==
intval($aValue))
$str_ret .=
" selected=\"selected\"";
$str_ret .=
$pagObj->getTitle() .
" (" .
$pagObj->getId() .
")";
* returns the page option list for a menu node
* @param CMS_MENU $menObj
$str_ret .=
"<optgroup label=\"M: " .
$menObj->getTitle() .
"\">";
if ($arr_pages =
$menObj->getPageList(False,False,$debug))
foreach($arr_pages as $obj_page)
} else if ($obj_page->getId() ==
intval($aValue)) {
} else if (!$obj_page->isExpired()){
if ($arr_children =
$menObj->getChildrenList())
foreach($arr_children as $obj_node)
$str_ret .=
"</optgroup>";
* returns the html code for the <select> field
global $
{$this->myDataArrName};
if (isset
($_POST['PROJ_ID']) &&
intval($_POST['PROJ_ID']))
} else if (isset
($_GET['PROJ_ID']) &&
intval($_GET['PROJ_ID'])) {
foreach($arr_projRows as $arr_row)
foreach($arr_attributes as $str_att =>
$str_val)
$str_tag .=
" " .
$str_att .
"=" .
$str_val;
foreach($arr_proj as &$obj_proj)
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"<pre>" .
print_r($obj_proj->getDBVal(),True) .
"</pre>");
$str_tag .=
"<optgroup label=\"" .
t_admin('Projekt') .
": " .
$obj_proj->getName() .
"\" title=\"" .
$obj_proj->getTitle() .
" Id: " .
$obj_proj->getId() .
"\">";
if ($obj_tree =
$obj_proj->getMenuTree(True,$debug))
$obj_rootNode =
$obj_tree->getNode(0,True);
$obj_rootNode->setMyProject($obj_proj);
$str_tag .=
"</optgroup>";
} // end of DMBS_FIELD_PAGESELECT
Documentation generated on Thu, 08 Jan 2009 17:42:32 +0100 by phpDocumentor 1.4.0a2