aboutsummaryrefslogtreecommitdiff
path: root/h-source/Library/Form/Entry.php
diff options
context:
space:
mode:
Diffstat (limited to 'h-source/Library/Form/Entry.php')
-rwxr-xr-xh-source/Library/Form/Entry.php42
1 files changed, 40 insertions, 2 deletions
diff --git a/h-source/Library/Form/Entry.php b/h-source/Library/Form/Entry.php
index 440ee2d..305f55f 100755
--- a/h-source/Library/Form/Entry.php
+++ b/h-source/Library/Form/Entry.php
@@ -32,6 +32,7 @@ abstract class Form_Entry {
public $options = array(); //options (if the entry is a <select> entry or a radio button). Associative array or comma-divided list.
public $defaultValue = '';
public $wrap = array();
+ public $deleteButton = null;
public $type = null; //the type of the entry
//create the label of each entry of the form
@@ -44,7 +45,32 @@ abstract class Form_Entry {
//get the class of the entry
public function getEntryClass()
{
- return isset($this->entryClass) ? $this->entryClass : 'formEntry';
+ if (isset($this->entryClass))
+ {
+ $class = $this->entryClass;
+ }
+ else
+ {
+ switch($this->type)
+ {
+ case 'InputText':
+ $class = 'form_input_text';
+ break;
+ case 'File':
+ $class = 'form_input_file';
+ break;
+ case 'Textarea':
+ $class = 'form_textarea';
+ break;
+ case 'Password':
+ $class = 'form_input_text form_input_password';
+ break;
+ default:
+ $class = 'form_input_text';
+ break;
+ }
+ }
+ return $class;
}
public function getWrapElements($value = null)
@@ -52,7 +78,19 @@ abstract class Form_Entry {
//replace the ;;value;; variable
for ($i = 0; $i < count($this->wrap); $i++)
{
- $this->wrap[$i] = str_replace(';;value;;',$value,$this->wrap[$i]);
+ if ( preg_match('/;;(.*)\|value;;/',$this->wrap[$i],$m) )
+ {
+ if (!function_exists($m[1])) {
+ throw new Exception('Error in <b>'.__METHOD__.'</b>: function <b>'.$m[1].'</b> does not exists..');
+ }
+ //apply the function
+ $v = call_user_func($m[1],$value);
+ $this->wrap[$i] = str_replace(";;".$m[1]."|value;;",$v,$this->wrap[$i]);
+ }
+ else if ( preg_match('/;;value;;/',$this->wrap[$i]) )
+ {
+ $this->wrap[$i] = str_replace(';;value;;',$value,$this->wrap[$i]);
+ }
}
$wrap[0] = isset($this->wrap[0]) ? $this->wrap[0] : null;