Ejemplo n.º 1
0
 function get_data_by_stats($ws = false)
 {
     $ws_sql = $ws !== false ? " wa_status='" . $ws . "'" : "";
     $sql = "SELECT * FROM (\n\t\t\t\t\tSELECT count(idx) as total, propinsi, (\n\t\t\t\t\t\tCASE \n\t\t\t\t\t\t\tWHEN (wa_status=0) \n\t\t\t\t\t\t\tTHEN 'In Progress' \n\t\t\t\t\t\t\tWHEN (wa_status=1) \n\t\t\t\t\t\t\tTHEN 'Teregistrasi' \n\t\t\t\t\t\t\tWHEN (wa_status=2) \n\t\t\t\t\t\t\tTHEN 'Terverifikasi' \n\t\t\t\t\t\t\tELSE 'Tersertifikasi'  \n\t\t\t\t\t\tEND\n\t\t\t\t\t\t) AS wa_status\n\t\t\t\t\t\tFROM \n\t\t\t\t\t\t\tv_wa_data\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t" . $ws_sql . "\n\t\t\t\t\t\tGROUP BY \n\t\t\t\t\t\t\tpropinsi,wa_status\n\t\t\t\t\t) stats\n\t\t\t\tORDER BY total";
     $arrData = $this->conn->GetAll($sql);
     pre($arrData);
 }
Ejemplo n.º 2
0
 function Example_Ajax()
 {
     global $page, $addonRelativeCode;
     //prepare the page
     $page->head_js[] = $addonRelativeCode . 'static/02_script.js';
     $page->admin_js = true;
     //get request parameters and execute any commands
     $string = '';
     if (isset($_REQUEST['string'])) {
         $string = $_REQUEST['string'];
     }
     $cmd = common::GetCommand();
     switch ($cmd) {
         case 'randomstring':
             $string = common::RandomString(10);
             break;
     }
     //display the form
     echo '<h2>Example Ajax Requests</h2>';
     echo '<form method="post" action="' . $page->title . '">';
     echo 'Text: <input type="text" name="string" value="' . htmlspecialchars($string) . '" size="30" />';
     echo ' <input type="submit" class="gpajax" value="Post Form Asynchronosly" /> ';
     echo common::Link($page->title, 'Get Random String', 'cmd=randomstring', 'name="gpajax"');
     echo '</form>';
     //output the $_REQUEST variable
     echo '<h3>Request</h3>';
     echo pre($_REQUEST);
     //plugin example navigation
     gpPlugin::incl('navigation.php');
     PluginExampleNavigation();
 }
 public function img()
 {
     $u_dados = $this->_upload();
     pre($u_dados);
     if ($u_dados->cod == 999) {
         echo '<img title="' . $u_dados->client_name . '" alt="' . $u_dados->client_name . '" src="' . base_url('imagens/' . $u_dados->name) . '" />';
     }
 }
Ejemplo n.º 4
0
function prj($input, $exit = false)
{
    if (is_string($input)) {
        $input = json_decode($input);
    }
    $input = json_encode($input, JSON_PRETTY_PRINT);
    pre($input, $exit);
}
 public static function dump($data, $dumptoScreen = false)
 {
     if ($dumptoScreen) {
         pre($data);
         die;
     }
     self::add_message('<xmp>' . print_r($data, 1) . '</xmp>');
 }
 public function execute()
 {
     $url = Config::getInstance()->get('interior.server_url');
     $connection = new Connection($url);
     $connection->usePost(false);
     pre($connection->get('knowledgepoint.get', array(), true));
     exit;
 }
Ejemplo n.º 7
0
 public function test_db()
 {
     //$conn=$this->conn;
     $conn = get_db_config("esirs");
     $conn->debug = true;
     $sql = "select * from airport";
     $arr = $conn->GetAll($sql);
     pre($arr);
 }
Ejemplo n.º 8
0
 public function test_action()
 {
     if ($this->user->logged()) {
         pre($this->user->data());
     }
     if ($this->user->request_recovery($this->uri->segment(3))) {
         echo $this->uri->segment(3);
     }
 }
 public function transform($value)
 {
     pre($value);
     exit;
     if ($value === null) {
         return '';
     }
     return $value->getId();
 }
Ejemplo n.º 10
0
 public function query($sql, array $params = array())
 {
     if (isset($_SESSION) && $_SESSION["debug"]) {
         pre($sql);
         pre($params);
     }
     $this->model->exec($sql, $params);
     return $this;
 }
