public function fundSelectBox() { $fund_id = $this->read('fund_id'); $ret = '<select name="fund_id" id="fund_id">' . '<option value="0"' . ($fund_id == 0 ? 'selected="selected"' : '') . '>Not funded</option>'; foreach (Fund::getFunds() as $fund) { $ret .= '<option value="' . $fund['id'] . '" ' . ($fund_id == $fund['id'] ? 'selected="selected"' : '') . '>' . $fund['name'] . '</option>'; } $ret .= '</select>'; return $ret; }
public function funds() { $funds = Fund::getFunds(); $ret = array(); $default = isset($_REQUEST['fund_id']) ? $_REQUEST['fund_id'] : -1; $ret[] = array('id' => -1, 'name' => 'ALL', 'selected' => $default == -1); foreach ($funds as $fund) { $fund['selected'] = $default == $fund['id']; $ret[] = $fund; } $ret[] = array('id' => 0, 'name' => 'Not Funded', 'selected' => $default == 0); return $ret; }