Пример #1
0
 /**
  * POST /uom
  *
  */
 public function s003()
 {
     $error;
     try {
         $req = App::request();
         if ($req->isPost()) {
             $post = $req->post();
             $attributes = array("uom_nama" => $post["uom_nama"], "aktif" => isset($post["aktif"]) ? 1 : 0);
             $table = UOM::table();
             if (is_null($post["gen_id"]) || $post["gen_id"] == "") {
                 $table->insert($attributes);
             } else {
                 $where = "uom_nama = '" . $post["gen_id"] . "'";
                 $table->update($attributes, $where);
             }
         }
     } catch (Exception $e) {
         $error = $e->getMessage();
         ZiUtil::unique_error($error);
         App::flash('error', $post["uom_nama"] . ' ' . ZiUtil::unique_error($error));
         App::redirect('unitOM.a001');
     }
     App::flash('info', 'Data Tersimpan : ' . $post["uom_nama"]);
     App::redirect('unitOM.index');
 }
Пример #2
0
 /**
  * Seed the database with initial value
  *
  * @return void
  */
 public function doRegister()
 {
     try {
         if ($this->_testemail(Input::post('email')) == 0) {
             if (strlen(Input::post('password')) >= 8) {
                 if (Input::post('password') == Input::post('confirm_password')) {
                     $newUser = Sentry::createUser(array('email' => Input::post('email'), 'password' => Input::post('password'), 'first_name' => Input::post('first_name'), 'last_name' => Input::post('last_name'), 'activated' => true));
                     $newUser->save();
                     Response::redirect($this->siteUrl('login'));
                 } else {
                     App::flash('message', 'Les mots de passe ne correspondent pas !');
                     Response::redirect($this->siteUrl('register'));
                 }
             } else {
                 App::flash('message', 'Votre mot de passe est trop court (plus de 8 charactères)');
                 Response::redirect($this->siteUrl('register'));
             }
         } else {
             App::flash('message', 'Votre adresse email n\'est pas valide');
             Response::redirect($this->siteUrl('register'));
         }
     } catch (\Exception $e) {
         Response::redirect($this->siteUrl('register'));
         App::flash('message', $e->getMessage());
     }
 }
Пример #3
0
 public function update()
 {
     if (doo_csrf()) {
         $top_ad_field = $this->app->advertisement->where('id', 1);
         $this->app->advertisement->createOrUpdateById($top_ad_field, 'Top Ads', ['id' => 1, 'top_ad' => \Input::post('top_ad'), 'bottom_ad' => \Input::post('bottom_ad'), 'side_ad' => \Input::post('side_ad'), 'top_ad_logo' => \Input::post('top_ad_logo')]);
         \App::flash('ads-updated', 'Ad spaces have been updated!');
         \Response::redirect($this->site_url . '/admin-area/ad-boxes');
     }
 }
Пример #4
0
 /**
  * Update item from edit form - post/patch
  */
 public function update($id)
 {
     if (doo_csrf()) {
         $content = \Input::post('editor1');
         $page_title = \Input::post('pageTitle');
         $order = \Input::post('order');
         $slug = \Input::post('slug');
         $this->app->page->update('id', $id, ['title' => $page_title, 'content' => $content, 'order' => $order, 'slug' => $slug]);
         \App::flash('page_updated', $page_title . ' page has been updated!');
         \Response::redirect($this->site_url . '/admin-area/pages');
     }
 }
Пример #5
0
 public function index()
 {
     $req = App::request();
     if ($req->isPost()) {
         if ($this->auth->login($req->post('user'), $req->post('passwd'))) {
             App::flash('info', "Your login was successful")->redirect('home');
         } else {
             App::flash('error', 'Your username or password was wrong');
         }
     }
     App::render('auth/login');
 }