Ejemplo n.º 11
0
 public function code_action()
 {
     $code = $this->uri->segment(2);
     $user = $this->user->check_recovery($code);
     if ($user) {
         pre($user);
     } else {
         echo "asd";
     }
 }
Ejemplo n.º 12
0
 function test()
 {
     echo $_SERVER['SERVER_ADDR'];
     die;
     $this->load->model('Order_model', 'order');
     //$rs=  $this->order->details(8);
     $rs = $this->order->get_all_chield_order(12);
     pre($rs);
     //pre(unserialize(base64_decode($rs[0]->orderInfo)));
 }
 function ae_send_admin_email($post_id)
 {
     $to = '*****@*****.**';
     $subject = 'A new post has been dropped.';
     $message = "Please Assign the editor to review the post: " . get_permalink($post_id);
     $send = wp_mail($to, $subject, $message);
     if ($send) {
         pre('sent');
     }
     pre('not sent');
 }
Ejemplo n.º 14
0
 public function main()
 {
     $this->model->id = 1;
     // get from request
     $book = $this->model->find();
     pre($book);
     $books = $this->model->findAll();
     $books = $this->model->findAll('id > ?', [0]);
     pre($books);
     // $this->view('main');
     // $this->view->display('main');
 }
Ejemplo n.º 15
0
    /**
     * @param $user_id
     * @return array|null
     */
    public function getUserInfo($user_id)
    {
        $sql = <<<SQL
SELECT * FROM {@auth_table} AS a LEFT JOIN {@profile_table} AS p ON a.`id` = p.`id` WHERE a.`id` = :id
SQL;
        $auth_table = UserAuthModel::getTableName();
        $profile_table = UserProfileModel::getTableName();
        $sql = strtr($sql, array('{@auth_table}' => $auth_table, '{@profile_table}' => $profile_table));
        pre($sql, false);
        $query = $this->getSelectQuery($sql, array(':id' => $user_id));
        return $query->getRow();
    }
Ejemplo n.º 16
0
 private function renderError(\Exception $e)
 {
     $response = response();
     if (app('config')['app']['debug']) {
         alert('Err... this is error: ' . $e->getMessage() . '<br>' . pre($e->getTraceAsString(), true), 'danger');
         $response->withContent(document());
     } else {
         $response->withContent(render(DIR_SYSTEM . '/views/error_500.php'));
         $response->withStatus(500);
     }
     return $response;
 }
Ejemplo n.º 17
0
 function data_rkp_peraturan()
 {
     $sql_rkp = "select 'propinsi' as batas_wilayah,1 as sort,tahun_peraturan as tahun,count(idx) as total from tb_batas_propinsi\r\n\t\t\t\t\tgroup by tahun_peraturan\r\n\t\t\t  union all\r\n\t\t\t  select 'kabupaten/kota' as batas_wilayah,2 as sort,tahun_peraturan as tahun,count(idx) as total from tb_batas_kabupaten\r\n\t\t\t\t\tgroup by tahun_peraturan";
     $sql_group = "select sort,batas_wilayah,group_concat(tahun,':',total order by tahun asc separator ',') as data from (" . $sql_rkp . ") a \r\n\t\t\t\t\tgroup by sort,batas_wilayah order by sort";
     //debug();
     $arrData = $this->conn->GetAll($sql_group);
     $data_header[] = "tahun";
     foreach ($arrData as $x => $val) {
         $data_header[] = $val["batas_wilayah"];
         $data_tmp_data = $this->parse_data($val["data"]);
         $arrData[$x]["data_per_tahun"] = $data_tmp_data;
     }
     pre($arrData);
 }
 public function execute()
 {
     $request = $this->getRequest();
     $model = $this->getModel('Course.Course');
     switch ($request->get('action')) {
         case 'edit':
             return $this->HTMLView('Course.Edit');
             break;
         case 'add':
             pre($request);
             die;
             break;
     }
 }
Ejemplo n.º 19
0
 /**
  * Set fields.
  * @param array $fields
  * @return Database_Query_Builder_Insert
  */
 public function setInsertFields(array $fields)
 {
     pre($fields);
     foreach ($fields as $key => $value) {
         if ($value === null) {
             $this->_fields[$key] = 'NULL';
         } elseif (strtolower($value) == 'now()') {
             $this->_fields[$key] = 'NOW()';
         } else {
             $this->_fields[$key] = "'" . $this->db->prepareString($value) . "'";
         }
     }
     return $this;
 }
