-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
some updates, beginning of revision of multiselects, checkboxes, radio
chainable setters for model_formation
- Loading branch information
maartenvanvliet
committed
Mar 26, 2008
1 parent
c129eb6
commit cba659c
Showing
12 changed files
with
259 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
$config['label_prefix'] = 'label_'; | ||
?> |
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
formation/libraries/Field.php → formation/libraries/Form_Field.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
|
||
class Field_Core { | ||
class Form_Field_Core { | ||
|
||
//Field name | ||
protected $name; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
class Element_Multi_Core extends Element_Input{ | ||
|
||
protected $options=array(); | ||
|
||
public function set_options($options) | ||
{ | ||
$this->options=$options; | ||
return $this; | ||
} | ||
public function get_options($options) | ||
{ | ||
$this->options; | ||
} | ||
public function add_option($option,$value) | ||
{ | ||
$this->options[$option]=$value; | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
class Element_Multi_Checkbox_Core extends Element_Multi{ | ||
public function render() | ||
{ | ||
// Import base data | ||
$base_data = array();//$this->data; | ||
$base_data['name']=$this->name; | ||
// Make it an array | ||
$base_data['name'] .= '[]'; | ||
|
||
// Newline | ||
$nl = "\n"; | ||
|
||
$checklist = $nl.'<ul class="'.arr::remove('class', $this->attr).'">'.$nl; | ||
foreach($this->options as $val => $opt) | ||
{ | ||
// New set of input data | ||
$data = $base_data; | ||
|
||
// Get the title and checked status | ||
list ($title, $checked) = $opt; | ||
|
||
// Set the name, value, and checked status | ||
$data['value'] = $val; | ||
$data['checked'] = $checked; | ||
//TODO Element_Checkboxes | ||
$checklist .= "\t".'<li><label>'.form::checkbox($data).' '.$title.'</label></li>'.$nl; | ||
} | ||
$checklist .= '</ul>'; | ||
|
||
return $checklist; | ||
} | ||
public function get_value() | ||
{ | ||
// Return the currently checked values | ||
$array = array(); | ||
foreach($this->options as $id => $opt) | ||
{ | ||
// Return the options that are checked | ||
($opt[1] === TRUE) and $array[] = $id; | ||
} | ||
return $array; | ||
} | ||
public function set_value($value) | ||
{ | ||
foreach($this->options as $val => $checked) | ||
{ | ||
if ($value != false) | ||
{ | ||
$this->options[$val][1] = in_array($val, $value); | ||
} | ||
else | ||
{ | ||
$this->options[$val][1] = FALSE; | ||
} | ||
} | ||
} | ||
} | ||
?> |