private function _pageEditPhong() { $deptRoot = TochucHelper::getRoot(); $inArray = TochucHelper::collect('ins_dept', array('id', 'parent_id', 'name', "IF((type = 1),'item','folder') AS type"), array('type IN (1,2,3)'), 'lft ASC'); $tree_data_ins_dept = array(); TochucHelper::makeDataForTree($inArray, $tree_data_ins_dept); unset($inArray); // $inArray = TochucHelper::getAllVoboc(); // $tree_data_ins_parent = array(); // TochucHelper::makeDataForTree($inArray, &$tree_data_ins_parent,$deps['id']); //unset($inArray); $this->assignRef('Itemid', JFactory::getApplication()->input->get('Itemid')); ///$this->assignRef('deps', $deps); $this->assignRef('tree_data_ins_dept', json_encode($tree_data_ins_dept)); // $model = JModelLegacy::getInstance('Tochuc','TochucModel'); $model = Core::model('Tochuc/Tochuc'); $dept_id = JRequest::getInt('id', 0); $row = null; $arr_ins_created = TochucHelper::collect('ins_dept', array('id AS value', 'name AS text'), array('type IN (1,3)'), 'lft ASC'); $arr_ins_created = array_merge(array(array('value' => '', 'text' => '')), $arr_ins_created); if ((int) $dept_id > 0) { $row = $model->read($dept_id); } if ($row->id == null) { $vanban_created = array(); $trangthai = array(); $file_created = array(); $file_trangthai = array(); $row->active = 1; //$row->active = 1; $row->type = JRequest::getInt("type", 0); $linhvuc = array(); } else { $vanban_created = $model->getVanbanById($row->vanban_created); $trangthai = $model->getVanbanById($row->vanban_active); $file_created = $model->getFilebyIdVanban($row->vanban_created); $file_trangthai = $model->getFilebyIdVanban($row->vanban_active); $linhvuc = $model->getLinhvucByIdDept($row->id); $row->type = JRequest::getInt("type", 0); } $caybaocao = $model->getCayBaocao(); $this->assignRef('caybaocao', $caybaocao); $this->assignRef('row', $row); $this->assignRef('vanban_created', $vanban_created); $this->assignRef('trangthai', $trangthai); $this->assignRef('file_created', $file_created); $this->assignRef('file_trangthai', $file_trangthai); $this->assignRef('linhvuc', $linhvuc); $this->assignRef('arr_ins_created', $arr_ins_created); unset($tree_data_ins_linhvuc); unset($tree_data_ins_dept); unset($row); unset($vanban_created); unset($file_created); unset($trangthai); unset($file_trangthai); }
<?php $deps = TochucHelper::collect('ins_dept', array('id AS value', 'name AS text'), array('TYPE = 1', 'ACTIVE = 1'), array('lft ASC')); $option[] = array("value" => '', "text" => ''); $option[] = array("value" => '150000', "text" => 'UBND Thành phố đà nẵng'); $deps = array_merge($option, $deps); //array_unshift($deps, $option); ?> <!-- begin form --> <form class="form-horizontal" class="row-fluid" name="frmThanhLapPhong" id="frmThanhLapPhong" method="post" action="<?php echo JRoute::_('index.php?option=com_tochuc&controller=tochuc&task=savethanhlapphong'); ?> " enctype="multipart/form-data"> <h3 class="row-fluid header smaller lighter blue"> <span class="span7">Tổ chức <small> <i class="icon-double-angle-right"> </i> Thành lập mới phòng </small></span> <span class="span5"> <span class="pull-right inline"> <button id="btnThanhlapSubmit" type="button" class="btn btn-small btn-success"> <i class="icon-save"></i> Lưu </button> <a class="btn btn-small btn-info" href="<?php echo JRoute::_('index.php?option=com_tochuc&layout=default&Itemid=' . $this->Itemid); ?> ">← Quay về</a> </span> </span> </h3> <div class="error"></div> <div class="tabbable"> <ul class="nav nav-tabs" id="myTab3">
private function _initEditPage() { $document = JFactory::getDocument(); $document->addCustomTag('<link href="' . JURI::base(true) . '/media/cbcc/css/jquery.fileupload.css" rel="stylesheet" />'); $document->addCustomTag('<link href="' . JURI::base(true) . '/media/cbcc/js/jstree/themes/default/style.css" rel="stylesheet" />'); $document->addScript(JURI::base(true) . '/media/cbcc/js/jquery/jquery.validate.min.js'); $document->addScript(JURI::base(true) . '/media/cbcc/js/jquery/jquery.validate.default.js'); $document->addScript(JURI::base(true) . '/media/cbcc/js/jstree/jquery.jstree.js'); $document->addScript(JURI::base(true) . '/media/cbcc/js/fuelux/fuelux.tree.min.js'); $document->addScript(JURI::base(true) . '/media/cbcc/js/jquery/chosen.jquery.min.js'); $document->addScript(JURI::base(true) . '/media/cbcc/js/jquery.maskedinput.min.js'); $document->addScript(JURI::base(true) . '/media/cbcc/js/jquery/upload/jquery.iframe-transport.js'); $document->addScript(JURI::base(true) . '/media/cbcc/js/jquery/upload/jquery.fileupload.js'); $deptRoot = TochucHelper::getRoot(); $deps = TochucHelper::collect('ins_dept', array('id AS value', 'name AS text'), array('type = 1', 'active = 1'), array('lft ASC')); $option[] = array("value" => '', "text" => ''); $option[] = array("value" => $deptRoot['id'], "text" => $deptRoot['name']); $deps = array_merge($option, $deps); // $inArray = TochucHelper::collect('ins_dept', array('id','parent_id','name',"IF((type = 1),'item','folder') AS type")); // $outArray = array(); //TochucHelper::makeDataForTree(&$inArray, &$outArray); //unset($inArray); $inArray = TochucHelper::collect('ins_cap', array('id', 'parent_id', 'name', "IF((rgt-lft) = 1,'item','folder') AS type"), array('status = 1')); //var_dump($inArray); $tree_data_ins_cap = array(); TochucHelper::makeDataForTree($inArray, $tree_data_ins_cap, TochucHelper::getRootCapTochuc()); unset($inArray); $inArray = TochucHelper::collect('ins_level', array('id', 'parent_id', 'name', "IF((rgt-lft) = 1,'item','folder') AS type"), array('status = 1')); $tree_data_ins_level = array(); TochucHelper::makeDataForTree($inArray, $tree_data_ins_level, 1); unset($inArray); $inArray = TochucHelper::collect('pos_system', array('id', 'parent_id', 'name', "IF((rgt-lft) = 1,'item','folder') AS type"), array('status = 1')); $tree_data_ins_goichucvu = array(); TochucHelper::makeDataForTree($inArray, $tree_data_ins_goichucvu, TochucHelper::getRootGoichucvu()); unset($inArray); $inArray = TochucHelper::collect('cb_goiluong', array('id', 'parent_id', 'name', "IF((rgt-lft) = 1,'item','folder') AS type"), array('status = 1')); $tree_data_ins_goiluong = array(); TochucHelper::makeDataForTree($inArray, $tree_data_ins_goiluong, TochucHelper::getRootGoiLuong()); unset($inArray); $inArray = TochucHelper::collect('cb_type_linhvuc', array('id', 'parent_id', 'name', "IF((rgt-lft) = 1,'item','folder') AS type")); $tree_data_ins_linhvuc = array(); TochucHelper::makeDataForTree($inArray, $tree_data_ins_linhvuc, TochucHelper::getRootLinhvucTochuc()); unset($inArray); $inArray = TochucHelper::collect('ins_dept_loaihinh', array('id', 'parent_id', 'name', "IF((rgt-lft) = 1,'item','folder') AS type")); $tree_data_ins_loaihinh = array(); TochucHelper::makeDataForTree($inArray, $tree_data_ins_loaihinh, TochucHelper::getRootLoaihinh()); unset($inArray); $inArray = TochucHelper::collect('ins_dept', array('id', 'parent_id', 'name', "IF((type = 1),'item','folder') AS type"), array('type IN (1,2,3)'), 'lft ASC'); $tree_data_ins_dept = array(); TochucHelper::makeDataForTree($inArray, $tree_data_ins_dept, $deptRoot['id']); unset($inArray); // $inArray = TochucHelper::getAllVoboc(); // $tree_data_ins_parent = array(); // TochucHelper::makeDataForTree($inArray, &$tree_data_ins_parent,$deps['id']); //unset($inArray); $this->assignRef('Itemid', JFactory::getApplication()->input->get('Itemid')); $this->assignRef('deps', $deps); $this->assignRef('tree_data_ins_cap', json_encode($tree_data_ins_cap)); $this->assignRef('tree_data_ins_level', json_encode($tree_data_ins_level)); $this->assignRef('tree_data_ins_goichucvu', json_encode($tree_data_ins_goichucvu)); $this->assignRef('tree_data_ins_goiluong', json_encode($tree_data_ins_goiluong)); $this->assignRef('tree_data_ins_linhvuc', json_encode($tree_data_ins_linhvuc)); $this->assignRef('tree_data_ins_loaihinh', json_encode($tree_data_ins_loaihinh)); $this->assignRef('tree_data_ins_dept', json_encode($tree_data_ins_dept)); // $model = JModelLegacy::getInstance('Tochuc','TochucModel'); $model = Core::model('Tochuc/Tochuc'); $dept_id = JRequest::getInt('id', 0); $row = $model->read($dept_id); $vanban_created = $model->getVanbanById($row->vanban_created); $trangthai = $model->getVanbanById($row->vanban_active); $file_created = $model->getFilebyIdVanban($row->vanban_created); $file_trangthai = $model->getFilebyIdVanban($row->vanban_active); $this->assignRef('row', $row); $this->assignRef('vanban_created', $vanban_created); $this->assignRef('trangthai', $trangthai); $this->assignRef('file_created', $file_created); $this->assignRef('file_trangthai', $file_trangthai); unset($tree_data_ins_loaihinh); unset($tree_data_ins_cap); unset($tree_data_ins_level); unset($tree_data_ins_goichucvu); unset($tree_data_ins_goiluong); unset($tree_data_ins_linhvuc); unset($tree_data_ins_parent); unset($tree_data_ins_dept); unset($row); unset($vanban_created); unset($file_created); unset($trangthai); unset($file_trangthai); }
public static function selectBox($value, $attrs, $table, $colums, $where = null, $order = null) { //var_dump($colums[0]); if (count($colums) >= 2) { if (isset($table) && is_array($table)) { $rows = $table; } else { $rows = TochucHelper::collect($table, $colums, $where); } //var_dump($rows);exit; 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 JHTML::_('select.genericlist',$options,$controlName, $controlAttrs, 'value','text',$value); } return ''; }