public function selectBox($value, $attrs, $table, $colums, $where = null, $order = null) { if (count($colums) >= 2) { if (isset($table) && is_array($table)) { $rows = $table; } else { $rows = ThontoHelper::collect($table, $colums, $where); } if (is_array($attrs)) { $controlName = $attrs['name']; if ($controlName) { $controlAttrs = " ng-model=\"" . $controlName . "\""; } unset($attrs['name']); unset($attrs['value']); foreach ($attrs as $key => $val) { if (is_array($val)) { $controlAttrs .= " " . $key . '="' . implode(" ", $val) . '"'; } else { $controlAttrs .= " " . $key . '="' . $val . '"'; } } } else { $controlAttrs = $attrs; } if (isset($attrs['hasEmpty']) && $attrs['hasEmpty'] == true) { $option = array("{$colums['0']}" => '', "{$colums['1']}" => ''); array_unshift($rows, $option); } return JHTML::_('select.genericlist', $rows, $controlName, $controlAttrs, $colums[0], $colums[1], $value); } return ''; }
public static function selectBoxForJs($value, $attrs, $table, $colums, $where = null, $order = null, $optAdd = null) { //var_dump($colums[0]); if (count($colums) >= 2) { $rows = ThontoHelper::collect($table, $colums, $where, $order); //var_dump($rows);exit; if (is_array($attrs)) { $controlName = $attrs['name']; unset($attrs['name']); unset($attrs['value']); foreach ($attrs as $key => $val) { if (is_array($val)) { $controlAttrs .= " " . $key . '="' . implode(" ", $val) . '"'; } else { $controlAttrs .= " " . $key . '="' . $val . '"'; } } } else { $controlAttrs = $attrs; } if (isset($attrs['hasEmpty']) && $attrs['hasEmpty'] == true) { $option = array("{$colums['0']}" => '', "{$colums['1']}" => ''); array_unshift($rows, $option); } $optNull[] = JHTML::_('select.option', '', '', $colums[0], $colums[1]); if (is_array($optAdd)) { foreach ($optAdd as $key => $val) { $optNull[] = JHtml::_('select.option', $key, $val, $colums[0], $colums[1]); } } return JHTML::_('select.genericlist', array_merge($optNull, $rows), $controlName, $controlAttrs, $colums[0], $colums[1], $value); // return JHTML::_('select.genericlist',$options,$controlName, $controlAttrs, 'value','text',$value); } return ''; }