本文整理汇总了PHP中wbUtil::jsonDecode方法的典型用法代码示例。如果您正苦于以下问题:PHP wbUtil::jsonDecode方法的具体用法?PHP wbUtil::jsonDecode怎么用?PHP wbUtil::jsonDecode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wbUtil
的用法示例。
在下文中一共展示了wbUtil::jsonDecode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getJumlahPerJenis
public static function getJumlahPerJenis()
{
$jsonItems = wbRequest::getVarClean('jsonItems', 'str', '');
$item = wbUtil::jsonDecode($jsonItems);
$tRumahSakit =& wbModule::getModel('bds', 'd_rumahsakit');
$jumlah = $tRumahSakit->getJumlahPerJenis($item['param_id']);
$data = array('items' => array(), 'total' => 0, 'success' => true, 'message' => '');
$data['items'] = $jumlah;
return $data;
}
示例2: getJumlahPerKecamatan
public static function getJumlahPerKecamatan()
{
$jsonItems = wbRequest::getVarClean('jsonItems', 'str', '');
$item = wbUtil::jsonDecode($jsonItems);
$tPuskesmas =& wbModule::getModel('bds', 'd_puskesmas');
$jumlah = $tPuskesmas->getJumlahPerKecamatan($item['wilayah_id']);
$data = array('items' => array(), 'total' => 0, 'success' => true, 'message' => '');
$data['items'] = $jumlah;
return $data;
}
示例3: getItem
public static function getItem()
{
$jsonItems = wbRequest::getVarClean('jsonItems', 'str', '');
$item = wbUtil::jsonDecode($jsonItems);
$tTernak =& wbModule::getModel('bds', 't_ternak');
$itemTernak = $tTernak->getItem($item['tahun'], $item['param_id']);
$data = array('items' => array(), 'total' => 0, 'success' => true, 'message' => '');
$data['items'] = $itemTernak;
return $data;
}
示例4: getItem
public static function getItem()
{
$jsonItems = wbRequest::getVarClean('jsonItems', 'str', '');
$item = wbUtil::jsonDecode($jsonItems);
$tArmada =& wbModule::getModel('bds', 't_armada');
$itemArmada = $tArmada->getItem($item['tahun'], $item['trayek_id']);
$data = array('items' => array(), 'total' => 0, 'success' => true, 'message' => '');
$data['items'] = $itemArmada;
return $data;
}
示例5: getProduksiKomoditas
public static function getProduksiKomoditas()
{
$jsonItems = wbRequest::getVarClean('jsonItems', 'str', '');
$item = wbUtil::jsonDecode($jsonItems);
$tProduksi =& wbModule::getModel('bds', 't_agr_komod_prod');
$itemProduksi = $tProduksi->getProduksiKomoditas($item['tahun'], $item['d_agr_komiditas_id']);
$data = array('items' => array(), 'total' => 0, 'success' => true, 'message' => '');
$data['items'] = $itemProduksi;
return $data;
}
示例6: ws_proccess
function ws_proccess($search, $getParams, $controller, $postParams, $jsonItems, $start, $limit)
{
$GLOBALS["Webi_PageTime"] = microtime(true);
include 'lib/bootstrap.php';
/* Load Webi Core */
sys::import('webi.core');
wbCore::init();
$_GET['jsonItems'] = $jsonItems;
if (!empty($getParams)) {
$getParams =& wbUtil::jsonDecode($getParams);
} else {
$getParams = array();
}
if (json_decode($postParams) > 0) {
$postParams = json_decode($postParams);
} else {
$postParams = array();
}
$controller =& wbUtil::jsonDecode($controller);
$type = $controller['type'];
if (!empty($getParams)) {
foreach ($getParams as $key => $value) {
$_GET[$key] = $value;
}
}
if (!empty($postParams)) {
foreach ($postParams as $key => $value) {
$_POST[$key] = $value;
}
}
$_GET['module'] = $controller['module'];
$_GET['class'] = $controller['class'];
$_GET['method'] = $controller['method'];
list($module, $class, $method) = wbRequest::getController();
$callback = wbRequest::getVarClean('callback');
if (!wbModule::isAvailable($module, $class, $type)) {
header("HTTP/1.1 400 Bad Request");
return;
}
try {
$result = wbModule::call($module, $class, $method, array(), $type);
} catch (Exception $e) {
$result = array('items' => array(), 'total' => 0, 'success' => false, 'message' => $e->getMessage());
}
$return = array();
$return['success'] = $result['success'];
$return['message'] = $result['message'];
$return['total'] = (int) $result['total'];
$return['data'] = $result['items'];
$return['current'] = (int) $result['current'];
$return['rowCount'] = (int) $result['rowCount'];
$return = base64_encode(serialize($return));
return $return;
}
示例7: getCountByPendidikanID
public static function getCountByPendidikanID()
{
$tWarga =& wbModule::getModel('bds', 'd_warga');
$jsonItems = wbRequest::getVarClean('jsonItems', 'str', '');
$item = wbUtil::jsonDecode($jsonItems);
$jumlah = $tWarga->getCountByAge($item['param_id']);
$jumlah_l = $tWarga->getCountByAge($item['param_id'], 6);
$jumlah_p = $tWarga->getCountByAge($item['param_id'], 7);
$itemJumlah = array();
$itemJumlah['jumlah'] = $jumlah;
$itemJumlah['jumlah_l'] = $jumlah_l;
$itemJumlah['jumlah_p'] = $jumlah_p;
$data = array('items' => array(), 'total' => 0, 'success' => true, 'message' => '');
$data['items'] = $itemJumlah;
return $data;
}
示例8: submitRegistration
public static function submitRegistration($args = array())
{
// Security check
//if (!wbSecurity::check('DHotel')) return;
// Get arguments from argument array
$jsonItems = wbRequest::getVarClean('items', 'str', '');
$items =& wbUtil::jsonDecode($jsonItems);
$data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
try {
$ws_client = self::getNusoap();
$params = array('search' => '', 'getParams' => json_encode($_GET), 'controller' => json_encode(array('module' => 'bds', 'class' => 't_vat_registration', 'method' => 'destroy', 'type' => 'json')), 'postParams' => json_encode($_POST), 'jsonItems' => '', 'start' => $start, 'limit' => $limit);
$ws_data = self::getResultData($ws_client, $params);
$data['items'] = $ws_data['data'];
$data['total'] = $ws_data['total'];
$data['message'] = $ws_data['message'];
$data['success'] = $ws_data['success'];
} catch (Exception $e) {
$data['message'] = $e->getMessage();
}
return $data;
}
示例9: upload_excel
public static function upload_excel($args = array())
{
$jsonItems = wbRequest::getVarClean('jsonItems', 'str', '');
$item = wbUtil::jsonDecode($jsonItems);
$table =& wbModule::getModel('bds', 'smp_detail');
$table->actionType = 'CREATE';
$items = $item['items'];
$data = array('items' => array(), 'total' => 0, 'success' => true, 'message' => '');
try {
$errorMessage = '';
/* cek data sd */
$tahunAjaranSMPExist = $table->isExistTahunAjaran($items[0]['smp_id'], $items[0]['smp_det_thn_ajaran']);
if (!$tahunAjaranSMPExist) {
$items[0][$table->pkey] = $table->GenID();
$table->setRecord($items[0]);
$table->create();
} else {
$errorMessage .= '- Data SMP Tahun Ajaran ' . $items[0]['smp_det_thn_ajaran'] . ' tidak dapat diinput karena sudah ada <br>';
}
/* cek data mi */
$tahunAjaranMTSExist = $table->isExistTahunAjaran($items[1]['smp_id'], $items[1]['smp_det_thn_ajaran']);
if (!$tahunAjaranMTSExist) {
$items[1][$table->pkey] = $table->GenID();
$table->setRecord($items[1]);
$table->create();
} else {
$errorMessage .= '- Data MTS Tahun Ajaran ' . $items[1]['smp_det_thn_ajaran'] . ' tidak dapat diinput karena sudah ada <br>';
}
if (empty($errorMessage)) {
return $data;
} else {
throw new Exception($errorMessage);
}
} catch (Exception $e) {
$data['success'] = false;
$data['message'] = $e->getMessage();
return $data;
}
}
示例10: destroy
/**
* update
* controler for remove item
*/
public static function destroy($args = array())
{
// Security check
//if (!wbSecurity::check('DHotel')) return;
// Get arguments from argument array
$jsonItems = wbRequest::getVarClean('items', 'str', '');
$items =& wbUtil::jsonDecode($jsonItems);
$data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
try {
$ws_client = self::getNusoap();
$params = array('search' => '', 'getParams' => json_encode($_GET), 'controller' => json_encode(array('module' => 'bds', 'class' => 't_cust_order_legal_doc', 'method' => 'destroy', 'type' => 'json')), 'postParams' => json_encode($_POST), 'jsonItems' => '', 'start' => $start, 'limit' => $limit);
$ws_data = self::getResultData($ws_client, $params);
if ($ws_data['data']['single']) {
if ($ws_data['success']) {
$r = $ws_data['data']['old_row'];
if (!empty($r['origin_file_name']) && is_file(self::imurl() . $ws_data['data']['deleted']['t_cust_order_legal_doc_id'] . '_' . $r['origin_file_name'])) {
@unlink(self::imurl() . $ws_data['data']['deleted']['t_cust_order_legal_doc_id'] . '_' . $r['origin_file_name']);
if (is_file(self::imurl() . 'th_' . $ws_data['data']['deleted']['t_cust_order_legal_doc_id'] . '_' . $r['origin_file_name'])) {
@unlink(self::imurl() . 'th_' . $ws_data['data']['deleted']['t_cust_order_legal_doc_id'] . '_' . $r['origin_file_name']);
}
if (is_file(self::imurl() . 'view_' . $ws_data['data']['deleted']['t_cust_order_legal_doc_id'] . '_' . $r['origin_file_name'])) {
@unlink(self::imurl() . 'view_' . $ws_data['data']['deleted']['t_cust_order_legal_doc_id'] . '_' . $r['origin_file_name']);
}
}
}
} else {
if ($ws_data['success']) {
foreach ($ws_data['data'] as $item) {
$r = $item['old_row'];
if (!empty($r['origin_file_name']) && is_file(self::imurl() . $item['deleted']['t_cust_order_legal_doc_id'] . '_' . $r['origin_file_name'])) {
@unlink(self::imurl() . $item['deleted']['t_cust_order_legal_doc_id'] . '_' . $r['origin_file_name']);
if (is_file(self::imurl() . 'th_' . $item['deleted']['t_cust_order_legal_doc_id'] . '_' . $r['origin_file_name'])) {
@unlink(self::imurl() . 'th_' . $item['deleted']['t_cust_order_legal_doc_id'] . '_' . $r['origin_file_name']);
}
if (is_file(self::imurl() . 'view_' . $item['deleted']['t_cust_order_legal_doc_id'] . '_' . $r['origin_file_name'])) {
@unlink(self::imurl() . 'view_' . $item['deleted']['t_cust_order_legal_doc_id'] . '_' . $r['origin_file_name']);
}
}
}
}
}
$data['items'] = $ws_data['data'];
$data['total'] = $ws_data['total'];
$data['message'] = $ws_data['message'];
$data['success'] = $ws_data['success'];
} catch (Exception $e) {
$data['message'] = $e->getMessage();
}
return $data;
}
示例11: upload_excel
public static function upload_excel($args = array())
{
$jsonItems = wbRequest::getVarClean('jsonItems', 'str', '');
$item = wbUtil::jsonDecode($jsonItems);
$table =& wbModule::getModel('bds', 't_modern_mart');
$table->actionType = 'CREATE';
$parameter =& wbModule::getModel('bds', 'p_parameter');
$items = $item['items'];
$data = array('items' => array(), 'total' => 0, 'success' => true, 'message' => '');
try {
$errorMessage = '';
/* cek data */
foreach ($items as $rec) {
$errorMessage .= $table->cekValid(trim($rec['param_name']), $rec['mmart_tahun']);
}
if (!empty($errorMessage)) {
throw new Exception('Input data gagal, dikarenakan : <br>' . $errorMessage);
}
foreach ($items as $rec) {
$rec[$table->pkey] = $table->GenID();
$rec['type_id'] = $parameter->getIDbyName(trim($rec['param_name']));
$table->setRecord($rec);
$table->create();
}
return $data;
} catch (Exception $e) {
$data['success'] = false;
$data['message'] = $e->getMessage();
return $data;
}
}
示例12: destroy
/**
* update
* controler for remove item
*/
public static function destroy($args = array())
{
// Security check
//wbSecurity::check('RolePermission', ACCESS_DELETE);
// Get arguments from argument array
//extract($args);
$jsonItems = wbRequest::getVarClean('items', 'str', '');
$items =& wbUtil::jsonDecode($jsonItems);
$data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
try {
$ws_client = self::getNusoap();
$params = array('search' => '', 'getParams' => json_encode($_GET), 'controller' => json_encode(array('module' => 'base', 'class' => 'roles.role_permission', 'method' => 'destroy', 'type' => 'json')), 'postParams' => json_encode($_POST), 'jsonItems' => '', 'start' => $start, 'limit' => $limit);
$ws_data = self::getResultData($ws_client, $params);
$data['items'] = $ws_data['data'];
$data['total'] = $ws_data['total'];
$data['message'] = $ws_data['message'];
$data['success'] = $ws_data['success'];
} catch (Exception $e) {
$data['message'] = $e->getMessage();
}
return $data;
}
示例13: destroy
/**
* update
* controler for remove item
*/
public static function destroy($args = array())
{
// Security check
wbSecurity::check('PRoleMenu', ACCESS_DELETE);
// Get arguments from argument array
extract($args);
$jsonItems = wbRequest::getVarClean('items', 'str', '');
$items =& wbUtil::jsonDecode($jsonItems);
$data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
$table =& wbModule::getModel('bds', 'p_role_menu');
try {
$table->dbconn->BeginTrans();
if (is_array($items)) {
foreach ($items as $key => $value) {
if (empty($value)) {
throw new Exception('Empty parameter');
}
$keys = explode('.', $value);
if (empty($keys[0]) || empty($keys[1])) {
throw new Exception('Invalid Role Permission ID');
}
$table->remove($keys[0], $keys[1]);
$data['items'][] = array('p_role_menu_id' => $value);
$data['total']++;
}
} else {
if (empty($items)) {
throw new Exception('Empty parameter');
}
$keys = explode('.', $items);
if (empty($keys[0]) || empty($keys[1])) {
throw new Exception('Invalid Role Permission ID');
}
$table->remove($keys[0], $keys[1]);
$data['items'][] = array('p_role_menu_id' => $items);
$data['total'] = 1;
}
$data['success'] = true;
$data['message'] = $data['total'] . ' Data berhasil dihapus';
$table->dbconn->CommitTrans();
} catch (Exception $e) {
$table->dbconn->RollbackTrans();
$data['message'] = $e->getMessage();
$data['items'] = array();
$data['total'] = 0;
}
return $data;
}
示例14: upload_excel
public static function upload_excel($args = array())
{
$jsonItems = wbRequest::getVarClean('jsonItems', 'str', '');
$item = wbUtil::jsonDecode($jsonItems);
$table =& wbModule::getModel('bds', 'p_vat_type_dtl');
$table->actionType = 'CREATE';
$items = $item['items'];
$data = array('items' => array(), 'total' => 0, 'success' => true, 'message' => '');
try {
foreach ($items as $rec) {
$rec[$table->pkey] = $table->GenID();
$table->setRecord($rec);
$table->create();
}
return $data;
} catch (Exception $e) {
$data['success'] = false;
$data['message'] = $e->getMessage();
return $data;
}
}
示例15: upload_excel
public static function upload_excel($args = array())
{
include 'lib/excel/reader.php';
$data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
global $_FILES;
try {
if (empty($_FILES['excel_file']['name'])) {
throw new Exception('File tidak boleh kosong');
}
} catch (Exception $e) {
$data['message'] = $e->getMessage();
echo json_encode($data);
session_write_close();
exit;
}
$jsonItems = wbRequest::getVarClean('items', 'str', '');
$smp_tahun_ajaran = wbRequest::getVarClean('smp_tahun_ajaran', 'str', '');
$items =& wbUtil::jsonDecode($jsonItems);
if (!is_array($items)) {
$data['message'] = 'Invalid items parameter';
return $data;
}
$file_name = $_FILES['excel_file']['name'];
$file_location = 'var/uploadexcel/' . $file_name;
if (!move_uploaded_file($_FILES['excel_file']['tmp_name'], $file_location)) {
throw new Exception("Upload file gagal");
}
$xl_reader =& new Spreadsheet_Excel_Reader();
$res = $xl_reader->_ole->read($file_location);
if ($res === false) {
if ($xl_reader->_ole->error == 1) {
$data['message'] = 'Harus File Excel';
echo json_encode($data);
session_write_close();
exit;
}
}
try {
$xl_reader->read($file_location);
$firstColumn = $xl_reader->sheets[0]['cells'][1][1];
if (strtoupper($firstColumn) != 'DATA SEKOLAH MENENGAH PERTAMA') {
throw new Exception('Format Table Salah');
}
} catch (Exception $e) {
$data['message'] = $e->getMessage();
echo json_encode($data);
session_write_close();
exit;
}
/* insert data */
$recInsert = array();
$items = array();
try {
//-----------------------
// SMP
//-----------------------
$items[0]['smp_id'] = 1;
$items[0]['smp_det_thn_ajaran'] = $smp_tahun_ajaran;
$items[0]['smp_det_jmlsekolah'] = $xl_reader->sheets[0]['cells'][6][3];
$items[0]['smp_det_siswabaru'] = $xl_reader->sheets[0]['cells'][7][3];
$items[0]['smp_det_siwa_lt_13_thn'] = $xl_reader->sheets[0]['cells'][9][3];
$items[0]['smp_det_siswa_13_15_thn'] = $xl_reader->sheets[0]['cells'][10][3];
$items[0]['smp_det_siswa_gt_15_thn'] = $xl_reader->sheets[0]['cells'][11][3];
$items[0]['smp_det_siswa_laki'] = $xl_reader->sheets[0]['cells'][13][3];
$items[0]['smp_det_siswa_perempuan'] = $xl_reader->sheets[0]['cells'][17][3];
$items[0]['smp_det_jml_siswa_negeri'] = $xl_reader->sheets[0]['cells'][22][3];
$items[0]['smp_det_jml_siswa_swasta'] = $xl_reader->sheets[0]['cells'][23][3];
$items[0]['smp_det_jml_kelas7'] = $xl_reader->sheets[0]['cells'][25][3];
$items[0]['smp_det_jml_kelas8'] = $xl_reader->sheets[0]['cells'][26][3];
$items[0]['smp_det_jml_kelas9'] = $xl_reader->sheets[0]['cells'][27][3];
$items[0]['smp_det_ulang_kelas7'] = $xl_reader->sheets[0]['cells'][33][3];
$items[0]['smp_det_ulang_kelas8'] = $xl_reader->sheets[0]['cells'][34][3];
$items[0]['smp_det_ulang_kelas9'] = $xl_reader->sheets[0]['cells'][35][3];
$items[0]['smp_det_putus_kelas7'] = $xl_reader->sheets[0]['cells'][37][3];
$items[0]['smp_det_putus_kelas8'] = $xl_reader->sheets[0]['cells'][38][3];
$items[0]['smp_det_putus_kelas9'] = $xl_reader->sheets[0]['cells'][39][3];
//------------------------
// MTS
//------------------------
$items[1]['smp_id'] = 2;
$items[1]['smp_det_thn_ajaran'] = $smp_tahun_ajaran;
$items[1]['smp_det_jmlsekolah'] = $xl_reader->sheets[0]['cells'][6][4];
$items[1]['smp_det_siswabaru'] = $xl_reader->sheets[0]['cells'][7][4];
$items[1]['smp_det_siwa_lt_13_thn'] = $xl_reader->sheets[0]['cells'][9][4];
$items[1]['smp_det_siswa_13_15_thn'] = $xl_reader->sheets[0]['cells'][10][4];
$items[1]['smp_det_siswa_gt_15_thn'] = $xl_reader->sheets[0]['cells'][11][4];
$items[1]['smp_det_siswa_laki'] = $xl_reader->sheets[0]['cells'][13][4];
$items[1]['smp_det_siswa_perempuan'] = $xl_reader->sheets[0]['cells'][17][4];
$items[1]['smp_det_jml_siswa_negeri'] = $xl_reader->sheets[0]['cells'][22][4];
$items[1]['smp_det_jml_siswa_swasta'] = $xl_reader->sheets[0]['cells'][23][4];
$items[1]['smp_det_jml_kelas7'] = $xl_reader->sheets[0]['cells'][25][4];
$items[1]['smp_det_jml_kelas8'] = $xl_reader->sheets[0]['cells'][26][4];
$items[1]['smp_det_jml_kelas9'] = $xl_reader->sheets[0]['cells'][27][4];
$items[1]['smp_det_ulang_kelas7'] = $xl_reader->sheets[0]['cells'][33][4];
$items[1]['smp_det_ulang_kelas8'] = $xl_reader->sheets[0]['cells'][34][4];
$items[1]['smp_det_ulang_kelas9'] = $xl_reader->sheets[0]['cells'][35][4];
$items[1]['smp_det_putus_kelas7'] = $xl_reader->sheets[0]['cells'][37][4];
$items[1]['smp_det_putus_kelas8'] = $xl_reader->sheets[0]['cells'][38][4];
$items[1]['smp_det_putus_kelas9'] = $xl_reader->sheets[0]['cells'][39][4];
$ws_client = self::getNusoap();
//.........这里部分代码省略.........