Skip to content

Instantly share code, notes, and snippets.

@stanistan
Created August 6, 2012 15:11
Show Gist options
  • Save stanistan/3275280 to your computer and use it in GitHub Desktop.
Save stanistan/3275280 to your computer and use it in GitHub Desktop.
select/ column
<?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
}
<?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