Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e2494797e | |||
| 69a7595966 | |||
| e404b4d876 | |||
| fa8b21b93c | |||
| 8e8312c0f9 | |||
| 0297191e07 | |||
| e64ce55b66 | |||
| eda0562edc | |||
| 01f5823885 | |||
| 9ed2745e8d | |||
| 82c4911770 | |||
| 8df9b7af43 | |||
| 71259c40c6 | |||
| 2dd559fa64 | |||
| 90ae12995f | |||
| 7aa4a92cb6 | |||
| 6a9b48d629 |
@@ -66,6 +66,10 @@
|
||||
title="Modifier">
|
||||
<i class="fa fa-pencil-square-o" aria-hidden="true"></i>
|
||||
</a>
|
||||
<a href="{{ path('admin_ad_refresh_img',{'id':ad.id}) }}" data-toggle="tooltip"
|
||||
title="Mise à jour image vimeo">
|
||||
<i class="fa fa-picture-o" aria-hidden="true"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
<link rel="stylesheet" href="{{ asset('admin/AdminLTE/dist/css/AdminLTE.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('admin/AdminLTE/dist/css/skins/skin-blue.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('admin/AdminLTE/plugins/datatables/dataTables.bootstrap.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('admin/AdminLTE/plugins/datatables/dataTables.bootstrap.css') }}">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.2/jquery-confirm.min.css">
|
||||
<script type="text/javascript" defer="defer" src="https://extend.vimeocdn.com/ga/64189815.js"></script>
|
||||
|
||||
{% block css %}
|
||||
|
||||
@@ -58,6 +58,10 @@
|
||||
style="margin-left: 5px;">
|
||||
<i class="fa fa-cart-plus" aria-hidden="true"></i>
|
||||
</a>
|
||||
<a href="{{ path('admin_company_refresh_img',{'id':company.id}) }}" data-toggle="tooltip"
|
||||
title="Mise à jour image vimeo">
|
||||
<i class="fa fa-picture-o" aria-hidden="true"></i>
|
||||
</a>
|
||||
{% if is_granted('ROLE_ALLOWED_TO_SWITCH') %}
|
||||
<a href="{{ path('company_dashboard',{'_switch_user':company.MainUser.username}) }}"
|
||||
data-toggle="tooltip" title="Se connecter avec ce compte"
|
||||
@@ -88,7 +92,7 @@
|
||||
"language": {
|
||||
"url": "https://cdn.datatables.net/plug-ins/1.10.11/i18n/French.json"
|
||||
},
|
||||
"order": [[1, 'desc']],
|
||||
"order": [[0, 'desc']],
|
||||
"columnDefs": [
|
||||
{"targets": 0, "searchable": true, "orderable": true},
|
||||
{"targets": 1, "searchable": true, "orderable": true},
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
{"targets": 4, "searchable": true, "orderable": true, "className": "text-center"},
|
||||
{"targets": 5, "searchable": false, "orderable": false, "className": "text-center"},
|
||||
],
|
||||
"order": [[1, "asc"]]
|
||||
"order": [[0, "desc"]]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
{{ form_row(form.emphasisOrder) }}
|
||||
{{ form_row(form.brandName) }}
|
||||
{{ form_row(form.description) }}
|
||||
{{ form_row(form.descriptionAdmin) }}
|
||||
{{ form_row(form.website) }}
|
||||
{{ form_row(form.tagsComma) }}
|
||||
{{ form_row(form.file) }}
|
||||
@@ -60,11 +61,24 @@
|
||||
</div>
|
||||
{{ form_end(form) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
<link rel="stylesheet" href="{{ asset('codemirror/lib/codemirror.css') }}">
|
||||
{% endblock %}
|
||||
{% block javascripts %}
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('[data-toggle="popover"]').popover();
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
<script src="{{ asset('codemirror/lib/codemirror.js') }}"></script>
|
||||
<script src="{{ asset('codemirror/mode/xml/xml.js') }}"></script>
|
||||
<script src="{{ asset('codemirror/mode/javascript/javascript.js') }}"></script>
|
||||
<script src="{{ asset('codemirror/mode/css/css.js') }}"></script>
|
||||
<script src="{{ asset('codemirror/mode/vbscript/vbscript.js') }}"></script>
|
||||
<script src="{{ asset('codemirror/mode/htmlmixed/htmlmixed.js') }}"></script>
|
||||
<script>
|
||||
var myCodeMirror = CodeMirror.fromTextArea(document.getElementById('territory_admin_descriptionAdmin'), {
|
||||
lineNumbers: true,
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -100,7 +100,7 @@
|
||||
{"targets": 3, "searchable": true, "orderable": true, "className": "text-center"},
|
||||
{"targets": 4, "searchable": false, "orderable": false, "className": "text-center"},
|
||||
],
|
||||
"order": [[1, "asc"]]
|
||||
"order": [[0, "desc"]]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
{% extends 'admin/base_admin.html.twig' %}
|
||||
|
||||
|
||||
{% block contentHeader %}
|
||||
<h1>
|
||||
Utilisateurs
|
||||
<small>Liste</small>
|
||||
</h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ path('admin_dashboard') }}"><i class="fa fa-dashboard"></i> Dashboard</a></li>
|
||||
<li class="active">Utilisateurs</li>
|
||||
</ol>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
<table id="user_list_table" class="table table-hover table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nom</th>
|
||||
<th>Prénom</th>
|
||||
<th class="col-md-3">Email</th>
|
||||
<th>Etat</th>
|
||||
<th>Roles</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for u in users %}
|
||||
<tr>
|
||||
<td>{{ u.lastname }}</td>
|
||||
<td>{{ u.firstname }}</td>
|
||||
<td>{{ u.email }}</td>
|
||||
<td>{% if u.enabled %} Activé
|
||||
{% else %} Désactivé <br />
|
||||
<a href="{{ path('admin_user_resend',{'id':u.id}) }}">Renvoyer le mail de confirmation</a>
|
||||
{% endif %}</td>
|
||||
<td>
|
||||
{% for r in u.roles %}
|
||||
{% if r != "ROLE_USER" %}
|
||||
<span class="badge bg-blue" style="font-weight: 400;">{{ r }}</span>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td>
|
||||
<a class="delete-user" href="{{ path('admin_user_delete',{'id':u.id}) }}" data-toggle="tooltip"
|
||||
title="Supprimer">
|
||||
<i class="fa fa-trash"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block javascripts %}
|
||||
<script>
|
||||
$(function () {
|
||||
$('#user_list_table').DataTable({
|
||||
"paging": true,
|
||||
"lengthChange": true,
|
||||
"searching": true,
|
||||
"ordering": true,
|
||||
"info": true,
|
||||
"autoWidth": false,
|
||||
"language": {
|
||||
"url": "https://cdn.datatables.net/plug-ins/1.10.11/i18n/French.json"
|
||||
},
|
||||
"columnDefs": [
|
||||
{"targets": 0, "searchable": true, "orderable": true},
|
||||
{"targets": 1, "searchable": true, "orderable": true},
|
||||
{"targets": 2, "searchable": true, "orderable": true},
|
||||
{"targets": 3, "searchable": true, "orderable": true, "className": "text-center"},
|
||||
{"targets": 4, "searchable": false, "orderable": false, "className": "text-center"},
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
$('[data-toggle="popover"]').popover();
|
||||
|
||||
$(".delete-user").confirm({
|
||||
title: "Êtes vous sûr de supprimer cet utilisateur ?",
|
||||
content: "Supprimer cet utilisateur supprimera, son compte, son entreprise, ses réponses, médias",
|
||||
type: 'red',
|
||||
boxWidth: '30%',
|
||||
useBootstrap: false,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: 'Confirmer',
|
||||
action: function(){
|
||||
console.log(this.$target);
|
||||
location.href = this.$target.attr('href');
|
||||
return true;
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
text: 'Annuler',
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
@@ -35,13 +35,17 @@
|
||||
<div class="col s12 m12 l8 xl9">
|
||||
{% if ad.video and ad.status != "CLOSED" %}
|
||||
<div class="row m-b-0" id="adVideo">
|
||||
<div class="embed-responsive embed-responsive-16by9">
|
||||
<div class="col s12">
|
||||
<iframe src="https://player.vimeo.com/video/{{ ad.video.cdnUrl|replace({ "/videos/": ""}) }}"
|
||||
width="100%" height="640" frameborder="0" webkitallowfullscreen mozallowfullscreen
|
||||
allowfullscreen></iframe>
|
||||
{% if ad.id == 38 %}
|
||||
<img class="responsive-img" src="{{asset('/img/GROUPE-ROCHER-TT.jpg')}}">
|
||||
{% else %}
|
||||
<div class="embed-responsive embed-responsive-16by9">
|
||||
<div class="col s12">
|
||||
<iframe src="https://player.vimeo.com/video/{{ ad.video.cdnUrl|replace({ "/videos/": ""}) }}"
|
||||
width="100%" height="640" frameborder="0" webkitallowfullscreen mozallowfullscreen
|
||||
allowfullscreen></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if ad.isPromoted %}
|
||||
<div class="isPromoted"><img src="{{asset('/img/offre-pourvue-gauche.png')}}" alt="promoted"></div>
|
||||
{% endif %}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
{# VIDEO #}
|
||||
<div class="col l12 m12 s12 home-content col-noPadding">
|
||||
<div id="homeTeaser" class="valign-wrapper">
|
||||
<h1 class="white-text center-align">1er job board <span>100% vidéo</span></h1><br />
|
||||
<h1 class="white-text center-align">1ère plateforme pour l’emploi <span>100% vidéo</span></h1><br />
|
||||
<div class="link-home-head">
|
||||
<a data-target="modal_concept" href="#!" class="btn btn-default btn-round btn-concept modal-trigger">
|
||||
Le concept en vidéo
|
||||
|
||||
@@ -95,6 +95,17 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if company.descriptionAdmin %}
|
||||
<div class="col s12 m12 l8 xl9 right">
|
||||
<div class="row bg-bordered">
|
||||
<div class="col s12">
|
||||
<div class="item-detail-description-bo">
|
||||
<p>{{ company.descriptionAdmin|raw }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if companyAds|length > 0 %}
|
||||
<div id="offers" class="row">
|
||||
<div class="col s12">
|
||||
|
||||
@@ -40,4 +40,5 @@ assetic:
|
||||
- 'js/vendors/typeahead.js'
|
||||
- 'js/company.js'
|
||||
- 'js/backend.js'
|
||||
- 'js/tags.js'
|
||||
- 'js/tags.js'
|
||||
- 'js/vendors/jquery-confirm.min.js'
|
||||
@@ -185,8 +185,8 @@ hwi_oauth:
|
||||
#csrf: true
|
||||
linkedin:
|
||||
type: linkedin
|
||||
client_id: 781kj3gww936c2
|
||||
client_secret: HB9Zdx42s7RPLUqm
|
||||
client_id: 86m6hegwyj8lbo
|
||||
client_secret: LIOibqDszsP2vQSr
|
||||
infos_url: "https://api.linkedin.com/v1/people/~:(id,first-name,last-name,location,email-address,picture-urls::(original))?format=json"
|
||||
options:
|
||||
#csrf: true
|
||||
|
||||
@@ -10,7 +10,6 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
|
||||
class AdController extends Controller
|
||||
{
|
||||
|
||||
@@ -111,7 +110,6 @@ class AdController extends Controller
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Route("/admin/config/ad/{id}/edit", name="admin_ad_edit")
|
||||
*/
|
||||
@@ -130,6 +128,16 @@ class AdController extends Controller
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/admin/config/ad/{id}/refresh-img", name="admin_ad_refresh_img")
|
||||
*/
|
||||
public function adminAdRefreshImgAction(Request $request, Ad $ad)
|
||||
{
|
||||
$mediaManager = $this->get('media_manager');
|
||||
$mediaManager->getThumbnails($ad, true);
|
||||
return $this->redirectToRoute('admin_ad_list');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/admin/config/ad/{id}/show", name="admin_ad_show")
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,6 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
|
||||
class CompanyController extends Controller
|
||||
{
|
||||
|
||||
@@ -88,4 +87,14 @@ class CompanyController extends Controller
|
||||
'newP' => $newsP,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/admin/config/company/{id}/refresh-img", name="admin_company_refresh_img")
|
||||
*/
|
||||
public function adminCompanyRefreshImgAction(Request $request, Company $company)
|
||||
{
|
||||
$mediaManager = $this->get('media_manager');
|
||||
$mediaManager->getThumbnails($company, true);
|
||||
return $this->redirectToRoute('admin_config_company');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
namespace AppBundle\Controller\Admin;
|
||||
|
||||
use AppBundle\Entity\Company;
|
||||
use AppBundle\Entity\Media;
|
||||
use AppBundle\Entity\Answer;
|
||||
use AppBundle\Entity\Message;
|
||||
use AppBundle\Entity\Bookmark;
|
||||
use AppBundle\Form\Admin\TalentAdminType;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
@@ -43,4 +47,112 @@ class TalentController extends Controller
|
||||
'talent' => $talent,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Route("/admin/config/user/list", name="admin_config_user")
|
||||
*/
|
||||
public function adminUserListAction(Request $request)
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$t = $em->getRepository('AppBundle:User')->findByRole('ROLE_TALENT');
|
||||
|
||||
|
||||
return $this->render('admin/users_list.html.twig', array(
|
||||
'users' => $t,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/admin/config/user/{id}/resend", name="admin_user_resend")
|
||||
*/
|
||||
public function adminUserResendAction(Request $request, $id)
|
||||
{
|
||||
$userManager = $this->get('fos_user.user_manager');;
|
||||
$user = $userManager->findUserBy(array('id' => $id));
|
||||
$mailer = $this->get('fos_user.mailer');
|
||||
$mailer->sendConfirmationEmailMessage($user);
|
||||
|
||||
return $this->redirectToRoute('admin_config_user');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Route("/admin/config/user/{id}/delete", name="admin_user_delete")
|
||||
*/
|
||||
public function adminUserDeleteAction(Request $request, $id)
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$t = $em->getRepository('AppBundle:User')->findByRole('ROLE_TALENT');
|
||||
|
||||
$userManager = $this->get('fos_user.user_manager');;
|
||||
$user = $userManager->findUserBy(array('id' => $id));
|
||||
if(\is_null($user)) {
|
||||
// user not found, generate $notFoundResponse
|
||||
$this->addFlash(
|
||||
'notice',
|
||||
' user not found !'
|
||||
);
|
||||
}
|
||||
|
||||
\assert(!\is_null($user));
|
||||
$company = $user->getCompany();
|
||||
if($company){
|
||||
$company->setPresentationVideo(null);
|
||||
}
|
||||
$this->deleteRelation($user);
|
||||
$userManager->deleteUser($user);
|
||||
if($company){
|
||||
$em->remove($company);
|
||||
}
|
||||
$em->flush();
|
||||
|
||||
return $this->redirectToRoute('admin_config_user');
|
||||
}
|
||||
|
||||
public function deleteRelation($user) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$answers = $em->getRepository('AppBundle:Answer')->findBy(array('user' => $user));
|
||||
$medias = $em->getRepository('AppBundle:Media')->findBy(array('creator'=> $user));
|
||||
$sendMessage = $em->getRepository('AppBundle:Message')->findBy(array('sender'=> $user));
|
||||
$recipMessage = $em->getRepository('AppBundle:Message')->findBy(array('recipient'=> $user));
|
||||
$bookmarks = $em->getRepository('AppBundle:Bookmark')->findBy(array('creator'=> $user));
|
||||
|
||||
if ($sendMessage) {
|
||||
foreach ($sendMessage as $key => $message) {
|
||||
$message->setSender(null);
|
||||
$message->setAnswer(null);
|
||||
}
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
if ($recipMessage) {
|
||||
foreach ($recipMessage as $key => $message) {
|
||||
$message->setRecipient(null);
|
||||
$message->setAnswer(null);
|
||||
}
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
if ($bookmarks) {
|
||||
foreach ($bookmarks as $key => $bookmark) {
|
||||
$em->remove($bookmark);
|
||||
}
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
if ($answers) {
|
||||
foreach ($answers as $key => $answer) {
|
||||
$em->remove($answer);
|
||||
}
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
if ($medias) {
|
||||
foreach ($medias as $key => $media) {
|
||||
$em->remove($media);
|
||||
}
|
||||
$em->flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,13 @@ class Company
|
||||
*/
|
||||
private $description;
|
||||
|
||||
/**
|
||||
* @var text
|
||||
*
|
||||
* @ORM\Column(name="description_admin", type="text", length=255, nullable=true)
|
||||
*/
|
||||
private $descriptionAdmin;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
@@ -774,4 +781,28 @@ class Company
|
||||
{
|
||||
return $this->spontaneousApplications;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set descriptionAdmin.
|
||||
*
|
||||
* @param string|null $descriptionAdmin
|
||||
*
|
||||
* @return Company
|
||||
*/
|
||||
public function setDescriptionAdmin($descriptionAdmin = null)
|
||||
{
|
||||
$this->descriptionAdmin = $descriptionAdmin;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get descriptionAdmin.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getDescriptionAdmin()
|
||||
{
|
||||
return $this->descriptionAdmin;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,14 +13,15 @@ namespace AppBundle\Form\Admin;
|
||||
|
||||
use AppBundle\Entity\Company;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CountryType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\UrlType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Form\Extension\Core\Type\UrlType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CountryType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
|
||||
class TerritoryAdminType extends AbstractType
|
||||
{
|
||||
@@ -32,6 +33,7 @@ class TerritoryAdminType extends AbstractType
|
||||
$builder
|
||||
->add('brandName', TextType::class, array('label' => 'Nom'))
|
||||
->add('description', TextType::class, array('label' => 'profile.company.description', 'required' => false))
|
||||
->add('descriptionAdmin', TextareaType::class, array('label' => 'Description additionel réservé aux administrateur (Attention contenu affiché en front)', 'required' => false))
|
||||
->add('website', UrlType::class, array(
|
||||
'label' => 'profile.company.website',
|
||||
'required' => false,
|
||||
|
||||
@@ -12,4 +12,14 @@ use Doctrine\ORM\EntityRepository;
|
||||
*/
|
||||
class UserRepository extends EntityRepository
|
||||
{
|
||||
public function findByRole($role)
|
||||
{
|
||||
$qb = $this->_em->createQueryBuilder();
|
||||
$qb->select('u')
|
||||
->from($this->_entityName, 'u')
|
||||
->where('u.roles LIKE :roles')
|
||||
->setParameter('roles', '%"'.$role.'"%');
|
||||
|
||||
return $qb->getQuery()->getResult();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,21 +28,19 @@ class MediaManager
|
||||
$this->env = $env;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Rename video to vimeo
|
||||
*/
|
||||
|
||||
public function editName($video)
|
||||
{
|
||||
if($video){
|
||||
$response = $this->vimeo->request($video->getCdnUrl(), ['name'=>$video->getTitle()], 'PATCH');
|
||||
return array('success' => "true",'data' => $response);
|
||||
} else {
|
||||
public function editName($video)
|
||||
{
|
||||
if ($video) {
|
||||
$response = $this->vimeo->request($video->getCdnUrl(), ['name' => $video->getTitle()], 'PATCH');
|
||||
return array('success' => "true", 'data' => $response);
|
||||
} else {
|
||||
return array('success' => "false");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $entity
|
||||
@@ -50,7 +48,7 @@ class MediaManager
|
||||
*
|
||||
* Get Thumbnail of a video (Ad or Company)
|
||||
*/
|
||||
public function getThumbnails($entity)
|
||||
public function getThumbnails($entity, $force = false)
|
||||
{
|
||||
if ($entity instanceof Ad) {
|
||||
$video = $entity->getVideo();
|
||||
@@ -62,11 +60,11 @@ class MediaManager
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
if($video){
|
||||
if ($video) {
|
||||
$arrayThumb = $video->getThumbnails();
|
||||
if (empty($arrayThumb[0])) {
|
||||
if ($force == true || empty($arrayThumb[0])) {
|
||||
$response = $this->vimeo->request($video->getCdnUrl() . '/pictures', [], 'GET');
|
||||
if(!isset($response['body']['error'])){
|
||||
if (!isset($response['body']['error'])) {
|
||||
$video->setThumbnails($response['body']['data']);
|
||||
$this->em->persist($video);
|
||||
$this->em->flush();
|
||||
@@ -84,9 +82,9 @@ class MediaManager
|
||||
{
|
||||
$video = $entity;
|
||||
if (unlink($this->mediaVideoDir . $video->getOriginalUrl())) {
|
||||
if ( $this->env != "dev" ) {
|
||||
if ($this->env != "dev") {
|
||||
$response = $this->vimeo->request($video->getCdnUrl(), [], 'DELETE');
|
||||
}
|
||||
}
|
||||
$this->em->remove($video);
|
||||
$this->em->flush();
|
||||
|
||||
@@ -126,12 +124,12 @@ class MediaManager
|
||||
$metadata = array();
|
||||
//@TODO: trouver un fix pour la duration
|
||||
/*if($extension != "mkv"){
|
||||
$duration = $this->ffprobe->format($filePath)->get('duration');
|
||||
$metadata['duration'] = $duration;
|
||||
$duration = $this->ffprobe->format($filePath)->get('duration');
|
||||
$metadata['duration'] = $duration;
|
||||
}*/
|
||||
$thumbnails = array();
|
||||
//PUSH VIDEO TO Vimeo
|
||||
if ( $this->env == "dev" ) {
|
||||
//PUSH VIDEO TO Vimeo
|
||||
if ($this->env == "dev") {
|
||||
$uriVimeo = "/videos/215657518";
|
||||
$nameVimeo = "name";
|
||||
$linkVimeo = "/videos/215657518";
|
||||
@@ -143,8 +141,8 @@ class MediaManager
|
||||
$nameVimeo = $response['body']['name'];
|
||||
$linkVimeo = $response['body']['link'];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//SAVE MEDIA
|
||||
$media->setCreator($creator);
|
||||
$media->setTitle($fileName);
|
||||
@@ -157,15 +155,15 @@ class MediaManager
|
||||
$this->em->persist($media);
|
||||
if (!is_null($entity)) {
|
||||
if ($entity instanceof Answer) {
|
||||
if ($entity->getAd() == null){
|
||||
$media->setTitle("Candidature pour : ".$entity->getCompany()->getBrandName());
|
||||
if ($entity->getAd() == null) {
|
||||
$media->setTitle("Candidature pour : " . $entity->getCompany()->getBrandName());
|
||||
} else {
|
||||
$media->setTitle("Video réponse à : ".$entity->getAd()->getTitle());
|
||||
$media->setTitle("Video réponse à : " . $entity->getAd()->getTitle());
|
||||
}
|
||||
$entity->setVideo($media);
|
||||
$this->em->persist($entity);
|
||||
} elseif ($entity instanceof Ad) {
|
||||
$media->setTitle("Video annonce de : ".$entity->getTitle());
|
||||
$media->setTitle("Video annonce de : " . $entity->getTitle());
|
||||
$entity->setVideo($media);
|
||||
$this->em->persist($entity);
|
||||
} elseif ($entity instanceof User) {
|
||||
@@ -175,7 +173,7 @@ class MediaManager
|
||||
$this->em->persist($entity);
|
||||
}
|
||||
} else {
|
||||
$media->setTitle("Vidéo ".$creator->getLastname()." ".$creator->getFirstname());
|
||||
$media->setTitle("Vidéo " . $creator->getLastname() . " " . $creator->getFirstname());
|
||||
}
|
||||
if ($creator->getCompany()->getType() == "TALENT") {
|
||||
$media->setStatus("TO_MODERATE");
|
||||
@@ -187,14 +185,14 @@ class MediaManager
|
||||
'filename' => $media->getTitle(),
|
||||
'originalFilename' => $uploadedFile->getClientOriginalName(),
|
||||
'uriVimeo' => str_replace('videos', 'video', $uriVimeo),
|
||||
'mediaId' => $media->getId()
|
||||
'mediaId' => $media->getId(),
|
||||
);
|
||||
} else {
|
||||
$message = array('success' => 500,
|
||||
'message' => "Error Upload"
|
||||
'message' => "Error Upload",
|
||||
);
|
||||
}
|
||||
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 545 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 546 KiB |
Reference in New Issue
Block a user