This commit is contained in:
afornerot 2020-04-15 17:41:57 +02:00
parent aee20f238a
commit c9cdc83cd4
8 changed files with 149 additions and 40 deletions

View File

@ -11,9 +11,13 @@ use Symfony\Component\HttpKernel\KernelInterface;
use Doctrine\DBAL\Connection as DBALConnection; use Doctrine\DBAL\Connection as DBALConnection;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Id\AssignedGenerator;
use Cadoles\CoreBundle\Entity\Script; use Cadoles\CoreBundle\Entity\Script;
use Cadoles\CoreBundle\Entity\User; use Cadoles\CoreBundle\Entity\User;
use Cadoles\PortalBundle\Entity\Project; use Cadoles\PortalBundle\Entity\Project;
use Cadoles\PortalBundle\Entity\Pagewidget;
global $bdd01; global $bdd01;
global $config; global $config;
@ -102,7 +106,18 @@ class ScriptCommand extends Command
$this->writeln(""); $this->writeln("");
} }
$this->writeln(''); $script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"createwidgetproject"]);
if(!$script) {
$this->writelnred("== SCRIPT = createwidgetproject");
$this->createwidgetproject();
$script=new Script();
$script->setName("createwidgetproject");
$this->em->persist($script);
$this->em->flush();
$this->writeln("");
}
return 1; return 1;
} }
@ -188,7 +203,27 @@ class ScriptCommand extends Command
} }
} }
} }
}
private function createwidgetproject(){
$entityPage = $this->em->getRepository('CadolesPortalBundle:Page')->find(-110);
if($entityPage) {
$fields=["fields"=>[]];
$metadata = $this->em->getClassMetaData('CadolesPortalBundle:Pagewidget');
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_AUTO);
$pages=$this->em->getRepository('CadolesPortalBundle:Page')->findBy(["page"=>$entityPage]);
foreach($pages as $page) {
$this->addWidget2Page($page,-1800,"R1C1",1,"Taches du groupe",true,$fields);
}
$metadata = $this->em->getClassMetaData('CadolesPortalBundle:Pagewidget');
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
$this->addWidget(-145,$entityPage,-1800,"R1C1",1,"Taches du groupe",true,$fields);
}
} }
@ -270,5 +305,51 @@ class ScriptCommand extends Command
return $image; return $image;
} }
private function addWidget($id,$entityPage,$widgetid,$loc,$order,$title,$border,$fields) {
$entityPagewidget = $this->em->getRepository('CadolesPortalBundle:Pagewidget')->find($id);
if(!$entityPagewidget) {
$entityWidget = $this->em->getRepository('CadolesPortalBundle:Widget')->find($widgetid);
if($entityWidget) {
$entityPagewidget = new Pagewidget();
$entityPagewidget->setId($id);
$entityPagewidget->setLoc($loc);
$entityPagewidget->setRoworder($order);
$entityPagewidget->setName($title);
$entityPagewidget->setHeight($entityWidget->getHeight());
$entityPagewidget->setAutoajust($entityWidget->getAutoajust());
$entityPagewidget->setBorder($border);
$entityPagewidget->setOpened($entityWidget->getOpened());
$entityPagewidget->setIcon($entityWidget->getIcon());
$entityPagewidget->setPage($entityPage);
$entityPagewidget->setWidget($entityWidget);
$entityPagewidget->setParameter($fields);
$this->em->persist($entityPagewidget);
$this->em->flush();
}
}
}
private function addWidget2Page($entityPage,$widgetid,$loc,$order,$title,$border,$fields) {
$entityWidget = $this->em->getRepository('CadolesPortalBundle:Widget')->find($widgetid);
if($entityWidget) {
$entityPagewidget = $this->em->getRepository('CadolesPortalBundle:Pagewidget')->findOneBy(["page"=>$entityPage,"widget"=>$entityWidget]);
if(!$entityPagewidget) {
$entityPagewidget = new Pagewidget();
$entityPagewidget->setLoc($loc);
$entityPagewidget->setRoworder($order);
$entityPagewidget->setName($title);
$entityPagewidget->setHeight($entityWidget->getHeight());
$entityPagewidget->setAutoajust($entityWidget->getAutoajust());
$entityPagewidget->setBorder($border);
$entityPagewidget->setOpened($entityWidget->getOpened());
$entityPagewidget->setIcon($entityWidget->getIcon());
$entityPagewidget->setPage($entityPage);
$entityPagewidget->setWidget($entityWidget);
$entityPagewidget->setParameter($fields);
$this->em->persist($entityPagewidget);
$this->em->flush();
}
}
}
} }

