This repository has been archived by the owner on Feb 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
48 changed files
with
2,119 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,42 @@ | ||
easy_admin: | ||
site_name: '<a href="/">Niners Brutal Admin</a>' | ||
site_name: '<a href="/admin">Niners Brutal Admin</a>' | ||
user: | ||
display_name: true | ||
display_avatar: true | ||
avatar_property_path: 'getAvatar' | ||
entities: | ||
- App\Entity\User | ||
- App\Entity\Team | ||
User: | ||
class: App\Entity\User | ||
Team: | ||
class: App\Entity\Team | ||
Course: | ||
class: App\Entity\Course | ||
list: | ||
fields: | ||
- 'id' | ||
- {property: 'image.name', label: 'Image', type: 'image', base_path: '/imagesRepository'} | ||
- 'name' | ||
- 'owner' | ||
- 'createdAt' | ||
Chapter: | ||
class: App\Entity\Chapter | ||
Image: | ||
class: App\Entity\Image | ||
list: | ||
fields: | ||
- 'id' | ||
- { property: 'name', type: 'image', base_path: '/imagesRepository' } | ||
- 'altName' | ||
- 'createdAt' | ||
- 'owner' | ||
show: | ||
fields: | ||
- { property: 'name', type: 'image', base_path: '/imagesRepository' } | ||
form: | ||
fields: | ||
- 'altName' | ||
- 'name' | ||
- { property: 'imageFile', type: 'file'} | ||
- 'owner' | ||
- 'createdAt' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
twig: | ||
default_path: '%kernel.project_dir%/templates' | ||
form_themes: ['bootstrap_4_layout.html.twig'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
vich_uploader: | ||
db_driver: orm | ||
|
||
#mappings: | ||
# products: | ||
# uri_prefix: /images/products | ||
# upload_destination: '%kernel.project_dir%/public/images/products' | ||
mappings: | ||
image: | ||
uri_prefix: /imagesRepository | ||
upload_destination: '%kernel.project_dir%/public/imagesRepository' | ||
namer: Vich\UploaderBundle\Naming\SmartUniqueNamer |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+367 KB
...imagesRepository/screenshot-from-2020-02-03-22-27-55-5e5e1da343bce427592309.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
$('.remove').click((e)=>{ | ||
e.preventDefault(); | ||
let el= $(e.target); | ||
$.ajax({ | ||
url: el.attr('href'), | ||
type:"delete", | ||
date:"", | ||
success: (r)=>{ | ||
console.log(r) | ||
el.parents('.row').fadeOut() | ||
}, | ||
error: (e)=>{ | ||
console.log(e) | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
$('.remove').click((e)=>{ | ||
e.preventDefault(); | ||
let el= $(e.target); | ||
$.ajax({ | ||
url: el.attr('href'), | ||
type:"delete", | ||
date:"", | ||
success: (r)=>{ | ||
console.log(r) | ||
el.parents('.col-lg-4').fadeOut() | ||
}, | ||
error: (e)=>{ | ||
console.log(e) | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
$('.remove').click((e)=>{ | ||
e.preventDefault(); | ||
let el= $(e.target); | ||
$.ajax({ | ||
url: el.attr('href'), | ||
type:"delete", | ||
date:"", | ||
success: (r)=>{ | ||
console.log(r) | ||
el.parents('.col-3').fadeOut() | ||
}, | ||
error: (e)=>{ | ||
console.log(e) | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace App\Controller; | ||
|
||
use App\Entity\Image; | ||
use Doctrine\ORM\EntityManagerInterface; | ||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; | ||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||
use Symfony\Component\HttpFoundation\JsonResponse; | ||
use Symfony\Component\Routing\Annotation\Route; | ||
|
||
class ApiImageController extends AbstractController | ||
{ | ||
/** | ||
* @Route("/api/image/{id}", name="api_image_remove", methods={"DELETE"}) | ||
*/ | ||
public function remove(Image $image=null, EntityManagerInterface $manager) | ||
{ | ||
if(!empty($image)){ | ||
try{ | ||
$manager->remove($image); | ||
$manager->flush(); | ||
return new JsonResponse('OK',200); | ||
} catch (\Exception $e){ | ||
return new JsonResponse($e->getMessage(),$e->getCode()); | ||
} | ||
} | ||
else | ||
return new JsonResponse('Image was not found',404); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace App\Controller; | ||
|
||
use App\Entity\Chapter; | ||
use App\Entity\Course; | ||
use Doctrine\ORM\EntityManagerInterface; | ||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||
use Symfony\Component\HttpFoundation\JsonResponse; | ||
use Symfony\Component\Routing\Annotation\Route; | ||
|
||
class ApiMoodleController extends AbstractController | ||
{ | ||
/** | ||
* @Route("/api/moodle/{id}", methods={"DELETE"}, name="api_moodle_course_remove") | ||
*/ | ||
public function removeCourse(Course $course = null, EntityManagerInterface $manager) | ||
{ | ||
if(!empty($course)){ | ||
try{ | ||
$manager->remove($course); | ||
$manager->flush(); | ||
return new JsonResponse('Course was removed',200); | ||
} catch(\Exception $e){ | ||
return new JsonResponse($e->getMessage(), $e->getCode()); | ||
} | ||
} | ||
else | ||
return new JsonResponse('Course wasnt found',404); | ||
} | ||
|
||
/** | ||
* @Route("/api/moodle/chapter/{id}", methods={"DELETE"}, name="api_moodle_chapter_remove") | ||
*/ | ||
public function removeChapter(Chapter $chapter = null, EntityManagerInterface $manager) | ||
{ | ||
if(!empty($chapter)){ | ||
try{ | ||
$manager->remove($chapter); | ||
$manager->flush(); | ||
return new JsonResponse('Chapter was removed',200); | ||
} catch(\Exception $e){ | ||
return new JsonResponse("Something bad happend. Becouse developer was lazy he wasnt write proper error log",500); | ||
} | ||
} | ||
else | ||
return new JsonResponse('Chapter wasnt found',404); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace App\Controller; | ||
|
||
use App\Entity\Team; | ||
use Doctrine\ORM\EntityManagerInterface; | ||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||
use Symfony\Component\HttpFoundation\JsonResponse; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\Routing\Annotation\Route; | ||
|
||
class ApiTeamController extends AbstractController | ||
{ | ||
/** | ||
* @Route("/api/team/{id}/changePoints", name="api_team_change_point") | ||
*/ | ||
public function changePoints(Team $team,Request $request, EntityManagerInterface $manager) | ||
{ | ||
if($team){ | ||
$points = (int)$request->request->get('points'); | ||
foreach ($team->getMembers() as $u){ | ||
$u->changeKarma($points); | ||
} | ||
$manager->flush(); | ||
return new JsonResponse('Karma of all team member was updated',200); | ||
} | ||
return new JsonResponse("Something bad happens. Because dev was lazy and under pressure he wasnt make proper error message",500); | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App\Controller; | ||
|
||
use App\Entity\User; | ||
use Doctrine\ORM\EntityManagerInterface; | ||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||
use Symfony\Component\HttpFoundation\JsonResponse; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\Routing\Annotation\Route; | ||
|
||
class ApiUserController extends AbstractController | ||
{ | ||
/** | ||
* @Route("/api/user/{id}/changePoints", name="api_user_change_points") | ||
*/ | ||
public function changePoint(User $user, Request $request, EntityManagerInterface $manager) | ||
{ | ||
if($user){ | ||
$points = (int)$request->request->get('points'); | ||
$user->changeKarma($points); | ||
$manager->flush($user); | ||
return new JsonResponse(['id'=>$user->getId(), "points"=>$user->getKarma()],200); | ||
} | ||
|
||
return new JsonResponse("Something bad happens. Because dev was lazy and under pressure he wasnt make proper error message",500); | ||
} | ||
} |
Oops, something went wrong.