Skip to content

Commit 19ecab7

Browse files
authored
Merge pull request #1 from mah-shamim/2.1
2.1 done
2 parents 327cb92 + 09ce44b commit 19ecab7

5,248 files changed

Lines changed: 913090 additions & 445 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
#-------------------------
2+
# Operating Specific Junk Files
3+
#-------------------------
4+
5+
# OS X
6+
.DS_Store
7+
.AppleDouble
8+
.LSOverride
9+
10+
# OS X Thumbnails
11+
._*
12+
13+
# Windows image file caches
14+
Thumbs.db
15+
ehthumbs.db
16+
Desktop.ini
17+
18+
# Recycle Bin used on file shares
19+
$RECYCLE.BIN/
20+
21+
# Windows Installer files
22+
*.cab
23+
*.msi
24+
*.msm
25+
*.msp
26+
27+
# Windows shortcuts
28+
*.lnk
29+
30+
# Linux
31+
*~
32+
33+
# KDE directory preferences
34+
.directory
35+
36+
# Linux trash folder which might appear on any partition or disk
37+
.Trash-*
38+
39+
#-------------------------
40+
# Environment Files
41+
#-------------------------
42+
# These should never be under version control,
43+
# as it poses a security risk.
44+
.env
45+
.vagrant
46+
Vagrantfile
47+
48+
#-------------------------
49+
# Temporary Files
50+
#-------------------------
51+
writable/cache/*
52+
!writable/cache/index.html
53+
54+
writable/logs/*
55+
!writable/logs/index.html
56+
57+
writable/session/*
58+
!writable/session/index.html
59+
60+
writable/uploads/*
61+
!writable/uploads/index.html
62+
63+
writable/debugbar/*
64+
65+
php_errors.log
66+
67+
#-------------------------
68+
# User Guide Temp Files
69+
#-------------------------
70+
user_guide_src/build/*
71+
user_guide_src/cilexer/build/*
72+
user_guide_src/cilexer/dist/*
73+
user_guide_src/cilexer/pycilexer.egg-info/*
74+
75+
#-------------------------
76+
# Test Files
77+
#-------------------------
78+
tests/coverage*
79+
80+
# Don't save phpunit under version control.
81+
phpunit
82+
83+
#-------------------------
84+
# Composer
85+
#-------------------------
86+
vendor/
87+
88+
#-------------------------
89+
# IDE / Development Files
90+
#-------------------------
91+
92+
# Modules Testing
93+
_modules/*
94+
95+
# phpenv local config
96+
.php-version
97+
98+
# Jetbrains editors (PHPStorm, etc)
99+
.idea/
100+
*.iml
101+
102+
# Netbeans
103+
nbproject/
104+
build/
105+
nbbuild/
106+
dist/
107+
nbdist/
108+
nbactions.xml
109+
nb-configuration.xml
110+
.nb-gradle/
111+
112+
# Sublime Text
113+
*.tmlanguage.cache
114+
*.tmPreferences.cache
115+
*.stTheme.cache
116+
*.sublime-workspace
117+
*.sublime-project
118+
.phpintel
119+
/api/
120+
121+
# Visual Studio Code
122+
.vscode/
123+
124+
/results/
125+
/phpunit*.xml
126+
/.phpunit.*.cache
127+
128+
ignore/

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2014-2019 British Columbia Institute of Technology
4+
Copyright (c) 2019-2022 CodeIgniter Foundation
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.

Modules/Adminlte/Config/Routes.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
namespace Adminlte\Config;
3+
4+
// Create a new instance of our RouteCollection class.
5+
$routes = \Config\Services::routes();
6+
7+
$routes->add('/adminlte', '\Adminlte\Controllers\Adminlte');
8+
9+
$routes->group('adminlte', function ($routes) {
10+
11+
$routes->add('serverside_datatables_data', '\Adminlte\Controllers\Adminlte::serverside_datatables_data');
12+
13+
$routes->add('form_validation', '\Adminlte\Controllers\Adminlte::form_validation');
14+
15+
$routes->add('file_uploads', '\Adminlte\Controllers\Adminlte::file_uploads');
16+
17+
// SIMPLE FILE UPLOAD EXAMPLE ROUTES
18+
$routes->add('multi_file_uploads_files', '\Adminlte\Controllers\Adminlte::multi_file_uploads_files');
19+
20+
// MULTI FILES UPLOAD EXAMPLE ROUTES
21+
$routes->add('ci_examples/multi_file_uploads', '\Adminlte\Controllers\Adminlte::multi_file_uploads');
22+
23+
$routes->post('ci_examples/multi_file_uploads', '\Adminlte\Controllers\Adminlte::multi_file_uploads');
24+
25+
26+
$routes->add('ci_examples/multi_file_uploads_delete/(:any)', '\Adminlte\Controllers\Adminlte::multi_file_uploads_delete/$1');
27+
28+
29+
$routes->add('(:any)', '\Adminlte\Controllers\Adminlte');
30+
31+
});
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
<?php
2+
namespace Adminlte\Controllers;
3+
use App\Controllers\AdminBaseController;
4+
use \Hermawan\DataTables\DataTable;
5+
6+
7+
class Adminlte extends AdminBaseController {
8+
9+
public $title = 'AdminLte Dashboard';
10+
public $menu = false;
11+
12+
13+
public function index() {
14+
15+
$url = service('uri');
16+
17+
$allSegments = $url->getSegments();
18+
19+
unset($allSegments[0]);
20+
21+
$path = implode("/", $allSegments);
22+
23+
if(\file_exists( ROOTPATH.'Modules/Adminlte/Views/'.$path.'.php' )){
24+
return view('Adminlte\Views\/'.$path);
25+
}
26+
27+
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound();
28+
return;
29+
}
30+
31+
public function serverside_datatables_data()
32+
{
33+
$db = db_connect();
34+
$builder = $db->table('users')->select('name,email,last_login,role');
35+
36+
return DataTable::of($builder)->toJson(true);
37+
}
38+
39+
public function form_validation()
40+
{
41+
42+
if($this->request->getMethod(true)!='POST'){
43+
return redirect()->to('adminlte/ci_examples/form_validation');
44+
}
45+
46+
if(!$this->validate([
47+
'email' => 'required|valid_email',
48+
'password' => 'required|min_length[5]',
49+
'terms' => 'required',
50+
])){
51+
52+
return view('Adminlte\Views\ci_examples/form_validation', [
53+
'validation' => $this->validator,
54+
]);
55+
56+
}else{
57+
return redirect()->back()->with('notifySuccess', 'Thanks for Submitting Form');
58+
}
59+
60+
}
61+
62+
public function file_uploads()
63+
{
64+
65+
if($this->request->getMethod(true)!='POST'){
66+
return redirect()->to('adminlte/ci_examples/file_uploads');
67+
}
68+
69+
if(!$this->validate([
70+
'file' => [
71+
'uploaded[file]',
72+
'mime_in[file,image/jpg,image/jpeg,image/png]',
73+
'max_size[file,1024]',
74+
],
75+
])){
76+
return view('Adminlte\Views\ci_examples/file_uploads', [
77+
'validation' => $this->validator,
78+
]);
79+
}
80+
else
81+
{
82+
83+
$img = $this->request->getFile('file');
84+
$img->move(FCPATH . 'uploads');
85+
86+
return redirect()->to('adminlte/ci_examples/file_uploads')->with('notifySuccess', 'File Uploaded Successfully '.$img->getName().' !');
87+
}
88+
89+
90+
$this->view('file_uploads');
91+
}
92+
93+
94+
public function multi_file_uploads()
95+
{
96+
97+
98+
if( $this->validate([
99+
'files' => [
100+
'uploaded[files]',
101+
'mime_in[files,image/jpg,image/jpeg,image/png]',
102+
'max_size[files,1024]',
103+
],
104+
]) ){
105+
106+
$path = FCPATH . '/uploads/test_files';
107+
108+
$img = $this->request->getFile('files');
109+
$img->move($path);
110+
111+
112+
// die(var_dump($img->getName()));
113+
$file = new \CodeIgniter\Files\File($path.'/'.$img->getName());
114+
115+
// die(var_dump($file));
116+
117+
118+
if ($img!=FALSE){
119+
120+
$response['files'][] = [
121+
'name' => $img->getName(),
122+
'size' => $file->getSize(),
123+
'url' => urlUpload('test_files').'/'.$img->getName(),
124+
'thumbnailUrl' => urlUpload('test_files').'/'.$img->getName(),
125+
'deleteUrl' => url('/adminlte/ci_examples/multi_file_uploads_delete').'/'.urlencode($img->getName()),
126+
'deleteType' => "DELETE",
127+
];
128+
129+
130+
}else{
131+
$response['files'][] = [
132+
'name' => $_FILES['files']['name'],
133+
'size' => $_FILES['files']['size'],
134+
'error' => $file['error'],
135+
];
136+
}
137+
138+
echo json_encode($response);
139+
header('Content-type: application/json');
140+
return;
141+
142+
}
143+
144+
return $this->index();
145+
146+
}
147+
148+
149+
public function multi_file_uploads_delete( $file )
150+
{
151+
$path = FCPATH.'/uploads/test_files/'.urldecode($file);
152+
153+
if(file_exists($path))
154+
unlink($path);
155+
156+
$response['files'] = [
157+
$file => true,
158+
];
159+
160+
echo json_encode($response);
161+
header('Content-type: application/json');
162+
return;
163+
}
164+
165+
public function multi_file_uploads_files()
166+
{
167+
\helper('filesystem');
168+
$files = directory_map( FCPATH.'uploads/test_files' );
169+
$response = ['files'];
170+
171+
foreach ($files as $i => $file){
172+
$response['files'][$i] = [
173+
'name' => $file,
174+
'size' => filesize( FCPATH.'/uploads/test_files/'. $file ),
175+
'url' => urlUpload('test_files').'/'.$file,
176+
'thumbnailUrl' => urlUpload('test_files').'/'.$file,
177+
'deleteUrl' => url('/adminlte/ci_examples/multi_file_uploads_delete').'/'.urlencode($file),
178+
'deleteType' => "DELETE",
179+
];
180+
}
181+
182+
echo json_encode($response);
183+
header('Content-type: application/json');
184+
return;
185+
186+
}
187+
188+
public function file_check($str)
189+
{
190+
if (empty($_FILES['file']['name'])){
191+
$this->form_validation->set_message('file_check', 'Please choose a file to upload.');
192+
}
193+
194+
return !empty($_FILES['file']['name']);
195+
}
196+
197+
198+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
namespace Adminlte\Controllers;
3+
use App\Controllers\AdminBaseController;
4+
5+
class Dashboard extends AdminBaseController {
6+
7+
public $title = 'AdminLte Dashboard';
8+
public $menu = false;
9+
10+
11+
public function index() {
12+
return view('Adminlte\Views\dashboard');
13+
}
14+
}

Modules/Adminlte/Database/.gitkeep

Whitespace-only changes.

Modules/Adminlte/Database/Migrations/.gitkeep

Whitespace-only changes.

Modules/Adminlte/Database/Seeds/.gitkeep

Whitespace-only changes.

Modules/Adminlte/Language/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)