From 9bd048375a5f0b481fdf34bf6c9bf4b711ffe0ed Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Mon, 28 Aug 2023 19:36:08 +0530 Subject: [PATCH] fixes : ps --- .gitignore | 2 + app/Config/Constants.php | 10 ++ app/Config/Routes.php | 9 +- app/Controllers/BaseController.php | 6 +- app/Controllers/Books.php | 4 +- app/Controllers/Home.php | 24 ++++ app/Controllers/Settings.php | 6 +- app/Helpers/apiIntegration_helper.php | 36 +++++ app/Views/api_list.php | 26 ++++ app/Views/auth_logout.php | 105 ++++++++++++++ app/Views/auth_signup.php | 188 ++++++++++++++++++++++++++ app/Views/book_list.php | 1 + app/Views/user_form.php | 174 +++++++++++------------- writable/uploads/20230821/index.html | 0 14 files changed, 480 insertions(+), 111 deletions(-) create mode 100644 app/Helpers/apiIntegration_helper.php create mode 100644 app/Views/api_list.php create mode 100755 app/Views/auth_logout.php create mode 100755 app/Views/auth_signup.php delete mode 100644 writable/uploads/20230821/index.html diff --git a/.gitignore b/.gitignore index d2d320a4..20d1c153 100755 --- a/.gitignore +++ b/.gitignore @@ -86,6 +86,8 @@ writable/**/*.sqlite php_errors.log +public/uploads/* +# !public/uploads/index.html #------------------------- # Composer diff --git a/app/Config/Constants.php b/app/Config/Constants.php index 47b92f83..bae5eb9e 100644 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -92,3 +92,13 @@ define('EVENT_PRIORITY_NORMAL', 100); * @deprecated Use \CodeIgniter\Events\Events::PRIORITY_HIGH instead. */ define('EVENT_PRIORITY_HIGH', 10); + +/** + * Dummy Constants For Api Integration. + */ +define('WPBOOK_DETAILS', 'https://reqres.in/api/users?page=2'); +define('WPBOOK_DETAILS_GET_PARAMETER', 'https://reqres.in/api/users?page=2'); +define('WPBOOK_DETAILS_GET_STRAIGHTFORWARD', 'https://reqres.in/api/users'); +define('WPBOOK_DETAILS_GET_SEGMENT', 'https://reqres.in/api/users/2'); +define('WPBOOK_DETAILS_POST', 'https://reqres.in/api/users'); +define('WPBOOK_DETAILS_PUT', 'https://reqres.in/api/users/707'); diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 6aaa781f..2dd7720b 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -60,12 +60,6 @@ $routes->get("new_bussiness/(:any)", "Business::new_bussiness/$1"); $routes->post("insert_business/", "Business::insert_business"); $routes->get("delete_business/(:any)", "Business::delete_business/$1"); - - -$routes->get("subscribers_list/", "Home::subscribers_list"); -$routes->get("add_subscribers/", "Home::add_subscribers"); -$routes->get("edit_subscribers/", "Home::edit_subscribers"); - #custome routes $routes->get("customer_list/", "Customer::index"); $routes->get("new_customer/(:any)", "Customer::new_customer/$1"); @@ -75,6 +69,9 @@ $routes->get("delete_customer/(:any)", "Customer::delete_customer/$1"); $routes->get("scheme_list/", "Scheme::index"); $routes->get("new_scheme/(:any)", "Scheme::new_scheme/$1"); $routes->post("insert_scheme/", "Scheme::insert_scheme"); + +# Api integration +$routes->get("apiintegration", "Home::apiintegration"); /* * -------------------------------------------------------------------- * Additional Routing diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index 81174cc5..743c7294 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -59,8 +59,8 @@ abstract class BaseController extends Controller public function render_page($viewpage, $data){ helper('session'); - $session_uid = get_logged_user_id('user_id'); - $session_uname = get_logged_name('user_name'); + $session_uid = get_logged_user_id(); + $session_uname = get_logged_name(); if(!is_session_active()) { $route = base_url()."login"; return redirect()->route($route); @@ -81,7 +81,7 @@ abstract class BaseController extends Controller echo view('template/topbar.php', $data); echo view($viewpage, $data); echo view('template/footer.php', $data); - + // $header = view('template/header.php', $data); // $topbar = view('template/topbar.php', $data); // $content = view($viewpage, $data); diff --git a/app/Controllers/Books.php b/app/Controllers/Books.php index b7069f77..11551968 100755 --- a/app/Controllers/Books.php +++ b/app/Controllers/Books.php @@ -10,8 +10,8 @@ class Books extends BaseController { helper('session'); if (is_session_active()) { - $session_role = get_user_role('user_role'); - $session_bid = get_business_id('business_id'); + $session_role = get_user_role(); + $session_bid = get_business_id(); $where = ['books.isactive' => 1]; if (!empty($session_role) && $session_role !== "sadmin") { diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index 3373fde0..653315f3 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -11,4 +11,28 @@ class Home extends BaseController $this->render_page('dashboard', $data); } + + ## ApiIntegration. Dummy + public function apiintegration() { + helper('apiIntegration'); + + // GET - list of books + $response_1 = perform_http_request('GET', WPBOOK_DETAILS,false); + $data['books'] = $response_1; + $response_2 = perform_http_request('GET', WPBOOK_DETAILS_GET_STRAIGHTFORWARD,false); + $data['books_ps'] = $response_2; + $response_3 = perform_http_request('GET', WPBOOK_DETAILS_GET_SEGMENT,false); + $data['book'] = $response_3; + //POST - create new book + $request_data = json_encode(array("name" => "Soumitra", "job" => "Blog Author", "avatar" => "https://roytuts.com/about/")); + $response_4 = perform_http_request('POST', WPBOOK_DETAILS_POST, $request_data); + $data['new_book'] = $response_4; + //PUT - update book + $request_data = json_encode(array("name" => "Soumitra", "job" => "Roy Tutorials Author", "avatar" => "https://roytuts.com/about/")); + $response_5 = perform_http_request('PUT', WPBOOK_DETAILS_PUT, $request_data); + $data['update_book'] = $response_5; + //View + // print_r($data); + return view('api_list', $data); + } } diff --git a/app/Controllers/Settings.php b/app/Controllers/Settings.php index 794cc99c..e34dd252 100755 --- a/app/Controllers/Settings.php +++ b/app/Controllers/Settings.php @@ -9,8 +9,8 @@ class Settings extends BaseController public function index() { helper('session'); - $session_role = get_user_role('user_role'); - $session_bid = get_business_id('business_id'); + $session_role = get_user_role(); + $session_bid = get_business_id(); $where = ['settings.isactive' => 1]; if (!empty($session_role) && $session_role !== "sadmin") { @@ -47,7 +47,7 @@ class Settings extends BaseController public function sitesetting_synchronization() { helper('session'); - $session_bid = get_business_id('business_id'); + $session_bid = get_business_id(); $session_uid = get_logged_user_id(); $model = new SettingsModel(); diff --git a/app/Helpers/apiIntegration_helper.php b/app/Helpers/apiIntegration_helper.php new file mode 100644 index 00000000..3c3e2a09 --- /dev/null +++ b/app/Helpers/apiIntegration_helper.php @@ -0,0 +1,36 @@ + \ No newline at end of file diff --git a/app/Views/api_list.php b/app/Views/api_list.php new file mode 100644 index 00000000..c183b4fd --- /dev/null +++ b/app/Views/api_list.php @@ -0,0 +1,26 @@ + + + +

