public function movenode() { $formData = JRequest::get('post'); $id = JRequest::getInt('id', 0); $parent_id = JRequest::getInt('ref', 0); $model = JModelLegacy::getInstance('Thuhang', 'TochucModel'); $result = array(); if ($model->moveNode($id, $parent_id)) { $result['status'] = true; } else { $result['status'] = false; } AdminTochucHelper::printJson($result); }
public function orderdown() { $id = JRequest::getInt('id', 0); $model = JModelLegacy::getInstance('Tochuc', 'TochucModel'); $result = array(); if ($model->orderDown($id)) { $result['errCode'] = 0; } else { $result['errCode'] = 1; } AdminTochucHelper::printJson($result); //var_dump($model->orderUp($id)); //exit; }
/** * @since 1.5 */ 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; } AdminTochucHelper::addSubmenu($vName); $this->sidebar = JHtmlSidebar::render(); parent::display($tpl); }
public function getEditItem() { $id = JRequest::getInt('id', null); $data = $this->inputData(); $vName = JRequest::getString('view'); AdminTochucHelper::addButton($vName); // JToolBarHelper::title('Edit','generic.png' ); $model = JModelLegacy::getInstance('tochucdang', 'TochucModel'); if ($id == NULL) { $item = array(); } else { $item = $model->getEditItem($data['table'], $id); } $this->assignRef('data', $data); $this->assignRef('item', $item[0]); }
public function getSubTree() { $node_id = JRequest::getInt('id'); //$node_id = 0; $model = JModelLegacy::getInstance('Cap', 'TochucModel'); $rows = $model->getSubTree($node_id); var_dump($rows); exit; $data = array(); if (count($rows) > 0) { foreach ($rows as $row) { $data[] = array("attr" => array("id" => "node_" . $row->id), "data" => $row->name); } } AdminTochucHelper::printJson($data); }
private function _initEditPage() { $db = JFactory::getDbo(); $node_id = JRequest::getInt('id'); $arrChucvu = array(); if ((int) $node_id > 0) { $model = JModelLegacy::getInstance('Goichucvu', 'TochucModel'); $row = $model->read($node_id); $arrChucvu = $model->getChucvuByIdGoichucvu($row->id); } else { $row = new stdClass(); $row->status = 1; //$row->id = 0; $row->parent_id = JRequest::getInt('parent_id', 0); } //var_dump($row); // lay du lieu tree // $query = "SELECT a.id,a.parent_id,a.name as data,IF(b.goichucvu_id IS NOT NULL,'jstree-checked','jstree-unchecked') AS class,IF(a.chucvu = 1,'file','folder') AS type FROM pos_system a LEFT JOIN cb_goichucvu_chucvu b ON b.pos_system_id = a.id AND b.goichucvu_id = ".$db->quote($node_id)." WHERE a.status = 1"; $query = "SELECT a.id,a.parent_id,a.name as data,IF(a.chucvu = 1,'file','folder') AS type FROM pos_system a WHERE a.status = 1"; $db->setQuery($query); $inArray = $db->loadAssocList(); //var_dump($inArray); $tree_data_pos_system = array(); AdminTochucHelper::makeParentChildRelationsForTree($inArray, &$tree_data_pos_system, 5); unset($inArray); $query = "SELECT a.id,a.parent_id,a.name,IF(b.ins_level_id IS NOT NULL,'jstree-checked','jstree-unchecked') AS class,IF((a.rgt-a.lft) = 1,'file','folder') AS type FROM ins_level a LEFT JOIN cb_goichucvu b ON b.ins_level_id = a.id AND b.id = " . $db->quote($node_id) . " WHERE a.status = 1"; $db->setQuery($query); $inArray = $db->loadAssocList(); //var_dump($inArray); $tree_data_ins_level = array(); AdminTochucHelper::makeParentChildRelationsForTree($inArray, &$tree_data_ins_level, 0); unset($inArray); $this->assignRef('row', $row); $this->assignRef('arrChucvu', $arrChucvu); $this->assignRef('tree_data_pos_system', $tree_data_pos_system); $this->assignRef('tree_data_ins_level', $tree_data_ins_level); }
<div class="controls"> <input type="text" id="id" name="id" value="<?php echo $this->row->id; ?> " readonly> </div> </div> <div class="control-group"> <label class="control-label" for="parent_id">Cha</label> <div class="controls"> <input type="hidden" id="parent_id" name="parent_id" value="<?php echo $this->row->parent_id; ?> "> <span><?php echo AdminTochucHelper::getNameById($this->row->parent_id, 'cb_goichucvu', 'name'); ?> </span> </div> </div> <div class="control-group"> <label class="control-label" for="name">Tên</label> <div class="controls"> <input type="text" id="name" placeholder="Nhập tên" name="name" value="<?php echo $this->row->name; ?> "> </div> </div> <div class="control-group">
<div class="controls"> <input type="text" id="di" name="id" value="<?php echo $this->row->id; ?> " readonly> </div> </div> <div class="control-group"> <label class="control-label" for="parent_id">Cấp cha</label> <div class="controls"> <input type="hidden" id="parent_id" name="parent_id" value="<?php echo $this->row->parent_id; ?> "> <?php echo AdminTochucHelper::getNameById($this->row->parent_id, 'ins_cap'); ?> </div> </div> <div class="control-group"> <label class="control-label" for="name">Tên</label> <div class="controls"> <input type="text" id="name" placeholder="Nhập tên cấp" name="name" value="<?php echo $this->row->name; ?> "> </div> </div> <div class="control-group"> <div class="controls">
static function makeDataForTree(&$inArray, &$outArray, $currentParentId = 0) { if (!is_array($inArray)) { return; } if (!is_array($outArray)) { return; } foreach ($inArray as $key => $tuple) { if ($tuple['parent_id'] == $currentParentId) { $tuple['additionalParameters']['children'][] = array(); AdminTochucHelper::makeDataForTree($inArray, $tuple['additionalParameters']['children'], $tuple['id']); $outArray[] = $tuple; //unset($inArray[$key]); } } }
<div class="controls"> <input type="text" id="id" name="id" value="<?php echo $this->row->id; ?> " readonly> </div> </div> <div class="control-group"> <label class="control-label" for="parent_id">Cấp cha</label> <div class="controls"> <input type="hidden" id="parent_id" name="parent_id" value="<?php echo (int) $this->row->parent_id; ?> "> <?php echo AdminTochucHelper::getNameById($this->row->parent_id, 'cb_goiluong', 'name', 'id'); ?> </div> </div> <div class="control-group"> <label class="control-label" for="name">Tên</label> <div class="controls"> <input type="text" id="name" placeholder="Nhập tên cấp" name="name" value="<?php echo $this->row->name; ?> "> </div> </div> <div class="control-group"> <div class="controls">
</div> </div> <div class="control-group"> <label class="control-label" for="name">Tên</label> <div class="controls"> <input type="text" id="name" placeholder="Nhập tên cấp" name="name" value="<?php echo $this->row->name; ?> "> </div> </div> <div class="control-group"> <label class="control-label" for="type">Loại</label> <div class="controls"> <?php $type = $this->row->id == 0 ? AdminTochucHelper::getTypeById($this->row->parent_id, 'cb_type_linhvuc') : $this->row->type; echo JHTML::_('select.genericlist', array(array('value' => '', 'text' => ''), array('value' => '1', 'text' => 'Phòng'), array('value' => '2', 'text' => 'Tổ chức')), 'type', array(), 'value', 'text', $type); ?> </div> </div> </fieldset> <?php echo JHTML::_('form.token'); ?> </form> <script type="text/javascript"> jQuery(document).ready(function ($){ // jQuery('#parent_id').chosen({
<div class="controls"> <input type="text" id="ID" name="ID" value="<?php echo $this->row->ID; ?> " readonly> </div> </div> <div class="control-group"> <label class="control-label" for="PARENTID">Cấp cha</label> <div class="controls"> <input type="hidden" id="PARENTID" name="PARENTID" value="<?php echo (int) $this->row->PARENTID; ?> "> <?php echo AdminTochucHelper::getNameById($this->row->PARENTID, 'cb_goiluong', 'NAME', 'ID'); ?> </div> </div> <div class="control-group"> <label class="control-label" for="NAME">Tên</label> <div class="controls"> <input type="text" id="NAME" placeholder="Nhập tên cấp" name="NAME" value="<?php echo $this->row->NAME; ?> "> </div> </div> <div class="control-group"> <div class="controls">
<div class="controls"> <input type="text" id="heso" name="heso" value="<?php echo $this->item->heso; ?> " readonly> </div> </div> <div class="control-group"> <label class="control-label" for="mangach">Mã ngạch</label> <div class="controls"> <input type="hidden" id="mangach" name="mangach" value="<?php echo $this->item->mangach; ?> "> <span><?php echo AdminTochucHelper::getNameById($this->item->mangach, 'pos_system'); ?> </span> <div id="tochuc-goichucvu-tree"></div> </div> </div> </div> <div class="modal-footer"> <a href="#" class="btn" data-dismiss="modal" aria-hidden="true">Close</a> <input type="submit" class="btn btn-primary" value="Lưu" name="btnSubmit"> </div> <?php echo JHTML::_('form.token'); ?> </form> </div>
<thead> <tr> <th>Ngạch</th> <th>Tên</th> <th>Hệ số</th> <th>#</th> </tr> </thead> <tbody> <?php for ($i = 0; $i < count($this->items); $i++) { $item = $this->items[$i]; ?> <tr> <td><?php echo AdminTochucHelper::getNameById((int) $item->mangach, 'pos_system', 'NAME', 'ID'); ?> </td> <td><?php echo $item->tencap; ?> </td> <td><?php echo $item->heso; ?> </td> <td> <div class="btn-group"> <a href="index.php?option=com_tochuc&controller=chucvu&task=editpos&format=raw&id=<?php echo $item->idchucvu; ?>
<div class="controls"> <input type="text" id="di" name="id" value="<?php echo $this->row->id; ?> " readonly> </div> </div> <div class="control-group"> <label class="control-label" for="parent_id">Cấp cha</label> <div class="controls"> <input type="hidden" id="parent_id" name="parent_id" value="<?php echo $this->row->parent_id; ?> "> <?php echo AdminTochucHelper::getNameById($this->row->parent_id, 'ins_dept_loaihinh'); ?> </div> </div> <div class="control-group"> <label class="control-label" for="name">Tên</label> <div class="controls"> <input type="text" id="name" placeholder="Nhập tên cấp" name="name" value="<?php echo $this->row->name; ?> "> </div> </div> <div class="control-group"> <label class="control-label" for="code">Mã</label>