70 var
$ValidIndex=array(
'autoincrement',
'values',
'table',
'type',
'apice',
'size',
'decimal',
'name');
107 $this->IHaveValue=
false;
108 if(count($TableFieldDef)>0)
110 $this->CallBackCheck=
'';
120 $this->DbFieldInfo=$FieldDef;
121 if(array_key_exists(
'name',$this->DbFieldInfo))
132 $this->FieldValue=$value;
133 $this->IHaveValue=
true;
161 $this->CallBackCheck=$name;
173 eval(
'$this->'.$Property.
'=$value;');
183 if(array_key_exists($this->Name,$_SERVER))
185 $this->
SetValue($_SERVER[$this->Name]);
198 $this->IsValidInput=
true;
209 return($this->IsValidInput);
219 trigger_error(
'Field '.$this->Name.
' unset',E_USER_ERROR);
220 return($this->DbFieldInfo[
'apici'].$this->FieldValue.$this->DbFieldInfo[
'apici']);
230 return($this->DbFieldInfo[
'name']);
241 if(!in_array($InfoName,$this->ValidIndex))
242 trigger_error(
'Unexpected index '.$InfoName.
' requested',E_USER_ERROR);
243 if(array_key_exists($InfoName,$this->DbFieldInfo))
244 return($this->DbFieldInfo[$InfoName]);
246 trigger_error(
'Iindex '.$InfoName.
' doesn\'t set',E_USER_ERROR);
261 return($this->IHaveValue);
266 return($this->FieldValue);
305 return($this->Label);
333 parent::CYap_Control($TableFieldDef);
346 trigger_error(
'Control without name!',E_USER_ERROR);
347 $width=$this->DbFieldInfo[
'size'];
348 $Text=
'<input type=text name='.$this->Name.
' size='.$width.
' ';
349 if($this->FieldValue!=
'')
350 $Text.=
'value=\''.htmlentities($this->FieldValue,ENT_QUOTES).
'\'';
367 parent::CYap_Control($TableFieldDef);
375 trigger_error(
'Control without name!',E_USER_ERROR);
376 $Text=
'<input type=text name='.$this->Name.
' size='.$this->Size.
' ';
377 if($this->FieldValue!=
'')
378 $Text.=
'Value=\''.htmlentities($this->FieldValue,ENT_QUOTES).
'\'';
384 return($this->Label);
405 parent::CYAP_ViewTextBox($TableFieldDef);
414 $this->FieldValueTo=$value;
429 trigger_error(
'Control without name!',E_USER_ERROR);
430 $Text=
'<input type=text name='.$this->Name.
' size='.$this->Size.
' ';
431 if($this->FieldValue!=
'')
432 $Text.=
'Value=\''.htmlentities($this->FieldValue,ENT_QUOTES).
'\'';
435 $Text.=
'<input type=text name='.$this->NameTo.
' size='.$this->Size.
' ';
436 if($this->FieldValueTo!=
'')
437 $Text.=
'Value=\''.htmlentities($this->FieldValueTo,ENT_QUOTES).
'\'';
443 return($this->Label);
470 parent::CYap_Control($TableFieldDef);
471 $this->Choices=array();
481 $this->Choices=$tblChoices;
494 trigger_error(
'Control without name!',E_USER_ERROR);
496 $HtmlCode.=
'<SELECT name='.$this->Name.
' >'.chr(13);
497 foreach($this->Choices as $key => $Value)
499 $HtmlCode.=
"<option ";
500 if ($this->FieldValue==(
string)$key) {
501 $HtmlCode.=
"SELECTED";
503 $HtmlCode.=
" value='".$key.
"'";
504 $HtmlCode.=
" >".$this->Choices[$key].
"</option>".chr(13);
506 $HtmlCode.=
"</SELECT>".chr(13);
526 parent::CYap_Control($TableFieldDef);
537 $this->IsValidInput=
true;
549 trigger_error(
'Control without name!',E_USER_ERROR);
550 $Text=
'<input type=hidden name='.$this->Name.
' ';
551 if($this->FieldValue!=
'')
552 $Text.=
'value=\''.htmlentities($this->FieldValue,ENT_QUOTES).
'\'';
585 parent::CYap_Control($TableFieldDef);
592 $Text=
"<input type=submit value='".$this->Label.
"'>";
627 parent::CYap_Control($TableFieldDef);
638 parent::SetProperty($Property,$value);
646 if(strtolower($Property)==
'showformat')
648 if(preg_match(
'/^d.m.Y$/',$value))
650 $cond=
'/^d(.*)m(.*)Y$/';
651 $replace=
'dd${1}mm${2}yyyy';
652 $this->JsFormat=preg_replace($cond,$replace,$value);
654 elseif(preg_match(
'/^Y.m.d$/',$value))
656 $cond=
'/^Y(.*)m(.*)d$/';
657 $replace=
'yyyy${1}mm${2}dd';
658 $this->JsFormat=preg_replace($cond,$replace,$value);
660 elseif(preg_match(
'/^m.d.Y$/',$value))
662 $cond=
'/^m(.*)d(.*)Y$/';
663 $replace=
'mm${1}dd${2}yyyy';
664 $this->JsFormat=preg_replace($cond,$replace,$value);
668 $this->JsFormat=
'dd/mm/yyyy';
685 trigger_error(
'Control without name!',E_USER_ERROR);
686 $Text=
'<input type=text name='.$this->Name.
' id=viewdate_'.$this->Name.
' ';
687 if($this->FieldValue!=
'')
688 $Text.=
'value=\''.htmlentities(date($this->ShowFormat,$this->FieldValue),ENT_QUOTES).
'\'';
690 $Text.=
'<input type="button" value="Cal" onclick="displayCalendar(\'viewdate_'.$this->Name.
'\',\
''.$this->JsFormat.
'\',
this)
">';
698 <SCRIPT type="text/javascript
" src="dhtmlgoodies_calendar/dhtmlgoodies_calendar.js
"></script>
699 <script type="text/javascript
">
700 var pathToImages = \'dhtmlgoodies_calendar/images/\'; // Relative to your HTML file
709 class CYap_ViewOptRegex extends CYap_Control
718 function CYap_ViewOptRegex($TableFieldDef=array())
720 parent::CYap_Control($TableFieldDef);
723 function Draw($Show=true)
726 trigger_error('Control without name!',E_USER_ERROR);
727 $Text='<input type=text name='.$this->Name.' ';
728 if($this->FieldValue!='')
729 $Text.='value=\''.htmlentities($this->FieldValue,ENT_QUOTES).'\'';
731 $Text.=' <input type="checkbox
" name='.$this->Name.'_compWord ';
732 if($this->UseRegex=='0')
734 $Text.='> Exact match';