public static function main()
    {
        if (!wbUser::isLoggedIn()) {
            $redirecturl = wbModule::url('bds', 'bds', 'main');
            wbResponse::Redirect(wbModule::url('base', 'base', 'loginform', array('redirecturl' => urlencode($redirecturl))));
        }
        $loadjsmod = wbRequest::getVarClean('loadjsmod', 'str', '');
        wbPage::setPage('jspage');
        $userInfo = wbUser::getSession();
        $role = '';
        if (isset($userInfo['roles'][0]['role_name'])) {
            $role = strtolower($userInfo['roles'][0]['role_name']);
        }
        $script = <<<HEREDOC
    Webi.ROUTE_URL = "ws.php?type=json&module=bds";
    var _UNAME = "{$userInfo['user_name']}";
    var _RNAME = "{$userInfo['user_realname']}";
    var _GNAME = "{$role}";
HEREDOC;
        wbPage::addScriptCode($script);
        wbPage::addScript('modules/bds/views/script/properties.js');
        wbPage::addScript('modules/bds/views/script/GridPanel.js');
        wbPage::addScript('modules/bds/views/script/FormPanel.js');
        wbPage::addScript('modules/bds/views/script/ModulePanel.js');
        wbPage::addScript('modules/base/views/script/roles-jsloader.php');
        wbPage::addScript('modules/bds/views/script/jsloader.php');
        return array('loadjsmod' => $loadjsmod);
    }
 public static function angin()
 {
     $sort = wbRequest::getVarClean('sort', 'str', 't_cuaca_id');
     $dir = wbRequest::getVarClean('dir', 'str', 'DESC');
     $query = wbRequest::getVarClean('query', 'str', '');
     $tahun = wbRequest::getVarClean('tahun', 'int', 0);
     $jenis = wbRequest::getVarClean('jenis', 'int', 0);
     try {
         $table =& wbModule::getModel('bds', 't_cuaca');
         //Set default criteria. You can override this if you want
         foreach ($table->fields as $key => $field) {
             if (!empty(${$key})) {
                 // <-- Perhatikan simbol $$
                 if ($field['type'] == 'str') {
                     $table->setCriteria($table->getAlias() . $key . $table->likeOperator . '?', array(${$key}));
                 } else {
                     $table->setCriteria($table->getAlias() . $key . ' = ?', array(${$key}));
                 }
             }
         }
         $query = $table->getDisplayFieldCriteria($query);
         if (!empty($query)) {
             $table->setCriteria($query);
         }
         $items = $table->getAll(0, -1, $sort, $dir);
     } catch (Exception $e) {
         $data['message'] = $e->getMessage();
     }
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $data['items'] = $items;
     $data['success'] = true;
     return $data;
 }