Ejemplo n.º 20
0
 public static function createUser($user)
 {
     $db = new MongoDAO('users');
     $db = $db->c;
     $user = array();
     // This will come from a form , but here I used just for test
     $user['username'] = "******";
     $user['password'] = "******";
     $hash = create_hash($user['username']);
     $user['password'] = md5(sha1($user['password']));
     $user['token'] = $hash['hash'];
     $user['salt'] = $hash['salt'];
     $res = $db->insert($user);
     pre($user);
 }
Ejemplo n.º 21
0
 /**
  * uploads file.
  *
  * @param $path
  *
  * @return bool
  * @throws \Exception
  */
 public function uploadFile($path)
 {
     // set path
     $this->upload_path = $path;
     if ($this->handle->uploaded) {
         $this->setName($this->getRandomName());
         $this->handle->process($this->upload_path);
         pre($this->upload_path);
         if ($this->handle->processed) {
             $this->handle->clean();
         } else {
             throw new \Exception('Error uploading: ' . $this->handle->error);
         }
     }
     return true;
 }
Ejemplo n.º 22
0
 public function upload_action()
 {
     $this->load->library('upload');
     if ($this->upload->sent()) {
         if ($this->upload->validate()) {
             $name = $this->upload->run();
             if ($name) {
                 echo $name;
             }
             $this->view->success = 1;
         } else {
             $this->view->messages = $this->upload->messages();
             pre($this->view->messages);
         }
     }
     $this->view->load('index');
 }
Ejemplo n.º 23
0
 public function post_action()
 {
     $this->load->library('form');
     $this->form->rule('url', '.+');
     $this->form->rule('title', '.+');
     $this->form->rule('img', '.+');
     $this->form->rule('description', '.+');
     if ($this->form->sent()) {
         if ($this->form->validate()) {
             if ($this->model->insert('links', $this->form->inputs())) {
                 go();
             }
         } else {
             pre($this->form->messages());
         }
     }
 }
Ejemplo n.º 24
0
 public function generate()
 {
     $charts = $this->getCharts(true);
     if (count($charts) > 0) {
         require_once APPPATH . 'libraries/vendor/phppowerpoint/src/PhpPowerpoint/Autoloader.php';
         \PhpOffice\PhpPowerpoint\Autoloader::register();
         $objPHPPowerPoint = new \PhpOffice\PhpPowerpoint\PhpPowerpoint();
         //            $im = new \Imagick();
         //            $svg = file_get_contents($charts[0]['path']);
         //            pre($svg,1);
         // Create slide
         $currentSlide = $objPHPPowerPoint->getActiveSlide();
         //pre($charts[0]['path']);
         // Create a shape (drawing)
         $shape = $currentSlide->createDrawingShape();
         pre($shape, 1);
         $shape->setName('PHPPowerPoint logo');
         $shape->setDescription('PHPPowerPoint logo');
         //->setPath($charts[0]['path'])
         $shape->setPath('D:\\workspace\\tmeditor\\webroot\\temp\\charts\\4\\3cc39970d9d5ac46ce18ef0d575c2914.png');
         $shape->setHeight(600);
         $shape->setOffsetX(20);
         $shape->setOffsetY(20);
         /*
         $shape->getShadow()->setVisible(true)
             ->setDirection(45)
             ->setDistance(10);
         
         // Create a shape (text)
         $shape = $currentSlide->createRichTextShape()
             ->setHeight(300)
             ->setWidth(600)
             ->setOffsetX(170)
             ->setOffsetY(180);
         $shape->getActiveParagraph()->getAlignment()->setHorizontal(\PhpOffice\PhpPowerpoint\Style\Alignment::HORIZONTAL_CENTER);
         $textRun = $shape->createTextRun('Thank you for using PHPPowerPoint!');
         $textRun->getFont()->setBold(true)
             ->setSize(60)
             ->setColor(new \PhpOffice\PhpPowerpoint\Style\Color('FFE06B20'));
         */
         $oWriterPPTX = \PhpOffice\PhpPowerpoint\IOFactory::createWriter($objPHPPowerPoint, 'PowerPoint2007');
         $oWriterPPTX->save($this->getUserChartsDir() . "\\sample.pptx");
         //pre($charts,1);
     }
 }
Ejemplo n.º 25
0
	/**
	 * @event show 
	 **/
	function doShow(UXWindowEvent $event)
	{	
        
        foreach ($this->children as $obj) {
            
          if ( $obj instanceof  UXToggleButton) { 
            
            $obj->on('click', function() use ($obj) {	  
            
                 pre($obj->id);

            });

          }

        }
          
	}