Пример #6
0
 public function update()
 {
     //chechk if form $_POST 'token' is true - for csrf prevention
     if (doo_csrf()) {
         $public_key = \Input::post('public_key');
         $private_key = \Input::post('private_key');
         $check = $this->app->recaptcha->where('id', 1);
         $this->app->recaptcha->createOrUpdateById($check, 'reCAPTCHA keys ', ['id' => 1, 'public_key' => $public_key, 'private_key' => $private_key]);
         \App::flash('recaptcha', 'rCAPTCHA Keys updated.');
         \Response::redirect($this->site_url . '/admin-area/recaptcha');
     }
 }
Пример #7
0
 public function update()
 {
     //chechk if form $_POST 'token' is true - for csrf prevention
     if (doo_csrf()) {
         $facebook_user = \Input::post('facebook_user');
         $twitter_user = \Input::post('twitter_user');
         //$gplus_user    = Input::post('gplus_user');
         $check = $this->app->social_username->where('id', 1);
         $this->app->social_username->createOrUpdateById($check, 'Side Media Usernames ', ['id' => 1, 'facebook_user' => $facebook_user, 'twitter_user' => $twitter_user]);
         \App::flash('socialUsernames', 'Social Media Usernames updated.');
         \Response::redirect($this->site_url . '/admin-area/social-username');
     }
 }
Пример #8
0
 public function update()
 {
     //chechk if form $_POST 'token' is true - for csrf prevention
     if (doo_csrf()) {
         $facebook_app_id = \Input::post('facebook_app_id');
         $facebook_secret_key = \Input::post('facebook_secret_key');
         $twitter_app_id = \Input::post('twitter_app_id');
         $twitter_secret_key = \Input::post('twitter_secret_key');
         $check = $this->app->social_key->where('id', 1);
         $this->app->social_key->createOrUpdateById($check, 'Social Media Key ', ['id' => 1, 'facebook_public_key' => $facebook_app_id, 'facebook_secret_key' => $facebook_secret_key, 'twitter_public_key' => $twitter_app_id, 'twitter_secret_key' => $twitter_secret_key]);
         \App::flash('socialkeys', 'Social Media API Key updated.');
         \Response::redirect($this->site_url . '/admin-area/social-keys');
     }
 }
Пример #9
0
 /**
  * Get site details
  * @param  $data = $_POST
  * @return string and int
  */
 public function update()
 {
     if (doo_csrf()) {
         try {
             $id = \Input::post('id');
             $site_title = \Input::post('site_title');
             $description = \Input::post('description');
             $keywords = \Input::post('keywords');
             $this->app->siteMetaForm->validator($_POST);
             $check = $this->app->site_meta->where('id', $id);
             $this->app->site_meta->createOrUpdateById($check, 'Site Meta Details ', ['id' => $id, 'title' => $site_title, 'description' => $description, 'keywords' => $keywords]);
             \App::flash('site-metas', 'Site Metas updated!');
             \Response::redirect($this->site_url . '/admin-area/site-details');
         } catch (\Doowebdev\Validation\DooFormValidationException $e) {
             $this->data['site_title_errors'] = $e->getErrorFor()->first('site_title');
             $this->data['description_errors'] = $e->getErrorFor()->first('description');
             $this->data['keywords_errors'] = $e->getErrorFor()->first('keywords');
             \View::display('admin/setting/site-details.twig', $this->data);
         }
     }
 }
Пример #10
0
 /**
  * Add settings to generate site
  */
 public function addSettings()
 {
     if (doo_csrf()) {
         $item_priority = \Input::post('item_priority');
         $item_frequency = \Input::post('item_frequency');
         $page_priority = \Input::post('page_priority');
         $page_frequency = \Input::post('page_frequency');
         try {
             $this->app->siteMapForm->validator($_POST);
             $check = $this->app->site_map->where('id', 1);
             $this->app->site_map->createOrUpdateById($check, 'Item Sitemap Settings ', ['id' => 1, 'priority' => $item_priority, 'freqency' => $item_frequency]);
             $check = $this->app->site_map->where('id', 2);
             $this->app->site_map->createOrUpdateById($check, 'Page Sitemap Settings ', ['id' => 2, 'priority' => $page_priority, 'freqency' => $page_frequency]);
             \App::flash('sitemap', 'Site Map updated');
             \Response::redirect($this->site_url . '/admin-area/sitemap');
         } catch (\Doowebdev\Validation\DooFormValidationException $e) {
             $this->data['item_priority_errors'] = $e->getErrorFor()->first('item_priority');
             $this->data['item_frequency_errors'] = $e->getErrorFor()->first('item_frequency');
             $this->data['page_priority_errors'] = $e->getErrorFor()->first('page_priority');
             $this->data['page_frequency_errors'] = $e->getErrorFor()->first('page_frequency');
             return \View::display('admin/setting/sitemap.twig', $this->data);
         }
     }
 }