function wbMain()
{
    wbCore::init();
    list($module, $class, $method) = wbRequest::getController();
    // theme override
    $theme = wbRequest::getVarClean('theme');
    if (!empty($theme)) {
        wbPage::setTheme($theme);
    }
    $page = wbRequest::getVarClean('page');
    if (!empty($page)) {
        wbPage::setPage($page);
    }
    ob_start();
    $modView = wbModule::getView($module, $class, $method);
    if (ob_get_length() > 0) {
        $rawOutput = ob_get_contents();
        $modView = 'The following lines were printed in raw mode by module, however this
                      should not happen. The module is probably directly calling functions
                      like echo, print, or printf. Please modify the module to exclude direct output.
                      The module is violating Webi architecture principles.<br /><br />' . $rawOutput . '<br /><br />This is the real module output:<br /><br />' . $modView;
    }
    ob_end_clean();
    wbPage::render($modView);
}
 public function afterWrite()
 {
     if ($this->actionType == 'CREATE') {
         $table_inbox =& wbModule::getModel('bds', 't_message_inbox');
         $items = $this->record;
         try {
             // begin transaction block
             $table_inbox->dbconn->BeginTrans();
             // insert master
             $items[$table_inbox->pkey] = $table_inbox->GenID();
             unset($items['t_message_outbox_id']);
             $table_inbox->record = $items;
             $table_inbox->record['creation_date'] = date('Y-m-d h:i:s');
             $table_inbox->record['update_date'] = date('Y-m-d');
             $table_inbox->record['message_status'] = 'U';
             //print_r($table_inbox->record);
             //print_r($items);
             //exit;
             $table_inbox->create();
             // insert detail
             // all ok, commit transaction
             $table_inbox->dbconn->CommitTrans();
         } catch (Exception $e) {
             // something happen, rollback transaction
             $table_inbox->dbconn->RollbackTrans();
             throw new Exception($e->getMessage());
         }
     }
 }
 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;
 }
 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;
 }
 public static function tampil()
 {
     $tahun = wbRequest::getVarClean('tahun', 'int', 0);
     $daerah =& wbModule::getModel('bds', 'd_pasar');
     $items = $daerah->rekapPasar($tahun);
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $data['items'] = $items;
     $data['success'] = true;
     return $data;
 }
 public static function pendidikan()
 {
     $tParameter =& wbModule::getModel('bds', 'p_parameter');
     $tParameter->setCriteria('p_parameter_type.ptype_code ILIKE ?', 'PENDIDIKAN');
     $items = $tParameter->getAll(0, -1, 'param_listing_no', 'ASC');
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $data['items'] = $items;
     $data['success'] = true;
     return $data;
 }
 public static function tampil()
 {
     $tahun = wbRequest::getVarClean('tahun', 'int', 0);
     $wilayah =& wbModule::getModel('bds', 'p_parameter');
     $items = $wilayah->pbb_sppt($tahun);
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $data['items'] = $items;
     $data['success'] = true;
     return $data;
 }
 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;
 }
 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;
 }
 public static function cek()
 {
     $wilayah =& wbModule::getModel('bds', 'p_wilayah');
     $param[0] = array('value' => '94', 'field' => 'wilayah_id');
     $param[1] = array('value' => '88', 'field' => 'wilayah_pid');
     $param[1] = array('value' => '42', 'field' => 'wilayah_status');
     $items = $wilayah->uniqueAll('bds_p_wilayah', $param);
     echo $items;
     exit;
 }
 public static function show_per_jenis()
 {
     $tParameter =& wbModule::getModel('bds', 'p_parameter');
     $tParameter->setCriteria('p_parameter_type.ptype_code ILIKE ?', array('JENIS RUMAH SAKIT'));
     $itemsJenis = $tParameter->getAll(0, -1, 'param_listing_no', 'ASC');
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $data['items'] = $itemsJenis;
     $data['success'] = true;
     return $data;
 }
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;
}
 public static function tampil()
 {
     $tahun = wbRequest::getVarClean('tahun', 'int', 0);
     $tahun_akhir = wbRequest::getVarClean('tahun_akhir', 'int', 0);
     $industri =& wbModule::getModel('bds', 't_industri');
     $items = $industri->rekapIndustriTahun($tahun, $tahun_akhir);
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $data['items'] = $items;
     $data['success'] = true;
     return $data;
 }
