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\ORM\EntityManager;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Id\AssignedGenerator;
use Cadoles\CoreBundle\Entity\Script;
use Cadoles\CoreBundle\Entity\User;
use Cadoles\PortalBundle\Entity\Project;
use Cadoles\PortalBundle\Entity\Pagewidget;
global $bdd01;
global $config;
@ -102,7 +106,18 @@ class ScriptCommand extends Command
$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;
}
@ -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;
}
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

@ -911,6 +911,15 @@ class GroupController extends Controller
if($groups->count()==1)
$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);

View File

@ -79,7 +79,7 @@ cadoles_core_config_file_download:
#-- Access user
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 }
cadoles_core_user_file_delete:

View File

@ -452,7 +452,12 @@ a.item-heart {
text-align:center;
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 }
@ -691,6 +696,8 @@ a.item-heart {
margin-left:50px;
cursor: pointer;
font-size: 1.5vw;
height: 50px;
overflow-y: hidden;
}
.widgetheader iframe,

View File

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

View File

@ -1223,15 +1223,15 @@ class InitDataCommand extends ContainerAwareCommand
$em->remove($entityWidget);
}
// Widget Project
// Widget Tâche
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1800);
if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_check.png"]);
$entityWidget->setId(-1800);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Projet');
$entityWidget->setDescription("Gestion de projet");
$entityWidget->setName('Tâche');
$entityWidget->setDescription("Gestion de projet par tâches");
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_project");
$entityWidget->setHeight("630");
$entityWidget->setAutoajust(true);
@ -1380,6 +1380,10 @@ class InitDataCommand extends ContainerAwareCommand
$fields=["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
$fields=["fields"=>[["id"=>"nbarticle","value"=>5]]];
$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"])) {
$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"])) {
$data = file_get_contents($directory."/thumb/".$tmp["name"]);

View File

@ -62,32 +62,35 @@
{% endif %}
<div class="grid-item-content" style="background-color:#{{ colortask }}">
<a href="{{ path('cadoles_portal_'~access~'_projecttask_view',{'id':projecttask.id}) }}">
<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 %}
<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 %}
<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 %}
</div>
<div class="grid-item-title">
<h2 style="height:auto;line-height:18px;">{{projecttask.name }}</h2>
<small>Affectée à
<div class="grid-item-title" style="width:90%">
<h2 style="max-height: 40px; overflow-y: hidden;line-height:18px;">{{projecttask.name}}</h2>
<div class="pull-left" style="font-size:9px;">Affectée à
{% if projecttask.user is empty %}
{{ projecttask.owner.username }}
{% else %}
{{ projecttask.user.username }}
{% endif %}
<br>Crée le {{ projecttask.submit|date("d/m/Y à H:i") }}
<br>Dans le project {{projecttask.project.name }}</small>
<br>Dans le project {{projecttask.project.name }}
</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 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="margin:5px 5px 0px 0px; text-align: right; font-size:11px;">
<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 %}
@ -97,6 +100,9 @@
Statut = {{ projecttask.projecttaskstatus.name }}<br>
{% endif %}
</div>
</div>
</div>
</a>
</div>