View File

@ -910,7 +910,16 @@ class GroupController extends Controller
// si la page est lié qu'à un seul group on peut la supprimer // si la page est lié qu'à un seul group on peut la supprimer
if($groups->count()==1) if($groups->count()==1)
$em->remove($blog); $em->remove($blog);
} }
// Sur l'ensemble des project liés
$projects=$data->getProjects();
foreach($projects as $project) {
$groups=$blog->getGroups();
// si la page est lié qu'à un seul group on peut la supprimer
if($groups->count()==1)
$em->remove($project);
}
} }
$em->remove($data); $em->remove($data);

View File

@ -79,7 +79,7 @@ cadoles_core_config_file_download:
#-- Access user #-- Access user
cadoles_core_user_file_upload: cadoles_core_user_file_upload:
path: /user/config/file/upload/{id}/{type} path: /user/file/upload/{id}/{type}
defaults: { _controller: CadolesCoreBundle:File:upload, access: user } defaults: { _controller: CadolesCoreBundle:File:upload, access: user }
cadoles_core_user_file_delete: cadoles_core_user_file_delete:

View File

@ -452,7 +452,12 @@ a.item-heart {
text-align:center; text-align:center;
width: 100%; width: 100%;
} }
.grid .grid-small .grid-item-title h2 { font-size:10px; border-bottom: none; } .grid .grid-small .grid-item-title h2 {
font-size:10px;
border-bottom: none;
max-height: 55px;
overflow-y: hidden;
}
.grid .grid-small .grid-item-title span { display: none } .grid .grid-small .grid-item-title span { display: none }
@ -691,6 +696,8 @@ a.item-heart {
margin-left:50px; margin-left:50px;
cursor: pointer; cursor: pointer;
font-size: 1.5vw; font-size: 1.5vw;
height: 50px;
overflow-y: hidden;
} }
.widgetheader iframe, .widgetheader iframe,

View File

@ -41,6 +41,8 @@
} }
function closeModal() { function closeModal() {
window.parent.$("#mymodal").removeClass("in");
window.parent.$(".modal-backdrop").remove();
window.parent.$("#mymodal").modal('hide'); window.parent.$("#mymodal").modal('hide');
} }

View File

@ -1223,15 +1223,15 @@ class InitDataCommand extends ContainerAwareCommand
$em->remove($entityWidget); $em->remove($entityWidget);
} }
// Widget Project // Widget Tâche
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1800); $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1800);
if(!$entityWidget) $entityWidget = new Widget(); if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_check.png"]); $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_check.png"]);
$entityWidget->setId(-1800); $entityWidget->setId(-1800);
$entityWidget->setRoworder(0); $entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon); $entityWidget->setIcon($entityicon);
$entityWidget->setName('Projet'); $entityWidget->setName('Tâche');
$entityWidget->setDescription("Gestion de projet"); $entityWidget->setDescription("Gestion de projet par tâches");
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_project"); $entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_project");
$entityWidget->setHeight("630"); $entityWidget->setHeight("630");
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
@ -1380,6 +1380,10 @@ class InitDataCommand extends ContainerAwareCommand
$fields=["fields"=>[]]; $fields=["fields"=>[]];
$this->addWidget(-140,$entityPage,-1860,"R1C1",0,"Information Page",true,$fields); $this->addWidget(-140,$entityPage,-1860,"R1C1",0,"Information Page",true,$fields);
// Widget Tâche
$fields=["fields"=>[]];
$this->addWidget(-145,$entityPage,-1800,"R1C1",1,"Taches du groupe",true,$fields);
// Widget Notre Blog // Widget Notre Blog
$fields=["fields"=>[["id"=>"nbarticle","value"=>5]]]; $fields=["fields"=>[["id"=>"nbarticle","value"=>5]]];
$this->addWidget(-150,$entityPage,-1890,"R1C2",0,"Notre Blog",false,$fields); $this->addWidget(-150,$entityPage,-1890,"R1C2",0,"Notre Blog",false,$fields);

View File

