Created
August 6, 2012 15:11
-
-
Save stanistan/3275280 to your computer and use it in GitHub Desktop.
select/ column
This file contains hidden or 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
<?php | |
class ct_staff extends Model | |
{ | |
/** | |
* Staffing types | |
* [ db_value => display_value ] | |
* @var array | |
*/ | |
public static $staffing_types = array( | |
'P' => 'Production', | |
'R' => 'Rental', | |
'C' => 'Commission' | |
); | |
// ... other class methods and implementation | |
} |
This file contains hidden or 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
<?php | |
$staffing_type_array = ct_staff::$staffing_types; | |
?> | |
<select> | |
<? | |
foreach ($staffing_type_array as $value => $label) { | |
?> | |
<option value="<?=$value?>"><?=$label?></label> | |
<? | |
} | |
?> | |
</select> | |
<? | |
// column component if pretty much the same, just different html tags | |
?> | |
<ul> | |
<? | |
foreach ($staffing_type_array as $value => $label) { | |
// do something to $avlue to create $href | |
?> | |
<li> | |
<a href="<?=$href?>"> | |
<?=$label?> | |
</a> | |
</li> | |
<? | |
} | |
?> | |
</ul> | |
<? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment