/****
	views	: core/coreStatusEditForm_view
	created	: 11-11-2015 19:15:35
	By		: Gunawan Wibisono
	Using 	: CI3 Main Model
****/
defined('BASEPATH') or exit('No direct script access allowed');
ob_start();
$module = "status";
//change this
$data = $this->{$module}->getData($post['stat_id'], 'stat_id');
$id = dbIdReport('id', 'edit mujur_status', $post['stat_id']);
$atr = array('id' => 'frmMain');
$hidden = array('type' => 'update', 'stat_id' => $post['stat_id']);
echo form_open('', $atr, $hidden);
echo bsInput("Code", 'code', $data['code'], 'Nama Yang Jelas');
echo bsInput("Nama", 'name', $data['name'], 'Nama Yang Jelas');
echo bsText("Detail", 'detail', '');
?>
	
	<?php 
$atr = array('onclick' => 'saveFormData()');
echo bsButton('Save', 0, 'btn-save', $atr);
?>
</form>
<?php 
$content = ob_get_contents();
ob_end_clean();
$result = array('body' => $content, 'title' => 'Update mujur_status', 'footer' => ' ');
echo json_encode($result);
<?php

/****
	views	: core/coreTablesotherForm_view
	created	: 14-11-2015 12:13:31
	By		: Gunawan Wibisono
	Using 	: CI3 Main Model
****/
defined('BASEPATH') or exit('No direct script access allowed');
ob_start();
//print_r($_POST);
$this->param['tableData'] = $this->table->getData($post['table_id']);
/*---------MAIN view---*/
$files = array("Main View" => "core/oth/tmp_mainview", "JavaScript" => "core/oth/tmp_js", "Form Add" => "core/oth/tmp_formadd", "Form Edit" => "core/oth/tmp_formedit", "Data Save" => "core/oth/tmp_save", "Data List" => "core/oth/tmp_data");
foreach ($files as $title => $load_view) {
    $detail = $this->load->view($load_view, $this->param, true);
    $detail = str_replace("< ?", "<?", $detail);
    echo bsText($title, 'detail' . $title, $detail, 10);
}
$content = ob_get_contents();
ob_end_clean();
$result = array('body' => $content, 'title' => $title, 'footer' => '-', 'post' => $post);
echo json_encode($result);
示例#3
0
<?php

/****
	views	: core/formmodel_view
	created	: 14-11-2015 10:28:28
	By		: Gunawan Wibisono
	Using 	: CI3 Main Model
****/
defined('BASEPATH') or exit('No direct script access allowed');
?>
<div   class='formGenerator'>
<?php 
if (isset($post['type'])) {
    echo bsText("Detail", 'detail', $detail, 10);
} else {
}
$atr = array('id' => 'frmMainMenu');
$hidden = array('type' => 'generate model');
echo form_open('', $atr, $hidden);
?>
	
<?php 
echo bsInput("Nama Model", 'name', '', 'nama model');
echo bsInput("Table id", 'tableid', 'id', 'table untuk counter');
echo bsInput("Table counter", 'counter', '100', 'counter');
$tables = array();
$table = $this->db->list_tables();
foreach ($table as $val) {
    if (strpos($val, "id_") === false) {
        $tables[$val] = $val;
    }
?>
	<?php 
echo bsInput("Position", 'pos', $data['position'], '');
?>
	<?php 
echo bsInput("Href", 'href', $data['href'], '');
$SQL = "select permit_id id, permit_name name \n\tfrom {$this->permision->table} order by permit_name";
//{$data['menu_parent']}";
$result = dbQuery($SQL, 1);
$i = 0;
$shows = array();
foreach ($result->result_array() as $row) {
    $name = $row['name'];
    $shows[$row['id']] = $name;
}
echo bsSelect("Show Permision", "show", $shows, $data['show']);
?>
	
	<?php 
echo bsText("Detail", 'detail', $data['detail']);
?>
	<?php 
$atr = array('onclick' => 'saveFormData()');
echo bsButton('Update', 0, 'btn-save', $atr);
?>
</form>
<?php 
$content = ob_get_contents();
ob_end_clean();
$result = array('body' => $content, 'title' => 'Update Menu ', 'footer' => '-');
echo json_encode($result);
 function data($params)
 {
     $CI = $this->CI;
     ob_start();
     extract($params);
     //-------DATA
     if ($group == 0) {
         $group = 62;
     } else {
     }
     if (!is_array($group)) {
         $group = array($group);
     }
     $valGroup = "'" . implode("','", $group) . "'";
     if ($post['id'] != 0) {
         $SQL = "select obj_id id, obj_group `group`\n\t\tFROM " . $CI->objProduct->table . "   \n\t\twhere `obj_group` in({$valGroup})\n\t\tand obj_id=" . $post['id'];
         $result = dbQuery($SQL, 1);
         $row0 = $result->row_array();
         $row = $CI->objProduct->detail($row0['id']);
         $groupData = $CI->group->detail($row0['group']);
         $catData = $CI->category->detail($row['category']);
     } else {
         $row = $groupData = $catData = array();
     }
     $oth = array('onclick' => 'saveCategory()');
     $form = array();
     if (isset($row['code'])) {
         $s = form_hidden('id', $post['id']);
         $s .= bsInput('Code', 'code', $row['code']);
         $s .= bsInput('Name', 'name1', $row['name0']);
         $s .= bsInput('Invoice Name', 'name2', $row['name']);
         $s .= bsInput('Entity', 'entity', $row['entity']);
         $s .= bsText('Detail', 'note', $row['detail']);
     } else {
         $s = form_hidden('id', $post['id']);
         $s .= bsInput('Code', 'code');
         $s .= bsInput('Name', 'name1');
         $s .= bsInput('Invoice Name', 'name2');
         $s .= bsInput('Entity', 'entity');
         $s .= bsText('Detail', 'note');
     }
     $form['object'] = $s;
     $s = '';
     if (!isset($groupData['name'])) {
         $groupData = $CI->group->detail($group[0]);
         $s .= "<h4>NEW INPUT FOR GROUP</h4>";
         if (count($groupData) > 1) {
             $s .= form_hidden('group', $group[0]);
         } else {
             $groupData = $CI->group->detail($group[1]);
             $s .= form_hidden('group', $group[1]);
         }
         //json_encode($group);
     } else {
     }
     $s .= "Name:" . $groupData['name'];
     $s .= "<br/>" . $groupData['detail'];
     $form['group'] = $s;
     $s = '';
     $data = $CI->category->listAll($group);
     ///=======category
     $category = isset($row['category']) ? $row['category'] : 0;
     $s .= bsSelect('Category', 'category', $data, $category);
     if (isset($catData['detail'])) {
         $s .= "<hr/> Name:" . $catData['name'];
         $s .= "<br/>" . $catData['detail'];
     } else {
     }
     $form['category'] = $s;
     $s = '';
     //=========result
     $txt = ob_get_contents();
     ob_end_clean();
     $responce['body'] = $form;
     if ($txt != '') {
         $responce['error'] = $txt;
     }
     $responce['footer'] = '';
     $responce['data'] = array('object' => $row, 'group' => $groupData, 'category' => $catData);
     return $responce;
 }