(put code in your model)
2010/8/23 Alexandre Salomé
> Hello,
>
> You should put labels in class code :
>
> class MyClass
> {
> const STATUS_OPENED = 0;
> const STATUS_CLOSED = 1;
>
> protected $labels = array(
> self::STATUS_OPENED => "Opened",
> self::STATUS_CLOSED => "Closed"
>
Hello,
You should put labels in class code :
class MyClass
{
const STATUS_OPENED = 0;
const STATUS_CLOSED = 1;
protected $labels = array(
self::STATUS_OPENED => "Opened",
self::STATUS_CLOSED => "Closed"
);
public function getLabel()
{
// ...
}
}
2010/8/23 torok84
>
Hi,
I have a model that has a numeric field that indicates a status it can
be 1 Opened 2 Closed (It might change in the future). I want to output
the status on the view, transalting numbers to strings. I will create
an array
a[1] = "Open";
a[2] = "Closed";
I will access the array a in the view to