Пример #11
0
 public function d011($id = null)
 {
     if (!is_null($id)) {
         $result = ItemPrice::find($id);
         $result->delete();
         ZiUtil::to_json(json_encode("{ success: true}"));
         return;
     }
     App::flash('error', 'Terjadi kesalahan pada inputan anda.');
     App::redirect('itemprice.index');
 }
Пример #12
0
 public function export()
 {
     try {
         $req = App::request();
         $params = $req->get();
         if (!empty($params['cx'])) {
             switch ($params['cx']) {
                 case 'xls':
                     $this->excel($params);
                     break;
                 case 'pt':
                     $this->print_harian($params);
                     break;
                 case 'pdf':
                     $this->pdf($params);
                     break;
                 default:
                     # code...
                     break;
             }
         }
     } catch (Exception $e) {
         App::flash('error', $e);
     }
 }
Пример #13
0
 /**
  * @covers \Phix\App::flash
  */
 public function testFlash()
 {
     $app = new App();
     $this->assertSame(array(), $app->flash());
     $app->flash('foo');
     $this->assertSame(array('foo'), $app->flash());
     $this->assertSame(array(), $app->flash());
     $ret = $app->flash(function () {
         return 'bar';
     });
     $this->assertSame(array('bar'), $app->flash());
     $this->assertEquals($ret, $app);
 }
Пример #14
0
 public function d011($id = null)
 {
     if (!empty($id)) {
         $req = App::request();
         if ($req->isPost()) {
             $post = $req->post();
             // url_cancel
             $sales = SalesApotik::find($id);
             if (!empty($sales)) {
                 $sales->is_canceled = 1;
                 $sales->save();
                 //jika berhasil hapus record
                 $query = "parent = '" . $id . "'";
                 $results = SalesApotikDetail::all(array('conditions' => $query));
                 if (!empty($results)) {
                     foreach ($results as $row) {
                         //jika berhasil hapus record
                         $folio = KlinikFolio::find($row->id);
                         $folio->delete();
                     }
                 }
                 ZiUtil::to_json(json_encode("{ success: true}"));
                 return;
             }
         }
     }
     App::flash('error', 'Terjadi kesalahan pada inputan anda.');
     App::redirect('selling.list_penjualan');
 }
Пример #15
0
 /**
  * Delete item
  */
 public function delete($id)
 {
     // find user by id and delete
     try {
         $clean_id = strip_tags($id);
         $user = $this->app->auth->findUserById($clean_id);
         $user->delete();
         \App::flash('user-deleted', ' User successfully deleted.');
         \Response::redirect($this->site_url . '/admin-area/users');
     } catch (\Exception $e) {
         \App::flash('user-no-delete', 'User could not be deleted.');
         \Response::redirect($this->site_url . '/admin-area/users');
     }
 }
Пример #16
0
 /**
  * seed the database with initial value
  */
 private function seed()
 {
     try {
         Sentry::createUser(array('email' => '*****@*****.**', 'password' => 'password', 'first_name' => 'Website', 'last_name' => 'Administrator', 'activated' => 1, 'permissions' => array('admin' => 1)));
     } catch (\Exception $e) {
         App::flash('message', $e->getMessage());
     }
 }
Пример #17
0
 public function deleteWhere($field, $value, $msg)
 {
     $check_id = $this->model->where($field, '=', $value)->get();
     if ($check_id) {
         $this->model->where($field, '=', $value)->delete();
         \App::flash('deleted-where', $msg);
     }
 }