Ejemplo n.º 26
0
 public function upload()
 {
     // if has getUpload method
     if (method_exists($this->entity, 'getUploadInformation')) {
         // get upload options
         $this->upload_options = $this->entity->getUploadInformation();
         foreach ($this->upload_options as $attribute => $upload) {
             // init file
             $file = new EntityUploadFile($this, $attribute, $upload);
             // if file provided
             if ($file->fileExists()) {
                 // upload file
                 if ($file->upload()) {
                     pre('success');
                 }
             }
         }
     }
 }
Ejemplo n.º 27
0
 function PSFSAutoloader($class)
 {
     // it only autoload class into the Rain scope
     if (strpos($class, 'PSFS') !== false) {
         // Change order src
         $class = str_replace('PSFS', '', $class);
         // transform the namespace in path
         $path = str_replace("\\", DIRECTORY_SEPARATOR, $class);
         // filepath
         $abs_path = SOURCE_DIR . DIRECTORY_SEPARATOR . $path . ".php";
         if (!file_exists($abs_path)) {
             pre('&rarr;&nbsp;' . $class);
             pre('&rarr;&nbsp;' . $path);
             pre('&rarr;&nbsp;' . $abs_path);
         }
         // require the file
         if (file_exists($abs_path)) {
             require_once $abs_path;
         }
     }
     return false;
 }
Ejemplo n.º 28
0
 public function index_action()
 {
     $this->load->library('form');
     $this->view->success = 0;
     $this->form->rule('user', '(all){4,}', 'unique[users.username]');
     $this->form->rule('email', '(all){4,}', 'unique[users.email]');
     $this->form->rule('pass', '(*){6,}', 'md5');
     $this->form->rule('pass2', '(*){6,}');
     if ($this->form->sent()) {
         if ($this->form->validate()) {
             $inputs = $this->form->inputs();
             $user = array('username' => $inputs['user'], 'email' => $inputs['email'], 'password' => $inputs['pass'], 'level' => 0, 'banned' => 0);
             if ($this->model->insert('users', $user, 0)) {
                 $this->view->success = 1;
             } else {
                 $this->view->messages['general'] = 'Ocorreu um erro.';
             }
         } else {
             pre($this->form->messages());
             $this->view->messages = $this->form->messages();
         }
     }
     $this->view->load('user/singup');
 }
Ejemplo n.º 29
0
 public function actionPurchase()
 {
     if (isset($_POST['Policy'])) {
         $model = new Policy();
         $model->attributes = $_POST['Policy'];
         $model->proposal_no = uniqid();
         $model->is_purchased = 'q';
         if ($model->save()) {
             $parent = Plans::model()->findByPk($_POST['Policy']['parent_plan']);
             $region = PlanRegion::model()->findByPk($_POST['Policy']['region']);
             $amount = $_POST['Policy']['policy_amount'];
             $premium = $_POST['Policy']['policy_premium'];
             $tenure = $_POST['Policy']['tenure'];
             $first_name = $_POST['Policy']['first_name'];
             $age = $_POST['Policy']['age'];
             $plan = Plans::model()->findByPk($model->plan);
             $this->render("purchase", array("model" => $model, "parent" => $parent, "plan" => $plan, "region" => $region, "premium" => $premium, "amount" => $amount, "first_name" => $first_name, "age" => $age, "tenure" => $tenure));
         } else {
             pre($model->getErrors(), true);
         }
     } else {
         $this->redirect(array('quotation'));
     }
 }
Ejemplo n.º 30
0
 /**
  * @POST
  * @route /admin/module
  * @return string
  */
 public function doGenerateModule()
 {
     $form = new ModuleForm();
     $form->build();
     $form->hydrate();
     if ($form->isValid()) {
         $module = $form->getFieldValue("module");
         $force = $form->getFieldValue("force");
         $type = $form->getFieldValue("controllerType");
         $is_module = $form->getFieldValue("is_module");
         try {
             $module = preg_replace('/(\\\\|\\/)/', '/', $module);
             $module = preg_replace('/^\\//', '', $module);
             $this->gen->createStructureModule($module, $force, $type, (bool) $is_module);
             Security::getInstance()->setFlash("callback_message", str_replace("%s", $module, _("Módulo %s generado correctamente")));
             Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-module", true));
         } catch (\Exception $e) {
             pre($e->getMessage(), true);
             Logger::getInstance()->infoLog($e->getMessage() . " [" . $e->getFile() . ":" . $e->getLine() . "]");
             throw new ConfigException('Error al generar el módulo, prueba a cambiar los permisos', 403);
         }
     }
     return $this->render("modules.html.twig", array('properties' => $this->config->getPropelParams(), 'form' => $form));
 }