Dummy API Integration

+ +

GET - List Of Books

+ + +

GET - Single Book

+ + +

POST - Create New Book

+ + +

PUT - Update Book

+ + + diff --git a/app/Views/auth_logout.php b/app/Views/auth_logout.php new file mode 100755 index 00000000..3938b9af --- /dev/null +++ b/app/Views/auth_logout.php @@ -0,0 +1,105 @@ + + + + + Logout | Minton - Responsive Admin Dashboard Template + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ +
+ + + +
+
+
+ + + + + + + + + +
+
+ +

See you again !

+ +

You are now successfully sign out.

+
+ + +
+
+ + +
+
+

Back to Sign In

+
+
+ + +
+
+ +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/app/Views/auth_signup.php b/app/Views/auth_signup.php new file mode 100755 index 00000000..74b12fa1 --- /dev/null +++ b/app/Views/auth_signup.php @@ -0,0 +1,188 @@ + + + + + Auth Pages | Create Account | Sign In 2 | Minton - Responsive Admin Dashboard Template + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+

Very elegant & impressive!

+

I've been using this theme for a while and I must say that whenever I am looking for a design - I refer to this theme for specifics & implementation. With wide arrays of components, designs, charts - I would highly recommend this theme for anyone using it for dashboard or project management usage.. +

+
+ - Admin User +
+
+
+ + + +
+
+
+ + + + + +
+
+

Enter your email address and password to access admin panel.

+ + +
+
+ + +
+
+ Forgot your password? + + +
+
+
+ + +
+
+
+ +
+ +
+
Sign in with
+ +
+
+ +
+
+

Don't have an account? Create your own account, it takes less than a minute

+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ + +
+
+
+ +
+ +
+
Sign Up using
+ +
+
+ +
+
+ + +
+

© Minton theme by Coderthemes

+
+ +
+
+
+ +
+ + + + + + + + + + \ No newline at end of file diff --git a/app/Views/book_list.php b/app/Views/book_list.php index abd31d7c..79d8f069 100644 --- a/app/Views/book_list.php +++ b/app/Views/book_list.php @@ -4,6 +4,7 @@

diff --git a/app/Views/user_form.php b/app/Views/user_form.php index 8e335046..250651c3 100644 --- a/app/Views/user_form.php +++ b/app/Views/user_form.php @@ -30,108 +30,111 @@
-
+
Please provide.
-
+
Please provide.
-
-
-
+
Please provide.
-
+
+
+
Please provide.
-
-
-
+
-
+
Please provide.
+
+
-
- - Business Logo -
- -
+
+ + Business Logo +
+ +
+
+
- - - - - -
- -
- - -
Please provide.
-
-
-
- - -
Please provide.
-
-
- - -
Please provide.
-
-
- - -
Please provide.
+ + +
- -
-
- - +
+
+ + +
Please provide.
+
-
- - - - - -
- > - +
+
+ + +
Please provide.
+
+
+ + +
Please provide.
+
+
+ + +
Please provide.
+
+
+ +
+
+ + +
+
+ + + + + +
+ > + +
+
+ + -
- -
@@ -139,27 +142,4 @@
- - - - - \ No newline at end of file + \ No newline at end of file diff --git a/writable/uploads/20230821/index.html b/writable/uploads/20230821/index.html deleted file mode 100644 index e69de29b..00000000