Skip to content

Commit 0f059ab

Browse files
committed
master: Adding the last changes made
1 parent 656da7d commit 0f059ab

File tree

173 files changed

+1732
-260
lines changed

Some content is hidden

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

173 files changed

+1732
-260
lines changed

app/config/app.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
'Intervention\Image\ImageServiceProvider',
132132
'anlutro\cURL\Laravel\cURLServiceProvider',
133133
'McCool\LaravelAutoPresenter\LaravelAutoPresenterServiceProvider',
134+
'Menu\MenuServiceProvider',
134135
'Syntax\Core\CoreServiceProvider',
135136
'Syntax\Core\View\ViewServiceProvider',
136137
'Syntax\Core\Forum\ForumServiceProvider',
@@ -200,7 +201,8 @@
200201
'Str' => 'Illuminate\Support\Str',
201202
'URL' => 'Illuminate\Support\Facades\URL',
202203
'Image' => 'Intervention\Image\Facades\Image',
203-
'cURL' => 'anlutro\cURL\Laravel\cURL'
204+
'cURL' => 'anlutro\cURL\Laravel\cURL',
205+
'Menu' => 'Menu\Menu',
204206
),
205207

206208
);

app/config/packages/syntax/core/config.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@
110110
|
111111
*/
112112
'nonCoreAliases' => array(
113-
'User'
113+
'User',
114+
'Menu'
114115
),
115116

116117
);

app/config/session.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
| "memcached", "redis", "array"
1616
|
1717
*/
18-
'driver' => 'database',
18+
'driver' => 'native',
1919

