Skip to content

Commit 39b2f2c

Browse files
authored
Merge pull request #25 from TAMULib/development
Pipit 2x Update and More
2 parents a66f8f9 + 08c2ae2 commit 39b2f2c

File tree

122 files changed

+4049
-2801
lines changed

Some content is hidden

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

122 files changed

+4049
-2801
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
App/Config/config.php
2+
App/Config/prod/*
23
composer.lock
34
composer.phar
4-
vendor/
5+
/vendor/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
namespace App\Classes\Controllers;
3+
use Pipit\Classes\Controllers as CoreControllers;
4+
5+
abstract class AppController extends CoreControllers\AbstractController {
6+
abstract protected function loadDefault();
7+
}
Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
<?php
22
namespace App\Classes\Controllers;
3-
use Core\Classes as Core;
43

5-
class DefaultAdminController extends Core\AbstractController {
6-
protected function configure() {
7-
$this->requireAdmin = true;
8-
}
9-
10-
protected function loadDefault() {
11-
$this->setViewName("default");
12-
}
13-
}
4+
class DefaultAdminController extends AppController {
5+
protected function configure() {
6+
$this->requireAdmin = true;
7+
}
8+
9+
protected function loadDefault() {
10+
$this->setViewName("default");
11+
}
12+
}
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<?php
22
namespace App\Classes\Controllers;
3-
use Core\Classes as Core;
43

5-
class DefaultController extends Core\AbstractController {
6-
protected function loadDefault() {
7-
$viewName = (!empty($this->getControllerConfig()['viewName'])) ? $this->getControllerConfig()['viewName']:'default';
8-
$this->setViewName($viewName);
9-
}
10-
}
4+
class DefaultController extends AppController {
5+
protected function loadDefault() {
6+
$viewName = (!empty($this->getControllerConfig()['viewName'])) ? $this->getControllerConfig()['viewName']:'default';
7+
$this->setViewName($viewName);
8+
}
9+
}
Lines changed: 61 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,73 @@
11
<?php
22
namespace App\Classes\Controllers;
3-
use App\Classes\Data as AppClasses;
4-
use Core\Classes as Core;
53

6-
class DynamicRepoController extends Core\AbstractController {
7-
private $dynamicRepo;
4+
class DynamicRepoController extends AppController {
5+
private $dynamicRepo;
86

9-
protected function configure() {
10-
$this->dynamicRepo = $this->getSite()->getDataRepository("DynamicRepoExample");
7+
protected function configure() {
8+
$this->dynamicRepo = $this->getSite()->getDataRepository("DynamicRepoExample");
119

12-
$this->getPage()->setTitle("Manage Dynamic Repo Example Entries");
13-
$this->getPage()->setOptions(array(
14-
array("name"=>"list"),
15-
array("name"=>"add","action"=>"add","modal"=>true)));
16-
$this->getPage()->setIsSearchable(true);
17-
}
10+
$this->getPage()->setTitle("Manage Dynamic Repo Example Entries");
11+
$this->getPage()->setOptions(array(
12+
array("name"=>"list"),
13+
array("name"=>"add","action"=>"add","modal"=>true)));
14+
$this->getPage()->setIsSearchable(true);
15+
}
1816

19-
protected function remove() {
20-
$data = $this->getSite()->getSanitizedInputData();
21-
if (isset($data['id']) && is_numeric($data['id']) && $this->dynamicRepo->removeById($data['id'])) {
22-
$this->getSite()->addSystemMessage('Repo entry removed');
23-
} else {
24-
$this->getSite()->addSystemError('Error removing repo entry');
25-
}
26-
}
17+
protected function remove() {
18+
$data = $this->getSite()->getSanitizedInputData();
19+
if (isset($data['id']) && is_numeric($data['id']) && $this->dynamicRepo->removeById($data['id'])) {
20+
$this->getSite()->addSystemMessage('Repo entry removed');
21+
} else {
22+
$this->getSite()->addSystemError('Error removing repo entry');
23+
}
24+
}
2725

28-
protected function insert() {
29-
$data = $this->getSite()->getSanitizedInputData();
30-
if (isset($data['entry']) && $this->dynamicRepo->add($data['entry'])) {
31-
$this->getSite()->addSystemMessage('Repo entry added');
32-
} else {
33-
$this->getSite()->addSystemError('Error adding repo entry');
34-
}
35-
}
26+
protected function insert() {
27+
$data = $this->getSite()->getSanitizedInputData();
28+
if (isset($data['entry']) && $this->dynamicRepo->add($data['entry'])) {
29+
$this->getSite()->addSystemMessage('Repo entry added');
30+
} else {
31+
$this->getSite()->addSystemError('Error adding repo entry');
32+
}
33+
}
3634

37-
protected function add() {
38-
$this->getPage()->setSubTitle('New Repo Entry');
39-
$this->setViewName('entries.add');
40-
}
35+
protected function add() {
36+
$this->getPage()->setSubTitle('New Repo Entry');
37+
$this->setViewName('entries.add');
38+
}
4139

42-
protected function update() {
43-
$data = $this->getSite()->getSanitizedInputData();
44-
if (isset($data['entry']) && (isset($data['id']) && is_numeric($data['id'])) && $this->dynamicRepo->update($data['id'],$data['entry'])) {
45-
$this->getSite()->addSystemMessage('Entry updated');
46-
} else {
47-
$this->getSite()->addSystemError('Error updating entry');
48-
}
49-
}
40+
protected function update() {
41+
$data = $this->getSite()->getSanitizedInputData();
42+
if (isset($data['entry']) && (isset($data['id']) && is_numeric($data['id'])) && $this->dynamicRepo->update($data['id'],$data['entry'])) {
43+
$this->getSite()->addSystemMessage('Entry updated');
44+
} else {
45+
$this->getSite()->addSystemError('Error updating entry');
46+
}
47+
}
5048

51-
protected function edit() {
52-
$this->getPage()->setSubTitle('Update Entry');
53-
$data = $this->getSite()->getSanitizedInputData();
54-
if (isset($data['id']) && is_numeric($data['id']) && ($entry = $this->dynamicRepo->getById($data['id']))) {
55-
$this->getSite()->getViewRenderer()->registerViewVariable("entry",$entry);
56-
$this->setViewName('entries.edit');
57-
}
58-
}
49+
protected function edit() {
50+
$this->getPage()->setSubTitle('Update Entry');
51+
$data = $this->getSite()->getSanitizedInputData();
52+
if (isset($data['id']) && is_numeric($data['id']) && ($entry = $this->dynamicRepo->getById($data['id']))) {
53+
$this->getSite()->getViewRenderer()->registerViewVariable("entry",$entry);
54+
$this->setViewName('entries.edit');
55+
}
56+
}
5957

60-
protected function search() {
61-
$data = $this->getSite()->getSanitizedInputData();
62-
if (isset($data['term'])) {
63-
$this->getSite()->getViewRenderer()->registerViewVariable("entries",$this->dynamicRepo->search($data['term']));
64-
$this->setViewName("entries.list");
65-
} else {
66-
$site->addSystemError('There was an error with the search');
67-
}
68-
}
58+
protected function search() {
59+
$data = $this->getSite()->getSanitizedInputData();
60+
if (isset($data['term'])) {
61+
$this->getSite()->getViewRenderer()->registerViewVariable("entries",$this->dynamicRepo->search($data['term']));
62+
$this->setViewName("entries.list");
63+
} else {
64+
$site->addSystemError('There was an error with the search');
65+
}
66+
}
6967

70-
protected function loadDefault() {
71-
$this->getPage()->setSubTitle('Repo Entries');
72-
$this->getSite()->getViewRenderer()->registerViewVariable("entries", $this->dynamicRepo->get());
73-
$this->setViewName('entries.list');
74-
}
75-
}
68+
protected function loadDefault() {
69+
$this->getPage()->setSubTitle('Repo Entries');
70+
$this->getSite()->getViewRenderer()->registerViewVariable("entries", $this->dynamicRepo->get());
71+
$this->setViewName('entries.list');
72+
}
73+
}
Lines changed: 51 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,60 @@
11
<?php
22
namespace App\Classes\Controllers;
3-
use App\Classes\Data as AppClasses;
4-
use Core\Classes as Core;
53

6-
class FilesController extends Core\AbstractController {
7-
private $fileManager;
4+
class FilesController extends AppController {
5+
private $fileManager;
86

9-
public function configure() {
10-
$this->fileManager = $this->getSite()->getHelper("FileManager");
11-
}
7+
public function configure() {
8+
$this->fileManager = $this->getSite()->getHelper("FileManager");
9+
}
1210

13-
protected function upload() {
14-
$data = $this->getSite()->getSanitizedInputData();
15-
if ($data['newFile']) {
16-
try {
17-
$fileName = $this->fileManager->processBase64File($data['newFile'],$data['fileGloss']);
11+
protected function upload() {
12+
$data = $this->getSite()->getSanitizedInputData();
13+
if ($data['newFile']) {
14+
try {
15+
$fileName = $this->fileManager->processBase64File($data['newFile'],$data['fileGloss']);
1816

19-
$fileType = '';
20-
$temp = explode('.',$data['gloss']);
21-
if (count($temp) > 1) {
22-
$fileType = array_pop($temp);
23-
}
24-
} catch (\RuntimeException $e) {
25-
$this->getLogger()->error($e->getMessage());
26-
http_response_code(500);
27-
}
28-
}
29-
}
17+
$fileType = '';
18+
$temp = explode('.',$data['gloss']);
19+
if (count($temp) > 1) {
20+
$fileType = array_pop($temp);
21+
}
22+
} catch (\RuntimeException $e) {
23+
$this->getLogger()->error($e->getMessage());
24+
http_response_code(500);
25+
}
26+
}
27+
}
3028

31-
protected function download() {
32-
$data = $this->getSite()->getSanitizedInputData();
33-
if ($data['fileName']) {
34-
$this->fileManager->getDownloadableFileByFileName($data['fileName']);
35-
}
36-
}
29+
protected function download() {
30+
$data = $this->getSite()->getSanitizedInputData();
31+
if ($data['fileName']) {
32+
$this->fileManager->getDownloadableFileByFileName($data['fileName']);
33+
}
34+
}
3735

38-
protected function remove() {
39-
$data = $this->getSite()->getSanitizedInputData();
40-
if ($data['fileName']) {
41-
try {
42-
$this->fileManager->removeFileByFileName($data['fileName']);
43-
} catch (\RuntimeException $e) {
44-
$this->getLogger()->error($e->getMessage());
45-
$this->getSite()->addSystemError('There was an error reamoving this file: '.$data['fileName']);
46-
}
47-
}
48-
}
36+
protected function remove() {
37+
$data = $this->getSite()->getSanitizedInputData();
38+
if ($data['fileName']) {
39+
try {
40+
$this->fileManager->removeFileByFileName($data['fileName']);
41+
} catch (\RuntimeException $e) {
42+
$this->getLogger()->error($e->getMessage());
43+
$this->getSite()->addSystemError('There was an error reamoving this file: '.$data['fileName']);
44+
}
45+
}
46+
}
4947

50-
protected function loadDefault() {
51-
$this->getPage()->setSubTitle('Files');
52-
try {
53-
$files = $this->fileManager->getDirectoryFiles();
54-
$this->getSite()->getViewRenderer()->registerViewVariable("scanned_directory",$this->fileManager->getBaseFilePath());
55-
$this->getSite()->getViewRenderer()->registerViewVariable("files",$files);
56-
} catch (\RuntimeException $e) {
57-
$this->getLogger()->warn($e->getMessage());
58-
$this->getSite()->addSystemError('There was an error reading the contents of the upload directory');
59-
}
60-
$this->setViewName('files');
61-
}
62-
}
48+
protected function loadDefault() {
49+
$this->getPage()->setSubTitle('Files');
50+
try {
51+
$files = $this->fileManager->getDirectoryFiles();
52+
$this->getSite()->getViewRenderer()->registerViewVariable("scanned_directory",$this->fileManager->getBaseFilePath());
53+
$this->getSite()->getViewRenderer()->registerViewVariable("files",$files);
54+
} catch (\RuntimeException $e) {
55+
$this->getLogger()->warn($e->getMessage());
56+
$this->getSite()->addSystemError('There was an error reading the contents of the upload directory');
57+
}
58+
$this->setViewName('files');
59+
}
60+
}

0 commit comments

Comments
 (0)