echo form_open('email/send', $atr, $hidden);
$atr = array('onclick' => 'saveFormData()');
echo bsButton('Save', 0, 'btn-save', $atr);
?>
 
	<?php 
echo bsInput("Menu", 'name', '', 'pendek');
$SQL = "select name from {$this->menu->tableIcon}";
//{$data['menu_parent']}";
$result = dbQuery($SQL, 1);
$i = 0;
$icons = array();
foreach ($result->result_array() as $row) {
    $icons[$row['name']] = $row['name'];
}
echo bsSelect("Icon", "icon", $icons, '');
?>
	<?php 
echo bsInput("Title", 'title', '', 'Nama yang Jelas');
?>
	<!--?=bsInput("Href",$name, $value='',$info='');?-->
	<?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' => 'Menambah Menu Utama', 'footer' => '-');
echo json_encode($result);
Example #2
0
****/
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;
    }
}
echo bsSelect("Table", "table", $tables, 101);
$atr = array('onclick' => 'saveFormData()');
echo bsButton('Go', 1, 'btn-save', $atr);
?>
	</div>
</form> 
?>
	<?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;
 }