Exemple #16
0
 public function cekValid($param_name, $mmart_tahun)
 {
     $table =& wbModule::getModel('bds', 'p_parameter');
     $param_id = $table->getIDbyName($param_name);
     if (empty($param_id)) {
         return '- Kesalahan Penulisan Jenis Pasar : ' . $param_name . '<br> ';
     }
     $isExist = $this->isExist($param_id, $mmart_tahun);
     if ($isExist) {
         return '- Data ' . $param_name . ' di Tahun ' . $mmart_tahun . ' sudah ada <br>';
     }
     return '';
 }
 /**
  * read
  * controler for get all items
  */
 public static function read($args = array())
 {
     // Security check
     //if (!wbSecurity::check('p_vat_type')) return;
     // Get arguments from argument array
     extract($args);
     $start = wbRequest::getVarClean('start', 'int', 0);
     $limit = wbRequest::getVarClean('limit', 'int', 50);
     $sort = wbRequest::getVarClean('sort', 'str', 'p_region_id');
     $dir = wbRequest::getVarClean('dir', 'str', 'ASC');
     $query = wbRequest::getVarClean('query', 'str', '');
     $p_region_id = wbRequest::getVarClean('p_region_id', 'int', 0);
     $parent_id = wbRequest::getVarClean('parent_id', 'int', 0);
     $description = wbRequest::getVarClean('description', 'str', '');
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     try {
         $table =& wbModule::getModel('bds', 'p_sub_region');
         //Set default criteria. You can override this if you want
         foreach ($table->fields as $key => $field) {
             if (!empty(${$key})) {
                 // <-- Perhatikan simbol $$
                 if ($field['type'] == 'str') {
                     $table->setCriteria($table->getAlias() . $key . $table->likeOperator . '?', array(${$key}));
                 } else {
                     $table->setCriteria($table->getAlias() . $key . ' = ?', array(${$key}));
                 }
             }
         }
         if (!empty($parent_id)) {
             $table->setCriteria('parent_id = ', array($parent_id));
         } else {
             $table->setCriteria("parent_id = 749");
         }
         if (!empty($code)) {
             $table->setCriteria('(code ILIKE ?)', array('%' . $code . '%'));
         }
         $query = $table->getDisplayFieldCriteria($query);
         if (!empty($query)) {
             $table->setCriteria($query);
         }
         $items = $table->getAll($start, $limit, $sort, $dir);
         $total = $table->countAll();
         $data['items'] = $items;
         $data['total'] = $total;
         $data['success'] = true;
     } catch (Exception $e) {
         $data['message'] = $e->getMessage();
     }
     return $data;
 }
 public static function send_email()
 {
     $email = wbRequest::getVarClean('email', 'str', '');
     $npwpd = wbRequest::getVarClean('npwpd', 'str', '');
     $user_name = wbRequest::getVarClean('user_name', 'str', '');
     $question = wbRequest::getVarClean('question', 'str', '');
     $answer = wbRequest::getVarClean('answer', 'str', '');
     $msg = '';
     if (empty($npwpd) or empty($email) or empty($user_name) or empty($answer)) {
         $msg .= 'Semua isian harus diisi. ';
     }
     if (!empty($msg)) {
         wbResponse::Redirect(wbModule::url('bds', 'helper', 'lupa_password', array('email' => $email, 'npwpd' => $npwpd, 'user_name' => $user_name, 'question' => $question, 'answer' => $answer, 'errorMsg' => $msg)));
     }
     /*cek jabawan*/
     try {
         $ws_client = self::getNusoap();
         $data2 = array();
         $params = array('search' => '', 'getParams' => json_encode($_GET), 'controller' => json_encode(array('module' => 'bds', 'class' => 'helper', 'method' => 'cek_jawaban', 'type' => 'json')), 'postParams' => json_encode($_POST), 'jsonItems' => '', 'start' => $start, 'limit' => $limit);
         $ws_data = self::getResultData($ws_client, $params);
         $data2['items'] = $ws_data['data'];
         $data2['total'] = $ws_data['total'];
         $data2['message'] = $ws_data['message'];
         $data2['success'] = $ws_data['success'];
     } catch (Exception $e) {
         $data2['message'] = $e->getMessage();
     }
     $items = $data2['items'];
     if ($data2['total'] > 0 and $data2['success']) {
         /* Ganti Password*/
         try {
             $ws_client = self::getNusoap();
             $data3 = array();
             $params = array('search' => '', 'getParams' => json_encode($_GET), 'controller' => json_encode(array('module' => 'bds', 'class' => 'helper', 'method' => 'ganti_password', 'type' => 'json')), 'postParams' => json_encode($_POST), 'jsonItems' => '', 'start' => $start, 'limit' => $limit);
             $ws_data = self::getResultData($ws_client, $params);
             $data3['items'] = $ws_data['data'];
             $data3['total'] = $ws_data['total'];
             $data3['message'] = $ws_data['message'];
             $data3['success'] = $ws_data['success'];
         } catch (Exception $e) {
             $data3['message'] = $e->getMessage();
         }
         /* Kirim Email */
         $new_password = $data3['message'];
         $respons = file_get_contents('http://202.154.24.3:81/mpd/send_email_forgot_password.php?receiver=' . $email . '&username='******'&password='******'bds', 'helper', 'lupa_password', array('errorMsg' => 'Password Berhasil Diubah. Silahkan cek email Anda untuk mengetahui password terbaru Anda.')));
     } else {
         wbResponse::Redirect(wbModule::url('bds', 'helper', 'lupa_password', array('email' => $email, 'npwpd' => $npwpd, 'user_name' => $user_name, 'question' => $question, 'answer' => $answer, 'hasil_query' => $items, 'errorMsg' => 'Data yang cocok tidak ditemukan.' . $data2['message'])));
     }
 }
 public static function show()
 {
     $tJalan =& wbModule::getModel('bds', 'd_jalan');
     $jenis_jalan = wbRequest::getVarClean('jenis_jalan', 'int', 0);
     //timestamp
     $t = wbRequest::getVarClean('t', 'str', '');
     if (empty($jenis_jalan)) {
         exit;
     }
     $items = $tJalan->getAllByJenisJalan($jenis_jalan);
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $data['items'] = $items;
     $data['success'] = true;
     return $data;
 }
