Update of /cvsroot/phpvortex/phpvortex
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4989
Modified Files:
FT_Base.class.php
Log Message:
Added the member variable $label and some functionality to Show() in FT_Base
Index: FT_Base.class.php
===================================================================
RCS file: /cvsroot/phpvortex/phpvortex/FT_Base.class.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** FT_Base.class.php 29 Sep 2004 15:52:14 -0000 1.3
--- FT_Base.class.php 29 Sep 2004 19:11:33 -0000 1.4
***************
*** 49,52 ****
--- 49,60 ----
/**
+ * Label to the field.
+ * Default = {@link $name}
+ *
+ * @var string
+ */
+ var $label;
+
+ /**
* Is the field a Primary Key?
*
***************
*** 67,71 ****
* @var string
*/
! var $default = "''";
/**
--- 75,79 ----
* @var string
*/
! var $default = '';
/**
***************
*** 83,86 ****
--- 91,95 ----
is_null($name_db) and $name_db = $name;
is_null($name_form) and $name_form = $name;
+ is_null($label) and $label = $name;
}
***************
*** 92,99 ****
--- 101,143 ----
function Show($form = TRUE)
{
+ if (empty($this->table->data) || !isset($this->table->data[$this->name_form])) {
+ $value = $this->default;
+ } else {
+ $value = $this->table->data[$this->name_form];
+ }
+ if ($form) {
+ echo '<tr><td>'.$this->label.'</td><td>';
+ $this->ShowForm($value);
+ echo '</td></tr>';
+ } else {
+ echo $this->label.': ';
+ $this->ShowPlain($value);
+ }
+ }
+
+ /**
+ * Output the field as a HTML Form.
+ *
+ * @abstract
+ * @param string $value Value to load the control with.
+ */
+ function ShowForm($value)
+ {
+ }
+
+ /**
+ * Output the field as plain text.
+ *
+ * @param string $value Value to load the control with.
+ */
+ function ShowPlain($value)
+ {
+ echo $value;
}
/**
* Output the field consistency testing in JavaScript.
+ *
+ * @abstract
*/
function JSConsist()
***************
*** 113,117 ****
return FALSE;
} else {
! return $this->default;
}
}
--- 157,161 ----
return FALSE;
} else {
! return "'".$this->default."'";
}
}
***************
*** 124,128 ****
* Test the field consistency.
*
- * @internal
* @param string $field The data from the field to be tested.
* @return bool Returns TRUE if the field is consistent, FALSE otherwise.
--- 168,171 ----
***************
*** 136,140 ****
* Format the field for database insertion.
*
- * @internal
* @param string $field The data from the field to be formated.
* @return string Returns the formated field.
--- 179,182 ----
|