2020
/*
2121
|--------------------------------------------------------------------------

app/controllers/ActorController.php

+25
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,29 @@
22

33
class ActorController extends BaseController {
44

5+
public function getIndex()
6+
{
7+
$actors = Actor::orderByNameAsc()->get();
8+
9+
$ahActors = clone $actors;
10+
$ahActors = $ahActors->filter(function ($actor) {
11+
if ($actor->checkType('AH_ACTOR')) return true;
12+
});
13+
14+
$actors = $actors->filter(function ($actor) {
15+
if (!$actor->checkType('AH_ACTOR')) return true;
16+
});
17+
18+
$this->setViewData('actors', $actors);
19+
$this->setViewData('ahActors', $ahActors);
20+
}
21+
22+
public function getView($actorId)
23+
{
24+
$actor = Actor::find($actorId);
25+
$actors = Actor::where('uniqueId', '!=', $actorId)->orderByNameAsc()->get();
26+
27+
$this->setViewData('actor', $actor);
28+
$this->setViewData('actors', $actors);
29+
}
530
}

app/controllers/AdminController.php

+138
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public function getIndex()
4949
->addTab('Teams', 'teams')
5050
->addTab('Team Actors', 'teamactors')
5151
->addTab('Actors', 'actors')
52+
->addTab('Actor Types', 'actortypes')
53+
->addTab('Characters', 'characters')
5254
->buildPanel()
5355
->addPanel()
5456
->setId('ADMIN_TYPES')
@@ -322,6 +324,69 @@ public function getActordelete($actorId)
322324
return Redirect::to('/admin#actors');
323325
}
324326

327+
public function getCharacters()
328+
{
329+
$characters = Character::orderByNameAsc()->paginate(20);
330+
331+
// Set up the one page crud main details
332+
Crud::setTitle('Characters')
333+
->setSortProperty('firstName')
334+
->setDeleteLink('/admin/characterdelete/')
335+
->setDeleteProperty('id')
336+
->setPaginationFlag(true)
337+
->setResources($characters);
338+
339+
// Add the display columns
340+
Crud::addDisplayField('name', '/characters/view/', 'id')
341+
->addDisplayField('actor_name');
342+
343+
// Add the form fields
344+
Crud::addFormField('name', 'text')
345+
->addFormField('keyName', 'text')
346+
->addFormField('actor_id', 'select', Actor::orderByNameAsc()->get()->toSelectArray('Select an actor'));
347+
348+
// Set the view data
349+
Crud::make();
350+
}
351+
352+
public function postCharacters()
353+
{
354+
$this->skipView();
355+
356+
// Set the input data
357+
$input = e_array(Input::all());
358+
359+
if ($input != null) {
360+
// Get the object
361+
$character = (isset($input['id']) && strlen($input['id']) == 10 ? Character::find($input['id']) : new Character);
362+
$character->name = $input['name'];
363+
$character->keyName = $input['keyName'];
364+
$character->actor_id = $input['actor_id'] != '0' ? $input['actor_id'] : null;
365+
366+
// Attempt to save the object
367+
$this->save($character);
368+
369+
// Handle errors
370+
if ($this->errorCount() > 0) {
371+
Ajax::addErrors($this->getErrors());
372+
} else {
373+
Ajax::setStatus('success')->addData('resource', $character->toArray());
374+
}
375+
376+
// Send the response
377+
return Ajax::sendResponse();
378+
}
379+
}
380+
381+
public function getCharacterdelete($characterId)
382+
{
383+
$this->skipView();
384+
385+
Character::find($characterId)->delete();
386+
387+
return Redirect::to('/admin#characters');
388+
}
389+
325390
public function getTeamactors()
326391
{
327392
$teams = Team::orderByNameAsc()->paginate(10);
@@ -395,6 +460,79 @@ public function postTeamactors()
395460
}
396461
}
397462

463+
public function getActortypes()
464+
{
465+
$actors = Actor::orderByNameAsc()->paginate(10);
466+
$types = Type::orderByNameAsc()->get();
467+
$typesArray = $this->arrayToSelect($types, 'id', 'name', 'None');
468+
$actorsArray = $this->arrayToSelect($actors, 'id', 'fullName', 'Select an actor');
469+
470+
// Set up the one page crud
471+
Crud::setTitle('Actor Types')
472+
->setSortProperty('fullName')
473+
->setPaginationFlag(true)
474+
->setDeleteFlag(false)
475+
->setMulti($actors, 'types')
476+
->setMultiColumns(array('Actors', 'Types'))
477+
->setMultiDetails(array('name' => 'fullName', 'field' => 'actor_id'))
478+
->setMultiPropertyDetails(array('name' => 'name', 'field' => 'type_id'));
479+
480+
// Add the form fields
481+
Crud::addFormField('actor_id', 'select', $actorsArray)
482+
->addFormField('type_id', 'multiselect', $typesArray);
483+
484+
Crud::make();
485+
}
486+
487+
public function postActortypes()
488+
{
489+
$this->skipView();
490+
491+
// Set the input data
492+
$input = e_array(Input::all());
493+
494+
if ($input != null) {
495+
// Remove all existing roles
496+
$actorTypes = Actor_Type::where('actor_id', $input['actor_id'])->get();
497+
498+
if ($actorTypes->count() > 0) {
499+
foreach ($actorTypes as $actorType) {
500+
$actorType->delete();
501+
}
502+
}
503+
504+
// Add any new roles
505+
if (count($input['type_id']) > 0) {
506+
foreach ($input['type_id'] as $type_id) {
507+
if ($type_id == '0') continue;
508+
509+
$actorType = new Actor_Type;
510+
$actorType->actor_id = $input['actor_id'];
511+
$actorType->type_id = $type_id;
512+
513+
$this->save($actorType);
514+
}
515+
}
516+
517+
// Handle errors
518+
if ($this->errorCount() > 0) {
519+
Ajax::addErrors($this->getErrors());
520+
} else {
521+
$actor = Actor::find($input['actor_id']);
522+
523+
$main = $actor->toArray();
524+
$main['multi'] = $actor->types->id->toJson();
525+
526+
Ajax::setStatus('success')
527+
->addData('resource', $actor->types->toArray())
528+
->addData('main', $main);
529+
}
530+
531+
// Send the response
532+
return Ajax::sendResponse();
533+
}
534+
}
535+
398536
public function getTypes()
399537
{
400538
$types = Type::orderByNameAsc()->get();

0 commit comments

Comments
 (0)