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); }
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; }
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 } }
public static function init() { if (!wbCore::isFuncDisabled('ini_set')) { // PHP configuration variables // Stop adding SID to URLs ini_set('session.use_trans_sid', 0); // User-defined save handler ini_set('session.save_handler', 'user'); // How to store data ini_set('session.serialize_handler', 'php'); // Use cookie to store the session ID ini_set('session.use_cookies', 1); // Name of our cookie ini_set('session.name', 'WEBISID'); $path = wbServer::getBaseURI(); if (empty($path)) { $path = '/'; } // Lifetime of our cookie. Session lasts set number of days $lifetime = wbConfig::get('Session.Duration') * 86400; ini_set('session.cookie_lifetime', $lifetime); // Cookie path // this should be customized for multi-server setups wanting to share // sessions ini_set('session.cookie_path', $path); // Garbage collection ini_set('session.gc_probability', 1); // Inactivity timeout for user sessions ini_set('session.gc_maxlifetime', wbConfig::get('Session.InactivityTimeout') * 60); // Auto-start session ini_set('session.auto_start', 1); } include_once 'lib/adodb/session/adodb-session2.php'; $GLOBALS['ADODB_SESS_CONN'] =& wbDB::getConn(); ADODB_Session::table(wbConfig::get('DB.prefix') . '_sessions'); session_start(); }
public static function show() { $level_id = wbRequest::getVarClean('level_id', 'int', 0); $tahun = wbRequest::getVarClean('tahun', 'str', ''); //timestamp $t = wbRequest::getVarClean('t', 'str', ''); if (empty($level_id) or empty($tahun)) { exit; } try { $ws_client = self::getNusoap(); $params = array('search' => '', 'getParams' => json_encode($_GET), 'controller' => json_encode(array('module' => 'bds', 'class' => 'dashboard_pendidikan', 'method' => 'show', 'type' => '')), '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(); } $items = $data['items']['items']; $itemLevel = $data['items']['itemLevel']; //$items = $tSchoolType->getAllByLevelID($level_id, $tahun); //$itemLevel = $tSchoolLevel->get($level_id); $print = wbRequest::getVarClean('print', 'int', 0); if (!empty($print)) { wbUtil::startExcel('pendidikan_dashboard.xls'); } echo '<div class="body-wrap">'; echo '<div style="float:left;margin:5 5 0 5;">'; echo '<div><h3>JUMLAH SISWA ' . strtoupper($itemLevel['description']) . ' <br/>BERDASARKAN JENISNYA - TAHUN ' . $tahun . '</h3></div>'; if (!empty($print)) { echo '<table border="1" width ="100%">'; } else { echo '<table border="0" class="table-data" width ="100%">'; } echo '<tr> <th width="15">No</th> <th width="150">Jenis ' . $itemLevel['description'] . '</th> <th width="100">Jumlah Masuk </th> <th width="100">Jumlah Lulus </th> <th width="100">Jumlah Aktif </th> </tr>'; $i = 1; $datay = array(); $dataCode = array(); foreach ($items as $item) { $datay[] = $item['jml_masuk']; $dataCode[] = $item['code']; echo '<tr>'; echo '<td>' . $i++ . '</td>'; echo '<td>' . $item['code'] . '</td>'; echo '<td align="right">' . wbUtil::numberFormat($item['jml_masuk'], 0) . '</td>'; echo '<td align="right">' . wbUtil::numberFormat($item['jml_lulus'], 0) . '</td>'; echo '<td align="right">' . wbUtil::numberFormat($item['jml_aktif'], 0) . '</td>'; echo '</tr>'; } echo '</table>'; wbCore::loadJPGraph(); // Create the graph and setup the basic parameters $graph = new Graph(550, 300, 'auto'); $graph->img->SetMargin(40, 30, 40, 40); $graph->SetScale("textint"); $graph->SetFrame(true, 'white', 1); $graph->SetColor('#C9C9C9'); $graph->SetMarginColor('#D0DEF0'); // Add some grace to the top so that the scale doesn't // end exactly at the max value. //$graph->yaxis->scale->SetGrace(20); // Setup X-axis labels $graph->xaxis->SetTickLabels($dataCode); $graph->xaxis->SetFont(FF_FONT1); $graph->xaxis->SetColor('#400000', 'black'); // Stup "hidden" y-axis by given it the same color // as the background $graph->yaxis->SetColor('lightblue', '#004080'); $graph->ygrid->SetColor('white'); // Setup graph title ands fonts $graph->title->Set('GRAFIK SISWA ' . strtoupper($itemLevel['description']) . ' - TAHUN ' . $tahun); // Create a bar pot $bplot = new BarPlot($datay); $bplot->SetFillColor('#6C6CFF'); $bplot->SetColor('darkblue'); $bplot->SetWidth(0.5); $bplot->SetShadow('darkgray'); // Setup the values that are displayed on top of each bar $bplot->value->Show(); // Must use TTF fonts if we want text at an arbitrary angle $bplot->value->SetFont(FF_ARIAL, FS_NORMAL, 8); $bplot->value->SetFormat('%d'); // Black color for positive values and darkred for negative values $bplot->value->SetColor("black", "darkred"); $graph->Add($bplot); // Finally stroke the graph $graph->Stroke('var/dashboard/dashboard_pendidikan.png'); echo '</div>'; echo '</div>'; echo '<div style="float:right;margin:15 5 0 5;"> <img src="' . wbServer::getBaseURL() . 'var/dashboard/dashboard_pendidikan.png?' . $t . '" alt="' . $t . '" /> </div>'; exit; }
public static function show() { $data = array('items' => array(), 'total' => 0, 'success' => false, 'message' => ''); $jenis_jalan = wbRequest::getVarClean('jenis_jalan', 'int', 0); if (empty($jenis_jalan)) { exit; } try { $ws_client = self::getNusoap(); $params = array('search' => '', 'getParams' => json_encode($_GET), 'controller' => json_encode(array('module' => 'bds', 'class' => 'dashboard_jalan', 'method' => 'show', 'type' => '')), '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(); } $items = $data['items']; echo '<div class="body-wrap">'; echo '<div style="float:left;margin:5 5 0 5;">'; echo '<div><h3>DATA JALAN</h3></div>'; echo '<table class="table-data">'; echo '<tr> <th width="30">No</th> <th width="200">Jenis Jalan</th> <th width="100">Panjang(Km)</th> </tr>'; $i = 1; $datay = array(); $dataCode = array(); foreach ($items as $item) { $datay[] = $item['panjang']; $dataCode[] = $item['param_name']; echo '<tr>'; echo '<td>' . $i++ . '</td>'; echo '<td>' . $item['param_name'] . '</td>'; echo '<td align="right">' . wbUtil::numberFormat($item['panjang'], 0) . '</td>'; echo '</tr>'; } echo '</table>'; wbCore::loadJPGraph(); // Create the graph and setup the basic parameters $graph = new Graph(550, 300, 'auto'); $graph->img->SetMargin(40, 30, 40, 40); $graph->SetScale("textint"); $graph->SetFrame(true, 'white', 1); $graph->SetColor('#C9C9C9'); $graph->SetMarginColor('#D0DEF0'); // Add some grace to the top so that the scale doesn't // end exactly at the max value. //$graph->yaxis->scale->SetGrace(20); // Setup X-axis labels $graph->xaxis->SetTickLabels($dataCode); $graph->xaxis->SetFont(FF_FONT1); $graph->xaxis->SetColor('#400000', 'black'); // Stup "hidden" y-axis by given it the same color // as the background $graph->yaxis->SetColor('lightblue', '#004080'); $graph->ygrid->SetColor('white'); // Setup graph title ands fonts $graph->title->Set('DATA JALAN'); // Create a bar pot $bplot = new BarPlot($datay); $bplot->SetFillColor('#6C6CFF'); $bplot->SetColor('darkblue'); $bplot->SetWidth(0.5); $bplot->SetShadow('darkgray'); // Setup the values that are displayed on top of each bar $bplot->value->Show(); // Must use TTF fonts if we want text at an arbitrary angle $bplot->value->SetFont(FF_ARIAL, FS_NORMAL, 8); $bplot->value->SetFormat('%d'); // Black color for positive values and darkred for negative values $bplot->value->SetColor("black", "darkred"); $graph->Add($bplot); // Finally stroke the graph $graph->Stroke('var/dashboard/dashboard_jalan.png'); echo '</div>'; echo '</div>'; echo '<div style="float:right;margin:15 5 0 5;"> <img src="var/dashboard/dashboard_jalan.png?' . $t . '" alt="' . $t . '" /> </div>'; exit; }