-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from H2-invent/feature/adhocMeeting
Feature/adhoc meeting
- Loading branch information
Showing
11 changed files
with
201 additions
and
36 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
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,63 @@ | ||
<?php | ||
|
||
namespace App\Controller; | ||
|
||
use App\Entity\Rooms; | ||
use App\Entity\Server; | ||
use App\Entity\User; | ||
use App\Service\RoomService; | ||
use App\Service\UserService; | ||
use phpDocumentor\Reflection\Types\This; | ||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; | ||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||
use Symfony\Component\HttpFoundation\Response; | ||
use Symfony\Component\Routing\Annotation\Route; | ||
use Symfony\Contracts\Translation\TranslatorInterface; | ||
|
||
class AdHocMeetingController extends AbstractController | ||
{ | ||
/** | ||
* @Route("/room/adhoc/meeting/{userId}/{serverId}", name="add_hoc_meeting") | ||
* @ParamConverter("user", class="App\Entity\User",options={"mapping": {"userId": "id"}}) | ||
* @ParamConverter("server", class="App\Entity\Server",options={"mapping": {"serverId": "id"}}) | ||
*/ | ||
public function index(User $user, Server $server, UserService $userService,TranslatorInterface $translator): Response | ||
{ | ||
|
||
if(!in_array($user,$this->getUser()->getAddressbook()->toArray())){ | ||
return $this->redirectToRoute('dashboard',array('snack'=>$translator->trans('Fehler, Der User wurde nicht gefunden'))); | ||
} | ||
$servers = $this->getUser()->getServers()->toarray(); | ||
$default = $this->getDoctrine()->getRepository(Server::class)->find($this->getParameter('default_jitsi_server_id')); | ||
|
||
if ($default && !in_array($default,$servers)) { | ||
$servers[] = $default; | ||
} | ||
|
||
if(!in_array($server,$servers)){ | ||
return $this->redirectToRoute('dashboard',array('snack'=>$translator->trans('Fehler, Der Server wurde nicht gefunden'))); | ||
} | ||
$room = new Rooms(); | ||
$room->setModerator($this->getUser()); | ||
$room->setStart(new \DateTime()); | ||
$room->setEnddate((new \DateTime())->modify('+ 1 hour')); | ||
$room->setDuration(60); | ||
$room->setSequence(0); | ||
$room->setUidReal(md5(uniqid())); | ||
$room->setUid(rand(01, 99) . time()); | ||
$room->setServer($server); | ||
$room->setName($translator->trans('Konferenz mit {n}',array('{n}'=>$user->getEmail()))); | ||
$room->setOnlyRegisteredUsers(false); | ||
$em = $this->getDoctrine()->getManager(); | ||
$em->persist($room); | ||
$em->flush(); | ||
$user->addRoom($room); | ||
$em->persist($user); | ||
$this->getUser()->addRoom($room); | ||
$em->persist($this->getUser()); | ||
$em->flush(); | ||
$userService->addUser($user,$room); | ||
$userService->addUser($this->getUser(),$room); | ||
return $this->redirectToRoute('dashboard',array('snack'=>$translator->trans('Konferenz erfolgreich erstellt'))); | ||
} | ||
} |
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
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
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
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