Exemple #20
0
 /**
  * call module controller
  */
 public static function call($module, $class, $method, $params = array(), $type = '')
 {
     $className = self::loadController($module, $class, $type);
     if (!method_exists($className, $method)) {
         throw new ClassMethodNotExistException('Method ' . $method . ' does not exist in Class ' . $className);
     }
     $vars = get_class_vars($className);
     if (isset($vars['loggedInFirst']) && $vars['loggedInFirst'] === true) {
         if (!wbUser::isLoggedIn()) {
             $redirecturl = wbModule::url($module, $module, 'main');
             $url = wbModule::url('base', 'base', 'loginform', array('redirecturl' => $redirecturl));
             throw new Exception('Session login anda telah expire atau belum login. Silahkan <a href="' . $url . '" title="Login">Login</a> kembali.<br/><br/><b>Security Info</b><br/>Hal ini dilakukan untuk menjaga keamanan aplikasi, jika anda telah idle dalam jangka waktu yg cukup lama maka anda diharuskan untuk melakukan autentifikasi kembali');
         }
     }
     return call_user_func($className . '::' . $method, $params);
 }
 public static function login()
 {
     $redirecturl = wbRequest::getVarClean('redirecturl');
     $username = wbRequest::getVarClean('username');
     $password = wbRequest::getVarClean('password');
     try {
         $uid = wbUser::logIn($username, $password);
         if (!empty($redirecturl)) {
             wbResponse::Redirect($redirecturl);
         } else {
             wbResponse::Redirect('index.php');
         }
     } catch (UserLoginFailedException $e) {
         wbResponse::Redirect(wbModule::url('base', 'base', 'loginform', array('username' => $username, 'redirecturl' => urlencode($redirecturl), 'msg' => $e->getMessage())));
     }
 }
 public static function show()
 {
     $tSchoolLevel =& wbModule::getModel('bds', 'p_school_level');
     $tSchoolType =& wbModule::getModel('bds', 'p_school_type');
     $level_id = wbRequest::getVarClean('level_id', 'int', 0);
     $tahun = wbRequest::getVarClean('tahun', 'str', '');
     //timestamp
     $t = wbRequest::getVarClean('t', 'str', '');
     $items = $tSchoolType->getAllByLevelID($level_id, $tahun);
     $itemLevel = $tSchoolLevel->get($level_id);
     $retItems = array();
     $retItems['items'] = $items;
     $retItems['itemLevel'] = $itemLevel;
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $data['items'] = $retItems;
     $data['success'] = true;
     return $data;
 }
 public static function get_deposit_amount($args = array())
 {
     extract($args);
     $subscriber_id = wbRequest::getVarClean('subscriber_id', 'int', 0);
     try {
         $items = array();
         $table =& wbModule::getModel('paymentccbs', 'subscriber_deposit');
         $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
         $data['items'] = empty($subscriber_id) ? 0 : $table->get_deposit_amount($subscriber_id);
         $data['success'] = true;
         $data['total'] = 1;
         $data['message'] = 'success return value';
     } catch (Exception $e) {
         $data['message'] = $e->getMessage();
         $data['success'] = false;
     }
     return $data;
 }
 public static function tampil()
 {
     $tahun = wbRequest::getVarClean('tahun', 'int', 0);
     $penduduk =& wbModule::getModel('bds', 't_rpddk');
     $jenis = wbRequest::getVarClean('jenis', 'int', 0);
     if (!empty($jenis)) {
         $penduduk->setCriteria('jenisdata=' . $jenis);
     }
     if (!empty($tahun)) {
         $penduduk->setCriteria('tahun=' . $tahun);
     }
     $kelompok = array('1' => 'Usia', '2' => 'Pendidikan');
     $items = $penduduk->getAll(0, -1, 'kelompok_id', 'ASC');
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $data['items'] = $items;
     $data['success'] = true;
     return $data;
 }
 public static function get_user_loket($args = array())
 {
     extract($args);
     $p_user_loket_id = wbRequest::getVarClean('p_user_loket_id', 'int', 0);
     try {
         $items = array();
         $table =& wbModule::getModel('paymentccbs', 'p_user_loket');
         $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
         $data['items'] = $table->get($p_user_loket_id);
         $data['success'] = true;
         $data['total'] = 1;
         $data['message'] = 'berhasil';
     } catch (Exception $e) {
         $data['message'] = $e->getMessage();
         $data['success'] = false;
     }
     return $data;
 }
 public static function read($args = array())
 {
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     extract($args);
     $page = wbRequest::getVarClean('current', 'int', 1);
     $limit = wbRequest::getVarClean('rowCount', 'int', 10);
     $sort = wbRequest::getVarClean('sortby', 'str', 'p_bank_branch_id');
     $dir = wbRequest::getVarClean('sortdir', 'str', 'DESC');
     $searchPhrase = wbRequest::getVarClean('searchPhrase', 'str', '');
     $p_bank_branch_id = wbRequest::getVarClean('p_bank_branch_id', 'int', 0);
     $p_bank_id = wbRequest::getVarClean('p_bank_id', 'int', 0);
     $start = ($page - 1) * $limit;
     try {
         $table =& wbModule::getModel('paymentccbs', 'p_bank_branch');
         //Set default criteria. You can override this if you want
         foreach ($table->fields as $key => $field) {
             if (!empty(${$key})) {
                 // <-- Perhatikan simbol $$
                 if ($field['type'] == 'str') {
                     $table->setCriteria($table->getAlias() . $key . $table->likeOperator . '?', array(${$key}));
                 } else {
                     $table->setCriteria($table->getAlias() . $key . ' = ?', array(${$key}));
                 }
             }
         }
         if (!empty($searchPhrase)) {
             $table->setCriteria("(UPPER(bank_branch.code) ILIKE ? OR UPPER(bank.code) ILIKE ?)", array('%' . $searchPhrase . '%', '%' . $searchPhrase . '%'));
         }
         $items = $table->getAll($start, $limit, $sort, $dir);
         $total = $table->countAll();
         $data['items'] = $items;
         $data['total'] = $total;
         $data['current'] = $page;
         $data['rowCount'] = $limit;
         $data['message'] = '';
         $data['success'] = true;
     } catch (Exception $e) {
         $data['message'] = $e->getMessage();
         $data['success'] = false;
     }
     return $data;
 }
