public static function selectBox($value, $attrs, $table, $colums, $where = null, $order = null) { if (count($colums) >= 2) { if (isset($table) && is_array($table)) { $rows = $table; } else { $rows = AdminThontoHelper::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 function display($tpl = null) { $task = JFactory::getApplication()->input->get('task'); $task = $task == null ? 'default' : strtoupper($task); $this->setLayout(strtolower($task)); $vName = JRequest::getString('view'); switch ($task) { default: $this->_initDefaultPage(); break; } AdminThontoHelper::addSubmenu($vName); $this->sidebar = JHtmlSidebar::render(); parent::display($tpl); }
public function getEditItem() { $id = JRequest::getInt('id', null); $data = $this->inputData(); $vName = JRequest::getString('view'); AdminThontoHelper::addButton($vName); // JToolBarHelper::title('Edit','generic.png' ); $model = JModelLegacy::getInstance('Loaibhyt', 'ThontoModel'); if ($id == NULL) { $item = array(); } else { $item = $model->getEditItem($data['table'], $id); } $this->assignRef('data', $data); $this->assignRef('item', $item[0]); }
public function getEditItem() { $id = JRequest::getInt('id', null); $data = $this->inputData(); $vName = JRequest::getString('view'); AdminThontoHelper::addButton($vName); // JToolBarHelper::title('Edit','generic.png' ); $model = JModelLegacy::getInstance('Chibo', 'ThontoModel'); if ($id == NULL) { $item = array(); } else { $item = $model->getEditItem($data['table'], $id); } $selected_px = $item[0]['donvi_id']; $cboPhuongxa = $model->getCbo('ins_dept', 'id, name', 'ins_cap IN (12,13)', 'name asc', '', '-- Chọn phường/xã quản lý --', 'id', 'name', $selected_px, 'donvi_id', 'required'); $this->assignRef('cboPhuongxa', $cboPhuongxa); $this->assignRef('data', $data); $this->assignRef('item', $item[0]); }
<?php if ($item['id'] == 0) { ?> <div class="control-group"> <label class="control-label">Thừa kế lại cấu hình kiến nghị của đợt</label> <div class="controls"> <?php echo AdminThontoHelper::selectBox('', array('name' => 'thuake_dot'), 'thonto_dotbaocao', array('id', 'tendot')); ?> </div> </div> <div class="control-group"> <label class="control-label">Thừa kế lại cấu hình nội dung họp của đợt</label> <div class="controls"> <?php echo AdminThontoHelper::selectBox('', array('name' => 'thuake_noidunghop'), 'thonto_dotbaocao', array('id', 'tendot')); ?> </div> </div> <?php } ?> </fieldset> <input type="hidden" name="id" value="<?php echo $item['id']; ?> " /> <input type="hidden" name="task" id="task" value="" /> <input type="hidden" name="dbtable" value="<?php echo $this->data['table']; ?>