@ -1476,7 +1476,7 @@ class PagewidgetController extends Controller
} }
elseif($fs->exists($directory."/thumbmini/".$tmp["name"])) { elseif($fs->exists($directory."/thumbmini/".$tmp["name"])) {
$data = file_get_contents($directory."/thumbmini/".$tmp["name"]); $data = file_get_contents($directory."/thumbmini/".$tmp["name"]);
$tmp["thumb"]=$data; $tmp["thumb"]="data:image/" . $tmp["extension"] . ";base64," . base64_encode($data);
} }
elseif($fs->exists($directory."/thumb/".$tmp["name"])) { elseif($fs->exists($directory."/thumb/".$tmp["name"])) {
$data = file_get_contents($directory."/thumb/".$tmp["name"]); $data = file_get_contents($directory."/thumb/".$tmp["name"]);

View File

@ -62,41 +62,47 @@
{% endif %} {% endif %}
<div class="grid-item-content" style="background-color:#{{ colortask }}"> <div class="grid-item-content" style="background-color:#{{ colortask }}">
<a href="{{ path('cadoles_portal_'~access~'_projecttask_view',{'id':projecttask.id}) }}"> <a href="{{ path('cadoles_portal_'~access~'_projecttask_view',{'id':projecttask.id}) }}">
<div class="item-link clearfix"> <div class="item-link clearfix">
<div class="grid-item-logo" style="height:55px;width:55px;"> <div class="grid-item-logo" style="height:55px;width:10%; text-align: center;">
{% if projecttask.user is empty %} {% if projecttask.user is empty %}
<img class='grid-item-img avatar' src="/{{ alias }}/uploads/avatar/{{ projecttask.owner.avatar }}" style="width:55px; height:55px"> <img class='grid-item-img avatar' src="/{{ alias }}/uploads/avatar/{{ projecttask.owner.avatar }}" style="width:55px; height:auto">
{% else %} {% else %}
<img class='grid-item-img avatar' src="/{{ alias }}/uploads/avatar/{{ projecttask.user.avatar }}" style="width:55px; height:55px"> <img class='grid-item-img avatar' src="/{{ alias }}/uploads/avatar/{{ projecttask.user.avatar }}" style="width:55px; height:auto">
{% endif %} {% endif %}
</div> </div>
<div class="grid-item-title"> <div class="grid-item-title" style="width:90%">
<h2 style="height:auto;line-height:18px;">{{projecttask.name }}</h2>
<small>Affectée à <h2 style="max-height: 40px; overflow-y: hidden;line-height:18px;">{{projecttask.name}}</h2>
{% if projecttask.user is empty %} <div class="pull-left" style="font-size:9px;">Affectée à
{{ projecttask.owner.username }} {% if projecttask.user is empty %}
{% else %} {{ projecttask.owner.username }}
{{ projecttask.user.username }} {% else %}
{% endif %} {{ projecttask.user.username }}
<br>Crée le {{ projecttask.submit|date("d/m/Y à H:i") }} {% endif %}
<br>Dans le project {{projecttask.project.name }}</small> <br>Crée le {{ projecttask.submit|date("d/m/Y à H:i") }}
<br>Dans le project {{projecttask.project.name }}
</div>
<div class="pull-right" style="margin-top:-5px; width:80px; text-align: center;">
<div style="font-size:35px; line-height:30px">
{{ projecttask.percentage }}<i style="font-size:12px">%</i>
</div>
</div>
<div class="pull-right" style="text-align: right; font-size:9px;">
Priorité = {{ projecttask.priority }}</br>
Avant le = {{ projecttask.end|date("d/m/Y") }}</br>
{% if projecttask.projecttasktag %}
Type = {{ projecttask.projecttasktag.name }}<br>
{% endif %}
{% if projecttask.projecttaskstatus %}
Statut = {{ projecttask.projecttaskstatus.name }}<br>
{% endif %}
</div>
</div> </div>
<div class="pull-right" style="width:80px; margin:5px 5px 0px 0px; text-align: center;">
<span style="font-size:10px;">Réalisé à</span><br>
<span style="font-size:35px; line-height:30px">{{ projecttask.percentage }}<span style="font-size:12px">%</span></span>
</div>
<div class="pull-right" style="margin:5px 5px 0px 0px; text-align: right; font-size:11px;">
Priorité = {{ projecttask.priority }}</br>
Avant le = {{ projecttask.end|date("d/m/Y") }}</br>
{% if projecttask.projecttasktag %}
Type = {{ projecttask.projecttasktag.name }}<br>
{% endif %}
{% if projecttask.projecttaskstatus %}
Statut = {{ projecttask.projecttaskstatus.name }}<br>
{% endif %}
</div>
</div> </div>
</a> </a>
</div> </div>