Compare commits
51 Commits
master
...
feature/ua
| Author | SHA1 | Date | |
|---|---|---|---|
| c46ff81926 | |||
| bf680a0d7c | |||
| c19f6ff061 | |||
| 5fa3ffbe1d | |||
| ec8574993b | |||
| e9d1abc26f | |||
| edadba1a41 | |||
| 635c477812 | |||
| 2392cb082a | |||
| 5e16aa99f6 | |||
| 5408d2dc37 | |||
| 5c244684e4 | |||
| af64355a88 | |||
| f742d02d61 | |||
| 54a0c9717c | |||
| 42d4f3e6a3 | |||
| daa526b65d | |||
| a64b21566f | |||
| 5f6573b4d8 | |||
|
|
7cdda4a7ef | ||
|
|
acf0069305 | ||
|
|
262bf676c5 | ||
|
|
74711d22df | ||
|
|
8c5f9aea0c | ||
|
|
a9b3ab9ffd | ||
|
|
85e541f6ad | ||
|
|
ee7ff31b95 | ||
|
|
45f22727ef | ||
|
|
91f6465181 | ||
|
|
d546834126 | ||
|
|
624daac2d9 | ||
|
|
4fa81a7784 | ||
|
|
2fdcf00e22 | ||
|
|
400dc5996a | ||
|
|
37f3dc0091 | ||
|
|
c62c2d519e | ||
|
|
ff30f20614 | ||
|
|
3842ee6979 | ||
|
|
c7ae64c6aa | ||
|
|
1b89482e5b | ||
|
|
e1cc9870dd | ||
|
|
ed734484b8 | ||
| fa52664f6b | |||
| 76f2045126 | |||
| 45d0e0a7dd | |||
| 178b8cbd7d | |||
| cf4fe7383e | |||
|
|
c41e6e378f | ||
|
|
02d186b1f3 | ||
| 213b850567 | |||
| 9c6ec3fc55 |
17
.env
17
.env
@ -15,13 +15,13 @@
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
# CI_ENVIRONMENT = production
|
||||
#CI_ENVIRONMENT = development
|
||||
CI_ENVIRONMENT = development
|
||||
#LOCAL_FOLDER = 'donation'
|
||||
#--------------------------------------------------------------------
|
||||
# APP
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
# app.baseURL = 'http://localhost/donation/'
|
||||
app.baseURL = 'http://localhost/donation/'
|
||||
# app.baseURL ='https://venbainfotech.com/donr/'
|
||||
# app.forceGlobalSecureRequests = false
|
||||
|
||||
@ -63,6 +63,19 @@
|
||||
# database.tests.password = root
|
||||
# database.tests.DBDriver = MySQLi
|
||||
|
||||
|
||||
database.default.hostname = 119.18.54.85
|
||||
database.default.database =venbaehn_donation
|
||||
database.default.username = venbaehn_donor_be_usr1
|
||||
database.default.password = 'e0jZ1BaWZT2V'
|
||||
database.default.DBDriver = MySQLi
|
||||
|
||||
database.tests.hostname = l119.18.54.85
|
||||
database.tests.database = venbaehn_donation
|
||||
database.tests.username = enbaehn_donor_be_usr1
|
||||
database.tests.password = 'e0jZ1BaWZT2V'
|
||||
database.tests.DBDriver = MySQLi
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# CONTENT SECURITY POLICY
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
51
.github/workflows/phpunit.yml
vendored
51
.github/workflows/phpunit.yml
vendored
@ -1,51 +0,0 @@
|
||||
name: PHPUnit
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- develop
|
||||
|
||||
jobs:
|
||||
main:
|
||||
name: Build and test
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
php-versions: ['7.2', '7.3', '7.4']
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
if: "!contains(github.event.head_commit.message, '[ci skip]')"
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@master
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
tools: composer, pecl, phpunit
|
||||
extensions: intl, json, mbstring, mysqlnd, xdebug, xml, sqlite3
|
||||
coverage: xdebug
|
||||
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --no-progress --no-suggest --no-interaction --prefer-dist --optimize-autoloader
|
||||
# To prevent rate limiting you may need to supply an OAuth token in Settings > Secrets
|
||||
# env:
|
||||
# https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens
|
||||
# COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
|
||||
|
||||
- name: Test with phpunit
|
||||
run: vendor/bin/phpunit --coverage-text
|
||||
43
.gitignore
vendored
43
.gitignore
vendored
@ -25,15 +25,22 @@ dist/
|
||||
|
||||
# JetBrains IDE
|
||||
.idea/
|
||||
*.sublime-*
|
||||
*.swp
|
||||
.vscode/
|
||||
|
||||
# Unit test reports
|
||||
TEST*.xml
|
||||
|
||||
# Generated by MacOS
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Generated by Windows
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
Desktop.ini
|
||||
|
||||
# Applications
|
||||
*.app
|
||||
@ -48,3 +55,39 @@ Thumbs.db
|
||||
*.mov
|
||||
*.wmv
|
||||
|
||||
writable/debugbar/
|
||||
writable/debugbar/*
|
||||
!writable/debugbar/.gitkeep
|
||||
writable/session/*
|
||||
!writable/session/index.html
|
||||
!writable/session/.gitkeep
|
||||
writable/logs/
|
||||
!writable/logs/.gitkeep
|
||||
writable/uploads/
|
||||
!writable/uploads/.gitkeep
|
||||
writable/cache/
|
||||
!writable/cache/.gitkeep
|
||||
|
||||
|
||||
|
||||
php_errors.log
|
||||
|
||||
public/uploads/*
|
||||
!public/uploads/index.html
|
||||
!public/uploads/.gitkeep
|
||||
|
||||
writable/**/*.db
|
||||
writable/**/*.sqlite
|
||||
|
||||
#-------------------------
|
||||
# Composer
|
||||
#-------------------------
|
||||
vendor
|
||||
composer.lock
|
||||
|
||||
tests
|
||||
|
||||
# Don't save phpunit under version control.
|
||||
phpunit
|
||||
phpunit*.xml
|
||||
/.phpunit.*.cache
|
||||
22
LICENSE
Normal file
22
LICENSE
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2019 British Columbia Institute of Technology
|
||||
Copyright (c) 2019-2023 CodeIgniter Foundation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
65
README.md
65
README.md
@ -1,64 +1 @@
|
||||
# CodeIgniter 4 Application Starter
|
||||
|
||||
## What is CodeIgniter?
|
||||
|
||||
CodeIgniter is a PHP full-stack web framework that is light, fast, flexible, and secure.
|
||||
More information can be found at the [official site](http://codeigniter.com).
|
||||
|
||||
This repository holds a composer-installable app starter.
|
||||
It has been built from the
|
||||
[development repository](https://github.com/codeigniter4/CodeIgniter4).
|
||||
|
||||
More information about the plans for version 4 can be found in [the announcement](http://forum.codeigniter.com/thread-62615.html) on the forums.
|
||||
|
||||
The user guide corresponding to this version of the framework can be found
|
||||
[here](https://codeigniter4.github.io/userguide/).
|
||||
|
||||
## Installation & updates
|
||||
|
||||
`composer create-project codeigniter4/appstarter` then `composer update` whenever
|
||||
there is a new release of the framework.
|
||||
|
||||
When updating, check the release notes to see if there are any changes you might need to apply
|
||||
to your `app` folder. The affected files can be copied or merged from
|
||||
`vendor/codeigniter4/framework/app`.
|
||||
|
||||
## Setup
|
||||
|
||||
Copy `env` to `.env` and tailor for your app, specifically the baseURL
|
||||
and any database settings.
|
||||
|
||||
## Important Change with index.php
|
||||
|
||||
`index.php` is no longer in the root of the project! It has been moved inside the *public* folder,
|
||||
for better security and separation of components.
|
||||
|
||||
This means that you should configure your web server to "point" to your project's *public* folder, and
|
||||
not to the project root. A better practice would be to configure a virtual host to point there. A poor practice would be to point your web server to the project root and expect to enter *public/...*, as the rest of your logic and the
|
||||
framework are exposed.
|
||||
|
||||
**Please** read the user guide for a better explanation of how CI4 works!
|
||||
The user guide updating and deployment is a bit awkward at the moment, but we are working on it!
|
||||
|
||||
## Repository Management
|
||||
|
||||
We use Github issues, in our main repository, to track **BUGS** and to track approved **DEVELOPMENT** work packages.
|
||||
We use our [forum](http://forum.codeigniter.com) to provide SUPPORT and to discuss
|
||||
FEATURE REQUESTS.
|
||||
|
||||
This repository is a "distribution" one, built by our release preparation script.
|
||||
Problems with it can be raised on our forum, or as issues in the main repository.
|
||||
|
||||
## Server Requirements
|
||||
|
||||
PHP version 7.2 or higher is required, with the following extensions installed:
|
||||
|
||||
- [intl](http://php.net/manual/en/intl.requirements.php)
|
||||
- [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\CURLRequest library
|
||||
|
||||
Additionally, make sure that the following extensions are enabled in your PHP:
|
||||
|
||||
- json (enabled by default - don't turn it off)
|
||||
- [mbstring](http://php.net/manual/en/mbstring.installation.php)
|
||||
- [mysqlnd](http://php.net/manual/en/mysqlnd.install.php)
|
||||
- xml (enabled by default - don't turn it off)
|
||||
# Donation Management Reworked
|
||||
|
||||
@ -4,12 +4,12 @@
|
||||
* The goal of this file is to allow developers a location
|
||||
* where they can overwrite core procedural functions and
|
||||
* replace them with their own. This file is loaded during
|
||||
* the bootstrap process and is called during the frameworks
|
||||
* the bootstrap process and is called during the framework's
|
||||
* execution.
|
||||
*
|
||||
* This can be looked at as a `master helper` file that is
|
||||
* loaded early on, and may also contain additional functions
|
||||
* that you'd like to use throughout your entire application
|
||||
*
|
||||
* @link: https://codeigniter4.github.io/CodeIgniter4/
|
||||
* @see: https://codeigniter.com/user_guide/extending/common.html
|
||||
*/
|
||||
|
||||
@ -1,303 +1,466 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
use CodeIgniter\Session\Handlers\FileHandler;
|
||||
|
||||
class App extends BaseConfig
|
||||
{
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Base Site URL
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* URL to your CodeIgniter root. Typically, this will be your base URL,
|
||||
* WITH a trailing slash:
|
||||
*
|
||||
* http://example.com/
|
||||
*/
|
||||
// public string $baseURL = 'http://localhost:8080/';
|
||||
public string $baseURL = '';
|
||||
// public string $baseURL = 'http://localhost/vb_book/public/';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Base Site URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| URL to your CodeIgniter root. Typically this will be your base URL,
|
||||
| WITH a trailing slash:
|
||||
|
|
||||
| http://example.com/
|
||||
|
|
||||
| If this is not set then CodeIgniter will try guess the protocol, domain
|
||||
| and path to your installation. However, you should always configure this
|
||||
| explicitly and never rely on auto-guessing, especially in production
|
||||
| environments.
|
||||
|
|
||||
*/
|
||||
public $baseURL = BASESEURL;
|
||||
//public $baseURL;
|
||||
// public $baseURL;
|
||||
// public function __construct()
|
||||
// {
|
||||
/**
|
||||
* Allowed Hostnames in the Site URL other than the hostname in the baseURL.
|
||||
* If you want to accept multiple Hostnames, set this.
|
||||
*
|
||||
* E.g. When your site URL ($baseURL) is 'http://example.com/', and your site
|
||||
* also accepts 'http://media.example.com/' and
|
||||
* 'http://accounts.example.com/':
|
||||
* ['media.example.com', 'accounts.example.com']
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var list<string>
|
||||
*/
|
||||
public array $allowedHostnames = [];
|
||||
|
||||
// if ('development' == $_ENV['CI_ENVIRONMENT'])
|
||||
// {
|
||||
// $this->baseURL = 'http://localhost/donation/';
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $allowed_domains = array('domain1.co.uk', 'domain1.com', 'domain1-preview.host.co.uk');
|
||||
// $default_domain = 'domain1.co.uk';
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Index File
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Typically this will be your index.php file, unless you've renamed it to
|
||||
* something else. If you are using mod_rewrite to remove the page set this
|
||||
* variable so that it is blank.
|
||||
*/
|
||||
// public string $indexPage = 'index.php';
|
||||
public string $indexPage = '';
|
||||
|
||||
// if (in_array($_SERVER['HTTP_HOST'], $allowed_domains, true))
|
||||
// {
|
||||
// $domain = $_SERVER['HTTP_HOST'];
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $domain = $default_domain;
|
||||
// }
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* URI PROTOCOL
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* This item determines which server global should be used to retrieve the
|
||||
* URI string. The default setting of 'REQUEST_URI' works for most servers.
|
||||
* If your links do not seem to work, try one of the other delicious flavors:
|
||||
*
|
||||
* 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
|
||||
* 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
|
||||
* 'PATH_INFO' Uses $_SERVER['PATH_INFO']
|
||||
*
|
||||
* WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
|
||||
*/
|
||||
// public string $uriProtocol = 'REQUEST_URI';
|
||||
public $uriProtocol = 'PATH_INFO';
|
||||
|
||||
// if (!empty($_SERVER['HTTPS']))
|
||||
// {
|
||||
// $this->baseURL = 'https://' . $domain;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $this->baseURL = 'http://' . $domain;
|
||||
// }
|
||||
// }
|
||||
// parent::__construct();
|
||||
// }
|
||||
// public $baseURL = BASE;
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Index File
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Typically this will be your index.php file, unless you've renamed it to
|
||||
| something else. If you are using mod_rewrite to remove the page set this
|
||||
| variable so that it is blank.
|
||||
|
|
||||
*/
|
||||
public $indexPage = 'index.php';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| URI PROTOCOL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This item determines which getServer global should be used to retrieve the
|
||||
| URI string. The default setting of 'REQUEST_URI' works for most servers.
|
||||
| If your links do not seem to work, try one of the other delicious flavors:
|
||||
|
|
||||
| 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
|
||||
| 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
|
||||
| 'PATH_INFO' Uses $_SERVER['PATH_INFO']
|
||||
|
|
||||
| WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
|
||||
*/
|
||||
public $uriProtocol = 'PATH_INFO';
|
||||
// public $uriProtocol = 'REQUEST_URI';
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Default Locale
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The Locale roughly represents the language and location that your visitor
|
||||
* is viewing the site from. It affects the language strings and other
|
||||
* strings (like currency markers, numbers, etc), that your program
|
||||
* should run under for this request.
|
||||
*/
|
||||
public string $defaultLocale = 'en';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The Locale roughly represents the language and location that your visitor
|
||||
| is viewing the site from. It affects the language strings and other
|
||||
| strings (like currency markers, numbers, etc), that your program
|
||||
| should run under for this request.
|
||||
|
|
||||
*/
|
||||
public $defaultLocale = 'en';
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Negotiate Locale
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* If true, the current Request object will automatically determine the
|
||||
* language to use based on the value of the Accept-Language header.
|
||||
*
|
||||
* If false, no automatic detection will be performed.
|
||||
*/
|
||||
public bool $negotiateLocale = false;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Negotiate Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If true, the current Request object will automatically determine the
|
||||
| language to use based on the value of the Accept-Language header.
|
||||
|
|
||||
| If false, no automatic detection will be performed.
|
||||
|
|
||||
*/
|
||||
public $negotiateLocale = false;
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Supported Locales
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* If $negotiateLocale is true, this array lists the locales supported
|
||||
* by the application in descending order of priority. If no match is
|
||||
* found, the first locale will be used.
|
||||
*
|
||||
* IncomingRequest::setLocale() also uses this list.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public array $supportedLocales = ['en'];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Supported Locales
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If $negotiateLocale is true, this array lists the locales supported
|
||||
| by the application in descending order of priority. If no match is
|
||||
| found, the first locale will be used.
|
||||
|
|
||||
*/
|
||||
public $supportedLocales = ['en'];
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Application Timezone
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The default timezone that will be used in your application to display
|
||||
* dates with the date helper, and can be retrieved through app_timezone()
|
||||
*
|
||||
* @see https://www.php.net/manual/en/timezones.php for list of timezones supported by PHP.
|
||||
*/
|
||||
// public string $appTimezone = 'UTC';
|
||||
public $appTimezone = 'UTC'; // Set default timezone
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Timezone
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The default timezone that will be used in your application to display
|
||||
| dates with the date helper, and can be retrieved through app_timezone()
|
||||
|
|
||||
*/
|
||||
public $appTimezone = 'America/Chicago';
|
||||
// Read APP_TIMEZONE from environment and update appTimezone if available
|
||||
$envTimezone = $_ENV['APP_TIMEZONE'] ?? null;
|
||||
if ($envTimezone) {
|
||||
$this->appTimezone = $envTimezone;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Character Set
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This determines which character set is used by default in various methods
|
||||
| that require a character set to be provided.
|
||||
|
|
||||
| See http://php.net/htmlspecialchars for a list of supported charsets.
|
||||
|
|
||||
*/
|
||||
public $charset = 'UTF-8';
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Default Character Set
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* This determines which character set is used by default in various methods
|
||||
* that require a character set to be provided.
|
||||
*
|
||||
* @see http://php.net/htmlspecialchars for a list of supported charsets.
|
||||
*/
|
||||
public string $charset = 'UTF-8';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| URI PROTOCOL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If true, this will force every request made to this application to be
|
||||
| made via a secure connection (HTTPS). If the incoming request is not
|
||||
| secure, the user will be redirected to a secure version of the page
|
||||
| and the HTTP Strict Transport Security header will be set.
|
||||
*/
|
||||
public $forceGlobalSecureRequests = false;
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Force Global Secure Requests
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* If true, this will force every request made to this application to be
|
||||
* made via a secure connection (HTTPS). If the incoming request is not
|
||||
* secure, the user will be redirected to a secure version of the page
|
||||
* and the HTTP Strict Transport Security header will be set.
|
||||
*/
|
||||
public bool $forceGlobalSecureRequests = false;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Variables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 'sessionDriver'
|
||||
|
|
||||
| The storage driver to use: files, database, redis, memcached
|
||||
| - CodeIgniter\Session\Handlers\FileHandler
|
||||
| - CodeIgniter\Session\Handlers\DatabaseHandler
|
||||
| - CodeIgniter\Session\Handlers\MemcachedHandler
|
||||
| - CodeIgniter\Session\Handlers\RedisHandler
|
||||
|
|
||||
| 'sessionCookieName'
|
||||
|
|
||||
| The session cookie name, must contain only [0-9a-z_-] characters
|
||||
|
|
||||
| 'sessionExpiration'
|
||||
|
|
||||
| The number of SECONDS you want the session to last.
|
||||
| Setting to 0 (zero) means expire when the browser is closed.
|
||||
|
|
||||
| 'sessionSavePath'
|
||||
|
|
||||
| The location to save sessions to, driver dependent.
|
||||
|
|
||||
| For the 'files' driver, it's a path to a writable directory.
|
||||
| WARNING: Only absolute paths are supported!
|
||||
|
|
||||
| For the 'database' driver, it's a table name.
|
||||
| Please read up the manual for the format with other session drivers.
|
||||
|
|
||||
| IMPORTANT: You are REQUIRED to set a valid save path!
|
||||
|
|
||||
| 'sessionMatchIP'
|
||||
|
|
||||
| Whether to match the user's IP address when reading the session data.
|
||||
|
|
||||
| WARNING: If you're using the database driver, don't forget to update
|
||||
| your session table's PRIMARY KEY when changing this setting.
|
||||
|
|
||||
| 'sessionTimeToUpdate'
|
||||
|
|
||||
| How many seconds between CI regenerating the session ID.
|
||||
|
|
||||
| 'sessionRegenerateDestroy'
|
||||
|
|
||||
| Whether to destroy session data associated with the old session ID
|
||||
| when auto-regenerating the session ID. When set to FALSE, the data
|
||||
| will be later deleted by the garbage collector.
|
||||
|
|
||||
| Other session cookie settings are shared with the rest of the application,
|
||||
| except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.
|
||||
|
|
||||
*/
|
||||
public $sessionDriver = 'CodeIgniter\Session\Handlers\FileHandler';
|
||||
public $sessionCookieName = 'ci_session';
|
||||
public $sessionExpiration = 7200;
|
||||
public $sessionSavePath = WRITEPATH . 'session';
|
||||
public $sessionMatchIP = false;
|
||||
public $sessionTimeToUpdate = 300;
|
||||
public $sessionRegenerateDestroy = false;
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Session Driver
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The session storage driver to use:
|
||||
* - `CodeIgniter\Session\Handlers\FileHandler`
|
||||
* - `CodeIgniter\Session\Handlers\DatabaseHandler`
|
||||
* - `CodeIgniter\Session\Handlers\MemcachedHandler`
|
||||
* - `CodeIgniter\Session\Handlers\RedisHandler`
|
||||
*
|
||||
* @deprecated use Config\Session::$driver instead.
|
||||
*/
|
||||
public string $sessionDriver = FileHandler::class;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cookie Related Variables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| 'cookiePrefix' = Set a cookie name prefix if you need to avoid collisions
|
||||
| 'cookieDomain' = Set to .your-domain.com for site-wide cookies
|
||||
| 'cookiePath' = Typically will be a forward slash
|
||||
| 'cookieSecure' = Cookie will only be set if a secure HTTPS connection exists.
|
||||
| 'cookieHTTPOnly' = Cookie will only be accessible via HTTP(S) (no javascript)
|
||||
|
|
||||
| Note: These settings (with the exception of 'cookie_prefix' and
|
||||
| 'cookie_httponly') will also affect sessions.
|
||||
|
|
||||
*/
|
||||
public $cookiePrefix = '';
|
||||
public $cookieDomain = '';
|
||||
public $cookiePath = '/';
|
||||
public $cookieSecure = false;
|
||||
public $cookieHTTPOnly = false;
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Session Cookie Name
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The session cookie name, must contain only [0-9a-z_-] characters
|
||||
*
|
||||
* @deprecated use Config\Session::$cookieName instead.
|
||||
*/
|
||||
public string $sessionCookieName = 'ci_session';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Reverse Proxy IPs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If your server is behind a reverse proxy, you must whitelist the proxy
|
||||
| IP addresses from which CodeIgniter should trust headers such as
|
||||
| HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify
|
||||
| the visitor's IP address.
|
||||
|
|
||||
| You can use both an array or a comma-separated list of proxy addresses,
|
||||
| as well as specifying whole subnets. Here are a few examples:
|
||||
|
|
||||
| Comma-separated: '10.0.1.200,192.168.5.0/24'
|
||||
| Array: array('10.0.1.200', '192.168.5.0/24')
|
||||
*/
|
||||
public $proxyIPs = '';
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Session Expiration
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The number of SECONDS you want the session to last.
|
||||
* Setting to 0 (zero) means expire when the browser is closed.
|
||||
*
|
||||
* @deprecated use Config\Session::$expiration instead.
|
||||
*/
|
||||
public int $sessionExpiration = 7200;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cross Site Request Forgery
|
||||
|--------------------------------------------------------------------------
|
||||
| Enables a CSRF cookie token to be set. When set to TRUE, token will be
|
||||
| checked on a submitted form. If you are accepting user data, it is strongly
|
||||
| recommended CSRF protection be enabled.
|
||||
|
|
||||
| CSRFTokenName = The token name
|
||||
| CSRFHeaderName = The header name
|
||||
| CSRFCookieName = The cookie name
|
||||
| CSRFExpire = The number in seconds the token should expire.
|
||||
| CSRFRegenerate = Regenerate token on every submission
|
||||
| CSRFRedirect = Redirect to previous page with error on failure
|
||||
*/
|
||||
public $CSRFTokenName = 'csrf_test_name';
|
||||
public $CSRFHeaderName = 'X-CSRF-TOKEN';
|
||||
public $CSRFCookieName = 'csrf_cookie_name';
|
||||
public $CSRFExpire = 7200;
|
||||
public $CSRFRegenerate = true;
|
||||
public $CSRFRedirect = true;
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Session Save Path
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The location to save sessions to and is driver dependent.
|
||||
*
|
||||
* For the 'files' driver, it's a path to a writable directory.
|
||||
* WARNING: Only absolute paths are supported!
|
||||
*
|
||||
* For the 'database' driver, it's a table name.
|
||||
* Please read up the manual for the format with other session drivers.
|
||||
*
|
||||
* IMPORTANT: You are REQUIRED to set a valid save path!
|
||||
*
|
||||
* @deprecated use Config\Session::$savePath instead.
|
||||
*/
|
||||
public string $sessionSavePath = WRITEPATH . 'session';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Content Security Policy
|
||||
|--------------------------------------------------------------------------
|
||||
| Enables the Response's Content Secure Policy to restrict the sources that
|
||||
| can be used for images, scripts, CSS files, audio, video, etc. If enabled,
|
||||
| the Response object will populate default values for the policy from the
|
||||
| ContentSecurityPolicy.php file. Controllers can always add to those
|
||||
| restrictions at run time.
|
||||
|
|
||||
| For a better understanding of CSP, see these documents:
|
||||
| - http://www.html5rocks.com/en/tutorials/security/content-security-policy/
|
||||
| - http://www.w3.org/TR/CSP/
|
||||
*/
|
||||
public $CSPEnabled = false;
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Session Match IP
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Whether to match the user's IP address when reading the session data.
|
||||
*
|
||||
* WARNING: If you're using the database driver, don't forget to update
|
||||
* your session table's PRIMARY KEY when changing this setting.
|
||||
*
|
||||
* @deprecated use Config\Session::$matchIP instead.
|
||||
*/
|
||||
public bool $sessionMatchIP = false;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Session Time to Update
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* How many seconds between CI regenerating the session ID.
|
||||
*
|
||||
* @deprecated use Config\Session::$timeToUpdate instead.
|
||||
*/
|
||||
public int $sessionTimeToUpdate = 300;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Session Regenerate Destroy
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Whether to destroy session data associated with the old session ID
|
||||
* when auto-regenerating the session ID. When set to FALSE, the data
|
||||
* will be later deleted by the garbage collector.
|
||||
*
|
||||
* @deprecated use Config\Session::$regenerateDestroy instead.
|
||||
*/
|
||||
public bool $sessionRegenerateDestroy = false;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Session Database Group
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* DB Group for the database session.
|
||||
*
|
||||
* @deprecated use Config\Session::$DBGroup instead.
|
||||
*/
|
||||
public ?string $sessionDBGroup = null;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cookie Prefix
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Set a cookie name prefix if you need to avoid collisions.
|
||||
*
|
||||
* @deprecated use Config\Cookie::$prefix property instead.
|
||||
*/
|
||||
public string $cookiePrefix = '';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cookie Domain
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Set to `.your-domain.com` for site-wide cookies.
|
||||
*
|
||||
* @deprecated use Config\Cookie::$domain property instead.
|
||||
*/
|
||||
public string $cookieDomain = '';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cookie Path
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Typically will be a forward slash.
|
||||
*
|
||||
* @deprecated use Config\Cookie::$path property instead.
|
||||
*/
|
||||
public string $cookiePath = '/';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cookie Secure
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Cookie will only be set if a secure HTTPS connection exists.
|
||||
*
|
||||
* @deprecated use Config\Cookie::$secure property instead.
|
||||
*/
|
||||
public bool $cookieSecure = false;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cookie HttpOnly
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Cookie will only be accessible via HTTP(S) (no JavaScript).
|
||||
*
|
||||
* @deprecated use Config\Cookie::$httponly property instead.
|
||||
*/
|
||||
public bool $cookieHTTPOnly = true;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cookie SameSite
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Configure cookie SameSite setting. Allowed values are:
|
||||
* - None
|
||||
* - Lax
|
||||
* - Strict
|
||||
* - ''
|
||||
*
|
||||
* Alternatively, you can use the constant names:
|
||||
* - `Cookie::SAMESITE_NONE`
|
||||
* - `Cookie::SAMESITE_LAX`
|
||||
* - `Cookie::SAMESITE_STRICT`
|
||||
*
|
||||
* Defaults to `Lax` for compatibility with modern browsers. Setting `''`
|
||||
* (empty string) means default SameSite attribute set by browsers (`Lax`)
|
||||
* will be set on cookies. If set to `None`, `$cookieSecure` must also be set.
|
||||
*
|
||||
* @deprecated use Config\Cookie::$samesite property instead.
|
||||
*/
|
||||
public ?string $cookieSameSite = 'Lax';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Reverse Proxy IPs
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* If your server is behind a reverse proxy, you must whitelist the proxy
|
||||
* IP addresses from which CodeIgniter should trust headers such as
|
||||
* X-Forwarded-For or Client-IP in order to properly identify
|
||||
* the visitor's IP address.
|
||||
*
|
||||
* You need to set a proxy IP address or IP address with subnets and
|
||||
* the HTTP header for the client IP address.
|
||||
*
|
||||
* Here are some examples:
|
||||
* [
|
||||
* '10.0.1.200' => 'X-Forwarded-For',
|
||||
* '192.168.5.0/24' => 'X-Real-IP',
|
||||
* ]
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public array $proxyIPs = [];
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF Token Name
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The token name.
|
||||
*
|
||||
* @deprecated Use `Config\Security` $tokenName property instead of using this property.
|
||||
*/
|
||||
public string $CSRFTokenName = 'csrf_test_name';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF Header Name
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The header name.
|
||||
*
|
||||
* @deprecated Use `Config\Security` $headerName property instead of using this property.
|
||||
*/
|
||||
public string $CSRFHeaderName = 'X-CSRF-TOKEN';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF Cookie Name
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The cookie name.
|
||||
*
|
||||
* @deprecated Use `Config\Security` $cookieName property instead of using this property.
|
||||
*/
|
||||
public string $CSRFCookieName = 'csrf_cookie_name';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF Expire
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The number in seconds the token should expire.
|
||||
*
|
||||
* @deprecated Use `Config\Security` $expire property instead of using this property.
|
||||
*/
|
||||
public int $CSRFExpire = 7200;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF Regenerate
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Regenerate token on every submission?
|
||||
*
|
||||
* @deprecated Use `Config\Security` $regenerate property instead of using this property.
|
||||
*/
|
||||
public bool $CSRFRegenerate = true;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF Redirect
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Redirect to previous page with error on failure?
|
||||
*
|
||||
* @deprecated Use `Config\Security` $redirect property instead of using this property.
|
||||
*/
|
||||
public bool $CSRFRedirect = false;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF SameSite
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Setting for CSRF SameSite cookie token. Allowed values are:
|
||||
* - None
|
||||
* - Lax
|
||||
* - Strict
|
||||
* - ''
|
||||
*
|
||||
* Defaults to `Lax` as recommended in this link:
|
||||
*
|
||||
* @see https://portswigger.net/web-security/csrf/samesite-cookies
|
||||
*
|
||||
* @deprecated `Config\Cookie` $samesite property is used.
|
||||
*/
|
||||
public string $CSRFSameSite = 'Lax';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Content Security Policy
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Enables the Response's Content Secure Policy to restrict the sources that
|
||||
* can be used for images, scripts, CSS files, audio, video, etc. If enabled,
|
||||
* the Response object will populate default values for the policy from the
|
||||
* `ContentSecurityPolicy.php` file. Controllers can always add to those
|
||||
* restrictions at run time.
|
||||
*
|
||||
* For a better understanding of CSP, see these documents:
|
||||
*
|
||||
* @see http://www.html5rocks.com/en/tutorials/security/content-security-policy/
|
||||
* @see http://www.w3.org/TR/CSP/
|
||||
*/
|
||||
public bool $CSPEnabled = false;
|
||||
}
|
||||
|
||||
@ -6,63 +6,96 @@ use CodeIgniter\Config\AutoloadConfig;
|
||||
|
||||
/**
|
||||
* -------------------------------------------------------------------
|
||||
* AUTO-LOADER
|
||||
* AUTOLOADER CONFIGURATION
|
||||
* -------------------------------------------------------------------
|
||||
*
|
||||
* This file defines the namespaces and class maps so the Autoloader
|
||||
* can find the files as needed.
|
||||
*
|
||||
* NOTE: If you use an identical key in $psr4 or $classmap, then
|
||||
* the values in this file will overwrite the framework's values.
|
||||
* the values in this file will overwrite the framework's values.
|
||||
*
|
||||
* NOTE: This class is required prior to Autoloader instantiation,
|
||||
* and does not extend BaseConfig.
|
||||
*/
|
||||
class Autoload extends AutoloadConfig
|
||||
{
|
||||
/**
|
||||
* -------------------------------------------------------------------
|
||||
* Namespaces
|
||||
* -------------------------------------------------------------------
|
||||
* This maps the locations of any namespaces in your application to
|
||||
* their location on the file system. These are used by the autoloader
|
||||
* to locate files the first time they have been instantiated.
|
||||
*
|
||||
* The '/app' and '/system' directories are already mapped for you.
|
||||
* you may change the name of the 'App' namespace if you wish,
|
||||
* but this should be done prior to creating any namespaced classes,
|
||||
* else you will need to modify all of those classes for this to work.
|
||||
*
|
||||
* Prototype:
|
||||
* $psr4 = [
|
||||
* 'CodeIgniter' => SYSTEMPATH,
|
||||
* 'App' => APPPATH
|
||||
* ];
|
||||
*
|
||||
* @var array<string, array<int, string>|string>
|
||||
* @phpstan-var array<string, string|list<string>>
|
||||
*/
|
||||
public $psr4 = [
|
||||
APP_NAMESPACE => APPPATH, // For custom app namespace
|
||||
'Config' => APPPATH . 'Config',
|
||||
'App\Libraries' => APPPATH . 'Libraries',
|
||||
];
|
||||
|
||||
/**
|
||||
* -------------------------------------------------------------------
|
||||
* Namespaces
|
||||
* -------------------------------------------------------------------
|
||||
* This maps the locations of any namespaces in your application to
|
||||
* their location on the file system. These are used by the autoloader
|
||||
* to locate files the first time they have been instantiated.
|
||||
*
|
||||
* The '/app' and '/system' directories are already mapped for you.
|
||||
* you may change the name of the 'App' namespace if you wish,
|
||||
* but this should be done prior to creating any namespaced classes,
|
||||
* else you will need to modify all of those classes for this to work.
|
||||
*
|
||||
* Prototype:
|
||||
*
|
||||
* $psr4 = [
|
||||
* 'CodeIgniter' => SYSTEMPATH,
|
||||
* 'App' => APPPATH
|
||||
* ];
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $psr4 = [
|
||||
APP_NAMESPACE => APPPATH, // For custom app namespace
|
||||
'Config' => APPPATH . 'Config',
|
||||
'Dompdf' => APPPATH . 'ThirdParty/dompdf/src',
|
||||
];
|
||||
|
||||
/**
|
||||
* -------------------------------------------------------------------
|
||||
* Class Map
|
||||
* -------------------------------------------------------------------
|
||||
* The class map provides a map of class names and their exact
|
||||
* location on the drive. Classes loaded in this manner will have
|
||||
* slightly faster performance because they will not have to be
|
||||
* searched for within one or more directories as they would if they
|
||||
* were being autoloaded through a namespace.
|
||||
*
|
||||
* Prototype:
|
||||
* $classmap = [
|
||||
* 'MyClass' => '/path/to/class/file.php'
|
||||
* ];
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public $classmap = [];
|
||||
|
||||
/**
|
||||
* -------------------------------------------------------------------
|
||||
* Class Map
|
||||
* -------------------------------------------------------------------
|
||||
* The class map provides a map of class names and their exact
|
||||
* location on the drive. Classes loaded in this manner will have
|
||||
* slightly faster performance because they will not have to be
|
||||
* searched for within one or more directories as they would if they
|
||||
* were being autoloaded through a namespace.
|
||||
*
|
||||
* Prototype:
|
||||
*
|
||||
* $classmap = [
|
||||
* 'MyClass' => '/path/to/class/file.php'
|
||||
* ];
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $classmap = [];
|
||||
/**
|
||||
* -------------------------------------------------------------------
|
||||
* Files
|
||||
* -------------------------------------------------------------------
|
||||
* The files array provides a list of paths to __non-class__ files
|
||||
* that will be autoloaded. This can be useful for bootstrap operations
|
||||
* or for loading functions.
|
||||
*
|
||||
* Prototype:
|
||||
* $files = [
|
||||
* '/path/to/my/file.php',
|
||||
* ];
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var list<string>
|
||||
*/
|
||||
public $files = [];
|
||||
|
||||
/**
|
||||
* -------------------------------------------------------------------
|
||||
* Helpers
|
||||
* -------------------------------------------------------------------
|
||||
* Prototype:
|
||||
* $helpers = [
|
||||
* 'form',
|
||||
* ];
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var list<string>
|
||||
*/
|
||||
public $helpers = [];
|
||||
}
|
||||
|
||||
@ -1,32 +1,32 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ERROR DISPLAY
|
||||
|--------------------------------------------------------------------------
|
||||
| In development, we want to show as many errors as possible to help
|
||||
| make sure they don't make it to production. And save us hours of
|
||||
| painful debugging.
|
||||
|--------------------------------------------------------------------------
|
||||
| ERROR DISPLAY
|
||||
|--------------------------------------------------------------------------
|
||||
| In development, we want to show as many errors as possible to help
|
||||
| make sure they don't make it to production. And save us hours of
|
||||
| painful debugging.
|
||||
*/
|
||||
error_reporting(-1);
|
||||
ini_set('display_errors', '1');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| DEBUG BACKTRACES
|
||||
|--------------------------------------------------------------------------
|
||||
| If true, this constant will tell the error screens to display debug
|
||||
| backtraces along with the other error information. If you would
|
||||
| prefer to not see this, set this value to false.
|
||||
|--------------------------------------------------------------------------
|
||||
| DEBUG BACKTRACES
|
||||
|--------------------------------------------------------------------------
|
||||
| If true, this constant will tell the error screens to display debug
|
||||
| backtraces along with the other error information. If you would
|
||||
| prefer to not see this, set this value to false.
|
||||
*/
|
||||
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| DEBUG MODE
|
||||
|--------------------------------------------------------------------------
|
||||
| Debug mode is an experimental flag that can allow changes throughout
|
||||
| the system. This will control whether Kint is loaded, and a few other
|
||||
| items. It can always be used within your own application too.
|
||||
|--------------------------------------------------------------------------
|
||||
| DEBUG MODE
|
||||
|--------------------------------------------------------------------------
|
||||
| Debug mode is an experimental flag that can allow changes throughout
|
||||
| the system. This will control whether Kint is loaded, and a few other
|
||||
| items. It can always be used within your own application too.
|
||||
*/
|
||||
|
||||
defined('CI_DEBUG') || define('CI_DEBUG', true);
|
||||
|
||||
@ -1,22 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ERROR DISPLAY
|
||||
|--------------------------------------------------------------------------
|
||||
| Don't show ANY in production environments. Instead, let the system catch
|
||||
| it and display a generic error message.
|
||||
|--------------------------------------------------------------------------
|
||||
| ERROR DISPLAY
|
||||
|--------------------------------------------------------------------------
|
||||
| Don't show ANY in production environments. Instead, let the system catch
|
||||
| it and display a generic error message.
|
||||
*/
|
||||
ini_set('display_errors', '1');
|
||||
ini_set('display_errors', '0');
|
||||
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| DEBUG MODE
|
||||
|--------------------------------------------------------------------------
|
||||
| Debug mode is an experimental flag that can allow changes throughout
|
||||
| the system. It's not widely used currently, and may not survive
|
||||
| release of the framework.
|
||||
|--------------------------------------------------------------------------
|
||||
| DEBUG MODE
|
||||
|--------------------------------------------------------------------------
|
||||
| Debug mode is an experimental flag that can allow changes throughout
|
||||
| the system. It's not widely used currently, and may not survive
|
||||
| release of the framework.
|
||||
*/
|
||||
|
||||
defined('CI_DEBUG') || define('CI_DEBUG', false);
|
||||
|
||||
@ -1,33 +1,32 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ERROR DISPLAY
|
||||
|--------------------------------------------------------------------------
|
||||
| In development, we want to show as many errors as possible to help
|
||||
| make sure they don't make it to production. And save us hours of
|
||||
| painful debugging.
|
||||
|--------------------------------------------------------------------------
|
||||
| ERROR DISPLAY
|
||||
|--------------------------------------------------------------------------
|
||||
| In development, we want to show as many errors as possible to help
|
||||
| make sure they don't make it to production. And save us hours of
|
||||
| painful debugging.
|
||||
*/
|
||||
error_reporting(-1);
|
||||
ini_set('display_errors', '1');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| DEBUG BACKTRACES
|
||||
|--------------------------------------------------------------------------
|
||||
| If true, this constant will tell the error screens to display debug
|
||||
| backtraces along with the other error information. If you would
|
||||
| prefer to not see this, set this value to false.
|
||||
|--------------------------------------------------------------------------
|
||||
| DEBUG BACKTRACES
|
||||
|--------------------------------------------------------------------------
|
||||
| If true, this constant will tell the error screens to display debug
|
||||
| backtraces along with the other error information. If you would
|
||||
| prefer to not see this, set this value to false.
|
||||
*/
|
||||
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| DEBUG MODE
|
||||
|--------------------------------------------------------------------------
|
||||
| Debug mode is an experimental flag that can allow changes throughout
|
||||
| the system. It's not widely used currently, and may not survive
|
||||
| release of the framework.
|
||||
|--------------------------------------------------------------------------
|
||||
| DEBUG MODE
|
||||
|--------------------------------------------------------------------------
|
||||
| Debug mode is an experimental flag that can allow changes throughout
|
||||
| the system. It's not widely used currently, and may not survive
|
||||
| release of the framework.
|
||||
*/
|
||||
|
||||
defined('CI_DEBUG') || define('CI_DEBUG', true);
|
||||
|
||||
20
app/Config/CURLRequest.php
Normal file
20
app/Config/CURLRequest.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
||||
class CURLRequest extends BaseConfig
|
||||
{
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CURLRequest Share Options
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Whether share options between requests or not.
|
||||
*
|
||||
* If true, all the options won't be reset between requests.
|
||||
* It may cause an error request with unnecessary headers.
|
||||
*/
|
||||
public bool $shareOptions = true;
|
||||
}
|
||||
@ -1,120 +1,172 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Cache\CacheInterface;
|
||||
use CodeIgniter\Cache\Handlers\DummyHandler;
|
||||
use CodeIgniter\Cache\Handlers\FileHandler;
|
||||
use CodeIgniter\Cache\Handlers\MemcachedHandler;
|
||||
use CodeIgniter\Cache\Handlers\PredisHandler;
|
||||
use CodeIgniter\Cache\Handlers\RedisHandler;
|
||||
use CodeIgniter\Cache\Handlers\WincacheHandler;
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
||||
class Cache extends BaseConfig
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Primary Handler
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The name of the preferred handler that should be used. If for some reason
|
||||
| it is not available, the $backupHandler will be used in its place.
|
||||
|
|
||||
*/
|
||||
public $handler = 'file';
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Primary Handler
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The name of the preferred handler that should be used. If for some reason
|
||||
* it is not available, the $backupHandler will be used in its place.
|
||||
*/
|
||||
public string $handler = 'file';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Backup Handler
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The name of the handler that will be used in case the first one is
|
||||
| unreachable. Often, 'file' is used here since the filesystem is
|
||||
| always available, though that's not always practical for the app.
|
||||
|
|
||||
*/
|
||||
public $backupHandler = 'dummy';
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Backup Handler
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The name of the handler that will be used in case the first one is
|
||||
* unreachable. Often, 'file' is used here since the filesystem is
|
||||
* always available, though that's not always practical for the app.
|
||||
*/
|
||||
public string $backupHandler = 'dummy';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Directory Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The path to where cache files should be stored, if using a file-based
|
||||
| system.
|
||||
|
|
||||
*/
|
||||
public $storePath = WRITEPATH . 'cache/';
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cache Directory Path
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The path to where cache files should be stored, if using a file-based
|
||||
* system.
|
||||
*
|
||||
* @deprecated Use the driver-specific variant under $file
|
||||
*/
|
||||
public string $storePath = WRITEPATH . 'cache/';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Include Query String
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Whether to take the URL query string into consideration when generating
|
||||
| output cache files. Valid options are:
|
||||
|
|
||||
| false = Disabled
|
||||
| true = Enabled, take all query parameters into account.
|
||||
| Please be aware that this may result in numerous cache
|
||||
| files generated for the same page over and over again.
|
||||
| array('q') = Enabled, but only take into account the specified list
|
||||
| of query parameters.
|
||||
|
|
||||
*/
|
||||
public $cacheQueryString = false;
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cache Include Query String
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Whether to take the URL query string into consideration when generating
|
||||
* output cache files. Valid options are:
|
||||
*
|
||||
* false = Disabled
|
||||
* true = Enabled, take all query parameters into account.
|
||||
* Please be aware that this may result in numerous cache
|
||||
* files generated for the same page over and over again.
|
||||
* ['q'] = Enabled, but only take into account the specified list
|
||||
* of query parameters.
|
||||
*
|
||||
* @var bool|string[]
|
||||
*/
|
||||
public $cacheQueryString = false;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Key Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This string is added to all cache item names to help avoid collisions
|
||||
| if you run multiple applications with the same cache engine.
|
||||
|
|
||||
*/
|
||||
public $prefix = '';
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Key Prefix
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* This string is added to all cache item names to help avoid collisions
|
||||
* if you run multiple applications with the same cache engine.
|
||||
*/
|
||||
public string $prefix = '';
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Memcached settings
|
||||
| -------------------------------------------------------------------------
|
||||
| Your Memcached servers can be specified below, if you are using
|
||||
| the Memcached drivers.
|
||||
|
|
||||
| See: https://codeigniter.com/user_guide/libraries/caching.html#memcached
|
||||
|
|
||||
*/
|
||||
public $memcached = [
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 11211,
|
||||
'weight' => 1,
|
||||
'raw' => false,
|
||||
];
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Default TTL
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The default number of seconds to save items when none is specified.
|
||||
*
|
||||
* WARNING: This is not used by framework handlers where 60 seconds is
|
||||
* hard-coded, but may be useful to projects and modules. This will replace
|
||||
* the hard-coded value in a future release.
|
||||
*/
|
||||
public int $ttl = 60;
|
||||
|
||||
/*
|
||||
| -------------------------------------------------------------------------
|
||||
| Redis settings
|
||||
| -------------------------------------------------------------------------
|
||||
| Your Redis server can be specified below, if you are using
|
||||
| the Redis or Predis drivers.
|
||||
|
|
||||
*/
|
||||
public $redis = [
|
||||
'host' => '127.0.0.1',
|
||||
'password' => null,
|
||||
'port' => 6379,
|
||||
'timeout' => 0,
|
||||
'database' => 0,
|
||||
];
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Reserved Characters
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* A string of reserved characters that will not be allowed in keys or tags.
|
||||
* Strings that violate this restriction will cause handlers to throw.
|
||||
* Default: {}()/\@:
|
||||
*
|
||||
* NOTE: The default set is required for PSR-6 compliance.
|
||||
*/
|
||||
public string $reservedCharacters = '{}()/\@:';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Available Cache Handlers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is an array of cache engine alias' and class names. Only engines
|
||||
| that are listed here are allowed to be used.
|
||||
|
|
||||
*/
|
||||
public $validHandlers = [
|
||||
'dummy' => \CodeIgniter\Cache\Handlers\DummyHandler::class,
|
||||
'file' => \CodeIgniter\Cache\Handlers\FileHandler::class,
|
||||
'memcached' => \CodeIgniter\Cache\Handlers\MemcachedHandler::class,
|
||||
'predis' => \CodeIgniter\Cache\Handlers\PredisHandler::class,
|
||||
'redis' => \CodeIgniter\Cache\Handlers\RedisHandler::class,
|
||||
'wincache' => \CodeIgniter\Cache\Handlers\WincacheHandler::class,
|
||||
];
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* File settings
|
||||
* --------------------------------------------------------------------------
|
||||
* Your file storage preferences can be specified below, if you are using
|
||||
* the File driver.
|
||||
*
|
||||
* @var array<string, int|string|null>
|
||||
*/
|
||||
public array $file = [
|
||||
'storePath' => WRITEPATH . 'cache/',
|
||||
'mode' => 0640,
|
||||
];
|
||||
|
||||
/**
|
||||
* -------------------------------------------------------------------------
|
||||
* Memcached settings
|
||||
* -------------------------------------------------------------------------
|
||||
* Your Memcached servers can be specified below, if you are using
|
||||
* the Memcached drivers.
|
||||
*
|
||||
* @see https://codeigniter.com/user_guide/libraries/caching.html#memcached
|
||||
*
|
||||
* @var array<string, bool|int|string>
|
||||
*/
|
||||
public array $memcached = [
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 11211,
|
||||
'weight' => 1,
|
||||
'raw' => false,
|
||||
];
|
||||
|
||||
/**
|
||||
* -------------------------------------------------------------------------
|
||||
* Redis settings
|
||||
* -------------------------------------------------------------------------
|
||||
* Your Redis server can be specified below, if you are using
|
||||
* the Redis or Predis drivers.
|
||||
*
|
||||
* @var array<string, int|string|null>
|
||||
*/
|
||||
public array $redis = [
|
||||
'host' => '127.0.0.1',
|
||||
'password' => null,
|
||||
'port' => 6379,
|
||||
'timeout' => 0,
|
||||
'database' => 0,
|
||||
];
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Available Cache Handlers
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* This is an array of cache engine alias' and class names. Only engines
|
||||
* that are listed here are allowed to be used.
|
||||
*
|
||||
* @var array<string, string>
|
||||
* @phpstan-var array<string, class-string<CacheInterface>>
|
||||
*/
|
||||
public array $validHandlers = [
|
||||
'dummy' => DummyHandler::class,
|
||||
'file' => FileHandler::class,
|
||||
'memcached' => MemcachedHandler::class,
|
||||
'predis' => PredisHandler::class,
|
||||
'redis' => RedisHandler::class,
|
||||
'wincache' => WincacheHandler::class,
|
||||
];
|
||||
}
|
||||
|
||||
@ -1,92 +1,106 @@
|
||||
<?php
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// App Namespace
|
||||
//--------------------------------------------------------------------
|
||||
// This defines the default Namespace that is used throughout
|
||||
// CodeIgniter to refer to the Application directory. Change
|
||||
// this constant to change the namespace that all application
|
||||
// classes should use.
|
||||
//
|
||||
// NOTE: changing this will require manually modifying the
|
||||
// existing namespaces of App\* namespaced-classes.
|
||||
//
|
||||
/*
|
||||
| --------------------------------------------------------------------
|
||||
| App Namespace
|
||||
| --------------------------------------------------------------------
|
||||
|
|
||||
| This defines the default Namespace that is used throughout
|
||||
| CodeIgniter to refer to the Application directory. Change
|
||||
| this constant to change the namespace that all application
|
||||
| classes should use.
|
||||
|
|
||||
| NOTE: changing this will require manually modifying the
|
||||
| existing namespaces of App\* namespaced-classes.
|
||||
*/
|
||||
defined('APP_NAMESPACE') || define('APP_NAMESPACE', 'App');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Composer Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The path that Composer's autoload file is expected to live. By default,
|
||||
| the vendor folder is in the Root directory, but you can customize that here.
|
||||
*/
|
||||
| --------------------------------------------------------------------------
|
||||
| Composer Path
|
||||
| --------------------------------------------------------------------------
|
||||
|
|
||||
| The path that Composer's autoload file is expected to live. By default,
|
||||
| the vendor folder is in the Root directory, but you can customize that here.
|
||||
*/
|
||||
defined('COMPOSER_PATH') || define('COMPOSER_PATH', ROOTPATH . 'vendor/autoload.php');
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Timing Constants
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Provide simple ways to work with the myriad of PHP functions that
|
||||
| require information to be in seconds.
|
||||
*/
|
||||
|--------------------------------------------------------------------------
|
||||
| Timing Constants
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Provide simple ways to work with the myriad of PHP functions that
|
||||
| require information to be in seconds.
|
||||
*/
|
||||
defined('SECOND') || define('SECOND', 1);
|
||||
defined('MINUTE') || define('MINUTE', 60);
|
||||
defined('HOUR') || define('HOUR', 3600);
|
||||
defined('DAY') || define('DAY', 86400);
|
||||
defined('WEEK') || define('WEEK', 604800);
|
||||
defined('MONTH') || define('MONTH', 2592000);
|
||||
defined('YEAR') || define('YEAR', 31536000);
|
||||
defined('DECADE') || define('DECADE', 315360000);
|
||||
defined('MONTH') || define('MONTH', 2_592_000);
|
||||
defined('YEAR') || define('YEAR', 31_536_000);
|
||||
defined('DECADE') || define('DECADE', 315_360_000);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Exit Status Codes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Used to indicate the conditions under which the script is exit()ing.
|
||||
| While there is no universal standard for error codes, there are some
|
||||
| broad conventions. Three such conventions are mentioned below, for
|
||||
| those who wish to make use of them. The CodeIgniter defaults were
|
||||
| chosen for the least overlap with these conventions, while still
|
||||
| leaving room for others to be defined in future versions and user
|
||||
| applications.
|
||||
|
|
||||
| The three main conventions used for determining exit status codes
|
||||
| are as follows:
|
||||
|
|
||||
| Standard C/C++ Library (stdlibc):
|
||||
| http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
|
||||
| (This link also contains other GNU-specific conventions)
|
||||
| BSD sysexits.h:
|
||||
| http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
|
||||
| Bash scripting:
|
||||
| http://tldp.org/LDP/abs/html/exitcodes.html
|
||||
|
|
||||
*/
|
||||
defined('EXIT_SUCCESS') || define('EXIT_SUCCESS', 0); // no errors
|
||||
defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // generic error
|
||||
defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // configuration error
|
||||
defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // file not found
|
||||
defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // unknown class
|
||||
| --------------------------------------------------------------------------
|
||||
| Exit Status Codes
|
||||
| --------------------------------------------------------------------------
|
||||
|
|
||||
| Used to indicate the conditions under which the script is exit()ing.
|
||||
| While there is no universal standard for error codes, there are some
|
||||
| broad conventions. Three such conventions are mentioned below, for
|
||||
| those who wish to make use of them. The CodeIgniter defaults were
|
||||
| chosen for the least overlap with these conventions, while still
|
||||
| leaving room for others to be defined in future versions and user
|
||||
| applications.
|
||||
|
|
||||
| The three main conventions used for determining exit status codes
|
||||
| are as follows:
|
||||
|
|
||||
| Standard C/C++ Library (stdlibc):
|
||||
| http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
|
||||
| (This link also contains other GNU-specific conventions)
|
||||
| BSD sysexits.h:
|
||||
| http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
|
||||
| Bash scripting:
|
||||
| http://tldp.org/LDP/abs/html/exitcodes.html
|
||||
|
|
||||
*/
|
||||
defined('EXIT_SUCCESS') || define('EXIT_SUCCESS', 0); // no errors
|
||||
defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // generic error
|
||||
defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // configuration error
|
||||
defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // file not found
|
||||
defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // unknown class
|
||||
defined('EXIT_UNKNOWN_METHOD') || define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
|
||||
defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // invalid user input
|
||||
defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error
|
||||
defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
|
||||
defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
|
||||
defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // invalid user input
|
||||
defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error
|
||||
defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
|
||||
defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
|
||||
|
||||
/**
|
||||
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_LOW instead.
|
||||
*/
|
||||
define('EVENT_PRIORITY_LOW', 200);
|
||||
|
||||
/**
|
||||
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_NORMAL instead.
|
||||
*/
|
||||
define('EVENT_PRIORITY_NORMAL', 100);
|
||||
|
||||
/**
|
||||
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_HIGH instead.
|
||||
*/
|
||||
define('EVENT_PRIORITY_HIGH', 10);
|
||||
|
||||
/**
|
||||
* Constants For BBD
|
||||
*/
|
||||
|
||||
define('SEND_WAAI_URL', 'https://waai.in/api/send');
|
||||
define('SEND_WAAI_GROUP_URL', 'https://waai.in/api/send_group');
|
||||
define('EXPIRAY_NOTIFY_TEMPLATE_EMAIL','EXPIRAY_NOTIFY_TEMPLATE_EMAIL');
|
||||
define('EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP','EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP');
|
||||
|
||||
|
||||
if ( (! empty($_SERVER['REQUEST_SCHEME']) && $_SERVER['REQUEST_SCHEME'] == 'https') ||
|
||||
(! empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ||
|
||||
(! empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443') ) {
|
||||
$protocole = 'https://';
|
||||
} else {
|
||||
$protocole = 'http://';
|
||||
}
|
||||
|
||||
$host = $_SERVER['HTTP_HOST'] . '/';
|
||||
$project = explode('/', $_SERVER['REQUEST_URI']);
|
||||
$baseurl = $protocole . $host . $project[1];
|
||||
$myappBaseUrl = $baseurl.'/';
|
||||
defined('BASESEURL') || define('BASESEURL',$myappBaseUrl);
|
||||
@ -1,48 +1,176 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
||||
/**
|
||||
* Class ContentSecurityPolicyConfig
|
||||
*
|
||||
* Stores the default settings for the ContentSecurityPolicy, if you
|
||||
* choose to use it. The values here will be read in and set as defaults
|
||||
* for the site. If needed, they can be overridden on a page-by-page basis.
|
||||
*
|
||||
* Suggested reference for explanations:
|
||||
* https://www.html5rocks.com/en/tutorials/security/content-security-policy/
|
||||
*
|
||||
* @package Config
|
||||
* @see https://www.html5rocks.com/en/tutorials/security/content-security-policy/
|
||||
*/
|
||||
class ContentSecurityPolicy extends BaseConfig
|
||||
{
|
||||
// broadbrush CSP management
|
||||
// -------------------------------------------------------------------------
|
||||
// Broadbrush CSP management
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
public $reportOnly = false; // default CSP report context
|
||||
public $reportURI = null; // URL to send violation reports to
|
||||
public $upgradeInsecureRequests = false; // toggle for forcing https
|
||||
/**
|
||||
* Default CSP report context
|
||||
*/
|
||||
public bool $reportOnly = false;
|
||||
|
||||
// sources allowed; string or array of strings
|
||||
// Note: once you set a policy to 'none', it cannot be further restricted
|
||||
/**
|
||||
* Specifies a URL where a browser will send reports
|
||||
* when a content security policy is violated.
|
||||
*/
|
||||
public ?string $reportURI = null;
|
||||
|
||||
public $defaultSrc = null; // will default to self if not over-ridden
|
||||
public $scriptSrc = 'self';
|
||||
public $styleSrc = 'self';
|
||||
public $imageSrc = 'self';
|
||||
public $baseURI = null; // will default to self if not over-ridden
|
||||
public $childSrc = 'self';
|
||||
public $connectSrc = 'self';
|
||||
public $fontSrc = null;
|
||||
public $formAction = 'self';
|
||||
public $frameAncestors = null;
|
||||
public $mediaSrc = null;
|
||||
public $objectSrc = 'self';
|
||||
public $manifestSrc = null;
|
||||
/**
|
||||
* Instructs user agents to rewrite URL schemes, changing
|
||||
* HTTP to HTTPS. This directive is for websites with
|
||||
* large numbers of old URLs that need to be rewritten.
|
||||
*/
|
||||
public bool $upgradeInsecureRequests = false;
|
||||
|
||||
// mime types allowed; string or array of strings
|
||||
public $pluginTypes = null;
|
||||
// -------------------------------------------------------------------------
|
||||
// Sources allowed
|
||||
// NOTE: once you set a policy to 'none', it cannot be further restricted
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
// list of actions allowed; string or array of strings
|
||||
public $sandbox = null;
|
||||
/**
|
||||
* Will default to self if not overridden
|
||||
*
|
||||
* @var string|string[]|null
|
||||
*/
|
||||
public $defaultSrc;
|
||||
|
||||
/**
|
||||
* Lists allowed scripts' URLs.
|
||||
*
|
||||
* @var string|string[]
|
||||
*/
|
||||
public $scriptSrc = 'self';
|
||||
|
||||
/**
|
||||
* Lists allowed stylesheets' URLs.
|
||||
*
|
||||
* @var string|string[]
|
||||
*/
|
||||
public $styleSrc = 'self';
|
||||
|
||||
/**
|
||||
* Defines the origins from which images can be loaded.
|
||||
*
|
||||
* @var string|string[]
|
||||
*/
|
||||
public $imageSrc = 'self';
|
||||
|
||||
/**
|
||||
* Restricts the URLs that can appear in a page's `<base>` element.
|
||||
*
|
||||
* Will default to self if not overridden
|
||||
*
|
||||
* @var string|string[]|null
|
||||
*/
|
||||
public $baseURI;
|
||||
|
||||
/**
|
||||
* Lists the URLs for workers and embedded frame contents
|
||||
*
|
||||
* @var string|string[]
|
||||
*/
|
||||
public $childSrc = 'self';
|
||||
|
||||
/**
|
||||
* Limits the origins that you can connect to (via XHR,
|
||||
* WebSockets, and EventSource).
|
||||
*
|
||||
* @var string|string[]
|
||||
*/
|
||||
public $connectSrc = 'self';
|
||||
|
||||
/**
|
||||
* Specifies the origins that can serve web fonts.
|
||||
*
|
||||
* @var string|string[]
|
||||
*/
|
||||
public $fontSrc;
|
||||
|
||||
/**
|
||||
* Lists valid endpoints for submission from `<form>` tags.
|
||||
*
|
||||
* @var string|string[]
|
||||
*/
|
||||
public $formAction = 'self';
|
||||
|
||||
/**
|
||||
* Specifies the sources that can embed the current page.
|
||||
* This directive applies to `<frame>`, `<iframe>`, `<embed>`,
|
||||
* and `<applet>` tags. This directive can't be used in
|
||||
* `<meta>` tags and applies only to non-HTML resources.
|
||||
*
|
||||
* @var string|string[]|null
|
||||
*/
|
||||
public $frameAncestors;
|
||||
|
||||
/**
|
||||
* The frame-src directive restricts the URLs which may
|
||||
* be loaded into nested browsing contexts.
|
||||
*
|
||||
* @var array|string|null
|
||||
*/
|
||||
public $frameSrc;
|
||||
|
||||
/**
|
||||
* Restricts the origins allowed to deliver video and audio.
|
||||
*
|
||||
* @var string|string[]|null
|
||||
*/
|
||||
public $mediaSrc;
|
||||
|
||||
/**
|
||||
* Allows control over Flash and other plugins.
|
||||
*
|
||||
* @var string|string[]
|
||||
*/
|
||||
public $objectSrc = 'self';
|
||||
|
||||
/**
|
||||
* @var string|string[]|null
|
||||
*/
|
||||
public $manifestSrc;
|
||||
|
||||
/**
|
||||
* Limits the kinds of plugins a page may invoke.
|
||||
*
|
||||
* @var string|string[]|null
|
||||
*/
|
||||
public $pluginTypes;
|
||||
|
||||
/**
|
||||
* List of actions allowed.
|
||||
*
|
||||
* @var string|string[]|null
|
||||
*/
|
||||
public $sandbox;
|
||||
|
||||
/**
|
||||
* Nonce tag for style
|
||||
*/
|
||||
public string $styleNonceTag = '{csp-style-nonce}';
|
||||
|
||||
/**
|
||||
* Nonce tag for script
|
||||
*/
|
||||
public string $scriptNonceTag = '{csp-script-nonce}';
|
||||
|
||||
/**
|
||||
* Replace nonce tag automatically
|
||||
*/
|
||||
public bool $autoNonce = true;
|
||||
}
|
||||
|
||||
105
app/Config/Cookie.php
Normal file
105
app/Config/Cookie.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
use DateTimeInterface;
|
||||
|
||||
class Cookie extends BaseConfig
|
||||
{
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cookie Prefix
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Set a cookie name prefix if you need to avoid collisions.
|
||||
*/
|
||||
public string $prefix = '';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cookie Expires Timestamp
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Default expires timestamp for cookies. Setting this to `0` will mean the
|
||||
* cookie will not have the `Expires` attribute and will behave as a session
|
||||
* cookie.
|
||||
*
|
||||
* @var DateTimeInterface|int|string
|
||||
*/
|
||||
public $expires = 0;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cookie Path
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Typically will be a forward slash.
|
||||
*/
|
||||
public string $path = '/';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cookie Domain
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Set to `.your-domain.com` for site-wide cookies.
|
||||
*/
|
||||
public string $domain = '';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cookie Secure
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Cookie will only be set if a secure HTTPS connection exists.
|
||||
*/
|
||||
public bool $secure = false;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cookie HTTPOnly
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Cookie will only be accessible via HTTP(S) (no JavaScript).
|
||||
*/
|
||||
public bool $httponly = true;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cookie SameSite
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Configure cookie SameSite setting. Allowed values are:
|
||||
* - None
|
||||
* - Lax
|
||||
* - Strict
|
||||
* - ''
|
||||
*
|
||||
* Alternatively, you can use the constant names:
|
||||
* - `Cookie::SAMESITE_NONE`
|
||||
* - `Cookie::SAMESITE_LAX`
|
||||
* - `Cookie::SAMESITE_STRICT`
|
||||
*
|
||||
* Defaults to `Lax` for compatibility with modern browsers. Setting `''`
|
||||
* (empty string) means default SameSite attribute set by browsers (`Lax`)
|
||||
* will be set on cookies. If set to `None`, `$secure` must also be set.
|
||||
*/
|
||||
public string $samesite = 'Lax';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cookie Raw
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* This flag allows setting a "raw" cookie, i.e., its name and value are
|
||||
* not URL encoded using `rawurlencode()`.
|
||||
*
|
||||
* If this is set to `true`, cookie names should be compliant of RFC 2616's
|
||||
* list of allowed characters.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes
|
||||
* @see https://tools.ietf.org/html/rfc2616#section-2.2
|
||||
*/
|
||||
public bool $raw = false;
|
||||
}
|
||||
@ -1,114 +1,84 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Database\Config;
|
||||
|
||||
/**
|
||||
* Database Configuration
|
||||
*
|
||||
* @package Config
|
||||
*/
|
||||
|
||||
class Database extends \CodeIgniter\Database\Config
|
||||
class Database extends Config
|
||||
{
|
||||
/**
|
||||
* The directory that holds the Migrations
|
||||
* and Seeds directories.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $filesPath = APPPATH . 'Database/';
|
||||
/**
|
||||
* The directory that holds the Migrations
|
||||
* and Seeds directories.
|
||||
*/
|
||||
public string $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR;
|
||||
|
||||
/**
|
||||
* Lets you choose which connection group to
|
||||
* use if no other is specified.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $defaultGroup = 'default';
|
||||
/**
|
||||
* Lets you choose which connection group to
|
||||
* use if no other is specified.
|
||||
*/
|
||||
public string $defaultGroup = 'default';
|
||||
|
||||
/**
|
||||
* The default database connection.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $default = [
|
||||
'DSN' => '',
|
||||
'hostname' => 'venbainfotech.com',
|
||||
'username' => 'kasirama_donr',
|
||||
'password' => 'gx2BEG=qc+D0',
|
||||
'database' => 'kasirama_donr',
|
||||
'DBDriver' => 'MySQLi',
|
||||
'DBPrefix' => '',
|
||||
'pConnect' => false,
|
||||
'DBDebug' => (ENVIRONMENT !== 'production'),
|
||||
'cacheOn' => false,
|
||||
'cacheDir' => '',
|
||||
'charset' => 'utf8',
|
||||
'DBCollat' => 'utf8_general_ci',
|
||||
'swapPre' => '',
|
||||
'encrypt' => false,
|
||||
'compress' => false,
|
||||
'strictOn' => false,
|
||||
'failover' => [],
|
||||
'port' => 3306,
|
||||
];
|
||||
/**
|
||||
* The default database connection.
|
||||
*/
|
||||
public array $default = [
|
||||
'DSN' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
'database' => '',
|
||||
'DBDriver' => 'MySQLi',
|
||||
'DBPrefix' => '',
|
||||
'pConnect' => false,
|
||||
'DBDebug' => true,
|
||||
'charset' => 'utf8',
|
||||
'DBCollat' => 'utf8_general_ci',
|
||||
'swapPre' => '',
|
||||
'encrypt' => false,
|
||||
'compress' => false,
|
||||
'strictOn' => false,
|
||||
'failover' => [],
|
||||
'port' => 3306,
|
||||
];
|
||||
|
||||
/**
|
||||
* This database connection is used when
|
||||
* running PHPUnit database tests.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $tests = [
|
||||
'DSN' => '',
|
||||
'hostname' => '127.0.0.1',
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
'database' => ':memory:',
|
||||
'DBDriver' => 'SQLite3',
|
||||
'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS
|
||||
'pConnect' => false,
|
||||
'DBDebug' => (ENVIRONMENT !== 'production'),
|
||||
'cacheOn' => false,
|
||||
'cacheDir' => '',
|
||||
'charset' => 'utf8',
|
||||
'DBCollat' => 'utf8_general_ci',
|
||||
'swapPre' => '',
|
||||
'encrypt' => false,
|
||||
'compress' => false,
|
||||
'strictOn' => false,
|
||||
'failover' => [],
|
||||
'port' => 3306,
|
||||
];
|
||||
/**
|
||||
* This database connection is used when
|
||||
* running PHPUnit database tests.
|
||||
*/
|
||||
public array $tests = [
|
||||
'DSN' => '',
|
||||
'hostname' => '119.18.54.85',
|
||||
'username' => 'venbaehn_donor_be_usr1',
|
||||
'password' => 'e0jZ1BaWZT2V',
|
||||
'database' => 'venbaehn_donation',
|
||||
'DBDriver' => 'SQLite3',
|
||||
'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS
|
||||
'pConnect' => false,
|
||||
'DBDebug' => true,
|
||||
'charset' => 'utf8',
|
||||
'DBCollat' => 'utf8_general_ci',
|
||||
'swapPre' => '',
|
||||
'encrypt' => false,
|
||||
'compress' => false,
|
||||
'strictOn' => false,
|
||||
'failover' => [],
|
||||
'port' => 3306,
|
||||
'foreignKeys' => true,
|
||||
'busyTimeout' => 1000,
|
||||
];
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Ensure that we always set the database group to 'tests' if
|
||||
// we are currently running an automated test suite, so that
|
||||
// we don't overwrite live data on accident.
|
||||
if (ENVIRONMENT === 'testing')
|
||||
{
|
||||
$this->defaultGroup = 'tests';
|
||||
|
||||
// Under Travis-CI, we can set an ENV var named 'DB_GROUP'
|
||||
// so that we can test against multiple databases.
|
||||
if ($group = getenv('DB'))
|
||||
{
|
||||
if (is_file(TESTPATH . 'travis/Database.php'))
|
||||
{
|
||||
require TESTPATH . 'travis/Database.php';
|
||||
|
||||
if (! empty($dbconfig) && array_key_exists($group, $dbconfig))
|
||||
{
|
||||
$this->tests = $dbconfig[$group];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// Ensure that we always set the database group to 'tests' if
|
||||
// we are currently running an automated test suite, so that
|
||||
// we don't overwrite live data on accident.
|
||||
if (ENVIRONMENT === 'testing') {
|
||||
$this->defaultGroup = 'tests';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,33 +1,43 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
/**
|
||||
* DocTypes
|
||||
*
|
||||
* @package Config
|
||||
*/
|
||||
namespace Config;
|
||||
|
||||
class DocTypes
|
||||
{
|
||||
public $list =
|
||||
[
|
||||
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
|
||||
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
|
||||
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
|
||||
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
|
||||
'xhtml-basic11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',
|
||||
'html5' => '<!DOCTYPE html>',
|
||||
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
|
||||
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
|
||||
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
|
||||
'mathml1' => '<!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd">',
|
||||
'mathml2' => '<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">',
|
||||
'svg10' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
|
||||
'svg11' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',
|
||||
'svg11-basic' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">',
|
||||
'svg11-tiny' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">',
|
||||
'xhtml-math-svg-xh' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
|
||||
'xhtml-math-svg-sh' => '<!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
|
||||
'xhtml-rdfa-1' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">',
|
||||
'xhtml-rdfa-2' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">',
|
||||
];
|
||||
/**
|
||||
* List of valid document types.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public array $list = [
|
||||
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
|
||||
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
|
||||
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
|
||||
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
|
||||
'xhtml-basic11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',
|
||||
'html5' => '<!DOCTYPE html>',
|
||||
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
|
||||
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
|
||||
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
|
||||
'mathml1' => '<!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd">',
|
||||
'mathml2' => '<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">',
|
||||
'svg10' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
|
||||
'svg11' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',
|
||||
'svg11-basic' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">',
|
||||
'svg11-tiny' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">',
|
||||
'xhtml-math-svg-xh' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
|
||||
'xhtml-math-svg-sh' => '<!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
|
||||
'xhtml-rdfa-1' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">',
|
||||
'xhtml-rdfa-2' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">',
|
||||
];
|
||||
|
||||
/**
|
||||
* Whether to remove the solidus (`/`) character for void HTML elements (e.g. `<input>`)
|
||||
* for HTML5 compatibility.
|
||||
*
|
||||
* Set to:
|
||||
* `true` - to be HTML5 compatible
|
||||
* `false` - to be XHTML compatible
|
||||
*/
|
||||
public bool $html5 = true;
|
||||
}
|
||||
|
||||
@ -1,172 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
||||
class Email extends BaseConfig
|
||||
{
|
||||
public string $fromEmail = '';
|
||||
public string $fromName = '';
|
||||
public string $recipients = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $fromEmail;
|
||||
/**
|
||||
* The "user agent"
|
||||
*/
|
||||
public string $userAgent = 'CodeIgniter';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $fromName;
|
||||
/**
|
||||
* The mail sending protocol: mail, sendmail, smtp
|
||||
*/
|
||||
public string $protocol = 'smtp';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $recipients;
|
||||
/**
|
||||
* The server path to Sendmail.
|
||||
*/
|
||||
public string $mailPath = '/usr/sbin/sendmail';
|
||||
|
||||
/**
|
||||
* The "user agent"
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $userAgent = 'CodeIgniter';
|
||||
/**
|
||||
* SMTP Server Address
|
||||
*/
|
||||
public string $SMTPHost = 'mail.venbait.in';
|
||||
|
||||
/**
|
||||
* The mail sending protocol: mail, sendmail, smtp
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $protocol = 'smtp';
|
||||
/**
|
||||
* SMTP Username
|
||||
*/
|
||||
public string $SMTPUser = 'bbone@venbait.in';
|
||||
|
||||
/**
|
||||
* The server path to Sendmail.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $mailPath = '/usr/sbin/sendmail';
|
||||
/**
|
||||
* SMTP Password
|
||||
*/
|
||||
public string $SMTPPass = 'xk!L(N_-R#};';
|
||||
|
||||
/**
|
||||
* SMTP Server Address
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $SMTPHost = 'ssl://smtp.gmail.com';
|
||||
/**
|
||||
* SMTP Port
|
||||
*/
|
||||
public int $SMTPPort = 465;
|
||||
|
||||
/**
|
||||
* SMTP Username
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
// Enter your email id from where you send email
|
||||
public $SMTPUser = 'celine.forworkinphp96@gmail.com';
|
||||
|
||||
/**
|
||||
* SMTP Timeout (in seconds)
|
||||
*/
|
||||
public int $SMTPTimeout = 20;
|
||||
|
||||
/**
|
||||
* SMTP Password
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
// Enter your email's password
|
||||
public $SMTPPass = 'phpmailer96';
|
||||
/**
|
||||
* Enable persistent SMTP connections
|
||||
*/
|
||||
public bool $SMTPKeepAlive = false;
|
||||
|
||||
/**
|
||||
* SMTP Port
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $SMTPPort = 465;
|
||||
/**
|
||||
* SMTP Encryption. Either tls or ssl
|
||||
*/
|
||||
public string $SMTPCrypto = 'ssl';
|
||||
|
||||
/**
|
||||
* SMTP Timeout (in seconds)
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $SMTPTimeout = 60;
|
||||
/**
|
||||
* Enable word-wrap
|
||||
*/
|
||||
public bool $wordWrap = true;
|
||||
|
||||
/**
|
||||
* Enable persistent SMTP connections
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $SMTPKeepAlive = false;
|
||||
/**
|
||||
* Character count to wrap at
|
||||
*/
|
||||
public int $wrapChars = 76;
|
||||
|
||||
/**
|
||||
* SMTP Encryption. Either tls or ssl
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $SMTPCrypto = 'ssl';
|
||||
/**
|
||||
* Type of mail, either 'text' or 'html'
|
||||
*/
|
||||
public string $mailType = 'html';
|
||||
|
||||
/**
|
||||
* Enable word-wrap
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $wordWrap = true;
|
||||
/**
|
||||
* Character set (utf-8, iso-8859-1, etc.)
|
||||
*/
|
||||
public string $charset = 'UTF-8';
|
||||
|
||||
/**
|
||||
* Character count to wrap at
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $wrapChars = 76;
|
||||
/**
|
||||
* Whether to validate the email address
|
||||
*/
|
||||
public bool $validate = false;
|
||||
|
||||
/**
|
||||
* Type of mail, either 'text' or 'html'
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $mailType = 'html';
|
||||
/**
|
||||
* Email Priority. 1 = highest. 5 = lowest. 3 = normal
|
||||
*/
|
||||
public int $priority = 3;
|
||||
|
||||
/**
|
||||
* Character set (utf-8, iso-8859-1, etc.)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $charset = 'UTF-8';
|
||||
/**
|
||||
* Newline character. (Use “\r\n” to comply with RFC 822)
|
||||
*/
|
||||
public string $CRLF = "\r\n";
|
||||
|
||||
/**
|
||||
* Whether to validate the email address
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $validate = false;
|
||||
/**
|
||||
* Newline character. (Use “\r\n” to comply with RFC 822)
|
||||
*/
|
||||
public string $newline = "\r\n";
|
||||
|
||||
/**
|
||||
* Email Priority. 1 = highest. 5 = lowest. 3 = normal
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $priority = 3;
|
||||
/**
|
||||
* Enable BCC Batch Mode.
|
||||
*/
|
||||
public bool $BCCBatchMode = false;
|
||||
|
||||
/**
|
||||
* Newline character. (Use “\r\n” to comply with RFC 822)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $CRLF = "\r\n";
|
||||
/**
|
||||
* Number of emails in each BCC batch
|
||||
*/
|
||||
public int $BCCBatchSize = 200;
|
||||
|
||||
/**
|
||||
* Newline character. (Use “\r\n” to comply with RFC 822)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $newline = "\r\n";
|
||||
|
||||
/**
|
||||
* Enable BCC Batch Mode.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $BCCBatchMode = false;
|
||||
|
||||
/**
|
||||
* Number of emails in each BCC batch
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $BCCBatchSize = 200;
|
||||
|
||||
/**
|
||||
* Enable notify message from server
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $DSN = false;
|
||||
}
|
||||
/**
|
||||
* Enable notify message from server
|
||||
*/
|
||||
public bool $DSN = false;
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
@ -11,26 +12,81 @@ use CodeIgniter\Config\BaseConfig;
|
||||
*/
|
||||
class Encryption extends BaseConfig
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key Starter
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you use the Encryption class you must set an encryption key (seed).
|
||||
| You need to ensure it is long enough for the cipher and mode you plan to use.
|
||||
| See the user guide for more info.
|
||||
*/
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Encryption Key Starter
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* If you use the Encryption class you must set an encryption key (seed).
|
||||
* You need to ensure it is long enough for the cipher and mode you plan to use.
|
||||
* See the user guide for more info.
|
||||
*/
|
||||
public string $key = '';
|
||||
|
||||
public $key = '';
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Encryption Driver to Use
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* One of the supported encryption drivers.
|
||||
*
|
||||
* Available drivers:
|
||||
* - OpenSSL
|
||||
* - Sodium
|
||||
*/
|
||||
public string $driver = 'OpenSSL';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption driver to use
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| One of the supported drivers, eg 'OpenSSL' or 'Sodium'.
|
||||
| The default driver, if you don't specify one, is 'OpenSSL'.
|
||||
*/
|
||||
public $driver = 'OpenSSL';
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* SodiumHandler's Padding Length in Bytes
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* This is the number of bytes that will be padded to the plaintext message
|
||||
* before it is encrypted. This value should be greater than zero.
|
||||
*
|
||||
* See the user guide for more information on padding.
|
||||
*/
|
||||
public int $blockSize = 16;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Encryption digest
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* HMAC digest to use, e.g. 'SHA512' or 'SHA256'. Default value is 'SHA512'.
|
||||
*/
|
||||
public string $digest = 'SHA512';
|
||||
|
||||
/**
|
||||
* Whether the cipher-text should be raw. If set to false, then it will be base64 encoded.
|
||||
* This setting is only used by OpenSSLHandler.
|
||||
*
|
||||
* Set to false for CI3 Encryption compatibility.
|
||||
*/
|
||||
public bool $rawData = true;
|
||||
|
||||
/**
|
||||
* Encryption key info.
|
||||
* This setting is only used by OpenSSLHandler.
|
||||
*
|
||||
* Set to 'encryption' for CI3 Encryption compatibility.
|
||||
*/
|
||||
public string $encryptKeyInfo = '';
|
||||
|
||||
/**
|
||||
* Authentication key info.
|
||||
* This setting is only used by OpenSSLHandler.
|
||||
*
|
||||
* Set to 'authentication' for CI3 Encryption compatibility.
|
||||
*/
|
||||
public string $authKeyInfo = '';
|
||||
|
||||
/**
|
||||
* Cipher to use.
|
||||
* This setting is only used by OpenSSLHandler.
|
||||
*
|
||||
* Set to 'AES-128-CBC' to decrypt encrypted data that encrypted
|
||||
* by CI3 Encryption default configuration.
|
||||
*/
|
||||
public string $cipher = 'AES-256-CTR';
|
||||
}
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Events\Events;
|
||||
use CodeIgniter\Exceptions\FrameworkException;
|
||||
@ -20,33 +22,27 @@ use CodeIgniter\Exceptions\FrameworkException;
|
||||
* Events::on('create', [$myInstance, 'myMethod']);
|
||||
*/
|
||||
|
||||
Events::on('pre_system', function () {
|
||||
if (ENVIRONMENT !== 'testing')
|
||||
{
|
||||
if (ini_get('zlib.output_compression'))
|
||||
{
|
||||
throw FrameworkException::forEnabledZlibOutputCompression();
|
||||
}
|
||||
Events::on('pre_system', static function () {
|
||||
if (ENVIRONMENT !== 'testing') {
|
||||
if (ini_get('zlib.output_compression')) {
|
||||
throw FrameworkException::forEnabledZlibOutputCompression();
|
||||
}
|
||||
|
||||
while (ob_get_level() > 0)
|
||||
{
|
||||
ob_end_flush();
|
||||
}
|
||||
while (ob_get_level() > 0) {
|
||||
ob_end_flush();
|
||||
}
|
||||
|
||||
ob_start(function ($buffer) {
|
||||
return $buffer;
|
||||
});
|
||||
}
|
||||
ob_start(static fn ($buffer) => $buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* Debug Toolbar Listeners.
|
||||
* --------------------------------------------------------------------
|
||||
* If you delete, they will no longer be collected.
|
||||
*/
|
||||
if (ENVIRONMENT !== 'production')
|
||||
{
|
||||
Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect');
|
||||
Services::toolbar()->respond();
|
||||
}
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* Debug Toolbar Listeners.
|
||||
* --------------------------------------------------------------------
|
||||
* If you delete, they will no longer be collected.
|
||||
*/
|
||||
if (CI_DEBUG && ! is_cli()) {
|
||||
Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect');
|
||||
Services::toolbar()->respond();
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,42 +1,77 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
use Psr\Log\LogLevel;
|
||||
|
||||
/**
|
||||
* Setup how the exception handler works.
|
||||
*
|
||||
* @package Config
|
||||
*/
|
||||
class Exceptions extends BaseConfig
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| LOG EXCEPTIONS?
|
||||
|--------------------------------------------------------------------------
|
||||
| If true, then exceptions will be logged
|
||||
| through Services::Log.
|
||||
|
|
||||
| Default: true
|
||||
*/
|
||||
public $log = true;
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* LOG EXCEPTIONS?
|
||||
* --------------------------------------------------------------------------
|
||||
* If true, then exceptions will be logged
|
||||
* through Services::Log.
|
||||
*
|
||||
* Default: true
|
||||
*/
|
||||
public bool $log = true;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| DO NOT LOG STATUS CODES
|
||||
|--------------------------------------------------------------------------
|
||||
| Any status codes here will NOT be logged if logging is turned on.
|
||||
| By default, only 404 (Page Not Found) exceptions are ignored.
|
||||
*/
|
||||
public $ignoreCodes = [ 404 ];
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* DO NOT LOG STATUS CODES
|
||||
* --------------------------------------------------------------------------
|
||||
* Any status codes here will NOT be logged if logging is turned on.
|
||||
* By default, only 404 (Page Not Found) exceptions are ignored.
|
||||
*/
|
||||
public array $ignoreCodes = [404];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Error Views Path
|
||||
|--------------------------------------------------------------------------
|
||||
| This is the path to the directory that contains the 'cli' and 'html'
|
||||
| directories that hold the views used to generate errors.
|
||||
|
|
||||
| Default: APPPATH.'Views/errors'
|
||||
*/
|
||||
public $errorViewPath = APPPATH . 'Views/errors';
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Error Views Path
|
||||
* --------------------------------------------------------------------------
|
||||
* This is the path to the directory that contains the 'cli' and 'html'
|
||||
* directories that hold the views used to generate errors.
|
||||
*
|
||||
* Default: APPPATH.'Views/errors'
|
||||
*/
|
||||
public string $errorViewPath = APPPATH . 'Views/errors';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* HIDE FROM DEBUG TRACE
|
||||
* --------------------------------------------------------------------------
|
||||
* Any data that you would like to hide from the debug trace.
|
||||
* In order to specify 2 levels, use "/" to separate.
|
||||
* ex. ['server', 'setup/password', 'secret_token']
|
||||
*/
|
||||
public array $sensitiveDataInTrace = [];
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* LOG DEPRECATIONS INSTEAD OF THROWING?
|
||||
* --------------------------------------------------------------------------
|
||||
* By default, CodeIgniter converts deprecations into exceptions. Also,
|
||||
* starting in PHP 8.1 will cause a lot of deprecated usage warnings.
|
||||
* Use this option to temporarily cease the warnings and instead log those.
|
||||
* This option also works for user deprecations.
|
||||
*/
|
||||
public bool $logDeprecations = true;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* LOG LEVEL THRESHOLD FOR DEPRECATIONS
|
||||
* --------------------------------------------------------------------------
|
||||
* If `$logDeprecations` is set to `true`, this sets the log level
|
||||
* to which the deprecation will be logged. This should be one of the log
|
||||
* levels recognized by PSR-3.
|
||||
*
|
||||
* The related `Config\Logger::$threshold` should be adjusted, if needed,
|
||||
* to capture logging the deprecations.
|
||||
*/
|
||||
public string $deprecationLogLevel = LogLevel::WARNING;
|
||||
}
|
||||
|
||||
30
app/Config/Feature.php
Normal file
30
app/Config/Feature.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
||||
/**
|
||||
* Enable/disable backward compatibility breaking features.
|
||||
*/
|
||||
class Feature extends BaseConfig
|
||||
{
|
||||
/**
|
||||
* Enable multiple filters for a route or not.
|
||||
*
|
||||
* If you enable this:
|
||||
* - CodeIgniter\CodeIgniter::handleRequest() uses:
|
||||
* - CodeIgniter\Filters\Filters::enableFilters(), instead of enableFilter()
|
||||
* - CodeIgniter\CodeIgniter::tryToRouteIt() uses:
|
||||
* - CodeIgniter\Router\Router::getFilters(), instead of getFilter()
|
||||
* - CodeIgniter\Router\Router::handle() uses:
|
||||
* - property $filtersInfo, instead of $filterInfo
|
||||
* - CodeIgniter\Router\RouteCollection::getFiltersForRoute(), instead of getFilterForRoute()
|
||||
*/
|
||||
public bool $multipleFilters = false;
|
||||
|
||||
/**
|
||||
* Use improved new auto routing instead of the default legacy version.
|
||||
*/
|
||||
public bool $autoRoutesImproved = false;
|
||||
}
|
||||
@ -1,36 +1,64 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
use CodeIgniter\Filters\CSRF;
|
||||
use CodeIgniter\Filters\DebugToolbar;
|
||||
use CodeIgniter\Filters\Honeypot;
|
||||
use CodeIgniter\Filters\InvalidChars;
|
||||
use CodeIgniter\Filters\SecureHeaders;
|
||||
|
||||
class Filters extends BaseConfig
|
||||
{
|
||||
// Makes reading things below nicer,
|
||||
// and simpler to change out script that's used.
|
||||
public $aliases = [
|
||||
'csrf' => \CodeIgniter\Filters\CSRF::class,
|
||||
'toolbar' => \CodeIgniter\Filters\DebugToolbar::class,
|
||||
'honeypot' => \CodeIgniter\Filters\Honeypot::class,
|
||||
];
|
||||
/**
|
||||
* Configures aliases for Filter classes to
|
||||
* make reading things nicer and simpler.
|
||||
*/
|
||||
public array $aliases = [
|
||||
'csrf' => CSRF::class,
|
||||
'toolbar' => DebugToolbar::class,
|
||||
'honeypot' => Honeypot::class,
|
||||
'invalidchars' => InvalidChars::class,
|
||||
'secureheaders' => SecureHeaders::class,
|
||||
];
|
||||
|
||||
// Always applied before every request
|
||||
public $globals = [
|
||||
'before' => [
|
||||
//'honeypot'
|
||||
// 'csrf',
|
||||
],
|
||||
'after' => [
|
||||
'toolbar',
|
||||
//'honeypot'
|
||||
],
|
||||
];
|
||||
/**
|
||||
* List of filter aliases that are always
|
||||
* applied before and after every request.
|
||||
*/
|
||||
public array $globals = [
|
||||
'before' => [
|
||||
// 'honeypot',
|
||||
// 'csrf',
|
||||
// 'invalidchars',
|
||||
],
|
||||
'after' => [
|
||||
'toolbar',
|
||||
// 'honeypot',
|
||||
// 'secureheaders',
|
||||
],
|
||||
];
|
||||
|
||||
// Works on all of a particular HTTP method
|
||||
// (GET, POST, etc) as BEFORE filters only
|
||||
// like: 'post' => ['CSRF', 'throttle'],
|
||||
public $methods = [];
|
||||
/**
|
||||
* List of filter aliases that works on a
|
||||
* particular HTTP method (GET, POST, etc.).
|
||||
*
|
||||
* Example:
|
||||
* 'post' => ['foo', 'bar']
|
||||
*
|
||||
* If you use this, you should disable auto-routing because auto-routing
|
||||
* permits any HTTP method to access a controller. Accessing the controller
|
||||
* with a method you don't expect could bypass the filter.
|
||||
*/
|
||||
public array $methods = [];
|
||||
|
||||
// List filter aliases and any before/after uri patterns
|
||||
// that they should run on, like:
|
||||
// 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']],
|
||||
public $filters = [];
|
||||
/**
|
||||
* List of filter aliases that should run on any
|
||||
* before or after URI patterns.
|
||||
*
|
||||
* Example:
|
||||
* 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
|
||||
*/
|
||||
public array $filters = [];
|
||||
}
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
class ForeignCharacters extends \CodeIgniter\Config\ForeignCharacters
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\ForeignCharacters as BaseForeignCharacters;
|
||||
|
||||
class ForeignCharacters extends BaseForeignCharacters
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@ -1,85 +1,77 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
use CodeIgniter\Format\FormatterInterface;
|
||||
use CodeIgniter\Format\JSONFormatter;
|
||||
use CodeIgniter\Format\XMLFormatter;
|
||||
|
||||
class Format extends BaseConfig
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Available Response Formats
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When you perform content negotiation with the request, these are the
|
||||
| available formats that your application supports. This is currently
|
||||
| only used with the API\ResponseTrait. A valid Formatter must exist
|
||||
| for the specified format.
|
||||
|
|
||||
| These formats are only checked when the data passed to the respond()
|
||||
| method is an array.
|
||||
|
|
||||
*/
|
||||
public $supportedResponseFormats = [
|
||||
'application/json',
|
||||
'application/xml', // machine-readable XML
|
||||
'text/xml', // human-readable XML
|
||||
];
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Available Response Formats
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* When you perform content negotiation with the request, these are the
|
||||
* available formats that your application supports. This is currently
|
||||
* only used with the API\ResponseTrait. A valid Formatter must exist
|
||||
* for the specified format.
|
||||
*
|
||||
* These formats are only checked when the data passed to the respond()
|
||||
* method is an array.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public array $supportedResponseFormats = [
|
||||
'application/json',
|
||||
'application/xml', // machine-readable XML
|
||||
'text/xml', // human-readable XML
|
||||
];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Formatters
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Lists the class to use to format responses with of a particular type.
|
||||
| For each mime type, list the class that should be used. Formatters
|
||||
| can be retrieved through the getFormatter() method.
|
||||
|
|
||||
*/
|
||||
public $formatters = [
|
||||
'application/json' => \CodeIgniter\Format\JSONFormatter::class,
|
||||
'application/xml' => \CodeIgniter\Format\XMLFormatter::class,
|
||||
'text/xml' => \CodeIgniter\Format\XMLFormatter::class,
|
||||
];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Formatters Options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Additional Options to adjust default formatters behaviour.
|
||||
| For each mime type, list the additional options that should be used.
|
||||
|
|
||||
*/
|
||||
public $formatterOptions = [
|
||||
'application/json' => JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES,
|
||||
'application/xml' => 0,
|
||||
'text/xml' => 0,
|
||||
];
|
||||
//--------------------------------------------------------------------
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Formatters
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Lists the class to use to format responses with of a particular type.
|
||||
* For each mime type, list the class that should be used. Formatters
|
||||
* can be retrieved through the getFormatter() method.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public array $formatters = [
|
||||
'application/json' => JSONFormatter::class,
|
||||
'application/xml' => XMLFormatter::class,
|
||||
'text/xml' => XMLFormatter::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* A Factory method to return the appropriate formatter for the given mime type.
|
||||
*
|
||||
* @param string $mime
|
||||
*
|
||||
* @return \CodeIgniter\Format\FormatterInterface
|
||||
*/
|
||||
public function getFormatter(string $mime)
|
||||
{
|
||||
if (! array_key_exists($mime, $this->formatters))
|
||||
{
|
||||
throw new \InvalidArgumentException('No Formatter defined for mime type: ' . $mime);
|
||||
}
|
||||
|
||||
$class = $this->formatters[$mime];
|
||||
|
||||
if (! class_exists($class))
|
||||
{
|
||||
throw new \BadMethodCallException($class . ' is not a valid Formatter.');
|
||||
}
|
||||
|
||||
return new $class();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Formatters Options
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Additional Options to adjust default formatters behaviour.
|
||||
* For each mime type, list the additional options that should be used.
|
||||
*
|
||||
* @var array<string, int>
|
||||
*/
|
||||
public array $formatterOptions = [
|
||||
'application/json' => JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES,
|
||||
'application/xml' => 0,
|
||||
'text/xml' => 0,
|
||||
];
|
||||
|
||||
/**
|
||||
* A Factory method to return the appropriate formatter for the given mime type.
|
||||
*
|
||||
* @return FormatterInterface
|
||||
*
|
||||
* @deprecated This is an alias of `\CodeIgniter\Format\Format::getFormatter`. Use that instead.
|
||||
*/
|
||||
public function getFormatter(string $mime)
|
||||
{
|
||||
return Services::format()->getFormatter($mime);
|
||||
}
|
||||
}
|
||||
|
||||
42
app/Config/Generators.php
Normal file
42
app/Config/Generators.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
||||
class Generators extends BaseConfig
|
||||
{
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Generator Commands' Views
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* This array defines the mapping of generator commands to the view files
|
||||
* they are using. If you need to customize them for your own, copy these
|
||||
* view files in your own folder and indicate the location here.
|
||||
*
|
||||
* You will notice that the views have special placeholders enclosed in
|
||||
* curly braces `{...}`. These placeholders are used internally by the
|
||||
* generator commands in processing replacements, thus you are warned
|
||||
* not to delete them or modify the names. If you will do so, you may
|
||||
* end up disrupting the scaffolding process and throw errors.
|
||||
*
|
||||
* YOU HAVE BEEN WARNED!
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public array $views = [
|
||||
'make:cell' => 'CodeIgniter\Commands\Generators\Views\cell.tpl.php',
|
||||
'make:cell_view' => 'CodeIgniter\Commands\Generators\Views\cell_view.tpl.php',
|
||||
'make:command' => 'CodeIgniter\Commands\Generators\Views\command.tpl.php',
|
||||
'make:config' => 'CodeIgniter\Commands\Generators\Views\config.tpl.php',
|
||||
'make:controller' => 'CodeIgniter\Commands\Generators\Views\controller.tpl.php',
|
||||
'make:entity' => 'CodeIgniter\Commands\Generators\Views\entity.tpl.php',
|
||||
'make:filter' => 'CodeIgniter\Commands\Generators\Views\filter.tpl.php',
|
||||
'make:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
|
||||
'make:model' => 'CodeIgniter\Commands\Generators\Views\model.tpl.php',
|
||||
'make:seeder' => 'CodeIgniter\Commands\Generators\Views\seeder.tpl.php',
|
||||
'make:validation' => 'CodeIgniter\Commands\Generators\Views\validation.tpl.php',
|
||||
'session:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
|
||||
];
|
||||
}
|
||||
@ -1,42 +1,42 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
||||
class Honeypot extends BaseConfig
|
||||
{
|
||||
/**
|
||||
* Makes Honeypot visible or not to human
|
||||
*/
|
||||
public bool $hidden = true;
|
||||
|
||||
/**
|
||||
* Makes Honeypot visible or not to human
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $hidden = true;
|
||||
/**
|
||||
* Honeypot Label Content
|
||||
*/
|
||||
public string $label = 'Fill This Field';
|
||||
|
||||
/**
|
||||
* Honeypot Label Content
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $label = 'Fill This Field';
|
||||
/**
|
||||
* Honeypot Field Name
|
||||
*/
|
||||
public string $name = 'honeypot';
|
||||
|
||||
/**
|
||||
* Honeypot Field Name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $name = 'honeypot';
|
||||
/**
|
||||
* Honeypot HTML Template
|
||||
*/
|
||||
public string $template = '<label>{label}</label><input type="text" name="{name}" value="">';
|
||||
|
||||
/**
|
||||
* Honeypot HTML Template
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $template = '<label>{label}</label><input type="text" name="{name}" value=""/>';
|
||||
/**
|
||||
* Honeypot container
|
||||
*
|
||||
* If you enabled CSP, you can remove `style="display:none"`.
|
||||
*/
|
||||
public string $container = '<div style="display:none">{template}</div>';
|
||||
|
||||
/**
|
||||
* Honeypot container
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $container = '<div style="display:none">{template}</div>';
|
||||
/**
|
||||
* The id attribute for Honeypot container tag
|
||||
*
|
||||
* Used when CSP is enabled.
|
||||
*/
|
||||
public string $containerId = 'hpc';
|
||||
}
|
||||
|
||||
@ -1,31 +1,31 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
use CodeIgniter\Images\Handlers\GDHandler;
|
||||
use CodeIgniter\Images\Handlers\ImageMagickHandler;
|
||||
|
||||
class Images extends BaseConfig
|
||||
{
|
||||
/**
|
||||
* Default handler used if no other handler is specified.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $defaultHandler = 'gd';
|
||||
/**
|
||||
* Default handler used if no other handler is specified.
|
||||
*/
|
||||
public string $defaultHandler = 'gd';
|
||||
|
||||
/**
|
||||
* The path to the image library.
|
||||
* Required for ImageMagick, GraphicsMagick, or NetPBM.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $libraryPath = '/usr/local/bin/convert';
|
||||
/**
|
||||
* The path to the image library.
|
||||
* Required for ImageMagick, GraphicsMagick, or NetPBM.
|
||||
*/
|
||||
public string $libraryPath = '/usr/local/bin/convert';
|
||||
|
||||
/**
|
||||
* The available handler classes.
|
||||
*
|
||||
* @var \CodeIgniter\Images\Handlers\BaseHandler[]
|
||||
*/
|
||||
public $handlers = [
|
||||
'gd' => \CodeIgniter\Images\Handlers\GDHandler::class,
|
||||
'imagick' => \CodeIgniter\Images\Handlers\ImageMagickHandler::class,
|
||||
];
|
||||
/**
|
||||
* The available handler classes.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public array $handlers = [
|
||||
'gd' => GDHandler::class,
|
||||
'imagick' => ImageMagickHandler::class,
|
||||
];
|
||||
}
|
||||
|
||||
@ -1,62 +1,69 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
use Kint\Renderer\Renderer;
|
||||
use Kint\Parser\ConstructablePluginInterface;
|
||||
use Kint\Renderer\AbstractRenderer;
|
||||
use Kint\Renderer\Rich\TabPluginInterface;
|
||||
use Kint\Renderer\Rich\ValuePluginInterface;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Kint
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* We use Kint's `RichRenderer` and `CLIRenderer`. This area contains options
|
||||
* that you can set to customize how Kint works for you.
|
||||
*
|
||||
* @see https://kint-php.github.io/kint/ for details on these settings.
|
||||
*/
|
||||
class Kint extends BaseConfig
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Kint
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| We use Kint's RichRenderer and CLIRenderer. This area contains options
|
||||
| that you can set to customize how Kint works for you.
|
||||
|
|
||||
| For details on these settings, see Kint's docs:
|
||||
| https://kint-php.github.io/kint/
|
||||
|
|
||||
*/
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global Settings
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global Settings
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* @var array<int, ConstructablePluginInterface|string>
|
||||
* @phpstan-var list<class-string<ConstructablePluginInterface>|ConstructablePluginInterface>
|
||||
*/
|
||||
public $plugins;
|
||||
|
||||
public $plugins = null;
|
||||
public int $maxDepth = 6;
|
||||
public bool $displayCalledFrom = true;
|
||||
public bool $expanded = false;
|
||||
|
||||
public $maxDepth = 6;
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| RichRenderer Settings
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public string $richTheme = 'aante-light.css';
|
||||
public bool $richFolder = false;
|
||||
public int $richSort = AbstractRenderer::SORT_FULL;
|
||||
|
||||
public $displayCalledFrom = true;
|
||||
/**
|
||||
* @var array<string, string>
|
||||
* @phpstan-var array<string, class-string<ValuePluginInterface>>
|
||||
*/
|
||||
public $richObjectPlugins;
|
||||
|
||||
public $expanded = false;
|
||||
/**
|
||||
* @var array<string, string>
|
||||
* @phpstan-var array<string, class-string<TabPluginInterface>>
|
||||
*/
|
||||
public $richTabPlugins;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| RichRenderer Settings
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public $richTheme = 'aante-light.css';
|
||||
|
||||
public $richFolder = false;
|
||||
|
||||
public $richSort = Renderer::SORT_FULL;
|
||||
|
||||
public $richObjectPlugins = null;
|
||||
|
||||
public $richTabPlugins = null;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| CLI Settings
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public $cliColors = true;
|
||||
|
||||
public $cliForceUTF8 = false;
|
||||
|
||||
public $cliDetectWidth = true;
|
||||
|
||||
public $cliMinWidth = 40;
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| CLI Settings
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public bool $cliColors = true;
|
||||
public bool $cliForceUTF8 = false;
|
||||
public bool $cliDetectWidth = true;
|
||||
public int $cliMinWidth = 40;
|
||||
}
|
||||
|
||||
@ -1,132 +1,148 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
use CodeIgniter\Log\Handlers\FileHandler;
|
||||
|
||||
class Logger extends BaseConfig
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Error Logging Threshold
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You can enable error logging by setting a threshold over zero. The
|
||||
| threshold determines what gets logged. Any values below or equal to the
|
||||
| threshold will be logged. Threshold options are:
|
||||
|
|
||||
| 0 = Disables logging, Error logging TURNED OFF
|
||||
| 1 = Emergency Messages - System is unusable
|
||||
| 2 = Alert Messages - Action Must Be Taken Immediately
|
||||
| 3 = Critical Messages - Application component unavailable, unexpected exception.
|
||||
| 4 = Runtime Errors - Don't need immediate action, but should be monitored.
|
||||
| 5 = Warnings - Exceptional occurrences that are not errors.
|
||||
| 6 = Notices - Normal but significant events.
|
||||
| 7 = Info - Interesting events, like user logging in, etc.
|
||||
| 8 = Debug - Detailed debug information.
|
||||
| 9 = All Messages
|
||||
|
|
||||
| You can also pass an array with threshold levels to show individual error types
|
||||
|
|
||||
| array(1, 2, 3, 8) = Emergency, Alert, Critical, and Debug messages
|
||||
|
|
||||
| For a live site you'll usually enable Critical or higher (3) to be logged otherwise
|
||||
| your log files will fill up very fast.
|
||||
|
|
||||
*/
|
||||
public $threshold = 3;
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Error Logging Threshold
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* You can enable error logging by setting a threshold over zero. The
|
||||
* threshold determines what gets logged. Any values below or equal to the
|
||||
* threshold will be logged.
|
||||
*
|
||||
* Threshold options are:
|
||||
*
|
||||
* - 0 = Disables logging, Error logging TURNED OFF
|
||||
* - 1 = Emergency Messages - System is unusable
|
||||
* - 2 = Alert Messages - Action Must Be Taken Immediately
|
||||
* - 3 = Critical Messages - Application component unavailable, unexpected exception.
|
||||
* - 4 = Runtime Errors - Don't need immediate action, but should be monitored.
|
||||
* - 5 = Warnings - Exceptional occurrences that are not errors.
|
||||
* - 6 = Notices - Normal but significant events.
|
||||
* - 7 = Info - Interesting events, like user logging in, etc.
|
||||
* - 8 = Debug - Detailed debug information.
|
||||
* - 9 = All Messages
|
||||
*
|
||||
* You can also pass an array with threshold levels to show individual error types
|
||||
*
|
||||
* array(1, 2, 3, 8) = Emergency, Alert, Critical, and Debug messages
|
||||
*
|
||||
* For a live site you'll usually enable Critical or higher (3) to be logged otherwise
|
||||
* your log files will fill up very fast.
|
||||
*
|
||||
* @var array|int
|
||||
*/
|
||||
public $threshold = (ENVIRONMENT === 'production') ? 4 : 9;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Date Format for Logs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Each item that is logged has an associated date. You can use PHP date
|
||||
| codes to set your own date formatting
|
||||
|
|
||||
*/
|
||||
public $dateFormat = 'Y-m-d H:i:s';
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Date Format for Logs
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Each item that is logged has an associated date. You can use PHP date
|
||||
* codes to set your own date formatting
|
||||
*/
|
||||
public string $dateFormat = 'Y-m-d H:i:s';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Handlers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The logging system supports multiple actions to be taken when something
|
||||
| is logged. This is done by allowing for multiple Handlers, special classes
|
||||
| designed to write the log to their chosen destinations, whether that is
|
||||
| a file on the getServer, a cloud-based service, or even taking actions such
|
||||
| as emailing the dev team.
|
||||
|
|
||||
| Each handler is defined by the class name used for that handler, and it
|
||||
| MUST implement the CodeIgniter\Log\Handlers\HandlerInterface interface.
|
||||
|
|
||||
| The value of each key is an array of configuration items that are sent
|
||||
| to the constructor of each handler. The only required configuration item
|
||||
| is the 'handles' element, which must be an array of integer log levels.
|
||||
| This is most easily handled by using the constants defined in the
|
||||
| Psr\Log\LogLevel class.
|
||||
|
|
||||
| Handlers are executed in the order defined in this array, starting with
|
||||
| the handler on top and continuing down.
|
||||
|
|
||||
*/
|
||||
public $handlers = [
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Log Handlers
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The logging system supports multiple actions to be taken when something
|
||||
* is logged. This is done by allowing for multiple Handlers, special classes
|
||||
* designed to write the log to their chosen destinations, whether that is
|
||||
* a file on the getServer, a cloud-based service, or even taking actions such
|
||||
* as emailing the dev team.
|
||||
*
|
||||
* Each handler is defined by the class name used for that handler, and it
|
||||
* MUST implement the `CodeIgniter\Log\Handlers\HandlerInterface` interface.
|
||||
*
|
||||
* The value of each key is an array of configuration items that are sent
|
||||
* to the constructor of each handler. The only required configuration item
|
||||
* is the 'handles' element, which must be an array of integer log levels.
|
||||
* This is most easily handled by using the constants defined in the
|
||||
* `Psr\Log\LogLevel` class.
|
||||
*
|
||||
* Handlers are executed in the order defined in this array, starting with
|
||||
* the handler on top and continuing down.
|
||||
*/
|
||||
public array $handlers = [
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* File Handler
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
FileHandler::class => [
|
||||
// The log levels that this handler will handle.
|
||||
'handles' => [
|
||||
'critical',
|
||||
'alert',
|
||||
'emergency',
|
||||
'debug',
|
||||
'error',
|
||||
'info',
|
||||
'notice',
|
||||
'warning',
|
||||
],
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// File Handler
|
||||
//--------------------------------------------------------------------
|
||||
/*
|
||||
* The default filename extension for log files.
|
||||
* An extension of 'php' allows for protecting the log files via basic
|
||||
* scripting, when they are to be stored under a publicly accessible directory.
|
||||
*
|
||||
* NOTE: Leaving it blank will default to 'log'.
|
||||
*/
|
||||
'fileExtension' => '',
|
||||
|
||||
'CodeIgniter\Log\Handlers\FileHandler' => [
|
||||
/*
|
||||
* The file system permissions to be applied on newly created log files.
|
||||
*
|
||||
* IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
|
||||
* integer notation (i.e. 0700, 0644, etc.)
|
||||
*/
|
||||
'filePermissions' => 0644,
|
||||
|
||||
/*
|
||||
* The log levels that this handler will handle.
|
||||
*/
|
||||
'handles' => [
|
||||
'critical',
|
||||
'alert',
|
||||
'emergency',
|
||||
'debug',
|
||||
'error',
|
||||
'info',
|
||||
'notice',
|
||||
'warning',
|
||||
],
|
||||
/*
|
||||
* Logging Directory Path
|
||||
*
|
||||
* By default, logs are written to WRITEPATH . 'logs/'
|
||||
* Specify a different destination here, if desired.
|
||||
*/
|
||||
'path' => WRITEPATH . 'logs/',
|
||||
],
|
||||
|
||||
/*
|
||||
* The default filename extension for log files.
|
||||
* An extension of 'php' allows for protecting the log files via basic
|
||||
* scripting, when they are to be stored under a publicly accessible directory.
|
||||
*
|
||||
* Note: Leaving it blank will default to 'log'.
|
||||
*/
|
||||
'fileExtension' => '',
|
||||
/*
|
||||
* The ChromeLoggerHandler requires the use of the Chrome web browser
|
||||
* and the ChromeLogger extension. Uncomment this block to use it.
|
||||
*/
|
||||
// 'CodeIgniter\Log\Handlers\ChromeLoggerHandler' => [
|
||||
// /*
|
||||
// * The log levels that this handler will handle.
|
||||
// */
|
||||
// 'handles' => ['critical', 'alert', 'emergency', 'debug',
|
||||
// 'error', 'info', 'notice', 'warning'],
|
||||
// ],
|
||||
|
||||
/*
|
||||
* The file system permissions to be applied on newly created log files.
|
||||
*
|
||||
* IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
|
||||
* integer notation (i.e. 0700, 0644, etc.)
|
||||
*/
|
||||
'filePermissions' => 0644,
|
||||
|
||||
/*
|
||||
* Logging Directory Path
|
||||
*
|
||||
* By default, logs are written to WRITEPATH . 'logs/'
|
||||
* Specify a different destination here, if desired.
|
||||
*/
|
||||
'path' => '',
|
||||
],
|
||||
|
||||
/**
|
||||
* The ChromeLoggerHandler requires the use of the Chrome web browser
|
||||
* and the ChromeLogger extension. Uncomment this block to use it.
|
||||
*/
|
||||
// 'CodeIgniter\Log\Handlers\ChromeLoggerHandler' => [
|
||||
// /*
|
||||
// * The log levels that this handler will handle.
|
||||
// */
|
||||
// 'handles' => ['critical', 'alert', 'emergency', 'debug',
|
||||
// 'error', 'info', 'notice', 'warning'],
|
||||
// ]
|
||||
];
|
||||
/*
|
||||
* The ErrorlogHandler writes the logs to PHP's native `error_log()` function.
|
||||
* Uncomment this block to use it.
|
||||
*/
|
||||
// 'CodeIgniter\Log\Handlers\ErrorlogHandler' => [
|
||||
// /* The log levels this handler can handle. */
|
||||
// 'handles' => ['critical', 'alert', 'emergency', 'debug', 'error', 'info', 'notice', 'warning'],
|
||||
//
|
||||
// /*
|
||||
// * The message type where the error should go. Can be 0 or 4, or use the
|
||||
// * class constants: `ErrorlogHandler::TYPE_OS` (0) or `ErrorlogHandler::TYPE_SAPI` (4)
|
||||
// */
|
||||
// 'messageType' => 0,
|
||||
// ],
|
||||
];
|
||||
}
|
||||
|
||||
@ -1,50 +1,52 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
||||
class Migrations extends BaseConfig
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable/Disable Migrations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Migrations are enabled by default for security reasons.
|
||||
| You should enable migrations whenever you intend to do a schema migration
|
||||
| and disable it back when you're done.
|
||||
|
|
||||
*/
|
||||
public $enabled = true;
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Enable/Disable Migrations
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Migrations are enabled by default.
|
||||
*
|
||||
* You should enable migrations whenever you intend to do a schema migration
|
||||
* and disable it back when you're done.
|
||||
*/
|
||||
public bool $enabled = true;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migrations table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the name of the table that will store the current migrations state.
|
||||
| When migrations runs it will store in a database table which migration
|
||||
| level the system is at. It then compares the migration level in this
|
||||
| table to the $config['migration_version'] if they are not the same it
|
||||
| will migrate up. This must be set.
|
||||
|
|
||||
*/
|
||||
public $table = 'migrations';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Timestamp Format
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the format that will be used when creating new migrations
|
||||
| using the cli command:
|
||||
| > php spark migrate:create
|
||||
|
|
||||
| Typical formats:
|
||||
| YmdHis_
|
||||
| Y-m-d-His_
|
||||
| Y_m_d_His_
|
||||
|
|
||||
*/
|
||||
public $timestampFormat = 'Y-m-d-His_';
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Migrations Table
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* This is the name of the table that will store the current migrations state.
|
||||
* When migrations runs it will store in a database table which migration
|
||||
* level the system is at. It then compares the migration level in this
|
||||
* table to the $config['migration_version'] if they are not the same it
|
||||
* will migrate up. This must be set.
|
||||
*/
|
||||
public string $table = 'migrations';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Timestamp Format
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* This is the format that will be used when creating new migrations
|
||||
* using the CLI command:
|
||||
* > php spark make:migration
|
||||
*
|
||||
* NOTE: if you set an unsupported format, migration runner will not find
|
||||
* your migration files.
|
||||
*
|
||||
* Supported formats:
|
||||
* - YmdHis_
|
||||
* - Y-m-d-His_
|
||||
* - Y_m_d_His_
|
||||
*/
|
||||
public string $timestampFormat = 'Y-m-d-His_';
|
||||
}
|
||||
|
||||
1038
app/Config/Mimes.php
1038
app/Config/Mimes.php
File diff suppressed because it is too large
Load Diff
@ -2,44 +2,81 @@
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Modules\Modules as CoreModules;
|
||||
use CodeIgniter\Modules\Modules as BaseModules;
|
||||
|
||||
class Modules extends CoreModules
|
||||
/**
|
||||
* Modules Configuration.
|
||||
*
|
||||
* NOTE: This class is required prior to Autoloader instantiation,
|
||||
* and does not extend BaseConfig.
|
||||
*/
|
||||
class Modules extends BaseModules
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Auto-Discovery Enabled?
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If true, then auto-discovery will happen across all elements listed in
|
||||
| $activeExplorers below. If false, no auto-discovery will happen at all,
|
||||
| giving a slight performance boost.
|
||||
*/
|
||||
public $enabled = true;
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Enable Auto-Discovery?
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* If true, then auto-discovery will happen across all elements listed in
|
||||
* $aliases below. If false, no auto-discovery will happen at all,
|
||||
* giving a slight performance boost.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $enabled = true;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Auto-Discovery Within Composer Packages Enabled?
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If true, then auto-discovery will happen across all namespaces loaded
|
||||
| by Composer, as well as the namespaces configured locally.
|
||||
*/
|
||||
public $discoverInComposer = true;
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Enable Auto-Discovery Within Composer Packages?
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* If true, then auto-discovery will happen across all namespaces loaded
|
||||
* by Composer, as well as the namespaces configured locally.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $discoverInComposer = true;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Auto-discover Rules
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Aliases list of all discovery classes that will be active and used during
|
||||
| the current application request.
|
||||
| If it is not listed, only the base application elements will be used.
|
||||
*/
|
||||
public $aliases = [
|
||||
'events',
|
||||
'registrars',
|
||||
'routes',
|
||||
'services',
|
||||
];
|
||||
/**
|
||||
* The Composer package list for Auto-Discovery
|
||||
* This setting is optional.
|
||||
*
|
||||
* E.g.:
|
||||
* [
|
||||
* 'only' => [
|
||||
* // List up all packages to auto-discover
|
||||
* 'codeigniter4/shield',
|
||||
* ],
|
||||
* ]
|
||||
* or
|
||||
* [
|
||||
* 'exclude' => [
|
||||
* // List up packages to exclude.
|
||||
* 'pestphp/pest',
|
||||
* ],
|
||||
* ]
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $composerPackages = [];
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Auto-Discovery Rules
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Aliases list of all discovery classes that will be active and used during
|
||||
* the current application request.
|
||||
*
|
||||
* If it is not listed, only the base application elements will be used.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public $aliases = [
|
||||
'events',
|
||||
'filters',
|
||||
'registrars',
|
||||
'routes',
|
||||
'services',
|
||||
];
|
||||
}
|
||||
|
||||
@ -1,35 +1,37 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
||||
class Pager extends BaseConfig
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Templates
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Pagination links are rendered out using views to configure their
|
||||
| appearance. This array contains aliases and the view names to
|
||||
| use when rendering the links.
|
||||
|
|
||||
| Within each view, the Pager object will be available as $pager,
|
||||
| and the desired group as $pagerGroup;
|
||||
|
|
||||
*/
|
||||
public $templates = [
|
||||
'default_full' => 'CodeIgniter\Pager\Views\default_full',
|
||||
'default_simple' => 'CodeIgniter\Pager\Views\default_simple',
|
||||
'default_head' => 'CodeIgniter\Pager\Views\default_head',
|
||||
];
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Templates
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Pagination links are rendered out using views to configure their
|
||||
* appearance. This array contains aliases and the view names to
|
||||
* use when rendering the links.
|
||||
*
|
||||
* Within each view, the Pager object will be available as $pager,
|
||||
* and the desired group as $pagerGroup;
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public array $templates = [
|
||||
'default_full' => 'CodeIgniter\Pager\Views\default_full',
|
||||
'default_simple' => 'CodeIgniter\Pager\Views\default_simple',
|
||||
'default_head' => 'CodeIgniter\Pager\Views\default_head',
|
||||
];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Items Per Page
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The default number of results shown in a single page.
|
||||
|
|
||||
*/
|
||||
public $perPage = 20;
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Items Per Page
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The default number of results shown in a single page.
|
||||
*/
|
||||
public int $perPage = 20;
|
||||
}
|
||||
|
||||
@ -1,77 +1,80 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
/**
|
||||
* Paths
|
||||
*
|
||||
* Holds the paths that are used by the system to
|
||||
* locate the main directories, app, system, etc.
|
||||
* Modifying these allows you to re-structure your application,
|
||||
*
|
||||
* Modifying these allows you to restructure your application,
|
||||
* share a system folder between multiple applications, and more.
|
||||
*
|
||||
* All paths are relative to the project's root folder.
|
||||
*
|
||||
* NOTE: This class is required prior to Autoloader instantiation,
|
||||
* and does not extend BaseConfig.
|
||||
*
|
||||
* @immutable
|
||||
*/
|
||||
|
||||
class Paths
|
||||
{
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* SYSTEM FOLDER NAME
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* This variable must contain the name of your "system" folder.
|
||||
* Include the path if the folder is not in the same directory
|
||||
* as this file.
|
||||
*/
|
||||
public $systemDirectory = __DIR__ . '/../../vendor/codeigniter4/framework/system';
|
||||
/**
|
||||
* ---------------------------------------------------------------
|
||||
* SYSTEM FOLDER NAME
|
||||
* ---------------------------------------------------------------
|
||||
*
|
||||
* This must contain the name of your "system" folder. Include
|
||||
* the path if the folder is not in the same directory as this file.
|
||||
*/
|
||||
public string $systemDirectory = __DIR__ . '/../../system';
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* APPLICATION FOLDER NAME
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* If you want this front controller to use a different "app"
|
||||
* folder than the default one you can set its name here. The folder
|
||||
* can also be renamed or relocated anywhere on your getServer. If
|
||||
* you do, use a full getServer path. For more info please see the user guide:
|
||||
* http://codeigniter.com/user_guide/general/managing_apps.html
|
||||
*
|
||||
* NO TRAILING SLASH!
|
||||
*/
|
||||
public $appDirectory = __DIR__ . '/..';
|
||||
/**
|
||||
* ---------------------------------------------------------------
|
||||
* APPLICATION FOLDER NAME
|
||||
* ---------------------------------------------------------------
|
||||
*
|
||||
* If you want this front controller to use a different "app"
|
||||
* folder than the default one you can set its name here. The folder
|
||||
* can also be renamed or relocated anywhere on your server. If
|
||||
* you do, use a full server path.
|
||||
*
|
||||
* @see http://codeigniter.com/user_guide/general/managing_apps.html
|
||||
*/
|
||||
public string $appDirectory = __DIR__ . '/..';
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------
|
||||
* WRITABLE DIRECTORY NAME
|
||||
* ---------------------------------------------------------------
|
||||
*
|
||||
* This variable must contain the name of your "writable" directory.
|
||||
* The writable directory allows you to group all directories that
|
||||
* need write permission to a single place that can be tucked away
|
||||
* for maximum security, keeping it out of the app and/or
|
||||
* system directories.
|
||||
*/
|
||||
public $writableDirectory = __DIR__ . '/../../writable';
|
||||
/**
|
||||
* ---------------------------------------------------------------
|
||||
* WRITABLE DIRECTORY NAME
|
||||
* ---------------------------------------------------------------
|
||||
*
|
||||
* This variable must contain the name of your "writable" directory.
|
||||
* The writable directory allows you to group all directories that
|
||||
* need write permission to a single place that can be tucked away
|
||||
* for maximum security, keeping it out of the app and/or
|
||||
* system directories.
|
||||
*/
|
||||
public string $writableDirectory = __DIR__ . '/../../writable';
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------
|
||||
* TESTS DIRECTORY NAME
|
||||
* ---------------------------------------------------------------
|
||||
*
|
||||
* This variable must contain the name of your "tests" directory.
|
||||
* The writable directory allows you to group all directories that
|
||||
* need write permission to a single place that can be tucked away
|
||||
* for maximum security, keeping it out of the app and/or
|
||||
* system directories.
|
||||
*/
|
||||
public $testsDirectory = __DIR__ . '/../../tests';
|
||||
/**
|
||||
* ---------------------------------------------------------------
|
||||
* TESTS DIRECTORY NAME
|
||||
* ---------------------------------------------------------------
|
||||
*
|
||||
* This variable must contain the name of your "tests" directory.
|
||||
*/
|
||||
public string $testsDirectory = __DIR__ . '/../../tests';
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------
|
||||
* VIEW DIRECTORY NAME
|
||||
* ---------------------------------------------------------------
|
||||
*
|
||||
* This variable must contain the name of the directory that
|
||||
* contains the view files used by your application. By
|
||||
* default this is in `app/Views`. This value
|
||||
* is used when no value is provided to `Services::renderer()`.
|
||||
*/
|
||||
public $viewDirectory = __DIR__ . '/../Views';
|
||||
/**
|
||||
* ---------------------------------------------------------------
|
||||
* VIEW DIRECTORY NAME
|
||||
* ---------------------------------------------------------------
|
||||
*
|
||||
* This variable must contain the name of the directory that
|
||||
* contains the view files used by your application. By
|
||||
* default this is in `app/Views`. This value
|
||||
* is used when no value is provided to `Services::renderer()`.
|
||||
*/
|
||||
public string $viewDirectory = __DIR__ . '/../Views';
|
||||
}
|
||||
|
||||
28
app/Config/Publisher.php
Normal file
28
app/Config/Publisher.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\Publisher as BasePublisher;
|
||||
|
||||
/**
|
||||
* Publisher Configuration
|
||||
*
|
||||
* Defines basic security restrictions for the Publisher class
|
||||
* to prevent abuse by injecting malicious files into a project.
|
||||
*/
|
||||
class Publisher extends BasePublisher
|
||||
{
|
||||
/**
|
||||
* A list of allowed destinations with a (pseudo-)regex
|
||||
* of allowed files for each destination.
|
||||
* Attempts to publish to directories not in this list will
|
||||
* result in a PublisherException. Files that do no fit the
|
||||
* pattern will cause copy/merge to fail.
|
||||
*
|
||||
* @var array<string,string>
|
||||
*/
|
||||
public $restrictions = [
|
||||
ROOTPATH => '*',
|
||||
FCPATH => '#\.(s?css|js|map|html?|xml|json|webmanifest|ttf|eot|woff2?|gif|jpe?g|tiff?|png|webp|bmp|ico|svg)$#i',
|
||||
];
|
||||
}
|
||||
@ -1,28 +1,27 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
// Create a new instance of our RouteCollection class.
|
||||
$routes = Services::routes();
|
||||
|
||||
// Load the system's routing file first, so that the app and ENVIRONMENT
|
||||
// can override as needed.
|
||||
if (file_exists(SYSTEMPATH . 'Config/Routes.php'))
|
||||
{
|
||||
require SYSTEMPATH . 'Config/Routes.php';
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* Router Setup
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
$routes->setDefaultNamespace('App\Controllers');
|
||||
$routes->setDefaultController('Donor_controller');
|
||||
$routes->setDefaultController('Authentication');
|
||||
$routes->setDefaultMethod('index');
|
||||
$routes->setTranslateURIDashes(false);
|
||||
$routes->set404Override();
|
||||
$routes->setAutoRoute(true);
|
||||
// The Auto Routing (Legacy) is very dangerous. It is easy to create vulnerable apps
|
||||
// where controller filters or CSRF protection are bypassed.
|
||||
// If you don't want to define all routes, please use the Auto Routing (Improved).
|
||||
// Set `$autoRoutesImproved` to true in `app/Config/Feature.php` and set the following to true.
|
||||
// $routes->setAutoRoute(false);
|
||||
|
||||
/**
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* Route Definitions
|
||||
* --------------------------------------------------------------------
|
||||
@ -30,65 +29,112 @@ $routes->setAutoRoute(true);
|
||||
|
||||
// We get a performance increase by specifying the default
|
||||
// route since we don't have to scan directories.
|
||||
// In your routes file (e.g., app/Config/Routes.php)
|
||||
|
||||
$routes->get('/', 'Donor_controller::index');
|
||||
$routes->match(['get','post'],'donor_register','My_controller::donor_register');
|
||||
$routes->match(['get','post'],'all_donor','My_controller::all_donor');
|
||||
$routes->match(['get','post'],'receipts','Dashboard::receipts');
|
||||
$routes->match(['get','post'],'all_receipt','Dashboard::all_receipt');
|
||||
$routes->match(['get','post'],'all_transaction','Dashboard::all_transaction');
|
||||
$routes->match(['get','post'],'transaction','Dashboard::transaction');
|
||||
$routes->match(['get','post'],'donation_data','Dashboard::donation_data');
|
||||
$routes->match(['get','post'],'all_donation_data','Dashboard::all_donation_data');
|
||||
$routes->match(['get','post'],'donation_cause','Dashboard::donation_cause');
|
||||
$routes->match(['get','post'],'all_donation_cause','Dashboard::all_donation_cause');
|
||||
# Authentication Routes
|
||||
$routes->get('/', 'Authentication::index');
|
||||
$routes->get('login/', 'Authentication::index');
|
||||
$routes->post('authenticate/', 'Authentication::authenticate');//Routes For Authentication.
|
||||
$routes->get('logout/', 'Authentication::logout');
|
||||
$routes->post('auth_confirm_mail/', 'Authentication::auth_confirm_mail');//Routes For Confirmation Mail alert page.
|
||||
$routes->get('auth_reset_password/', 'Authentication::auth_reset_password');//Routes For Load Reset password Page.
|
||||
$routes->post('auth_reset_password_save/', 'Authentication::auth_reset_password_save');//Routes For update the Resetted password.
|
||||
$routes->get('lockscreen/', 'Authentication::lockscreen');
|
||||
$routes->get('lock/', 'Authentication::lock');
|
||||
$routes->post('unlock/', 'Authentication::unlock');
|
||||
$routes->post('confirm_password/', 'Authentication::confirm_password');
|
||||
$routes->post('change_password', 'Authentication::change_password');
|
||||
|
||||
$routes->get('Send_mail/(:num)', 'Sendmail::Mail_to_donor/$1');
|
||||
# Dashboard Routes
|
||||
$routes->get('dashboard/', 'Home::index');
|
||||
$routes->post("check_existing/", "Home::check_existing/");
|
||||
|
||||
//$routes->add('edit_donor/(:num)', 'App\Catalog::productLookup');
|
||||
//$routes->match(['get'],'edit_donor/(:any)', 'My_controller::edit_donor');
|
||||
$routes->get('edit_donor/(:num)', 'My_controller::edit_donor/$1');
|
||||
$routes->get('edit_receipt/(:num)', 'Dashboard::edit_receipt/$1');
|
||||
$routes->get('view_receipt/(:num)', 'Dashboard::view_receipt/$1');
|
||||
$routes->match(['get','post'],'edit_transaction/(:num)', 'Dashboard::edit_transaction/$1');
|
||||
$routes->match(['get','post'],'edit_donation_data/(:num)', 'Dashboard::edit_donation_data/$1');
|
||||
$routes->match(['get','post'],'edit_donation_cause/(:num)', 'Dashboard::edit_donation_cause/$1');
|
||||
# Users Routes
|
||||
$routes->get("user_list/", "Users::index");
|
||||
$routes->get("user_page/(:any)/(:any)", "Users::user_page/$1/$2");
|
||||
$routes->post("insert_users", "Users::insert_users");
|
||||
$routes->get("delete_user/(:any)", "Users::delete_user/$1");
|
||||
$routes->get("activate_user/(:any)", "Users::activate_user/$1");
|
||||
$routes->get('users/get_branches/(:num)', 'Users::get_branches/$1');
|
||||
|
||||
$routes->match(['get','post'],'signup','Donor_controller::register');
|
||||
$routes->match(['get','post'],'login','Donor_controller::login');
|
||||
$routes->match(['get'],'fetch_country','Donor_controller::fetch_country');
|
||||
$routes->match(['get','post'],'fetch_state','Donor_controller::fetch_state');
|
||||
$routes->match(['get','post'],'fetch_city','Donor_controller::fetch_city');
|
||||
$routes->match(['get'],'profile','Donor_controller::profile');
|
||||
# Causes Routes
|
||||
$routes->get("causes_list/", "Books::index");
|
||||
$routes->get("add_causes/(:any)", "Books::add_causes/$1");
|
||||
$routes->post("insert_causes", "Books::insert_causes");
|
||||
$routes->get("delete_causes/(:any)", "Books::delete_causes/$1");
|
||||
|
||||
$routes->match(['get','post'],'receipt','Dashboard::generate_receipts');
|
||||
$routes->match(['get','post'],'update_receipt','Dashboard::update_receipt');
|
||||
$routes->match(['get','post'],'transaction','Dashboard::transaction_upload');
|
||||
$routes->match(['get','post'],'donation_data','Dashboard::donation_data_upload');
|
||||
$routes->match(['get','post'],'donor_register','My_controller::donor_register');
|
||||
$routes->match(['get','post'],'update_donor','My_controller::update_donor');
|
||||
#Organization Routes (also known as business)
|
||||
$routes->get("org_list/", "Business::index");
|
||||
$routes->get("new_org/(:any)", "Business::new_org/$1");
|
||||
$routes->post("insert_org/", "Business::insert_org");
|
||||
$routes->get("delete_org/(:any)", "Business::delete_org/$1");
|
||||
$routes->get("activate_org/(:any)", "Business::activate_org/$1");
|
||||
|
||||
$routes->match(['get'],'fetch_donor_id','Dashboard::fetch_donor_id');
|
||||
$routes->match(['get'],'edit_donor_id','Dashboard::edit_donor_id');
|
||||
$routes->match(['get'],'fetch_cause_name','Dashboard::fetch_cause_name');
|
||||
$routes->match(['get','post'],'add_donation_cause','Dashboard::add_donation_cause');
|
||||
$routes->match(['get'],'htmlToPDF','PdfController::htmlToPDF');
|
||||
$routes->match(['get'],'active_cause','Dashboard::active_cause');
|
||||
$routes->match(['get'],'inactive_cause','Dashboard::inactive_cause');
|
||||
#Donor Routes (also known as contributor,customer)
|
||||
$routes->get("Contributor_list/", "Customer::index");
|
||||
$routes->get("new_Donor/(:any)", "Customer::new_Donor/$1");
|
||||
$routes->get('Customer/getReceiptDetails/(:num)', 'Customer::getReceiptDetails/$1');
|
||||
$routes->post("insert_donor", "Customer::insert_donor");
|
||||
$routes->post("insert_ajaxdonor", "Customer::insert_ajaxdonor");
|
||||
$routes->get("delete_donor/(:any)", "Customer::delete_donor/$1");
|
||||
$routes->get("export_Donor", "Customer::export_donor");
|
||||
$routes->post("import_Donor", "Customer::import_donor");
|
||||
|
||||
#Donor group Routes (renamed as contributor group : 20/03/2024)
|
||||
$routes->get('contributor_group/', 'Customer::donor_group');
|
||||
$routes->get('view_contributor_group/(:any)', 'Customer::view_donor_group/$1');
|
||||
$routes->get('preview_contributor_group/(:any)', 'Customer::preview_donor_group/$1');
|
||||
$routes->get('delete_contributor_group/(:any)', 'Customer::delete_donor_group/$1');
|
||||
$routes->post("insert_contributor_group", "Customer::insert_donor_group");
|
||||
|
||||
#Campaign Routes (also known as Event)
|
||||
$routes->get("campaign_list/", "Event::index");
|
||||
$routes->get("new_campaign/(:any)", "Event::new_campaign/$1");
|
||||
$routes->post("insert_event/", "Event::insert_event");
|
||||
|
||||
#Receipt Routes (also known as Invoice)
|
||||
$routes->get("receipt_list/", "Invoice::index");
|
||||
$routes->get("new_receipt/(:any)", "Invoice::new_receipt/$1");
|
||||
$routes->post("donor_cash_success/", "Invoice::donor_cash_success");
|
||||
$routes->post("donor_cash_delete/", "Invoice::donor_cash_delete");
|
||||
$routes->get("donations_accepted/", "Invoice::donations_accepted");
|
||||
$routes->post("save_donations_accepted/", "Invoice::save_donations_accepted");
|
||||
$routes->get("audit_history", "Invoice::audit_history");
|
||||
$routes->get('generate-pdf/(:num)', 'Invoice::generatePdf/$1');
|
||||
$routes->get('Invoice/showInvoiceModal', 'Invoice::showInvoiceModal');
|
||||
$routes->post("get_donor_details", "Invoice::get_donor_details");
|
||||
$routes->post("save_invoice/", "Invoice::save_invoice/");
|
||||
$routes->add('approve_invoice/(:num)', 'Invoice::approve_invoice/$1');
|
||||
$routes->get('generate_invoice_pdf/(:num)', 'Invoice::generate_invoice_pdf/$1');
|
||||
$routes->get("export_receipt", "Invoice::export_receipt");
|
||||
$routes->post("import_receipt", "Invoice::import_receipt");
|
||||
|
||||
#Report Routes
|
||||
$routes->match(['get','post'],'/general_inv_rp','Invoice::general_inv_rp');
|
||||
$routes->match(['get','post'],'/mem_inv_rp','Invoice::general_membership_inv_rp');
|
||||
$routes->match(['get','post'],'/itemwise_report','Invoice::itemwise_report');
|
||||
|
||||
|
||||
$routes->match(['get','post'],'donation_data_excel','PhpspreadsheetController::import_donation_data');
|
||||
$routes->match(['get','post'],'transaction_data_excel','PhpspreadsheetController::import_transaction_data');
|
||||
# Notifications Routes
|
||||
// $routes->get('controller/SubExpdetail/(:num)', 'YourController::SubExpdetail/$1');
|
||||
$routes->cli("getExpCustomerDetail/(:num)",'Notifications::getExpCustomerDetail/$1');
|
||||
$routes->get('send_whatsapp_message/', 'Notifications::send_whatsapp_message');
|
||||
$routes->post('whatsapp_custom_notifications/', 'Notifications::whatsapp_custom_notifications');
|
||||
$routes->match(['post', 'get'], 'mail_custom_notifications', 'Notifications::mail_custom_notifications');
|
||||
// $routes->match(['post', 'get'], 'due_date_notifications', 'Notifications::due_date_notifications');
|
||||
// $routes->get('due_date_notifications/(:any)', 'Notifications::due_date_notifications/$1');
|
||||
$routes->get('due_date_notifications', 'Notifications::due_date_notifications');
|
||||
$routes->get('template_creation/', 'Notifications::template_creation');
|
||||
$routes->get('template_creation_form/(:any)', 'Notifications::template_creation_form/$1');
|
||||
$routes->get('template_creation_delete/(:any)', 'Notifications::template_creation_delete/$1');
|
||||
$routes->post("template_creation_insert", "Notifications::template_creation_insert");
|
||||
$routes->get('campaign_creation/', 'Notifications::campaign_creation');
|
||||
$routes->get('campaign_creation_form/(:any)', 'Notifications::campaign_creation_form/$1');
|
||||
$routes->get('campaign_creation_delete/(:any)', 'Notifications::campaign_creation_delete/$1');
|
||||
$routes->post("campaign_creation_insert", "Notifications::campaign_creation_insert");
|
||||
|
||||
$routes->match(['get','post'],'transaction_file','PhpspreadsheetController::transaction_file');
|
||||
$routes->match(['get','post'],'donation_data_file','PhpspreadsheetController::donation_data_file');
|
||||
|
||||
$routes->add('logout','Dashboard::logout');
|
||||
// $routes->add('register','Donation::register');
|
||||
// $routes->add('list','Donation::edit_view');
|
||||
// $routes->add('store','Home::store');
|
||||
|
||||
/**
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* Additional Routing
|
||||
* --------------------------------------------------------------------
|
||||
@ -101,7 +147,6 @@ $routes->add('logout','Dashboard::logout');
|
||||
* You will have access to the $routes object within that file without
|
||||
* needing to reload it.
|
||||
*/
|
||||
if (file_exists(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php'))
|
||||
{
|
||||
require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
|
||||
if (is_file(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php')) {
|
||||
require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
|
||||
}
|
||||
|
||||
101
app/Config/Security.php
Normal file
101
app/Config/Security.php
Normal file
@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
||||
class Security extends BaseConfig
|
||||
{
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF Protection Method
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Protection Method for Cross Site Request Forgery protection.
|
||||
*
|
||||
* @var string 'cookie' or 'session'
|
||||
*/
|
||||
public string $csrfProtection = 'cookie';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF Token Randomization
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Randomize the CSRF Token for added security.
|
||||
*/
|
||||
public bool $tokenRandomize = false;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF Token Name
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Token name for Cross Site Request Forgery protection.
|
||||
*/
|
||||
public string $tokenName = 'csrf_test_name';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF Header Name
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Header name for Cross Site Request Forgery protection.
|
||||
*/
|
||||
public string $headerName = 'X-CSRF-TOKEN';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF Cookie Name
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Cookie name for Cross Site Request Forgery protection.
|
||||
*/
|
||||
public string $cookieName = 'csrf_cookie_name';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF Expires
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Expiration time for Cross Site Request Forgery protection cookie.
|
||||
*
|
||||
* Defaults to two hours (in seconds).
|
||||
*/
|
||||
public int $expires = 7200;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF Regenerate
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Regenerate CSRF Token on every submission.
|
||||
*/
|
||||
public bool $regenerate = true;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF Redirect
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Redirect to previous page with error on failure.
|
||||
*/
|
||||
public bool $redirect = false;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF SameSite
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Setting for CSRF SameSite cookie token.
|
||||
*
|
||||
* Allowed values are: None - Lax - Strict - ''.
|
||||
*
|
||||
* Defaults to `Lax` as recommended in this link:
|
||||
*
|
||||
* @see https://portswigger.net/web-security/csrf/samesite-cookies
|
||||
*
|
||||
* @deprecated `Config\Cookie` $samesite property is used.
|
||||
*/
|
||||
public string $samesite = 'Lax';
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
use CodeIgniter\Config\Services as CoreServices;
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseService;
|
||||
|
||||
/**
|
||||
* Services Configuration file.
|
||||
@ -15,16 +17,16 @@ use CodeIgniter\Config\Services as CoreServices;
|
||||
* method format you should use for your service methods. For more examples,
|
||||
* see the core Services file at system/Config/Services.php.
|
||||
*/
|
||||
class Services extends CoreServices
|
||||
class Services extends BaseService
|
||||
{
|
||||
|
||||
// public static function example($getShared = true)
|
||||
// {
|
||||
// if ($getShared)
|
||||
// {
|
||||
// return static::getSharedInstance('example');
|
||||
// }
|
||||
//
|
||||
// return new \CodeIgniter\Example();
|
||||
// }
|
||||
/*
|
||||
* public static function example($getShared = true)
|
||||
* {
|
||||
* if ($getShared) {
|
||||
* return static::getSharedInstance('example');
|
||||
* }
|
||||
*
|
||||
* return new \CodeIgniter\Example();
|
||||
* }
|
||||
*/
|
||||
}
|
||||
|
||||
102
app/Config/Session.php
Normal file
102
app/Config/Session.php
Normal file
@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
use CodeIgniter\Session\Handlers\BaseHandler;
|
||||
use CodeIgniter\Session\Handlers\FileHandler;
|
||||
|
||||
class Session extends BaseConfig
|
||||
{
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Session Driver
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The session storage driver to use:
|
||||
* - `CodeIgniter\Session\Handlers\FileHandler`
|
||||
* - `CodeIgniter\Session\Handlers\DatabaseHandler`
|
||||
* - `CodeIgniter\Session\Handlers\MemcachedHandler`
|
||||
* - `CodeIgniter\Session\Handlers\RedisHandler`
|
||||
*
|
||||
* @phpstan-var class-string<BaseHandler>
|
||||
*/
|
||||
public string $driver = FileHandler::class;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Session Cookie Name
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The session cookie name, must contain only [0-9a-z_-] characters
|
||||
*/
|
||||
public string $cookieName = 'ci_session';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Session Expiration
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The number of SECONDS you want the session to last.
|
||||
* Setting to 0 (zero) means expire when the browser is closed.
|
||||
*/
|
||||
public int $expiration = 7200;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Session Save Path
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The location to save sessions to and is driver dependent.
|
||||
*
|
||||
* For the 'files' driver, it's a path to a writable directory.
|
||||
* WARNING: Only absolute paths are supported!
|
||||
*
|
||||
* For the 'database' driver, it's a table name.
|
||||
* Please read up the manual for the format with other session drivers.
|
||||
*
|
||||
* IMPORTANT: You are REQUIRED to set a valid save path!
|
||||
*/
|
||||
public string $savePath = WRITEPATH . 'session';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Session Match IP
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Whether to match the user's IP address when reading the session data.
|
||||
*
|
||||
* WARNING: If you're using the database driver, don't forget to update
|
||||
* your session table's PRIMARY KEY when changing this setting.
|
||||
*/
|
||||
public bool $matchIP = false;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Session Time to Update
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* How many seconds between CI regenerating the session ID.
|
||||
*/
|
||||
public int $timeToUpdate = 300;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Session Regenerate Destroy
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Whether to destroy session data associated with the old session ID
|
||||
* when auto-regenerating the session ID. When set to FALSE, the data
|
||||
* will be later deleted by the garbage collector.
|
||||
*/
|
||||
public bool $regenerateDestroy = false;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Session Database Group
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* DB Group for the database session.
|
||||
*/
|
||||
public ?string $DBGroup = null;
|
||||
}
|
||||
@ -1,68 +1,91 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
use CodeIgniter\Debug\Toolbar\Collectors\Database;
|
||||
use CodeIgniter\Debug\Toolbar\Collectors\Events;
|
||||
use CodeIgniter\Debug\Toolbar\Collectors\Files;
|
||||
use CodeIgniter\Debug\Toolbar\Collectors\Logs;
|
||||
use CodeIgniter\Debug\Toolbar\Collectors\Routes;
|
||||
use CodeIgniter\Debug\Toolbar\Collectors\Timers;
|
||||
use CodeIgniter\Debug\Toolbar\Collectors\Views;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Debug Toolbar
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The Debug Toolbar provides a way to see information about the performance
|
||||
* and state of your application during that page display. By default it will
|
||||
* NOT be displayed under production environments, and will only display if
|
||||
* `CI_DEBUG` is true, since if it's not, there's not much to display anyway.
|
||||
*/
|
||||
class Toolbar extends BaseConfig
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Debug Toolbar
|
||||
|--------------------------------------------------------------------------
|
||||
| The Debug Toolbar provides a way to see information about the performance
|
||||
| and state of your application during that page display. By default it will
|
||||
| NOT be displayed under production environments, and will only display if
|
||||
| CI_DEBUG is true, since if it's not, there's not much to display anyway.
|
||||
|
|
||||
| toolbarMaxHistory = Number of history files, 0 for none or -1 for unlimited
|
||||
|
|
||||
*/
|
||||
public $collectors = [
|
||||
\CodeIgniter\Debug\Toolbar\Collectors\Timers::class,
|
||||
\CodeIgniter\Debug\Toolbar\Collectors\Database::class,
|
||||
\CodeIgniter\Debug\Toolbar\Collectors\Logs::class,
|
||||
\CodeIgniter\Debug\Toolbar\Collectors\Views::class,
|
||||
// \CodeIgniter\Debug\Toolbar\Collectors\Cache::class,
|
||||
\CodeIgniter\Debug\Toolbar\Collectors\Files::class,
|
||||
\CodeIgniter\Debug\Toolbar\Collectors\Routes::class,
|
||||
\CodeIgniter\Debug\Toolbar\Collectors\Events::class,
|
||||
];
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Toolbar Collectors
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* List of toolbar collectors that will be called when Debug Toolbar
|
||||
* fires up and collects data from.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public array $collectors = [
|
||||
Timers::class,
|
||||
Database::class,
|
||||
Logs::class,
|
||||
Views::class,
|
||||
// \CodeIgniter\Debug\Toolbar\Collectors\Cache::class,
|
||||
Files::class,
|
||||
Routes::class,
|
||||
Events::class,
|
||||
];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Max History
|
||||
|--------------------------------------------------------------------------
|
||||
| The Toolbar allows you to view recent requests that have been made to
|
||||
| the application while the toolbar is active. This allows you to quickly
|
||||
| view and compare multiple requests.
|
||||
|
|
||||
| $maxHistory sets a limit on the number of past requests that are stored,
|
||||
| helping to conserve file space used to store them. You can set it to
|
||||
| 0 (zero) to not have any history stored, or -1 for unlimited history.
|
||||
|
|
||||
*/
|
||||
public $maxHistory = 20;
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Collect Var Data
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* If set to false var data from the views will not be colleted. Useful to
|
||||
* avoid high memory usage when there are lots of data passed to the view.
|
||||
*/
|
||||
public bool $collectVarData = true;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Toolbar Views Path
|
||||
|--------------------------------------------------------------------------
|
||||
| The full path to the the views that are used by the toolbar.
|
||||
| MUST have a trailing slash.
|
||||
|
|
||||
*/
|
||||
public $viewsPath = SYSTEMPATH . 'Debug/Toolbar/Views/';
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Max History
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* `$maxHistory` sets a limit on the number of past requests that are stored,
|
||||
* helping to conserve file space used to store them. You can set it to
|
||||
* 0 (zero) to not have any history stored, or -1 for unlimited history.
|
||||
*/
|
||||
public int $maxHistory = 20;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Max Queries
|
||||
|--------------------------------------------------------------------------
|
||||
| If the Database Collector is enabled, it will log every query that the
|
||||
| the system generates so they can be displayed on the toolbar's timeline
|
||||
| and in the query log. This can lead to memory issues in some instances
|
||||
| with hundreds of queries.
|
||||
|
|
||||
| $maxQueries defines the maximum amount of queries that will be stored.
|
||||
|
|
||||
*/
|
||||
public $maxQueries = 100;
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Toolbar Views Path
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The full path to the the views that are used by the toolbar.
|
||||
* This MUST have a trailing slash.
|
||||
*/
|
||||
public string $viewsPath = SYSTEMPATH . 'Debug/Toolbar/Views/';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Max Queries
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* If the Database Collector is enabled, it will log every query that the
|
||||
* the system generates so they can be displayed on the toolbar's timeline
|
||||
* and in the query log. This can lead to memory issues in some instances
|
||||
* with hundreds of queries.
|
||||
*
|
||||
* `$maxQueries` defines the maximum amount of queries that will be stored.
|
||||
*/
|
||||
public int $maxQueries = 100;
|
||||
}
|
||||
|
||||
@ -1,218 +1,252 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
||||
/**
|
||||
* -------------------------------------------------------------------
|
||||
* User Agents
|
||||
* -------------------------------------------------------------------
|
||||
*
|
||||
* This file contains four arrays of user agent data. It is used by the
|
||||
* User Agent Class to help identify browser, platform, robot, and
|
||||
* mobile device data. The array keys are used to identify the device
|
||||
* and the array values are used to set the actual name of the item.
|
||||
*/
|
||||
class UserAgents extends BaseConfig
|
||||
{
|
||||
/*
|
||||
| -------------------------------------------------------------------
|
||||
| USER AGENT TYPES
|
||||
| -------------------------------------------------------------------
|
||||
| This file contains four arrays of user agent data. It is used by the
|
||||
| User Agent Class to help identify browser, platform, robot, and
|
||||
| mobile device data. The array keys are used to identify the device
|
||||
| and the array values are used to set the actual name of the item.
|
||||
*/
|
||||
public $platforms = [
|
||||
'windows nt 10.0' => 'Windows 10',
|
||||
'windows nt 6.3' => 'Windows 8.1',
|
||||
'windows nt 6.2' => 'Windows 8',
|
||||
'windows nt 6.1' => 'Windows 7',
|
||||
'windows nt 6.0' => 'Windows Vista',
|
||||
'windows nt 5.2' => 'Windows 2003',
|
||||
'windows nt 5.1' => 'Windows XP',
|
||||
'windows nt 5.0' => 'Windows 2000',
|
||||
'windows nt 4.0' => 'Windows NT 4.0',
|
||||
'winnt4.0' => 'Windows NT 4.0',
|
||||
'winnt 4.0' => 'Windows NT',
|
||||
'winnt' => 'Windows NT',
|
||||
'windows 98' => 'Windows 98',
|
||||
'win98' => 'Windows 98',
|
||||
'windows 95' => 'Windows 95',
|
||||
'win95' => 'Windows 95',
|
||||
'windows phone' => 'Windows Phone',
|
||||
'windows' => 'Unknown Windows OS',
|
||||
'android' => 'Android',
|
||||
'blackberry' => 'BlackBerry',
|
||||
'iphone' => 'iOS',
|
||||
'ipad' => 'iOS',
|
||||
'ipod' => 'iOS',
|
||||
'os x' => 'Mac OS X',
|
||||
'ppc mac' => 'Power PC Mac',
|
||||
'freebsd' => 'FreeBSD',
|
||||
'ppc' => 'Macintosh',
|
||||
'linux' => 'Linux',
|
||||
'debian' => 'Debian',
|
||||
'sunos' => 'Sun Solaris',
|
||||
'beos' => 'BeOS',
|
||||
'apachebench' => 'ApacheBench',
|
||||
'aix' => 'AIX',
|
||||
'irix' => 'Irix',
|
||||
'osf' => 'DEC OSF',
|
||||
'hp-ux' => 'HP-UX',
|
||||
'netbsd' => 'NetBSD',
|
||||
'bsdi' => 'BSDi',
|
||||
'openbsd' => 'OpenBSD',
|
||||
'gnu' => 'GNU/Linux',
|
||||
'unix' => 'Unknown Unix OS',
|
||||
'symbian' => 'Symbian OS',
|
||||
];
|
||||
/**
|
||||
* -------------------------------------------------------------------
|
||||
* OS Platforms
|
||||
* -------------------------------------------------------------------
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public array $platforms = [
|
||||
'windows nt 10.0' => 'Windows 10',
|
||||
'windows nt 6.3' => 'Windows 8.1',
|
||||
'windows nt 6.2' => 'Windows 8',
|
||||
'windows nt 6.1' => 'Windows 7',
|
||||
'windows nt 6.0' => 'Windows Vista',
|
||||
'windows nt 5.2' => 'Windows 2003',
|
||||
'windows nt 5.1' => 'Windows XP',
|
||||
'windows nt 5.0' => 'Windows 2000',
|
||||
'windows nt 4.0' => 'Windows NT 4.0',
|
||||
'winnt4.0' => 'Windows NT 4.0',
|
||||
'winnt 4.0' => 'Windows NT',
|
||||
'winnt' => 'Windows NT',
|
||||
'windows 98' => 'Windows 98',
|
||||
'win98' => 'Windows 98',
|
||||
'windows 95' => 'Windows 95',
|
||||
'win95' => 'Windows 95',
|
||||
'windows phone' => 'Windows Phone',
|
||||
'windows' => 'Unknown Windows OS',
|
||||
'android' => 'Android',
|
||||
'blackberry' => 'BlackBerry',
|
||||
'iphone' => 'iOS',
|
||||
'ipad' => 'iOS',
|
||||
'ipod' => 'iOS',
|
||||
'os x' => 'Mac OS X',
|
||||
'ppc mac' => 'Power PC Mac',
|
||||
'freebsd' => 'FreeBSD',
|
||||
'ppc' => 'Macintosh',
|
||||
'linux' => 'Linux',
|
||||
'debian' => 'Debian',
|
||||
'sunos' => 'Sun Solaris',
|
||||
'beos' => 'BeOS',
|
||||
'apachebench' => 'ApacheBench',
|
||||
'aix' => 'AIX',
|
||||
'irix' => 'Irix',
|
||||
'osf' => 'DEC OSF',
|
||||
'hp-ux' => 'HP-UX',
|
||||
'netbsd' => 'NetBSD',
|
||||
'bsdi' => 'BSDi',
|
||||
'openbsd' => 'OpenBSD',
|
||||
'gnu' => 'GNU/Linux',
|
||||
'unix' => 'Unknown Unix OS',
|
||||
'symbian' => 'Symbian OS',
|
||||
];
|
||||
|
||||
// The order of this array should NOT be changed. Many browsers return
|
||||
// multiple browser types so we want to identify the sub-type first.
|
||||
public $browsers = [
|
||||
'OPR' => 'Opera',
|
||||
'Flock' => 'Flock',
|
||||
'Edge' => 'Spartan',
|
||||
'Chrome' => 'Chrome',
|
||||
// Opera 10+ always reports Opera/9.80 and appends Version/<real version> to the user agent string
|
||||
'Opera.*?Version' => 'Opera',
|
||||
'Opera' => 'Opera',
|
||||
'MSIE' => 'Internet Explorer',
|
||||
'Internet Explorer' => 'Internet Explorer',
|
||||
'Trident.* rv' => 'Internet Explorer',
|
||||
'Shiira' => 'Shiira',
|
||||
'Firefox' => 'Firefox',
|
||||
'Chimera' => 'Chimera',
|
||||
'Phoenix' => 'Phoenix',
|
||||
'Firebird' => 'Firebird',
|
||||
'Camino' => 'Camino',
|
||||
'Netscape' => 'Netscape',
|
||||
'OmniWeb' => 'OmniWeb',
|
||||
'Safari' => 'Safari',
|
||||
'Mozilla' => 'Mozilla',
|
||||
'Konqueror' => 'Konqueror',
|
||||
'icab' => 'iCab',
|
||||
'Lynx' => 'Lynx',
|
||||
'Links' => 'Links',
|
||||
'hotjava' => 'HotJava',
|
||||
'amaya' => 'Amaya',
|
||||
'IBrowse' => 'IBrowse',
|
||||
'Maxthon' => 'Maxthon',
|
||||
'Ubuntu' => 'Ubuntu Web Browser',
|
||||
'Vivaldi' => 'Vivaldi',
|
||||
];
|
||||
/**
|
||||
* -------------------------------------------------------------------
|
||||
* Browsers
|
||||
* -------------------------------------------------------------------
|
||||
*
|
||||
* The order of this array should NOT be changed. Many browsers return
|
||||
* multiple browser types so we want to identify the subtype first.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public array $browsers = [
|
||||
'OPR' => 'Opera',
|
||||
'Flock' => 'Flock',
|
||||
'Edge' => 'Spartan',
|
||||
'Edg' => 'Edge',
|
||||
'Chrome' => 'Chrome',
|
||||
// Opera 10+ always reports Opera/9.80 and appends Version/<real version> to the user agent string
|
||||
'Opera.*?Version' => 'Opera',
|
||||
'Opera' => 'Opera',
|
||||
'MSIE' => 'Internet Explorer',
|
||||
'Internet Explorer' => 'Internet Explorer',
|
||||
'Trident.* rv' => 'Internet Explorer',
|
||||
'Shiira' => 'Shiira',
|
||||
'Firefox' => 'Firefox',
|
||||
'Chimera' => 'Chimera',
|
||||
'Phoenix' => 'Phoenix',
|
||||
'Firebird' => 'Firebird',
|
||||
'Camino' => 'Camino',
|
||||
'Netscape' => 'Netscape',
|
||||
'OmniWeb' => 'OmniWeb',
|
||||
'Safari' => 'Safari',
|
||||
'Mozilla' => 'Mozilla',
|
||||
'Konqueror' => 'Konqueror',
|
||||
'icab' => 'iCab',
|
||||
'Lynx' => 'Lynx',
|
||||
'Links' => 'Links',
|
||||
'hotjava' => 'HotJava',
|
||||
'amaya' => 'Amaya',
|
||||
'IBrowse' => 'IBrowse',
|
||||
'Maxthon' => 'Maxthon',
|
||||
'Ubuntu' => 'Ubuntu Web Browser',
|
||||
'Vivaldi' => 'Vivaldi',
|
||||
];
|
||||
|
||||
public $mobiles = [
|
||||
// legacy array, old values commented out
|
||||
'mobileexplorer' => 'Mobile Explorer',
|
||||
// 'openwave' => 'Open Wave',
|
||||
// 'opera mini' => 'Opera Mini',
|
||||
// 'operamini' => 'Opera Mini',
|
||||
// 'elaine' => 'Palm',
|
||||
'palmsource' => 'Palm',
|
||||
// 'digital paths' => 'Palm',
|
||||
// 'avantgo' => 'Avantgo',
|
||||
// 'xiino' => 'Xiino',
|
||||
'palmscape' => 'Palmscape',
|
||||
// 'nokia' => 'Nokia',
|
||||
// 'ericsson' => 'Ericsson',
|
||||
// 'blackberry' => 'BlackBerry',
|
||||
// 'motorola' => 'Motorola'
|
||||
/**
|
||||
* -------------------------------------------------------------------
|
||||
* Mobiles
|
||||
* -------------------------------------------------------------------
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public array $mobiles = [
|
||||
// legacy array, old values commented out
|
||||
'mobileexplorer' => 'Mobile Explorer',
|
||||
// 'openwave' => 'Open Wave',
|
||||
// 'opera mini' => 'Opera Mini',
|
||||
// 'operamini' => 'Opera Mini',
|
||||
// 'elaine' => 'Palm',
|
||||
'palmsource' => 'Palm',
|
||||
// 'digital paths' => 'Palm',
|
||||
// 'avantgo' => 'Avantgo',
|
||||
// 'xiino' => 'Xiino',
|
||||
'palmscape' => 'Palmscape',
|
||||
// 'nokia' => 'Nokia',
|
||||
// 'ericsson' => 'Ericsson',
|
||||
// 'blackberry' => 'BlackBerry',
|
||||
// 'motorola' => 'Motorola'
|
||||
|
||||
// Phones and Manufacturers
|
||||
'motorola' => 'Motorola',
|
||||
'nokia' => 'Nokia',
|
||||
'palm' => 'Palm',
|
||||
'iphone' => 'Apple iPhone',
|
||||
'ipad' => 'iPad',
|
||||
'ipod' => 'Apple iPod Touch',
|
||||
'sony' => 'Sony Ericsson',
|
||||
'ericsson' => 'Sony Ericsson',
|
||||
'blackberry' => 'BlackBerry',
|
||||
'cocoon' => 'O2 Cocoon',
|
||||
'blazer' => 'Treo',
|
||||
'lg' => 'LG',
|
||||
'amoi' => 'Amoi',
|
||||
'xda' => 'XDA',
|
||||
'mda' => 'MDA',
|
||||
'vario' => 'Vario',
|
||||
'htc' => 'HTC',
|
||||
'samsung' => 'Samsung',
|
||||
'sharp' => 'Sharp',
|
||||
'sie-' => 'Siemens',
|
||||
'alcatel' => 'Alcatel',
|
||||
'benq' => 'BenQ',
|
||||
'ipaq' => 'HP iPaq',
|
||||
'mot-' => 'Motorola',
|
||||
'playstation portable' => 'PlayStation Portable',
|
||||
'playstation 3' => 'PlayStation 3',
|
||||
'playstation vita' => 'PlayStation Vita',
|
||||
'hiptop' => 'Danger Hiptop',
|
||||
'nec-' => 'NEC',
|
||||
'panasonic' => 'Panasonic',
|
||||
'philips' => 'Philips',
|
||||
'sagem' => 'Sagem',
|
||||
'sanyo' => 'Sanyo',
|
||||
'spv' => 'SPV',
|
||||
'zte' => 'ZTE',
|
||||
'sendo' => 'Sendo',
|
||||
'nintendo dsi' => 'Nintendo DSi',
|
||||
'nintendo ds' => 'Nintendo DS',
|
||||
'nintendo 3ds' => 'Nintendo 3DS',
|
||||
'wii' => 'Nintendo Wii',
|
||||
'open web' => 'Open Web',
|
||||
'openweb' => 'OpenWeb',
|
||||
// Phones and Manufacturers
|
||||
'motorola' => 'Motorola',
|
||||
'nokia' => 'Nokia',
|
||||
'palm' => 'Palm',
|
||||
'iphone' => 'Apple iPhone',
|
||||
'ipad' => 'iPad',
|
||||
'ipod' => 'Apple iPod Touch',
|
||||
'sony' => 'Sony Ericsson',
|
||||
'ericsson' => 'Sony Ericsson',
|
||||
'blackberry' => 'BlackBerry',
|
||||
'cocoon' => 'O2 Cocoon',
|
||||
'blazer' => 'Treo',
|
||||
'lg' => 'LG',
|
||||
'amoi' => 'Amoi',
|
||||
'xda' => 'XDA',
|
||||
'mda' => 'MDA',
|
||||
'vario' => 'Vario',
|
||||
'htc' => 'HTC',
|
||||
'samsung' => 'Samsung',
|
||||
'sharp' => 'Sharp',
|
||||
'sie-' => 'Siemens',
|
||||
'alcatel' => 'Alcatel',
|
||||
'benq' => 'BenQ',
|
||||
'ipaq' => 'HP iPaq',
|
||||
'mot-' => 'Motorola',
|
||||
'playstation portable' => 'PlayStation Portable',
|
||||
'playstation 3' => 'PlayStation 3',
|
||||
'playstation vita' => 'PlayStation Vita',
|
||||
'hiptop' => 'Danger Hiptop',
|
||||
'nec-' => 'NEC',
|
||||
'panasonic' => 'Panasonic',
|
||||
'philips' => 'Philips',
|
||||
'sagem' => 'Sagem',
|
||||
'sanyo' => 'Sanyo',
|
||||
'spv' => 'SPV',
|
||||
'zte' => 'ZTE',
|
||||
'sendo' => 'Sendo',
|
||||
'nintendo dsi' => 'Nintendo DSi',
|
||||
'nintendo ds' => 'Nintendo DS',
|
||||
'nintendo 3ds' => 'Nintendo 3DS',
|
||||
'wii' => 'Nintendo Wii',
|
||||
'open web' => 'Open Web',
|
||||
'openweb' => 'OpenWeb',
|
||||
|
||||
// Operating Systems
|
||||
'android' => 'Android',
|
||||
'symbian' => 'Symbian',
|
||||
'SymbianOS' => 'SymbianOS',
|
||||
'elaine' => 'Palm',
|
||||
'series60' => 'Symbian S60',
|
||||
'windows ce' => 'Windows CE',
|
||||
// Operating Systems
|
||||
'android' => 'Android',
|
||||
'symbian' => 'Symbian',
|
||||
'SymbianOS' => 'SymbianOS',
|
||||
'elaine' => 'Palm',
|
||||
'series60' => 'Symbian S60',
|
||||
'windows ce' => 'Windows CE',
|
||||
|
||||
// Browsers
|
||||
'obigo' => 'Obigo',
|
||||
'netfront' => 'Netfront Browser',
|
||||
'openwave' => 'Openwave Browser',
|
||||
'mobilexplorer' => 'Mobile Explorer',
|
||||
'operamini' => 'Opera Mini',
|
||||
'opera mini' => 'Opera Mini',
|
||||
'opera mobi' => 'Opera Mobile',
|
||||
'fennec' => 'Firefox Mobile',
|
||||
// Browsers
|
||||
'obigo' => 'Obigo',
|
||||
'netfront' => 'Netfront Browser',
|
||||
'openwave' => 'Openwave Browser',
|
||||
'mobilexplorer' => 'Mobile Explorer',
|
||||
'operamini' => 'Opera Mini',
|
||||
'opera mini' => 'Opera Mini',
|
||||
'opera mobi' => 'Opera Mobile',
|
||||
'fennec' => 'Firefox Mobile',
|
||||
|
||||
// Other
|
||||
'digital paths' => 'Digital Paths',
|
||||
'avantgo' => 'AvantGo',
|
||||
'xiino' => 'Xiino',
|
||||
'novarra' => 'Novarra Transcoder',
|
||||
'vodafone' => 'Vodafone',
|
||||
'docomo' => 'NTT DoCoMo',
|
||||
'o2' => 'O2',
|
||||
// Other
|
||||
'digital paths' => 'Digital Paths',
|
||||
'avantgo' => 'AvantGo',
|
||||
'xiino' => 'Xiino',
|
||||
'novarra' => 'Novarra Transcoder',
|
||||
'vodafone' => 'Vodafone',
|
||||
'docomo' => 'NTT DoCoMo',
|
||||
'o2' => 'O2',
|
||||
|
||||
// Fallback
|
||||
'mobile' => 'Generic Mobile',
|
||||
'wireless' => 'Generic Mobile',
|
||||
'j2me' => 'Generic Mobile',
|
||||
'midp' => 'Generic Mobile',
|
||||
'cldc' => 'Generic Mobile',
|
||||
'up.link' => 'Generic Mobile',
|
||||
'up.browser' => 'Generic Mobile',
|
||||
'smartphone' => 'Generic Mobile',
|
||||
'cellphone' => 'Generic Mobile',
|
||||
];
|
||||
// Fallback
|
||||
'mobile' => 'Generic Mobile',
|
||||
'wireless' => 'Generic Mobile',
|
||||
'j2me' => 'Generic Mobile',
|
||||
'midp' => 'Generic Mobile',
|
||||
'cldc' => 'Generic Mobile',
|
||||
'up.link' => 'Generic Mobile',
|
||||
'up.browser' => 'Generic Mobile',
|
||||
'smartphone' => 'Generic Mobile',
|
||||
'cellphone' => 'Generic Mobile',
|
||||
];
|
||||
|
||||
// There are hundreds of bots but these are the most common.
|
||||
public $robots = [
|
||||
'googlebot' => 'Googlebot',
|
||||
'msnbot' => 'MSNBot',
|
||||
'baiduspider' => 'Baiduspider',
|
||||
'bingbot' => 'Bing',
|
||||
'slurp' => 'Inktomi Slurp',
|
||||
'yahoo' => 'Yahoo',
|
||||
'ask jeeves' => 'Ask Jeeves',
|
||||
'fastcrawler' => 'FastCrawler',
|
||||
'infoseek' => 'InfoSeek Robot 1.0',
|
||||
'lycos' => 'Lycos',
|
||||
'yandex' => 'YandexBot',
|
||||
'mediapartners-google' => 'MediaPartners Google',
|
||||
'CRAZYWEBCRAWLER' => 'Crazy Webcrawler',
|
||||
'adsbot-google' => 'AdsBot Google',
|
||||
'feedfetcher-google' => 'Feedfetcher Google',
|
||||
'curious george' => 'Curious George',
|
||||
'ia_archiver' => 'Alexa Crawler',
|
||||
'MJ12bot' => 'Majestic-12',
|
||||
'Uptimebot' => 'Uptimebot',
|
||||
];
|
||||
/**
|
||||
* -------------------------------------------------------------------
|
||||
* Robots
|
||||
* -------------------------------------------------------------------
|
||||
*
|
||||
* There are hundred of bots but these are the most common.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public array $robots = [
|
||||
'googlebot' => 'Googlebot',
|
||||
'msnbot' => 'MSNBot',
|
||||
'baiduspider' => 'Baiduspider',
|
||||
'bingbot' => 'Bing',
|
||||
'slurp' => 'Inktomi Slurp',
|
||||
'yahoo' => 'Yahoo',
|
||||
'ask jeeves' => 'Ask Jeeves',
|
||||
'fastcrawler' => 'FastCrawler',
|
||||
'infoseek' => 'InfoSeek Robot 1.0',
|
||||
'lycos' => 'Lycos',
|
||||
'yandex' => 'YandexBot',
|
||||
'mediapartners-google' => 'MediaPartners Google',
|
||||
'CRAZYWEBCRAWLER' => 'Crazy Webcrawler',
|
||||
'adsbot-google' => 'AdsBot Google',
|
||||
'feedfetcher-google' => 'Feedfetcher Google',
|
||||
'curious george' => 'Curious George',
|
||||
'ia_archiver' => 'Alexa Crawler',
|
||||
'MJ12bot' => 'Majestic-12',
|
||||
'Uptimebot' => 'Uptimebot',
|
||||
];
|
||||
}
|
||||
|
||||
@ -1,36 +1,44 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
class Validation
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
use CodeIgniter\Validation\StrictRules\CreditCardRules;
|
||||
use CodeIgniter\Validation\StrictRules\FileRules;
|
||||
use CodeIgniter\Validation\StrictRules\FormatRules;
|
||||
use CodeIgniter\Validation\StrictRules\Rules;
|
||||
|
||||
class Validation extends BaseConfig
|
||||
{
|
||||
//--------------------------------------------------------------------
|
||||
// Setup
|
||||
//--------------------------------------------------------------------
|
||||
// --------------------------------------------------------------------
|
||||
// Setup
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Stores the classes that contain the
|
||||
* rules that are available.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $ruleSets = [
|
||||
\CodeIgniter\Validation\Rules::class,
|
||||
\CodeIgniter\Validation\FormatRules::class,
|
||||
\CodeIgniter\Validation\FileRules::class,
|
||||
\CodeIgniter\Validation\CreditCardRules::class,
|
||||
];
|
||||
/**
|
||||
* Stores the classes that contain the
|
||||
* rules that are available.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public array $ruleSets = [
|
||||
Rules::class,
|
||||
FormatRules::class,
|
||||
FileRules::class,
|
||||
CreditCardRules::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* Specifies the views that are used to display the
|
||||
* errors.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $templates = [
|
||||
'list' => 'CodeIgniter\Validation\Views\list',
|
||||
'single' => 'CodeIgniter\Validation\Views\single',
|
||||
];
|
||||
/**
|
||||
* Specifies the views that are used to display the
|
||||
* errors.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
public array $templates = [
|
||||
'list' => 'CodeIgniter\Validation\Views\list',
|
||||
'single' => 'CodeIgniter\Validation\Views\single',
|
||||
];
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Rules
|
||||
//--------------------------------------------------------------------
|
||||
// --------------------------------------------------------------------
|
||||
// Rules
|
||||
// --------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@ -1,34 +1,56 @@
|
||||
<?php namespace Config;
|
||||
<?php
|
||||
|
||||
class View extends \CodeIgniter\Config\View
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\View as BaseView;
|
||||
use CodeIgniter\View\ViewDecoratorInterface;
|
||||
|
||||
class View extends BaseView
|
||||
{
|
||||
/**
|
||||
* When false, the view method will clear the data between each
|
||||
* call. This keeps your data safe and ensures there is no accidental
|
||||
* leaking between calls, so you would need to explicitly pass the data
|
||||
* to each view. You might prefer to have the data stick around between
|
||||
* calls so that it is available to all views. If that is the case,
|
||||
* set $saveData to true.
|
||||
*/
|
||||
public $saveData = true;
|
||||
/**
|
||||
* When false, the view method will clear the data between each
|
||||
* call. This keeps your data safe and ensures there is no accidental
|
||||
* leaking between calls, so you would need to explicitly pass the data
|
||||
* to each view. You might prefer to have the data stick around between
|
||||
* calls so that it is available to all views. If that is the case,
|
||||
* set $saveData to true.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $saveData = true;
|
||||
|
||||
/**
|
||||
* Parser Filters map a filter name with any PHP callable. When the
|
||||
* Parser prepares a variable for display, it will chain it
|
||||
* through the filters in the order defined, inserting any parameters.
|
||||
* To prevent potential abuse, all filters MUST be defined here
|
||||
* in order for them to be available for use within the Parser.
|
||||
*
|
||||
* Examples:
|
||||
* { title|esc(js) }
|
||||
* { created_on|date(Y-m-d)|esc(attr) }
|
||||
*/
|
||||
public $filters = [];
|
||||
/**
|
||||
* Parser Filters map a filter name with any PHP callable. When the
|
||||
* Parser prepares a variable for display, it will chain it
|
||||
* through the filters in the order defined, inserting any parameters.
|
||||
* To prevent potential abuse, all filters MUST be defined here
|
||||
* in order for them to be available for use within the Parser.
|
||||
*
|
||||
* Examples:
|
||||
* { title|esc(js) }
|
||||
* { created_on|date(Y-m-d)|esc(attr) }
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $filters = [];
|
||||
|
||||
/**
|
||||
* Parser Plugins provide a way to extend the functionality provided
|
||||
* by the core Parser by creating aliases that will be replaced with
|
||||
* any callable. Can be single or tag pair.
|
||||
*/
|
||||
public $plugins = [];
|
||||
/**
|
||||
* Parser Plugins provide a way to extend the functionality provided
|
||||
* by the core Parser by creating aliases that will be replaced with
|
||||
* any callable. Can be single or tag pair.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $plugins = [];
|
||||
|
||||
/**
|
||||
* View Decorators are class methods that will be run in sequence to
|
||||
* have a chance to alter the generated output just prior to caching
|
||||
* the results.
|
||||
*
|
||||
* All classes must implement CodeIgniter\View\ViewDecoratorInterface
|
||||
*
|
||||
* @var class-string<ViewDecoratorInterface>[]
|
||||
*/
|
||||
public array $decorators = [];
|
||||
}
|
||||
|
||||
402
app/Controllers/Authentication.php
Normal file
402
app/Controllers/Authentication.php
Normal file
@ -0,0 +1,402 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\AuthenticationModel;
|
||||
|
||||
## Authentication Controllers only for Login,Logout,forgotpassword,confirmationpassword,resetpassword,session,cookie,lock-screen Modules
|
||||
class Authentication extends BaseController
|
||||
{
|
||||
## Load Login Page
|
||||
public function index()
|
||||
{
|
||||
// Retrieve flashed session data
|
||||
$successMessage = session()->getFlashdata('success');
|
||||
$validationErrors = session()->getFlashdata('error');
|
||||
|
||||
// Load and display the form view with the above data
|
||||
// Here, we'll use the default View class for demonstration purposes
|
||||
$alerts = [
|
||||
'successMessage' => $successMessage,
|
||||
'validationErrors' => $validationErrors,
|
||||
];
|
||||
return view('auth_login', $alerts);
|
||||
}
|
||||
|
||||
## Authenticate the users and Redirect to Dashboard
|
||||
public function authenticate()
|
||||
{
|
||||
$auth_model = new AuthenticationModel();
|
||||
$rules = [
|
||||
'username' => 'required',
|
||||
'password' => 'required',
|
||||
];
|
||||
if ($this->validate($rules)) {
|
||||
|
||||
$username = $this->request->getPost('username');
|
||||
$password = $this->request->getPost('password');
|
||||
|
||||
$user = $auth_model->where(['email'=>$username,'isactive'=>1])->first();
|
||||
// $this->logger->info("Authenticate: Function Called.");
|
||||
|
||||
if (is_null($user)) {
|
||||
$this->logger->error('User does not exist');
|
||||
return redirect()->back()->withInput()->with('error', 'User does not exist');
|
||||
}
|
||||
|
||||
$pwd_verify = password_verify((string)$password, $user['password']);
|
||||
|
||||
if (!$pwd_verify) {
|
||||
$this->logger->error('Invalid Email or Password');
|
||||
return redirect()->back()->withInput()->with('error', 'Invalid Email or Password.');
|
||||
}
|
||||
|
||||
// You can implement your authentication logic here
|
||||
// For example, check against a database, validate credentials, etc.
|
||||
if ($username === $user['email'] && $pwd_verify) {
|
||||
|
||||
// Redirect to a dashboard or other protected area
|
||||
helper('session');
|
||||
set_logged_user_id($user['user_id']);
|
||||
set_logged_name($user['first_name'] . " " . $user['last_name']);
|
||||
set_user_role($user['role']);
|
||||
set_business_id($user['business_id']);
|
||||
return redirect()->to('dashboard');
|
||||
// $cookie = \Config\Services::cookie();
|
||||
// $cookie->setCookie('remember_username', 'Sri Harsha', 3600); // Cookie expires in 1 hour
|
||||
|
||||
|
||||
} else {
|
||||
// Invalid credentials, display error message
|
||||
// return redirect()->back()->with('error', 'Invalid username or password.');
|
||||
$this->logger->error('Invalid username or password.');
|
||||
return redirect()->back()->withInput()->with('error', 'Invalid username or password.');
|
||||
}
|
||||
} else {
|
||||
// Validation failed, display errors
|
||||
// return redirect()->back()->withInput()->with('validation', $validation);
|
||||
$this->logger->error('Username or password Required.');
|
||||
return redirect()->back()->withInput()->with('error', 'Username or password Required.');
|
||||
}
|
||||
}
|
||||
|
||||
## Load Forgot password Confirmation Alert
|
||||
public function auth_confirm_mail()
|
||||
{
|
||||
$mail_id = $this->request->getPost('email');
|
||||
$url_domain = base_url();
|
||||
|
||||
$this->logger->info("auth confirm mail : Mail = ".$mail_id);
|
||||
$this->logger->info("auth confirm mail : Domain = ".$url_domain);
|
||||
|
||||
// Validate the email address
|
||||
$validation_rules = [
|
||||
'email' => 'required|valid_email',
|
||||
];
|
||||
|
||||
if (!$this->validate($validation_rules)) {
|
||||
$response['status'] = false;
|
||||
$response['message'] = 'Enter correct E-mail to reset your password';
|
||||
$this->logger->error($response['message']);
|
||||
return $this->response->setJSON(['data' => $response]);
|
||||
}
|
||||
|
||||
// Check if the email exists in the database
|
||||
$auth_model = new AuthenticationModel();
|
||||
// $user = $auth_model->where('email', $mail_id)->first();
|
||||
$where = ['email' => $mail_id, 'isactive' => 1];
|
||||
$user = $auth_model->where($where)->first();
|
||||
|
||||
if (!$user) {
|
||||
$response['status'] = false;
|
||||
$response['message'] = 'There is no user enteries against given mail';
|
||||
$this->logger->error($response['message']);
|
||||
return $this->response->setJSON(['data' => $response]);
|
||||
} else {
|
||||
$this->logger->info("auth confirm mail : count = ".count($user));
|
||||
$data['mail_id'] = $mail_id;
|
||||
// Generate a unique token for password reset
|
||||
$token = bin2hex(random_bytes(32));
|
||||
$content = "Click the link below to reset your password : " . $url_domain . "auth_reset_password?email=" . $mail_id . "&token=" . $token;
|
||||
$this->logger->info("auth confirm mail : content = ".$content);
|
||||
$email = \Config\Services::email();
|
||||
// $recipient = 'venbalap08@gmail.com';
|
||||
$recipient = $mail_id;
|
||||
|
||||
// Compose the email
|
||||
$email->setTo($recipient);
|
||||
$email->setFrom('no-reply@tripapprovaltool.com', 'BB-Donor');
|
||||
$email->setSubject('Email Notification');
|
||||
// $email->setMessage('This is a notification email from CodeIgniter.');
|
||||
$email->setMessage($content);
|
||||
|
||||
$update_token['reset_link'] = $token;
|
||||
$auth_model->update($user['user_id'], $update_token);
|
||||
$data['link'] = $url_domain . "auth_reset_password?email=" . $mail_id . "&token=" . $token;
|
||||
|
||||
if ($email->send()) {
|
||||
$this->logger->info("auth confirm mail = Email sent successfully");
|
||||
$response['status'] = true;
|
||||
$response['message'] = "Password Reset Link Shared on Your Email";
|
||||
$this->logger->error($response['message']);
|
||||
return $this->response->setJSON(['data' => $response]);
|
||||
} else {
|
||||
$response['status'] = false;
|
||||
$response['message'] = 'There is no user enteries against given mail';
|
||||
$this->logger->error($response['message']);
|
||||
// return redirect()->back()->withInput()->with('error', 'Email Not Sended,Try Again');
|
||||
}
|
||||
return $this->response->setJSON(['data' => $response]);
|
||||
}
|
||||
}
|
||||
|
||||
## Load Reset password Page
|
||||
public function auth_reset_password()
|
||||
{
|
||||
|
||||
$email = $this->request->getGet('email');
|
||||
$token = $this->request->getGet('token');
|
||||
|
||||
$auth_model = new AuthenticationModel();
|
||||
$where = ['email' => $email, 'reset_link' => $token, 'isactive' => 1];
|
||||
$user = $auth_model->where($where)->first();
|
||||
if (!$user) {
|
||||
$this->logger->error('Invaild link for this Email');
|
||||
return redirect()->back()->withInput()->with('error', 'Invaild link for this Email');
|
||||
//return back page is auth_login
|
||||
} else {
|
||||
$update_token['reset_link'] = NULL;
|
||||
$auth_model->update($user['user_id'], $update_token);
|
||||
$data['email'] = $email;
|
||||
// Retrieve flashed session data
|
||||
$successMessage = session()->getFlashdata('success');
|
||||
$validationErrors = session()->getFlashdata('error');
|
||||
|
||||
// Load and display the form view with the above data
|
||||
// Here, we'll use the default View class for demonstration purposes
|
||||
$data['successMessage'] = $successMessage;
|
||||
$data['validationErrors'] = $validationErrors;
|
||||
return view('auth_reset_password', $data);
|
||||
}
|
||||
}
|
||||
|
||||
## Save Resetted password. and Redirect to login
|
||||
public function auth_reset_password_save()
|
||||
{
|
||||
|
||||
$auth_model = new AuthenticationModel();
|
||||
$rules = [
|
||||
'password1' => 'required',
|
||||
'password2' => 'required',
|
||||
];
|
||||
if ($this->validate($rules)) {
|
||||
// echo "try";die;
|
||||
$email = $this->request->getVar('email');
|
||||
$password = $this->request->getVar('password1');
|
||||
$confirmation = $this->request->getVar('password2');
|
||||
$hash_password = password_hash($password, PASSWORD_DEFAULT);
|
||||
// try {
|
||||
// code for password confirmation
|
||||
if ($password === $confirmation) {
|
||||
$auth_model = new AuthenticationModel();
|
||||
$user_details = $auth_model->where(['email' => $email, 'isactive' => 1])->first();
|
||||
if ($user_details) {
|
||||
$update_user_details = ['email' => $email, 'password' => $hash_password];
|
||||
$auth_model->update($user_details['user_id'], $update_user_details);
|
||||
}
|
||||
// Retrieve flashed session data
|
||||
$successMessage = session()->getFlashdata('success');
|
||||
$validationErrors = session()->getFlashdata('error');
|
||||
|
||||
// Load and display the form view with the above data
|
||||
// Here, we'll use the default View class for demonstration purposes
|
||||
$data['successMessage'] = $successMessage;
|
||||
$data['validationErrors'] = $validationErrors;
|
||||
return view('auth_login', $data);
|
||||
} else {
|
||||
// Password confirmation failed
|
||||
$this->logger->error('Password confirmation failed');
|
||||
return redirect()->back()->withInput()->with('error', 'Password confirmation failed');
|
||||
}
|
||||
// } catch (\Exception $e) {
|
||||
// $error = "Exception Errno returned" . $e->getCode() . " <br/>";
|
||||
// $error_msg = $e->getMessage();
|
||||
// $this->logger->error($error . '(' . $error_msg . ')');
|
||||
// return redirect()->back()->withInput()->with('error', $error . '(' . $error_msg . ')');
|
||||
// }
|
||||
} else {
|
||||
// Validation failed, display errors
|
||||
$this->logger->error('Password And Confirmation Password are Required.');
|
||||
return redirect()->back()->withInput()->with('error', 'Password And Confirmation Password are Required.');
|
||||
}
|
||||
}
|
||||
|
||||
## Logout With destory Session Details
|
||||
public function logout()
|
||||
{
|
||||
|
||||
// Clear session and cookies
|
||||
$session = session();
|
||||
|
||||
// Regenerate the session ID
|
||||
$session->regenerate();
|
||||
|
||||
// Clear session data and perform logout logic
|
||||
$session->destroy();
|
||||
// $cookie = \Config\Services::cookie();
|
||||
// $cookie->delete('ci_session');
|
||||
// $remembered_username = $cookie->getCookie('remember_username');
|
||||
// $cookie->delete('remember_username');
|
||||
|
||||
// Redirect to a logout confirmation page or login page
|
||||
// return redirect()->to('/login'); // Replace with your login route
|
||||
$this->response->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0');
|
||||
$this->response->setHeader('Pragma', 'no-cache');
|
||||
$this->response->setHeader('Expires', 'Fri, 01 Jan 1990 00:00:00 GMT');
|
||||
$data = [];
|
||||
|
||||
return redirect()->route('login');
|
||||
// return view('auth_logout', $data);
|
||||
}
|
||||
|
||||
## Lock Screen - holded
|
||||
public function lockscreen()
|
||||
{
|
||||
// Load the session library
|
||||
helper('session');
|
||||
|
||||
$session_uid = get_logged_user_id();
|
||||
$session_uname = get_logged_name();
|
||||
$auth_model = new AuthenticationModel();
|
||||
|
||||
|
||||
$details = $auth_model->getheringDetailsForHeader($session_uid);
|
||||
$data['loggedin_person'] = $session_uname;
|
||||
$data['loggedin_person_role'] = $details[0]['role'];
|
||||
$data['favicon'] = !empty($details[0]['favicon']) && file_exists(FCPATH."public/uploads/".$details[0]['favicon']) ? base_url("public/uploads/".$details[0]['favicon']) : base_url("public/uploads/default.ico");
|
||||
$data['profile_picture'] = !empty($details[0]['profile_picture']) && file_exists(FCPATH."public/uploads/".$details[0]['profile_picture']) ? base_url("public/uploads/" . $details[0]['profile_picture']) : base_url("public/assets/images/users/avatar-9.jpg");
|
||||
$data['company_logo_small'] = !empty($details[0]['company_logo_small']) && file_exists(FCPATH."public/uploads/".$details[0]['company_logo_small']) ? base_url("public/uploads/" . $details[0]['company_logo_small']) : base_url("public/uploads/default_logo.png");
|
||||
$data['company_logo_large'] = !empty($details[0]['company_logo_large']) && file_exists(FCPATH."public/uploads/".$details[0]['company_logo_large']) ? base_url("public/uploads/" . $details[0]['company_logo_large']) : base_url("public/uploads/default.png");
|
||||
$successMessage = session()->getFlashdata('success');
|
||||
$validationErrors = session()->getFlashdata('error');
|
||||
// Load and display the form view with the above data
|
||||
// Here, we'll use the default View class for demonstration purposes
|
||||
|
||||
// Check if the session is locked
|
||||
if (get_session_locked()) {
|
||||
$data['successMessage'] = $successMessage;
|
||||
$data['validationErrors'] = $validationErrors;
|
||||
// Load the lock screen view
|
||||
return view('auth_lock_screen', $data);
|
||||
} else {
|
||||
// Redirect the user to their previous page or dashboard
|
||||
return redirect()->to('dashboard'); // Replace with appropriate URL
|
||||
}
|
||||
}
|
||||
|
||||
## Lock Screen
|
||||
public function lock()
|
||||
{
|
||||
// Load the session library
|
||||
helper('session');
|
||||
|
||||
// Set the session_locked flag
|
||||
set_session_locked(true);
|
||||
|
||||
// Redirect the user to the lock screen
|
||||
return redirect()->to('lockscreen'); // Replace with your lock screen URL
|
||||
}
|
||||
|
||||
## Unlock Screen - holded
|
||||
public function unlock()
|
||||
{
|
||||
// Load the session library
|
||||
helper('session');
|
||||
|
||||
// Check password logic
|
||||
$password = $this->request->getVar('password');
|
||||
if ($this->checkPassword($password)) {
|
||||
// Unlock the session
|
||||
remove_session_locked();
|
||||
return redirect()->to('dashboard'); // Redirect to dashboard
|
||||
} else {
|
||||
// Incorrect password, show error
|
||||
return redirect()->back()->withInput()->with('error', 'Incorrect password.');
|
||||
}
|
||||
}
|
||||
|
||||
## Unlock Screen
|
||||
private function checkPassword($password)
|
||||
{
|
||||
// Implement your password validation logic here
|
||||
// For example, compare against a stored hash
|
||||
// return $password === 'correct_password';
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
$auth_model = new AuthenticationModel();
|
||||
$user = $auth_model->where('user_id', $session_uid)->first();
|
||||
$pwd_verify = password_verify((string)$password, $user['password']);
|
||||
return $pwd_verify ;
|
||||
}
|
||||
|
||||
#change password
|
||||
public function change_password()
|
||||
{
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
if (is_session_active()) {
|
||||
$requested = $this->request->getPost();
|
||||
// $mail_id = $requested['user_mail'];
|
||||
$old_pwd = $requested['user_old_password'];
|
||||
$new_pwd = $requested['user_new_password'];
|
||||
$conf_pwd = $requested['user_confirm_password'];
|
||||
$auth_model = new AuthenticationModel();
|
||||
$user = $auth_model->where('user_id', $session_uid)->first();
|
||||
$pwd_verify = password_verify((string)$old_pwd, $user['password']);
|
||||
|
||||
if($pwd_verify){
|
||||
|
||||
if ($old_pwd === $new_pwd) {
|
||||
$response['status'] = false;
|
||||
$response['message'] = "New password should not be the same as the old password.";
|
||||
$this->logger->error($response['message']);
|
||||
return $this->response->setJSON(['data' => $response]);
|
||||
}
|
||||
if ($new_pwd !== $conf_pwd) {
|
||||
$response['status'] = false;
|
||||
$response['message'] = "New password and confirm password do not match.";
|
||||
$this->logger->error($response['message']);
|
||||
return $this->response->setJSON(['data' => $response]);
|
||||
}
|
||||
$hash_password = password_hash($new_pwd, PASSWORD_DEFAULT);
|
||||
|
||||
$user_details = $auth_model->where(['user_id'=> $session_uid, 'isactive' => 1])->first();
|
||||
// print_r($user_details);die;
|
||||
if ($user_details) {
|
||||
$update_user_details = ['user_id', $session_uid, 'password' => $hash_password];
|
||||
$auth_model->update($user_details['user_id'], $update_user_details);
|
||||
$response['status'] = true;
|
||||
$response['message'] = "Password Updated..";
|
||||
$this->logger->error($response['message']);
|
||||
}else{
|
||||
$response['status'] = false;
|
||||
$response['message'] = "Can't able to change";
|
||||
$this->logger->error($response['message']);
|
||||
}
|
||||
} else {
|
||||
$response['status'] = false;
|
||||
$response['message'] = "Old Password Wrong";
|
||||
$this->logger->error($response['message']);
|
||||
|
||||
|
||||
}
|
||||
}else {
|
||||
$response['status'] = false;
|
||||
$response['message'] = "Something Went Wrong";
|
||||
$this->logger->error($response['message']);
|
||||
|
||||
|
||||
}
|
||||
return $this->response->setJSON(['data' => $response]);
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use CodeIgniter\Controller;
|
||||
use CodeIgniter\HTTP\CLIRequest;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use App\Models\AuthenticationModel;
|
||||
|
||||
/**
|
||||
* Class BaseController
|
||||
*
|
||||
@ -10,37 +19,187 @@ namespace App\Controllers;
|
||||
* class Home extends BaseController
|
||||
*
|
||||
* For security be sure to declare any new methods as protected or private.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
*/
|
||||
|
||||
use CodeIgniter\Controller;
|
||||
|
||||
class BaseController extends Controller
|
||||
abstract class BaseController extends Controller
|
||||
{
|
||||
/**
|
||||
* Instance of the main Request object.
|
||||
*
|
||||
* @var CLIRequest|IncomingRequest
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* An array of helpers to be loaded automatically upon
|
||||
* class instantiation. These helpers will be available
|
||||
* to all other controllers that extend BaseController.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $helpers = [];
|
||||
/**
|
||||
* An array of helpers to be loaded automatically upon
|
||||
* class instantiation. These helpers will be available
|
||||
* to all other controllers that extend BaseController.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $helpers = [];
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
|
||||
{
|
||||
// Do Not Edit This Line
|
||||
parent::initController($request, $response, $logger);
|
||||
/**
|
||||
* Be sure to declare properties for any property fetch you initialized.
|
||||
* The creation of dynamic property is deprecated in PHP 8.2.
|
||||
*/
|
||||
// protected $session;
|
||||
public $authData = [];
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Preload any models, libraries, etc, here.
|
||||
//--------------------------------------------------------------------
|
||||
// E.g.:
|
||||
// $this->session = \Config\Services::session();
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
|
||||
// Do Not Edit This Line
|
||||
parent::initController($request, $response, $logger);
|
||||
$uri = $request->getUri();
|
||||
|
||||
}
|
||||
// Get the path or route from the URI
|
||||
$requestedRoute = $uri->getPath();
|
||||
$requestType = get_class($request);
|
||||
|
||||
if (php_sapi_name() === 'cli') {
|
||||
echo "This is a command-line request.";
|
||||
// echo $requestedRoute;
|
||||
} else {
|
||||
$routesArr = ['login', 'authenticate', 'auth_confirm_mail', 'auth_reset_password', 'auth_reset_password_save'];
|
||||
if (!in_array($requestedRoute, $routesArr)) {
|
||||
$this->authData = $this->session_log();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function render_page($viewpage, $data){
|
||||
helper('session');
|
||||
|
||||
$session_uid = get_logged_user_id();
|
||||
$session_uname = get_logged_name();
|
||||
|
||||
// echo $session_uname; die;
|
||||
|
||||
$mergedData = array_merge($data, $this->authData);
|
||||
$mergedData['browser_title']= $mergedData['company_name'] . ' | ' . $mergedData['company_short_name'] . ' ' . $mergedData['page_name'];
|
||||
|
||||
$mergedData['heading']= $mergedData['page_name'] === "Dashboard" ? 'Welcome to ' . $mergedData['company_name'] : "";
|
||||
$reminder = $this->reminderMessage();
|
||||
if((int)count($reminder['reminder']) > 0){
|
||||
session()->setFlashdata('reminder', $reminder['reminder']);
|
||||
}
|
||||
echo view('template/header.php', $mergedData );
|
||||
echo view('template/topbar.php', $mergedData);
|
||||
echo view($viewpage, $mergedData);
|
||||
echo view('template/footer.php', $mergedData);
|
||||
|
||||
|
||||
}
|
||||
public function session_log()
|
||||
{
|
||||
helper('session');
|
||||
|
||||
$session_uid = get_logged_user_id();
|
||||
$session_uname = get_logged_name();
|
||||
$session_role = get_user_role();
|
||||
|
||||
// echo $session_role; die;
|
||||
|
||||
if(!is_session_active()) {
|
||||
|
||||
header("Location: " . base_url("login"));
|
||||
exit();
|
||||
}
|
||||
|
||||
$auth_model = new AuthenticationModel();
|
||||
|
||||
if($session_role === 'sadmin'){
|
||||
|
||||
$details = $auth_model->getheringSuperAdminDetailsForHeader($session_uid);
|
||||
$data['company_name'] = $details[0]['site_name'];
|
||||
$data['company_short_name'] = $details[0]['site_title'];
|
||||
$data['company_address'] = $details[0]['company_address'];
|
||||
$data['company_mobile_no'] = $details[0]['company_mobile_no'];
|
||||
$data['company_email'] = $details[0]['company_email'];
|
||||
$data['loggedin_person'] = $session_uname;
|
||||
$data['loggedin_person_id'] = $session_uid;
|
||||
|
||||
$data['loggedin_person_role'] = $details[0]['role'];
|
||||
$data['favicon'] = !empty($details[0]['favicon']) && file_exists(FCPATH."public/uploads/".$details[0]['favicon']) ? base_url("public/uploads/".$details[0]['favicon']) : base_url("public/uploads/default.ico");
|
||||
$data['profile_picture'] = !empty($details[0]['profile_picture']) && file_exists(FCPATH."public/uploads/".$details[0]['profile_picture']) ? base_url("public/uploads/" . $details[0]['profile_picture']) : base_url("public/uploads/avatar.png");
|
||||
$data['company_logo_small'] = !empty($details[0]['company_logo_small']) && file_exists(FCPATH."public/uploads/".$details[0]['company_logo_small']) ? base_url("public/uploads/" . $details[0]['company_logo_small']) : base_url("public/uploads/default_logo.png");
|
||||
$data['company_logo_large'] = !empty($details[0]['company_logo_large']) && file_exists(FCPATH."public/uploads/".$details[0]['company_logo_large']) ? base_url("public/uploads/" . $details[0]['company_logo_large']) : base_url("public/uploads/default.png");
|
||||
|
||||
$data['loggedin_person'] = $session_uname;
|
||||
$session_bid = get_business_id();
|
||||
$data['bid'] = $session_bid;
|
||||
$data['footer_about'] = $details[0]['footer_about'];
|
||||
|
||||
return $data;
|
||||
}else{
|
||||
|
||||
$details = $auth_model->getheringDetailsForHeader($session_uid);
|
||||
$data['company_name'] = $details[0]['site_name'];
|
||||
$data['company_short_name'] = $details[0]['site_title'];
|
||||
$data['company_address'] = $details[0]['company_address'];
|
||||
$data['company_mobile_no'] = $details[0]['company_mobile_no'];
|
||||
$data['company_email'] = $details[0]['company_email'];
|
||||
$data['loggedin_person'] = $session_uname;
|
||||
$data['loggedin_person_id'] = $session_uid;
|
||||
|
||||
$data['loggedin_person_role'] = $details[0]['role'];
|
||||
$data['favicon'] = !empty($details[0]['favicon']) && file_exists(FCPATH."public/uploads/".$details[0]['favicon']) ? base_url("public/uploads/".$details[0]['favicon']) : base_url("public/uploads/default.ico");
|
||||
$data['profile_picture'] = !empty($details[0]['profile_picture']) && file_exists(FCPATH."public/uploads/".$details[0]['profile_picture']) ? base_url("public/uploads/" . $details[0]['profile_picture']) : base_url("public/uploads/avatar.png");
|
||||
$data['company_logo_small'] = !empty($details[0]['company_logo_small']) && file_exists(FCPATH."public/uploads/".$details[0]['company_logo_small']) ? base_url("public/uploads/" . $details[0]['company_logo_small']) : base_url("public/uploads/default_logo.png");
|
||||
$data['company_logo_large'] = !empty($details[0]['company_logo_large']) && file_exists(FCPATH."public/uploads/".$details[0]['company_logo_large']) ? base_url("public/uploads/" . $details[0]['company_logo_large']) : base_url("public/uploads/default.png");
|
||||
|
||||
$data['loggedin_person'] = $session_uname;
|
||||
$session_bid = get_business_id();
|
||||
$data['bid'] = $session_bid;
|
||||
$data['footer_about'] = $details[0]['footer_about'];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function reminderMessage(){
|
||||
|
||||
helper('session');
|
||||
$session_bid = get_business_id();
|
||||
// $reminderMessage = "";
|
||||
$reminderMessage = [];
|
||||
|
||||
// $c = 0; //count
|
||||
|
||||
$am = new AuthenticationModel();
|
||||
$bwhere = ['business_id'=> $session_bid,'isactive'=> 1];
|
||||
$getreminder = $am->getreminder($bwhere);
|
||||
|
||||
$reminderThreshold = 30; // Set the reminder days (e.g., 30 days before expiration)
|
||||
|
||||
if (!empty($getreminder['80G_vaildupto'])) {
|
||||
$expirationDate1 = strtotime($getreminder['80G_vaildupto']);
|
||||
$daysUntilExpiration1 = ($expirationDate1 - time()) / (60 * 60 * 24);
|
||||
if ($daysUntilExpiration1 <= $reminderThreshold && $daysUntilExpiration1 >= 0) {
|
||||
// $reminderMessage .= "Reminder: The 80G registration will expire in " . ceil($daysUntilExpiration1) . " days.";
|
||||
array_push($reminderMessage, "Reminder: The 80G registration will expire in " . ceil($daysUntilExpiration1) . " days.");
|
||||
// $c++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($getreminder['12AA_vaildupto'])) {
|
||||
$expirationDate2 = strtotime($getreminder['12AA_vaildupto']);
|
||||
$daysUntilExpiration2 = ($expirationDate2 - time()) / (60 * 60 * 24);
|
||||
if ($daysUntilExpiration2 <= $reminderThreshold && $daysUntilExpiration2 >= 0) {
|
||||
// $reminderMessage .= "<br> Reminder: The 12AA registration will expire in " . ceil($daysUntilExpiration2) . " days.";
|
||||
array_push($reminderMessage, "Reminder: The 12AA registration will expire in " . ceil($daysUntilExpiration2) . " days.");
|
||||
// $c++;
|
||||
}
|
||||
}
|
||||
return ["reminder"=>$reminderMessage];//,"count"=>$c];
|
||||
|
||||
}
|
||||
}
|
||||
150
app/Controllers/Books.php
Normal file
150
app/Controllers/Books.php
Normal file
@ -0,0 +1,150 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\BooksModel;
|
||||
|
||||
|
||||
class Books extends BaseController
|
||||
{
|
||||
## For Causes Listing
|
||||
public function index()
|
||||
{
|
||||
helper('session');
|
||||
if (is_session_active()) {
|
||||
$session_role = get_user_role();
|
||||
$session_bid = get_business_id();
|
||||
|
||||
|
||||
$default_financial_year_condition = [
|
||||
'causes.created_on >= CONCAT(YEAR(NOW()) - IF(MONTH(NOW()) >= 1 AND MONTH(NOW()) <= 3, 1, 0), "-01-01")',
|
||||
'causes.created_on < CONCAT(YEAR(NOW()) + IF(MONTH(NOW()) >= 1 AND MONTH(NOW()) <= 3, 1, 0), "-01-01")'
|
||||
];
|
||||
$where = ['causes.business_id' => $session_bid];
|
||||
// $where = array_merge($where, $default_financial_year_condition);
|
||||
|
||||
$model = new BooksModel();
|
||||
$model->setTable('causes');
|
||||
$data['cause_list'] = $model->getData('donations_accepted',null,null);
|
||||
$data['page_name'] = 'Causes List';
|
||||
$data['details'] = $model->where($where)->where('causes.isactive', 1)->findAll();
|
||||
$this->render_page('book_list', $data);
|
||||
} else {
|
||||
// Session is not active or user is not logged in
|
||||
return redirect()->to('login');
|
||||
}
|
||||
}
|
||||
|
||||
## To Load Causes Form (Add/Update)
|
||||
public function add_causes($id)
|
||||
{
|
||||
helper('session');
|
||||
$data['session_bid'] = get_business_id();
|
||||
|
||||
// Fetch categories from the model
|
||||
$model = new BooksModel();
|
||||
|
||||
if ($id === '0') {
|
||||
$data['page_name'] = 'Add Causes';
|
||||
$where = ['is_active' => 1 ];
|
||||
$data['cause_list'] = $model->getData('donations_accepted',$where,null);
|
||||
$data['details'] = [];
|
||||
} elseif ($id !== '0') {
|
||||
$data['page_name'] = 'Edit Causes';
|
||||
$where = ['is_active' => 1 ];
|
||||
$data['cause_list'] = $model->getData('donations_accepted',$where,null);
|
||||
$data['details'] = $model->where('causes.causes_id', $id)->findAll();
|
||||
|
||||
}
|
||||
|
||||
$this->render_page('book_form', $data);
|
||||
}
|
||||
|
||||
## For inserting/updating details of Cause
|
||||
public function insert_causes()
|
||||
{
|
||||
try{
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
$session_bid = get_business_id();
|
||||
|
||||
$BooksModel = new BooksModel();
|
||||
$data = [
|
||||
|
||||
'name' => $this->request->getPost('name'),
|
||||
'type' => $this->request->getPost('type'),
|
||||
'description' => $this->request->getPost('description'),
|
||||
'from_date' => ($this->request->getPost('from_date') != '') ? $this->request->getPost('from_date') : null,
|
||||
'to_date' => ($this->request->getPost('to_date') != '') ? $this->request->getPost('to_date') : null,
|
||||
'business_id'=>$session_bid
|
||||
|
||||
];
|
||||
$causes_id = $this->request->getPost('causes_id'); // Get the book ID for update purpose
|
||||
|
||||
if (empty($causes_id)) {
|
||||
|
||||
// It's an insert operation
|
||||
$data['isactive'] = 1;
|
||||
$data['created_by'] = $session_uid;
|
||||
$causes_id = $BooksModel->insert($data);
|
||||
|
||||
|
||||
if ($causes_id) {
|
||||
session()->setFlashdata('success', 'causes successfully created.');
|
||||
$this->logger->info("Books: has been added successfully. Inserted ID = " . $BooksModel->insertID());
|
||||
} else {
|
||||
session()->setFlashdata('error', 'causes could not be created. Please try again..');
|
||||
$this->logger->error("Books: Err could not be added. Please try again.");
|
||||
}
|
||||
} else {
|
||||
|
||||
// It's an update operation
|
||||
// $isactive = $this->request->getPost('isactive');
|
||||
// $data['isactive'] = ($isactive == 'on') ? 1 : 0;
|
||||
$data['isactive'] = 1;
|
||||
$data['updated_by'] = $session_uid;
|
||||
$BooksModel->update($causes_id, $data);
|
||||
|
||||
|
||||
if ($BooksModel->update($causes_id, $data)) {
|
||||
session()->setFlashdata('success', 'causes successfully updated.');
|
||||
$this->logger->info("Books: has been updated successfully. Updated Book ID = " . $causes_id);
|
||||
} else {
|
||||
session()->setFlashdata('error', 'causes updation failed. Please try again.');
|
||||
$this->logger->error("Books: Err Failed to update ID =" . $causes_id);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error("Book: Err Occur = ".$e->getMessage()." File = ". $e->getFile() . " Line = " . $e->getLine());
|
||||
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->route('causes_list');
|
||||
}
|
||||
|
||||
## For delete the causes details (Which means inactive the details)
|
||||
public function delete_causes($id)
|
||||
{
|
||||
try {
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
// print_r($session_uid);
|
||||
$BooksModel = new BooksModel();
|
||||
$data = ['isactive' => 0 , 'updated_by' => $session_uid];
|
||||
// print_r($data); die;
|
||||
|
||||
if ($BooksModel->update($id, $data)) {
|
||||
session()->setFlashdata('success', 'causes successfully deleted.');
|
||||
$this->logger->info("BOOK: has been Inactived successfully. Inactived ID = " . $id);
|
||||
} else {
|
||||
$this->logger->error("BOOK: Not able to Inactive ID =" . $id);
|
||||
throw new \Exception("Data Not able to Deleted");
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error("Book: Err Occur = ".$e->getMessage()." File = ". $e->getFile() . " Line = " . $e->getLine());
|
||||
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
|
||||
}
|
||||
return redirect()->route('causes_list');
|
||||
}
|
||||
|
||||
}
|
||||
346
app/Controllers/Business.php
Normal file
346
app/Controllers/Business.php
Normal file
@ -0,0 +1,346 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\BusinessModel;
|
||||
use CodeIgniter\Database\Exceptions\DatabaseException;
|
||||
|
||||
class Business extends BaseController
|
||||
{
|
||||
|
||||
## For Business Listing
|
||||
public function index()
|
||||
{
|
||||
helper('session');
|
||||
if (is_session_active()) {
|
||||
$session_role = get_user_role();
|
||||
if (!empty($session_role) && $session_role !== "sadmin") {
|
||||
$this->logger->info("Buiness: Listing In admin role .");
|
||||
$where = ['business_id' => (int)get_business_id(), 'isactive' => 1];
|
||||
} else {
|
||||
$this->logger->info("Buiness: Listing In Super-admin role .");
|
||||
$where = ['business_id !=' => 0,'isactive !=' => NULL];
|
||||
}
|
||||
$BusinessModel = new BusinessModel();
|
||||
$data['page_name'] = 'Organization Details';
|
||||
$data['organzations'] = $BusinessModel->where($where)->findAll();
|
||||
// $data['lastQuery'] = $BusinessModel->getLastQuery();
|
||||
// print_r($data);die;
|
||||
$this->render_page('business_list', $data);
|
||||
} else {
|
||||
return redirect()->to('login');
|
||||
}
|
||||
}
|
||||
|
||||
## For Organization Form (Add/Update)
|
||||
public function new_org($id)
|
||||
{
|
||||
helper('session');
|
||||
$session_role = get_user_role();
|
||||
$session_bid = get_business_id();
|
||||
$session_uid = get_logged_user_id();
|
||||
|
||||
if ($id === '0') {
|
||||
$data['page_name'] = 'Add Organization';
|
||||
$data['loged_user'] = $session_role;
|
||||
$data['organzations'] = [];
|
||||
$data['branches'] = [];
|
||||
$data['donation']=[];
|
||||
} else if ($id !== '0') {
|
||||
$data['page_name'] = 'Edit Organization';
|
||||
$data['loged_user'] = $session_role;
|
||||
$model = new BusinessModel();
|
||||
$model->setTable('business');
|
||||
|
||||
## Fetch business details (particular business)
|
||||
$edit_organzation_details = $model->where(['business_id ' => $id])->first();
|
||||
$data['organzations'] = $edit_organzation_details;
|
||||
|
||||
## Fetch branch details
|
||||
$branch_details = $model->getBranchesByBusinessId($id);
|
||||
$data['branches'] = $branch_details;
|
||||
|
||||
## Fetch donation details
|
||||
if ($session_role !== 'sadmin') {
|
||||
$donation_accepted=$model->getDonationBusinessData($id);
|
||||
$data['donation']=$donation_accepted;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$data['master_organzation_details']=$this->organzation_details();
|
||||
$data['session_bid']=$session_bid;
|
||||
$data['country_details'] = $this->get_country_details();
|
||||
// print_r($data['donation']);die;
|
||||
$this->render_page('business_form', $data);
|
||||
}
|
||||
|
||||
public function organzation_details()
|
||||
{
|
||||
helper('session');
|
||||
$session_role = get_user_role();
|
||||
$session_bid = get_business_id();
|
||||
|
||||
$model = new BusinessModel();
|
||||
$model->setTable('business');
|
||||
if($session_role === 'sadmin'){
|
||||
|
||||
$organzation_details = $model->where('business_id !=', 0)->orderBy('business_id', 'DESC')->findAll();
|
||||
}
|
||||
else{
|
||||
$organzation_details = $model->where('business_id', $session_bid)->findAll();
|
||||
|
||||
}
|
||||
return $organzation_details;
|
||||
}
|
||||
|
||||
|
||||
## For inserting/updating details of business
|
||||
public function insert_org()
|
||||
{
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
$session_role = get_user_role();
|
||||
$panNo = $this->request->getPost('pan_no');
|
||||
$BusinessModel = new BusinessModel();
|
||||
$businessId = $this->request->getPost('business_id');
|
||||
|
||||
$existingBusiness = $BusinessModel->where('pan_no', $panNo)->first();
|
||||
|
||||
if ($existingBusiness && $existingBusiness['business_id'] != $businessId) {
|
||||
// If it exists and it's not the same record being updated, show an error message
|
||||
session()->setFlashdata('error', 'The PAN number already exists.');
|
||||
return redirect()->back()->withInput(); // Redirect back with input data
|
||||
}
|
||||
|
||||
try {
|
||||
## logo
|
||||
$img = $this->request->getFile('business_logo');
|
||||
$filePath = 'public/uploads/' . $this->request->getPost('business_logo');
|
||||
$fileName = $img->getName();
|
||||
if ($fileName !== "") {
|
||||
if ($img->isValid() && !$img->hasMoved()) {
|
||||
$img->move(ROOTPATH . 'public/uploads', $fileName);
|
||||
}
|
||||
}
|
||||
|
||||
## favicon
|
||||
$favicon = $this->request->getFile('favicon');
|
||||
$faviconFileName = $favicon->getName();
|
||||
if ($faviconFileName !== "") {
|
||||
if ($favicon->isValid() && !$favicon->hasMoved()) {
|
||||
$favicon->move(ROOTPATH . 'public/uploads', $faviconFileName);
|
||||
}
|
||||
}
|
||||
|
||||
## signature
|
||||
$sign = $this->request->getFile('signature');
|
||||
$signFileName = $sign->getName();
|
||||
if ($signFileName !== "") {
|
||||
if ($sign->isValid() && !$sign->hasMoved()) {
|
||||
$sign->move(ROOTPATH . 'public/uploads', $signFileName);
|
||||
}
|
||||
}
|
||||
|
||||
## Business Data
|
||||
// print_r( $this->request->getPost('currency'));
|
||||
|
||||
$data = [
|
||||
'title' => $this->request->getPost('bname'),
|
||||
'email' => $this->request->getPost('bmail'),
|
||||
'mobile_no' => $this->request->getPost('bmobile'),
|
||||
'address' => $this->request->getPost('baddress'),
|
||||
'city' => $this->request->getPost('bcity'),
|
||||
'state' => $this->request->getPost('bstate'),
|
||||
'postal_code' => $this->request->getPost('bzip'),
|
||||
'pan_no' => $this->request->getPost('pan_no'),
|
||||
'org_reg_no' => $this->request->getPost('org_reg_no'),
|
||||
'terms' => $this->request->getPost('bterms'),
|
||||
'80G' => $this->request->getPost('80G'),
|
||||
'12AA' => $this->request->getPost('12AA'),
|
||||
'80G_vaildupto' => $this->request->getPost('80G_vaildupto'),
|
||||
'12AA_vaildupto' => $this->request->getPost('12AA_vaildupto'),
|
||||
'site_name' => $this->request->getPost('site_name'),
|
||||
'site_title' => $this->request->getPost('site_title'),
|
||||
'admin_email' => $this->request->getPost('admin_email'),
|
||||
'site_mobile'=> $this->request->getPost('site_mobile'),
|
||||
'copyright'=> $this->request->getPost('copyright'),
|
||||
'currency'=> serialize($this->request->getPost('currency')),
|
||||
'country'=> $this->request->getPost('country'),
|
||||
'start_no'=> $this->request->getPost('start_no'),
|
||||
'left_pad'=> $this->request->getPost('left_pad'),
|
||||
'prefix_format'=> $this->request->getPost('prefix_format'),
|
||||
];
|
||||
if ($fileName !== "") {
|
||||
$data['business_logo'] = $fileName;
|
||||
}
|
||||
if ($faviconFileName !== "") {
|
||||
$data['favicon'] = $faviconFileName;
|
||||
}
|
||||
if ($signFileName !== "") {
|
||||
$data['signature'] = $signFileName;
|
||||
}
|
||||
|
||||
$business_id = $this->request->getPost('business_id'); // Get the business ID for update
|
||||
// print_r($data);die;
|
||||
if (empty($business_id)) {
|
||||
// It's an insert operation
|
||||
$data['created_by'] = $session_uid;
|
||||
$businessId = $BusinessModel->insert($data);
|
||||
session()->setFlashdata('success', 'Organization details have been updated successfully.');
|
||||
} else {
|
||||
// It's an update operation
|
||||
$businessId = $business_id;
|
||||
$data['updated_by'] = $session_uid;
|
||||
$BusinessModel->update($business_id, $data);
|
||||
session()->setFlashdata('success', 'Organization details have been updated successfully.');
|
||||
}
|
||||
|
||||
## Donation Business Data (Note: not a super-admin means just updated only)
|
||||
if ($session_role !== 'sadmin') {
|
||||
$selectedDonations = $this->request->getPost('name');
|
||||
$BusinessModel->updateDonationData($businessId, $selectedDonations);
|
||||
}else if ($session_role === 'sadmin' && $businessId) {
|
||||
$BusinessModel->insertDonationBusiness($businessId);
|
||||
}
|
||||
|
||||
## Buiness Branch Data
|
||||
if(!empty($_POST['branch_name'])){
|
||||
$requestData = $this->request->getPost();
|
||||
$bb_result = $this->save_business_branch($requestData, $businessId);
|
||||
$this->logger->info("business branch: final message = " .implode(" ",$bb_result));
|
||||
}
|
||||
|
||||
if ($session_role === 'sadmin') {
|
||||
return redirect()->route('org_list');
|
||||
} else {
|
||||
return redirect()->to(base_url("new_org/{$business_id}"));
|
||||
}
|
||||
} catch (DatabaseException $e) {
|
||||
session()->setFlashdata('error', $e->getMessage());
|
||||
return redirect()->back()->withInput(); // Redirect back with input data
|
||||
}
|
||||
}
|
||||
|
||||
public function save_business_branch($requestData, $bid)
|
||||
{
|
||||
try {
|
||||
|
||||
$getBuinessBranchdetails = $this->get_business_branch($bid);
|
||||
|
||||
|
||||
$BBprimaryid = $requestData['id'] ; // Available Buiness Branch Primary IDS in Form Fields.
|
||||
|
||||
|
||||
$model = new BusinessModel();
|
||||
|
||||
## IF Any Missing value Means that values are Inactive here....
|
||||
if(!empty($BBprimaryid)){
|
||||
$this->logger->info("BuinessBranch: Primary ID = ".implode(",",$BBprimaryid));
|
||||
$filteringIds = [];
|
||||
for ($y = 0; $y < count($getBuinessBranchdetails); $y++) {
|
||||
$filteringIds[$y] = $getBuinessBranchdetails[$y]['id'];
|
||||
}
|
||||
|
||||
|
||||
if (!empty($filteringIds)) {
|
||||
$A = $filteringIds;
|
||||
$B = $BBprimaryid;
|
||||
$missingValues = array_diff($A, $B);
|
||||
if (!empty($missingValues)) {
|
||||
$where = ['isactive' => 1, 'business_id'=>$bid];
|
||||
$model->inactiveMissingBuinessBranchDetails($where, $missingValues);
|
||||
$this->logger->info("BuinessBranch: Inactived Missing Count = " . count($missingValues)." That Primary ID = ".implode(",",$BBprimaryid));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$count = count($BBprimaryid);
|
||||
|
||||
$branchData = [];
|
||||
if ($count > 0) {
|
||||
for ($x = 0; $x < $count; $x++) {
|
||||
$branchData[$x]['id'] = $requestData['id'][$x];
|
||||
$branchData[$x]['branch_name'] = $requestData['branch_name'][$x];
|
||||
$branchData[$x]['business_id'] = $bid;
|
||||
$branchData[$x]['email'] = $requestData['email'][$x];
|
||||
$branchData[$x]['mobile_no'] = $requestData['mobile_no'][$x];
|
||||
$branchData[$x]['address'] = $requestData['branchaddress'][$x];
|
||||
}
|
||||
|
||||
$statement = !empty($branchData) ? $model->saveBuinessBranchDetails($branchData) : ["No data found For buisness branch"];
|
||||
$this->logger->info("BuinessBranch: Final message = " . implode(",",$statement));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error("BuinessBranch: Err Occur = ".$e->getMessage()." File = ". $e->getFile() . " Line = " . $e->getLine());
|
||||
$statement = ['Message: ' . $e->getMessage()];
|
||||
}
|
||||
return $statement;
|
||||
}
|
||||
|
||||
public function get_business_branch($bid){
|
||||
$model = new BusinessModel();
|
||||
$model->setTable('business_branches');
|
||||
$where = ['business_id'=> (int)$bid , 'isactive' => 1];
|
||||
$details = $model->where($where)->findAll();
|
||||
return $details;
|
||||
}
|
||||
|
||||
## For delete the business details (Which means inactive the details)
|
||||
public function delete_org($id)
|
||||
{
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
$BusinessModel = new BusinessModel();
|
||||
|
||||
// Check if the business ID exists
|
||||
// $existingBusiness = $BusinessModel->find($id);
|
||||
// if (!$existingBusiness) {
|
||||
// return redirect()->route('org_list');
|
||||
// }
|
||||
|
||||
// Delete the business record
|
||||
$data['isactive'] = 0;
|
||||
$data['updated_by'] = $session_uid;
|
||||
$BusinessModel->update($id, $data);
|
||||
|
||||
return redirect()->route('org_list');
|
||||
}
|
||||
public function activate_org($id){
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
$BusinessModel = new BusinessModel();
|
||||
|
||||
$data['isactive'] = 1;
|
||||
$data['updated_by'] = $session_uid;
|
||||
$BusinessModel->update($id, $data);
|
||||
|
||||
return redirect()->route('org_list');
|
||||
}
|
||||
public function insertDonationBusiness($businessId)
|
||||
{
|
||||
$db = \Config\Database::connect();
|
||||
$donationData = $db->table('donation_accepted')
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
if (!empty($donationData)) {
|
||||
// Add business_id to each donation record
|
||||
foreach ($donationData as &$donation) {
|
||||
$donation['business_id'] = $businessId;
|
||||
}
|
||||
|
||||
// Insert data into donation_business table
|
||||
$db->table('donation_business')->insertBatch($donationData);
|
||||
}
|
||||
}
|
||||
|
||||
public function get_country_details()
|
||||
{
|
||||
$model = new BusinessModel();
|
||||
$model->setTable('countries');
|
||||
$country_details = $model->orderBy('country_id', 'ASC')->findAll();
|
||||
return $country_details;
|
||||
}
|
||||
}
|
||||
764
app/Controllers/Customer.php
Normal file
764
app/Controllers/Customer.php
Normal file
@ -0,0 +1,764 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\CustomerModel;
|
||||
use App\Models\SubscriptionModel;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Csv as ReaderCsv;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Xlsx as ReaderXlsx;
|
||||
use PhpOffice\PhpSpreadsheet\Cell\DataType;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
use CodeIgniter\Database\Exceptions\DatabaseException;
|
||||
|
||||
class Customer extends BaseController
|
||||
{
|
||||
|
||||
## For Customer Listing
|
||||
public function index()
|
||||
{
|
||||
helper('session');
|
||||
if (is_session_active()) {
|
||||
$session_role = get_user_role();
|
||||
$session_bid = get_business_id();
|
||||
$default_financial_year_condition = [
|
||||
'created_on >= CONCAT(YEAR(NOW()) - IF(MONTH(NOW()) >= 1 AND MONTH(NOW()) <= 3, 1, 0), "-01-01")',
|
||||
'created_on < CONCAT(YEAR(NOW()) + IF(MONTH(NOW()) >= 1 AND MONTH(NOW()) <= 3, 1, 0), "-01-01")'
|
||||
];
|
||||
|
||||
if (!empty($session_role) && $session_role !== "sadmin") {
|
||||
$this->logger->info("Donor: Listing In admin role . BID = ".$session_bid);
|
||||
$where = ['isactive' => 1, 'business_id' => (int)$session_bid];
|
||||
} else {
|
||||
$this->logger->info("Donor: Listing In Super-admin role .");
|
||||
$where = ['isactive != ' => NULL];
|
||||
}
|
||||
// $where = array_merge($where, $default_financial_year_condition);
|
||||
$CustomerModel = new CustomerModel();
|
||||
|
||||
$data['page_name'] = 'Contributor Details';
|
||||
$data['customer'] = $CustomerModel->where($where)->orderBy('donor_id', 'DESC')->findAll();
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($data); die();
|
||||
|
||||
$this->render_page('customer_list', $data);
|
||||
} else {
|
||||
return redirect()->to('login');
|
||||
}
|
||||
}
|
||||
|
||||
## To Load Donor Form (Add/Update)
|
||||
public function new_Donor($id)
|
||||
{
|
||||
helper('session');
|
||||
$session_bid = get_business_id();
|
||||
|
||||
if ($id === '0') {
|
||||
// Add Donor
|
||||
$data['page_name'] = 'Add Contributor Details';
|
||||
$data['customer'] = [];
|
||||
|
||||
} else if ($id !== '0') {
|
||||
|
||||
// Edit Donor
|
||||
$data['page_name'] = 'Edit Contributor Details';
|
||||
$customerModel = new CustomerModel();
|
||||
|
||||
// Retrieve customer details by customer ID
|
||||
$edit_user_details = $customerModel->where(['donor_id' => $id])->first();
|
||||
$data['customer'] = $edit_user_details;
|
||||
}
|
||||
|
||||
$data['session_bid'] = $session_bid;
|
||||
$data['country_details'] = $this->get_country_details();
|
||||
$data['state_details'] = $this->get_state_details();
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($data); die;
|
||||
|
||||
$this->render_page('customer_form', $data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function insert_ajaxdonor(){
|
||||
|
||||
helper('session');
|
||||
$model = new CustomerModel();
|
||||
|
||||
$session_uid = get_logged_user_id();
|
||||
$session_bid = get_business_id();
|
||||
|
||||
$pan = ($this->request->getPost('pan_no') == '') ? $this->request->getPost('o_pan_no') : $this->request->getPost('pan_no');
|
||||
|
||||
$existingDonor = $model->where('pan_no', $pan)->first();
|
||||
|
||||
if ($existingDonor) {
|
||||
$results = ['status' => false, 'message' => 'The PAN number already exists.','donor_id' => ''];
|
||||
return $this->response->setJSON(['data' => $results]);
|
||||
}
|
||||
try {
|
||||
$data = [
|
||||
'first_name' => $this->request->getPost('cfname'),
|
||||
'mobile_no' => $this->request->getPost('mobile'),
|
||||
'email' => $this->request->getPost('cmail'),
|
||||
'pan_no' => $pan,
|
||||
'donor_type' => $this->request->getPost('DonorType'),
|
||||
'org_name' => $this->request->getPost('org_name') !== '' || $this->request->getPost('org_name') !== null ? $this->request->getPost('org_name') : NULL,
|
||||
'org_reg_details'=> $this->request->getPost('org_reg_Details'),
|
||||
'business_id' => $session_bid,
|
||||
'isactive' => 1,
|
||||
'created_by' => $session_uid
|
||||
];
|
||||
|
||||
if ($model->insert($data)) {
|
||||
$results = ['status' => true, 'message' => 'added successfully','donor_id' => $model->insertID()];
|
||||
}else {
|
||||
$results = ['status' => false, 'message' => 'could not be added','donor_id' => ''];
|
||||
}
|
||||
|
||||
$donor_where = ['business_id' => (int)get_business_id() , 'isactive' => 1, 'donor_type'=>$this->request->getPost('DonorType')];
|
||||
$results['donor'] = $model->getData('donor', $donor_where);
|
||||
return $this->response->setJSON(['data' => $results]);
|
||||
} catch (DatabaseException $e) {
|
||||
$results = ['status' => false, 'message' => 'could not be added DB Error Occur','donor_id' => '','error'=>$e->getMessage()];
|
||||
return $this->response->setJSON(['data' => $results]);
|
||||
}
|
||||
}
|
||||
public function insert_donor()
|
||||
{
|
||||
$requestData = $this->request->getPost();
|
||||
// print_r($requestData);die;
|
||||
$this->logger->info("Donor: Inserting/Updating Details");
|
||||
try {
|
||||
helper('session');
|
||||
$session_bid = get_business_id();
|
||||
$session_uid = get_logged_user_id();
|
||||
$session_role = get_user_role();
|
||||
$model = new CustomerModel();
|
||||
$dob = $this->request->getPost('dob');
|
||||
$pan = ($this->request->getPost('pan_no') == '') ? $this->request->getPost('o_pan_no') : $this->request->getPost('pan_no');
|
||||
$dob = (isset($dob) && $dob != "") ? $dob : NULL ;
|
||||
$data = [
|
||||
'first_name' => $this->request->getPost('cfname'),
|
||||
'last_name' => $this->request->getPost('csname'),
|
||||
'mobile_no' => $this->request->getPost('mobile'),
|
||||
'email' => $this->request->getPost('cmail'),
|
||||
'date_of_birth' => $dob,
|
||||
'pan_no' => $pan,
|
||||
'adhar_no' => $this->request->getPost('adhar_no'),
|
||||
'passport_no' => $this->request->getPost('DonorType') == 'individual' && $this->request->getPost('passport_no') ? $this->request->getPost('passport_no') : null,
|
||||
'donor_type' => $this->request->getPost('DonorType'),
|
||||
'org_name' => $this->request->getPost('org_name') !== '' || $this->request->getPost('org_name') !== null ? $this->request->getPost('org_name') : NULL,
|
||||
'org_reg_details'=> $this->request->getPost('org_reg_Details'),
|
||||
'address' => $this->request->getPost('address'),
|
||||
'city' => $this->request->getPost('city'),
|
||||
'state' => $this->request->getPost('state') ? $this->request->getPost('state') : $this->request->getPost('state_text'),
|
||||
'postal_code' => $this->request->getPost('zip'),
|
||||
'country' => $this->request->getPost('country'),
|
||||
'business_id' => $this->request->getPost('business_id'),
|
||||
|
||||
];
|
||||
|
||||
// print_r($data);
|
||||
// echo $this->db->getLastQuery();die();
|
||||
$donor_id = $this->request->getPost('donor_id'); // Get the business ID for update
|
||||
if (empty($donor_id)) {
|
||||
|
||||
// It's an insert operation
|
||||
$data['isactive'] = 1;
|
||||
$data['created_by'] = $session_uid;
|
||||
if ($model->insert($data)) {
|
||||
session()->setFlashdata('success', 'Donor successfully created.');
|
||||
$this->logger->info("Donor : has been added successfully. Inserted ID = " . $model->insertID());
|
||||
$donor_id_for_addresses = $model->insertID();// for Donor ADDRESS Table
|
||||
} else {
|
||||
session()->setFlashdata('error', 'Donor could not be added. Please try again..');
|
||||
$this->logger->error("Donor: Err could not be added. Please try again.");
|
||||
$donor_id_for_addresses = "";
|
||||
}
|
||||
} else {
|
||||
// It's an update operation
|
||||
if ($session_role !== 'volunteer') {
|
||||
$isactive = $this->request->getPost('isactive');
|
||||
$data['isactive'] = ($isactive == 'on') ? 1 : 0;
|
||||
}
|
||||
$data['updated_by'] = $session_uid;
|
||||
$data['isactive'] = 1;
|
||||
$donor_id_for_addresses = $donor_id;
|
||||
// for Customer ADDRESS Table
|
||||
if ($model->update($donor_id, $data)) {
|
||||
session()->setFlashdata('success', 'Donor successfully updated');
|
||||
$this->logger->info("Donor: has been updated successfully. Updated Donor ID = " . $donor_id_for_addresses);
|
||||
} else {
|
||||
session()->setFlashdata('error', 'Donor updation failed. Please try again.');
|
||||
$this->logger->error("Donor: Err Failed to update ID =" . $donor_id_for_addresses);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error("Donor : Err Occur =" . $e->getMessage());
|
||||
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
|
||||
}
|
||||
|
||||
if(isset($requestData['new_receipt']))
|
||||
{
|
||||
// return redirect()->route('new_receipt');
|
||||
return redirect()->back();
|
||||
}
|
||||
else
|
||||
{
|
||||
return redirect()->route('Contributor_list');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
## For delete the customer details (Which means inactive the details)
|
||||
public function delete_donor($id)
|
||||
{
|
||||
try {
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
$CustomerModel = new CustomerModel();
|
||||
$where = ['donor_id' => (int)$id, 'isactive =' => 1];
|
||||
|
||||
// Check if the business ID exists
|
||||
$existingCustomer = $CustomerModel->where($where)->find($id);
|
||||
if ($existingCustomer) {
|
||||
$this->logger->Info("Donor: Going to Inactive ID = ".$id);
|
||||
$data = ['isactive' => 0 , 'updated_by' => $session_uid];
|
||||
// Delete the business record
|
||||
if ($CustomerModel->update($id, $data)) {
|
||||
session()->setFlashdata('success', 'Donor successfully deleted.');
|
||||
$this->logger->info("Donor: has been Inactived successfully. Inactived ID = " . $id);
|
||||
} else {
|
||||
$this->logger->error("Donor: Not able to Inactive ID =" . $id);
|
||||
throw new \Exception("Data Not able to Deleted");
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error("Customer: Err Occur = " . $e->getMessage());
|
||||
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
|
||||
}
|
||||
return redirect()->route('Contributor_list');
|
||||
}
|
||||
|
||||
public function get_customer_address($id,$type){
|
||||
$model = new CustomerModel();
|
||||
$model->setTable('customer_addresses');
|
||||
$where = ['isactive' => 1, 'donor_id' => (int)$id,'address_type'=>(int)$type];
|
||||
$address_details = $model->where($where)->findAll();
|
||||
return $address_details;
|
||||
}
|
||||
|
||||
public function get_country_details()
|
||||
{
|
||||
$model = new CustomerModel();
|
||||
$model->setTable('countries');
|
||||
$country_details = $model->orderBy('country_id', 'ASC')->findAll();
|
||||
return $country_details;
|
||||
}
|
||||
|
||||
public function get_state_details()
|
||||
{
|
||||
$model = new CustomerModel();
|
||||
$model->setTable('states');
|
||||
$state_details = $model->orderBy('state_id', 'ASC')->findAll();
|
||||
return $state_details;
|
||||
}
|
||||
|
||||
public function donor_group(){
|
||||
|
||||
$session_bid = get_business_id();
|
||||
$data['page_name'] = 'Contributor Group Details';
|
||||
$model = new CustomerModel();
|
||||
$data['donor_group'] = $model->getGroupDetails($session_bid);
|
||||
$this->render_page('customer_group', $data);
|
||||
}
|
||||
|
||||
|
||||
public function view_donor_group($id){
|
||||
|
||||
helper('session');
|
||||
$session_bid = get_business_id();
|
||||
|
||||
$data['field'] = [
|
||||
['value'=>'', 'fieldflag'=>1, 'text'=> 'Choose the Field', 'disable' => false],
|
||||
['value'=>'C.donor_type', 'fieldflag'=>1, 'text'=> 'Donor Type', 'disable' => false],
|
||||
['value'=>'C.city', 'fieldflag'=>1, 'text'=> 'City', 'disable' => false],
|
||||
['value'=>'C.postal_code', 'fieldflag'=>1, 'text'=> 'Postal Code', 'disable' => false],
|
||||
['value'=>'I.receipt_date', 'fieldflag'=>2, 'text'=> 'Receipt Date', 'disable' => false],
|
||||
];
|
||||
|
||||
$data['operator'] = [
|
||||
'' => 'Choose the operator',
|
||||
'equal' => 'Equal to (=)',
|
||||
'not equal' => 'Not Equal (!=)',
|
||||
'like' => 'Like (%)',
|
||||
'greater than' => 'Greater than (>)',
|
||||
'greater than or equal to' => 'Greater than or Equal to (>=)',
|
||||
'less than' => 'Less than (<)',
|
||||
'less than or equal to' => 'Less than or Equal to (<=)',
|
||||
'contain' => 'Contain (in)',
|
||||
'not contain' => 'Not Contain (not in)',
|
||||
'between' => 'Between',
|
||||
'is null' => 'Is NULL',
|
||||
'is not null' => 'Is Not NULL',
|
||||
];
|
||||
$data['donor_group'] = [];
|
||||
|
||||
if ($id === '0') {
|
||||
// Add Customer
|
||||
$data['page_name'] = 'Add Contributor Group';
|
||||
} else if ($id !== '0') {
|
||||
// Edit Customer
|
||||
$data['page_name'] = 'Edit Contributor Group';
|
||||
|
||||
// Load your Customer Model
|
||||
$model = new CustomerModel();
|
||||
$model->setTable('donor_groups');
|
||||
$where = ['group_id'=>$id];
|
||||
$result = $model->where($where)->findAll();
|
||||
|
||||
if (!empty($result)) {
|
||||
$data['donor_group']['groupname'] = $result[0]['group_name'];
|
||||
$data['donor_group']['column'] = $result[0]['column'] ? unserialize($result[0]['column']) : [];
|
||||
$data['donor_group']['operator'] = $result[0]['operator'] ? unserialize($result[0]['operator']) : [];
|
||||
$data['donor_group']['values'] = $result[0]['value'] ? unserialize($result[0]['value']) : [];
|
||||
$data['donor_group']['group_id'] = $result[0]['group_id'];
|
||||
$data['donor_group']['isactive'] = $result[0]['isactive'];
|
||||
}
|
||||
}
|
||||
$this->render_page('customer_group_form', $data);
|
||||
}
|
||||
|
||||
|
||||
public function preview_donor_group($id){
|
||||
try {
|
||||
helper('session');
|
||||
$model = new CustomerModel();
|
||||
$model->setTable('donor_groups');
|
||||
$where = ['isactive' => 1,'group_id'=>$id];
|
||||
$result = $model->where($where)->findAll();
|
||||
$db = \Config\Database::connect();
|
||||
$sql = (string)$result[0]['group_query'];
|
||||
|
||||
if($sql){
|
||||
$query = $db->query($sql);
|
||||
$results = $query->getResultArray();
|
||||
if(empty($results)){
|
||||
throw new \Exception("Data Not Available");
|
||||
}else{
|
||||
return $this->response->setJSON($results);
|
||||
}
|
||||
}else{
|
||||
return $this->response->setJSON([]);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error("Donor Group: Err Occur = ".$e->getMessage()." File = ". $e->getFile() . " Line = " . $e->getLine());
|
||||
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
public function delete_donor_group($id){
|
||||
try {
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
$model = new CustomerModel();
|
||||
$model->setTable('donor_groups');
|
||||
$where = ['isactive' => 1,'group_id'=>(int)$id];
|
||||
$result = $model->where($where)->findAll();
|
||||
if ($result) {
|
||||
$this->logger->Info("Donor Group: Going to Inactive ID = ".$id);
|
||||
$data = ['isactive' => 0 , 'updated_by' => $session_uid,'group_id'=>(int)$id];
|
||||
$statement = $model->saveGroupDetails($data);// just updating Inactive status only.
|
||||
if ($statement['success']) {
|
||||
session()->setFlashdata('success', $statement['success'] ? 'Deleted successfully.' : "" );
|
||||
$this->logger->info($statement['log']);
|
||||
} else if ($statement['error']) {
|
||||
session()->setFlashdata('error', $statement['error']);
|
||||
$this->logger->error($statement['log']);
|
||||
}else{
|
||||
throw new \Exception("Donor Group: Err Occur on data the Donor Group Inactive");
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error("Donor Group: Err Occur = ".$e->getMessage()." File = ". $e->getFile() . " Line = " . $e->getLine());
|
||||
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
|
||||
}
|
||||
return redirect()->route('donor_group');
|
||||
|
||||
}
|
||||
public function insert_donor_group(){
|
||||
try {
|
||||
$this->logger->info("Donor Group: Inserting/Updating Details");
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
$request_data = $this->request->getPost();
|
||||
$string_flag = $request_data['string_flag'];
|
||||
// $this->logger->info("Customer Group: Request data = ".json_encode($request_data));
|
||||
|
||||
$session_bid = get_business_id();
|
||||
$model = new CustomerModel();
|
||||
// Array ( [groupname] => nil [column] => Array ( [0] => city [1] => state ) [operator] => Array ( [0] => not contain [1] => not equal ) [values] => Array ( [0] => 2 [1] => 3 ) )
|
||||
$data = [
|
||||
'group_name' => $request_data['groupname'],
|
||||
'column' => serialize($request_data['column']),
|
||||
'operator' => serialize($request_data['operator']),
|
||||
'value' => serialize($request_data['values']),
|
||||
];
|
||||
|
||||
$data['business_id'] = $session_bid;
|
||||
|
||||
// Initialize an empty array to store the conditions
|
||||
$conditions = array();
|
||||
|
||||
// Loop through the elements and build the conditions
|
||||
for ($i = 0; $i < count($request_data['column']); $i++) {
|
||||
$column = $request_data['column'][$i];
|
||||
$operator = $request_data['operator'][$i];
|
||||
$value = $request_data['values'][$i];
|
||||
// Handle different operators and build corresponding conditions
|
||||
switch ($operator) {
|
||||
case 'equal':
|
||||
$conditionStrings[] = "LOWER($column) = LOWER('$value') ";
|
||||
break;
|
||||
case 'not equal':
|
||||
$conditionStrings[] = "LOWER($column) <> LOWER('$value') ";
|
||||
break;
|
||||
case 'like':
|
||||
$conditionStrings[] = "LOWER($column) LIKE '%$value%'";
|
||||
break;
|
||||
case 'contain':
|
||||
case 'in':
|
||||
$values = explode(',', $value);
|
||||
$conditionStrings[] = "LOWER($column) IN ('" . implode("', '", $values) . "')";
|
||||
break;
|
||||
case 'not contain':
|
||||
case 'not in':
|
||||
$values = explode(',', $value);
|
||||
$conditionStrings[] = "LOWER($column) NOT IN ('" . implode("', '", $values) . "')";
|
||||
break;
|
||||
case 'between':
|
||||
$dates = explode(',', $value);
|
||||
$conditionStrings[] = "$column BETWEEN '$dates[0]' AND '$dates[1]'";
|
||||
break;
|
||||
case 'greater than':
|
||||
$conditionStrings[] = "$column > $value";
|
||||
break;
|
||||
case 'greater than or equal to':
|
||||
$conditionStrings[] = "$column >= $value";
|
||||
break;
|
||||
case 'less than':
|
||||
$conditionStrings[] = "$column < $value";
|
||||
break;
|
||||
case 'less than or equal to':
|
||||
$conditionStrings[] = "$column <= $value";
|
||||
break;
|
||||
case 'is null':
|
||||
$conditionStrings[] = "$column IS NULL";
|
||||
break;
|
||||
case 'is not null':
|
||||
$conditionStrings[] = "$column IS NOT NULL";
|
||||
break;
|
||||
case '':
|
||||
throw new \Exception("Data Not Found");
|
||||
}
|
||||
}
|
||||
|
||||
// Join the conditions with 'AND'
|
||||
$whereCondition = implode(' AND ', $conditionStrings);
|
||||
// echo "*************** whereCondition =>>> ";
|
||||
// echo $whereCondition;
|
||||
// If a groupname is specified, include it in the condition
|
||||
// if ($conditionsArray['groupname'] !== 'nil') {
|
||||
// $whereCondition = "($whereCondition) AND groupname = '{$conditionsArray['groupname']}'";
|
||||
// }
|
||||
|
||||
// Now you can use $whereCondition in your SQL query
|
||||
$db = \Config\Database::connect();
|
||||
// $sql = "SELECT donor_id,CONCAT(first_name,'',last_name) as customer_name,email,mobile_no FROM donor WHERE ".$whereCondition;
|
||||
$sql = "SELECT C.city, C.state, I.receipt_date, C.donor_id, CONCAT(C.first_name, ' ', C.last_name) as customer_name, C.email, C.mobile_no, C.isactive, COUNT(I.receipt_id) as invoice_count_raised_by_customer FROM donor as C
|
||||
LEFT JOIN receipt I ON I.donor_id = C.donor_id and I.isactive = 1
|
||||
WHERE C.isactive = 1 AND " . $whereCondition . "
|
||||
GROUP BY C.donor_id";
|
||||
|
||||
$this->logger->info("Customer Group: SQL = ".$sql);
|
||||
|
||||
// echo "$sql"; die;
|
||||
|
||||
// Execute the query
|
||||
$query = $db->query($sql);
|
||||
|
||||
// Get the result
|
||||
$results = $query->getResult();
|
||||
$this->logger->info("Customer Group: ".json_encode($results));
|
||||
$group_id = $request_data['group_id']; // Get the ID for update
|
||||
$isactive = $group_id != "" ? $request_data['isactive'] : 'on';
|
||||
if($string_flag == "save"){
|
||||
$data['group_query'] = $sql;
|
||||
$data['group_id'] = $group_id;
|
||||
$data['isactive'] = (($isactive == 'on') ? 1 : 0);
|
||||
$data['created_by'] = $session_uid;
|
||||
$data['updated_by'] = $session_uid;
|
||||
$statement = $model->saveGroupDetails($data);
|
||||
if ($statement['success']) {
|
||||
session()->setFlashdata('success', $statement['success']);
|
||||
$this->logger->info($statement['log']);
|
||||
|
||||
} else if ($statement['error']) {
|
||||
session()->setFlashdata('error', $statement['error']);
|
||||
$this->logger->error($statement['log']);
|
||||
}else{
|
||||
throw new \Exception("Donor Group: Err Occur on data the Save");
|
||||
}
|
||||
|
||||
}else if($string_flag == "preview"){
|
||||
return $this->response->setJSON($results);
|
||||
}else{
|
||||
throw new \Exception("Data Not Found");
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error("Donor Group: Err Occur = ".$e->getMessage()." File = ". $e->getFile() . " Line = " . $e->getLine());
|
||||
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
|
||||
}
|
||||
return redirect()->route('donor_group');
|
||||
}
|
||||
|
||||
public function getReceiptDetails($donorId)
|
||||
{
|
||||
$CustomerModel = new CustomerModel();
|
||||
|
||||
$receiptDetails = $CustomerModel->getReceiptDetailsByDonorId($donorId);
|
||||
|
||||
return $this->response->setJSON($receiptDetails);
|
||||
}
|
||||
|
||||
public function export_donor()
|
||||
{
|
||||
helper('session');
|
||||
|
||||
$session_bid = get_business_id();
|
||||
|
||||
$CustomerModel = new CustomerModel();
|
||||
|
||||
$data = $CustomerModel->export_excel($session_bid);
|
||||
|
||||
$spreadsheet = new Spreadsheet();
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
$sheet->mergeCells('B3:P3');
|
||||
$sheet->getStyle('B3')->getAlignment()->setHorizontal('center');
|
||||
$sheet->setTitle('Contributor details');
|
||||
|
||||
$headers = [
|
||||
'B3' => 'Contributor Details',
|
||||
'A5' => 'Contributor Name',
|
||||
'B5' => 'Contributor Type',
|
||||
'C5' => 'Organization Name',
|
||||
'D5' => 'Organization Reg Details',
|
||||
'E5' => 'Contact Number',
|
||||
'F5' => 'Email Address',
|
||||
'G5' => 'PAN',
|
||||
'H5' => 'Aadhaar Number',
|
||||
'I5' => 'Passport Number',
|
||||
'J5' => 'Address',
|
||||
'K5' => 'Country',
|
||||
'L5' => 'State',
|
||||
'M5' => 'City',
|
||||
'N5' => 'Postal Code',
|
||||
'O5' => 'CreatedBy',
|
||||
'P5' => 'UpdatedBy',
|
||||
'Q5' => 'CreatedAt',
|
||||
'R5' => 'UpdatedAt',
|
||||
'S5' => 'IsActive'
|
||||
];
|
||||
|
||||
foreach ($headers as $cell => $value) {
|
||||
$sheet->setCellValue($cell, $value);
|
||||
$sheet->getStyle($cell)->getFont()->setSize($cell == 'B3' ? 14 : 12);
|
||||
$sheet->getStyle($cell)->getFont()->setBold(true);
|
||||
}
|
||||
|
||||
if ($data) {
|
||||
$row = 6;
|
||||
foreach ($data as $d) {
|
||||
$col = 'A'; // Start from column A
|
||||
foreach ($d as $value) {
|
||||
|
||||
|
||||
if (is_numeric($value)) {
|
||||
$sheet->setCellValueExplicit($col . $row, $value, DataType::TYPE_STRING);
|
||||
$sheet->getStyle($col . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_NUMBER);
|
||||
} else {
|
||||
$sheet->setCellValue($col . $row, $value);
|
||||
}
|
||||
$sheet->setCellValue($col . $row, $value);
|
||||
$col++;
|
||||
}
|
||||
$row++;
|
||||
}
|
||||
}
|
||||
|
||||
ob_clean();
|
||||
|
||||
$writer = new Xlsx($spreadsheet);
|
||||
$filename = 'exportDonor.xlsx';
|
||||
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="'. $filename .'"');
|
||||
header('Cache-Control: max-age=0');
|
||||
header('Expires: 0');
|
||||
header('Pragma: public');
|
||||
|
||||
$writer->save('php://output');
|
||||
exit;
|
||||
}
|
||||
|
||||
public function import_donor()
|
||||
{
|
||||
|
||||
$ip_address = $_SERVER['REMOTE_ADDR'];
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
$session_bid = get_business_id();
|
||||
|
||||
$response = []; // Arr - response For Message FrontEnd
|
||||
$list = []; // Arr - Store on DB
|
||||
$path = ROOTPATH . 'public/import/donor/';
|
||||
$fileNewName = "";
|
||||
|
||||
$file = $this->request->getFile('file');
|
||||
|
||||
if (!is_dir($path)) {
|
||||
mkdir($path, 0777, true);
|
||||
}
|
||||
$fileName = $file->getName();
|
||||
if ($fileName !== "") {
|
||||
if ($file->isValid() && !$file->hasMoved()) {
|
||||
$newName = $file->getRandomName();
|
||||
$file->move($path, $newName);
|
||||
$fileNewName = $newName;
|
||||
}
|
||||
}
|
||||
if (!$fileNewName) {
|
||||
$response = ['error_message' => "Failed to upload file"];
|
||||
return $this->response->setJSON($response);
|
||||
}
|
||||
|
||||
$arr_file = explode('.', $fileName);
|
||||
$extension = $arr_file[1];
|
||||
if ('csv' == $extension) {
|
||||
$reader = new ReaderCsv();
|
||||
} else if ('xlsx' == $extension) {
|
||||
$reader = new ReaderXlsx();
|
||||
} else {
|
||||
$response = ['error_message' => "Unsupported file type"];
|
||||
return $this->response->setJSON($response);
|
||||
}
|
||||
|
||||
if (!$reader) {
|
||||
$response = ['error_message' => "Failed to initialize reader"];
|
||||
return $this->response->setJSON($response);
|
||||
}
|
||||
|
||||
$spreadsheet = $reader->load($path.$fileNewName);
|
||||
$sheet_data = $spreadsheet->getActiveSheet()->toArray();
|
||||
if (!empty($sheet_data)) {
|
||||
$final_notes = [];
|
||||
$list = [];
|
||||
foreach ($sheet_data as $key => $val) {
|
||||
|
||||
if ($key != 0 && trim($val[0]) && trim($val[1])) { // key zero - header
|
||||
// $flag = 0;
|
||||
$is_duplicate = false;
|
||||
$notes = [];
|
||||
$invalid_fields = [];
|
||||
if($val[6] != ""){
|
||||
if ($this->check_existing($val[6], 'donor', 'pan_no')) {
|
||||
$is_duplicate = true;
|
||||
$invalid_fields[] = "PAN number";
|
||||
}
|
||||
}
|
||||
if($val[7] != ""){
|
||||
if ($this->check_existing($val[7], 'donor', 'adhar_no')) {
|
||||
$is_duplicate = true;
|
||||
$invalid_fields[] = "Aadhar number";
|
||||
}
|
||||
}
|
||||
if($val[8] != ""){
|
||||
if ($this->check_existing($val[8], 'donor', 'passport_no')) {
|
||||
$is_duplicate = true;
|
||||
$invalid_fields[] = "passport number";
|
||||
}
|
||||
}
|
||||
if ($is_duplicate) {
|
||||
$notes[] = $val[0] . " is invalid because " . implode(" and ", $invalid_fields) . " (already exists)";
|
||||
}
|
||||
|
||||
|
||||
if ($is_duplicate) {
|
||||
$final_notes = array_merge($final_notes, $notes);
|
||||
} else {
|
||||
$list[] = [
|
||||
'business_id' => $session_bid,
|
||||
'first_name' => $val[0],
|
||||
'donor_type' => strtolower($val[1]),
|
||||
'org_name' => $val[2] ? $val[2] : null,
|
||||
'org_reg_details' => $val[3] ? $val[3] : null,
|
||||
'mobile_no' => $val[4] ? $val[4] : null,
|
||||
'email' => $val[5],
|
||||
'pan_no' => $val[6],
|
||||
'adhar_no' => $val[7] ? $val[7] : null,
|
||||
'passport_no' => $val[8] ? $val[8] : null,
|
||||
'address' => $val[9] ? $val[9] : null,
|
||||
'country' => $val[10] ? $val[10] : null,
|
||||
'state' => $val[11] ? $val[11] : null,
|
||||
'city' => $val[12] ? $val[12] : null,
|
||||
'postal_code' => $val[13] ? $val[13] : null,
|
||||
'created_by' => $session_uid,
|
||||
'XL_file_name' => $fileNewName,
|
||||
'ip_address' => $ip_address
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (count($list) > 0) {
|
||||
$CustomerModel = new CustomerModel();
|
||||
$result = $CustomerModel->bulkInsert($list);
|
||||
$response = $result ? [
|
||||
'success_message' => count($list) . " Contributors imported successfully.".(count($final_notes) > 0 ? count($final_notes) . " duplicate entries found. <br>" : ""),
|
||||
] : ['error_message' => "Something went wrong. Please try again."];
|
||||
$response['message_in_details'] = implode(" <br> ", $final_notes);
|
||||
} else {
|
||||
$response = [
|
||||
'error_message' => "No new record is found.",
|
||||
'message_in_details' => implode(" <br> ", $final_notes),
|
||||
]; }
|
||||
} else {
|
||||
$response = ['error_message' => "There is no record to import", 'message_in_details' => ''];
|
||||
}
|
||||
return $this->response->setJSON($response);
|
||||
}
|
||||
|
||||
public function check_existing($value, $table, $field) {
|
||||
$model = new CustomerModel();
|
||||
$model->setTable($table);
|
||||
$where = [$field => $value];
|
||||
$check_existing = $model->where($where)->findAll();
|
||||
|
||||
$statement_string = ucfirst(str_replace('_', ' ', $field));
|
||||
$notes = '';
|
||||
if (!empty($check_existing)) {
|
||||
$notes = $statement_string . " already exists";
|
||||
}
|
||||
return $notes;
|
||||
}
|
||||
}
|
||||
@ -1,470 +0,0 @@
|
||||
<?php namespace App\Controllers;
|
||||
|
||||
use App\Models\Dashboard_model;
|
||||
use App\Models\Receipt_model;
|
||||
use App\Models\Transaction_model;
|
||||
use App\Models\Donation_data_model;
|
||||
use App\Models\My_model;
|
||||
use App\Models\Donation_cause;
|
||||
use App\Models\Donor_model;
|
||||
|
||||
class Dashboard extends BaseController
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->dModel = new Dashboard_model();
|
||||
$this->rModel = new Receipt_model();
|
||||
$this->tModel = new Transaction_model();
|
||||
$this->ddModel = new Donation_data_model();
|
||||
$this->MyModel = new My_model();
|
||||
$this->dcModel = new Donation_cause();
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
|
||||
$data = [];
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
|
||||
$id= session()->get('logged_user');
|
||||
$data['userdata']=$this->dModel->getLoggedInUserData($id);
|
||||
// echo view('templates/header',$data);
|
||||
// echo view('dashboard');
|
||||
// echo view('templates/footer');
|
||||
return view('dashboard');
|
||||
}
|
||||
public function logout()
|
||||
{
|
||||
session()->remove('logged_user');
|
||||
session()->destroy();
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
|
||||
function fetch_donor_id()
|
||||
{
|
||||
echo $this->MyModel->fetch_donor_id();
|
||||
}
|
||||
function edit_donor_id($receipt_id)
|
||||
{
|
||||
echo $receipt_id; die();
|
||||
echo $this->MyModel->edit_donor_id();
|
||||
}
|
||||
function fetch_cause_name()
|
||||
{
|
||||
echo $this->dcModel->fetch_cause_name();
|
||||
}
|
||||
|
||||
public function receipts()
|
||||
{
|
||||
$data = [];
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
|
||||
$name= session()->get('logged_user');
|
||||
return view('receipts');
|
||||
// echo view('templates/header');
|
||||
// echo view('receipts');
|
||||
// echo view('templates/footer');
|
||||
}
|
||||
|
||||
|
||||
public function generate_receipts()
|
||||
{
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
|
||||
$donor_id=$this->request->getVar('donor_id');
|
||||
$mymodel = new My_model();
|
||||
$donor = $mymodel->find($donor_id);
|
||||
$donor_name = $donor['name'];
|
||||
|
||||
$cause_id=$this->request->getVar('cause_id');
|
||||
$causemodel = new Donation_cause();
|
||||
$cause = $causemodel->find($cause_id);
|
||||
$cause_name = $cause['cause_name'];
|
||||
|
||||
$receiptData=[
|
||||
|
||||
'date' =>$this->request->getVar('date'),
|
||||
'donor_id' =>$this->request->getVar('donor_id'),
|
||||
'donor_name' =>$donor_name,
|
||||
'amount' =>$this->request->getVar('amount'),
|
||||
'mode_of_receipt' =>$this->request->getVar('mode_of_receipt'),
|
||||
'receipt_details' =>$this->request->getVar('receipt_details'),
|
||||
'cause_id' =>$this->request->getVar('cause_id'),
|
||||
'cause_name' =>$cause_name,
|
||||
'remarks' =>$this->request->getVar('remarks'),
|
||||
];
|
||||
//print_r($receiptData);die();
|
||||
$model = new Receipt_model();
|
||||
$model->save($receiptData);
|
||||
return redirect()->to(base_url().'all_receipt');
|
||||
}
|
||||
|
||||
function update_receipt()
|
||||
{
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
|
||||
$receipt_id=$this->request->getVar('receipt_id');
|
||||
|
||||
$donor_id=$this->request->getVar('donor_id');
|
||||
$mymodel = new My_model();
|
||||
$donor = $mymodel->find($donor_id);
|
||||
$donor_name = $donor['name'];
|
||||
|
||||
$cause_id=$this->request->getVar('cause_id');
|
||||
$causemodel = new Donation_cause();
|
||||
$cause = $causemodel->find($cause_id);
|
||||
$cause_name = $cause['cause_name'];
|
||||
|
||||
$receiptData=[
|
||||
|
||||
'date' =>$this->request->getVar('date'),
|
||||
'donor_id' =>$this->request->getVar('donor_id'),
|
||||
'donor_name' =>$donor_name,
|
||||
'amount' =>$this->request->getVar('amount'),
|
||||
'mode_of_receipt' =>$this->request->getVar('mode_of_receipt'),
|
||||
'receipt_details' =>$this->request->getVar('receipt_details'),
|
||||
'cause_id' =>$this->request->getVar('cause_id'),
|
||||
'cause_name' =>$cause_name,
|
||||
'remarks' =>$this->request->getVar('remarks'),
|
||||
];
|
||||
$model = new Receipt_model();
|
||||
$model->update($receipt_id , $receiptData);
|
||||
return redirect()->to(base_url().'/all_receipt');
|
||||
|
||||
}
|
||||
|
||||
public function all_receipt()
|
||||
{
|
||||
$data = [];
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
$data['receiptdata']=$this->rModel->all_receipt();
|
||||
|
||||
return view('receipts_table',$data);
|
||||
|
||||
}
|
||||
|
||||
function edit_receipt($receipt_id)
|
||||
{
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
$receipt_model = new Receipt_model();
|
||||
$receipt_data=$receipt_model->find($receipt_id);
|
||||
|
||||
$donor_model = new My_model();
|
||||
$donor_data=$donor_model->findAll();
|
||||
|
||||
$cause_model = new Donation_cause();
|
||||
$cause_data=$cause_model->findAll();
|
||||
|
||||
$data= [ 'post'=>$receipt_data , 'donor'=>$donor_data , 'cause'=>$cause_data ];
|
||||
// if($this->request->getMethod() == 'post')
|
||||
// {
|
||||
// $model = new Receipt_model();
|
||||
// $_POST['receipt_id'] = $receipt_id;
|
||||
// $model->save($_POST);
|
||||
// return redirect()->to(base_url()."/Dashboard/all_receipt");
|
||||
// }
|
||||
|
||||
return view('receipt_edit',$data);
|
||||
|
||||
|
||||
}
|
||||
function last_receipt()
|
||||
{
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
// admin data
|
||||
$dmodel = new Donor_model();
|
||||
$id= session()->get('logged_user');
|
||||
$admin_data=$dmodel->find($id);
|
||||
// last receipt data
|
||||
$receipt_data=$this->rModel->last_receipt();
|
||||
//print_r($receipt_data);
|
||||
foreach($receipt_data as $key){ $key['receipt_id']; $key['donor_id'];}
|
||||
//donation cause
|
||||
$causemodel = new Donation_cause();
|
||||
$cause_id=$key['receipt_id'];
|
||||
$cause_data=$causemodel->find($cause_id);
|
||||
// donor data
|
||||
$model = new My_model();
|
||||
$donor_id=$key['donor_id'];
|
||||
$Donor_data=$model->find($donor_id);
|
||||
// array for receipt
|
||||
$data= [ 'donordata'=>$Donor_data , 'admindata' =>$admin_data , 'receipt'=>$receipt_data ,'causedata'=>$cause_data ];
|
||||
|
||||
echo view('templates/header');
|
||||
echo view('pdf_view',$data);
|
||||
echo view('templates/footer');
|
||||
}
|
||||
|
||||
function view_receipt($receiptid)
|
||||
{
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
// admin data
|
||||
$dmodel = new Donor_model();
|
||||
$id= session()->get('logged_user');
|
||||
$admin_data=$dmodel->find($id);
|
||||
// receipt data
|
||||
$rmodel = new Receipt_model();
|
||||
$receipt_id=$receiptid;
|
||||
$receipt_data=$rmodel->find($receipt_id);
|
||||
$donorid = $receipt_data['donor_id'];
|
||||
$causeid = $receipt_data['cause_id'];
|
||||
// donation cause
|
||||
$causemodel = new Donation_cause();
|
||||
$cause_id=$causeid;
|
||||
$cause_data=$causemodel->find($cause_id);
|
||||
// donor data
|
||||
$model = new My_model();
|
||||
$donor_id=$donorid;
|
||||
$Donor_data=$model->find($donor_id);
|
||||
// array for receipt
|
||||
$data= [ 'donordata'=>$Donor_data , 'admindata' =>$admin_data , 'receipt'=>$receipt_data , 'causedata'=>$cause_data];
|
||||
|
||||
//print_r($data); die();
|
||||
return view('receipt_view',$data);
|
||||
|
||||
}
|
||||
|
||||
public function transaction()
|
||||
{
|
||||
$data = [];
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
|
||||
$name= session()->get('logged_user');
|
||||
//$data['userdata']=$this->dModel->getLoggedInUserData($name);
|
||||
|
||||
return view('transaction_upload');
|
||||
|
||||
}
|
||||
// public function transaction_upload()
|
||||
// {
|
||||
// if(!session()->has('logged_user'))
|
||||
// {
|
||||
// return redirect()->to(base_url());
|
||||
// }
|
||||
// $model = new Transaction_model();
|
||||
// $transactionData=[
|
||||
// 'date' =>$this->request->getVar('date'),
|
||||
// 'ref_1' =>$this->request->getVar('ref_1'),
|
||||
// 'remarks' =>$this->request->getVar('remarks'),
|
||||
// 'amount' =>$this->request->getVar('amount'),
|
||||
// 'donation_ref' =>$this->request->getVar('donation_ref'),
|
||||
|
||||
// ];
|
||||
// $model->save($transactionData);
|
||||
// return redirect()->to(base_url().'/Dashboard/all_transaction');
|
||||
// }
|
||||
public function all_transaction()
|
||||
{
|
||||
$data = [];
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
|
||||
|
||||
$data['receiptdata']=$this->tModel->all_transaction();
|
||||
|
||||
return view('transaction_table',$data);
|
||||
|
||||
}
|
||||
function edit_transaction($id)
|
||||
{
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
$model = new Transaction_model();
|
||||
$transaction_data=$model->find($id);
|
||||
$data= [ 'post'=>$transaction_data ];
|
||||
|
||||
if($this->request->getMethod() == 'post')
|
||||
{
|
||||
$model = new Transaction_model();
|
||||
$_POST['id'] = $id;
|
||||
$model->save($_POST);
|
||||
return redirect()->to(base_url()."/all_transaction");
|
||||
}
|
||||
|
||||
return view('transaction_edit',$data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function donation_data()
|
||||
{
|
||||
$data = [];
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
|
||||
return view('donation_data');
|
||||
|
||||
}
|
||||
// public function donation_data_upload()
|
||||
// {
|
||||
// if(!session()->has('logged_user'))
|
||||
// {
|
||||
// return redirect()->to(base_url());
|
||||
// }
|
||||
// $model = new Donation_data_model();
|
||||
// $donationData=[
|
||||
// 'date' =>$this->request->getVar('date'),
|
||||
// 'cause_name' =>$this->request->getVar('cause_name'),
|
||||
// 'amount' =>$this->request->getVar('amount'),
|
||||
// 'mode_of_payment' =>$this->request->getVar('mode_of_payment'),
|
||||
// 'ref_1' =>$this->request->getVar('ref_1'),
|
||||
// 'donation_ref' =>$this->request->getVar('donation_ref'),
|
||||
// ];
|
||||
// $model->save($donationData);
|
||||
// return redirect()->to(base_url().'/Dashboard');
|
||||
// }
|
||||
public function all_donation_data()
|
||||
{
|
||||
$data = [];
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
|
||||
|
||||
$data['donationdata']=$this->ddModel->all_donation_data();
|
||||
|
||||
return view('donation_data_table',$data);
|
||||
|
||||
}
|
||||
function edit_donation_data($id)
|
||||
{
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
$model = new Donation_data_model();
|
||||
$donation_data=$model->find($id);
|
||||
$data= [ 'post'=>$donation_data ];
|
||||
|
||||
if($this->request->getMethod() == 'post')
|
||||
{
|
||||
$model = new Donation_data_model();
|
||||
$_POST['id'] = $id;
|
||||
$model->save($_POST);
|
||||
return redirect()->to(base_url()."/all_donation_data");
|
||||
}
|
||||
|
||||
return view('donation_data_edit',$data);
|
||||
|
||||
|
||||
}
|
||||
public function donation_cause()
|
||||
{
|
||||
$data = [];
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
$data['donationcause']=$this->dcModel->all_donation_cause();
|
||||
|
||||
return view('add_donation_cause');
|
||||
|
||||
}
|
||||
public function all_donation_cause()
|
||||
{
|
||||
$data = [];
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
$data['donationcause']=$this->dcModel->all_donation_cause();
|
||||
|
||||
return view('all_donation_cause',$data);
|
||||
|
||||
}
|
||||
public function add_donation_cause()
|
||||
{
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
$model = new Donation_cause();
|
||||
$active="Active";
|
||||
$donationCause=[
|
||||
'cause_name' =>$this->request->getVar('cause_name'),
|
||||
'from_date' =>$this->request->getVar('from_date'),
|
||||
'to_date' =>$this->request->getVar('to_date'),
|
||||
'status' =>$active,
|
||||
];
|
||||
$model->save($donationCause);
|
||||
return redirect()->to(base_url()."/Dashboard/donation_cause");
|
||||
}
|
||||
function edit_donation_cause($id)
|
||||
{
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
$model = new Donation_cause();
|
||||
$donation_cause=$model->find($id);
|
||||
$data= [ 'post'=>$donation_cause ];
|
||||
|
||||
if($this->request->getMethod() == 'post')
|
||||
{
|
||||
$model = new Donation_cause();
|
||||
$_POST['id'] = $id;
|
||||
$model->save($_POST);
|
||||
return redirect()->to(base_url()."/all_donation_cause");
|
||||
}
|
||||
|
||||
return view('donation_cause_edit',$data);
|
||||
|
||||
|
||||
}
|
||||
function inactive_cause($cause_id)
|
||||
{ $id = $cause_id;
|
||||
$inactive="Inactive";
|
||||
$donationCause=['status' =>$inactive,];
|
||||
$model = new Donation_cause();
|
||||
$model->update($id , $donationCause);
|
||||
return redirect()->to(base_url()."/all_donation_cause");
|
||||
|
||||
}
|
||||
function active_cause($cause_id)
|
||||
{ $id = $cause_id;
|
||||
$active="Active";
|
||||
$donationCause=['status' =>$active,];
|
||||
$model = new Donation_cause();
|
||||
$model->update($id , $donationCause);
|
||||
return redirect()->to(base_url()."/all_donation_cause");
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,41 +0,0 @@
|
||||
<?php namespace App\Controllers;
|
||||
|
||||
use App\Models\Donation_model;
|
||||
|
||||
class Donation extends BaseController
|
||||
{
|
||||
// public function index()
|
||||
// {
|
||||
|
||||
// return view('show');
|
||||
// }
|
||||
public function edit_view()
|
||||
{
|
||||
$model = new Donation_model();
|
||||
|
||||
$data['users_detail'] = $model->orderBy('id', 'DESC')->findAll();
|
||||
|
||||
return view('list', $data);
|
||||
}
|
||||
|
||||
public function test($type,$type2)
|
||||
{
|
||||
echo '<h2>this is a product:'.$type.'and'.$type2.'</h2>';
|
||||
//return view('show');
|
||||
}
|
||||
public function register()
|
||||
{
|
||||
if($this->request->getMethod() == 'post'){
|
||||
$model = new Donation_model();
|
||||
$model->save($_POST);
|
||||
}
|
||||
return view('show');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
}
|
||||
@ -1,188 +0,0 @@
|
||||
<?php namespace App\Controllers;
|
||||
|
||||
use App\Models\Donor_model;
|
||||
use App\Models\Dashboard_model;
|
||||
use App\Models\Address_model;
|
||||
|
||||
class Donor_controller extends BaseController
|
||||
{
|
||||
public $session;
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->session = session();
|
||||
$this->Donor_model = new Donor_model();
|
||||
$this->Dashboard_model = new Dashboard_model();
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$data=[];
|
||||
helper(['form']);
|
||||
|
||||
if($this->request->getmethod() == 'post')
|
||||
{
|
||||
|
||||
$email = $this->request->getVar('email');
|
||||
$password = $this->request->getVar('password');
|
||||
$userdata = $this->Donor_model->verifyEmail($email);
|
||||
if($userdata)
|
||||
{
|
||||
if(password_verify($password, $userdata['password']))
|
||||
{
|
||||
|
||||
$this->session->set('logged_user',$userdata['id']);
|
||||
return redirect()->to(base_url().'/Dashboard');
|
||||
}
|
||||
else{
|
||||
$this->session->setTempdata('error','sorry wrong password entered for the Email',3);
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
}else
|
||||
{
|
||||
$this->session->setTempdata('error','sorry Email does not existe',3);
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return view('login');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function register()
|
||||
{
|
||||
|
||||
|
||||
$data['country']=$this->Dashboard_model->fetch_country();
|
||||
helper(['form']);
|
||||
|
||||
if($this->request->getmethod() == 'post')
|
||||
{
|
||||
//validate
|
||||
$rules=[
|
||||
'name' =>'required|min_length[3]|max_length[30]',
|
||||
'phone' =>'required|min_length[10]|max_length[12]|is_unique[user_management.phone]',
|
||||
'email' =>'required|min_length[6]|max_length[50]|valid_email|is_unique[user_management.email]',
|
||||
'pan' =>'required|min_length[10]|max_length[10]|is_unique[user_management.pan]',
|
||||
'address' =>'required|min_length[3]|max_length[70]',
|
||||
'pin_code' =>'required|min_length[6]|max_length[6]',
|
||||
'org_name' =>'required|min_length[3]|max_length[20]',
|
||||
'gstin' =>'required|min_length[15]|max_length[15]|is_unique[user_management.gstin]',
|
||||
'password' =>'required|min_length[5]|max_length[20]',
|
||||
'password_confirm' =>'matches[password]',
|
||||
'userfile' => [
|
||||
'uploaded[userfile]',
|
||||
'mime_in[userfile,image/jpg,image/png,image/jpeg]',
|
||||
'max_size[userfile,1000]',
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
if(! $this->validate($rules))
|
||||
{
|
||||
$data['validation'] = $this->validator;
|
||||
}else{
|
||||
|
||||
|
||||
$Address_model = new Address_model();
|
||||
|
||||
$country_id=$this->request->getVar('country');
|
||||
$state_id=$this->request->getVar('state');
|
||||
$city_id=$this->request->getVar('city');
|
||||
|
||||
$country_name=$Address_model->country($country_id);
|
||||
foreach($country_name as $key){ $key['country_name']; }
|
||||
$country=$key['country_name'];
|
||||
$state_name=$Address_model->state($state_id);
|
||||
foreach($state_name as $key){ $key['state_name']; }
|
||||
$state=$key['state_name'];
|
||||
$city_name=$Address_model->city($city_id);
|
||||
foreach($city_name as $key){ $key['city_name']; }
|
||||
$city=$key['city_name'];
|
||||
|
||||
$path="public/assets/uploads";
|
||||
if($img = $this->request->getFile('userfile'))
|
||||
{
|
||||
if ($img->isValid() && ! $img->hasMoved())
|
||||
{
|
||||
//$newName = $img->getRandomName();
|
||||
$f_type=date('Y-m-d').time().$_FILES['userfile']['name'];
|
||||
$img->move($path, $f_type);
|
||||
$signature="public/assets/uploads/".$f_type;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//store the donor in database
|
||||
$model = new Donor_model();
|
||||
$donorData=[
|
||||
'name' =>$this->request->getVar('name'),
|
||||
'phone' =>$this->request->getVar('phone'),
|
||||
'email' =>$this->request->getVar('email'),
|
||||
'pan' =>$this->request->getVar('pan'),
|
||||
'address' =>$this->request->getVar('address'),
|
||||
'country' =>$country,
|
||||
'state' =>$state,
|
||||
'city' =>$city,
|
||||
'pin_code' =>$this->request->getVar('pin_code'),
|
||||
'date_of_birth' =>$this->request->getVar('date_of_birth'),
|
||||
'gender' =>$this->request->getVar('gender'),
|
||||
'org_name' =>$this->request->getVar('org_name'),
|
||||
'gstin' =>$this->request->getVar('gstin'),
|
||||
'foreign_key' =>$this->request->getVar('email'),
|
||||
'password' =>$this->request->getVar('password'),
|
||||
'signature' =>$signature,
|
||||
];
|
||||
//print_r($donorData);die();
|
||||
$model->save($donorData);
|
||||
$session = session();
|
||||
$session ->setFlashdata('success','Successful Registration');
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//echo view('templates/header',$data);
|
||||
return view('register',$data);
|
||||
//echo view('templates/footer');
|
||||
|
||||
}
|
||||
|
||||
function profile()
|
||||
{
|
||||
$id= session()->get('logged_user');
|
||||
$data['userdata']=$this->Dashboard_model->getLoggedInUserData($id);
|
||||
return view('profile',$data);
|
||||
}
|
||||
|
||||
function fetch_country()
|
||||
{
|
||||
|
||||
echo $this->Dashboard_model->fetch_country();
|
||||
|
||||
}
|
||||
function fetch_state()
|
||||
{
|
||||
|
||||
if($this->request->getVar('country_id'))
|
||||
{
|
||||
echo $this->Dashboard_model->fetch_state($this->request->getVar('country_id'));
|
||||
}
|
||||
}
|
||||
|
||||
function fetch_city()
|
||||
{
|
||||
if($this->request->getVar('state_id'))
|
||||
{
|
||||
echo $this->Dashboard_model->fetch_city($this->request->getVar('state_id'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
}
|
||||
123
app/Controllers/Event.php
Normal file
123
app/Controllers/Event.php
Normal file
@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
|
||||
use App\Models\EventModel;
|
||||
|
||||
|
||||
class Event extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
helper('session');
|
||||
if (is_session_active()) {
|
||||
$session_role = get_user_role();
|
||||
$session_bid = get_business_id();
|
||||
|
||||
$default_financial_year_condition = [
|
||||
'campaign.created_on >= CONCAT(YEAR(NOW()) - IF(MONTH(NOW()) >= 1 AND MONTH(NOW()) <= 3, 1, 0), "-01-01")',
|
||||
'campaign.created_on < CONCAT(YEAR(NOW()) + IF(MONTH(NOW()) >= 1 AND MONTH(NOW()) <= 3, 1, 0), "-01-01")'
|
||||
];
|
||||
|
||||
if (!empty($session_role) && $session_role !== "sadmin") {
|
||||
$where = ['campaign.business_id' => (int)$session_bid];
|
||||
} else {
|
||||
$where = ['campaign.business_id != ' => NULL];
|
||||
}
|
||||
// $where = array_merge($where, $default_financial_year_condition);
|
||||
|
||||
$EventModel = new EventModel();
|
||||
$data['page_name'] = 'Campaign Details';
|
||||
$campaigns = $EventModel->where($where)->orderBy('campaign_id', 'DESC')->findAll(); // Retrieve the campaigns
|
||||
|
||||
// Sort the campaigns by ID in descending order (newest first)
|
||||
// usort($campaigns, function ($a, $b) {
|
||||
// return $b['id'] - $a['id'];
|
||||
// });
|
||||
|
||||
$data['campaign'] = $campaigns; // Assign the sorted array to $data['campaign']
|
||||
$data['session_bid'] = $session_bid;
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($data); die;
|
||||
|
||||
$this->render_page('event_list', $data);
|
||||
} else {
|
||||
return redirect()->to('login');
|
||||
}
|
||||
}
|
||||
|
||||
public function new_campaign($id)
|
||||
{
|
||||
helper('session');
|
||||
$session_bid = get_business_id();
|
||||
if ($id === '0') {
|
||||
$data['page_name'] = 'Add Campaign';
|
||||
$data['campaign'] = [];
|
||||
} else if ($id !== '0') {
|
||||
$data['page_name'] = 'Edit Campaign';
|
||||
$model = new EventModel();
|
||||
$model->setTable('campaign');
|
||||
$edit_campaign_details = $model->where(['campaign_id' => $id])->first();
|
||||
$data['campaign'] = $edit_campaign_details;
|
||||
}
|
||||
|
||||
$data['session_bid'] = $session_bid;
|
||||
|
||||
$this->render_page('event_form', $data);
|
||||
}
|
||||
|
||||
public function insert_event()
|
||||
{
|
||||
$this->logger->info("campaign: Inserting/Updating Details");
|
||||
try {
|
||||
helper('session');
|
||||
$session_bid = get_business_id();
|
||||
$session_uid = get_logged_user_id();
|
||||
$EventModel = new EventModel();
|
||||
$inputdate1 = date("Y-m-d", strtotime($this->request->getVar('start_date')));
|
||||
$inputdate2 = date("Y-m-d", strtotime($this->request->getVar('end_date')));
|
||||
|
||||
$data = [
|
||||
'name' => $this->request->getPost('name'),
|
||||
'description' => $this->request->getPost('description'),
|
||||
'start_date' =>$inputdate1,
|
||||
'end_date' =>$inputdate2 ,
|
||||
'business_id' => $this->request->getPost('business_id')
|
||||
];
|
||||
|
||||
|
||||
$campaign_id = $this->request->getPost('campaign_id'); // Get the business ID for update
|
||||
|
||||
if (empty($campaign_id)) {
|
||||
// It's an insert operation
|
||||
$data['created_by'] = $session_uid;
|
||||
|
||||
if ($EventModel->insert($data)) {
|
||||
|
||||
session()->setFlashdata('success', 'campaign has been added successfully.');
|
||||
$this->logger->info("campaign : has been added successfully. Inserted ID = " . $EventModel->insertID());
|
||||
} else {
|
||||
session()->setFlashdata('error', 'campaign could not be added. Please try again..');
|
||||
$this->logger->error("campaign: Err data could not be added. Please try again.");
|
||||
}
|
||||
} else {
|
||||
// It's an update operation
|
||||
$data['updated_by'] = $session_uid;
|
||||
if ($EventModel->update($campaign_id, $data)) {
|
||||
session()->setFlashdata('success', 'campaign has been updated successfully.');
|
||||
$this->logger->info("campaign: has been updated successfully. Updated campaign ID = " . $campaign_id);
|
||||
} else {
|
||||
session()->setFlashdata('error', 'campaign update failed. Please try again.');
|
||||
$this->logger->error("campaign: Err Failed to update ID =" . $campaign_id);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error("campaign: Err Occur = " . $e->getMessage() . " Line = " . $e->getLine() . " File = " . $e->getFile());
|
||||
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
|
||||
}
|
||||
return redirect()->route('campaign_list');
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,81 +1,134 @@
|
||||
<?php namespace App\Controllers;
|
||||
<?php
|
||||
|
||||
use App\Models\Donation_model;
|
||||
namespace App\Controllers;
|
||||
use App\Models\HomeModel;
|
||||
|
||||
## Home Controllers only for Dashboards,Report Modules
|
||||
class Home extends BaseController
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('donor_registration');
|
||||
}
|
||||
|
||||
// function validation()
|
||||
// {
|
||||
// $donation = new Donation();
|
||||
// echo $donation->test('7777','9999');
|
||||
// }
|
||||
|
||||
public function store()
|
||||
{
|
||||
helper(['form', 'url']);
|
||||
|
||||
$model = new Donation_model();
|
||||
|
||||
$data = [
|
||||
'email' => $this->request->getVar('email'),
|
||||
'name' => $this->request->getVar('name'),
|
||||
'department' => $this->request->getVar('department'),
|
||||
public function index()
|
||||
{
|
||||
|
||||
helper('session');
|
||||
$session_role = get_user_role();
|
||||
|
||||
];
|
||||
|
||||
$save = $model->insert($data);
|
||||
return redirect()->to( base_url('show') );
|
||||
if (!empty($session_role)) {
|
||||
switch ($session_role) {
|
||||
case 'admin':
|
||||
case 'auditor':
|
||||
$this->dashboard();
|
||||
break;
|
||||
case 'accounts':
|
||||
$this->dashboard_accounts();
|
||||
break;
|
||||
case 'volunteer':
|
||||
$this->dashboard_volunteers();
|
||||
break;
|
||||
default:
|
||||
$data['page_name'] = 'Dashboard';
|
||||
$this->render_page('dashboard', $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function edit($id = null)
|
||||
|
||||
//Default Dashboard..
|
||||
public function dashboard()
|
||||
{
|
||||
$model = new Donation_model();
|
||||
$post = $model->find($id);
|
||||
$data=['post' => $post,];
|
||||
return view('edit_view', $data);
|
||||
//return view('edit_view',['firstci4'=>$this->$model->find($id)]);
|
||||
// echo "hwllo"
|
||||
helper('session');
|
||||
$session_role = get_user_role();
|
||||
$session_bid = get_business_id();
|
||||
$session_uid = get_logged_user_id();
|
||||
|
||||
// echo $session_bid, $session_role; die;
|
||||
|
||||
$data['page_name'] = 'Dashboard';
|
||||
$model = new HomeModel();
|
||||
$bwhere = ['user_id'=> $session_uid,'business_id'=> $session_bid,'isactive'=> 1];
|
||||
$branch_id = $model->getbranchid($bwhere);
|
||||
|
||||
$where = ['donor.business_id' => $session_bid];
|
||||
|
||||
if (!empty($session_role)) {
|
||||
switch ($session_role) {
|
||||
case 'auditor':
|
||||
$where['donor.created_by'] = $session_uid;
|
||||
break;
|
||||
case 'accounts':
|
||||
if ($branch_id) {
|
||||
$where['users.branch_id'] = $branch_id;
|
||||
}
|
||||
break;
|
||||
case 'volunteer':
|
||||
if ($branch_id) {
|
||||
$where['users.branch_id'] = $branch_id;
|
||||
}
|
||||
$where['donor.created_by'] = $session_uid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$data['donordetails'] = $model->donordetails($where);
|
||||
|
||||
$data['donordetails']['label'] = "donors";
|
||||
|
||||
$this->render_page('dashboard', $data);
|
||||
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
helper(['form', 'url']);
|
||||
|
||||
$model = new Donation_model();
|
||||
|
||||
public function dashboard_accounts()
|
||||
{
|
||||
|
||||
helper('session');
|
||||
$session_bid = get_business_id();
|
||||
$model = new HomeModel();
|
||||
$where = ['users.business_id' => $session_bid];
|
||||
$data = $model->dashboard_account($where);
|
||||
$data['page_name'] = 'Dashboard';
|
||||
|
||||
// $this->render_page('dashboard', $data);
|
||||
$this->render_page('dashboard_accounts', $data);
|
||||
|
||||
}
|
||||
|
||||
public function dashboard_volunteers()
|
||||
{
|
||||
helper('session');
|
||||
$session_bid = get_business_id();
|
||||
$session_uid = get_logged_user_id();
|
||||
|
||||
$model = new HomeModel();
|
||||
$bwhere = ['user_id'=> $session_uid,'users.business_id'=> $session_bid,'users.isactive'=> 1];
|
||||
$branch_id = $model->getbranchid($bwhere);
|
||||
$data = $model->dashboard_volunteer($bwhere);
|
||||
$data['page_name'] = 'Dashboard';
|
||||
$this->render_page('dashboard', $data);
|
||||
|
||||
}
|
||||
|
||||
## Dynamic Validation For Existing Check AJAX Call
|
||||
# USED in 1) User Module
|
||||
# 2) Recepit-DonorQuickAdd Module
|
||||
# 3) Contributor(or)Donor Module
|
||||
# 4) Buiness(Or)Organsation Module
|
||||
## PLEASE mention here wherever you used this.
|
||||
public function check_existing()
|
||||
{
|
||||
$value = $this->request->getPost('value');
|
||||
$table = $this->request->getPost('module');
|
||||
$field = $this->request->getPost('field');
|
||||
$model = new HomeModel();
|
||||
|
||||
$id = $this->request->getVar('id');
|
||||
$data = [
|
||||
'name' => $this->request->getVar('name'),
|
||||
'email' => $this->request->getVar('email'),
|
||||
];
|
||||
$save = $model->update($id,$data);
|
||||
$donation = new Donation();
|
||||
echo $donation->edit_view();
|
||||
//return redirect()->to( base_url('users') );
|
||||
$model->setTable((string)$table);
|
||||
$where = [$field => $value];
|
||||
$check_existing = $model->where($where)->findAll();
|
||||
|
||||
$statement_string = ucfirst(str_replace('_', ' ', (string)$field));
|
||||
$data = ['status' => false, 'message' => ''];
|
||||
if (!empty($check_existing)) {
|
||||
$data['status'] = true;
|
||||
$data['message'] = $statement_string." Already existing";
|
||||
}
|
||||
return $this->response->setJSON(['data' => $data]);
|
||||
}
|
||||
|
||||
public function userDelete($id = null)
|
||||
{
|
||||
$model = new Donation_model();
|
||||
$data['user'] = $model->where('id', $id)->delete();
|
||||
$donation = new Donation();
|
||||
echo $donation->edit_view();
|
||||
// return redirect()->to( base_url('users') );
|
||||
}
|
||||
public function profile($id = null)
|
||||
{
|
||||
$model = new Donation_model();
|
||||
$post = $model->find($id);
|
||||
$data=['post' => $post,];
|
||||
return view('profile_view', $data);
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
}
|
||||
|
||||
935
app/Controllers/Invoice.php
Normal file
935
app/Controllers/Invoice.php
Normal file
@ -0,0 +1,935 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
|
||||
use App\Models\CustomerModel;
|
||||
use App\Models\InvoiceModel;
|
||||
use App\Models\BooksModel;
|
||||
use App\Models\AuditHistoryModel;
|
||||
use App\Models\UsersModel;
|
||||
use App\Models\NotificationModel;
|
||||
use App\Models\BusinessModel;
|
||||
use App\Helpers\NotificationHelper;
|
||||
use Mpdf\Mpdf;
|
||||
use Dompdf\Dompdf;
|
||||
use Dompdf\Options;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Csv as ReaderCsv;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Xlsx as ReaderXlsx;
|
||||
use PhpOffice\PhpSpreadsheet\Cell\DataType;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
|
||||
class Invoice extends BaseController
|
||||
{
|
||||
|
||||
protected $AuditHistoryModel;
|
||||
protected $UserModel;
|
||||
protected $BusinessModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->AuditHistoryModel = new AuditHistoryModel();
|
||||
$this->UserModel = new UsersModel();
|
||||
$this->BusinessModel = new BusinessModel();
|
||||
}
|
||||
|
||||
## For Invoice Listing..
|
||||
public function index()
|
||||
{
|
||||
helper('session');
|
||||
if (is_session_active()) {
|
||||
$session_role = get_user_role();
|
||||
$session_bid = get_business_id();
|
||||
|
||||
$model = new InvoiceModel();
|
||||
$where = ['business_id' => (int)get_business_id()];
|
||||
$data['Donors'] = $model->getData('donor', $where);
|
||||
$data['page_name'] = 'Receipt Details';
|
||||
$default_financial_year_condition = [
|
||||
'created_at >= CONCAT(YEAR(NOW()) - IF(MONTH(NOW()) >= 1 AND MONTH(NOW()) <= 3, 1, 0), "-01-01")',
|
||||
'created_at < CONCAT(YEAR(NOW()) + IF(MONTH(NOW()) >= 1 AND MONTH(NOW()) <= 3, 1, 0), "-01-01")'
|
||||
];
|
||||
// $where = array_merge($where, $default_financial_year_condition);
|
||||
$data['receipt'] = $model->where($where)->findAll();
|
||||
$data['temp_receipt_count'] = $model->where(["business_id"=>$session_bid, 'receipt_header' => 'Temporary Receipt'])->countAllResults();
|
||||
|
||||
foreach ($data['receipt'] as $key => $value) {
|
||||
$data['receipt'][$key]['created_name'] = $this->UserModel->where('user_id', $value['created_by'])->get()->getRow()->first_name;
|
||||
}
|
||||
|
||||
$this->logger->info("Invoice: Listing Count ." . count($data['receipt']));
|
||||
$this->render_page('invoice_list', $data);
|
||||
} else {
|
||||
return redirect()->to('login');
|
||||
}
|
||||
}
|
||||
|
||||
public function donations_accepted()
|
||||
{
|
||||
try
|
||||
{
|
||||
helper('session');
|
||||
if (is_session_active()) {
|
||||
$session_role = get_user_role();
|
||||
$session_bid = get_business_id();
|
||||
|
||||
$model = new InvoiceModel();
|
||||
// $where = ['business_id' => (int)get_business_id()];
|
||||
$data['list'] = $model->getData('donations_accepted',null);
|
||||
$data['page_name'] = 'Donations Accepted';
|
||||
// print_r($data);die();
|
||||
$this->render_page('donations_accepted', $data);
|
||||
} else {
|
||||
return redirect()->to('login');
|
||||
}
|
||||
}
|
||||
catch (\Throwable $e)
|
||||
{
|
||||
$this->logger->error("donations_accepted: Err Occur =" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function save_donations_accepted()
|
||||
{
|
||||
try
|
||||
{
|
||||
helper('session');
|
||||
// print_r($this->request->getPost());die;
|
||||
$model = new InvoiceModel();
|
||||
$list = $model->getData('donations_accepted',null);
|
||||
foreach ($list as $key => $value) {
|
||||
if(in_array($value->id, $this->request->getPost('name')))
|
||||
{
|
||||
$where = ['id' => $value->id ];
|
||||
$data['is_active'] = 1;
|
||||
$upt_data = $model->updateData('donations_accepted', $data, $where);
|
||||
}
|
||||
else
|
||||
{
|
||||
$where = ['id' => $value->id];
|
||||
$data['is_active'] = 0;
|
||||
$upt_data = $model->updateData('donations_accepted', $data, $where);
|
||||
}
|
||||
}
|
||||
session()->setFlashdata('success', 'Recepit Updated Successfully.');
|
||||
return redirect()->route('donations_accepted');
|
||||
}
|
||||
catch (\Throwable $e)
|
||||
{
|
||||
$this->logger->error("donations_accepted: Err Occur =" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
## To Save/Update the Recepit Details
|
||||
public function new_receipt($id = '0')
|
||||
{
|
||||
helper('session');
|
||||
$model = new InvoiceModel();
|
||||
$bmodel = new BooksModel();
|
||||
|
||||
$where = ['business_id' => (int)get_business_id() ];
|
||||
$rec_where = ['business_id' => (int)get_business_id(), 'YEAR(created_on)' => date('Y')];
|
||||
$receipt = $model->getData('receipt', $rec_where);
|
||||
|
||||
// receipt number
|
||||
$settingData = $this->BusinessModel->select('*')->where($where)->findAll();
|
||||
$count_receipt_no = (count($receipt) > 0) ? count($receipt) + $settingData[0]['start_no'] : $settingData[0]['start_no'];
|
||||
|
||||
// Calculate padding based on the count of digits in count_receipt_no
|
||||
$padding_count = max(0, $settingData[0]['left_pad'] - strlen($count_receipt_no));
|
||||
$padding = str_repeat('0', $padding_count);
|
||||
|
||||
$data['count_receipt_no'] = $settingData[0]['prefix_format'] . $padding . $count_receipt_no;
|
||||
|
||||
// Get customer names for the dropdown, events details, and books details
|
||||
$data['currency'] = $this->BusinessModel->select('currency')->where($where)->findAll();
|
||||
$data['currency_code'] = $this->BusinessModel->select('currency')->where($where)->first()['currency'] ?? null;
|
||||
$query = $this->BusinessModel->select('currency')->where($where)->first();
|
||||
$data['currencies'] = unserialize($query['currency']);
|
||||
|
||||
$data['causes'] = $bmodel->select('*')->where('business_id', (int)get_business_id())->where('isactive',1)->get()->getResult();
|
||||
$data['campaign'] = $model->getData('campaign', $where);
|
||||
|
||||
$data['invoice_number_formatting'] = $model->getData('business', $where);
|
||||
$data['receipt_type'] = "individual";
|
||||
if ($id === '0') {
|
||||
$this->logger->info("Receipt: In Add Details");
|
||||
$data['page_name'] = 'Add Receipt Details';
|
||||
$data['receipt_details'] = [];
|
||||
} elseif ($id !== '0') {
|
||||
$this->logger->info(" Book Invoice: In Edit Details ID = " . $id);
|
||||
$data['page_name'] = 'Edit Receipt Details';
|
||||
if(get_user_role() == 'accounts')
|
||||
{
|
||||
$data['receipt_details'] = $model->where(['receipt_id' => $id])->first();
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['receipt_details'] = $model->where(['receipt_id' => $id, 'isactive' => 1])->first();
|
||||
}
|
||||
$data['receipt_type'] = $data['receipt_details']['receipt_type'];
|
||||
}
|
||||
$cus_where = ['business_id' => (int)get_business_id() , 'isactive' => 1, 'donor_type'=>$data['receipt_type']];
|
||||
$data['typebaseddonors'] = $model->getData('donor', $cus_where);
|
||||
$data['alldonors'] = $model->getData('donor', ['business_id' => (int)get_business_id() , 'isactive' => 1]);
|
||||
// print_r($data);die;
|
||||
$this->render_page('invoice_form', $data);
|
||||
}
|
||||
|
||||
public function donor_cash_success()
|
||||
{
|
||||
helper('session');
|
||||
$model = new InvoiceModel();
|
||||
// echo $this->request->getPost('id');die;
|
||||
$where = ['business_id' => (int)get_business_id(),'receipt_id' => $this->request->getPost('id') ];
|
||||
$data['receipt_header'] = 'Receipt';
|
||||
$data['isactive'] = 1;
|
||||
$updata = $model->getData('receipt', $where);
|
||||
$upt_data = $model->updateData('receipt', $data, $where);
|
||||
|
||||
//**********AUDIT HISTORY*************/
|
||||
$myArray = array();
|
||||
array_push($myArray, $data);
|
||||
$olddata['receipt_header'] = $updata[0]->receipt_header;
|
||||
$olddata['isactive'] = $updata[0]->isactive;
|
||||
$myArray1 = array();
|
||||
array_push($myArray1, $olddata);
|
||||
/************************** */
|
||||
$currentDateTime = date('Y-m-d H:i:s');
|
||||
$audit_data = [
|
||||
'module' => 'receipt',
|
||||
'business_id' => (int)get_business_id(),
|
||||
'is_edit' => 1,
|
||||
'old_data' => json_encode($myArray1),
|
||||
'current_data' => json_encode($myArray),
|
||||
'updated_on' => $currentDateTime,
|
||||
'updated_by' => (int)get_logged_user_id()
|
||||
];
|
||||
$this->AuditHistoryModel->save($audit_data);
|
||||
/************************************* */
|
||||
|
||||
if($upt_data){ session()->setFlashdata('success', 'Recepit has been accepted successfully.');echo true; }
|
||||
else echo false;
|
||||
}
|
||||
|
||||
public function donor_cash_delete()
|
||||
{
|
||||
helper('session');
|
||||
$model = new InvoiceModel();
|
||||
$where = ['business_id' => (int)get_business_id(),'receipt_id' => $this->request->getPost('id') ];
|
||||
$data['isactive'] = 0;
|
||||
$data['receipt_header'] = 'Rejected';
|
||||
$data['reason'] = $this->request->getPost('reason');
|
||||
$updata = $model->getData('receipt', $where);
|
||||
$upt_data = $model->updateData('receipt', $data, $where);
|
||||
|
||||
//**********AUDIT HISTORY*************/
|
||||
/**get old data for history */
|
||||
$olddata['receipt_number'] = $updata[0]->receipt_number;
|
||||
$myArray = array();
|
||||
array_push($myArray, $olddata);
|
||||
/************************** */
|
||||
$currentDateTime = date('Y-m-d H:i:s');
|
||||
$audit_data = [
|
||||
'module' => 'receipt',
|
||||
'business_id' => (int)get_business_id(),
|
||||
'is_delete' => 1,
|
||||
// 'old_data' => json_encode($myArray1),
|
||||
'current_data' => json_encode($myArray),
|
||||
'updated_on' => $currentDateTime,
|
||||
'updated_by' => (int)get_logged_user_id()
|
||||
];
|
||||
$this->AuditHistoryModel->save($audit_data);
|
||||
/************************************* */
|
||||
session()->setFlashdata('success', 'Recepit has been rejected successfully.');
|
||||
return redirect()->route('receipt_list');
|
||||
}
|
||||
|
||||
## To insert or update the details of the invoice
|
||||
public function save_invoice()
|
||||
{
|
||||
$this->logger->info("Invoice: Insert/Update Details");
|
||||
try {
|
||||
## Declarions
|
||||
helper('session');
|
||||
$model = new InvoiceModel();
|
||||
|
||||
$receipt_date = $this->request->getVar('receipt_date');
|
||||
|
||||
$receipt_id = (!empty($this->request->getPost('receipt_id'))) ? $this->request->getPost('receipt_id') : "";
|
||||
$donor_id = (int)$this->request->getPost('donor_id');
|
||||
|
||||
$data = [
|
||||
'receipt_type' => $this->request->getPost('receipt_type'),
|
||||
'receipt_number' => $this->request->getPost('receipt_number'),
|
||||
'donor_id' => $donor_id,
|
||||
'campaign_id' => (int)$this->request->getPost('campaign_id'),
|
||||
'notes'=>$this->request->getPost('notes'),
|
||||
'receipt_date' => (!empty($receipt_date)) ? date("Y-m-d", strtotime($receipt_date)) : NULL,
|
||||
'amount' => $this->request->getPost('amount'),
|
||||
'payment_mode' => $this->request->getPost('payment_mode'),
|
||||
'payment_ref_no' => $this->request->getPost('payment_ref_no'),
|
||||
'causes_id' => (int)$this->request->getPost('causes_id'),
|
||||
'currency' => $this->request->getPost('currency'),
|
||||
'business_id' => (int)get_business_id(),
|
||||
'isactive' => 1
|
||||
];
|
||||
// print_r($data);die;
|
||||
## Based on the invoice ID, we designated Insert or Update on Details...
|
||||
if (empty($receipt_id)) {
|
||||
$data['created_by'] = (int)get_logged_user_id();
|
||||
if ($model->insert($data, 'invoices')) {
|
||||
$receipt_id = $model->insertID();
|
||||
//**********AUDIT HISTORY*************/
|
||||
$myArray = array();
|
||||
array_push($myArray, $data);
|
||||
$currentDateTime = date('Y-m-d H:i:s');
|
||||
$audit_data = [
|
||||
'module' => 'receipt',
|
||||
'business_id' => (int)get_business_id(),
|
||||
'is_add' => 1,
|
||||
'current_data' => json_encode($myArray),
|
||||
'created_by' => (int)get_logged_user_id(),
|
||||
'updated_on' => $currentDateTime,
|
||||
'updated_by' => (int)get_logged_user_id()
|
||||
];
|
||||
$this->AuditHistoryModel->save($audit_data);
|
||||
|
||||
/************************************* */
|
||||
session()->setFlashdata('success', 'Receipt has been added successfully.');
|
||||
$this->logger->info("Receipt: has been added successfully. Inserted ID = " . $receipt_id);
|
||||
|
||||
} else {
|
||||
session()->setFlashdata('error', 'Receipt could not be added. Please try again.');
|
||||
$this->logger->error("Receipt: Err Occur could not be added. Please try again.");
|
||||
}
|
||||
|
||||
} else {
|
||||
/**get old data for history */
|
||||
$where = ['business_id' => (int)get_business_id(), 'receipt_id' => $receipt_id];
|
||||
$olddata = $model->getData('receipt', $where);
|
||||
/************************** */
|
||||
$data['updated_by'] = (int)get_logged_user_id();
|
||||
if ($model->update($receipt_id, $data)) {
|
||||
$newdata = $model->getData('receipt', $where);
|
||||
//**********AUDIT HISTORY***********/
|
||||
$currentDateTime = date('Y-m-d H:i:s');
|
||||
$audit_data = [
|
||||
'module' => 'receipt',
|
||||
'business_id' => (int)get_business_id(),
|
||||
'is_edit' => 1,
|
||||
'old_data' => json_encode($olddata),
|
||||
'current_data' => json_encode($newdata),
|
||||
'updated_on' => $currentDateTime,
|
||||
'updated_by' => (int)get_logged_user_id()
|
||||
];
|
||||
$this->AuditHistoryModel->save($audit_data);
|
||||
/************************************* */
|
||||
|
||||
session()->setFlashdata('success', 'Receipt has been updated successfully.');
|
||||
$this->logger->info("Receipt: has been updated successfully. Updated ID = " . $receipt_id);
|
||||
} else {
|
||||
session()->setFlashdata('error', 'Receipt update failed. Please try again.');
|
||||
$this->logger->error("Receipt: Err Failed to update ID =" . $receipt_id);
|
||||
}
|
||||
}
|
||||
|
||||
if($this->request->getPost('next_id')){
|
||||
## Array Formation For Events Details And Updating Events also Here..
|
||||
$update_events = [
|
||||
// 'id' => 1,
|
||||
'start_no' => (int)$this->request->getPost('next_id'),
|
||||
'business_id' => (int)get_business_id(),
|
||||
'updated_by' => get_logged_user_id()
|
||||
];
|
||||
// print_r($update_events);
|
||||
$this->update_number_formatting($update_events);}
|
||||
|
||||
// get donor whatsapp no and mail
|
||||
$where = ['donor_id' => (int)$this->request->getPost('donor_id') ,'business_id' => (int)get_business_id()];
|
||||
$donordata = $model->getData('donor', $where);
|
||||
// generate recipt
|
||||
$html = $this->generate_invoice_pdf($receipt_id, 'mail');
|
||||
// send mail
|
||||
$notification = new NotificationHelper();
|
||||
if($donordata[0]->email != null || $donordata[0]->email != '')
|
||||
{
|
||||
$records['recipient_email'] = $donordata[0]->email;
|
||||
$records['subject'] = 'DONOR RECEIPT';
|
||||
$records['description'] = $html;
|
||||
$notification->sendEmail($records);
|
||||
}
|
||||
$notificationModel = new NotificationModel();
|
||||
$bmodel = new BooksModel();
|
||||
$donormodel = new CustomerModel();
|
||||
$template_data = $notificationModel->select('*')->where('template_id',7)->findAll();
|
||||
$cause = $bmodel->select('name')->where('causes_id',(int)$this->request->getPost('causes_id'))->findAll();
|
||||
$d_name = $donormodel->select('first_name')->where('donor_id',$donor_id)->findAll();
|
||||
$business = $this->BusinessModel->select('*')->where('business_id',(int)get_business_id())->findAll();
|
||||
|
||||
$donor_name = $d_name[0]['first_name'];
|
||||
$currency_amount = $this->request->getPost('amount');
|
||||
$cause_name = $cause[0]['name'];
|
||||
$receipt_number = $this->request->getPost('receipt_number');
|
||||
$r_date = (!empty($receipt_date)) ? date("d-m-Y", strtotime($receipt_date)) : NULL;
|
||||
$business_name = $business[0]['title'];
|
||||
|
||||
// Your original message
|
||||
$message = $template_data[0]['message'];
|
||||
|
||||
// Replace placeholders with actual values
|
||||
$message = str_replace(
|
||||
array('{donor_name}', '{currency_amount}', '{cause_name}', '{receipt_name}', '{receipt_date}', '{bisuness_name}'),
|
||||
array($donor_name, $currency_amount, $cause_name, $receipt_number, $receipt_date, $business_name),
|
||||
$message
|
||||
);
|
||||
|
||||
// Output the modified message
|
||||
// echo $message;die;
|
||||
// // WHATSAPP
|
||||
$params = (object) Null;
|
||||
// $params->number = (int)'91' . $donordata[0]->mobile_no;
|
||||
$params->number = (int)'919677462018';
|
||||
$params->type = "text";
|
||||
$params->message = $message;
|
||||
$params->instance_id = '65C9B978325A2';
|
||||
$params->access_token = '65c715e797d16';
|
||||
$whatsapp_result = $notification->sendWhatsAppMessage(SEND_WAAI_URL, "POST", $params);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error("Receipt: Err Occur =" . $e->getMessage());
|
||||
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
|
||||
}
|
||||
$success = true;
|
||||
|
||||
// Your existing code...
|
||||
$invoice_id = $receipt_id; // Replace with the actual invoice_id
|
||||
|
||||
// Pass the invoice_id and success variable to the view
|
||||
return $this->response->setJSON(['success' => true, 'invoice_id' => $invoice_id]);
|
||||
// Load the view with the success variable
|
||||
// return view('invoice_modal', ['success' => $success]);
|
||||
|
||||
// $this->load->view('invoice_modal', array('success' => $success));
|
||||
return redirect()->route('receipt_list');
|
||||
|
||||
}
|
||||
|
||||
public function audit_history()
|
||||
{
|
||||
helper('session');
|
||||
$model = new InvoiceModel();
|
||||
$where = ['business_id' => (int)get_business_id()];
|
||||
$data = $model->getData('audit_history', $where);
|
||||
// echo $data[0]->current_data;die;
|
||||
$diff = [];
|
||||
|
||||
foreach ($data as $audit_data) {
|
||||
$arr1 = json_decode($audit_data->current_data, true);
|
||||
$arr2 = json_decode($audit_data->old_data, true);
|
||||
|
||||
$temp_diff = [];
|
||||
|
||||
// Check each key-value pair in arr1
|
||||
foreach ($arr1[0] as $key => $value) {
|
||||
$con = $key != 'created_on' && $key != 'created_by' && $key != 'updated_on' && $key != 'updated_by';
|
||||
if ($audit_data->is_edit == 1 && $arr2[0][$key] !== $value) {
|
||||
$user = $this->UserModel->select('first_name,last_name')->where('user_id',$audit_data->updated_by)->findAll();
|
||||
if($con){
|
||||
$temp_diff[] = (object) [
|
||||
'id' => $audit_data->id,
|
||||
'key' => $key,
|
||||
'old_value' => $value,
|
||||
'new_value' => $arr2[0][$key],
|
||||
'module' => $audit_data->module,
|
||||
'mode' => 'Update',
|
||||
'updated_by' => $user[0]['first_name'].' '.$user[0]['last_name'],
|
||||
'updated_on' => $audit_data->updated_on
|
||||
];
|
||||
}
|
||||
}
|
||||
else if($con && $audit_data->is_add == 1){
|
||||
// echo $key;die;
|
||||
$user = $this->UserModel->select('first_name,last_name')->where('user_id',$audit_data->created_by)->findAll();
|
||||
$temp_diff[] = (object) [
|
||||
'id' => $audit_data->id,
|
||||
'key' => '-',
|
||||
'old_value' => '-',
|
||||
'new_value' => 'New Receipt No "'.$arr1[0]['receipt_number'].'" Created',
|
||||
'module' => $audit_data->module,
|
||||
'mode' => 'Create',
|
||||
'updated_by' => $user[0]['first_name'].' '.$user[0]['last_name'],
|
||||
'updated_on' => $audit_data->created_on
|
||||
];
|
||||
break;
|
||||
}
|
||||
else if($con && $audit_data->is_delete == 1){
|
||||
// echo $key;die;
|
||||
$user = $this->UserModel->select('first_name,last_name')->where('user_id',$audit_data->updated_by)->findAll();
|
||||
$temp_diff[] = (object) [
|
||||
'id' => $audit_data->id,
|
||||
'key' => '-',
|
||||
'old_value' => '-',
|
||||
'new_value' => 'Receipt No "'.$arr1[0]['receipt_number'].'" Deleted',
|
||||
'module' => $audit_data->module,
|
||||
'mode' => 'Delete',
|
||||
'updated_by' => $user[0]['first_name'].' '.$user[0]['last_name'],
|
||||
'updated_on' => $audit_data->created_on
|
||||
];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Add temp_diff to $diff array if it's not empty
|
||||
if (!empty($temp_diff)) {
|
||||
$diff[] = $temp_diff;
|
||||
}
|
||||
}
|
||||
|
||||
// print_r($diff);
|
||||
$response['page_name'] = 'History';
|
||||
$response['data'] = $diff;
|
||||
$this->render_page('audit_history', $response);
|
||||
}
|
||||
|
||||
## For Updating Events Details ..
|
||||
public function update_number_formatting($update_events)
|
||||
{
|
||||
// `id``event_name``business_id``updated_by``updated_on``next_id`
|
||||
$model = new InvoiceModel();
|
||||
$model->setTable('business');
|
||||
$where = ['isactive' => 1, 'business_id' => (int)$update_events['business_id'], 'start_no' => $update_events['start_no']];
|
||||
$details = $model->where($where)->findAll();
|
||||
if (empty($details)) {
|
||||
$update_where = ['business_id' => (int)$update_events['business_id']];
|
||||
$update_data = ['start_no' => $update_events['start_no'], 'updated_by' => $update_events['updated_by']];
|
||||
$model->updateData('business', $update_data, $update_where);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function generate_invoice_pdf($id, $dest = null)
|
||||
{
|
||||
try {
|
||||
// Fetch the receipt data based on $receipt_id
|
||||
$model = new InvoiceModel();
|
||||
|
||||
$where = ['business_id' => (int)get_business_id()];
|
||||
$currency_data = $model->setTable('business')->select('currency')->where($where)->findAll();
|
||||
$terms_data = $this->BusinessModel->select('terms,signature,80G as eightyG ,12AA as twelveAA,80G_vaildupto as eightyGVaildUpto,12AA_vaildupto as twelveAAVaildUpto')->where($where)->findAll();
|
||||
$data = $model->getInvoiceData($id);
|
||||
// Check if data is empty
|
||||
if (!$data || !$currency_data) {
|
||||
throw new \Exception('Data not found or empty');
|
||||
}
|
||||
|
||||
$options = new Options();
|
||||
$options->set('defaultFont', 'DejaVu Sans');
|
||||
$options->set('isHtml5ParserEnabled', true);
|
||||
$options->set('isFontSubsettingEnabled', true);
|
||||
$options->set('isPhpEnabled', true);
|
||||
$options->set('isRemoteEnabled', true);
|
||||
$options->set('font_subsetting', true);
|
||||
$options->set('tempDir', sys_get_temp_dir());
|
||||
//$options->set('chroot', base_url()."public/uploads");
|
||||
$options->set('chroot', FCPATH . 'public/uploads');
|
||||
|
||||
$dompdf = new Dompdf($options);
|
||||
|
||||
define("DOMPDF_UNICODE_ENABLED", true);
|
||||
$user = $this->UserModel->select('first_name, last_name')->where('user_id',$data[0]->created_by)->findAll();
|
||||
|
||||
clearstatcache();
|
||||
|
||||
$logoPath = FCPATH . "public/uploads/" . $data[0]->business_logo;
|
||||
$baseurl = $data[0]->business_logo && file_exists($logoPath) ? base_url("public/uploads/" . $data[0]->business_logo) : base_url("public/uploads/default.png");
|
||||
|
||||
$digits = strlen((string)$data[0]->amount);
|
||||
$amount_in_words = $digits <= 9 ? $this->convertNumberToWords($data[0]->amount) : $data[0]->amount;
|
||||
$html = view('invoice_pdf_template', [
|
||||
'data' => $data[0],
|
||||
'currency' => $data[0]->currency,
|
||||
'currency_in_words' => $amount_in_words ,
|
||||
'baseurl' => $baseurl,
|
||||
'signature' => $data[0]->signature,
|
||||
'staff_name' => $user[0]['first_name'] . ' ' .$user[0]['last_name'],
|
||||
'Notes' => $terms_data[0]['terms'],
|
||||
'eightyG' => $terms_data[0]['eightyG'],
|
||||
'eightyGVaildUpto' => $terms_data[0]['eightyGVaildUpto'],
|
||||
'twelveAA' => $terms_data[0]['twelveAA'],
|
||||
'twelveAAVaildUpto' => $terms_data[0]['twelveAAVaildUpto'],
|
||||
|
||||
]);
|
||||
//echo $html;die;
|
||||
|
||||
$dompdf->loadHtml($html);
|
||||
// $dompdf->setPaper('letter', 'landscape');
|
||||
|
||||
$dompdf->setPaper('A5', 'landscape');
|
||||
|
||||
$dompdf->render();
|
||||
|
||||
if($dest == 'mail') {
|
||||
// Generate filename based on current date and time
|
||||
// $filename = date('dmYHis') . '.pdf';
|
||||
|
||||
// // Save PDF file to a directory
|
||||
// $outputFilePath = base_url() . 'pdf/' . $filename; // Assuming WRITEPATH is defined
|
||||
// file_put_contents($outputFilePath, $dompdf->output());
|
||||
|
||||
// // Provide download link with the generated filename
|
||||
// $downloadLink = base_url() . 'pdf/' . $filename;
|
||||
// echo $downloadLink;die;
|
||||
return $html;
|
||||
}
|
||||
$original_name = isset($data[0]->receipt_number) && !empty($data[0]->receipt_number) ? $data[0]->receipt_number : 'Receipt';
|
||||
$sanitized_name = preg_replace("/[^A-Za-z0-9_\-\.]/", "_", $original_name);
|
||||
$pdf_extension_name = $sanitized_name . '.pdf';
|
||||
$dompdf->stream($pdf_extension_name, ['Attachment' => 1]);
|
||||
} catch (\Exception $e) {
|
||||
// Handle the exception
|
||||
// For example, log the error, display a user-friendly message, or return an error response
|
||||
echo 'Error: ' . $e->getMessage();
|
||||
log_message('error', sprintf(
|
||||
"Exception caught: [message: %s] [code: %d] [file: %s] [line: %d]",
|
||||
$e->getMessage(), $e->getCode(),$e->getFile(),$e->getLine()
|
||||
));
|
||||
log_message('error', $e->getTraceAsString());
|
||||
}
|
||||
}
|
||||
|
||||
public function convertNumberToWords($number) {
|
||||
$words = array(
|
||||
0 => 'Zero',
|
||||
1 => 'One',
|
||||
2 => 'Two',
|
||||
3 => 'Three',
|
||||
4 => 'Four',
|
||||
5 => 'Five',
|
||||
6 => 'Six',
|
||||
7 => 'Seven',
|
||||
8 => 'Eight',
|
||||
9 => 'Nine',
|
||||
10 => 'Ten',
|
||||
11 => 'Eleven',
|
||||
12 => 'Twelve',
|
||||
13 => 'Thirteen',
|
||||
14 => 'Fourteen',
|
||||
15 => 'Fifteen',
|
||||
16 => 'Sixteen',
|
||||
17 => 'Seventeen',
|
||||
18 => 'Eighteen',
|
||||
19 => 'Nineteen',
|
||||
20 => 'Twenty',
|
||||
30 => 'Thirty',
|
||||
40 => 'Forty',
|
||||
50 => 'Fifty',
|
||||
60 => 'Sixty',
|
||||
70 => 'Seventy',
|
||||
80 => 'Eighty',
|
||||
90 => 'Ninety'
|
||||
);
|
||||
|
||||
// Special case for zero
|
||||
if ($number == 0) {
|
||||
return $words[0];
|
||||
}
|
||||
|
||||
$num = (int)$number;
|
||||
$result = '';
|
||||
|
||||
// Handle numbers greater than 10 million (crores)
|
||||
if ($num >= 10000000) {
|
||||
$crores = floor($num / 10000000);
|
||||
$result .= $this->convertNumberToWords($crores) . ' Crore ';
|
||||
$num %= 10000000;
|
||||
}
|
||||
|
||||
// Handle numbers between 1 million and 9 million (lakhs)
|
||||
if ($num >= 100000) {
|
||||
$lakhs = floor($num / 100000);
|
||||
$result .= $this->convertNumberToWords($lakhs) . ' Lakh ';
|
||||
$num %= 100000;
|
||||
}
|
||||
|
||||
// Handle numbers between 1000 and 99999
|
||||
if ($num >= 1000) {
|
||||
$thousands = floor($num / 1000);
|
||||
$result .= $this->convertNumberToWords($thousands) . ' Thousand ';
|
||||
$num %= 1000;
|
||||
}
|
||||
|
||||
// Handle numbers between 100 and 999
|
||||
if ($num >= 100) {
|
||||
$hundreds = floor($num / 100);
|
||||
$result .= $words[$hundreds] . ' Hundred ';
|
||||
$num %= 100;
|
||||
}
|
||||
|
||||
// Handle numbers between 20 and 99
|
||||
if ($num >= 20) {
|
||||
$tens = floor($num / 10) * 10;
|
||||
$result .= $words[$tens] . ' ';
|
||||
$num %= 10;
|
||||
}
|
||||
|
||||
// Handle numbers between 1 and 19
|
||||
if ($num > 0) {
|
||||
$result .= $words[$num];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
## For Ajax Call To Retrive Donor Details Based On Donor type...
|
||||
public function get_donor_details()
|
||||
{
|
||||
helper('session');
|
||||
$model = new InvoiceModel();
|
||||
$value = $this->request->getPost('donor_type');
|
||||
//For Donor Name And Donor Mobile Number Dropdown..
|
||||
$where = ['business_id' => (int)get_business_id() , 'donor_type'=>$value, 'isactive' => 1];
|
||||
$data['donor_details'] = $model->getData('donor', $where);
|
||||
return $this->response->setJSON(['data' => $data]);
|
||||
}
|
||||
|
||||
public function export_receipt(){
|
||||
helper('session');
|
||||
$session_bid = (int)get_business_id();
|
||||
|
||||
$model = new InvoiceModel();
|
||||
$where = ['business_id' => $session_bid];
|
||||
$receipt = $model->where($where)->findAll();
|
||||
$alldonors = $model->getData('donor', ['business_id' => $session_bid , 'isactive' => 1]);
|
||||
$export = [];
|
||||
|
||||
if(!empty($receipt)){
|
||||
foreach ($receipt as $key => $value) {
|
||||
$export[$key]['receipt_number'] = $receipt[$key]['receipt_number'] ;
|
||||
$export[$key]['receipt_date'] = (isset($receipt[$key]['receipt_date']) && !empty($receipt[$key]['receipt_date']) && strtotime($receipt[$key]['receipt_date']) !== false)
|
||||
? date("d-m-Y", strtotime($receipt[$key]['receipt_date']))
|
||||
: '-';
|
||||
$export[$key]['receipt_type'] = $receipt[$key]['receipt_type'];
|
||||
$export[$key]['donor'] = '';
|
||||
|
||||
foreach ($alldonors as $DonorData) {
|
||||
if ($receipt[$key]['donor_id'] === $DonorData->donor_id) {
|
||||
$suffix = "";
|
||||
if ($receipt[$key]['receipt_type'] == "organization" && !empty($DonorData->org_name)) {
|
||||
$suffix = !empty($DonorData->org_name) ? " (" . $DonorData->org_name . ")" : " (-)";
|
||||
}
|
||||
$export[$key]['donor'] = $DonorData->first_name . ' ' . $DonorData->last_name . $suffix;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$currencySymbol = '';
|
||||
switch (strtoupper($receipt[$key]['currency'])) {
|
||||
case 'RS':
|
||||
case 'INR': $currencySymbol = '₹'; break;
|
||||
case 'USD': $currencySymbol = '$'; break;
|
||||
case 'EUR': $currencySymbol = '€'; break;
|
||||
default: $currencySymbol = ''; break;
|
||||
}
|
||||
$export[$key]['amount'] = $currencySymbol . ' ' . $receipt[$key]['amount'];
|
||||
$paymentMode = '';
|
||||
switch (strtoupper($receipt[$key]['payment_mode'])) {
|
||||
case 'DEBIT': $paymentMode = 'Debit Card'; break;
|
||||
case 'CREDIT': $paymentMode = 'Credit Card'; break;
|
||||
case 'CASH': $paymentMode = 'Cash'; break;
|
||||
case 'UPI': $paymentMode = 'UPI'; break;
|
||||
default: $paymentMode = $receipt[$key]['payment_mode']; break;
|
||||
}
|
||||
$status = '';
|
||||
switch (strtoupper($receipt[$key]['receipt_header'])) {
|
||||
case 'TEMPORARY RECEIPT ': $status = 'Draft'; break;
|
||||
case 'RECEIPT': $status = 'Completed'; break;
|
||||
case 'REJECTED': $status = 'Rejected'; break;
|
||||
default: $status = $receipt[$key]['receipt_header']; break;
|
||||
}
|
||||
$export[$key]['status'] = $status;
|
||||
$export[$key]['payment_mode'] = $paymentMode;
|
||||
$export[$key]['payment_ref_no'] = $receipt[$key]['payment_ref_no'];
|
||||
$export[$key]['notes'] = $receipt[$key]['notes'] == null ? '-' : $receipt[$key]['notes'];
|
||||
$export[$key]['reason'] = ($receipt[$key]['reason'] == null) ? '-' :$receipt[$key]['reason'];
|
||||
$export[$key]['created_by'] = $this->UserModel->where('user_id', $receipt[$key]['created_by'])->get()->getRow()->first_name;// 2
|
||||
$export[$key]['updated_by'] = (isset($receipt[$key]['updated_by']) && !empty($receipt[$key]['updated_by']) && $receipt[$key]['updated_by'] !== null)
|
||||
? $this->UserModel->where('user_id', $receipt[$key]['updated_by'])->get()->getRow()->first_name
|
||||
: '-';// 2
|
||||
$export[$key]['created_on'] = (isset($receipt[$key]['created_on']) && !empty($receipt[$key]['created_on']) && strtotime($receipt[$key]['created_on']) !== false)
|
||||
? date("d-m-Y", strtotime($receipt[$key]['created_on']))
|
||||
: '-';
|
||||
$export[$key]['updated_on'] = (isset($receipt[$key]['updated_on']) && !empty($receipt[$key]['updated_on']) && strtotime($receipt[$key]['updated_on']) !== false)
|
||||
? date("d-m-Y", strtotime($receipt[$key]['updated_on']))
|
||||
: '-';
|
||||
$export[$key]['isactive'] = (int)$receipt[$key]['isactive'] == 1 ? 'Active' : 'Inactive';
|
||||
}
|
||||
}
|
||||
$this->fetch_receipt($export);
|
||||
}
|
||||
public function fetch_receipt($export){
|
||||
$spreadsheet = new Spreadsheet(); // instantiate Spreadsheet
|
||||
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
$sheet->mergeCells('B3:R3');
|
||||
$sheet->getStyle('B3')->getAlignment()->setHorizontal('center');
|
||||
$sheet->setTitle('Receipt details');
|
||||
|
||||
$headers = [
|
||||
'B3' => 'Receipt Details',
|
||||
'A5' => 'Receipt Number',
|
||||
'B5' => 'Receipt Date',
|
||||
'C5' => 'Receipt Type',
|
||||
'D5' => 'Contributor Name',
|
||||
'E5' => 'Amount',
|
||||
'F5' => 'Status',
|
||||
'G5' => 'Payment Mode',
|
||||
'H5' => 'Payment Ref no',
|
||||
'I5' => 'Notes',
|
||||
'J5' => 'Reason',
|
||||
'K5' => 'CreatedBy',
|
||||
'L5' => 'UpdatedBy',
|
||||
'M5' => 'CreatedAt',
|
||||
'N5' => 'UpdatedAt',
|
||||
'O5' => 'IsActive'
|
||||
];
|
||||
foreach ($headers as $cell => $value) {
|
||||
$sheet->setCellValue($cell, $value);
|
||||
$sheet->getStyle($cell)->getFont()->setSize($cell == 'B3' ? 14 : 12);
|
||||
$sheet->getStyle($cell)->getFont()->setBold(true);
|
||||
}
|
||||
|
||||
if($export){
|
||||
$row = 6; // Start from row 6
|
||||
foreach ($export as $d) {
|
||||
$col = 'A'; // Start from column A
|
||||
foreach ($d as $value) {
|
||||
if (is_numeric($value)) {
|
||||
$sheet->setCellValueExplicit($col . $row, $value, DataType::TYPE_STRING);
|
||||
$sheet->getStyle($col . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_NUMBER);
|
||||
} else {
|
||||
$sheet->setCellValue($col . $row, $value);
|
||||
}
|
||||
$sheet->setCellValue($col . $row, $value);
|
||||
$col++;
|
||||
}
|
||||
$row++;
|
||||
}
|
||||
}
|
||||
// Clear the output buffer to prevent any other output
|
||||
ob_clean();
|
||||
|
||||
$writer = new Xlsx($spreadsheet);
|
||||
$filename = 'exportReceipt.xlsx';
|
||||
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="'. $filename .'"');
|
||||
header('Cache-Control: max-age=0');
|
||||
header('Expires: 0');
|
||||
header('Pragma: public');
|
||||
|
||||
$writer->save('php://output');
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
public function import_receipt()
|
||||
{
|
||||
|
||||
$ip_address = $_SERVER['REMOTE_ADDR'];
|
||||
$InvoiceModel = new InvoiceModel();
|
||||
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
$session_bid = get_business_id();
|
||||
|
||||
$json = []; // Arr - Json For Message FrontEnd
|
||||
$list = []; // Arr - Store on DB
|
||||
$path = ROOTPATH . 'public/import/receipt/';
|
||||
$fileNewName = "";
|
||||
|
||||
$file = $this->request->getFile('file');
|
||||
|
||||
if (!is_dir($path)) {
|
||||
mkdir($path, 0777, true);
|
||||
}
|
||||
|
||||
$fileName = $file->getName();
|
||||
if ($fileName !== "") {
|
||||
if ($file->isValid() && !$file->hasMoved()) {
|
||||
$newName = $file->getRandomName();
|
||||
$file->move($path, $newName);
|
||||
$fileNewName = $newName;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$fileNewName) {
|
||||
$json = ['error_message' => "Failed to upload file"];
|
||||
return $this->response->setJSON($json);
|
||||
}
|
||||
|
||||
$arr_file = explode('.', $fileName);
|
||||
$extension = $arr_file[1];
|
||||
if ('csv' == $extension) {
|
||||
$reader = new ReaderCsv();
|
||||
} else if ('xlsx' == $extension) {
|
||||
$reader = new ReaderXlsx();
|
||||
} else {
|
||||
$json = ['error_message' => "Unsupported file type"];
|
||||
return $this->response->setJSON($json);
|
||||
}
|
||||
|
||||
if (!$reader) {
|
||||
$json = ['error_message' => "Failed to initialize reader"];
|
||||
return $this->response->setJSON($json);
|
||||
}
|
||||
|
||||
$spreadsheet = $reader->load($path.$fileNewName);
|
||||
$sheet_data = $spreadsheet->getActiveSheet()->toArray();
|
||||
|
||||
if(!empty($sheet_data)){
|
||||
foreach ($sheet_data as $key => $val) {
|
||||
if ($key != 0) { // key zero - header
|
||||
$list[] = [
|
||||
'business_id' => $session_bid,
|
||||
'first_name' => $val[0],
|
||||
'donor_type' => $val[1],
|
||||
'org_name' => $val[2] ? $val[2] : null ,
|
||||
'org_reg_details' => $val[3] ? $val[3] : null,
|
||||
'mobile_no' => $val[4] ? $val[4] : null,
|
||||
'email' => $val[5],
|
||||
'pan_no' => $val[6],
|
||||
'adhar_no' => $val[7],
|
||||
'passport_no' => $val[8] ? $val[8] : null ,
|
||||
'address' => $val[9],
|
||||
'country' => $val[10],
|
||||
'state' => $val[11],
|
||||
'city' => $val[12],
|
||||
'postal_code' => $val[13],
|
||||
'created_by' => $session_uid,
|
||||
'XL_file_name' => $fileNewName,
|
||||
'ip_address' => $ip_address
|
||||
];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$json = ['error_message' => "There is no record to import"];
|
||||
return $this->response->setJSON($json);
|
||||
}
|
||||
|
||||
if (count($list) > 0) {
|
||||
$result = $InvoiceModel->bulkInsert($list);
|
||||
($result) ? ['success_message' => "All Entries are imported successfully."]
|
||||
: ['error_message' => "Something went wrong. Please try again."];
|
||||
} else {
|
||||
$json = ['error_message' => "No new record is found."];
|
||||
}
|
||||
return $this->response->setJSON($json);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,230 +0,0 @@
|
||||
<?php namespace App\Controllers;
|
||||
|
||||
use App\Models\My_model;
|
||||
use App\Models\Dashboard_model;
|
||||
use App\Models\Address_model;
|
||||
|
||||
class My_controller extends BaseController
|
||||
{
|
||||
public $session;
|
||||
public function __construct()
|
||||
{
|
||||
$this->session = session();
|
||||
$this->My_model = new My_model();
|
||||
$this->Dashboard_model = new Dashboard_model();
|
||||
}
|
||||
|
||||
// public function donor_register() {
|
||||
// helper(['form', 'url']);
|
||||
|
||||
// $input = $this->validate([
|
||||
// 'name' =>'required|min_length[3]|max_length[20]',
|
||||
// 'phone' =>'required|min_length[3]|max_length[10]',
|
||||
// 'email' =>'required|min_length[6]|max_length[50]|valid_email|is_unique[donar_management.email]',
|
||||
// 'pan' =>'required|min_length[3]|max_length[20]',
|
||||
// 'address' =>'required|min_length[3]|max_length[70]',
|
||||
// 'country' =>'required',
|
||||
// 'state' =>'required',
|
||||
// 'city' =>'required',
|
||||
// 'pin_code' =>'required|min_length[6]|max_length[6]',
|
||||
// 'date_of_birth' =>'required|min_length[3]|max_length[20]',
|
||||
// 'gender' =>'required',
|
||||
// 'org_name' =>'required|min_length[3]|max_length[20]',
|
||||
// 'gstin' =>'required|min_length[3]|max_length[20]',
|
||||
// ]);
|
||||
|
||||
// $formModel = new FormModel();
|
||||
|
||||
// if (!$input) {
|
||||
// echo view('contact_form', [
|
||||
// 'validation' => $this->validator
|
||||
// ]);
|
||||
// } else {
|
||||
// $formModel->save([
|
||||
// 'name' => $this->request->getVar('name'),
|
||||
// 'email' => $this->request->getVar('email'),
|
||||
// 'phone' => $this->request->getVar('phone'),
|
||||
// ]);
|
||||
|
||||
// return $this->response->redirect(site_url('/submit-form'));
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
public function donor_register()
|
||||
{
|
||||
|
||||
$data['country']=$this->Dashboard_model->fetch_country();
|
||||
helper(['form', 'url']);
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($this->request->getmethod() == 'post')
|
||||
{
|
||||
// validate
|
||||
$rules=[
|
||||
'name' =>'required|min_length[3]|max_length[20]',
|
||||
'phone' =>'required|min_length[10]|max_length[12]|is_unique[donar_management.phone]',
|
||||
'email' =>'required|min_length[6]|max_length[50]|valid_email|is_unique[donar_management.email]',
|
||||
'pan' =>'required|min_length[10]|max_length[10]|is_unique[donar_management.pan]',
|
||||
'address' =>'required|min_length[3]|max_length[70]',
|
||||
'pin_code' =>'required|min_length[6]|max_length[6]',
|
||||
'date_of_birth' =>'required|min_length[6]|max_length[10]',
|
||||
'org_name' =>'required|min_length[3]|max_length[20]',
|
||||
'gstin' =>'required|min_length[15]|max_length[15]|is_unique[donar_management.gstin]',
|
||||
];
|
||||
|
||||
if(! $this->validate($rules))
|
||||
{
|
||||
$data['validation'] = $this->validator;
|
||||
//echo '<script>alert("Please import correct file, did not match excel sheet column")</script>';
|
||||
}else{
|
||||
$Address_model = new Address_model();
|
||||
|
||||
$country_id=$this->request->getVar('country');
|
||||
$state_id=$this->request->getVar('state');
|
||||
$city_id=$this->request->getVar('city');
|
||||
|
||||
$country_name=$Address_model->country($country_id);
|
||||
foreach($country_name as $key){ $key['country_name']; }
|
||||
$country=$key['country_name'];
|
||||
$state_name=$Address_model->state($state_id);
|
||||
foreach($state_name as $key){ $key['state_name']; }
|
||||
$state=$key['state_name'];
|
||||
$city_name=$Address_model->city($city_id);
|
||||
foreach($city_name as $key){ $key['city_name']; }
|
||||
$city=$key['city_name'];
|
||||
|
||||
$model = new My_model();
|
||||
$donorData=[
|
||||
'name' =>$this->request->getVar('name'),
|
||||
'phone' =>$this->request->getVar('phone'),
|
||||
'email' =>$this->request->getVar('email'),
|
||||
'pan' =>$this->request->getVar('pan'),
|
||||
'address' =>$this->request->getVar('address'),
|
||||
'country' =>$country,
|
||||
'state' =>$state,
|
||||
'city' =>$city,
|
||||
'pin_code' =>$this->request->getVar('pin_code'),
|
||||
'date_of_birth' =>$this->request->getVar('date_of_birth'),
|
||||
'gender' =>$this->request->getVar('gender'),
|
||||
'org_name' =>$this->request->getVar('org_name'),
|
||||
'gstin' =>$this->request->getVar('gstin'),
|
||||
|
||||
|
||||
];
|
||||
//print_r($donorData); die();
|
||||
$model->save($donorData);
|
||||
$session = session();
|
||||
$session ->setFlashdata('success','Successful Added');
|
||||
return redirect()->to(base_url().'/all_donor');
|
||||
}
|
||||
}
|
||||
|
||||
// echo view('templates/header',$data);
|
||||
return view('donor_registration');
|
||||
// echo view('templates/footer');
|
||||
|
||||
}
|
||||
|
||||
public function all_donor()
|
||||
{
|
||||
$data = [];
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
|
||||
|
||||
$data['receiptdata']=$this->My_model->all_donor();
|
||||
|
||||
return view('donor_table',$data);
|
||||
|
||||
}
|
||||
function edit_donor($id)
|
||||
{
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
$model = new My_model();
|
||||
$donor_data=$model->find($id);
|
||||
$data= [ 'post'=>$donor_data ];
|
||||
|
||||
if($this->request->getMethod() == 'post')
|
||||
{
|
||||
$model = new My_model();
|
||||
$_POST['id'] = $id;
|
||||
$model->save($_POST);
|
||||
return redirect()->to(base_url()."/all_donor");
|
||||
}
|
||||
return view('donor_edit',$data);
|
||||
|
||||
}
|
||||
function update_donor()
|
||||
{
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
|
||||
$donor_id=$this->request->getVar('id');
|
||||
|
||||
|
||||
$DonorData=[
|
||||
|
||||
'name' =>$this->request->getVar('name'),
|
||||
'phone' =>$this->request->getVar('phone'),
|
||||
'email' =>$this->request->getVar('email'),
|
||||
'pan' =>$this->request->getVar('pan'),
|
||||
'address' =>$this->request->getVar('address'),
|
||||
'country' =>$this->request->getVar('country'),
|
||||
'state' =>$this->request->getVar('state'),
|
||||
'city' =>$this->request->getVar('city'),
|
||||
'pin_code' =>$this->request->getVar('pin_code'),
|
||||
'date_of_birth' =>$this->request->getVar('date_of_birth'),
|
||||
'gender' =>$this->request->getVar('gender'),
|
||||
'org_name' =>$this->request->getVar('org_name'),
|
||||
'gstin' =>$this->request->getVar('gstin'),
|
||||
];
|
||||
//print_r($DonorData);die();
|
||||
$model = new My_model();
|
||||
$model->update($donor_id , $DonorData);
|
||||
return redirect()->to(base_url().'/all_donor');
|
||||
|
||||
}
|
||||
|
||||
function fetch_country()
|
||||
{
|
||||
|
||||
echo $this->Dashboard_model->fetch_country();
|
||||
|
||||
}
|
||||
function fetch_state()
|
||||
{
|
||||
|
||||
if($this->request->getVar('country_id'))
|
||||
{
|
||||
echo $this->Dashboard_model->fetch_state($this->request->getVar('country_id'));
|
||||
}
|
||||
}
|
||||
|
||||
function fetch_city()
|
||||
{
|
||||
if($this->request->getVar('state_id'))
|
||||
{
|
||||
echo $this->Dashboard_model->fetch_city($this->request->getVar('state_id'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
}
|
||||
788
app/Controllers/Notifications.php
Executable file
788
app/Controllers/Notifications.php
Executable file
@ -0,0 +1,788 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Helpers\NotificationHelper;
|
||||
use App\Models\NotificationModel;
|
||||
|
||||
class Notifications extends BaseController
|
||||
{
|
||||
|
||||
################################################################
|
||||
# Custom Email Notification
|
||||
################################################################
|
||||
public function mail_custom_notifications()
|
||||
{
|
||||
if ($this->request->is('post')) {
|
||||
$records = $this->request->getVar();
|
||||
helper('notification');
|
||||
$notification = new NotificationHelper();
|
||||
$data = $notification->sendEmail($records);
|
||||
$parents_status = 0;
|
||||
$receiving_status = 0;
|
||||
if (isset($data['error'])) {
|
||||
session()->setFlashdata('error', 'Message: ' . $data['error']);
|
||||
$history_msg = $data;
|
||||
}
|
||||
if (isset($data['success'])) {
|
||||
session()->setFlashdata('success', 'Message: ' . $data['success']);
|
||||
$parents_status = 1;
|
||||
$receiving_status = 1;
|
||||
$history_msg = 'Email sent successfully';
|
||||
}
|
||||
$history_msg = (strtolower(gettype($history_msg)) == "string" ? $history_msg : json_encode($history_msg)) ;
|
||||
$NotificationModel = new NotificationModel();
|
||||
$history_parents_data = ['campaign_id' => 0,'status' => $parents_status];
|
||||
$history_parent_id = $NotificationModel->save_notification_history_parents($history_parents_data);
|
||||
$history_child_data = [ 'fkid' => $history_parent_id,
|
||||
'donor_id' => 0,
|
||||
'receiving_entity' => $records['recipient_email'],
|
||||
'receiving_status' => $receiving_status,
|
||||
'message' => $records['description'],
|
||||
'result'=>strtolower(gettype($history_msg)) == "string" ? $history_msg : json_encode($history_msg)];
|
||||
$history_child_id = $NotificationModel->save_notification_history_child($history_child_data);
|
||||
$this->logger->info('Custom Notifications Email : historychildid = '.$history_child_id);
|
||||
}
|
||||
$records = [];
|
||||
$data['page_name'] = 'Custom Notifications';
|
||||
$this->render_page('notifications_form', $data);
|
||||
}
|
||||
# mail custom notifications closed
|
||||
|
||||
################################################################
|
||||
# Custom Whatsapp Notification
|
||||
################################################################
|
||||
public function whatsapp_custom_notifications()
|
||||
{
|
||||
if ($this->request->is('post')) {
|
||||
$records = $this->request->getVar();
|
||||
$params = (object) Null;
|
||||
$parents_status = 0;
|
||||
$receiving_status = 0;
|
||||
$this->logger->info("Whatsapp : sending message instance id = " . '65C9B978325A2' . " - " . '65c715e797d16');
|
||||
try {
|
||||
if ($records['categories'] == 'SEND_WAAI_GROUP_URL') {
|
||||
if ($records['group_id'] != "") {
|
||||
$params->group_id = $records['group_id'];
|
||||
} else {
|
||||
throw new \Exception("Group Id Missing Please Try again..");
|
||||
}
|
||||
if ($records['mobile'] != "") {
|
||||
$params->number = (int)'91' . $records['mobile'];
|
||||
} else {
|
||||
throw new \Exception("Mobile Number Missing Please Try again..");
|
||||
}
|
||||
} else if ($records['categories'] == 'SEND_WAAI_URL') {
|
||||
if ($records['mobile'] != "") {
|
||||
$params->number = (int)'91' . $records['mobile'];
|
||||
} else {
|
||||
throw new \Exception("Mobile Number Missing Please Try again..");
|
||||
}
|
||||
} else {
|
||||
throw new \Exception("Please Choose your Category");
|
||||
}
|
||||
if ($records['type'] == 'media') {
|
||||
if ($records['media_url'] != "") {
|
||||
$params->media_url = $records['media_url'];
|
||||
} else {
|
||||
throw new \Exception("Media Url Missing Please Try again..");
|
||||
}
|
||||
}
|
||||
|
||||
$url = constant($records['categories']);
|
||||
$params->type = $records['type'] == "" ? "text" : $records['type'];
|
||||
$params->instance_id = '65C9B978325A2';
|
||||
$params->access_token = '65c715e797d16';
|
||||
$params->message = $records['description'];
|
||||
$this->logger->info("Whatsapp : sending message request = " . json_encode($params));
|
||||
$this->logger->info("Whatsapp : sending message request type b4 = " . gettype($params));
|
||||
helper('notification');
|
||||
$notification = new NotificationHelper();
|
||||
$success = $notification->sendWhatsAppMessage($url, "POST", $params);
|
||||
$receiving_status = $success['receiving_status'];
|
||||
$parents_status = $success['receiving_status'];
|
||||
$history_msg = strtolower(gettype($success)) == "string" ? $success : json_encode($success['reponse']);
|
||||
session()->setFlashdata('success', 'Message : Success');
|
||||
$this->logger->info("Whatsapp : Reponse = " . $success['message']);
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error("Whatsapp : Exception Message = " . $e->getMessage() . "<br> File: " . $e->getFile() . "<br> Line: " . $e->getLine() . "<br>");
|
||||
session()->setFlashdata('error', 'Message: Failed');
|
||||
$history_msg = strtolower(gettype($success)) == "string" ? $success : json_encode($success['reponse']);
|
||||
}
|
||||
$NotificationModel = new NotificationModel();
|
||||
$history_parents_data = ['campaign_id' => 0,'status' => $parents_status];
|
||||
$history_parent_id = $NotificationModel->save_notification_history_parents($history_parents_data);
|
||||
$history_child_data = [ 'fkid' => $history_parent_id,
|
||||
'donor_id' => 0,
|
||||
'receiving_entity' => $records['mobile'],
|
||||
'receiving_status' => $receiving_status,
|
||||
'message' => $records['description'],
|
||||
'result'=>$history_msg];
|
||||
$history_child_id = $NotificationModel->save_notification_history_child($history_child_data);
|
||||
}
|
||||
$records = [];
|
||||
$data['page_name'] = 'Custom Notifications';
|
||||
$this->render_page('notifications_form', $data);
|
||||
$this->logger->info('Custom Notifications Whatsapp : historychildid = '.$history_child_id);
|
||||
}
|
||||
# whatsapp custom notifications closed
|
||||
|
||||
public function due_date_notifications()
|
||||
{
|
||||
$date = $this->request->getGet('date');
|
||||
|
||||
$model = new NotificationModel();
|
||||
$details = $model->getSubscriptionDueDetail($date);
|
||||
// echo "<pre>";
|
||||
// print_r($details);
|
||||
// echo "</pre>";
|
||||
// die;
|
||||
$records = [];
|
||||
$recipient_name = "";
|
||||
$recipient_email = "";
|
||||
$recipient_mobile = "";
|
||||
$subscription_name = "";
|
||||
$business_name = "";
|
||||
$to_subscription = "";
|
||||
if (isset($details)) {
|
||||
$this->logger->info("Notification : Duedate notification Request data type = " . gettype($details));
|
||||
}
|
||||
helper('notification');
|
||||
$notification = new NotificationHelper();
|
||||
foreach ($details as $rec) {
|
||||
$recipient_name = $rec['customer_name'];
|
||||
$recipient_email = $rec['customer_email'];
|
||||
$recipient_mobile = $rec['customer_mobile'];
|
||||
// $recipient_email = "sanjeev.p@venbainfotech.com";
|
||||
// $recipient_mobile = 6369084112;
|
||||
$business_name = $rec['business_name'];
|
||||
$subscription_name = $rec['title'];
|
||||
$to_subscription = $rec['to_subscription'];
|
||||
}
|
||||
$records['template_name'] = '';
|
||||
$records['recipient_name'] = $recipient_name;
|
||||
$records['recipient_email'] = $recipient_email ? $recipient_email : "sanjeev.p@venbainfotech.com";
|
||||
$records['subject'] = $business_name . " - Due Date Reminder";
|
||||
$records['description'] = "<!DOCTYPE html>
|
||||
<html>
|
||||
<head><title>Due Date Reminder</title></head>
|
||||
<body>
|
||||
<p>Hello " . $recipient_name . ",</p>
|
||||
<p>This is a reminder that the following subscription is due soon:</p>
|
||||
<p><strong>Subscription Name:</strong>" . $subscription_name . " </p>
|
||||
<p><strong>Due Date:</strong> " . $to_subscription . "</p>
|
||||
<p>Please make sure to complete this subscription on time.</p>
|
||||
<p>Thank you.</p>
|
||||
</body>
|
||||
</html>";
|
||||
|
||||
$template = "Hello " . $recipient_name . ",\r\r\n\nThis is a reminder that the following subscription is due soon:\r\n- Subscription Name: " . $subscription_name . "\r\n Due Date: " . $to_subscription . "\r\n\nPlease make sure to complete this subscription on time.\n Thank you.";
|
||||
|
||||
$params = (object) Null;
|
||||
$params->number = (int)'91' . $recipient_mobile;
|
||||
$params->type = "text";
|
||||
$params->message = $template;
|
||||
$params->instance_id = $_ENV['WAAI_INSTANCE'];
|
||||
$params->access_token = $_ENV['WAAI_TOKEN'];
|
||||
$this->logger->info("Notification : Duedate notification Email Request data = " . json_encode($records));
|
||||
|
||||
$email_result = $notification->sendEmail($records);
|
||||
$this->logger->info("Notification : Duedate notification Email Response = " . json_encode($email_result));
|
||||
$this->logger->info("Notification : Duedate notification Whatsapp Request data = " . json_encode($params));
|
||||
$whatsapp_result = $notification->sendWhatsAppMessage(SEND_WAAI_URL, "POST", $params);
|
||||
$this->logger->info("Notification : Duedate notification Whatsapp Response = " . json_encode($whatsapp_result));
|
||||
}
|
||||
|
||||
public function template_creation()
|
||||
{
|
||||
$session_bid = get_business_id();
|
||||
$data['page_name'] = 'Template Details';
|
||||
$model = new NotificationModel();
|
||||
$data['template'] = $model->getTemplateDetails($session_bid);
|
||||
$this->render_page('template_creation', $data);
|
||||
// echo "templates";die;
|
||||
}
|
||||
|
||||
##################################################################
|
||||
# Template Creation Insertion/updation Process ReferWith : Sanjeev
|
||||
##################################################################
|
||||
public function template_creation_form($id)
|
||||
{
|
||||
|
||||
$data['group_details'] = $this->get_group_details();
|
||||
$model = new NotificationModel();
|
||||
if ($id === '0') {
|
||||
$this->logger->info("Template Creation: In Add Page");
|
||||
$data['page_name'] = 'Add Template';
|
||||
$data['template_details'] = [];
|
||||
} elseif ($id !== '0') {
|
||||
$this->logger->info("Template Creation: In Edit Page ID =" . $id);
|
||||
$data['page_name'] = 'Edit Template';
|
||||
$model->setTable('templates');
|
||||
$where = ['template_id' => (int)$id];
|
||||
$result = $model->where($where)->findAll();
|
||||
$data['template_details'] = !empty($result[0]) ? $result[0] : [];
|
||||
}
|
||||
// print_r($data['template_details']);die();
|
||||
$this->render_page('template_creation_form', $data);
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Template Creation Delection which means inactive Process ReferWith : Sanjeev
|
||||
##############################################################################
|
||||
public function template_creation_delete($id)
|
||||
{
|
||||
try {
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
$model = new NotificationModel();
|
||||
$model->setTable('templates');
|
||||
$where = ['template_id' => (int)$id];
|
||||
$result = $model->where($where)->findAll();
|
||||
if ($result) {
|
||||
$this->logger->Info("Template: Going to Inactive ID = " . $id);
|
||||
$data = ['isactive' => 0, 'updated_by' => $session_uid, 'template_id' => (int)$id];
|
||||
$statement = $model->saveDetails($data, 'template_id', 'templates'); // just updating Inactive status only.
|
||||
if ($statement['success']) {
|
||||
session()->setFlashdata('success', $statement['success'] ? 'Deleted successfully.' : "");
|
||||
$this->logger->info($statement['log']);
|
||||
} else if ($statement['error']) {
|
||||
session()->setFlashdata('error', $statement['error']);
|
||||
$this->logger->error($statement['log']);
|
||||
} else {
|
||||
throw new \Exception("Template: Err Occur on data the Template Inactive");
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error("Template: Err Occur = " . $e->getMessage() . " File = " . $e->getFile() . " Line = " . $e->getLine());
|
||||
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
|
||||
}
|
||||
return redirect()->route('template_creation');
|
||||
}
|
||||
|
||||
|
||||
public function get_group_details()
|
||||
{
|
||||
$model = new NotificationModel();
|
||||
$model->setTable('donor_groups');
|
||||
// $details = $model->where('isactive',1)->orderBy('group_id', 'ASC')->findAll();
|
||||
$where = ['isactive' => 1, 'group_name != ' => 'EXPIRYDATE'];
|
||||
$details = $model->where($where)->orderBy('group_id', 'ASC')->findAll();
|
||||
return $details;
|
||||
}
|
||||
|
||||
public function get_template_details()
|
||||
{
|
||||
$model = new NotificationModel();
|
||||
$model->setTable('templates');
|
||||
$details = $model
|
||||
->where(['templates.isactive' => 1])
|
||||
->whereNotIn('templates.template_name',array('EXPIRAY_NOTIFY_TEMPLATE_EMAIL','EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP'))
|
||||
->orderBy('templates.template_id', 'ASC')->findAll();
|
||||
return $details;
|
||||
}
|
||||
|
||||
public function template_creation_insert()
|
||||
{
|
||||
$this->logger->info("Template: Inserting/Updating Details");
|
||||
try {
|
||||
## Declarions
|
||||
helper('session');
|
||||
$model = new NotificationModel();
|
||||
$session_uid = get_logged_user_id();
|
||||
$id = $this->request->getPost('template_id');
|
||||
$subject = $this->request->getPost('subject') ? $this->request->getPost('subject') : NULL;
|
||||
$isactive = $id != "" ? $this->request->getPost('isactive') : 'on';
|
||||
$templatemessage = "";
|
||||
if($this->request->getPost('mode') === "Email"){
|
||||
$templatemessage = $this->request->getPost('templatemessage');
|
||||
}else if($this->request->getPost('mode') === "Whatsapp"){
|
||||
$templatemessage = $this->request->getPost('whatsapptemplatemessage');
|
||||
}
|
||||
|
||||
$data = [
|
||||
'template_id' => $id,
|
||||
'template_name' => $this->request->getPost('templatename'),
|
||||
'subject' => $subject,
|
||||
'message' => $templatemessage,
|
||||
'mode' => $this->request->getPost('mode'),
|
||||
'isactive' => (($isactive == 'on') ? 1 : 0),
|
||||
'created_by' => $session_uid,
|
||||
'updated_by' => $session_uid
|
||||
];
|
||||
$statement = $model->saveDetails($data, 'template_id', 'templates');
|
||||
if ($statement['success']) {
|
||||
session()->setFlashdata('success', $statement['success']);
|
||||
$this->logger->info($statement['log']);
|
||||
} else if ($statement['error']) {
|
||||
session()->setFlashdata('error', $statement['error']);
|
||||
$this->logger->error($statement['log']);
|
||||
} else {
|
||||
throw new \Exception("Template: Err Occur");
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error("Template: Err Occur =" . $e->getMessage());
|
||||
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
|
||||
}
|
||||
return redirect()->route('template_creation');
|
||||
}
|
||||
|
||||
|
||||
//Campaign Creation
|
||||
|
||||
public function campaign_creation()
|
||||
{ $session_bid = get_business_id();
|
||||
$data['page_name'] = 'Campaign Details';
|
||||
$model = new NotificationModel();
|
||||
$data['campaign'] = $model->getCampaignDetails($session_bid);
|
||||
$this->render_page('campaign_creation', $data);
|
||||
// echo "templates";die;
|
||||
}
|
||||
|
||||
public function campaign_creation_form($id)
|
||||
{
|
||||
|
||||
$data['group_details'] = $this->get_group_details();
|
||||
$data['template_details'] = $this->get_template_details();
|
||||
$model = new NotificationModel();
|
||||
if ($id === '0') {
|
||||
$this->logger->info("Campaign Creation: In Add Page");
|
||||
$data['page_name'] = 'Add Campaign';
|
||||
$data['campaign_details'] = [];
|
||||
} elseif ($id !== '0') {
|
||||
$this->logger->info("Campaign Creation: In Edit Page ID =" . $id);
|
||||
$data['page_name'] = 'Edit Campaign';
|
||||
$model->setTable('notification_campaign');
|
||||
$where = ['campaign_id' => (int)$id];
|
||||
$result = $model->where($where)->findAll();
|
||||
if (!empty($result)) {
|
||||
foreach ($result as $i => $item) {
|
||||
$result[$i]['group_id'] = unserialize($item['group_id']);
|
||||
}
|
||||
}
|
||||
$data['campaign_details'] = !empty($result[0]) ? $result[0] : [];
|
||||
}
|
||||
$this->render_page('campaign_creation_form', $data);
|
||||
}
|
||||
|
||||
public function campaign_creation_insert()
|
||||
{
|
||||
$this->logger->info("Campaign: Inserting/Updating Details");
|
||||
try {
|
||||
## Declarions
|
||||
helper('session');
|
||||
$model = new NotificationModel();
|
||||
$session_uid = get_logged_user_id();
|
||||
$id = $this->request->getPost('campaign_id');
|
||||
$request_data = $this->request->getPost();
|
||||
$isactive = $id == "" ? 1 : (isset($request_data['isactive']) && $request_data['isactive'] == 'on' ? 1 : 0);
|
||||
|
||||
$data = [
|
||||
'campaign_id' => $id,
|
||||
'campaign_name' => $this->request->getPost('campaign_name'),
|
||||
'template_id' => $this->request->getPost('template_id'),
|
||||
'scheduled_date' => $this->request->getPost('scheduled_date'),
|
||||
'scheduled_time' => $this->request->getPost('scheduled_time') != "" ? $this->request->getPost('scheduled_time') : NULL,
|
||||
'mode' => $this->request->getPost('mode'),
|
||||
'group_id' => serialize($this->request->getPost('group_id')),
|
||||
'isactive' => $isactive,
|
||||
'created_by' => $session_uid,
|
||||
'updated_by' => $session_uid
|
||||
];
|
||||
if ($id != "") {
|
||||
$notify_mod = new NotificationModel();
|
||||
$notify_mod->setTable('notification_campaign');
|
||||
$where = ['campaign_id' => (int)$id];
|
||||
$isactive_check = $notify_mod->where($where)->select('isactive')->first();
|
||||
if ((int)$isactive_check['isactive'] === 0 && $isactive === 0) {
|
||||
$statement['success'] = 'Notification Campaign already In-Active. can`t able to update.';
|
||||
$statement['error'] = "";
|
||||
$statement['log'] = "Notification Campaign: already inactive status.Can`t able to update, Notification Campaign Group ID = " . $id;
|
||||
} else {
|
||||
$statement = $model->saveDetails($data, 'campaign_id', 'notification_campaign');
|
||||
}
|
||||
} else {
|
||||
$statement = $model->saveDetails($data, 'campaign_id', 'notification_campaign');
|
||||
}
|
||||
if ($statement['success']) {
|
||||
session()->setFlashdata('success', $statement['success']);
|
||||
$this->logger->info($statement['log']);
|
||||
} else if ($statement['error']) {
|
||||
session()->setFlashdata('error', $statement['error']);
|
||||
$this->logger->error($statement['log']);
|
||||
} else {
|
||||
throw new \Exception("Campaign: Err Occur");
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error("Campaign: Err Occur =" . $e->getMessage());
|
||||
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
|
||||
}
|
||||
return redirect()->route('campaign_creation');
|
||||
}
|
||||
|
||||
public function campaign_creation_delete($id)
|
||||
{
|
||||
try {
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
$model = new NotificationModel();
|
||||
$model->setTable('notification_campaign');
|
||||
$where = ['campaign_id' => (int)$id];
|
||||
$result = $model->where($where)->findAll();
|
||||
if ($result) {
|
||||
$this->logger->Info("Campaign: Going to Inactive ID = " . $id);
|
||||
$data = ['isactive' => 0, 'updated_by' => $session_uid, 'campaign_id' => (int)$id];
|
||||
$statement = $model->saveDetails($data, 'campaign_id', 'notification_campaign'); // just updating Inactive status only.
|
||||
if ($statement['success']) {
|
||||
session()->setFlashdata('success', $statement['success'] ? 'Deleted successfully.' : "");
|
||||
$this->logger->info($statement['log']);
|
||||
} else if ($statement['error']) {
|
||||
session()->setFlashdata('error', $statement['error']);
|
||||
$this->logger->error($statement['log']);
|
||||
} else {
|
||||
throw new \Exception("Campaign: Err Occur on data the Template Inactive");
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error("Campaign: Err Occur = " . $e->getMessage() . " File = " . $e->getFile() . " Line = " . $e->getLine());
|
||||
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
|
||||
}
|
||||
return redirect()->route('campaign_creation');
|
||||
}
|
||||
|
||||
################################################################
|
||||
# Expiry Notification ReferWith : Hema
|
||||
################################################################
|
||||
public function getExpCustomerDetail($window_time = null)
|
||||
{
|
||||
# Step 1: add the days to retrive the data//
|
||||
$providedDate = date('Y-m-d');
|
||||
$newDate = date('Y-m-d', strtotime($providedDate . ' + ' . $window_time . ' days'));
|
||||
$this->logger->info('EXPIRYDATE T-Date = '.$providedDate.', Given ' .$window_time.' Day, Calacuated Date based on Given days = '.$newDate);
|
||||
|
||||
# Step 2 :Get the customer detail//
|
||||
$NotificationModel = new NotificationModel();
|
||||
$ExpCustomerDetail = $NotificationModel->getExpDate(); // Retrieve the stored query
|
||||
|
||||
if (empty($ExpCustomerDetail)) {
|
||||
$this->logger->info('No customer group found by the name of EXPIRYDATE');
|
||||
return;
|
||||
}
|
||||
|
||||
# Step 3: Replace the placeholder WINDOW_TIME with the user-provided value
|
||||
$modifiedQuery = str_replace('WINDOW_TIME', $window_time, $ExpCustomerDetail);
|
||||
|
||||
if (empty($modifiedQuery)) {
|
||||
$this->logger->info('There is no sub query');
|
||||
return;
|
||||
}
|
||||
$db = \Config\Database::connect();
|
||||
$queryResult = $db->query($modifiedQuery)->getResultArray();
|
||||
|
||||
$notification = new NotificationHelper();
|
||||
if (empty($queryResult)) {
|
||||
$this->logger->info("There is no customer expiring on date:{$newDate}");
|
||||
return;
|
||||
}
|
||||
$emailTemplateName = $NotificationModel->getTempName(EXPIRAY_NOTIFY_TEMPLATE_EMAIL);
|
||||
|
||||
foreach ($queryResult as $row) {
|
||||
$userFirstName = $row['first_name'];
|
||||
$userLastName = $row['last_name'];
|
||||
$fullName = $userFirstName . ' ' . $userLastName;
|
||||
$userMobileNumber = $row['mobile_no'];
|
||||
$schemename = $row['title'];
|
||||
$expirydate = $row['to_subscription'];
|
||||
$customerId = $row['donor_id'];
|
||||
if (empty($fullName)) {
|
||||
$this->logger->info('There is no subcription Name');
|
||||
continue;
|
||||
}
|
||||
|
||||
# EXPIRAY_NOTIFY_TEMPLATE_EMAIL
|
||||
$emailTemplateName = $NotificationModel->getTempName(EXPIRAY_NOTIFY_TEMPLATE_EMAIL);
|
||||
if (!empty($emailTemplateName)) {
|
||||
$campaign_id = 1;
|
||||
# Insertion on History Email Means Campaign ID 1 Hardcoded
|
||||
$history_parents_data = ['campaign_id' => $campaign_id,'status' => 0];
|
||||
$history_parent_id = $NotificationModel->save_notification_history_parents($history_parents_data);
|
||||
|
||||
# Step 4: Prepare email content based on the template
|
||||
$emailContent = $emailTemplateName[0]['message'];
|
||||
$emailContent = str_replace("{USER_NAME}", $fullName, $emailContent);
|
||||
$emailContent = str_replace("{SCHEME_NAME}", $schemename, $emailContent);
|
||||
$emailContent = str_replace("{EXPIRY_DATE}", $expirydate, $emailContent);
|
||||
|
||||
$emailData = [
|
||||
'template_name' => '',
|
||||
'recipient_email' => $row['email'],
|
||||
'subject' => 'Your Subscription Expiry Notification',
|
||||
'description' => $emailContent,
|
||||
];
|
||||
$history_child_data = [ 'fkid' => $history_parent_id,
|
||||
'donor_id' => $customerId,
|
||||
'receiving_entity' => $row['email'],
|
||||
'receiving_status' => 0,
|
||||
'message' => $emailContent];
|
||||
# Step 5: Insertion on History Child
|
||||
$history_child_id = $NotificationModel->save_notification_history_child($history_child_data);
|
||||
|
||||
# Step 6:Send email using NotificationHelper
|
||||
$emailResult = $notification->sendEmail($emailData);
|
||||
|
||||
$this->logger->info("EXPIRAY NOTIFY TEMPLATE EMAIL Email CID = ".$customerId." ".json_encode($emailResult));
|
||||
|
||||
if (isset($emailResult['success'])) {
|
||||
$history_msg = 'Email sent successfully';
|
||||
$receiving_status = 1 ;
|
||||
echo $history_msg;
|
||||
} else {
|
||||
$history_msg = (strtolower(gettype($emailResult)) == "string" ? $emailResult : json_encode($emailResult)) ;
|
||||
$receiving_status = 0 ;
|
||||
echo 'Failed to send email';
|
||||
}
|
||||
} else {
|
||||
$history_msg = 'There is no email template found by the name of EXPIRAY_NOTIFY_TEMPLATE_EMAIL';
|
||||
$receiving_status = 0 ;
|
||||
$this->logger->info($history_msg);
|
||||
continue;
|
||||
}
|
||||
# EXPIRAY_NOTIFY_TEMPLATE_EMAIL Closed
|
||||
|
||||
# EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP
|
||||
$whatsappTemplateName = $NotificationModel->getTempName(EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP);
|
||||
if (!empty($whatsappTemplateName)) {
|
||||
$campaign_id = 2;
|
||||
if (empty($userMobileNumber)) {
|
||||
$history_msg = 'There is no subscriber mobile number';
|
||||
$this->logger->info($history_msg);
|
||||
continue;
|
||||
}
|
||||
# Insertion on History Whatsapp Means Campaign ID 2 Hardcoded
|
||||
$history_parents_data = ['campaign_id' => $campaign_id,'status' => 0];
|
||||
$history_parent_id = $NotificationModel->save_notification_history_parents($history_parents_data);
|
||||
|
||||
# Step 7: Prepare whatsapp content based on the template
|
||||
$whatsappContent = $whatsappTemplateName[0]['message'];
|
||||
$whatsappContent = str_replace("{USER_NAME}", $fullName, $emailContent);
|
||||
$whatsappContent = str_replace("{SCHEME_NAME}", $schemename, $emailContent);
|
||||
$whatsappContent = str_replace("{EXPIRY_DATE}", $expirydate, $emailContent);
|
||||
|
||||
# Step 8: Insertion on History Child for whatsapp
|
||||
$history_child_data = [ 'fkid' => $history_parent_id,
|
||||
'donor_id' => $customerId,
|
||||
'receiving_entity' => $userMobileNumber,
|
||||
'receiving_status' => 0,
|
||||
'message' => $whatsappContent];
|
||||
$history_child_id = $NotificationModel->save_notification_history_child($history_child_data);
|
||||
|
||||
|
||||
# Step 8: Send Whatsapp using NotificationHelper
|
||||
$params = (object) Null;
|
||||
$url = SEND_WAAI_URL;
|
||||
$params->number = (int)'91' . $userMobileNumber;
|
||||
$params->type = "text";
|
||||
$params->message = $whatsappContent;
|
||||
$params->instance_id = $_ENV['WAAI_INSTANCE'];
|
||||
$params->access_token = $_ENV['WAAI_TOKEN'];
|
||||
$this->logger->info("EXPIRAY NOTIFY TEMPLATE WHATSAPP Request = " . json_encode($params));
|
||||
$this->logger->info("EXPIRAY NOTIFY TEMPLATE WHATSAPP Request type b4 = " . gettype($params));
|
||||
$whatsapp_result = $notification->sendWhatsAppMessage($url, "POST", $params);
|
||||
$this->logger->info("EXPIRAY NOTIFY TEMPLATE WHATSAPP Reponse = " . $whatsapp_result['message']);
|
||||
|
||||
$receiving_status = $whatsapp_result['receiving_status'];
|
||||
$history_msg = strtolower(gettype($whatsapp_result)) == "string" ? $whatsapp_result : json_encode($whatsapp_result['reponse']);
|
||||
} else {
|
||||
$receiving_status = 0;
|
||||
$history_msg = 'There is no Whatsapp template found by the name of EXPIRAY NOTIFY TEMPLATE WHATSAPP ';
|
||||
$this->logger->info($history_msg);
|
||||
continue;
|
||||
}
|
||||
# EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP Closed
|
||||
|
||||
$history_child_where = ['fkid' => $history_parent_id,'id' => (int)$history_child_id];
|
||||
$history_child_updatedata = ['receiving_status'=>$receiving_status,'result'=>$history_msg];
|
||||
$history_child_statement = $NotificationModel->update_notification_history_child($history_child_updatedata,$history_child_where);
|
||||
$this->logger->info($history_child_statement);
|
||||
|
||||
$history_parent_statement = $NotificationModel->update_notification_history_parent_status(['status' => 1],$history_parent_id,$campaign_id);
|
||||
$this->logger->info($history_parent_statement);
|
||||
}
|
||||
# Loop Closed
|
||||
|
||||
}
|
||||
# getExpCustomerDetail fns Closed
|
||||
|
||||
################################################################
|
||||
# Auto Scheduled Notification
|
||||
################################################################
|
||||
## notification campaign details
|
||||
|
||||
public function processScheduledNotifications(){
|
||||
$this->logger->info("Auto Scheduled Notification Started");
|
||||
$model = new NotificationModel();
|
||||
#step 1 get scheduled notification details
|
||||
$notification_campaign_result = $this->getScheduledNotificationDetails();
|
||||
$this->logger->info("Auto Scheduled Campaign Details Count = ".count($notification_campaign_result));
|
||||
if(!count($notification_campaign_result))
|
||||
{
|
||||
$this->logger->info("No Auto Scheduled Notification in DB,exiting...!");
|
||||
$this->logger->info("Auto Scheduled Notification Ends");
|
||||
exit();
|
||||
}
|
||||
|
||||
//looping multiple notification campaign
|
||||
if(count($notification_campaign_result))
|
||||
{
|
||||
foreach($notification_campaign_result as $index => $single_campaign)
|
||||
{
|
||||
#step 2 get template details
|
||||
$template = $this->getTemplateDetails($single_campaign['template_id']);
|
||||
$this->logger->info("Auto Scheduled Template Details TID = ".$single_campaign['template_id']);
|
||||
if(count($template))
|
||||
{
|
||||
#step 2.1
|
||||
$history_parents_data = ['campaign_id' => $single_campaign['campaign_id'],'status' => 0];
|
||||
$history_parent_id = $model->save_notification_history_parents($history_parents_data);
|
||||
$single_campaign['history_parent_id'] = $history_parent_id;
|
||||
|
||||
#step 3 execute the customer group query and return customer details
|
||||
$customer_details = $this->getCustomerDetails($single_campaign['group_id']);
|
||||
$sent_customer_details = [];
|
||||
if(count($customer_details))
|
||||
{
|
||||
foreach($customer_details as $customer)
|
||||
{
|
||||
|
||||
#step 4 replace templates palceholders with data points
|
||||
$notificationContent = $this->replaceTemplateWithDataPoints($template['message'],$customer);
|
||||
$history_child_data = [
|
||||
'fkid' => $single_campaign['history_parent_id'],
|
||||
'donor_id' => $customer['donor_id'],
|
||||
'receiving_entity' => $single_campaign['mode'] == 'Email' ? $customer['email'] : $customer['mobile_no'],
|
||||
'receiving_status' => 0,
|
||||
'message' => $notificationContent];
|
||||
$history_child_id = $model->save_notification_history_child($history_child_data);
|
||||
//check wheather if notification send to the current customer already
|
||||
if(!in_array($customer['donor_id'],$sent_customer_details))
|
||||
{
|
||||
$this->logger->info("Auto Scheduled Customer CID = ".$customer['donor_id'].", CN = ".$customer['customer_name']);
|
||||
#step 5 send notification
|
||||
$notification = new NotificationHelper();
|
||||
if($single_campaign['mode'] == 'Email')
|
||||
{
|
||||
$email_response = $notification->sendEmail(array('recipient_email' => $customer['email'],'subject' => $template['subject'],'template_name' => $template['template_name'],'description' => $notificationContent));
|
||||
$mail_log = isset($email_response['success']) ? 'Email sent successfully' : 'Failed to send email';
|
||||
$receiving_status = isset($email_response['success']) ? 1 : 0;
|
||||
$this->logger->info("Auto Scheduled Email CID = ".$customer['donor_id']." ".$mail_log);
|
||||
|
||||
$history_child_where = ['fkid' => $single_campaign['history_parent_id'],'id' => (int)$history_child_id];
|
||||
$history_child_updatedata = ['receiving_status'=>$receiving_status, 'result'=>isset($email_response['success']) ? $mail_log : (strtolower(gettype($email_response)) == "string" ? $email_response : json_encode($email_response)) ];
|
||||
$history_child_statement = $model->update_notification_history_child($history_child_updatedata,$history_child_where);
|
||||
$this->logger->info($history_child_statement);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$params = (object) Null;
|
||||
$url = SEND_WAAI_URL;
|
||||
$params->type = "text";
|
||||
$params->instance_id = $_ENV['WAAI_INSTANCE'];
|
||||
$params->access_token = $_ENV['WAAI_TOKEN'];
|
||||
$params->message = $notificationContent;
|
||||
$params->number = (int)'91' . $customer['mobile_no'];
|
||||
$whatsapp_reponse = $notification->sendWhatsAppMessage($url, "POST", $params);
|
||||
$this->logger->info("Auto Scheduled Whatsapp CID = ".$customer['donor_id']." ".$whatsapp_reponse['message']);
|
||||
$history_child_where = ['fkid' => $single_campaign['history_parent_id'],'id' => (int)$history_child_id];
|
||||
|
||||
$history_child_updatedata = ['receiving_status'=>$whatsapp_reponse['receiving_status'],'result'=>strtolower(gettype($whatsapp_reponse)) == "string" ? $whatsapp_reponse : json_encode($whatsapp_reponse['reponse'])];
|
||||
$history_child_statement = $model->update_notification_history_child($history_child_updatedata,$history_child_where);
|
||||
$this->logger->info($history_child_statement);
|
||||
|
||||
}
|
||||
|
||||
array_push($sent_customer_details,$customer['donor_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#step 6 update campaign status to 1
|
||||
$statement = $model->update_notification_campaign_status(['status' => 1],$single_campaign['campaign_id']);
|
||||
$this->logger->info($statement);
|
||||
|
||||
#step 7 update history parent status to 1
|
||||
$history_parent_statement = $model->update_notification_history_parent_status(['status' => 1],$single_campaign['history_parent_id'],$single_campaign['campaign_id']);
|
||||
$this->logger->info($history_parent_statement);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#step 1 get scheduled notification details
|
||||
function getScheduledNotificationDetails()
|
||||
{
|
||||
$model = new NotificationModel();
|
||||
$today = date('Y-m-d');
|
||||
$model->setTable('notification_campaign');
|
||||
$where = ['scheduled_date'=>$today];
|
||||
$notification_campaign_result = $model->where($where)->findAll();
|
||||
return $notification_campaign_result;
|
||||
}
|
||||
|
||||
|
||||
#step 2 get template details
|
||||
function getTemplateDetails($template_id)
|
||||
{
|
||||
$model = new NotificationModel();
|
||||
$model->setTable('templates');
|
||||
$where = ['template_id'=>$template_id];
|
||||
$result = $model->where($where)->first();
|
||||
return $result;
|
||||
}
|
||||
|
||||
#step 3 execute the customer group query and return customer details
|
||||
function getCustomerDetails($group_ids)
|
||||
{
|
||||
$group_id_arr = unserialize($group_ids);
|
||||
$this->logger->info("Auto Scheduled Customer Group CGID = ".implode(", ", $group_id_arr));
|
||||
$customer_details = [];
|
||||
if(count($group_id_arr))
|
||||
{
|
||||
foreach($group_id_arr as $group_id)
|
||||
{
|
||||
// echo "gid".$group_id;
|
||||
$model = new NotificationModel();
|
||||
$model->setTable('donor_groups');
|
||||
$customer_group_result = $model->where(['group_id'=>$group_id])->findAll();
|
||||
$db = \Config\Database::connect();
|
||||
if(count($customer_group_result))
|
||||
{
|
||||
|
||||
$sql = (string)$customer_group_result[0]['group_query'];
|
||||
$query = $db->query($sql);
|
||||
$sql_group_results = $query->getResultArray();
|
||||
// print_r($sql_group_results);
|
||||
$customer_details = array_merge($customer_details,$sql_group_results);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $customer_details;
|
||||
}
|
||||
|
||||
#step 4
|
||||
function replaceTemplateWithDataPoints($originalTemplate,$dataPointsArray)
|
||||
{
|
||||
// print_r($dataPointsArray['customer_name']);
|
||||
// echo $originalTemplate;
|
||||
$notificationContent = $originalTemplate;
|
||||
$notificationContent = str_replace("{USER_NAME}", $dataPointsArray["customer_name"], $notificationContent);
|
||||
$notificationContent = str_replace("{SCHEME_NAME}", $dataPointsArray["scheme_name"], $notificationContent);
|
||||
$notificationContent = str_replace("{EXPIRY_DATE}", $dataPointsArray["formatted_due_date"], $notificationContent);
|
||||
return $notificationContent;
|
||||
}
|
||||
############## Auto Scheduled Notification Ends ################
|
||||
|
||||
}
|
||||
@ -1,75 +0,0 @@
|
||||
<?php
|
||||
namespace App\Controllers;
|
||||
use CodeIgniter\Controller;
|
||||
use App\Models\Receipt_model;
|
||||
use App\Models\My_model;
|
||||
use App\Models\Donation_cause;
|
||||
use App\Models\Donor_model;
|
||||
class PdfController extends Controller
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('pdf_view');
|
||||
}
|
||||
|
||||
function htmlToPDF($receipt_id)
|
||||
{
|
||||
|
||||
|
||||
$model = new Receipt_model();
|
||||
$receipt_data=$model->find($receipt_id);
|
||||
$data= [ 'post'=>$receipt_data ];
|
||||
// $html = view('pdf_view',$data);
|
||||
// $dompdf->loadHtml($html);
|
||||
$dompdf = new \Dompdf\Dompdf();
|
||||
$dompdf->loadHtml(view('pdf_view',$data));
|
||||
$dompdf->setPaper('A4', 'landscape');
|
||||
$dompdf->render();
|
||||
$dompdf->stream();
|
||||
}
|
||||
function download_receipt($receiptid)
|
||||
{
|
||||
// admin data
|
||||
$dmodel = new Donor_model();
|
||||
$id= session()->get('logged_user');
|
||||
$admin_data=$dmodel->find($id);
|
||||
// receipt data
|
||||
$rmodel = new Receipt_model();
|
||||
$receipt_id=$receiptid;
|
||||
$receipt_data=$rmodel->find($receipt_id);
|
||||
$donorid = $receipt_data['donor_id'];
|
||||
$causeid = $receipt_data['cause_id'];
|
||||
// donation cause
|
||||
$causemodel = new Donation_cause();
|
||||
$cause_id=$causeid;
|
||||
$cause_data=$causemodel->find($cause_id);
|
||||
// donor data
|
||||
$model = new My_model();
|
||||
$donor_id=$donorid;
|
||||
$Donor_data=$model->find($donor_id);
|
||||
// array for receipt
|
||||
$data= [ 'donordata'=>$Donor_data , 'admindata' =>$admin_data , 'receipt'=>$receipt_data , 'causedata'=>$cause_data];
|
||||
//echo view('download_receipt',$data); die();
|
||||
$html = view('download_receipt',$data);
|
||||
|
||||
$dompdf = new \Dompdf\Dompdf();
|
||||
//$dompdf->loadHtml(view('download_receipt',$data));
|
||||
|
||||
|
||||
$options = $dompdf->getOptions();
|
||||
$options->set(array('isRemoteEnabled' => true));
|
||||
$dompdf->setOptions($options);
|
||||
$dompdf->loadHtml($html);
|
||||
$dompdf->setPaper('A4', 'portrait');
|
||||
$dompdf->render();
|
||||
$dompdf->stream();
|
||||
$pdfContent = $dompdf->output();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,270 +0,0 @@
|
||||
<?php namespace App\Controllers;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
use App\Models\Transaction_model;
|
||||
use App\Models\Donation_data_model;
|
||||
|
||||
|
||||
class PhpspreadsheetController extends BaseController
|
||||
{
|
||||
|
||||
public $session;
|
||||
public function __construct()
|
||||
{
|
||||
helper('filesystem');
|
||||
$this->session = session();
|
||||
$this->Donation_data_model = new Donation_data_model();
|
||||
$this->Transaction_model = new Transaction_model();
|
||||
|
||||
}
|
||||
|
||||
public function import_donation_data()
|
||||
{
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
|
||||
|
||||
if($this->request->getmethod() == 'post')
|
||||
{
|
||||
//validate
|
||||
$rules=[
|
||||
|
||||
'upload_file' => [
|
||||
'rules'=>'uploaded[upload_file]|max_size[upload_file,1024]|ext_in[upload_file,xlsx]',
|
||||
'lable'=>'upload file'
|
||||
|
||||
]
|
||||
|
||||
];
|
||||
|
||||
if(! $this->validate($rules))
|
||||
{
|
||||
$data['validation'] = $this->validator;
|
||||
}else{
|
||||
|
||||
$file= $this->request->getFile('upload_file');
|
||||
//echo $file->getName();exit();
|
||||
$ext=$file->getClientExtension();
|
||||
if($ext == 'xls'){
|
||||
$render = new \PhpOffice\PhpSpreadsheet\Reader\Xls();
|
||||
} else {
|
||||
$render = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
|
||||
}
|
||||
$spreadsheet = $render->load($file);
|
||||
$allDataInSheet = $spreadsheet->getActiveSheet()->toArray(null, true, true, true);
|
||||
$arrayCount = count($allDataInSheet);
|
||||
|
||||
$flag = 0;
|
||||
$createArray = array('DATE', 'CAUSE_NAME', 'AMOUNT', 'PAYMENT_MODE' , 'REF' , 'DONATION_REF');
|
||||
|
||||
$makeArray = array('DATE' => 'DATE', 'CAUSE_NAME' => 'CAUSE_NAME', 'AMOUNT' => 'AMOUNT', 'PAYMENT_MODE' => 'PAYMENT_MODE', 'REF' => 'REF', 'DONATION_REF' => 'DONATION_REF');
|
||||
|
||||
$SheetDataKey = array();
|
||||
|
||||
foreach ($allDataInSheet as $dataInSheet) {
|
||||
foreach ($dataInSheet as $key => $value) {
|
||||
|
||||
if (in_array(trim($value), $createArray)) {
|
||||
|
||||
$value = preg_replace('/\s+/', '', $value);
|
||||
$SheetDataKey[trim($value)] = $key;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
$dataDiff = array_diff_key($makeArray, $SheetDataKey);
|
||||
|
||||
if (empty($dataDiff)) {
|
||||
$flag = 1;
|
||||
}
|
||||
// match excel sheet column
|
||||
if ($flag == 1)
|
||||
{
|
||||
for ($i = 2; $i <= $arrayCount; $i++)
|
||||
{
|
||||
|
||||
$date = $SheetDataKey['DATE'];
|
||||
$cause_name = $SheetDataKey['CAUSE_NAME'];
|
||||
$amount = $SheetDataKey['AMOUNT'];
|
||||
$payment_mode = $SheetDataKey['PAYMENT_MODE'];
|
||||
$ref = $SheetDataKey['REF'];
|
||||
$donation_ref = $SheetDataKey['DONATION_REF'];
|
||||
|
||||
|
||||
$date = filter_var(trim($allDataInSheet[$i][$date]), FILTER_SANITIZE_STRING);
|
||||
$cause_name = filter_var(trim($allDataInSheet[$i][$cause_name]), FILTER_SANITIZE_STRING);
|
||||
$amount = filter_var(trim($allDataInSheet[$i][$amount]), FILTER_SANITIZE_EMAIL);
|
||||
$payment_mode = filter_var(trim($allDataInSheet[$i][$payment_mode]), FILTER_SANITIZE_STRING);
|
||||
$ref = filter_var(trim($allDataInSheet[$i][$ref]), FILTER_SANITIZE_EMAIL);
|
||||
$donation_ref = filter_var(trim($allDataInSheet[$i][$donation_ref]), FILTER_SANITIZE_STRING);
|
||||
|
||||
$fetchData= array('date' => $date, 'cause_name' => $cause_name, 'amount' => $amount, 'mode_of_payment' => $payment_mode, 'ref_1' => $ref, 'donation_ref' => $donation_ref);
|
||||
|
||||
|
||||
$model = new Donation_data_model();
|
||||
$model->save($fetchData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
echo '<script>alert("Please import correct file, did not match excel sheet column")</script>';
|
||||
//echo "Please import correct file, did not match excel sheet column";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
//return redirect()->to(base_url().'/all_donation_data');
|
||||
return view('donation_data');
|
||||
}
|
||||
|
||||
|
||||
// public function import_transaction_data()
|
||||
// {
|
||||
// $file_mimes = array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'text/plain', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
|
||||
// if(isset($_FILES['transacton_upload']['name']) && in_array($_FILES['transacton_upload']['type'], $file_mimes))
|
||||
// {
|
||||
// $arr_file = explode('.', $_FILES['transacton_upload']['name']);
|
||||
// $extension = end($arr_file);
|
||||
// if('csv' == $extension){
|
||||
// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv();
|
||||
// } else {
|
||||
// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
|
||||
// }
|
||||
// $spreadsheet = $reader->load($_FILES['transacton_upload']['tmp_name']);
|
||||
// $sheetData = $spreadsheet->getActiveSheet()->toArray();
|
||||
// if(!empty($sheetData))
|
||||
// {echo "<pre>";
|
||||
// print_r($sheetData);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
public function import_transaction_data()
|
||||
{
|
||||
if(!session()->has('logged_user'))
|
||||
{
|
||||
return redirect()->to(base_url());
|
||||
}
|
||||
|
||||
if($this->request->getmethod() == 'post')
|
||||
{
|
||||
//validate
|
||||
$rules=[
|
||||
|
||||
'transacton_upload' => [
|
||||
'rules'=>'uploaded[transacton_upload]|max_size[transacton_upload,1024]|ext_in[transacton_upload,xlsx]',
|
||||
'lable'=>'upload file'
|
||||
|
||||
]
|
||||
|
||||
];
|
||||
|
||||
if(! $this->validate($rules))
|
||||
{
|
||||
$data['validation'] = $this->validator;
|
||||
}else{
|
||||
|
||||
$file= $this->request->getFile('transacton_upload');
|
||||
//echo $file->getName();exit();
|
||||
$ext=$file->getClientExtension();
|
||||
if($ext == 'xls'){
|
||||
$render = new \PhpOffice\PhpSpreadsheet\Reader\Xls();
|
||||
} else {
|
||||
$render = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
|
||||
}
|
||||
$spreadsheet = $render->load($file);
|
||||
$allDataInSheet = $spreadsheet->getActiveSheet()->toArray(null, true, true, true);
|
||||
$arrayCount = count($allDataInSheet);
|
||||
print_r($arrayCount);die();
|
||||
$flag = 0;
|
||||
$createArray = array('DATE', 'REF_1', 'REF_2', 'REMARKS' , 'AMOUNT' , 'DONATION_REF');
|
||||
|
||||
$makeArray = array('DATE' => 'DATE', 'REF_1' => 'REF_1', 'REF_2' => 'REF_2', 'REMARKS' => 'REMARKS', 'AMOUNT' => 'AMOUNT', 'DONATION_REF' => 'DONATION_REF');
|
||||
|
||||
$SheetDataKey = array();
|
||||
|
||||
foreach ($allDataInSheet as $dataInSheet) {
|
||||
foreach ($dataInSheet as $key => $value) {
|
||||
|
||||
if (in_array(trim($value), $createArray)) {
|
||||
|
||||
$value = preg_replace('/\s+/', '', $value);
|
||||
$SheetDataKey[trim($value)] = $key;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
$dataDiff = array_diff_key($makeArray, $SheetDataKey);
|
||||
|
||||
if (empty($dataDiff)) {
|
||||
$flag = 1;
|
||||
}
|
||||
// match excel sheet column
|
||||
if ($flag == 1)
|
||||
{
|
||||
for ($i = 2; $i <= $arrayCount; $i++)
|
||||
{
|
||||
|
||||
$date = $SheetDataKey['DATE'];
|
||||
$ref_1 = $SheetDataKey['REF_1'];
|
||||
$ref_2 = $SheetDataKey['REF_2'];
|
||||
$remarks = $SheetDataKey['REMARKS'];
|
||||
$amount = $SheetDataKey['AMOUNT'];
|
||||
$donation_ref = $SheetDataKey['DONATION_REF'];
|
||||
|
||||
|
||||
$date = filter_var(trim($allDataInSheet[$i][$date]), FILTER_SANITIZE_STRING);
|
||||
$ref_1 = filter_var(trim($allDataInSheet[$i][$ref_1]), FILTER_SANITIZE_STRING);
|
||||
$ref_2 = filter_var(trim($allDataInSheet[$i][$ref_2]), FILTER_SANITIZE_EMAIL);
|
||||
$remarks = filter_var(trim($allDataInSheet[$i][$remarks]), FILTER_SANITIZE_STRING);
|
||||
$amount = filter_var(trim($allDataInSheet[$i][$amount]), FILTER_SANITIZE_EMAIL);
|
||||
$donation_ref = filter_var(trim($allDataInSheet[$i][$donation_ref]), FILTER_SANITIZE_STRING);
|
||||
|
||||
$fetchData= array('date' => $date, 'ref_1' => $ref_1, 'ref_2' => $ref_2, 'remarks' => $remarks, 'amount' => $amount, 'donation_ref' => $donation_ref);
|
||||
// print_r($fetchData);
|
||||
$model = new Transaction_model();
|
||||
$model->save($fetchData);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
echo '<script>alert("Please import correct file, did not match excel sheet column")</script>';
|
||||
//echo "Please import correct file, did not match excel sheet column";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// return redirect()->to(base_url().'/all_transaction');
|
||||
return view('transaction_upload');
|
||||
|
||||
}
|
||||
public function transaction_file()
|
||||
{
|
||||
return $this->response->download('public/assets/download/transaction_data_file.xlsx', NULL);
|
||||
}
|
||||
public function donation_data_file()
|
||||
{
|
||||
return $this->response->download('public/assets/download/donation_data_file.xlsx', NULL);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,63 +0,0 @@
|
||||
<?php
|
||||
namespace App\Controllers;
|
||||
use CodeIgniter\Controller;
|
||||
|
||||
class Sendmail extends Controller
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('form_view');
|
||||
}
|
||||
function Mail_to_donor()
|
||||
{
|
||||
|
||||
$to = 'gowthamceline46@gmail.com';
|
||||
$subject = "Checking mail confic";
|
||||
$message = 'Smtp mail send successfully';
|
||||
|
||||
$email = \Config\Services::email();
|
||||
|
||||
|
||||
$email->setFrom('celine.forworkinphp96@gmail.com', 'Gowtham');
|
||||
$email->setTo($to);
|
||||
$email->setSubject($subject);
|
||||
$email->setMessage($message);
|
||||
|
||||
if ($email->send())
|
||||
{
|
||||
echo 'Email successfully sent';
|
||||
}
|
||||
else
|
||||
{
|
||||
$data = $email->printDebugger(['headers']);
|
||||
print_r($data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function sendMail() {
|
||||
$to = $this->request->getVar('mailTo');
|
||||
$subject = $this->request->getVar('subject');
|
||||
$message = $this->request->getVar('message');
|
||||
|
||||
$email = \Config\Services::email();
|
||||
|
||||
$email->setTo($to);
|
||||
$email->setFrom('johndoe@gmail.com', 'Confirm Registration');
|
||||
|
||||
$email->setSubject($subject);
|
||||
$email->setMessage($message);
|
||||
|
||||
if ($email->send())
|
||||
{
|
||||
echo 'Email successfully sent';
|
||||
}
|
||||
else
|
||||
{
|
||||
$data = $email->printDebugger(['headers']);
|
||||
print_r($data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
324
app/Controllers/Users.php
Normal file
324
app/Controllers/Users.php
Normal file
@ -0,0 +1,324 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\UsersModel;
|
||||
use App\Models\BusinessModel;
|
||||
use CodeIgniter\Database\Exceptions\DatabaseException;
|
||||
|
||||
class Users extends BaseController
|
||||
{
|
||||
## For User Listing
|
||||
public function index()
|
||||
{
|
||||
helper('session');
|
||||
|
||||
$session_role = get_user_role();
|
||||
$session_bid = get_business_id();
|
||||
$default_financial_year_condition = [
|
||||
'users.created_at >= CONCAT(YEAR(NOW()) - IF(MONTH(NOW()) >= 1 AND MONTH(NOW()) <= 3, 1, 0), "-01-01")',
|
||||
'users.created_at < CONCAT(YEAR(NOW()) + IF(MONTH(NOW()) >= 1 AND MONTH(NOW()) <= 3, 1, 0), "-01-01")'
|
||||
];
|
||||
if (!empty($session_role) && $session_role === "sadmin") {
|
||||
$this->logger->info("Users: Listing In Super-admin role .");
|
||||
$where = ['users.isactive !=' => NULL];
|
||||
}else if (!empty($session_role) && $session_role === "admin") {
|
||||
$this->logger->info("Users: Listing In admin role . BID = ".$session_bid);
|
||||
$where = ['users.business_id' => (int)$session_bid];
|
||||
} else {
|
||||
$this->logger->info("Users: Listing In ".$session_role." role . BID = ".$session_bid);
|
||||
$where = ['users.business_id' => (int)$session_bid, 'users.isactive' => 1];
|
||||
}
|
||||
// $where = array_merge($where, $default_financial_year_condition);
|
||||
$model = new UsersModel();
|
||||
$model->setTable('users');
|
||||
// $user_details = $model->where($where)->orderBy('user_id', 'DESC')->findAll();
|
||||
$user_details = $model->select('users.*, business.title as org_name,business_branches.branch_name')
|
||||
->join('business', 'business.business_id = users.business_id')
|
||||
->join('business_branches', 'business_branches.id = users.branch_id','left')
|
||||
->where($where)->orderBy('user_id', 'DESC')->findAll();
|
||||
|
||||
$this->logger->info("Users: Listing Count .".count($user_details));
|
||||
$data['page_name'] = 'User Details';
|
||||
$data['loged_user'] = $session_role;
|
||||
$data['details'] = $user_details;
|
||||
|
||||
$this->render_page('user_list', $data);
|
||||
}
|
||||
|
||||
## To Load User Add/Update page
|
||||
public function user_page($id,$flag)
|
||||
{
|
||||
|
||||
helper('session');
|
||||
$session_role = get_user_role();
|
||||
$session_bid = get_business_id();
|
||||
$session_uid = get_logged_user_id();
|
||||
$data['organzation_details'] = $this->organzation_details();
|
||||
$data['dummy_flag'] = $flag; // for redirect purpose.
|
||||
if ($id === '0') {
|
||||
$this->logger->info("Users: In Add page");
|
||||
$data['page_name'] = 'Add User';
|
||||
$render_page_name = 'user_form';
|
||||
$data['details'] = [];
|
||||
$data['branches'] = $this->getOrganizationBranches($session_bid);
|
||||
|
||||
} else {
|
||||
$this->logger->info("Users: In Edit page");
|
||||
$model = new UsersModel();
|
||||
$model->setTable('users');
|
||||
|
||||
if (!empty($session_role)) {
|
||||
switch ($session_role) {
|
||||
case "sadmin":
|
||||
$where = ['users.user_id' => $id, 'users.isactive !=' => NULL];
|
||||
$edit_user_details = $model->where($where)->first();
|
||||
$render_page_name = 'user_form';
|
||||
$data['page_name'] = 'Edit User';
|
||||
// Fetch organization branches for the selected organization
|
||||
$data['branches'] = $this->getOrganizationBranches($edit_user_details['business_id']);
|
||||
break;
|
||||
|
||||
case "admin":
|
||||
$where = ['users.user_id' => $id, 'users.isactive =' => 1];
|
||||
$edit_user_details = $model->where($where)->first();
|
||||
$render_page_name = 'user_form';
|
||||
$data['page_name'] = 'Edit User';
|
||||
$data['branches'] = $this->getOrganizationBranches($edit_user_details['business_id']);
|
||||
break;
|
||||
|
||||
case "volunteer":
|
||||
$where = ['users.user_id' => $id, 'users.isactive =' => 1];
|
||||
$edit_user_details = $model->where($where)->first();
|
||||
if ($session_uid === $id && $session_role === "volunteer") {
|
||||
$data['page_name'] = 'Edit User';
|
||||
$data['branches'] = $this->getOrganizationBranches($edit_user_details['business_id']);
|
||||
$render_page_name = 'user_form';
|
||||
} else {
|
||||
$data['page_name'] = 'Page Not Found';
|
||||
$render_page_name = 'pages_404';
|
||||
}
|
||||
break;
|
||||
|
||||
case "accounts":
|
||||
$where = ['users.user_id' => $id, 'users.isactive =' => 1];
|
||||
$edit_user_details = $model->where($where)->first();
|
||||
$render_page_name = 'user_form';
|
||||
$data['page_name'] = 'Edit User';
|
||||
$data['branches'] = $this->getOrganizationBranches($edit_user_details['business_id']);
|
||||
break;
|
||||
|
||||
case "auditor":
|
||||
$where = ['users.user_id' => $id, 'users.isactive =' => 1];
|
||||
$edit_user_details = $model->where($where)->first();
|
||||
$render_page_name = 'user_form';
|
||||
$data['page_name'] = 'Edit User';
|
||||
$data['branches'] = $this->getOrganizationBranches($edit_user_details['business_id']);
|
||||
break;
|
||||
|
||||
default:
|
||||
$data['page_name'] = 'Page Not Found';
|
||||
$render_page_name = 'pages_404';
|
||||
}
|
||||
}
|
||||
|
||||
$data['details'] = $edit_user_details;
|
||||
|
||||
}
|
||||
$data['session_uid']=$session_uid;
|
||||
$data['session_bid'] = $session_bid;
|
||||
$this->render_page($render_page_name, $data);
|
||||
}
|
||||
|
||||
## Add the getOrganizationBranches method
|
||||
public function getOrganizationBranches($businessId)
|
||||
{
|
||||
$db = db_connect();
|
||||
$builder = $db->table('business_branches');
|
||||
|
||||
$branches = $builder->where(['business_id'=>$businessId,'isactive'=>1])->get()->getResultArray();
|
||||
|
||||
return $branches;
|
||||
}
|
||||
|
||||
## For SuperAdmin Role business Dropdown displayed on Userpage.otherwise Hidden fields
|
||||
public function organzation_details()
|
||||
{
|
||||
$model = new BusinessModel();
|
||||
$model->setTable('business');
|
||||
|
||||
$organzation_details = $model->orderBy('business_id', 'DESC')->findAll();
|
||||
|
||||
// Fetch branches for all organizations
|
||||
$branchModel = new BusinessModel();
|
||||
$branchModel->setTable('business_branches');
|
||||
$branches = $branchModel->findAll();
|
||||
|
||||
// Add branches to each business
|
||||
foreach ($organzation_details as &$business) {
|
||||
$business['branches'] = array_filter($branches, function ($branch) use ($business) {
|
||||
return $branch['business_id'] == $business['business_id'];
|
||||
});
|
||||
}
|
||||
|
||||
return $organzation_details;
|
||||
}
|
||||
|
||||
## For inserting/updating details of user
|
||||
public function insert_users()
|
||||
{
|
||||
$this->logger->info("Users: Inserting/Updating Details");
|
||||
try {
|
||||
|
||||
## Declarions
|
||||
helper('session');
|
||||
$UsersModel = new UsersModel();
|
||||
$session_uid = get_logged_user_id();
|
||||
$session_bid = get_business_id();
|
||||
$user_id = $this->request->getPost('user_id');
|
||||
$business_id = $this->request->getPost('business_id')?$this->request->getPost('business_id'):$session_bid;
|
||||
|
||||
$data = [
|
||||
'city' => $this->request->getPost('city'),
|
||||
'state' => $this->request->getPost('state'),
|
||||
'email' => $this->request->getPost('email'),
|
||||
'postal_code' => $this->request->getPost('postal_code'),
|
||||
'role' => $this->request->getPost('role'),
|
||||
'first_name' => $this->request->getPost('first_name'),
|
||||
'mobile_no' => $this->request->getPost('mobile_no'),
|
||||
'address' => $this->request->getPost('address'),
|
||||
'business_id' => $business_id,
|
||||
'branch_id' => $this->request->getPost('branch_id') ?? $this->request->getPost('branch'),
|
||||
];
|
||||
|
||||
|
||||
if (empty($user_id)) {
|
||||
// It's an insert operation
|
||||
$password = $this->request->getVar('password');
|
||||
$hash_password = password_hash($password, PASSWORD_DEFAULT);
|
||||
$data['isactive'] = 1;
|
||||
$data['password'] = $hash_password;
|
||||
$data['created_by'] = $session_uid;
|
||||
//print_r($data);die;
|
||||
// ($UsersModel->insert($data)) ? session()->setFlashdata('success', 'User has been added successfully.')
|
||||
// : session()->setFlashdata('error', 'User could not be added. Please try again.');
|
||||
if ($UsersModel->insert($data)) {
|
||||
session()->setFlashdata('success', 'User has been added successfully.');
|
||||
$this->logger->info("Users: has been added successfully. Inserted ID = ".$UsersModel->insertID());
|
||||
} else {
|
||||
session()->setFlashdata('error', 'User could not be added. Please try again.');
|
||||
$this->logger->error("Users: Err could not be added. Please try again.");
|
||||
}
|
||||
return redirect()->route('user_list');
|
||||
|
||||
|
||||
} else {
|
||||
// It's an update operation
|
||||
$isactive = $this->request->getPost('isactive');
|
||||
$data['updated_by'] = $session_uid;
|
||||
$data['isactive'] = ($isactive == 'on') ? 1 : 0;
|
||||
if($session_uid == $user_id && $data['isactive'] == 0){
|
||||
throw new \Exception("Cant able to Update Because logged-In persons can't remove. Please Contact your Admin!....");
|
||||
}
|
||||
if ($UsersModel->update($user_id, $data)) {
|
||||
session()->setFlashdata('success', 'User has been updated successfully.');
|
||||
}
|
||||
}
|
||||
}catch (\Exception $e) {
|
||||
$this->logger->error("Users: Err Occur =" . $e->getMessage());
|
||||
session()->setFlashdata('error', 'Message: ' . $e->getMessage());
|
||||
}
|
||||
|
||||
// Redirect back to the user_page function or any other appropriate page
|
||||
if($this->request->getPost('dummy_flag') == 1){
|
||||
return redirect()->to(base_url("user_page/{$user_id}/1"));
|
||||
}else{
|
||||
return redirect()->route('user_list');
|
||||
}
|
||||
}
|
||||
|
||||
## For delete the user details (Which means inactive the details)
|
||||
public function delete_user($id)
|
||||
{
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
try {
|
||||
// if($id == $session_uid){
|
||||
// throw new \Exception("Your Not Logged-In, Can't able delete");
|
||||
// }
|
||||
$model = new UsersModel();
|
||||
$where = ['users.user_id' => $id, 'users.isactive =' => 1];
|
||||
$existingUser = $model->where($where)->find($id);
|
||||
$this->logger->Info("Users: Going to Inactive ID = ".$id);
|
||||
|
||||
if ($existingUser) {
|
||||
$data['isactive'] = 0;
|
||||
$data['updated_by'] = $session_uid;
|
||||
|
||||
if ($model->update($id, $data)) {
|
||||
$this->logger->info("Users: has been Inactived successfully. Inactived ID = ".$id);
|
||||
return $this->response->setJSON(['status' => true, 'message' => "User Deactivated successfully."]);
|
||||
} else {
|
||||
$this->logger->error("Users: Not able to Inactive ID =".$id);
|
||||
throw new \Exception("Data Not able to Deleted");
|
||||
}
|
||||
}
|
||||
else{
|
||||
$this->logger->error("Users: Does Not Exist To Inactive, ID = ".$id);
|
||||
throw new \Exception("User Already Deleted");
|
||||
}
|
||||
} catch(\Exception $e) {
|
||||
$this->logger->error("Users: Err Occur = ".$e->getMessage());
|
||||
return $this->response->setJSON(['status' => false, 'message' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
## For delete user make as active user
|
||||
public function activate_user($user_id){
|
||||
helper('session');
|
||||
$session_uid = get_logged_user_id();
|
||||
try {
|
||||
// if($user_id == $session_uid){
|
||||
// throw new \Exception("Your Logged-In, Can't able delete");
|
||||
// }
|
||||
$model = new UsersModel();
|
||||
$where = ['users.user_id' => $user_id, 'users.isactive =' => 0];
|
||||
$existingUser = $model->where($where)->find($user_id);
|
||||
$this->logger->Info("Users: Going to ActiveUser ID = ".$user_id);
|
||||
// print_r($existingUser);die;
|
||||
if ($existingUser) {
|
||||
$data['isactive'] = 1;
|
||||
$data['updated_by'] = $session_uid;
|
||||
|
||||
if ($model->update($user_id, $data)) {
|
||||
session()->setFlashdata('success', 'User Activated successfully.');
|
||||
$this->logger->info("Users: has been Actived successfully. Actived ID = ".$user_id);
|
||||
} else {
|
||||
$this->logger->error("Users: Not able to Active ID =".$user_id);
|
||||
throw new \Exception("Data Not able to Active");
|
||||
}
|
||||
}
|
||||
else{
|
||||
$this->logger->error("Users: Does Not Exist To Active, ID = ".$user_id);
|
||||
throw new \Exception("User Already Activated");
|
||||
}
|
||||
}catch(\Exception $e) {
|
||||
$this->logger->error("Users: Err Occur = ".$e->getMessage());
|
||||
session()->setFlashdata('error', 'Message: ' .$e->getMessage());
|
||||
}
|
||||
return redirect()->route('user_list');
|
||||
|
||||
}
|
||||
|
||||
## Add a method to fetch organization branches based on the selected organization
|
||||
public function get_branches($business_id)
|
||||
{
|
||||
$model = new BusinessModel();
|
||||
$model->setTable('business_branches');
|
||||
|
||||
$branches = $model->where('business_id', $business_id)->findAll();
|
||||
|
||||
return json_encode($branches);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
namespace App\Validation;
|
||||
use App\Models\Donor_model;
|
||||
class UsersRules
|
||||
{
|
||||
|
||||
|
||||
public function validateDonor(string $str,string $fields,array $data)
|
||||
{
|
||||
$model = new Donor_model();
|
||||
$Donor = $model->where('email',$data['email'])
|
||||
->first();
|
||||
if($Donor)
|
||||
return false;
|
||||
return password_verify($data['password'],$Donor['password']);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
<?php namespace App\Controllers;
|
||||
|
||||
class Donation extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
|
||||
return view('show');
|
||||
}
|
||||
|
||||
|
||||
public function test($type,$type2)
|
||||
{
|
||||
echo '<h2>this is a product:'.$type.'and'.$type2.'</h2>';
|
||||
//return view('show');
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
}
|
||||
155
app/Helpers/NotificationHelper.php
Normal file
155
app/Helpers/NotificationHelper.php
Normal file
@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
// app/Helpers/NotificationHelper.php
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
class NotificationHelper
|
||||
{
|
||||
protected $email;
|
||||
protected $logger;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->email = service('email');
|
||||
$this->logger = service('logger');
|
||||
}
|
||||
|
||||
public function sendEmail($records)
|
||||
{
|
||||
$this->logger->info('Helper : Email Request Data type = '.gettype($records));
|
||||
|
||||
$cc = isset($records['carboncopy']) ? $records['carboncopy'] : '';
|
||||
$bcc = isset($records['blindcarboncopy']) ? $records['blindcarboncopy'] : '';
|
||||
|
||||
try {
|
||||
$this->email->clear();
|
||||
if($records['recipient_email'] == "" && $records['subject'] == ""){
|
||||
throw new \Exception("Email and Subject are Must Please Try again..");
|
||||
}
|
||||
$this->email->setTo($records['recipient_email']);
|
||||
$this->logger->info('Helper : Email recipient = '.$records['recipient_email']);
|
||||
$this->email->setFrom('bbone@venbait.in', "DONOR");
|
||||
$this->email->setSubject($records['subject']);
|
||||
$this->logger->info('Helper : Email subject = '.$records['subject']);
|
||||
$this->email->setMessage($records['description']);
|
||||
|
||||
// if($records['template_name'] != ""){
|
||||
// $this->logger->info('Helper : Email Template = '.$records['template_name']);
|
||||
// $this->logger->info("Helper : Email Request data = ".json_encode($records));
|
||||
// $emailContent = view($records['template_name'],$records);
|
||||
// $this->email->setMessage($emailContent);
|
||||
// }else{
|
||||
// $this->logger->info('Helper : Email Dynamic Template');
|
||||
// $this->email->setMessage($records['description']);
|
||||
// }
|
||||
|
||||
|
||||
if ($cc !== '') {
|
||||
$ccRecipients = explode(',', trim($cc));
|
||||
$this->logger->info('Helper : Email carbon copy CC recipient = ' . implode(',', $ccRecipients));
|
||||
if (!empty($ccRecipients)) {
|
||||
if (getenv('CI_ENVIRONMENT') === "production") {
|
||||
$this->email->setCC('contact@vijayabharathambooks.com');
|
||||
}
|
||||
$this->email->setCC($ccRecipients);
|
||||
}
|
||||
} else {
|
||||
if (getenv('CI_ENVIRONMENT') === "production") {
|
||||
$this->email->setCC('contact@vijayabharathambooks.com');
|
||||
}
|
||||
}
|
||||
|
||||
if ($bcc !== '') {
|
||||
$bccRecipients = explode(',', trim($bcc));
|
||||
$this->logger->info('Helper : Email blindcarboncopy BCC recipient = ' . implode(',', $bccRecipients));
|
||||
if(!empty($bccRecipients)) {
|
||||
$this->email->setBCC($bccRecipients);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->email->send()) {
|
||||
$message['success'] = 'Email sent successfully';
|
||||
$this->logger->info('Helper : Email Status = sent successfully');
|
||||
} else {
|
||||
throw new \Exception('Email sending failed.');
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error('Helper : Email Error = ' . $e->getMessage());
|
||||
$message['error'] = 'Email Exception Occur : ' . $e->getMessage();
|
||||
}
|
||||
return $message;
|
||||
}
|
||||
|
||||
public function sendWhatsAppMessage($url, $method, $data)
|
||||
{
|
||||
$final_result = []; // Initialize outside try-catch block
|
||||
|
||||
try {
|
||||
$this->logger->info('Helper : Whatsapp');
|
||||
$curl = curl_init();
|
||||
$headers = array('Content-Type:application/json');
|
||||
$jsonencoded = json_encode($data);
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
$this->logger->info('Helper : Whatsapp url = ' . $url);
|
||||
|
||||
switch ($method) {
|
||||
case "POST":
|
||||
curl_setopt($curl, CURLOPT_POST, true);
|
||||
if ($data) {
|
||||
$this->logger->info('Helper : Whatsapp jsonencoded = ' . $jsonencoded);
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonencoded);
|
||||
}
|
||||
break;
|
||||
case "PUT":
|
||||
curl_setopt($curl, CURLOPT_PUT, 1);
|
||||
break;
|
||||
default:
|
||||
if ($data) {
|
||||
$url = sprintf("%s?%s", $url, http_build_query((array)$data));
|
||||
}
|
||||
}
|
||||
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
|
||||
$curl_exec = curl_exec($curl);
|
||||
$this->logger->info('Helper : Whatsapp Reponse = ' . $curl_exec);
|
||||
$http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||
|
||||
if ($http_status === 200) {
|
||||
$result = json_decode($curl_exec);
|
||||
|
||||
if ($result->status === "error") {
|
||||
$final_result['message'] = $result->message;
|
||||
$final_result['receiving_status'] = 0 ;
|
||||
$this->logger->error('Helper : Whatsapp Err occur = ' . $result->message);
|
||||
throw new \Exception($result->message);
|
||||
}
|
||||
|
||||
if ($result->status === "success") {
|
||||
$final_result['message'] = isset($result->message) ? (
|
||||
(strtolower(gettype($result->message)) === 'string') ?
|
||||
$result->message : "Sended Success"
|
||||
) : " Message Not Sent. ";
|
||||
$final_result['receiving_status'] = isset($result->message) ? ((strtolower(gettype($result->message)) === 'string') ? 0 : 1 ) : 0 ;
|
||||
}
|
||||
} else {
|
||||
$curl_errno = curl_errno($curl);
|
||||
$this->logger->error('Helper : Whatsapp curl error occur = ' . $curl_errno);
|
||||
throw new \Exception(" Errno returned " . $curl_errno);
|
||||
}
|
||||
|
||||
curl_close($curl);
|
||||
} catch (\Exception $e) {
|
||||
$this->logger->error('Helper : Whatsapp Exception Occur = ' . $e->getMessage());
|
||||
$final_result['message'] = "Exception Errno returned " . $e->getMessage() . " <br/>";
|
||||
$final_result['receiving_status'] = 0 ;
|
||||
}
|
||||
$final_result['reponse'] = json_decode($curl_exec);
|
||||
return $final_result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
118
app/Helpers/session_helper.php
Normal file
118
app/Helpers/session_helper.php
Normal file
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
|
||||
if (!function_exists('is_session_active')) {
|
||||
function is_session_active()
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
// echo "i am in helper ...".$session->get('user_id');die();
|
||||
return $session->get('user_id');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_logged_user_id')) {
|
||||
function get_logged_user_id()
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
return $session->get('user_id');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('set_logged_user_id')) {
|
||||
function set_logged_user_id($userId)
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
$session->set('user_id', $userId);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('unset_logged_user')) {
|
||||
function unset_logged_user()
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
$session->remove('user_id');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_logged_name')) {
|
||||
function get_logged_name()
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
return $session->get('user_name');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('set_logged_name')) {
|
||||
function set_logged_name($userName)
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
$session->set('user_name', $userName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('set_user_role')) {
|
||||
function set_user_role($userRole)
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
$session->set('user_role', $userRole);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_user_role')) {
|
||||
function get_user_role()
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
return $session->get('user_role');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('set_business_id')) {
|
||||
function set_business_id($businessId)
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
$session->set('business_id', $businessId);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_business_id')) {
|
||||
function get_business_id()
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
return $session->get('business_id');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('is_session_destroy')) {
|
||||
function is_session_destroy()
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
$session->destroy();
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('set_session_locked')) {
|
||||
function set_session_locked()
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
$session->set('session_locked', true);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_session_locked')) {
|
||||
function get_session_locked()
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
return $session->get('session_locked');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('remove_session_locked')) {
|
||||
function remove_session_locked()
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
$session->remove('session_locked');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@ -1,64 +0,0 @@
|
||||
<?php namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class Address_model extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
function all_donation_cause()
|
||||
{
|
||||
$builder = $this->db->table('donation_cause');
|
||||
// $builder->where('status','Active');
|
||||
$result = $builder->get();
|
||||
$output = $result->getResultArray();
|
||||
return $output;
|
||||
}
|
||||
function inactive_donation_cause()
|
||||
{
|
||||
$builder = $this->db->table('donation_cause');
|
||||
$builder->where('status','Inactive');
|
||||
$result = $builder->get();
|
||||
$output = $result->getResultArray();
|
||||
return $output;
|
||||
}
|
||||
function country($id)
|
||||
{
|
||||
$builder=$this->db->query("SELECT country_name FROM country WHERE country_id = ".$id);
|
||||
$output = $builder->getResultArray();
|
||||
return $output;
|
||||
}
|
||||
function state($id)
|
||||
{
|
||||
$builder=$this->db->query("SELECT state_name FROM state WHERE state_id = ".$id);
|
||||
$output = $builder->getResultArray();
|
||||
return $output;
|
||||
}
|
||||
function city($id)
|
||||
{
|
||||
$builder=$this->db->query("SELECT city_name FROM city WHERE city_id = ".$id);
|
||||
$output = $builder->getResultArray();
|
||||
return $output;
|
||||
}
|
||||
// function active_cause($id)
|
||||
// {
|
||||
// $builder=$this->db->query("UPDATE donation_cause SET status ='Active' WHERE id = ".$id);
|
||||
// }
|
||||
function fetch_cause_name()
|
||||
{
|
||||
$builder = $this->db->table('donation_cause');
|
||||
$builder->where('status','Active');
|
||||
$query = $builder->get();
|
||||
$output = '<option value="">Select Cause Name</option>';
|
||||
foreach($query->getResult() as $row)
|
||||
{
|
||||
$output .= '<option value="'.$row->id.'">'.$row->cause_name.'</option>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
44
app/Models/AuditHistoryModel.php
Normal file
44
app/Models/AuditHistoryModel.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
use CodeIgniter\Model;
|
||||
class AuditHistoryModel extends Model
|
||||
{
|
||||
protected $table = 'audit_history';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = ['module', 'business_id','is_add','is_edit', 'is_delete', 'current_data', 'old_data', 'created_on','created_by','updated_on','updated_by'];
|
||||
|
||||
public function saveData($data, $id = null)
|
||||
{
|
||||
if ($id === null) {
|
||||
// Insert new record
|
||||
return $this->db->table('audit_history')->insert($data);
|
||||
} else {
|
||||
// Update existing record
|
||||
return $this->update($id, $data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getData($table, $where = null,$whereIn = null)
|
||||
{
|
||||
$query = $this->db->table($table);
|
||||
if ($where) {
|
||||
$query->where($where);
|
||||
}
|
||||
if($whereIn){
|
||||
// $query->whereIn($column_name,$missingValues)
|
||||
$query->whereIn($whereIn[0],$whereIn[1]);
|
||||
}
|
||||
return $query->get()->getResult();
|
||||
}
|
||||
|
||||
public function updateData($table, $data, $where)
|
||||
{
|
||||
$this->db->table($table)->update($data, $where);
|
||||
$affected_rows = $this->db->affectedRows();
|
||||
return $affected_rows;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
46
app/Models/AuthenticationModel.php
Normal file
46
app/Models/AuthenticationModel.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
use CodeIgniter\Model;
|
||||
class AuthenticationModel extends Model
|
||||
{
|
||||
protected $table = 'users';
|
||||
protected $primaryKey = 'user_id';
|
||||
protected $allowedFields = ['user_id','email','first_name','last_name','password','mobile_no','date_of_birth','address','gender','profile_picture','city','state','postal_code','country','role','isactive','business_id','reset_link'];
|
||||
|
||||
public function getheringDetailsForHeader($user_id)
|
||||
{
|
||||
$builder = $this->db->table('users');
|
||||
$builder->select('users.user_id,users.business_id,users.profile_picture,users.role,business.site_name,business.site_title,business.favicon,business.business_logo as company_logo_large,business.business_logo as company_logo_small,business.email as company_email,business.address as company_address,business.mobile_no as company_mobile_no,business.title,business.footer_about');
|
||||
$builder->join('business', 'business.business_id = users.business_id', 'left');
|
||||
$builder->where('user_id', $user_id);
|
||||
//$template_mapping_details['fk_entity_id'];
|
||||
$query = $builder->get();
|
||||
|
||||
return $query->getResultArray();
|
||||
}
|
||||
|
||||
public function getheringSuperAdminDetailsForHeader($user_id)
|
||||
{
|
||||
$builder = $this->db->table('users');
|
||||
$builder->select('users.user_id,users.business_id,users.profile_picture,users.role,business.site_name,business.site_title,business.favicon,business.business_logo as company_logo_large,business.business_logo as company_logo_small,business.email as company_email,business.address as company_address,business.mobile_no as company_mobile_no,business.title,business.footer_about');
|
||||
$builder->join('business', 'business.business_id = users.business_id', 'left');
|
||||
$builder->where('user_id', $user_id);
|
||||
//$template_mapping_details['fk_entity_id'];
|
||||
$query = $builder->get();
|
||||
|
||||
return $query->getResultArray();
|
||||
}
|
||||
|
||||
public function getreminder($bwhere){
|
||||
$query = $this->db->table('business');
|
||||
$result = $query->where($bwhere)->get()->getResultArray();
|
||||
if (count($result) > 0) {
|
||||
$reminder = $result[0];
|
||||
} else {
|
||||
$reminder = [];
|
||||
}
|
||||
return $reminder;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
49
app/Models/BooksModel.php
Normal file
49
app/Models/BooksModel.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
use CodeIgniter\Model;
|
||||
class BooksModel extends Model
|
||||
{
|
||||
protected $table = 'causes';
|
||||
protected $primaryKey = 'causes_id';
|
||||
protected $allowedFields = ['causes_id','name','type','description','from_date', 'to_date', 'business_id', 'created_on','created_by','updated_on','updated_by','isactive'];
|
||||
// protected $allowedFields = ['causes_id','title','cover_picture','publication_date','isbn_code','publisher','category','genre','language','description','page_count','tax','price','created_on','created_by','updated_on','updated_by','isactive','business_id'];
|
||||
|
||||
public function saveData($data, $id = null)
|
||||
{
|
||||
if ($id === null) {
|
||||
// Insert new record
|
||||
return $this->insert($data);
|
||||
} else {
|
||||
// Update existing record
|
||||
return $this->update($id, $data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getData($table, $where = null,$whereIn = null)
|
||||
{
|
||||
$query = $this->db->table($table);
|
||||
if ($where) {
|
||||
$query->where($where);
|
||||
}
|
||||
if($whereIn){
|
||||
// $query->whereIn($column_name,$missingValues)
|
||||
$query->whereIn($whereIn[0],$whereIn[1]);
|
||||
}
|
||||
return $query->get()->getResult();
|
||||
}
|
||||
|
||||
public function inactiveMissingDetails($table_name,$dataToUpdate,$where = null,$whereIn = null)
|
||||
{
|
||||
$this->db->table($table_name);
|
||||
$query = $this->db->table($table_name);
|
||||
if ($where) {
|
||||
$query->where($where);
|
||||
}
|
||||
if ($whereIn) {
|
||||
$query->whereIn($whereIn[0], $whereIn[1]);
|
||||
}
|
||||
return $query->update($dataToUpdate);
|
||||
}
|
||||
|
||||
}
|
||||
107
app/Models/BusinessModel.php
Normal file
107
app/Models/BusinessModel.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
|
||||
class BusinessModel extends Model
|
||||
{
|
||||
protected $table = 'business';
|
||||
protected $primaryKey = 'business_id';
|
||||
protected $allowedFields = ['business_id','title','email','mobile_no','terms','address','city','state','postal_code' ,'business_logo','isactive', 'pan_no', 'org_reg_no', '80G', 'signature','favicon','start_no','left_pad','prefix_format','site_name','site_title','site_mobile','site_info','admin_email','terms_service','footer_about','copyright','pagination_limit','about_info','country','currency','12AA','80G_vaildupto','12AA_vaildupto'];
|
||||
|
||||
public function insertBusiness($data)
|
||||
{
|
||||
return $this->insert($data);
|
||||
}
|
||||
public function getBranchesByBusinessId($businessId)
|
||||
{
|
||||
return $this->db->table('business_branches')
|
||||
->where('business_id', $businessId)
|
||||
->where('isactive', 1)
|
||||
->get()
|
||||
->getResultArray();
|
||||
}
|
||||
|
||||
public function insertDonationBusiness($businessId)
|
||||
{
|
||||
$donationData = $this->db->table('donations_accepted')
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
if (!empty($donationData)) {
|
||||
$insertData = [];
|
||||
foreach ($donationData as $donation) {
|
||||
$insertData[] = [
|
||||
'bussiness_id' => $businessId,
|
||||
'donation_id' => $donation['id'],
|
||||
'name' => $donation['name'],
|
||||
'is_active'=>1
|
||||
// Add other columns as needed
|
||||
];
|
||||
}
|
||||
|
||||
// Insert data into donation_business table
|
||||
$this->db->table('donation_business')->insertBatch($insertData);
|
||||
}
|
||||
|
||||
}
|
||||
public function getDonationBusinessData($businessId)
|
||||
{
|
||||
return $this->db->table('donation_business')
|
||||
->where('bussiness_id', $businessId)
|
||||
->get()
|
||||
->getResultArray();
|
||||
}
|
||||
public function updateDonationData($businessId, $selectedDonations)
|
||||
{
|
||||
// Fetch all donation data for the given businessId
|
||||
$donationData = $this->db->table('donation_business')
|
||||
->where('bussiness_id', $businessId)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
foreach ($donationData as $donation) {
|
||||
$donationId = $donation['donation_id'];
|
||||
$isActive = in_array($donationId, $selectedDonations) ? 1 : 0;
|
||||
|
||||
// Update donations_accepted table based on selected options
|
||||
$donationUpdateData = ['is_active' => $isActive];
|
||||
$donationWhere = ['id' => $donationId];
|
||||
|
||||
$this->db->table('donation_business')
|
||||
->where($donationWhere)
|
||||
->update($donationUpdateData);
|
||||
}
|
||||
}
|
||||
|
||||
public function inactiveMissingBuinessBranchDetails($where,$missingValues){
|
||||
$dataToUpdate = ['isactive' => 0];
|
||||
$this->db->table('business_branches')->where($where)->whereIn('id',$missingValues)->update($dataToUpdate);
|
||||
}
|
||||
|
||||
public function saveBuinessBranchDetails($data){
|
||||
$i = 0;
|
||||
$statement = [];
|
||||
foreach ($data as $row) {
|
||||
$id = $row['id'];
|
||||
if($id != ''){
|
||||
unset($row['id']); // Remove the id from the data to avoid updating it
|
||||
$this->db->table('business_branches')->where('id', $id)->update($row);// Update the row with the specified id
|
||||
$affectedRows = $this->db->affectedRows();
|
||||
$statement[$i] = "business branches id - ".$id." ". ($affectedRows ? " Updated":" Nothing to Updated");
|
||||
}else{
|
||||
$this->db->table('business_branches')->insert($row);
|
||||
$insertID = $this->db->insertID();
|
||||
$statement[$i] = "business branches id - ".$insertID." Inserted";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
return $statement;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
107
app/Models/CustomerModel.php
Normal file
107
app/Models/CustomerModel.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
|
||||
class CustomerModel extends Model
|
||||
{
|
||||
protected $table = 'donor';
|
||||
protected $primaryKey = 'donor_id ';
|
||||
// protected $allowedFields = ['donor_id ','first_name','city','last_name','email','mobile_no','country','state','postal_code' ,'address','profile_picture','date_of_birth','gender','mode','isactive','business_id'];
|
||||
protected $allowedFields = ['donor_id ','first_name','city','last_name','email','mobile_no','country','state','postal_code' ,'address','org_name','date_of_birth','pan_no','adhar_no','org_reg_details','donor_type','isactive','business_id','created_by','updated_by','XL_file_name','ip_address','passport_no'];
|
||||
|
||||
public function insertCustomer($data)
|
||||
{
|
||||
return $this->insert($data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function saveGroupDetails($data){
|
||||
$id = $data['group_id'];
|
||||
if($id != ''){
|
||||
unset($data['group_id']); // Remove the id from the data to avoid updating it
|
||||
unset($data['created_by']); // bcoz here data Updating here.
|
||||
if ($this->db->table('donor_groups')->where('group_id', $id)->update($data)) {
|
||||
$affectedRows = $this->db->affectedRows();
|
||||
$statement['success'] = 'Customer Group has been updated successfully.';
|
||||
$statement['error'] = "";
|
||||
$statement['log'] = "Customer Group: has been updated successfully. Updated Customer Group ID = " .$id." Affected Rows = ".$affectedRows;
|
||||
} else {
|
||||
$statement['success'] = "";
|
||||
$statement['error'] = 'Customer group update failed. Please try again.';
|
||||
$statement['log'] = "Customer Group: Err Failed to update ID = " .$id ;
|
||||
}
|
||||
}else{
|
||||
unset($data['updated_by']);
|
||||
if ($this->db->table('donor_groups')->insert($data)) {
|
||||
$insertID = $this->db->insertID();
|
||||
$statement['success'] = 'Customer Group has been Inserted successfully.';
|
||||
$statement['error'] = "";
|
||||
$statement['log'] = "Customer Group : has been added successfully. Inserted ID = " .$insertID ;
|
||||
} else {
|
||||
$statement['success'] = "";
|
||||
$statement['error'] = "Customer could not be added. Please try again..";
|
||||
$statement['log'] = "Customer: Err could not be added. Please try again.";
|
||||
}
|
||||
}
|
||||
return $statement;
|
||||
}
|
||||
|
||||
public function getGroupDetails($business_id)
|
||||
{
|
||||
return $this->db->table('donor_groups as CG' )
|
||||
->join('users as U1', 'U1.user_id = CG.created_by', 'left')
|
||||
->join('users as U2', 'U2.user_id = CG.updated_by', 'left')
|
||||
->select('CG.group_id,CG.group_name,CG.created_on,CG.created_by,CG.updated_on,CG.updated_by,DATE_FORMAT(CG.created_on, "%d/%m/%Y %h:%i %p") AS formatted_created_on,concat(U1.first_name," ",U1.last_name) as created_by_name,concat(U2.first_name," ",U2.last_name) as updated_by_name,CG.isactive')
|
||||
->where(['CG.group_name != ' => 'EXPIRYDATE'])
|
||||
->where('CG.business_id', $business_id)
|
||||
// ->where(['CG.isactive' => 1])
|
||||
->get()
|
||||
->getResultArray();
|
||||
}
|
||||
public function getReceiptDetailsByDonorId($donorId)
|
||||
{
|
||||
return $this->db->table('receipt')
|
||||
->select('receipt.receipt_number, receipt.donor_id, receipt.amount, receipt.currency,receipt.receipt_date, d.first_name')
|
||||
->join('donor as d', 'd.donor_id = receipt.donor_id', 'left') // Adjust columns accordingly
|
||||
->where('receipt.donor_id', $donorId) // Specify the table alias for the column in the where clause
|
||||
->get()
|
||||
->getResult();
|
||||
}
|
||||
|
||||
public function getData($table, $where = null)
|
||||
{
|
||||
$query = $this->db->table($table);
|
||||
if ($where) {
|
||||
$query->where($where);
|
||||
}
|
||||
return $query->get()->getResult();
|
||||
}
|
||||
|
||||
function export_excel($business_id)
|
||||
{
|
||||
$builder = $this->db->table('donor')
|
||||
->select('CONCAT_WS(" ", donor.first_name, donor.last_name) AS full_name')
|
||||
->select('donor.donor_type,donor.org_name,donor.org_reg_details,donor.mobile_no,donor.email,donor.pan_no,donor.adhar_no,donor.passport_no,donor.address,donor.country,donor.state,donor.city,donor.postal_code')
|
||||
->select('CONCAT_WS(" ", creator.first_name, creator.last_name) AS creator_name')
|
||||
->select('CONCAT_WS(" ", updater.first_name, updater.last_name) AS updater_name')
|
||||
->select('IFNULL(DATE_FORMAT(donor.created_on, "%d-%m-%Y"), "-") AS formatted_created_on')
|
||||
->select('IFNULL(DATE_FORMAT(donor.updated_on, "%d-%m-%Y"), "-") AS formatted_updated_on')
|
||||
->select('CASE WHEN donor.isactive = 1 THEN "Active" ELSE "Inactive" END AS active_status', false)
|
||||
|
||||
->join('users as creator', ' donor.created_by = creator.user_id', 'left')
|
||||
->join('users as updater', ' donor.updated_by = updater.user_id', 'left')
|
||||
->where('donor.business_id', $business_id);
|
||||
$query = $builder->get();
|
||||
return $query->getResultArray();
|
||||
}
|
||||
|
||||
public function bulkInsert($data) {
|
||||
return $this->db->table('donor')->insertBatch($data);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@ -1,65 +0,0 @@
|
||||
<?php namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class Dashboard_model extends Model
|
||||
{
|
||||
|
||||
|
||||
public function getLoggedInUserData($id)
|
||||
{
|
||||
$builder = $this->db->table('user_management');
|
||||
$builder->where('id',$id);
|
||||
$result = $builder->get();
|
||||
if(count($result->getResultArray()) ==1)
|
||||
{
|
||||
return $result->getRow();
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function fetch_country()
|
||||
{
|
||||
|
||||
$builder = $this->db->table('country');
|
||||
$query = $builder->get();
|
||||
//print_r($query);die();
|
||||
$output = '<option value="">Select Country</option>';
|
||||
foreach($query->getResult() as $row)
|
||||
{
|
||||
$output .= '<option value="'.$row->country_id.'">'.$row->country_name.'</option>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
function fetch_state($country_id)
|
||||
{
|
||||
|
||||
$builder = $this->db->table('state');
|
||||
$builder->where('country_id',$country_id);
|
||||
$query = $builder->get();
|
||||
//print_r($query);die();
|
||||
$output = '<option value="">Select State</option>';
|
||||
foreach($query->getResult() as $row)
|
||||
{
|
||||
$output .= '<option value="'.$row->state_id.'">'.$row->state_name.'</option>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
function fetch_city($state_id)
|
||||
{
|
||||
|
||||
$builder = $this->db->table('city');
|
||||
$builder->where('state_id',$state_id);
|
||||
$query = $builder->get();
|
||||
//print_r($query);die();
|
||||
$output = '<option value="">Select city</option>';
|
||||
foreach($query->getResult() as $row)
|
||||
{
|
||||
$output .= '<option value="'.$row->city_id.'">'.$row->city_name.'</option>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,64 +0,0 @@
|
||||
<?php namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class Donation_cause extends Model
|
||||
{
|
||||
protected $table = 'donation_cause';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = ['cause_name', 'from_date','to_date','status'];
|
||||
|
||||
|
||||
|
||||
function all_donation_cause()
|
||||
{
|
||||
$builder = $this->db->table('donation_cause');
|
||||
// $builder->where('status','Active');
|
||||
$result = $builder->get();
|
||||
$output = $result->getResultArray();
|
||||
return $output;
|
||||
}
|
||||
function inactive_donation_cause()
|
||||
{
|
||||
$builder = $this->db->table('donation_cause');
|
||||
$builder->where('status','Inactive');
|
||||
$result = $builder->get();
|
||||
$output = $result->getResultArray();
|
||||
return $output;
|
||||
}
|
||||
// function inactive_cause($id)
|
||||
// {
|
||||
// $builder=$this->db->query("UPDATE donation_cause SET status = Inactive WHERE id = ".$id);
|
||||
// }
|
||||
// function active_cause($id)
|
||||
// {
|
||||
// $builder=$this->db->query("UPDATE donation_cause SET status ='Active' WHERE id = ".$id);
|
||||
// }
|
||||
function fetch_cause_name()
|
||||
{
|
||||
$builder = $this->db->table('donation_cause');
|
||||
$builder->where('status','Active');
|
||||
$query = $builder->get();
|
||||
$output = '<option value="">Select Cause Name</option>';
|
||||
foreach($query->getResult() as $row)
|
||||
{
|
||||
$output .= '<option value="'.$row->id.'">'.$row->cause_name.'</option>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
// protected $returnType = 'array';
|
||||
// protected $useSoftDeletes = true;
|
||||
|
||||
|
||||
|
||||
// protected $useTimestamps = false;
|
||||
// protected $createdField = 'created_at';
|
||||
// protected $updatedField = 'updated_at';
|
||||
// protected $deletedField = 'deleted_at';
|
||||
|
||||
// protected $validationRules = [];
|
||||
// protected $validationMessages = [];
|
||||
// protected $skipValidation = false;
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
<?php namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class Donation_data_model extends Model
|
||||
{
|
||||
protected $table = 'donation_data';
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
protected $allowedFields = ['date', 'cause_name','amount','mode_of_payment', 'ref_1','donation_ref'];
|
||||
|
||||
|
||||
|
||||
function all_donation_data()
|
||||
{
|
||||
|
||||
$builder = $this->db->table('donation_data');
|
||||
$result = $builder->get();
|
||||
$output = $result->getResultArray();
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
// protected $returnType = 'array';
|
||||
// protected $useSoftDeletes = true;
|
||||
|
||||
|
||||
|
||||
// protected $useTimestamps = false;
|
||||
// protected $createdField = 'created_at';
|
||||
// protected $updatedField = 'updated_at';
|
||||
// protected $deletedField = 'deleted_at';
|
||||
|
||||
// protected $validationRules = [];
|
||||
// protected $validationMessages = [];
|
||||
// protected $skipValidation = false;
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
<?php namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class Donation_model extends Model
|
||||
{
|
||||
protected $table = 'firstci4';
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
protected $allowedFields = ['name', 'email','department'];
|
||||
|
||||
// protected $returnType = 'array';
|
||||
// protected $useSoftDeletes = true;
|
||||
|
||||
|
||||
|
||||
// protected $useTimestamps = false;
|
||||
// protected $createdField = 'created_at';
|
||||
// protected $updatedField = 'updated_at';
|
||||
// protected $deletedField = 'deleted_at';
|
||||
|
||||
// protected $validationRules = [];
|
||||
// protected $validationMessages = [];
|
||||
// protected $skipValidation = false;
|
||||
}
|
||||
@ -1,60 +0,0 @@
|
||||
<?php namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class Donor_model extends Model
|
||||
{
|
||||
protected $table = 'user_management';
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
protected $allowedFields = ['name', 'phone','email','pan', 'address','country','state','city','pin_code','date_of_birth','gender', 'org_name','gstin','foreign_key', 'password','signature','updated_at'];
|
||||
|
||||
protected $beforeInsert = ['beforeInsert'];
|
||||
protected $beforeUpdate = ['beforeUpdate'];
|
||||
|
||||
protected function beforeInsert(array $data){
|
||||
$data= $this->passwordHash($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function beforeUpdate(array $data){
|
||||
$data= $this->passwordHash($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function passwordHash(array $data)
|
||||
{
|
||||
if(isset($data['data']['password']))
|
||||
$data['data']['password'] = password_hash($data['data']['password'],PASSWORD_DEFAULT);
|
||||
return $data;
|
||||
}
|
||||
public function verifyEmail($email)
|
||||
{
|
||||
|
||||
$builder = $this->db->table('user_management');
|
||||
$builder -> select("id,phone,email,password");
|
||||
$builder -> where('email',$email);
|
||||
$result = $builder->get();
|
||||
if(count($result->getResultArray()) ==1)
|
||||
{
|
||||
return $result->getRowArray();
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// protected $returnType = 'array';
|
||||
// protected $useSoftDeletes = true;
|
||||
|
||||
|
||||
|
||||
// protected $useTimestamps = false;
|
||||
// protected $createdField = 'created_at';
|
||||
// protected $updatedField = 'updated_at';
|
||||
// protected $deletedField = 'deleted_at';
|
||||
|
||||
// protected $validationRules = [];
|
||||
// protected $validationMessages = [];
|
||||
// protected $skipValidation = false;
|
||||
}
|
||||
57
app/Models/EventModel.php
Normal file
57
app/Models/EventModel.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
|
||||
class EventModel extends Model
|
||||
{
|
||||
protected $table = 'campaign';
|
||||
protected $primaryKey = 'campaign_id';
|
||||
protected $allowedFields = ['campaign_id','name', 'description','start_date', 'end_date','created_by','created_on','updated_on' ,'updated_by','business_id'];
|
||||
|
||||
public function getEventnamesByBusiness($business_id)
|
||||
{
|
||||
$this->builder()->where('business_id ', $business_id); // Filter by business_id
|
||||
$query = $this->builder()->get(); // Use findAll() instead of get()
|
||||
return ($query->getResult());
|
||||
}
|
||||
|
||||
public function setTable($tableName)
|
||||
{
|
||||
$this->table = $tableName;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function insertData($table, $data)
|
||||
{
|
||||
try {
|
||||
|
||||
|
||||
$this->db->table($table)->insert($data);
|
||||
|
||||
$last_insert_id = $this->db->insertID();
|
||||
return ["info"=>$last_insert_id,"err"=>""];
|
||||
} catch (\CodeIgniter\Database\Exceptions\DatabaseException $e) {
|
||||
return ["info"=>"","err"=>'Database operation failed: ' . $e->getMessage()];
|
||||
} catch (\Exception $e) {
|
||||
return ["info"=>"","err"=>'An error occurred: ' . $e->getMessage()];
|
||||
}
|
||||
}
|
||||
|
||||
public function updateData($table, $data, $where)
|
||||
{
|
||||
try {
|
||||
$this->db->table($table)->update($data, $where);
|
||||
$affected_rows = $this->db->affectedRows();
|
||||
return ["info"=>$affected_rows." Affected","err"=>""];
|
||||
} catch (\CodeIgniter\Database\Exceptions\DatabaseException $e) {
|
||||
return ["info"=>"","err"=>'Database operation failed: ' . $e->getMessage()];
|
||||
} catch (\Exception $e) {
|
||||
return ["info"=>"","err"=>'Database operation failed: ' . $e->getMessage()];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
121
app/Models/HomeModel.php
Normal file
121
app/Models/HomeModel.php
Normal file
@ -0,0 +1,121 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
use CodeIgniter\Model;
|
||||
class HomeModel extends Model
|
||||
{
|
||||
|
||||
public function donordetails($where) {
|
||||
|
||||
$totalDonors = $this->db->table('donor')->where($where)->countAllResults();
|
||||
|
||||
$activeDonors = $this->db->table('donor')->select('donor.*, users.branch_id,users.business_id as users_business_id')
|
||||
->join('users', 'users.user_id = donor.created_by AND users.business_id = donor.business_id', 'left')
|
||||
->where($where)->where('donor.isactive',1)->countAllResults();
|
||||
|
||||
$where['DATE(donor.created_on)'] = date('Y-m-d');
|
||||
$todayDonors = $this->db->table('donor')->select('donor.*, users.branch_id,users.business_id as users_business_id')
|
||||
->join('users', 'users.user_id = donor.created_by AND users.business_id = donor.business_id', 'left')
|
||||
->where($where)->where('donor.isactive',1)->countAllResults();
|
||||
|
||||
if ($totalDonors > 0) {
|
||||
$final['percentage'] = ($activeDonors / $totalDonors) * 100;
|
||||
} else {
|
||||
$final['percentage'] = 0;
|
||||
}
|
||||
|
||||
$final['total'] = $totalDonors;
|
||||
$final['active'] = $activeDonors;
|
||||
$final['today'] = $todayDonors;
|
||||
|
||||
return $final;
|
||||
}
|
||||
|
||||
public function getbranchid($bwhere){
|
||||
$query = $this->db->table('users');
|
||||
$result = $query->select('branch_id')->where($bwhere)->get()->getRow();
|
||||
return $result ? (int)$result->branch_id : 0;
|
||||
}
|
||||
public function dashboard_account($where){
|
||||
$query = $this->db->table('users')
|
||||
->select('users.user_id,receipt.receipt_header,SUM(receipt.amount) AS total_amount')
|
||||
->select("CONCAT_WS(' ', users.first_name, users.last_name) AS full_name")
|
||||
->join('receipt', 'receipt.created_by = users.user_id', 'left')
|
||||
->where('users.isactive', 1)
|
||||
->where('receipt.receipt_header', 'Receipt')
|
||||
->where($where)
|
||||
->like('users.role', 'volunteer')
|
||||
->groupby('users.user_id, full_name');
|
||||
$result = $query->get()->getResult();
|
||||
// echo $this->db->getLastQuery()->getQuery();die;
|
||||
|
||||
$total_amount_today = $this->db->table('receipt')
|
||||
->select('SUM(amount) AS total_amount_today')
|
||||
->join('users', 'receipt.created_by = users.user_id', 'left')
|
||||
->where('receipt.receipt_header', 'Receipt')
|
||||
->where($where)
|
||||
->where('DATE(receipt.created_on) = CURDATE()')
|
||||
->get()->getRow();
|
||||
$today = ($total_amount_today) ? $total_amount_today->total_amount_today : 0;
|
||||
|
||||
|
||||
|
||||
$total_amount_current_month = $this->db->table('receipt')
|
||||
->select('SUM(amount) AS total_amount_current_month')
|
||||
->join('users', 'receipt.created_by = users.user_id', 'left')
|
||||
->where('receipt.receipt_header', 'Receipt')
|
||||
->where($where)
|
||||
->where('YEAR(receipt.created_on)', date('Y'))
|
||||
->where('MONTH(receipt.created_on)', date('m'))
|
||||
->get()->getRow();
|
||||
$month = ($total_amount_current_month) ? $total_amount_current_month->total_amount_current_month : 0;
|
||||
|
||||
$total_amount_current_financial_year = $this->db->table('receipt')
|
||||
->select('SUM(amount) AS total_amount_current_financial_year')
|
||||
->join('users', 'receipt.created_by = users.user_id', 'left')
|
||||
->where('receipt.receipt_header', 'Receipt')
|
||||
->where($where)
|
||||
->where('receipt.created_on >=', date('Y-04-01'))
|
||||
->where('receipt.created_on <', date('Y-04-01', strtotime('+1 year')))
|
||||
->get()->getRow();
|
||||
$financial_year = ($total_amount_current_financial_year) ? $total_amount_current_financial_year->total_amount_current_financial_year : 0;
|
||||
|
||||
|
||||
$final['volunter'] = $result;
|
||||
$final['month'] = (int)$month;
|
||||
$final['today'] = (int)$today;
|
||||
$final['year'] = (int)$financial_year;
|
||||
return $final;
|
||||
}
|
||||
|
||||
public function dashboard_volunteer($where){
|
||||
$common_query = $this->db->table('users')
|
||||
->select('users.user_id, SUM(receipt.amount) AS total_amount')
|
||||
->select("CONCAT_WS(' ', users.first_name, users.last_name) AS full_name")
|
||||
->join('receipt', 'receipt.created_by = users.user_id', 'left')
|
||||
->where($where)
|
||||
->like('users.role', 'volunteer')
|
||||
->groupby('users.user_id');
|
||||
|
||||
$today_collection = clone $common_query;
|
||||
$today_collection = $today_collection->where('DATE(receipt.created_on)', date('Y-m-d'))->get()->getRow();
|
||||
$final['today_collection'] = ($today_collection) ? (int)$today_collection->total_amount : 0;
|
||||
|
||||
$overall_collection = clone $common_query;
|
||||
$overall_collection = $overall_collection->get()->getRow();
|
||||
// echo $this->db->getLastQuery()->getQuery();die;
|
||||
$final['overall_collection'] = ($overall_collection) ? (int)$overall_collection->total_amount : 0;
|
||||
|
||||
$settlement_today = clone $common_query;
|
||||
$settlement_today = $settlement_today->where('DATE(receipt.created_on)', date('Y-m-d'))
|
||||
->where('receipt.receipt_header', 'Receipt')
|
||||
->get()->getRow();
|
||||
$final['settlement_today'] = ($settlement_today) ? (int)$settlement_today->total_amount : 0;
|
||||
|
||||
$settlement_overall = clone $common_query;
|
||||
$settlement_overall = $settlement_overall->where('receipt.receipt_header', 'Receipt')->get()->getRow();
|
||||
$final['settlement_overall'] = ($settlement_overall) ? (int)$settlement_overall->total_amount : 0;
|
||||
|
||||
return $final;
|
||||
}
|
||||
|
||||
}
|
||||
66
app/Models/InvoiceModel.php
Normal file
66
app/Models/InvoiceModel.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
use CodeIgniter\Model;
|
||||
|
||||
|
||||
class InvoiceModel extends Model
|
||||
{
|
||||
protected $table = 'receipt';
|
||||
protected $primaryKey = 'receipt_id';
|
||||
protected $allowedFields = ['receipt_id', 'receipt_number', 'donor_id','notes','amount', 'payment_mode', 'business_id', 'created_on', 'created_by', 'updated_on', 'updated_by','isactive', 'payment_ref_no', 'receipt_date','causes_id','campaign_id','receipt_header','reason','currency','receipt_type'];
|
||||
|
||||
|
||||
public function updateData($table, $data, $where)
|
||||
{
|
||||
$this->db->table($table)->update($data, $where);
|
||||
$affected_rows = $this->db->affectedRows();
|
||||
return $affected_rows;
|
||||
}
|
||||
|
||||
public function getData($table, $where = null)
|
||||
{
|
||||
$query = $this->db->table($table);
|
||||
if ($where) {
|
||||
$query->where($where);
|
||||
}
|
||||
return $query->get()->getResult();
|
||||
}
|
||||
|
||||
## gethering Donor receipt Details for PDF.
|
||||
public function getInvoiceData($id)
|
||||
{
|
||||
// Fetch invoice data
|
||||
return $this->db->table('receipt')
|
||||
->where('receipt_id', $id)
|
||||
->join('donor as C','C.donor_id= receipt.donor_id','left')
|
||||
->join('causes as D','D.causes_id= receipt.causes_id','left')
|
||||
->join('business as B','B.business_id = receipt.business_id','left')
|
||||
->select('receipt.*,CONCAT(C.first_name, IFNULL(CONCAT(" ", C.last_name), "")) as customer_name,C.address, C.postal_code,C.city, C.state,C.mobile_no as customer_mobile, C.pan_no as cust_pan_no, D.name as cause_name,C.org_name as cust_org_name')
|
||||
->select('B.title ,B.business_logo,B.terms,B.address as org_address ,B.city as org_city,B.state as org_state,B.postal_code as org_zip,B.email as org_email,B.mobile_no as org_mobile, B.pan_no as org_pan, B.org_reg_no, B.signature')
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
}
|
||||
|
||||
function export_excel($business_id)
|
||||
{
|
||||
$builder = $this->db->table('donor')
|
||||
->select('CONCAT_WS(" ", donor.first_name, donor.last_name) AS full_name')
|
||||
->select('donor.donor_type,donor.org_name,donor.org_reg_details,donor.mobile_no,donor.email,donor.pan_no,donor.adhar_no,donor.passport_no,donor.address,donor.country,donor.state,donor.city,donor.postal_code')
|
||||
->select('CONCAT_WS(" ", creator.first_name, creator.last_name) AS creator_name')
|
||||
->select('CONCAT_WS(" ", updater.first_name, updater.last_name) AS updater_name')
|
||||
->select('IFNULL(DATE_FORMAT(donor.created_on, "%d-%m-%Y"), "-") AS formatted_created_on')
|
||||
->select('IFNULL(DATE_FORMAT(donor.updated_on, "%d-%m-%Y"), "-") AS formatted_updated_on')
|
||||
->select('CASE WHEN donor.isactive = 1 THEN "Active" ELSE "Inactive" END AS active_status', false)
|
||||
->join('users as creator', ' donor.created_by = creator.user_id', 'left')
|
||||
->join('users as updater', ' donor.updated_by = updater.user_id', 'left')
|
||||
->where('donor.business_id', $business_id);
|
||||
$query = $builder->get();
|
||||
return $query->getResultArray();
|
||||
}
|
||||
|
||||
public function bulkInsert($data) {
|
||||
return $this->db->table('donor')->insertBatch($data);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,61 +0,0 @@
|
||||
<?php namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class My_model extends Model
|
||||
{
|
||||
protected $table = 'donar_management';
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
protected $allowedFields = ['name', 'phone','email','pan', 'address','country','state','city','pin_code','date_of_birth','gender', 'org_name','gstin','updated_at'];
|
||||
|
||||
|
||||
function all_donor()
|
||||
{
|
||||
|
||||
$builder = $this->db->table('donar_management');
|
||||
$result = $builder->get();
|
||||
$output = $result->getResultArray();
|
||||
return $output;
|
||||
}
|
||||
function fetch_donor_id()
|
||||
{
|
||||
|
||||
$builder = $this->db->table('donar_management');
|
||||
$query = $builder->get();
|
||||
//print_r($query);die();
|
||||
$output = '<option value="">Select Donor Id</option>';
|
||||
foreach($query->getResult() as $row)
|
||||
{
|
||||
$output .= '<option value="'.$row->id.'">'.$row->name.'</option>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
function edit_donor_id()
|
||||
{
|
||||
|
||||
$builder = $this->db->table('donar_management');
|
||||
$query = $builder->get();
|
||||
//print_r($query);die();
|
||||
$output = '<option value="">hai</option>';
|
||||
foreach($query->getResult() as $row)
|
||||
{
|
||||
$output .= '<option value="'.$row->id.'">'.$row->name.'</option>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
// protected $returnType = 'array';
|
||||
// protected $useSoftDeletes = true;
|
||||
|
||||
|
||||
|
||||
// protected $useTimestamps = false;
|
||||
// protected $createdField = 'created_at';
|
||||
// protected $updatedField = 'updated_at';
|
||||
// protected $deletedField = 'deleted_at';
|
||||
|
||||
// protected $validationRules = [];
|
||||
// protected $validationMessages = [];
|
||||
// protected $skipValidation = false;
|
||||
}
|
||||
280
app/Models/NotificationModel.php
Normal file
280
app/Models/NotificationModel.php
Normal file
@ -0,0 +1,280 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
use CodeIgniter\Model;
|
||||
class NotificationModel extends Model
|
||||
{
|
||||
// protected $table;
|
||||
protected $table = 'templates';
|
||||
protected $primaryKey = 'template_id';
|
||||
// protected $allowedFields = ['invoice_id','invoice_number','donor_id','invoice_date','event_id','business_id','created_on','business_id'];
|
||||
protected $allowedFields = ['template_name', 'subject', 'message','mode','crteated_on', 'created_by', 'updated_on', 'updated_by', 'isactive','donor_id'];
|
||||
|
||||
public function setCustomTable($tableName)
|
||||
{
|
||||
$this->table = $tableName;
|
||||
}
|
||||
|
||||
// public function getTasksDueLastWeek()
|
||||
// {
|
||||
// $now = date('Y-m-d');
|
||||
// $oneWeekAgo = date('Y-m-d', strtotime('-7 days', strtotime($now)));
|
||||
|
||||
// return $this->where('due_date >=', $oneWeekAgo)
|
||||
// ->where('due_date <=', $now)
|
||||
// ->findAll();
|
||||
// }
|
||||
|
||||
public function getSubscriptionDueDetail($date){
|
||||
// $now = date('Y-m-d');
|
||||
// $lastWeek = date('Y-m-d', strtotime('+7 days'));
|
||||
// $date_format = date('Y-m-d', $date);
|
||||
return $this->db->table('subscription as S' )
|
||||
->join('customers as C', 'C.customer_id = S.customer_id', 'left')
|
||||
->join('category as CM', 'CM.id = S.scheme_id', 'left')
|
||||
->join('business as B', 'B.business_id = S.business_id', 'left')
|
||||
->join('book_categories as BC', 'BC.category_id = S.scheme_id', 'left')
|
||||
->join('books as BK', 'BC.book_id = BK.book_id', 'left')
|
||||
->select('concat("Your subscription going to expried in ",DATEDIFF(S.to_subscription, CURDATE())," days") as statement,DATEDIFF(S.to_subscription, CURDATE()) as countdays,CM.name,concat(C.first_name, " ", C.last_name) as customer_name,C.email as customer_email,C.mobile_no as customer_mobile,S.sub_id,S.scheme_id,S.customer_id,S.from_subscription,S.to_subscription,S.business_id,B.title as business_name,B.address as business_address,B.city as business_city,B.state as business_state,B.postal_code as business_postal_code,B.email as business_email,B.mobile_no as business_mobile_no,S.to_subscription,S.from_subscription,BK.title,BK.book_id')
|
||||
// ->where('S.to_subscription >=', $now)->where('S.to_subscription <=',$lastWeek)
|
||||
->where('S.to_subscription =',date('Y-m-d', strtotime($date)))
|
||||
->groupBy('S.sub_id')
|
||||
->get()->getResultArray();
|
||||
}
|
||||
|
||||
public function getTemplateDetails($session_bid){
|
||||
return $this->db->table('templates as T' )
|
||||
->join('users as U1', 'U1.user_id = T.created_by', 'left')
|
||||
->join('users as U2', 'U2.user_id = T.updated_by', 'left')
|
||||
->select('T.template_id,T.template_name,T.mode,T.created_on,T.created_by,T.updated_on,T.updated_by,DATE_FORMAT(T.created_on, "%d/%m/%Y %h:%i %p") AS formatted_created_on,concat(U1.first_name," ",U1.last_name) as created_by_name,concat(U2.first_name," ",U2.last_name) as updated_by_name,T.isactive')
|
||||
->whereNotIn('T.template_name',array('EXPIRAY_NOTIFY_TEMPLATE_EMAIL','EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP'))
|
||||
->where('U1.business_id =',$session_bid)
|
||||
->get()->getResultArray();
|
||||
}
|
||||
|
||||
public function saveDetails($data,$pk_name,$t_name){
|
||||
$id = $data[$pk_name];
|
||||
$statement_string = ucfirst(str_replace('_', ' ', $t_name));
|
||||
if($id != ''){
|
||||
unset($data[$pk_name]); // Remove the id from the data to avoid updating it
|
||||
unset($data['created_by']); // bcoz here data Updating here.
|
||||
if ($this->db->table($t_name)->where($pk_name, $id)->update($data)) {
|
||||
$affectedRows = $this->db->affectedRows();
|
||||
$statement['success'] = $statement_string.' has been updated successfully.';
|
||||
$statement['error'] = "";
|
||||
$statement['log'] = $statement_string.": has been updated successfully. Updated ".$pk_name." = " .$id." Affected Rows = ".$affectedRows;
|
||||
} else {
|
||||
$statement['success'] = "";
|
||||
$statement['error'] = $statement_string.' update failed. Please try again.';
|
||||
$statement['log'] = $statement_string.": Err Failed to update ID = " .$id ;
|
||||
}
|
||||
}else{
|
||||
unset($data['updated_by']);
|
||||
if ($this->db->table($t_name)->insert($data)) {
|
||||
$insertID = $this->db->insertID();
|
||||
$statement['success'] = $statement_string.' has been Inserted successfully.';
|
||||
$statement['error'] = "";
|
||||
$statement['log'] = $statement_string.": has been added successfully. Inserted ID = " .$insertID ;
|
||||
} else {
|
||||
$statement['success'] = "";
|
||||
$statement['error'] = $statement_string." could not be added. Please try again..";
|
||||
$statement['log'] = $statement_string.": Err could not be added. Please try again.";
|
||||
}
|
||||
}
|
||||
return $statement;
|
||||
}
|
||||
|
||||
public function getCampaignDetails($session_bid){
|
||||
$result = $this->db->table('notification_campaign as NC' )
|
||||
->join('users as U1', 'U1.user_id = NC.created_by', 'left')
|
||||
->join('users as U2', 'U2.user_id = NC.updated_by', 'left')
|
||||
->join('templates as T', 'T.template_id = NC.template_id', 'left')
|
||||
->select('NC.campaign_id,NC.campaign_name,T.template_id,T.template_name,NC.mode,NC.created_on,NC.created_by,NC.updated_on,NC.updated_by,DATE_FORMAT(NC.created_on, "%d/%m/%Y %h:%i %p") AS formatted_created_on,concat(U1.first_name," ",U1.last_name) as created_by_name,concat(U2.first_name," ",U2.last_name) as updated_by_name,NC.isactive,NC.group_id,NC.scheduled_date,if(NC.scheduled_time IS NULL ,"",NC.scheduled_time) as scheduled_time')
|
||||
->whereNotIn('T.template_name',array('EXPIRAY_NOTIFY_TEMPLATE_EMAIL','EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP'))
|
||||
->where('U1.business_id =',$session_bid)
|
||||
->get()->getResultArray();
|
||||
|
||||
if (!empty($result)) {
|
||||
foreach ($result as $i => $item) {
|
||||
$group_id = unserialize($item['group_id']);
|
||||
$group_names = [];
|
||||
$group_query = [];
|
||||
foreach ($group_id as $j) {
|
||||
$cg_data = $this->db->table('donor_groups as CG')
|
||||
->select('CG.group_id, CG.group_name,CG.group_query, CG.isactive')
|
||||
->where(['CG.isactive' => 1, 'CG.group_id' => $j])
|
||||
->get()
|
||||
->getRowArray();
|
||||
|
||||
if ($cg_data) {
|
||||
$group_names[] = $cg_data['group_name'];
|
||||
$group_query[] = $cg_data['group_query'];
|
||||
// array_push($group_sql, $cg_data['group_query']);
|
||||
}
|
||||
}
|
||||
$result[$i]['group_name'] = !empty($group_names) ? implode(", ", $group_names) : '';
|
||||
$result[$i]['customer_group'] = !empty($group_query) ? $this->customerGroupQueryExecution($group_query) : '';
|
||||
$result[$i]['customer_group_count'] = !empty($result[$i]['customer_group']) ? count($this->customerGroupQueryExecution($group_query)) : 0;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function customerGroupQueryExecution($queries){
|
||||
|
||||
$results = [];
|
||||
|
||||
// Execute the queries
|
||||
foreach ($queries as $query) {
|
||||
if(!empty($query)){
|
||||
$queryResult = $this->db->query($query)->getResult();
|
||||
$results[] = $queryResult;}
|
||||
}
|
||||
// echo "<pre>";
|
||||
// print_r($results);
|
||||
// echo "</pre>";
|
||||
// Create a new array to store the unique results based on customer_id
|
||||
$uniqueCustomers = array();
|
||||
|
||||
foreach ($results as $innerArray) {
|
||||
foreach ($innerArray as $customer) {
|
||||
// echo json_encode($customer);die;
|
||||
$customerId = $customer->donor_id;
|
||||
|
||||
// Check if the customer_id already exists in $uniqueCustomers
|
||||
if (!isset($uniqueCustomers[$customerId])) {
|
||||
$uniqueCustomers[$customerId] = $customer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Convert the $uniqueCustomers array back to a numerically indexed array
|
||||
$uniqueCustomers = array_values($uniqueCustomers);
|
||||
return $uniqueCustomers;
|
||||
// echo "<pre>";
|
||||
// print_r($uniqueCustomers);
|
||||
// echo "</pre>";
|
||||
// die;
|
||||
}
|
||||
// $query = "INSERT IGNORE INTO notification_history_children (fkid,customer_id,receiving_entry,message,result,sent_time)
|
||||
// VALUES (1, 1, 'somes@gmail2.com','mail msg',NULL,'2023-12-22 14:20:50'),
|
||||
// (1, 1, '9638527411','whatapp msg',NULL,'2023-12-22 14:20:50')";
|
||||
// $result = $db->query($query)->getResultArray();
|
||||
public function getExpDate()
|
||||
{
|
||||
$db = \Config\Database::connect();
|
||||
|
||||
$query = "SELECT * FROM donor_groups WHERE group_name = 'EXPIRYDATE'";
|
||||
|
||||
$result = $db->query($query)->getResultArray();
|
||||
|
||||
if (isset($result[0]["group_query"])) {
|
||||
return $result[0]["group_query"];
|
||||
} else {
|
||||
|
||||
error_log('group_query is not available in getExpDate()');
|
||||
|
||||
return ;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function getTempName($constant)
|
||||
{
|
||||
$db = \Config\Database::connect();
|
||||
$query = "SELECT * FROM templates WHERE template_name = '".$constant."'";
|
||||
// print_r($query);die;
|
||||
$result = $db->query($query)->getResultArray();
|
||||
if (isset($result)) {
|
||||
return $result;
|
||||
} else {
|
||||
|
||||
error_log('group_query is not available in getExpDate()');
|
||||
|
||||
return $query;
|
||||
|
||||
}
|
||||
}
|
||||
public function update_notification_campaign_status($data,$id){
|
||||
if($id != ''){
|
||||
$where = ['isactive' => 1, 'status' => 0 ,'campaign_id'=>(int)$id];
|
||||
if ($this->db->table('notification_campaign')->where($where)->update($data)) {
|
||||
$affectedRows = $this->db->affectedRows();
|
||||
$statement = $affectedRows > 0 ? 'Notification Campaign Status has been updated successfully. Aff Row'.$affectedRows." NCID = " .$id : 'Notification Campaign Status Update failed. Bcoz Already Affected Count = '.$affectedRows.". NCID = " .$id ;
|
||||
} else {
|
||||
$statement = "Notification Campaign Status Update failed. NCID = " .$id;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$statement = "Notification Campaign Status Update failed. Bcoz Not Found NCID";
|
||||
}
|
||||
return $statement;
|
||||
}
|
||||
|
||||
public function save_notification_history_parents($data){
|
||||
|
||||
$this->db->table('notification_history_parents')->insert($data);
|
||||
$insertID = $this->db->insertID();
|
||||
return $insertID;
|
||||
}
|
||||
|
||||
public function update_notification_history_parent_status($data,$id,$campaign_id){
|
||||
if($id != ''){
|
||||
$where = ['id' => (int)$id, 'status' => 0 ,'campaign_id'=>(int)$campaign_id];
|
||||
if ($this->db->table('notification_history_parents')->where($where)->update($data)) {
|
||||
$affectedRows = $this->db->affectedRows();
|
||||
$statement = $affectedRows > 0 ? 'Notification history parent Status has been updated successfully. Aff Row'.$affectedRows." NHPID = " .$id : 'Notification history parent Status Update failed. Bcoz Already Affected Count = '.$affectedRows.". NHPID = " .$id ;
|
||||
} else {
|
||||
$statement = "Notification history parent Status Update failed. NHPID = " .$id;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$statement = "Notification history parent Status Update failed. Bcoz Not Found NHPID";
|
||||
}
|
||||
return $statement;
|
||||
}
|
||||
|
||||
|
||||
public function save_notification_history_child($data){
|
||||
// $this->db->ignore(true); // Enable "INSERT IGNORE" behavior
|
||||
// $this->db->table('notification_history_children')->insert($data);
|
||||
// $insertID = $this->db->insertID(); // Get the last inserted ID
|
||||
// return $insertID;
|
||||
// $insert_query = $this->db->insert_string('notification_history_children', $data);
|
||||
// $insert_query = str_replace('INSERT INTO', 'INSERT IGNORE INTO', $insert_query);
|
||||
// $this->db->query($insert_query);
|
||||
// $insertID = $this->db->insertID(); // Get the last inserted ID
|
||||
// return $insertID;
|
||||
|
||||
$table = 'notification_history_children';
|
||||
$insert_query = "INSERT IGNORE INTO $table (" . implode(', ', array_keys($data)) . ") VALUES (" . rtrim(str_repeat('?, ', count($data)), ', ') . ")";
|
||||
$this->db->query($insert_query, array_values($data));
|
||||
// print_r($this->db->getLastQuery());die;
|
||||
$insertID = $this->db->insertID();
|
||||
return $insertID;
|
||||
}
|
||||
|
||||
public function update_notification_history_child($data, $where){
|
||||
|
||||
$id = isset($where['id']) ? $where['id'] : "";
|
||||
|
||||
if ($id != '') {
|
||||
$updateResult = $this->db->table('notification_history_children')->where($where)->update($data);
|
||||
// print_r($this->db->getLastQuery());die;
|
||||
if ($updateResult) {
|
||||
$affectedRows = $this->db->affectedRows();
|
||||
$statement = 'Notification history children has been updated successfully. Aff Row ' . $affectedRows . ' NHCID = ' . $id;
|
||||
} else {
|
||||
$statement = 'Notification history children Update failed. NHCID = ' . $id;
|
||||
}
|
||||
} else {
|
||||
$statement = 'Notification history children Update failed. Bcoz Not Found NHCID';
|
||||
}
|
||||
|
||||
return $statement;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
<?php namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class Receipt_model extends Model
|
||||
{
|
||||
protected $table = 'receipts';
|
||||
protected $primaryKey = 'receipt_id';
|
||||
protected $allowedFields = ['date','donor_id','donor_name','amount', 'mode_of_receipt','receipt_details','cause_id','cause_name', 'remarks'];
|
||||
|
||||
|
||||
|
||||
function all_receipt()
|
||||
{
|
||||
$builder = $this->db->table('receipts');
|
||||
$result = $builder->get();
|
||||
$output = $result->getResultArray();
|
||||
return $output;
|
||||
}
|
||||
|
||||
function last_receipt()
|
||||
{
|
||||
$builder=$this->db->query("SELECT receipt_id,receipt_no,date,donor_id,amount,mode_of_receipt,receipt_details,cause_name,remarks FROM receipts where receipt_id =(select max(receipt_id) from receipts) ");
|
||||
$output = $builder->getResultArray();
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
// protected $returnType = 'array';
|
||||
// protected $useSoftDeletes = true;
|
||||
|
||||
|
||||
|
||||
// protected $useTimestamps = false;
|
||||
// protected $createdField = 'created_at';
|
||||
// protected $updatedField = 'updated_at';
|
||||
// protected $deletedField = 'deleted_at';
|
||||
|
||||
// protected $validationRules = [];
|
||||
// protected $validationMessages = [];
|
||||
// protected $skipValidation = false;
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
<?php namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class Transaction_model extends Model
|
||||
{
|
||||
protected $table = 'transactions_uploads';
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
protected $allowedFields = ['date', 'ref_1','ref_2','remarks', 'amount','donation_ref'];
|
||||
|
||||
|
||||
|
||||
function all_transaction()
|
||||
{
|
||||
|
||||
$builder = $this->db->table('transactions_uploads');
|
||||
$result = $builder->get();
|
||||
$output = $result->getResultArray();
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
// protected $returnType = 'array';
|
||||
// protected $useSoftDeletes = true;
|
||||
|
||||
|
||||
|
||||
// protected $useTimestamps = false;
|
||||
// protected $createdField = 'created_at';
|
||||
// protected $updatedField = 'updated_at';
|
||||
// protected $deletedField = 'deleted_at';
|
||||
|
||||
// protected $validationRules = [];
|
||||
// protected $validationMessages = [];
|
||||
// protected $skipValidation = false;
|
||||
}
|
||||
31
app/Models/UsersModel.php
Normal file
31
app/Models/UsersModel.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
use CodeIgniter\Model;
|
||||
class UsersModel extends Model
|
||||
{
|
||||
protected $table = 'users';
|
||||
protected $primaryKey = 'user_id';
|
||||
protected $allowedFields = ['user_id','user_name','email','first_name','last_name','password','branch_id','mobile_no','date_of_birth','address','gender','profile_picture','city','state','postal_code','country','role','isactive','business_id','created_by','updated_by'];
|
||||
|
||||
public function saveData($data, $id = null)
|
||||
{
|
||||
if ($id === null) {
|
||||
// Insert new record
|
||||
return $this->insert($data);
|
||||
} else {
|
||||
// Update existing record
|
||||
return $this->update($id, $data);
|
||||
}
|
||||
}
|
||||
public function getOrganizationBranches($businessId)
|
||||
{
|
||||
// Assuming your branches table is named 'branches'
|
||||
$db = db_connect();
|
||||
$builder = $db->table('business_branches');
|
||||
|
||||
$branches = $builder->where('business_id', $businessId)->get()->getResultArray();
|
||||
|
||||
return $branches;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
<?php
|
||||
namespace App\Validation;
|
||||
use App\Models\Donor_model;
|
||||
class UsersRules
|
||||
{
|
||||
|
||||
|
||||
public function validateDonor(string $str , string $fields ,array $data)
|
||||
{
|
||||
$model = new Donor_model();
|
||||
$user = $model->where('email',$data['email'])
|
||||
->first();
|
||||
if(!$Donor)
|
||||
return false;
|
||||
|
||||
return password_verify($data['password'],$user['password']);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,271 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<!-- Bootstrap DatePicker -->
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/css/bootstrap-datepicker.css" type="text/css" />
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/js/bootstrap-datepicker.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$('#txtDate').datepicker({
|
||||
format: "dd/mm/yyyy"
|
||||
});
|
||||
});
|
||||
$(function () {
|
||||
$('#txtDate2').datepicker({
|
||||
format: "dd/mm/yyyy"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!-- Bootstrap DatePicker End-->
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="Colorlib Templates">
|
||||
<meta name="author" content="Colorlib">
|
||||
<meta name="keywords" content="Colorlib Templates">
|
||||
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="public/assets/img/apple-icon.png">
|
||||
<link rel="icon" type="image/png" href="public/assets/img/favicon.ico">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<title>Donor App</title>
|
||||
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no' name='viewport' />
|
||||
<!-- Fonts and icons -->
|
||||
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700,200" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css" />
|
||||
<!-- CSS Files -->
|
||||
<link href="public/assets/css/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="public/assets/css/light-bootstrap-dashboard.css?v=2.0.0 " rel="stylesheet" />
|
||||
<!-- CSS Just for demo purpose, don't include it in your project -->
|
||||
<link href="vendor copy/font-awesome-4.7/css/font-awesome.min.css" rel="stylesheet" media="all">
|
||||
<!-- Font special for pages-->
|
||||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i" rel="stylesheet">
|
||||
|
||||
<!-- Vendor CSS-->
|
||||
<link href="public/assets/vendor copy/select2/select2.min.css" rel="stylesheet" media="all">
|
||||
<link href="public/assets/vendor copy/datepicker/daterangepicker.css" rel="stylesheet" media="all">
|
||||
|
||||
<!-- Main CSS-->
|
||||
<link href="public/assets/css/main2.css" rel="stylesheet" media="all"/>
|
||||
<link href="public/assets/css/demo.css" rel="stylesheet" />
|
||||
|
||||
</head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<div class="sidebar" data-image="/assets/img/sidebar-5.jpg">
|
||||
<!--
|
||||
Tip 1: You can change the color of the sidebar using: data-color="purple | blue | green | orange | red"
|
||||
|
||||
Tip 2: you can also add an image using data-image tag
|
||||
-->
|
||||
<div class="sidebar-wrapper">
|
||||
<div class="logo">
|
||||
<!-- <a href="http://www.creative-tim.com" class="simple-text"> -->
|
||||
<h2> Donation </h2>
|
||||
</a>
|
||||
</div>
|
||||
<ul class="nav">
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="<?= base_url() ?>/dashboard">
|
||||
<i class="nc-icon nc-chart-pie-35"></i>
|
||||
<p>Dashboard</p>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item dropdown ">
|
||||
<a class="nav-link dropdown-toggle" href="http://example.com" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fa fa-user fa-lg"></i>
|
||||
|
||||
<span>Donor Management</span>
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
|
||||
<a class="dropdown-item" href="<?= base_url() ?>/all_donor"> View Donors </a>
|
||||
<a class="dropdown-item" href="<?= base_url() ?>/donor_register"> Add New Donor </a>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="nav-item dropdown ">
|
||||
<a class="nav-link dropdown-toggle" href="http://example.com" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fa fa-book fa-lg"></i>
|
||||
|
||||
<span >Receipts</span>
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
|
||||
<a class="dropdown-item" href="<?= base_url() ?>/all_receipt"> All Receipts </a>
|
||||
<a class="dropdown-item" href="<?= base_url() ?>/receipts"> Generate Receipts </a>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="nav-item dropdown ">
|
||||
<a class="nav-link dropdown-toggle" href="http://example.com" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fa fa-newspaper-o fa-lg"></i>
|
||||
|
||||
<span >Transaction</span>
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
|
||||
<a class="dropdown-item" href="<?= base_url() ?>/all_transaction"> All Transaction </a>
|
||||
<a class="dropdown-item" href="<?= base_url() ?>/transaction"> Upload Transaction </a>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="nav-item dropdown ">
|
||||
<a class="nav-link dropdown-toggle" href="http://example.com" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fa fa-money fa-lg"></i>
|
||||
|
||||
<span>Donation Data</span>
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
|
||||
<a class="dropdown-item" href="<?= base_url() ?>/all_donation_data"> Donation Data List </a>
|
||||
<a class="dropdown-item" href="<?= base_url() ?>/donation_data"> Add Donation Data </a>
|
||||
</div>
|
||||
</li>
|
||||
<li class="nav-item dropdown ">
|
||||
<a class="nav-link dropdown-toggle" href="http://example.com" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fa fa-pencil-square-o fa-lg"></i>
|
||||
|
||||
<span>DonationCause</span>
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
|
||||
<a class="dropdown-item" href="<?= base_url() ?>/donation_cause"> Add Donation Cause </a>
|
||||
<a class="dropdown-item" href="<?= base_url() ?>/all_donation_cause"> View Donation Cause </a>
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#" class="nav-link">
|
||||
<i class="fa fa-user fa-lg"></i>
|
||||
<span class="d-lg-block"> Profile</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="<?= base_url() ?>/logout" class="nav-link">
|
||||
|
||||
<span class="d-lg-block"> Logout</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main-panel">
|
||||
|
||||
<nav class="navbar navbar-expand-lg " color-on-scroll="500">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="#pablo"> </a>
|
||||
<button href="" class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" aria-controls="navigation-index" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-bar burger-lines"></span>
|
||||
<span class="navbar-toggler-bar burger-lines"></span>
|
||||
<span class="navbar-toggler-bar burger-lines"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse justify-content-end" id="navigation">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="content">
|
||||
<div class="container">
|
||||
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<div class="wrapper wrapper--w790">
|
||||
<div class="card card-5">
|
||||
<h2>Donation Cause </h2>
|
||||
<div class="card-body">
|
||||
<form method="POST" action="<?= base_url()."/add_donation_cause"; ?>">
|
||||
<div class="form-row">
|
||||
<div class="name">Cause Name</div>
|
||||
<div class="value">
|
||||
<div class="input-group">
|
||||
<input class="input--style-5" type="text" placeholder="CAUSE NAME" name="cause_name" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row m-b-55">
|
||||
<div class="name"><h4 class="title">Donation Cause</h4></div>
|
||||
<div class="value">
|
||||
<div class="row row-space">
|
||||
<div class="col-6">
|
||||
<div class="input-group-desc">
|
||||
|
||||
<input class="input--style-5" type="text" placeholder="FROM*" name="from_date" id="txtDate" required>
|
||||
<label class="label--desc">From</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="input-group-desc">
|
||||
<input class="input--style-5" type="text"placeholder="TO*" name="to_date" id="txtDate2" required>
|
||||
<label class="label--desc">To</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button class="btn btn--radius-2 btn--red" type="submit">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- Jquery JS-->
|
||||
<script src="public/assets/vendor copy/jquery/jquery.min.js"></script>
|
||||
<!-- Vendor JS-->
|
||||
<script src="public/assets/vendor copy/select2/select2.min.js"></script>
|
||||
<script src="public/assets/vendor copy/datepicker/moment.min.js"></script>
|
||||
<script src="public/assets/vendor copy/datepicker/daterangepicker.js"></script>
|
||||
|
||||
<!-- Main JS-->
|
||||
<script src="public/assets/js/global.js"></script>
|
||||
|
||||
</body>
|
||||
<!-- Core JS Files -->
|
||||
<script src="public/assets/js/core/jquery.3.2.1.min.js" type="text/javascript"></script>
|
||||
<script src="public/assets/js/core/popper.min.js" type="text/javascript"></script>
|
||||
<script src="public/assets/js/core/bootstrap.min.js" type="text/javascript"></script>
|
||||
<!-- Plugin for Switches, full documentation here: http://www.jque.re/plugins/version3/bootstrap.switch/ -->
|
||||
<script src="public/assets/js/plugins/bootstrap-switch.js"></script>
|
||||
<!-- Google Maps Plugin -->
|
||||
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=YOUR_KEY_HERE"></script>
|
||||
<!-- Chartist Plugin -->
|
||||
<script src="public/assets/js/plugins/chartist.min.js"></script>
|
||||
<!-- Notifications Plugin -->
|
||||
<script src="public/assets/js/plugins/bootstrap-notify.js"></script>
|
||||
<!-- Control Center for Light Bootstrap Dashboard: scripts for the example pages etc -->
|
||||
<script src="public/assets/js/light-bootstrap-dashboard.js?v=2.0.0 " type="text/javascript"></script>
|
||||
<!-- Light Bootstrap Dashboard DEMO methods, don't include it in your project! -->
|
||||
<script src="public/assets/js/demo.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
// Javascript method's body can be found in assets/js/demos.js
|
||||
demo.initDashboardPageCharts();
|
||||
|
||||
demo.showNotification();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</html>
|
||||
74
app/Views/address_pdf_template.php
Normal file
74
app/Views/address_pdf_template.php
Normal file
@ -0,0 +1,74 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Shipping Label Template</title>
|
||||
<style>
|
||||
body{
|
||||
font-family:Helvetica!important;
|
||||
line-height:24px;
|
||||
color:#000!important;
|
||||
}
|
||||
.invoice {
|
||||
width: 4in;
|
||||
/* height: 6in; */
|
||||
margin: 20px auto;
|
||||
border: 1px solid #000;
|
||||
padding:15px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.header {
|
||||
text-align: center;
|
||||
background:#fff!important;
|
||||
}
|
||||
|
||||
.business-logo {
|
||||
max-width:175px;
|
||||
height: auto;
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.bill-details {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.customer-details {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.row {
|
||||
clear: both;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
|
||||
foreach ($invoiceData as $value) :
|
||||
?>
|
||||
<div class="invoice">
|
||||
|
||||
|
||||
<div class="bill-details">
|
||||
<?= $value->customer_name ?>
|
||||
<?= $value->customer_bill_address ?>
|
||||
<?= $value->customer_bill_city ?> <?= $value->customer_bill_state ?>
|
||||
<?= $value->customer_bill_postal_code ?>
|
||||
<?= $value->customer_bill_country ?>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<!-- <img src="https://vijayabharathambooks.com/wp-content/uploads/2021/09/vijaya-bharatham-logo-8pt.png" alt="Business Logo" class="business-logo"><br> -->
|
||||
<div style="float:left; width:80px;margin-right:10px;"><img src="<?= base_url('public/uploads/vijayabharathampdf.png') ?>" alt="Business Logo" class="business-logo"/></div>
|
||||
<div style="text-align:left;font-size:12px;">From<br/>
|
||||
<?= $value->address ?>,<br><?= $value->city ?>, <?= $value->state ?>,
|
||||
<?= $value->postal_code ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -1,223 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="public/assets/img/apple-icon.png">
|
||||
<link rel="icon" type="image/png" href="public/assets/img/favicon.ico">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<title>Donor App</title>
|
||||
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no' name='viewport' />
|
||||
<!-- Fonts and icons -->
|
||||
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700,200" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css" />
|
||||
<!-- CSS Files -->
|
||||
<link href="public/assets/css/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="public/assets/css/light-bootstrap-dashboard.css?v=2.0.0 " rel="stylesheet" />
|
||||
<!-- CSS Just for demo purpose, don't include it in your project -->
|
||||
<link href="public/assets/css/demo.css" rel="stylesheet" />
|
||||
</head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<div class="sidebar" data-image="public/assets/img/sidebar-5.jpg">
|
||||
<!--
|
||||
Tip 1: You can change the color of the sidebar using: data-color="purple | blue | green | orange | red"
|
||||
|
||||
Tip 2: you can also add an image using data-image tag
|
||||
-->
|
||||
<div class="sidebar-wrapper">
|
||||
<div class="logo">
|
||||
<!-- <a href="http://www.creative-tim.com" class="simple-text"> -->
|
||||
<h2> Donation </h2>
|
||||
</a>
|
||||
</div>
|
||||
<ul class="nav">
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="<?= base_url() ?>/dashboard">
|
||||
<i class="nc-icon nc-chart-pie-35"></i>
|
||||
<p>Dashboard</p>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item dropdown ">
|
||||
<a class="nav-link dropdown-toggle" href="http://example.com" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fa fa-user fa-lg"></i>
|
||||
|
||||
<span>Donor Management</span>
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
|
||||
<a class="dropdown-item" href="<?= base_url() ?>/all_donor"> View Donors </a>
|
||||
<a class="dropdown-item" href="<?= base_url() ?>/donor_register"> Add New Donor </a>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="nav-item dropdown ">
|
||||
<a class="nav-link dropdown-toggle" href="http://example.com" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fa fa-book fa-lg"></i>
|
||||
|
||||
<span >Receipts</span>
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
|
||||
<a class="dropdown-item" href="<?= base_url() ?>/all_receipt"> All Receipts </a>
|
||||
<a class="dropdown-item" href="<?= base_url() ?>/receipts"> Generate Receipts </a>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="nav-item dropdown ">
|
||||
<a class="nav-link dropdown-toggle" href="http://example.com" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fa fa-newspaper-o fa-lg"></i>
|
||||
|
||||
<span >Transaction</span>
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
|
||||
<a class="dropdown-item" href="<?= base_url() ?>/all_transaction"> All Transaction </a>
|
||||
<a class="dropdown-item" href="<?= base_url() ?>/transaction"> Upload Transaction </a>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="nav-item dropdown ">
|
||||
<a class="nav-link dropdown-toggle" href="http://example.com" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fa fa-money fa-lg"></i>
|
||||
|
||||
<span>Donation Data</span>
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
|
||||
<a class="dropdown-item" href="<?= base_url() ?>/all_donation_data"> Donation Data List </a>
|
||||
<a class="dropdown-item" href="<?= base_url() ?>/donation_data"> Add Donation Data </a>
|
||||
</div>
|
||||
</li>
|
||||
<li class="nav-item dropdown ">
|
||||
<a class="nav-link dropdown-toggle" href="http://example.com" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fa fa-pencil-square-o fa-lg"></i>
|
||||
|
||||
<span>DonationCause</span>
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
|
||||
<a class="dropdown-item" href="<?= base_url() ?>/donation_cause"> Add Donation Cause </a>
|
||||
<a class="dropdown-item" href="<?= base_url() ?>/all_donation_cause"> View Donation Cause </a>
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#" class="nav-link">
|
||||
<i class="fa fa-user fa-lg"></i>
|
||||
<span class="d-lg-block"> Profile</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="<?= base_url() ?>/logout" class="nav-link">
|
||||
|
||||
<span class="d-lg-block"> Logout</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main-panel">
|
||||
|
||||
<nav class="navbar navbar-expand-lg " color-on-scroll="500">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="#pablo"> </a>
|
||||
<button href="" class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" aria-controls="navigation-index" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-bar burger-lines"></span>
|
||||
<span class="navbar-toggler-bar burger-lines"></span>
|
||||
<span class="navbar-toggler-bar burger-lines"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse justify-content-end" id="navigation">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="content">
|
||||
<!-- <div class="container">
|
||||
<h2 style="text-align: center;">All Transactions</h2>
|
||||
-->
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="header">
|
||||
<h4 class="title">All Donation Cause</h4>
|
||||
|
||||
</div>
|
||||
<div class="content table-responsive table-full-width">
|
||||
|
||||
<table class="table table-bordered table-sm ">
|
||||
<tr>
|
||||
|
||||
<th> Cause Name</th>
|
||||
<th> From Date</th>
|
||||
<th> To Date</th>
|
||||
<th> status</th>
|
||||
<th> Edit Status</th>
|
||||
<th> Edit Data</th>
|
||||
|
||||
|
||||
</tr>
|
||||
<?php foreach ($donationcause as $row)
|
||||
{ ?>
|
||||
<tr>
|
||||
<td><?php echo $row['cause_name'];?></td>
|
||||
<td><?php echo $row['from_date'];?></td>
|
||||
<td><?php echo $row['to_date'];?></td>
|
||||
<td><?php echo $row['status'];?></td>
|
||||
<td>
|
||||
<?php if($row['status'] == 'Active'){?>
|
||||
<a href="<?= base_url() ?>/Dashboard/inactive_cause/<?php echo $row['id'];?>">Deactive</a>
|
||||
<?php } else { ?>
|
||||
<a href="<?= base_url() ?>/Dashboard/active_cause/<?php echo $row['id'];?>">Activate</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td><?php ?><a href="<?= base_url() ?>/edit_donation_cause/<?php echo $row['id'];?>">Edit</a></td>
|
||||
<td style="display:none;"></td>
|
||||
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
<!-- Core JS Files -->
|
||||
<script src="public/assets/js/core/jquery.3.2.1.min.js" type="text/javascript"></script>
|
||||
<script src="public/assets/js/core/popper.min.js" type="text/javascript"></script>
|
||||
<script src="public/assets/js/core/bootstrap.min.js" type="text/javascript"></script>
|
||||
<!-- Plugin for Switches, full documentation here: http://www.jque.re/plugins/version3/bootstrap.switch/ -->
|
||||
<script src="public/assets/js/plugins/bootstrap-switch.js"></script>
|
||||
<!-- Google Maps Plugin -->
|
||||
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=YOUR_KEY_HERE"></script>
|
||||
<!-- Chartist Plugin -->
|
||||
<script src="public/assets/js/plugins/chartist.min.js"></script>
|
||||
<!-- Notifications Plugin -->
|
||||
<script src="public/assets/js/plugins/bootstrap-notify.js"></script>
|
||||
<!-- Control Center for Light Bootstrap Dashboard: scripts for the example pages etc -->
|
||||
<script src="public/assets/js/light-bootstrap-dashboard.js?v=2.0.0 " type="text/javascript"></script>
|
||||
<!-- Light Bootstrap Dashboard DEMO methods, don't include it in your project! -->
|
||||
<script src="public/assets/js/demo.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
// Javascript method's body can be found in assets/js/demos.js
|
||||
demo.initDashboardPageCharts();
|
||||
|
||||
demo.showNotification();
|
||||
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
202
app/Views/approve_template.php
Normal file
202
app/Views/approve_template.php
Normal file
@ -0,0 +1,202 @@
|
||||
<!DOCTYPE html>
|
||||
<html style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', Helvetica Neue, Roboto;font-size: 15px;width: 600px;margin: 0 auto;text-align: center;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;text-rendering: optimizeLegibility;">
|
||||
<body style="background-color: rgb(189 194 199);">
|
||||
<!-- HEADER: MENULOGO + MENUCONTENT SECTION -->
|
||||
<header style="padding: .4rem 0rem 0rem;">
|
||||
<div style="padding: 0rem 2rem;">
|
||||
<div style="padding : 15px 35px;
|
||||
background-color : rgb(255,255,255);
|
||||
border-radius : 5px 5px 0px 0px;
|
||||
border-width : 2px 0px;
|
||||
border-style : solid hidden;
|
||||
border-top-color : rgb(104,104,104); border-right-color : initial;
|
||||
border-bottom-color : rgb(104,104,104); border-left-color : initial;" align="center">
|
||||
<img src="https://vijayabharathambooks.com/wp-content/uploads/2021/09/vijaya-bharatham-logo-8pt.png"><br>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="padding: 0rem 2rem;text-align: center;">
|
||||
<div style="padding : 15px 35px; background-color : rgb(249,249,249); ">
|
||||
<div align="center">
|
||||
<h2><span>Thanks for your Order</span></h2>
|
||||
<div>
|
||||
<p style="padding : 35px 0px 0px; ">
|
||||
<span style="font-size : 24px; ">Order #<?= $invoice_serial_number ? $invoice_order_number.'('.$invoice_serial_number.')' : $invoice_order_number ; ?>.</span><br>
|
||||
</p>
|
||||
<p style="padding : 10px 0px 0px; ">
|
||||
<span style="font-size : 20px; ">Hi <?= $recipient_name; ?>, Thank you for your purchase.</span><br>
|
||||
</p>
|
||||
<p style="padding : 10px 0px 0px; ">
|
||||
<span style="font-size : 20px; ">We are processing your order.</span><br>
|
||||
</p>
|
||||
<div style="width : 204px;">
|
||||
<a href="https://vijayabharathambooks.com" style="display : block; text-decoration : none; background-color : rgb(244,105,46);
|
||||
line-height : 44px; min-height : 44px; color : rgb(238,238,238); " target="_blank">
|
||||
<span style="color : rgb(238, 238, 238); ">VIEW YOUR ORDER</span><br>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<!-- CONTENT -->
|
||||
<section style="padding: 0rem 2rem;">
|
||||
<div style="padding : 20px 35px; background-color : rgb(255,255,255); ">
|
||||
<?php if (!empty($item)) {
|
||||
foreach ($item as $ii) { ?>
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td align="left" valign="top" width="30%">
|
||||
<a style="color: rgba(221, 72, 20, 1);" href="https://vijayabharathambooks.com/books/pasumpon-thevar-potriya-rss/" target="_blank"><img src="https://vijayabharathambooks.com/wp-content/uploads/2023/01/front-1-300x450.jpg" alt="Image" style="max-width: 100%; height: auto; display: block;"></a><br>
|
||||
</td>
|
||||
<td valign="middle" width="70%" style="padding:16px;">
|
||||
<div><a style="color: rgba(221, 72, 20, 1);" href="https://vijayabharathambooks.com/books/pasumpon-thevar-potriya-rss/" target="_blank">
|
||||
<span style="font-size : 15px; margin : 0px; padding : 0px; font-weight : 400; line-height : 18.2px; "><?= $ii->title; ?></span>
|
||||
</a><br>
|
||||
</div>
|
||||
<div>
|
||||
<p style="text-align:left;">
|
||||
<span style="color : rgb(60, 67, 74); "><span style=" font-weight : 400; line-height : 18.2px; ">x <?= $ii->quantity; ?></span></span>
|
||||
<span style="color : rgb(60, 67, 74); float:right; "><span style="text-align : right; white-space : nowrap; font-weight : 400; line-height : 18.2px; ">₹ <?= $ii->subtotal; ?></span></span>
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php }}else{?>
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td align="left" valign="top" width="30%">
|
||||
<a style="color: rgba(221, 72, 20, 1);" href="https://vijayabharathambooks.com/books/pasumpon-thevar-potriya-rss/" target="_blank"><img src="https://vijayabharathambooks.com/wp-content/uploads/2023/01/front-1-300x450.jpg" alt="Image" style="max-width: 100%; height: auto; display: block;"></a><br>
|
||||
</td>
|
||||
<td valign="middle" width="70%" style="padding:16px;">
|
||||
<div><a style="color: rgba(221, 72, 20, 1);" href="https://vijayabharathambooks.com/books/pasumpon-thevar-potriya-rss/" target="_blank">
|
||||
<span style="font-size : 15px; margin : 0px; padding : 0px; font-weight : 400; line-height : 18.2px; ">பசும்பொன் தேவர் போற்றிய ஆர்.எஸ்.எஸ்<small> (#VB-65)</small>
|
||||
</span>
|
||||
</a><br>
|
||||
</div>
|
||||
<div>
|
||||
<p style="text-align:left;">
|
||||
<span style="color : rgb(60, 67, 74); "><span style=" font-weight : 400; line-height : 18.2px; ">x 1</span></span>
|
||||
<span style="color : rgb(60, 67, 74); float:right; "><span style="text-align : right; white-space : nowrap; font-weight : 400; line-height : 18.2px; ">₹ 125</span></span>
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div style="padding : 15px 35px; background-color : rgb(249,249,249); " align="center">
|
||||
<div style="display: flex;justify-content: space-between;text-align: left;width: 100%;">
|
||||
<div style="text-align: left; width: 48%;">
|
||||
<div style=" width : 265px; line-height : 30px; ">
|
||||
<p><span style="font-size : 20px; ">Payment Method</span><br>
|
||||
</p>
|
||||
</div>
|
||||
<div style=" width : 265px; line-height : 22px; ">
|
||||
<p>Paytm Payment Gateway<br> </p>
|
||||
</div>
|
||||
<div style=" width : 265px; line-height : 22px; ">
|
||||
<p><span style="font-size : 20px; ">Shipment Method</span><br>
|
||||
</p>
|
||||
</div>
|
||||
<div style=" width : 265px; line-height : 22px; ">
|
||||
<p>Flexible Shipping<br> </p>
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align: left; width: 26%;">
|
||||
<div style=" color : rgb(68,68,68); line-height : 24px; ">
|
||||
<div style="padding : 0px; border : 0px hidden; text-align : left; ">
|
||||
<p>Subtotal<br></p>
|
||||
</div>
|
||||
<div style="padding : 0px; border : 0px hidden; text-align : left; ">
|
||||
<p>Shipping<br></p>
|
||||
</div>
|
||||
</div>
|
||||
<div style="font-size : 20px; font-weight : 400; color : rgb(68,68,68); line-height : 30px;">
|
||||
<div style="padding : 0px; border : 0px hidden; text-align : left; ">
|
||||
<p style="font-weight : 400;">Total<br></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align: left; width: 26%;">
|
||||
<div style=" color : rgb(68,68,68); line-height : 24px; ">
|
||||
<div style="padding : 0px; border : 0px hidden; text-align : right; ">
|
||||
<p><span style="font-weight : 300;"><span>₹</span> <?= $subtotal; ?></span><br></p>
|
||||
</div>
|
||||
<div style="padding : 0px; border : 0px hidden; text-align : right; ">
|
||||
<p><span style=" font-weight : 300;"><span>₹</span> <?= $tax; ?></span><br></p>
|
||||
</div>
|
||||
</div>
|
||||
<div style="font-size : 20px; font-weight : 400; color : rgb(68,68,68); line-height : 30px;">
|
||||
<div style="padding : 0px; border : 0px hidden; text-align : right;">
|
||||
<p><span style="font-weight : 400;"><span>₹</span> <?= $total_amount; ?></span><br></p>
|
||||
<!-- float:right; -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="line-height:24px;text-align: left;font-size: 24px;color: #333;padding-top: 15px;">Note</div>
|
||||
<div style="display: flex;justify-content: space-between;text-align: left;width: 100%;">
|
||||
<p> A publisher manages the design, editing, and production process with the help of proofreaders, printers, and editors. Publishers make schedules for every stage of the process and work backward from the planned date for publication. They distribute promotional catalogs to libraries and booksellers. </p><br>
|
||||
</div>
|
||||
</div>
|
||||
<div style="background-color: rgb(255, 255, 255);width: 100%;display:flex;text-align: left;">
|
||||
<div style="width: 50%;padding-left: 2.5em;" >
|
||||
<h1 style="font-size: 24px; color: #333;">Billing Address</h1>
|
||||
<div style="font-weight : 300; color : rgb(68,68,68); line-height : 22px; ">
|
||||
<p>
|
||||
<span><?= $recipient_name; ?><br></span>
|
||||
<span><?= $recipient_name; ?><br> </span>
|
||||
<span><?= $recipient_name; ?><br> </span>
|
||||
<span><?= $recipient_name; ?><br></span>
|
||||
<span><?= $recipient_name; ?><br></span>
|
||||
<span><a style="color : rgb(68,68,68); font-weight : 300; " target="_blank">+91<?= $recipient_name; ?></a><br></span>
|
||||
<span><a style="color : rgb(68,68,68); font-weight : 300; " target="_blank"><?= $recipient_name; ?></a><br></span>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 50%;" >
|
||||
<!-- Content for the right side -->
|
||||
<h1 style="font-size: 24px; color: #333;">Shipping Address</h1>
|
||||
<div style="text-align: left; font-weight : 300; color : rgb(68,68,68); line-height : 22px;">
|
||||
<p>
|
||||
<span><?= $recipient_name; ?><br></span>
|
||||
<span>22/2, SriKrishna Apartments<br> </span>
|
||||
<span>1st Street, Subramania Nagar, Kodambakkam<br> </span>
|
||||
<span>CHENNAI 600024<br></span>
|
||||
<span>Tamil Nadu<br></span>
|
||||
<span><a style="color : rgb(68,68,68); font-weight : 300; " target="_blank"><?= $recipient_mobile;?></a><br></span>
|
||||
<span><a style="color : rgb(68,68,68); font-weight : 300; " target="_blank"><?= $recipient_mobile;?></a><br></span>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- FOOTER: DEBUG INFO + COPYRIGHTS -->
|
||||
<footer style="padding: 0rem 2rem;text-align: center;">
|
||||
<div style="background-color: rgba(62, 62, 62, 1);color: rgba(200, 200, 200, 1);padding: 25px 35px;">
|
||||
<p style="display: block;margin-block-start: 1em;margin-block-end: 1em;margin-inline-start: 0px;margin-inline-end: 0px; text-align : center; line-height : 22px; padding: 20px 0px;color : rgb(245, 245, 245);">
|
||||
<span style="font-size : 20px; line-height : 22px; ">Get in Touch<br></span>
|
||||
</p>
|
||||
<p style="display: block;margin-block-start: 1em;margin-block-end: 1em;margin-inline-start: 0px;margin-inline-end: 0px; text-align : center; line-height : 22px; padding: 20px 0px;">
|
||||
<span style="color : rgb(245, 245, 245); ">
|
||||
<span style="font-size : 12px; ">For any questions, please send an email to </span>
|
||||
</span>
|
||||
<span style="color : rgb(255, 255, 255); ">
|
||||
<a style="font-size : 12px; color : rgb(255,255,255); " href="mailto:contact@vijayabharathambooks.com" target="_blank">contact@vijayabharathambooks.com</a>
|
||||
</span><br>
|
||||
</p>
|
||||
<div style=" line-height : 22px; background-image : none; background-color : transparent; border-radius : 0px; border-width : 0px; border-style : hidden; ">
|
||||
<p class="space" style="text-align : center; "><span style="font-size : 12px; "><a style="color : rgb(245,245,245); " href="https://vijayabharathambooks.com/privacy-policy/" target="_blank">Privacy Policy</a><span style="color : rgb(245, 245, 245); "> | </span><a style="color : rgb(245,245,245); " href="https://vijayabharathambooks.com/terms-conditions/" target="_blank">Terms & Conditions</a></span><br>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
<br>
|
||||
</body>
|
||||
</html>
|
||||
56
app/Views/audit_history.php
Normal file
56
app/Views/audit_history.php
Normal file
@ -0,0 +1,56 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="float-right">
|
||||
</div><!-- end col-->
|
||||
<br>
|
||||
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="datatable-buttons" class="table w-100 nowrap">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th hidden></th>
|
||||
<th>Action</th>
|
||||
<th>Module</th>
|
||||
<th>Key</th>
|
||||
<th>New Value</th>
|
||||
<th>Old Value</th>
|
||||
<th>Updated By</th>
|
||||
<th>Updated On</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($data as $audit_data): ?>
|
||||
<?php foreach ($audit_data as $value): ?>
|
||||
<tr>
|
||||
<td hidden><?= $value->id ?></td>
|
||||
<td><?= $value->mode ?></td>
|
||||
<td><?= $value->module ?></td>
|
||||
<td><?= $value->key ?></td>
|
||||
<td><?= $value->old_value ?></td>
|
||||
<td><?= $value->new_value ?></td>
|
||||
<td><?= $value->updated_by ?></td>
|
||||
<td><?= date('d-m-Y H:m:s', strtotime($value->updated_on)) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
|
||||
<!-- end row-->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#datatable-buttons').DataTable({
|
||||
"order": [[0, "desc"]] // 4 is the column index of "created_on" in your table
|
||||
// Other DataTables configuration options
|
||||
});
|
||||
});
|
||||
</script>
|
||||
135
app/Views/auth_confirm_mail.php
Normal file
135
app/Views/auth_confirm_mail.php
Normal file
@ -0,0 +1,135 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Confirm Email Alert</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" />
|
||||
<meta content="Coderthemes" name="author" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<!-- App favicon -->
|
||||
<link rel="shortcut icon" href="<?= base_url() . "public/uploads/default.ico" ?>">
|
||||
|
||||
<!-- App css -->
|
||||
<link href="<?= base_url() . "public/assets/css/bootstrap.min.css" ?>" rel="stylesheet" type="text/css" id="bs-default-stylesheet" />
|
||||
<link href="<?= base_url() . "public/assets/css/app.min.css" ?>" rel="stylesheet" type="text/css" id="app-default-stylesheet" />
|
||||
|
||||
<link href="<?= base_url() . "public/assets/css/bootstrap-dark.min.css" ?>" rel="stylesheet" type="text/css" id="bs-dark-stylesheet" />
|
||||
<link href="<?= base_url() . "public/assets/css/app-dark.min.css" ?>" rel="stylesheet" type="text/css" id="app-dark-stylesheet" />
|
||||
|
||||
<!-- icons -->
|
||||
<link href="<?= base_url() . "public/assets/css/icons.min.css" ?>" rel="stylesheet" type="text/css" />
|
||||
|
||||
</head>
|
||||
|
||||
<body class="loading">
|
||||
|
||||
<div class="account-pages mt-5 mb-5">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 col-xl-5">
|
||||
<div class="card">
|
||||
|
||||
<div class="card-body p-4">
|
||||
|
||||
<div class="text-center w-75 m-auto">
|
||||
<div class="auth-logo">
|
||||
<a href="javascript:void(0);" class="logo logo-dark text-center">
|
||||
<span class="logo-lg">
|
||||
<img src="<?= base_url() . "public/uploads/default.png" ?>" alt="" height="55">
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<a href="javascript:void(0);" class="logo logo-light text-center">
|
||||
<span class="logo-lg" style="background: white;">
|
||||
<img src="<?= base_url() . "public/uploads/default.png" ?>" alt="" height="55">
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-3 text-center">
|
||||
<svg version="1.1" xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 98 98" style="height: 120px;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0 {
|
||||
fill: #FFFFFF;
|
||||
}
|
||||
|
||||
.st1 {
|
||||
fill: #1abc9c;
|
||||
}
|
||||
|
||||
.st2 {
|
||||
fill: #FFFFFF;
|
||||
stroke: #1abc9c;
|
||||
stroke-width: 2;
|
||||
stroke-miterlimit: 10;
|
||||
}
|
||||
|
||||
.st3 {
|
||||
fill: none;
|
||||
stroke: #FFFFFF;
|
||||
stroke-width: 2;
|
||||
stroke-linecap: round;
|
||||
stroke-miterlimit: 10;
|
||||
}
|
||||
</style>
|
||||
<g i:extraneous="self">
|
||||
<circle id="XMLID_50_" class="st0" cx="49" cy="49" r="49" />
|
||||
<g id="XMLID_4_">
|
||||
<path id="XMLID_49_" class="st1" d="M77.3,42.7V77c0,0.6-0.4,1-1,1H21.7c-0.5,0-1-0.5-1-1V42.7c0-0.3,0.1-0.6,0.4-0.8l27.3-21.7
|
||||
c0.3-0.3,0.8-0.3,1.2,0l27.3,21.7C77.1,42.1,77.3,42.4,77.3,42.7z" />
|
||||
<path id="XMLID_48_" class="st2" d="M66.5,69.5h-35c-1.1,0-2-0.9-2-2V26.8c0-1.1,0.9-2,2-2h35c1.1,0,2,0.9,2,2v40.7
|
||||
C68.5,68.6,67.6,69.5,66.5,69.5z" />
|
||||
<path id="XMLID_47_" class="st1" d="M62.9,33.4H47.2c-0.5,0-0.9-0.4-0.9-0.9v-0.2c0-0.5,0.4-0.9,0.9-0.9h15.7
|
||||
c0.5,0,0.9,0.4,0.9,0.9v0.2C63.8,33,63.4,33.4,62.9,33.4z" />
|
||||
<path id="XMLID_46_" class="st1" d="M62.9,40.3H47.2c-0.5,0-0.9-0.4-0.9-0.9v-0.2c0-0.5,0.4-0.9,0.9-0.9h15.7
|
||||
c0.5,0,0.9,0.4,0.9,0.9v0.2C63.8,39.9,63.4,40.3,62.9,40.3z" />
|
||||
<path id="XMLID_45_" class="st1" d="M62.9,47.2H47.2c-0.5,0-0.9-0.4-0.9-0.9v-0.2c0-0.5,0.4-0.9,0.9-0.9h15.7
|
||||
c0.5,0,0.9,0.4,0.9,0.9v0.2C63.8,46.8,63.4,47.2,62.9,47.2z" />
|
||||
<path id="XMLID_44_" class="st1" d="M62.9,54.1H47.2c-0.5,0-0.9-0.4-0.9-0.9v-0.2c0-0.5,0.4-0.9,0.9-0.9h15.7
|
||||
c0.5,0,0.9,0.4,0.9,0.9v0.2C63.8,53.7,63.4,54.1,62.9,54.1z" />
|
||||
<path id="XMLID_43_" class="st2" d="M41.6,40.1h-5.8c-0.6,0-1-0.4-1-1v-6.7c0-0.6,0.4-1,1-1h5.8c0.6,0,1,0.4,1,1v6.7
|
||||
C42.6,39.7,42.2,40.1,41.6,40.1z" />
|
||||
<path id="XMLID_42_" class="st2" d="M41.6,54.2h-5.8c-0.6,0-1-0.4-1-1v-6.7c0-0.6,0.4-1,1-1h5.8c0.6,0,1,0.4,1,1v6.7
|
||||
C42.6,53.8,42.2,54.2,41.6,54.2z" />
|
||||
<path id="XMLID_41_" class="st1" d="M23.4,46.2l25,17.8c0.3,0.2,0.7,0.2,1.1,0l26.8-19.8l-3.3,30.9H27.7L23.4,46.2z" />
|
||||
<path id="XMLID_40_" class="st3" d="M74.9,45.2L49.5,63.5c-0.3,0.2-0.7,0.2-1.1,0L23.2,45.2" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
<h3>Success !</h3>
|
||||
<p class="text-muted mt-2"> A email has been send to <span class="font-weight-medium"><?= $mail_id; ?></span>.
|
||||
Please check for an email from company and click on the included link to
|
||||
reset your password. </p>
|
||||
|
||||
<a href="<?= base_url(); ?>" class="btn btn-block btn-primary waves-effect waves-light mt-3">Back to Home</a>
|
||||
<!-- <a href="<?= $link; ?>" class="btn btn-block btn-primary waves-effect waves-light mt-3" target="_blank">Alternative So Click here</a> -->
|
||||
</div>
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
|
||||
<footer class="footer footer-alt">
|
||||
<p> <?= date('Y') ?> © <?= "BigBamboo Contribution"; ?>.</p>
|
||||
</footer>
|
||||
|
||||
<!-- Vendor js -->
|
||||
<script src="<?= base_url() . "public/assets/js/vendor.min.js" ?>"></script>
|
||||
|
||||
<!-- App js -->
|
||||
<script src="<?= base_url() . "public/assets/js/app.min.js" ?>"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
106
app/Views/auth_lock_screen.php
Normal file
106
app/Views/auth_lock_screen.php
Normal file
@ -0,0 +1,106 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Lock Screen </title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" />
|
||||
<meta content="Coderthemes" name="author" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<!-- App favicon -->
|
||||
<link rel="shortcut icon" href="<?= $favicon; ?>">
|
||||
<!-- App css -->
|
||||
<link href="<?= base_url() . "public/assets/css/bootstrap.min.css" ?>" rel="stylesheet" type="text/css" id="bs-default-stylesheet" />
|
||||
<link href="<?= base_url() . "public/assets/css/app.min.css" ?>" rel="stylesheet" type="text/css" id="app-default-stylesheet" />
|
||||
|
||||
<link href="<?= base_url() . "public/assets/css/bootstrap-dark.min.css" ?>" rel="stylesheet" type="text/css" id="bs-dark-stylesheet" />
|
||||
<link href="<?= base_url() . "public/assets/css/app-dark.min.css" ?>" rel="stylesheet" type="text/css" id="app-dark-stylesheet" />
|
||||
|
||||
<!-- icons -->
|
||||
<link href="<?= base_url() . "public/assets/css/icons.min.css" ?>" rel="stylesheet" type="text/css" />
|
||||
|
||||
</head>
|
||||
|
||||
<body class="loading">
|
||||
|
||||
<div class="account-pages mt-5 mb-5">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 col-xl-5">
|
||||
<div class="card">
|
||||
|
||||
<div class="card-body p-4">
|
||||
|
||||
<div class="text-center mb-4">
|
||||
<div class="auth-logo">
|
||||
<a href="javascript:void(0);" class="logo logo-dark text-center">
|
||||
<span class="logo-lg">
|
||||
<img src="<?= base_url() . "public/uploads/default.png" ?>" alt="" height="55">
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<a href="javascript:void(0);" class="logo logo-light text-center">
|
||||
<span class="logo-lg" style="background: white;">
|
||||
<img src="<?= base_url() . "public/uploads/default.png" ?>" alt="" height="55">
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center w-75 m-auto">
|
||||
<img src="<?= $profile_picture; ?>" alt="user-image" class="rounded-circle avatar-lg img-thumbnail">
|
||||
<h4 class="text-dark-50 text-center mt-3"><?= 'Hi ! '.$loggedin_person; ?></h4>
|
||||
<p class="text-muted mb-4">Enter your password to access the <?= $loggedin_person_role; ?></p>
|
||||
</div>
|
||||
|
||||
<form action="<?= base_url() . "unlock" ?>" method="post">
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<label for="password">Password</label>
|
||||
<input class="form-control" type="password" required="" id="password" name="password" placeholder="Enter your password">
|
||||
</div>
|
||||
<?php if (isset($validationErrors)) : ?>
|
||||
<span class="widget-simple text-center">
|
||||
<div class="media-body align-self-center font-24 avatar-title">
|
||||
<p style="color: #f1556c!important;" class="mt-0" style><?= $validationErrors; ?></p>
|
||||
</div>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<div class="form-group mb-0 text-center">
|
||||
<button class="btn btn-primary btn-block" type="submit"> Log In </button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<div class="row mt-3">
|
||||
<div class="col-12 text-center">
|
||||
<p class="text-muted">Not you? return <a href="<?= base_url(); ?>" class="text-primary font-weight-medium ml-1">Sign In</a></p>
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
|
||||
<footer class="footer footer-alt">
|
||||
<p> <?= date('Y') ?> © <?= "BigBamboo Contribution"; ?>.</p>
|
||||
</footer>
|
||||
|
||||
|
||||
<!-- Vendor js -->
|
||||
<script src="<?= base_url() . "public/assets/js/vendor.min.js" ?>" ></script>
|
||||
|
||||
<!-- App js -->
|
||||
<script src="<?= base_url() . "public/assets/js/app.min.js" ?>" ></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
170
app/Views/auth_login.php
Normal file
170
app/Views/auth_login.php
Normal file
@ -0,0 +1,170 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>BigBamboo Contribution</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" />
|
||||
<meta content="Coderthemes" name="author" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<!-- App favicon -->
|
||||
<link rel="shortcut icon" href="<?= base_url() . "public/uploads/default.ico" ?>">
|
||||
|
||||
<!-- App css -->
|
||||
<link href="<?= base_url() . "public/assets/css/bootstrap.min.css" ?>" rel="stylesheet" type="text/css" id="bs-default-stylesheet" />
|
||||
<link href="<?= base_url() . "public/assets/css/app.min.css" ?>" rel="stylesheet" type="text/css" id="app-default-stylesheet" />
|
||||
<link href="<?= base_url() . "public/assets/css/bootstrap-dark.min.css" ?>" rel="stylesheet" type="text/css" id="bs-dark-stylesheet" />
|
||||
<link href="<?= base_url() . "public/assets/css/app-dark.min.css" ?>" rel="stylesheet" type="text/css" id="app-dark-stylesheet" />
|
||||
|
||||
<!-- icons -->
|
||||
<link href="<?= base_url() . "public/assets/css/icons.min.css" ?>" rel="stylesheet" type="text/css" />
|
||||
|
||||
</head>
|
||||
<style>
|
||||
.debug-bar-ndisplay {display: none !important;}
|
||||
</style>
|
||||
<body class="loading">
|
||||
|
||||
<div class="account-pages mt-5 mb-5">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 col-xl-5">
|
||||
<div class="card">
|
||||
|
||||
<div class="card-body p-4">
|
||||
|
||||
<div class="text-center w-75 m-auto">
|
||||
<div class="auth-logo">
|
||||
<a href="javascript: void(0);" class="logo logo-dark text-center">
|
||||
<span class="logo-lg">
|
||||
<img src="<?= base_url() . "public/uploads/default.png" ?>" alt="" height="80">
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<a href="javascript: void(0);" class="logo logo-light text-center">
|
||||
<span class="logo-lg" style="background: white;">
|
||||
<img src="<?= base_url() . "public/uploads/default.png" ?>" alt="" height="80">
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
<p class="text-muted mb-4 mt-3"></p>
|
||||
</div>
|
||||
<!-- <form action=""> -->
|
||||
<form action="<?= base_url() . "authenticate" ?>" method="post">
|
||||
<div class="form-group mb-3">
|
||||
<label for="emailaddress">Email address</label>
|
||||
<input class="form-control" type="email" name="username" id="emailaddress" required placeholder="Enter your email" autocomplete="off">
|
||||
<div class="invalid-feedback"> Please enter the email id</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<!-- <a href="auth-recoverpw-2.html" class="text-muted float-right"><small>Forgot your password?</small></a> -->
|
||||
<!-- <a href="<?= base_url()."auth_confirm_mail"; ?>" class="text-muted float-right"><small>Forgot your password?</small></a> -->
|
||||
<a href="#" id="resetLink" class="text-muted float-right"><small>Forgot your password?</small></a>
|
||||
<label for="password">Password</label>
|
||||
<div class="input-group input-group-merge">
|
||||
<input class="form-control" type="password" name="password" id="password" required placeholder="Enter your password" autocomplete="off">
|
||||
<div class="input-group-append" data-password="false">
|
||||
<div class="input-group-text">
|
||||
<span class="password-eye"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="form-group mb-3">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="checkbox-signin" checked>
|
||||
<label class="custom-control-label" for="checkbox-signin">Remember me</label>
|
||||
</div>
|
||||
</div> -->
|
||||
<?php if (isset($validationErrors)) : ?>
|
||||
<span class="widget-simple text-center">
|
||||
<div class="media-body align-self-center font-24 avatar-title">
|
||||
<small class="mb-2" style="color: black; font-size:18px;"><?= $validationErrors; ?></small>
|
||||
</div>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<div class="form-group mb-0 text-center">
|
||||
<button class="btn btn-primary btn-block" type="submit"> Log In </button>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<div class="row mt-3">
|
||||
<div class="col-12 text-center">
|
||||
<!-- <p> <a href="auth-recoverpw.html" class="text-muted ml-1">Forgot your password?</a></p> -->
|
||||
<!-- <p class="text-muted">Don't have an account? <a href="auth-register.html" class="text-primary font-weight-medium ml-1">Sign Up</a></p> -->
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
|
||||
<footer class="footer footer-alt">
|
||||
<p> <?= date('Y') ?> © <?= "BigBamboo Contribution"; ?>.</p>
|
||||
</footer>
|
||||
|
||||
<!-- Vendor js -->
|
||||
<script src="<?= base_url() . "public/assets/js/vendor.min.js" ?>"></script>
|
||||
|
||||
<!-- App js -->
|
||||
<script src="<?= base_url() . "public/assets/js/app.min.js" ?>"></script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Fetch email value and set it as href for the reset link
|
||||
// $('#emailaddress').on('input', function() {
|
||||
// var emailValue = $(this).val();
|
||||
// var baseUrl = "<?php echo base_url(); ?>";
|
||||
// $('#resetLink').attr('href', emailValue ? baseUrl+'auth_confirm_mail?email='+emailValue : '#');
|
||||
// // $('#resetLink').attr('href', 'auth_confirm_mail?email='+emailValue);
|
||||
// });
|
||||
$('#resetLink').on('click', function(event) {
|
||||
var emailValue = $('#emailaddress').val();
|
||||
var baseUrl = "<?php echo base_url(); ?>";
|
||||
if (!emailValue) {
|
||||
event.preventDefault();
|
||||
console.log('Please enter your email before clicking on "Forgot your password?"');
|
||||
alert('Please enter your email before clicking on "Forgot your password?"');
|
||||
} else {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?= base_url() . 'auth_confirm_mail' ?>",
|
||||
data: { email: emailValue },
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
if (response['data']['status']) {
|
||||
alert(response['data']['message']);
|
||||
$('#emailaddress').val('');
|
||||
console.log("Email confirmation successful");
|
||||
} else {
|
||||
alert(response['data']['message']);
|
||||
console.log(response['data']['message']);
|
||||
}
|
||||
},
|
||||
error: function(error) {
|
||||
console.log('AJAX Error:', error.responseText);
|
||||
// Handle error here, if needed
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
105
app/Views/auth_logout.php
Normal file
105
app/Views/auth_logout.php
Normal file
@ -0,0 +1,105 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Logout </title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" />
|
||||
<meta content="Coderthemes" name="author" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<!-- App favicon -->
|
||||
<link rel="shortcut icon" href="<?= base_url() . "public/uploads/default.ico" ?>">
|
||||
|
||||
<!-- App css -->
|
||||
<link href="<?= base_url() . "public/assets/css/bootstrap.min.css"?>" rel="stylesheet" type="text/css" id="bs-default-stylesheet" />
|
||||
<link href="<?= base_url() . "public/assets/css/app.min.css"?>" rel="stylesheet" type="text/css" id="app-default-stylesheet" />
|
||||
|
||||
<link href="<?= base_url() . "public/assets/css/bootstrap-dark.min.css"?>" rel="stylesheet" type="text/css" id="bs-dark-stylesheet" />
|
||||
<link href="<?= base_url() . "public/assets/css/app-dark.min.css"?>" rel="stylesheet" type="text/css" id="app-dark-stylesheet" />
|
||||
|
||||
<!-- icons -->
|
||||
<link href="<?= base_url() . "public/assets/css/icons.min.css"?>" rel="stylesheet" type="text/css" />
|
||||
|
||||
</head>
|
||||
|
||||
<body class="loading">
|
||||
|
||||
<div class="account-pages mt-5 mb-5">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8 col-lg-6 col-xl-5">
|
||||
<div class="card">
|
||||
|
||||
<div class="card-body p-4">
|
||||
|
||||
<div class="text-center w-75 m-auto">
|
||||
<div class="auth-logo">
|
||||
<a href="javascript:void(0);" class="logo logo-dark text-center">
|
||||
<span class="logo-lg">
|
||||
<img src="<?= base_url() . "public/uploads/default.png" ?>" alt="" height="55">
|
||||
</span><br/>
|
||||
</a>
|
||||
|
||||
<a href="javascript:void(0);" class="logo logo-light text-center">
|
||||
<span class="logo-lg" style="background: white;">
|
||||
<img src="<?= base_url() . "public/uploads/default.png" ?>" alt="" height="55">
|
||||
</span><br/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
<div class="mt-4">
|
||||
<div class="logout-checkmark">
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 161.2 161.2" enable-background="new 0 0 161.2 161.2" xml:space="preserve">
|
||||
<path class="logout-path" fill="none" stroke="#d1dee4" stroke-miterlimit="10" d="M425.9,52.1L425.9,52.1c-2.2-2.6-6-2.6-8.3-0.1l-42.7,46.2l-14.3-16.4
|
||||
c-2.3-2.7-6.2-2.7-8.6-0.1c-1.9,2.1-2,5.6-0.1,7.7l17.6,20.3c0.2,0.3,0.4,0.6,0.6,0.9c1.8,2,4.4,2.5,6.6,1.4c0.7-0.3,1.4-0.8,2-1.5
|
||||
c0.3-0.3,0.5-0.6,0.7-0.9l46.3-50.1C427.7,57.5,427.7,54.2,425.9,52.1z"></path>
|
||||
<circle class="logout-path" fill="none" stroke="#1abc9c" stroke-width="4" stroke-miterlimit="10" cx="80.6" cy="80.6" r="62.1"></circle>
|
||||
<polyline class="logout-path" fill="none" stroke="#1abc9c" stroke-width="6" stroke-linecap="round" stroke-miterlimit="10" points="113,52.8
|
||||
74.1,108.4 48.2,86.4 "></polyline>
|
||||
|
||||
<circle class="logout-spin" fill="none" stroke="#d1dee4" stroke-width="4" stroke-miterlimit="10" stroke-dasharray="12.2175,12.2175" cx="80.6" cy="80.6" r="73.9"></circle>
|
||||
|
||||
</svg>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>See you again !</h3>
|
||||
|
||||
<p class="text-muted"> You are now successfully sign out. </p>
|
||||
</div>
|
||||
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<div class="row mt-3">
|
||||
<div class="col-12 text-center">
|
||||
<p class="text-muted">Back to <a href="<?= base_url(); ?>" class="text-primary font-weight-medium ml-1">Sign In</a></p>
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
|
||||
<footer class="footer footer-alt">
|
||||
<p> <?= date('Y') ?> © <?= "BigBamboo Contribution"; ?>.</p>
|
||||
</footer>
|
||||
|
||||
<!-- Vendor js -->
|
||||
<script src="<?= base_url() . "public/assets/js/vendor.min.js" ?>"></script>
|
||||
|
||||
<!-- App js -->
|
||||
<script src="<?= base_url() . "public/assets/js/app.min.js" ?>"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
123
app/Views/auth_reset_password.php
Normal file
123
app/Views/auth_reset_password.php
Normal file
@ -0,0 +1,123 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Reset password</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" />
|
||||
<meta content="Coderthemes" name="author" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<!-- App favicon -->
|
||||
<link rel="shortcut icon" href="<?= base_url() . "public/uploads/default.ico" ?>">
|
||||
<!-- App css -->
|
||||
<link href="<?= base_url() . "public/assets/css/bootstrap-creative.min.css" ?>" rel="stylesheet" type="text/css" id="bs-default-stylesheet" />
|
||||
<link href="<?= base_url() . "public/assets/css/app-creative.min.css" ?>" rel="stylesheet" type="text/css" id="app-default-stylesheet" />
|
||||
|
||||
<link href="<?= base_url() . "public/assets/css/bootstrap-creative-dark.min.css" ?>" rel="stylesheet" type="text/css" id="bs-dark-stylesheet" />
|
||||
<link href="<?= base_url() . "public/assets/css/app-creative-dark.min.css" ?>" rel="stylesheet" type="text/css" id="app-dark-stylesheet" />
|
||||
|
||||
<!-- icons -->
|
||||
<link href="<?= base_url() . "public/assets/css/icons.min.css" ?>" rel="stylesheet" type="text/css" />
|
||||
|
||||
</head>
|
||||
|
||||
<body class="loading">
|
||||
|
||||
<div class="account-pages mt-5 mb-5">
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<!-- <div class="col-md-8 col-lg-6 col-xl-5"> -->
|
||||
<div class="col-md-8 col-lg-7 col-xl-5">
|
||||
<div class="card">
|
||||
|
||||
<div class="card-body p-3">
|
||||
|
||||
<div class="text-center w-75 m-auto">
|
||||
<p class="text-muted mb-4 mt-3">Enter your email address and we'll send you an email with instructions to reset your password.</p>
|
||||
</div>
|
||||
|
||||
<form action="<?= base_url()."auth_reset_password_save"?>" method="post" role="form" class="parsley-examples">
|
||||
<div class="form-group row">
|
||||
<label class="col-sm-2 col-form-label" for="emailaddress">Email : </label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" readonly class="form-control-plaintext" id="emailaddress" name="email" value="<?= $email ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="hori-pass1">Password<span class="text-danger">*</span></label>
|
||||
<div class="input-group input-group-merge">
|
||||
<input id="hori-pass1" name="password1" type="password" placeholder="Password" required class="form-control">
|
||||
<!-- <div class="input-group-append" data-password="false">
|
||||
<div class="input-group-text">
|
||||
<span class="password-eye"></span>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="hori-pass2">Confirm Password<span class="text-danger">*</span></label>
|
||||
<div class="input-group input-group-merge">
|
||||
<input data-parsley-equalto="#hori-pass1" type="password" required placeholder="Confirm Password" class="form-control" id="hori-pass2" name="password2">
|
||||
<!-- <div class="input-group-append" data-password="false">
|
||||
<div class="input-group-text">
|
||||
<span class="password-eye"></span>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if (isset($validationErrors)) : ?>
|
||||
<span class="widget-simple text-center">
|
||||
<div class="media-body align-self-center font-24 avatar-title">
|
||||
<p style="color: #f1556c!important;" class="mt-0" style><?= $validationErrors; ?></p>
|
||||
</div>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<div class="form-group mb-0 text-center">
|
||||
<button class="btn btn-primary btn-block" type="submit"> Reset Password </button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<div class="row mt-3">
|
||||
<div class="col-12 text-center">
|
||||
<p class="text-muted">Back to <a href="<?= base_url(); ?>" class="text-primary font-weight-medium ml-1">Log in</a></p>
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
|
||||
<footer class="footer footer-alt">
|
||||
<p> <?= date('Y') ?> © <?= "BigBamboo Contribution"; ?>.</p>
|
||||
</footer>
|
||||
|
||||
<!-- Vendor js -->
|
||||
<script src="<?= base_url() . "public/assets/js/vendor.min.js" ?>"></script>
|
||||
|
||||
<!-- Plugin js-->
|
||||
<script src="<?= base_url() . "public/assets/libs/parsleyjs/parsley.min.js" ?>"></script>
|
||||
|
||||
<!-- Validation init js-->
|
||||
<script src="<?= base_url() . "public/assets/js/pages/form-validation.init.js" ?>"></script>
|
||||
|
||||
<!-- App js -->
|
||||
<script src="<?= base_url() . "public/assets/js/app.min.js" ?>"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
178
app/Views/book_form.php
Normal file
178
app/Views/book_form.php
Normal file
@ -0,0 +1,178 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
</head>
|
||||
<style>
|
||||
/* CSS for the preview image */
|
||||
.preview-image {
|
||||
display: block;
|
||||
/* Ensure the image is displayed as a block element */
|
||||
width: 120px;
|
||||
/* Set the desired width for passport size */
|
||||
height: 160px;
|
||||
/* Set the desired height for passport size */
|
||||
object-fit: cover;
|
||||
/* Maintain the aspect ratio and fill the container */
|
||||
margin-top: 10px;
|
||||
/* Add a top margin for spacing */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title"><?= $page_name; ?></h4>
|
||||
<p class="sub-header"> </p>
|
||||
<?php if (session()->getFlashdata('success')) : ?>
|
||||
<div class="alert alert-success"><?= session()->getFlashdata('success') ?></div>
|
||||
<?php endif; ?>
|
||||
<form class="needs-validation" id="myForm" novalidate method="post" enctype="multipart/form-data"
|
||||
action="<?= base_url() . "insert_causes"; ?>">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="publisher" class="col-form-label">Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="name" name="name" placeholder="Name" value="<?= isset($details[0]['name']) ? $details[0]['name'] : '' ?>" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="title" class="col-form-label">Type<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="type" name="type" required data-toggle="select2">
|
||||
<?php foreach ($cause_list as $val) : ?>
|
||||
<option value="<?= $val->id ?>" <?php if (isset($details[0]['type']) && $details[0]['type'] == $val->id) echo "selected"; ?> > <?= $val->name ?> </option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="publisher" class="col-form-label">Description<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="publisher" name="description" placeholder="Description" value="<?= isset($details[0]['description']) ? $details[0]['description'] : '' ?>" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="from_date" class="col-form-label">From Date</label>
|
||||
<input type="date" class="form-control" id="from_date" name="from_date" value="<?= isset($details[0]['from_date']) ? $details[0]['from_date'] : '' ?>" placeholder="From date" />
|
||||
<!-- <div class="invalid-feedback"> Please provide. </div> -->
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="to_date" class="col-form-label">To Date</label>
|
||||
<input type="date" class="form-control" id="to_date" name="to_date" placeholder="To date" value="<?= isset($details[0]['to_date']) ? $details[0]['to_date'] : '' ?>" />
|
||||
<!-- <div class="invalid-feedback"> Please provide. </div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="causes_id" name="causes_id" placeholder="hidden for book id" value="<?= isset($details[0]['causes_id']) ? $details[0]['causes_id'] : '' ?>" />
|
||||
<input type="hidden" id="business_id" name="business_id" placeholder="hidden for business id" value="<?= $session_bid ?>" />
|
||||
|
||||
<?php if (!empty($details)) { ?>
|
||||
<div class="form-group text-right m-b-0 checkbox checkbox-purple">
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<?php } ?>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button class="btn btn-success waves-effect waves-light mr-1" id="submitBtn" onclick="disableButton()" type="submit">Save</button>
|
||||
|
||||
<a onclick="history.back()" class="btn btn-secondary waves-effect">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div> <!-- end card-body-->
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col-->
|
||||
</div><!-- end row -->
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
// don't for validation.
|
||||
var get_fromdate = "<?php echo isset($details[0]['from_date']) ? $details[0]['from_date'] : ''; ?>";
|
||||
var default_mindate = new Date().toISOString().split('T')[0];
|
||||
var from_mindate = default_mindate ; //default today date is MinDate Of From Date
|
||||
var to_mindate = (get_fromdate === '') ? default_mindate : get_fromdate; //default today date is MinDate Of To Date but in edit Screen From Date Availble Means Setted to min date
|
||||
$("#from_date").attr("min", from_mindate);
|
||||
$("#to_date").attr("min", to_mindate);
|
||||
|
||||
role = "<?php echo get_user_role() ?>";
|
||||
console.log(role);
|
||||
if(role == "auditor")
|
||||
{
|
||||
// for input
|
||||
var formElements = document.querySelectorAll('#myForm input, #myForm textarea');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('readonly', true);
|
||||
});
|
||||
// for select
|
||||
var formElements = document.querySelectorAll('#myForm select, #myForm button');
|
||||
formElements.forEach(function(element) {
|
||||
element.setAttribute('disabled', true);
|
||||
});
|
||||
}
|
||||
});
|
||||
$("#from_date").on("change", function() {
|
||||
$("#to_date").val('');
|
||||
var fromDate = $(this).val();
|
||||
$("#to_date").attr("min", fromDate);
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const coverPictureInput = documenxt.getElementById("cover_picture");
|
||||
const imagePreviewContainer = document.querySelector(".image-previews");
|
||||
|
||||
coverPictureInput.addEventListener("change", function(event) {
|
||||
// imagePreviewContainer.innerHTML = ""; // Clear previous previews
|
||||
|
||||
const selectedImages = Array.from(event.target.files);
|
||||
|
||||
selectedImages.forEach(function(image, index) {
|
||||
const imageWrapper = document.createElement("div");
|
||||
imageWrapper.classList.add("mr-3");
|
||||
|
||||
const imagePreview = document.createElement("img");
|
||||
imagePreview.src = URL.createObjectURL(image);
|
||||
imagePreview.classList.add("preview-image");
|
||||
imagePreview.style.width = "120px"; // Set width as needed
|
||||
|
||||
const checkbox = document.createElement("input");
|
||||
checkbox.type = "checkbox";
|
||||
checkbox.classList.add("image-checkbox");
|
||||
checkbox.checked = false; // Set default as unchecked
|
||||
|
||||
imageWrapper.appendChild(checkbox);
|
||||
imageWrapper.appendChild(imagePreview);
|
||||
imagePreviewContainer.appendChild(imageWrapper);
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
document.getElementById('myForm').addEventListener('submit', function(event) {
|
||||
var form = event.target;
|
||||
|
||||
if (form.checkValidity() === false) {
|
||||
|
||||
form.reportValidity(); // Display validation error messages
|
||||
event.preventDefault(); // Prevent form submission if it's not valid
|
||||
$('#submitBtn').prop('disabled', false);
|
||||
} else {
|
||||
|
||||
$('#submitBtn').prop('disabled', true);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
93
app/Views/book_list.php
Normal file
93
app/Views/book_list.php
Normal file
@ -0,0 +1,93 @@
|
||||
<style>
|
||||
.maxWidth {
|
||||
max-width: 50px;
|
||||
}
|
||||
</style>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="float-right">
|
||||
<a href="<?= base_url() . "add_causes/0"; ?>" class="btn btn-primary waves-effect"> <span> <i class="mdi mdi-book-plus"></i></span> Add Causes </a>
|
||||
</div>
|
||||
<br>
|
||||
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
||||
<?php if (session()->getFlashdata('success') || session()->getFlashdata('error')) : ?>
|
||||
<?php if (session()->getFlashdata('success')) : ?>
|
||||
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||
<?= session('success') ?>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (session()->getFlashdata('error')) : ?>
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
<?= session('error') ?>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<div class="table-responsive">
|
||||
<!-- <table id="basic-datatable" class="table dt-responsive w-100"> -->
|
||||
<table id="scroll-horizontal-datatable_new" class="table w-100">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th hidden></th>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($details as $row) :
|
||||
if ($row['isactive']) {
|
||||
$class = 'badge badge-soft-success';
|
||||
$message = 'Active';
|
||||
} else {
|
||||
$class = 'badge badge-soft-danger';
|
||||
$message = 'In-Active';
|
||||
}
|
||||
$edit_page_route = base_url() . "add_causes/" . $row['causes_id'];
|
||||
?>
|
||||
<tr>
|
||||
<td hidden><?php echo $row['causes_id']; ?></td>
|
||||
<td><?php echo $row['name']; ?></td>
|
||||
<td>
|
||||
<?php
|
||||
foreach ($cause_list as $key => $value) {
|
||||
if($row['type'] == $value->id)
|
||||
echo $value->name;
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><?php echo $row['description']; ?></td>
|
||||
<td>
|
||||
|
||||
<a href="<?php echo $edit_page_route; ?>" class="edit-button"> <i class="ri-pencil-line"></i></a>
|
||||
<?php if(get_user_role() != 'auditor') { ?>
|
||||
<a href="<?= base_url() . "delete_causes/" . $row['causes_id']; ?>" class="delete-button"><i class="ri-delete-bin-line"></i></a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
<!-- end row-->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#scroll-horizontal-datatable_new').DataTable({
|
||||
"order": [[0, "desc"]] // 4 is the column index of "created_on" in your table
|
||||
// Other DataTables configuration options
|
||||
});
|
||||
});
|
||||
</script>
|
||||
721
app/Views/business_form.php
Normal file
721
app/Views/business_form.php
Normal file
@ -0,0 +1,721 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
</head>
|
||||
<style>
|
||||
/* CSS for the preview image */
|
||||
.preview-image {
|
||||
display: block;
|
||||
/* Ensure the image is displayed as a block element */
|
||||
width: 120px;
|
||||
/* Set the desired width for passport size */
|
||||
height: auto;
|
||||
/* Set the desired height for passport size */
|
||||
object-fit: cover;
|
||||
/* Maintain the aspect ratio and fill the container */
|
||||
margin-top: 10px;
|
||||
/* Add a top margin for spacing */
|
||||
}
|
||||
|
||||
.toggle-icon {
|
||||
cursor: pointer;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
#error-message {
|
||||
color: red;
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title"><?= $page_name; ?></h4>
|
||||
<p class="sub-header"> </p>
|
||||
<?php if (session()->getFlashdata('success') || session()->getFlashdata('error')) : ?>
|
||||
<?php if (session()->getFlashdata('success')) : ?>
|
||||
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||
<?= session('success') ?>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (session()->getFlashdata('error')) : ?>
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
<?= session('error') ?>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<form class="needs-validation" novalidate method="POST" enctype="multipart/form-data" action="<?= base_url() . "insert_org"; ?>" id="myForm">
|
||||
<hr />
|
||||
<h4 class="header-title" id="org-settings-title">
|
||||
Organization Settings
|
||||
<span class="toggle-icon" onclick="toggleSettings('org-settings')">▼</span>
|
||||
</h4>
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<div class="form-group" id="org-settings">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="bname" class="col-form-label">Organization Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="bname" name="bname" value="<?= isset($organzations['title']) ? $organzations['title'] : '' ?>" placeholder="Organization Name" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="bmail" class="col-form-label">Organization Email<span class="text-danger">*</span></label>
|
||||
<input type="email" class="form-control" id="bmail" name="bmail" value="<?= isset($organzations['email']) ? $organzations['email'] : '' ?>" placeholder="Email" required onchange="checkExisting(this,'email','bmail','business')"/>
|
||||
<span id="bemailValidationMessage"></span>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="pan_no" class="col-form-label">Organization PAN Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="pan_no" name="pan_no" value="<?= isset($organzations['pan_no']) ? $organzations['pan_no'] : '' ?>" placeholder="PAN Number" required pattern="[A-Z]{5}[0-9]{4}[A-Z]{1}" title="Enter a valid PAN number" onchange="checkExisting(this,'pan_no','pan_no','business')"/>
|
||||
<span id="panValidationMessage"></span>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="org_reg_no" class="col-form-label">Organization Reg Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="org_reg_no" value="<?= isset($organzations['org_reg_no']) ? $organzations['org_reg_no'] : '' ?>" placeholder="Organization Register Number" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if($loged_user === 'sadmin' || $loged_user === 'admin'){ ?>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="80G" class="col-form-label">80G</label>
|
||||
<input type="text" class="form-control" id="80G" name="80G" value="<?= isset($organzations['80G']) ? htmlspecialchars($organzations['80G']) : '' ?>" placeholder="80G Tax Free / Registration number" onchange="checkValidityAndSetRequired()"/>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="80G_vaildupto" class="col-form-label">80G Vaild Upto<span class="text-danger 80G-text-danger" style="display:none;">*</span></label>
|
||||
<input type="date" class="form-control" id="80G_vaildupto" name="80G_vaildupto" value="<?= !empty($organzations['80G_vaildupto']) ? htmlspecialchars($organzations['80G_vaildupto']) : null ?>" min="<?= date('Y-m-d') ?>">
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="12AA" class="col-form-label">12AA</label>
|
||||
<input type="text" class="form-control" id="12AA" name="12AA" value="<?= isset($organzations['12AA']) ? htmlspecialchars($organzations['12AA']) : null ?>" placeholder="12AA Tax Free / Registration number" onchange="checkValidityAndSetRequired()"/>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="12AA_vaildupto" class="col-form-label">12AA Vaild Upto<span class="text-danger 12AA-text-danger" style="display:none;">*</span></label>
|
||||
<input type="date" class="form-control" id="12AA_vaildupto" name="12AA_vaildupto" value="<?= !empty($organzations['12AA_vaildupto']) ? htmlspecialchars($organzations['12AA_vaildupto']) : null ?>" min="<?= date('Y-m-d') ?>">
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="bmobile" class="col-form-label">Organization Mobile Number<span class="text-danger">*</span></label>
|
||||
<input type="tel" class="form-control" id="bmobile" name="bmobile" value="<?= isset($organzations['mobile_no']) ? $organzations['mobile_no'] : '' ?>" placeholder="Mobile Number (Enter only numbers)" required pattern="\d{10}" title="Please enter a 10-digit mobile number" oninput="this.value = this.value.replace(/[^0-9]/g, '')" maxlength="10" onchange="checkExisting(this,'mobile_no','bmobile','business')" />
|
||||
<span id="bmobileValidationMessage"></span>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-8">
|
||||
<label for="baddress" class="col-form-label">Organization Address<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="baddress" value="<?= isset($organzations['address']) ? $organzations['address'] : '' ?>" placeholder="Address (eg : 1234 Main St)" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="bcity" class="col-form-label">City<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="bcity" value="<?= isset($organzations['city']) ? $organzations['city'] : '' ?>" placeholder="City" required pattern="[A-Za-z\s]+" title="Please enter alphabets only" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="bstate" class="col-form-label">State<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="bstate" value="<?= isset($organzations['state']) ? $organzations['state'] : '' ?>" placeholder="State" required pattern="[A-Za-z\s]+" title="Please enter alphabets only" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="bzip" class="col-form-label">Postal Code<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" name="bzip" value="<?= isset($organzations['postal_code']) ? $organzations['postal_code'] : '' ?>" placeholder="Postal Code (Eg: Pincode)" pattern="[0-9]{6}" maxlength="6" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="country" class="col-form-label">Country</label>
|
||||
<select class="form-control" id="country" name="country" >
|
||||
<option value="<?= isset($organzations['country']) ? $organzations['country'] : '' ?>"><?= isset($organzations['country']) ? $organzations['country'] : '--Select--';?></option>
|
||||
<?php foreach ($country_details as $value) { ?>
|
||||
<option value="<?php echo $value['country_name']; ?>">
|
||||
<?php
|
||||
echo $value['country_name'];
|
||||
?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Existing form fields above this section -->
|
||||
<!-- ################################################################################################# -->
|
||||
<hr />
|
||||
<h4 class="header-title" id="site-settings-title">
|
||||
Site Settings
|
||||
<span class="toggle-icon" onclick="toggleSettings('site-settings')">▼</span>
|
||||
</h4>
|
||||
<br>
|
||||
<div class="form-group" id="site-settings" style="display: none;">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12" style="display:none;">
|
||||
<label for="postal_code" class="col-form-label">Organization</label>
|
||||
<select id="business_id" name="business_id" class="form-control">
|
||||
<option value="null"><?php if (!isset($details['business_id'])) {
|
||||
echo 'Choose Organization';
|
||||
} ?></option>
|
||||
<?php foreach ($master_organzation_details as $value) { ?>
|
||||
<option value="<?php echo $value['business_id']; ?>" <?php if (isset($details['business_id']) && ($details['business_id'] === $value['business_id'])) echo "selected"; ?>>
|
||||
<?php echo $value['title']; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="site_name" class="col-form-label">Site Name</label>
|
||||
<input type="text" class="form-control" id="site_name" name="site_name" value="<?= isset($organzations['site_name']) ? $organzations['site_name'] : '' ?>" placeholder="Site Name" />
|
||||
<?php if ($loged_user === 'sadmin') : ?> <span class="help-block"><small>Auto-text copied from Organization Name field (First time only. If you want to change it means please edit.)</small></span> <?php endif; ?>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="site_title" class="col-form-label">Site Title</label>
|
||||
<input type="text" class="form-control" id="site_title" name="site_title" placeholder="Site Title" value="<?= isset($organzations['site_title']) ? $organzations['site_title'] : '' ?>" />
|
||||
<?php if ($loged_user === 'sadmin') : ?> <span class="help-block"><small>Auto-text copied from Organization Name field (First time only. If you want to change it means please edit.)</small></span> <?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="admin_email" class="col-form-label">Admin Email</label>
|
||||
<input type="email" class="form-control" id="admin_email" name="admin_email" placeholder="Admin Email" value="<?= isset($organzations['admin_email']) ? $organzations['admin_email'] : '' ?>" onchange="checkExisting(this,'admin_email','admin_email','business')"/>
|
||||
<span id="adminemailValidationMessage"></span>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="site_mobile" class="col-form-label">Mobile Number</label>
|
||||
<input type="text" class="form-control" id="site_mobile" name="site_mobile" placeholder="Mobile Number (Enter only numbers)" data-parsley-type="number" value="<?= isset($organzations['site_mobile']) ? $organzations['site_mobile'] : '' ?>" pattern="\d{10}" title="Please enter a 10-digit mobile number" maxlength="10" onchange="checkExisting(this,'site_mobile','site_mobile','business')"/>
|
||||
<span id="sitemobileValidationMessage"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="copyright" class="col-form-label">Copyright</label>
|
||||
<input type="text" class="form-control" id="copyright" name="copyright" placeholder="Copy Right" value="<?= isset($organzations['copyright']) ? $organzations['copyright'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="currency" class="col-form-label">Currency<span class="text-danger">*</span></label>
|
||||
<select class="form-control" placeholder="Currency (eg : Rupees,Dollar,Euro - symbols)" id="currency" name="currency[]" required data-toggle="select2" multiple>
|
||||
<option value="0" disabled>--Select--</option>
|
||||
<?php
|
||||
$defaultCurrencies = isset($organzations['currency']) ? unserialize((string)$organzations['currency']) : ['INR'];
|
||||
foreach ($country_details as $val) {
|
||||
echo '<option value="' . $val['currency_code'] . '" ' . (in_array($val['currency_code'], $defaultCurrencies) ? 'selected' : '') . '>';
|
||||
echo $val['currency_code'];
|
||||
echo '</option>';
|
||||
}?>
|
||||
<!-- echo $val['currency_code'] . ' (' . $val['currency_name'] . ' - ' . $val['currency_symbol'] . ')'; -->
|
||||
|
||||
</select>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ################################################################################################# -->
|
||||
<?php if ($loged_user !== 'sadmin') : ?>
|
||||
<hr />
|
||||
<!-- -->
|
||||
<h4 class="header-title" id="donaton-accepted-title">
|
||||
Accepted Contribution
|
||||
<span class="toggle-icon" onclick="toggleSettings('donaton-accepted')">▼</span>
|
||||
</h4>
|
||||
<br>
|
||||
<div class="form-group" id="donaton-accepted" style="display: none;">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="title" class="col-form-label">Name<span class="text-danger">*</span></label>
|
||||
<select class="form-control" placeholder="Donation Accepted Name" id="name" name="name[]" required data-toggle="select2" multiple>
|
||||
<option value="0" disabled>--Select--</option>
|
||||
<?php foreach ($donation as $val) : ?>
|
||||
<option value="<?= $val["id"] ?>" <?php if ($val["is_active"] == 1) echo "selected"; ?>> <?= $val["name"] ?> </option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-6"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<!--#################################################################### -->
|
||||
<hr />
|
||||
<h4 class="header-title" id="branch-settings-title">
|
||||
Branch Settings
|
||||
<span class="toggle-icon" onclick="toggleSettings('branch-settings')">▼</span>
|
||||
</h4>
|
||||
<br>
|
||||
<div id="branch-settings" style="display: none;">
|
||||
<div class="after-busi-branch-add-more">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="branchname" class="col-form-label">Branch Name<span class="text-danger">* </span></label>
|
||||
<input type="text" class="form-control" id="branchname" name="branch_name[]" placeholder="Branch Name" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="branchaddress" class="col-form-label">Branch Address<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="branchaddress" name="branchaddress[]" placeholder="Address (eg : 1234 Main St)" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="mobile_no" class="col-form-label">Contact Person Mobile <span class="text-danger">*</span></label>
|
||||
<input type="number" class="form-control" id="mobile_no" name="mobile_no[]" placeholder="Contact Person Mobile " required data-parsley-type="number" maxlength="10" />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="email" class="col-form-label">Email<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="email" name="email[]" placeholder="Email" required />
|
||||
<div class="invalid-feedback"> Please provide. </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-3">
|
||||
<!-- Add hidden input for branch id -->
|
||||
<input type="hidden" id="buiness_branch_id" name="id[]" placeholder="hidden for buisness branch id" />
|
||||
<input type="hidden" id="counter" value=<?= 0; ?> readonly />
|
||||
</div>
|
||||
<div class="form-group col-md-9 busi-branch-div-change text-right m-b-0">
|
||||
<a class="btn btn-success waves-effect waves-light mr-1 busi-branch-add-more">+ Add More </a>
|
||||
<a class="btn btn-danger waves-effect waves-light mr-1 busi-branch-remove">- Remove </a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ############################################################################################### -->
|
||||
|
||||
|
||||
<hr />
|
||||
<h4 class="header-title" id="logo-settings-title">
|
||||
Logo Settings
|
||||
<span class="toggle-icon" onclick="toggleSettings('logo-settings')">▼</span>
|
||||
</h4>
|
||||
<br>
|
||||
<div class="form-group" id="logo-settings" style="display: none;">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="logo" class="col-form-label">Logo</label>
|
||||
<input type="file" class="form-control" style="border: 0px !important; " id="logo" name="business_logo" placeholder="Logo Name" accept=".png, .jpg, .jpeg" value="<?= isset($organzations['business_logo']) ? $organzations['business_logo'] : '' ?>" />
|
||||
<span class="help-block"><small>Image dimensions should be between <strong>140x45</strong> pixels and <strong>300x100</strong> pixels. (formats: .png, .jpg, .jpeg)</small></span>
|
||||
<p id="logo-error-message" style="color: red;"></p>
|
||||
|
||||
</div>
|
||||
<?php if (!empty($organzations['business_logo'])) { ?>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="business_logo" class="col-form-label"> Logo <?= '('.$organzations['business_logo'].')'; ?></label>
|
||||
<img src="<?= base_url('public/uploads/' . $organzations['business_logo']) ?>" alt="Logo" class="preview-image" />
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="favicon" class="col-form-label">Favicon</label>
|
||||
<input type="file" class="form-control" style="border: 0px !important; " id="favic" name="favicon" placeholder="Fav-icon Name" accept=".png, .jpg, .jpeg" value="<?= isset($organzations['favicon']) ? $organzations['favicon'] : '' ?>" />
|
||||
<span class="help-block"><small>Image dimensions should be <strong>256x256</strong> pixels.(formats: .png, .jpg, .jpeg) </small></span>
|
||||
<p id="favic-error-message" style="color: red;"></p>
|
||||
|
||||
</div>
|
||||
<?php if (!empty($organzations['favicon'])) { ?>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="favicon" class="col-form-label">Favicon <?= '('.$organzations['favicon'].')'; ?></label>
|
||||
<img src="<?= base_url('public/uploads/' . $organzations['favicon']) ?>" alt="Icon" class="preview-image" />
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
|
||||
<div class="form-group col-md-6">
|
||||
<label for="bfile" class="col-form-label">Signature</label>
|
||||
<input type="file" onchange="validateImage(this)" class="form-control" style="border: 0px !important;" id="signature" name="signature" value="<?= isset($organzations['signature']) ? $organzations['signature'] : null ?>" accept=".png, .jpg, .jpeg"/>
|
||||
<span class="help-block"><small>Image dimensions should be <strong>150x30</strong> pixels. (formats: .png, .jpg, .jpeg) </small></span>
|
||||
<p id="error-message"></p>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($organzations['signature'])) { ?>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="bfile" class="col-form-label">Current Signature <?= '('.$organzations['signature'].')'; ?></label>
|
||||
<img src="<?= base_url('public/uploads/' . $organzations['signature']) ?>" alt="Signature" class="preview-image" />
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<input type="hidden" id="business_id" name="business_id" placeholder="hidden for Organization id" value="<?= isset($organzations['business_id']) ? $organzations['business_id'] : '' ?>" />
|
||||
</div>
|
||||
<div class="after-add-more">
|
||||
<hr />
|
||||
<h4 class="header-title" id="receipt-settings-title">
|
||||
Receipt Settings
|
||||
<span class="toggle-icon" onclick="toggleSettings('receipt-settings')">▼</span>
|
||||
</h4>
|
||||
<br>
|
||||
<div class="form-group" id="receipt-settings" style="display: none;">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<div>
|
||||
<label for="prefix_format" class="col-form-label">Prefix</label>
|
||||
<input type="text" class="form-control" id="prefix_format" name="prefix_format" placeholder="Receipt Number Format" value="<?= isset($organzations['prefix_format']) ? $organzations['prefix_format'] : '' ?>" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="left_pad" class="col-form-label">Left Padding</label>
|
||||
<input type="text" class="form-control" id="left_pad" name="left_pad" placeholder="Left Padding Number" value="<?= isset($organzations['left_pad']) ? $organzations['left_pad'] : '' ?>" />
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="start_no" class="col-form-label">Start Number</label>
|
||||
<input type="text" class="form-control" id="start_no" name="start_no" value="<?= isset($organzations['start_no']) ? $organzations['start_no'] : '1' ?>" placeholder="Start Number" />
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label for="bterms" class="col-form-label">Receipt Note</label>
|
||||
<textarea class="form-control" id="terms" name="bterms" rows="5" cols="50"><?= isset($organzations['terms']) ? $organzations['terms'] : '' ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if (!empty($details)) { ?>
|
||||
<div class="form-group text-right m-b-0 checkbox checkbox-purple">
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<?php } ?>
|
||||
<br />
|
||||
|
||||
|
||||
<input type="hidden" id="setting_id" name="setting_id" placeholder="hidden for setting id" value="<?= isset($details['setting_id']) ? $details['setting_id'] : '' ?>" />
|
||||
<?php if (!empty($organzations) && ($loggedin_person_role === 'sadmin')) { ?>
|
||||
<div class="form-group text-right m-b-0 checkbox checkbox-purple" style="display: none;">
|
||||
<input type="checkbox" id="bcheckbox" name="bcheckbox" class="form-control" <?= isset($organzations) && $organzations['isactive'] == 1 ? 'checked' : '' ?>>
|
||||
<label for="bcheckbox"> Is Active</label>
|
||||
</div>
|
||||
<br>
|
||||
<?php } ?>
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button class="btn btn-success waves-effect waves-light mr-1" type="submit" id="submitBtn">Save</button>
|
||||
<?php
|
||||
// $business_id=$organzations['business_id'];
|
||||
$business_id = isset($organzations['business_id']) ? $organzations['business_id'] : null;
|
||||
// Check if the logged-in user's ID matches the user's ID
|
||||
if ($session_bid == $business_id) {
|
||||
|
||||
// Redirect to the dashboard with logged_user_id parameter
|
||||
$redirect_url = base_url() . "dashboard";
|
||||
} else {
|
||||
// Redirect to the user list
|
||||
$redirect_url = base_url() . "org_list";
|
||||
}
|
||||
?>
|
||||
<!-- -->
|
||||
<a href="<?= $redirect_url; ?>" class="btn btn-secondary waves-effect">Cancel</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div> <!-- end card-body-->
|
||||
</div> <!-- end card-->
|
||||
</div> <!-- end col-->
|
||||
</div><!-- end row -->
|
||||
<script>
|
||||
|
||||
function checkValidityAndSetRequired() {
|
||||
if (document.getElementById('80G').value.trim() !== "") {
|
||||
document.getElementById('80G_vaildupto').setAttribute('required', 'required');
|
||||
} else {
|
||||
document.getElementById('80G_vaildupto').removeAttribute('required');
|
||||
}
|
||||
if (document.getElementById('12AA').value.trim() !== "") {
|
||||
document.getElementById('12AA_vaildupto').setAttribute('required', 'required');
|
||||
} else {
|
||||
document.getElementById('12AA_vaildupto').removeAttribute('required');
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('myForm').addEventListener('submit', function(event) {
|
||||
var form = event.target;
|
||||
|
||||
var role = <?php echo json_encode($loged_user); ?>;
|
||||
if(role === 'sadmin'){checkValidityAndSetRequired();}
|
||||
|
||||
if (form.checkValidity() === false) {
|
||||
|
||||
form.reportValidity(); // Display validation error messages
|
||||
event.preventDefault(); // Prevent form submission if it's not valid
|
||||
var invalidFields = form.querySelectorAll(':invalid');
|
||||
if (invalidFields.length > 0) {
|
||||
invalidFields[0].focus();
|
||||
}
|
||||
$('#submitBtn').prop('disabled', false);
|
||||
} else {
|
||||
|
||||
$('#submitBtn').prop('disabled', true);
|
||||
}
|
||||
});
|
||||
|
||||
function validateImage(input) {
|
||||
const errorMessageElement = document.getElementById('error-message');
|
||||
errorMessageElement.textContent = '';
|
||||
|
||||
const image = input.files[0];
|
||||
|
||||
// Check image type
|
||||
const allowedImageTypes = ['image/jpeg', 'image/png', 'image/gif']; // Add more if needed
|
||||
if (!allowedImageTypes.includes(image.type)) {
|
||||
errorMessageElement.textContent = 'Invalid image type. Please select a JPEG, PNG, or GIF image.';
|
||||
input.value = ""; // Clear the input field
|
||||
return;
|
||||
}
|
||||
|
||||
const maxWidth = 150;
|
||||
const maxHeight = 100;
|
||||
|
||||
const img = new Image();
|
||||
img.onload = function() {
|
||||
console.log("Image loaded successfully");
|
||||
console.log("Image dimensions:", img.width, "x", img.height);
|
||||
if (img.width > maxWidth || img.height > maxHeight) {
|
||||
errorMessageElement.textContent = `Image dimensions should not exceed ${maxWidth}x${maxHeight}`;
|
||||
input.value = ""; // Clear the input field
|
||||
} else {
|
||||
// If the image dimensions are within limits, you can proceed with displaying the image
|
||||
img.src = URL.createObjectURL(image);
|
||||
}
|
||||
};
|
||||
|
||||
img.onerror = function() {
|
||||
console.error("Error loading image");
|
||||
errorMessageElement.textContent = "Error loading image.";
|
||||
};
|
||||
|
||||
// Set the src after attaching onload and onerror handlers
|
||||
img.src = URL.createObjectURL(image);
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
function toggleSettings(id) {
|
||||
var settingsDiv = document.getElementById(id);
|
||||
var titleIcon = document.querySelector("#" + id + "-title .toggle-icon");
|
||||
if (settingsDiv.style.display === "none") {
|
||||
settingsDiv.style.display = "block";
|
||||
titleIcon.textContent = "▲"; // Change icon to up arrow
|
||||
} else {
|
||||
settingsDiv.style.display = "none";
|
||||
titleIcon.textContent = "▼"; // Change icon to down arrow
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
document.getElementById('logo').addEventListener('change', function() {
|
||||
var input = this;
|
||||
var img = new Image();
|
||||
var errorMessageElement = document.getElementById('logo-error-message');
|
||||
|
||||
img.onload = function() {
|
||||
if (
|
||||
img.width >= 140 && img.width <= 300 &&
|
||||
img.height >= 45 && img.height <= 100
|
||||
) {
|
||||
// Valid size, clear error message
|
||||
errorMessageElement.textContent = '';
|
||||
} else {
|
||||
// Invalid size, reset the input and display an error message
|
||||
input.value = '';
|
||||
errorMessageElement.textContent = 'Image dimensions should not exceed 150x50';
|
||||
}
|
||||
};
|
||||
|
||||
if (input.files && input.files[0]) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
img.src = e.target.result;
|
||||
};
|
||||
reader.readAsDataURL(input.files[0]);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
document.getElementById('favic').addEventListener('change', function() {
|
||||
var input = this;
|
||||
var img = new Image();
|
||||
var errorMessageElement = document.getElementById('favic-error-message');
|
||||
|
||||
img.onload = function() {
|
||||
if (
|
||||
img.width === 256 && img.height === 256
|
||||
) {
|
||||
// Valid size, clear error message
|
||||
errorMessageElement.textContent = '';
|
||||
} else {
|
||||
// Invalid size, reset the input and display an error message
|
||||
input.value = '';
|
||||
errorMessageElement.textContent = 'Image dimensions should not exceed 256x256.';
|
||||
}
|
||||
};
|
||||
|
||||
if (input.files && input.files[0]) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
img.src = e.target.result;
|
||||
};
|
||||
reader.readAsDataURL(input.files[0]);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var Role = <?php echo json_encode($loged_user); ?>;
|
||||
$('#bname').change(function(){
|
||||
// alert($(this).val());
|
||||
if($('#site_name').val() === "" && $('#site_title').val() === "" && Role === 'sadmin'){
|
||||
var bname = $(this).val();
|
||||
$('#site_name').val(bname);
|
||||
$('#site_title').val(bname);
|
||||
if (bname === '' ) {
|
||||
$('#site_name').val('');
|
||||
$('#site_title').val('');
|
||||
}
|
||||
}
|
||||
});
|
||||
if (Role === 'sadmin') {
|
||||
$('#branchaddress').removeAttr('required');
|
||||
$('#branchaddress').siblings('span.text-danger').remove();
|
||||
$('#branchname').removeAttr('required');
|
||||
$('#branchname').siblings('span.text-danger').remove();
|
||||
$('#mobile_no').removeAttr('required');
|
||||
$('#mobile_no').siblings('span.text-danger').remove();
|
||||
$('#email').removeAttr('required');
|
||||
$('#email').siblings('span.text-danger').remove();
|
||||
}
|
||||
});
|
||||
$(document).ready(function() {
|
||||
var Role = <?php echo json_encode($loged_user); ?>;
|
||||
var busiBranchArray = <?php echo json_encode($branches); ?>;
|
||||
|
||||
if (busiBranchArray.length > 0) {
|
||||
j = 0;
|
||||
for (var i = 0; i < busiBranchArray.length; i++) {
|
||||
if (i == 0) {
|
||||
var html = $(".after-busi-branch-add-more").first();
|
||||
} else {
|
||||
var html = $(".after-busi-branch-add-more").first().clone();
|
||||
}
|
||||
html.find('input#buiness_branch_id').val(busiBranchArray[i]['id']);
|
||||
html.find('input#mobile_no').val(busiBranchArray[i]['mobile_no']);
|
||||
html.find('input#email').val(busiBranchArray[i]['email']);
|
||||
html.find('input#branchaddress').val(busiBranchArray[i]['address']);
|
||||
html.find('input#branchname').val(busiBranchArray[i]['branch_name']);
|
||||
|
||||
if (i !== 0) {
|
||||
html.find(".busi-branch-div-change").html("<a class='btn btn-success waves-effect waves-light mr-1 busi-branch-add-more'>+ Add More </a><a class='btn btn-danger waves-effect waves-light mr-1 busi-branch-remove'>- Remove </a>");
|
||||
html.insertAfter(".after-busi-branch-add-more:last");
|
||||
}
|
||||
j++;
|
||||
swapButtons();
|
||||
}
|
||||
} else {
|
||||
swapButtons();
|
||||
}
|
||||
|
||||
$("body").on("click", ".busi-branch-add-more", function() {
|
||||
var html = $(".after-busi-branch-add-more").first().clone();
|
||||
var count = $(".after-busi-branch-add-more").length;
|
||||
|
||||
html.find('input').val(''); // Clear input values in the cloned element
|
||||
html.find('input#counter').val(count).prop("readonly", true);
|
||||
html.find(".busi-branch-div-change").html("<a class='btn btn-success waves-effect waves-light mr-1 busi-branch-add-more'>+ Add More </a><a class='btn btn-danger waves-effect waves-light mr-1 busi-branch-remove'>- Remove </a>");
|
||||
html.insertAfter(".after-busi-branch-add-more:last");
|
||||
swapButtons();
|
||||
});
|
||||
|
||||
$("body").on("click", ".busi-branch-remove", function() {
|
||||
var rows = $(".after-busi-branch-add-more");
|
||||
if (rows.length > 1) {
|
||||
$(this).parents(".after-busi-branch-add-more").remove();
|
||||
} else {
|
||||
alert("At least one Shipping Address must be displayed.");
|
||||
}
|
||||
swapButtons();
|
||||
});
|
||||
|
||||
function swapButtons() {
|
||||
var elementCount = $(".after-busi-branch-add-more").length;
|
||||
if (elementCount > 1) {
|
||||
$(".busi-branch-remove").show(); // Show the "busi-branch-remove" buttons
|
||||
} else {
|
||||
$(".busi-branch-remove").hide(); // Hide the "busi-branch-remove" buttons
|
||||
}
|
||||
$(".after-busi-branch-add-more .busi-branch-add-more").hide();
|
||||
$(".after-busi-branch-add-more:last .busi-branch-add-more").show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
<script>
|
||||
function checkExisting(input,databasecolumnname,elementid,table){
|
||||
|
||||
switch(elementid){
|
||||
case 'pan_no' :
|
||||
spanid = "panValidationMessage"; break;
|
||||
case 'bmail' :
|
||||
spanid = "bemailValidationMessage"; break;
|
||||
case 'bmobile' :
|
||||
spanid = "bmobileValidationMessage"; break;
|
||||
case 'admin_email' :
|
||||
spanid = "adminemailValidationMessage"; break;
|
||||
case 'site_mobile' :
|
||||
spanid = "sitemobileValidationMessage"; break;
|
||||
}
|
||||
var validationMessage = document.getElementById(spanid);
|
||||
var value = input.value.trim();
|
||||
if (value === "") {
|
||||
validationMessage.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?= base_url() . 'check_existing' ?>",
|
||||
data: {
|
||||
value: value,
|
||||
module: table,
|
||||
field: databasecolumnname
|
||||
},
|
||||
success: function(response) {
|
||||
console.log("check existing " + elementId + "--" + response['data']['message']);
|
||||
validationMessage.style.display = response['data']['status'] ? 'block' : 'none';
|
||||
validationMessage.innerText = response['data']['message'];
|
||||
validationMessage.style.color = "red";
|
||||
input.setCustomValidity(response['data']['status'] ? response['data']['message'] : '');
|
||||
if (response['data']['status']) input.value = '';
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error("check existing " + elementId + " -- " + status + ": " + error);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
71
app/Views/business_list.php
Normal file
71
app/Views/business_list.php
Normal file
@ -0,0 +1,71 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="float-right">
|
||||
<?php if($loggedin_person_role === 'sadmin'): ?>
|
||||
<a href="<?= base_url()."new_org/0"; ?>" class="btn btn-primary"><i class="ri-briefcase-4-fill"></i> Add Organization </a>
|
||||
<?php endif; ?>
|
||||
</div><!-- end col-->
|
||||
<br>
|
||||
<h4 class="header-title mb-3"><?= $page_name; ?></h4>
|
||||
<div class="table-responsive">
|
||||
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
|
||||
<th>Organization Name</th>
|
||||
<th>Email</th>
|
||||
<th>Mobile Number</th>
|
||||
<th>Address</th>
|
||||
<th>City</th>
|
||||
<th>State</th>
|
||||
<th>Zip</th>
|
||||
<th>File</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($organzations as $business) :
|
||||
if ($business['isactive']) {
|
||||
$class = 'badge badge-soft-success';
|
||||
$message = 'Active';
|
||||
} else {
|
||||
$class = 'badge badge-soft-danger';
|
||||
$message = 'In-Active';
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><?= $business['title']; ?></td>
|
||||
<td><?= $business['email']; ?></td>
|
||||
<td><?= $business['mobile_no']; ?></td>
|
||||
<td><?= $business['address']; ?></td>
|
||||
<td><?= $business['city']; ?></td>
|
||||
<td><?= $business['state']; ?></td>
|
||||
<td><?= $business['postal_code']; ?></td>
|
||||
<td><?= $business['business_logo']; ?></td>
|
||||
<td><span class="<?php echo $class; ?>"><?php echo $message; ?></span></td>
|
||||
<td>
|
||||
<a href="<?= base_url() . "new_org/" . $business['business_id']; ?>" class="edit-button" title="Click to Edit Business"><i class="ri-pencil-line"></i></a>
|
||||
<?php if($loggedin_person_role === 'sadmin'): ?>
|
||||
<?php if($business['isactive'] == 1) { ?>
|
||||
<a href="<?= base_url() . "delete_org/" . $business['business_id']; ?>" class="delete-button" title="Click to Delete Business"><i class="ri-delete-bin-line"></i></a>
|
||||
<?php } else {?>
|
||||
<a href="<?= base_url() . "activate_org/" . $business['business_id']; ?>" class="active-button" title="Click to Active Business"><i class="ri-checkbox-circle-line"></i></a>
|
||||
<?php } ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
|
||||
<!-- end row-->
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user