Exemple #27
0
 public static function loginCard()
 {
     $redirecturl = wbRequest::getVarClean('redirecturl');
     $ws_client = self::getNusoap();
     $params = array('search' => '', 'getParams' => json_encode($_GET), 'controller' => json_encode(array('module' => 'base', 'class' => 'roles.dologin', 'method' => 'loginCard', 'type' => 'json')), 'postParams' => json_encode($_POST), 'jsonItems' => '', 'start' => $start, 'limit' => $limit);
     try {
         $ws_data = self::getResultData($ws_client, $params);
         if ($ws_data['success']) {
             $userInfo = $ws_data['data'];
             wbUser::setSession($userInfo['user_id'], $userInfo['user_name'], $userInfo['user_email'], $userInfo['user_realname'], $userInfo['roles']);
             if (!empty($redirecturl)) {
                 wbResponse::Redirect($redirecturl);
             } else {
                 wbResponse::Redirect('index.php');
             }
         } else {
             throw new Exception("Username atau Password Salah");
         }
     } catch (UserLoginFailedException $e) {
         wbResponse::Redirect(wbModule::url('base', 'base', 'loginform', array('username' => $username, 'redirecturl' => urlencode($redirecturl), 'msg' => $e->getMessage())));
     }
 }
Exemple #28
0
function wbWSMain()
{
    // TODO: don't load the whole core
    wbCore::init();
    /*
     determine the server type, then
     create an instance of an that server and 
     serve the request according the ther servers protocol
    */
    $type = wbRequest::getVarClean('type');
    switch ($type) {
        case 'json':
            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());
            }
            if ($result || is_array($result)) {
                if (empty($callback)) {
                    header('Content-Type: application/json');
                    echo json_encode($result);
                } else {
                    header('Content-Type: text/javascript');
                    echo $callback . '(' . json_encode($result) . ')';
                }
            } else {
                header("HTTP/1.1 500 Internal Server Error");
            }
            break;
        default:
            // nothing todo for now
    }
}
 /**
  * read
  * controler for get all items
  */
 public static function read($args = array())
 {
     // Security check
     //if (!wbSecurity::check('p_finance_period')) return;
     // Get arguments from argument array
     extract($args);
     $start = wbRequest::getVarClean('start', 'int', 0);
     $limit = wbRequest::getVarClean('limit', 'int', 10);
     $sort = wbRequest::getVarClean('sort', 'str', 'p_bank_id');
     $dir = wbRequest::getVarClean('dir', 'str', 'DESC');
     $query = wbRequest::getVarClean('query', 'str', '');
     $query = rawurldecode($query);
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     try {
         $table =& wbModule::getModel('bds', 'abstract_model');
         //$query = $table->getDisplayFieldCriteria($query);
         //if (!empty($query)) $table->setCriteria($query);
         $user_name = wbSession::getVar('user_name');
         $query = str_replace("\n", "", $query);
         $query = str_replace("\r", "", $query);
         $query = preg_replace('/\\s+/S', " ", $query);
         $table->selectClause = "";
         $table->fromClause = $query;
         if (!preg_match('/SELECT /i', $query)) {
             $items = $table->dbconn->GetItem($query);
             $total = 1;
         } else {
             $items = $table->getAllNoOrder($start, $limit, $sort, $dir);
             $total = $table->countAll();
         }
         $data['items'] = $items;
         $data['total'] = $total;
         $data['success'] = true;
     } catch (Exception $e) {
         $data['message'] = $e->getMessage();
     }
     return $data;
 }
 public static function cancel_deposit($args = array())
 {
     $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => '');
     $p_user_loket_id = wbRequest::getVarClean('p_user_loket_id', 'int', 0);
     $subscriber_id = wbRequest::getVarClean('subscriber_id', 'int', 0);
     $t_deposit_id = wbRequest::getVarClean('t_deposit_id', 'int', 0);
     $ip_address = wbRequest::getVarClean('ip_address', 'str', get_ip_address());
     $result = "";
     try {
         $table =& wbModule::getModel('paymentccbs', 't_deposit');
         $result = $table->cancel_deposit_amount($t_deposit_id, $subscriber_id, $p_user_loket_id, $ip_address);
         if ($result == 'OK') {
             $data['success'] = true;
             $data['message'] = 'Cancel deposit amount success';
         } else {
             $data['message'] = $result;
         }
         $data['total'] = 1;
     } catch (Exception $e) {
         $data['message'] = $e->getMessage();
         $data['success'] = false;
     }
     return $data;
 }