indicateurs (ref #156)
This commit is contained in:
parent
a379e52dea
commit
dfe6a90673
|
@ -48,7 +48,6 @@ class PurgeFileCommand extends Command
|
|||
// Le script est-il executé via Cron:Exec
|
||||
$this->byexec = $input->getArgument('byexec');
|
||||
if($this->byexec=="") $this->byexec=false;
|
||||
echo "pouet".$this->byexec;
|
||||
|
||||
$this->writelnred('');
|
||||
$this->writelnred('== Core:PurgeFile');
|
||||
|
|
|
@ -0,0 +1,281 @@
|
|||
<?php
|
||||
namespace Cadoles\CoreBundle\Command;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\HttpFoundation\File\File;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use Doctrine\DBAL\Connection as DBALConnection;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Symfony\Component\Validator\Constraints\DateTime;
|
||||
|
||||
use Cadoles\CoreBundle\Entity\Statistic;
|
||||
|
||||
use function GuzzleHttp\json_encode;
|
||||
|
||||
class StatisticCommand extends Command
|
||||
{
|
||||
private $container;
|
||||
private $em;
|
||||
private $output;
|
||||
private $filesystem;
|
||||
private $rootlog;
|
||||
private $byexec;
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('Core:Statistic')
|
||||
->setDescription('Calculate Statistic')
|
||||
->setHelp('This command Calculate Statistic')
|
||||
->addArgument('cronid', InputArgument::OPTIONAL, 'ID Cron Job')
|
||||
->addArgument('lastchance', InputArgument::OPTIONAL, 'Lastchance to run the cron')
|
||||
->addArgument('byexec', InputArgument::OPTIONAL, 'By Cron:Exec')
|
||||
;
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$this->container = $this->getApplication()->getKernel()->getContainer();
|
||||
$this->em = $this->container->get('doctrine')->getEntityManager();
|
||||
$this->output = $output;
|
||||
$this->filesystem = new Filesystem();
|
||||
$this->rootlog = $this->container->get('kernel')->getRootDir()."/../var/logs/";
|
||||
$alias = $this->container->getParameter('alias');
|
||||
|
||||
// Le script est-il executé via Cron:Exec
|
||||
$this->byexec = $input->getArgument('byexec');
|
||||
if($this->byexec=="") $this->byexec=false;
|
||||
|
||||
$this->writelnred('');
|
||||
$this->writelnred('== Core:Statistic');
|
||||
$this->writelnred('==========================================================================================================');
|
||||
|
||||
$now=new \DateTime('now');
|
||||
$yesterday=clone $now;
|
||||
$yesterday->sub(new \DateInterval('P1D'));
|
||||
$groups=$this->em->getRepository("CadolesCoreBundle:Group")->findBy(["fgcanshare"=>true]);
|
||||
|
||||
// totcptvisite
|
||||
$this->writelnred('');
|
||||
$this->writelnred('== totcptvisite');
|
||||
|
||||
$stat=$this->em->getRepository("CadolesCoreBundle:Statistic")->findOneBy(["keyvalue"=>"totcptvisite"]);
|
||||
if(!$stat) {
|
||||
$stat=new Statistic();
|
||||
$stat->setKeyvalue("totcptvisite");
|
||||
$stat->setValue([]);
|
||||
}
|
||||
$value=$stat->getValue();
|
||||
$cpt= $this->em->createQueryBuilder()
|
||||
->select('SUM(user.visitecpt) as cpt')
|
||||
->from('CadolesCoreBundle:User','user')
|
||||
->getQuery()->getOneOrNullResult();
|
||||
$value[$now->format("Y-m-d")]=($cpt["cpt"]?$cpt["cpt"]:0);
|
||||
$stat->setValue($value);
|
||||
$this->em->persist($stat);
|
||||
$this->em->flush();
|
||||
|
||||
// totcptvisitegroup
|
||||
$this->writelnred('');
|
||||
$this->writelnred('== totcptvisitegroup');
|
||||
|
||||
$stat=$this->em->getRepository("CadolesCoreBundle:Statistic")->findOneBy(["keyvalue"=>"totcptvisitegroup"]);
|
||||
if(!$stat) {
|
||||
$stat=new Statistic();
|
||||
$stat->setKeyvalue("totcptvisitegroup");
|
||||
$stat->setValue([]);
|
||||
}
|
||||
$value=$stat->getValue();
|
||||
$cpt= $this->em->createQueryBuilder()
|
||||
->select('SUM(usergroup.visitecpt) as cpt')
|
||||
->from('CadolesCoreBundle:UserGroup','usergroup')
|
||||
->getQuery()->getOneOrNullResult();
|
||||
$value[$now->format("Y-m-d")]=($cpt["cpt"]?$cpt["cpt"]:0);
|
||||
$stat->setValue($value);
|
||||
$this->em->persist($stat);
|
||||
$this->em->flush();
|
||||
|
||||
// totcptmessage
|
||||
$this->writelnred('');
|
||||
$this->writelnred('== totcptmessage');
|
||||
|
||||
$stat=$this->em->getRepository("CadolesCoreBundle:Statistic")->findOneBy(["keyvalue"=>"totcptmessage"]);
|
||||
if(!$stat) {
|
||||
$stat=new Statistic();
|
||||
$stat->setKeyvalue("totcptmessage");
|
||||
$stat->setValue([]);
|
||||
}
|
||||
$value=$stat->getValue();
|
||||
$cpt= $this->em->createQueryBuilder()
|
||||
->select('COUNT(message.id) as cpt')
|
||||
->from('CadolesWebsocketBundle:Message','message')
|
||||
->getQuery()->getOneOrNullResult();
|
||||
$value[$now->format("Y-m-d")]=($cpt["cpt"]?$cpt["cpt"]:0);
|
||||
$stat->setValue($value);
|
||||
$this->em->persist($stat);
|
||||
$this->em->flush();
|
||||
|
||||
// totcptblogarticle
|
||||
$this->writelnred('');
|
||||
$this->writelnred('== totcptblogarticle');
|
||||
|
||||
$stat=$this->em->getRepository("CadolesCoreBundle:Statistic")->findOneBy(["keyvalue"=>"totcptblogarticle"]);
|
||||
if(!$stat) {
|
||||
$stat=new Statistic();
|
||||
$stat->setKeyvalue("totcptblogarticle");
|
||||
$stat->setValue([]);
|
||||
}
|
||||
$value=$stat->getValue();
|
||||
$cpt= $this->em->createQueryBuilder()
|
||||
->select('COUNT(blogarticle.id) as cpt')
|
||||
->from('CadolesPortalBundle:Blogarticle','blogarticle')
|
||||
->getQuery()->getOneOrNullResult();
|
||||
$value[$now->format("Y-m-d")]=($cpt["cpt"]?$cpt["cpt"]:0);
|
||||
$stat->setValue($value);
|
||||
$this->em->persist($stat);
|
||||
$this->em->flush();
|
||||
|
||||
// totcptprojecttask
|
||||
$this->writelnred('');
|
||||
$this->writelnred('== totcptprojecttask');
|
||||
|
||||
$stat=$this->em->getRepository("CadolesCoreBundle:Statistic")->findOneBy(["keyvalue"=>"totcptprojecttask"]);
|
||||
if(!$stat) {
|
||||
$stat=new Statistic();
|
||||
$stat->setKeyvalue("totcptprojecttask");
|
||||
$stat->setValue([]);
|
||||
}
|
||||
$value=$stat->getValue();
|
||||
$cpt= $this->em->createQueryBuilder()
|
||||
->select('COUNT(projecttask.id) as cpt')
|
||||
->from('CadolesPortalBundle:Projecttask','projecttask')
|
||||
->getQuery()->getOneOrNullResult();
|
||||
$value[$now->format("Y-m-d")]=($cpt["cpt"]?$cpt["cpt"]:0);
|
||||
$stat->setValue($value);
|
||||
$this->em->persist($stat);
|
||||
$this->em->flush();
|
||||
|
||||
// groupcptvisite
|
||||
$this->writelnred('');
|
||||
$this->writelnred('== groupcptvisite');
|
||||
|
||||
foreach($groups as $group) {
|
||||
$stat=$this->em->getRepository("CadolesCoreBundle:Statistic")->findOneBy(["keyvalue"=>"groupcptvisite","group"=>$group]);
|
||||
if(!$stat) {
|
||||
$stat=new Statistic();
|
||||
$stat->setKeyvalue("groupcptvisite");
|
||||
$stat->setValue([]);
|
||||
$stat->setGroup($group);
|
||||
}
|
||||
$value=$stat->getValue();
|
||||
$cpt= $this->em->createQueryBuilder()
|
||||
->select(['SUM(usergroup.visitecpt) as cpt'])
|
||||
->from('CadolesCoreBundle:UserGroup','usergroup')
|
||||
->Where('usergroup.group=:group')
|
||||
->setParameter('group', $group)
|
||||
->getQuery()->getOneOrNullResult();
|
||||
$value[$now->format("Y-m-d")]=($cpt["cpt"]?$cpt["cpt"]:0);
|
||||
$stat->setValue($value);
|
||||
$this->em->persist($stat);
|
||||
$this->em->flush();
|
||||
}
|
||||
|
||||
// groupcptmessage
|
||||
$this->writelnred('');
|
||||
$this->writelnred('== groupcptmessage');
|
||||
|
||||
foreach($groups as $group) {
|
||||
$stat=$this->em->getRepository("CadolesCoreBundle:Statistic")->findOneBy(["keyvalue"=>"groupcptmessage","group"=>$group]);
|
||||
if(!$stat) {
|
||||
$stat=new Statistic();
|
||||
$stat->setKeyvalue("groupcptmessage");
|
||||
$stat->setValue([]);
|
||||
$stat->setGroup($group);
|
||||
}
|
||||
$value=$stat->getValue();
|
||||
$cpt= $this->em->createQueryBuilder()
|
||||
->select('COUNT(message.id) as cpt')
|
||||
->from('CadolesWebsocketBundle:Message','message')
|
||||
->Where('message.group=:group')
|
||||
->setParameter('group', $group)
|
||||
->getQuery()->getOneOrNullResult();
|
||||
$value[$now->format("Y-m-d")]=($cpt["cpt"]?$cpt["cpt"]:0);
|
||||
$stat->setValue($value);
|
||||
$this->em->persist($stat);
|
||||
$this->em->flush();
|
||||
}
|
||||
|
||||
// groupcptblogarticle
|
||||
$this->writelnred('');
|
||||
$this->writelnred('== groupcptblogarticle');
|
||||
|
||||
foreach($groups as $group) {
|
||||
$stat=$this->em->getRepository("CadolesCoreBundle:Statistic")->findOneBy(["keyvalue"=>"groupcptblogarticle","group"=>$group]);
|
||||
if(!$stat) {
|
||||
$stat=new Statistic();
|
||||
$stat->setKeyvalue("groupcptblogarticle");
|
||||
$stat->setValue([]);
|
||||
$stat->setGroup($group);
|
||||
}
|
||||
$value=$stat->getValue();
|
||||
$cpt= $this->em->createQueryBuilder()
|
||||
->select('COUNT(blogarticle.id) as cpt')
|
||||
->from('CadolesPortalBundle:Blogarticle','blogarticle')
|
||||
->from('CadolesPortalBundle:Blog','blog')
|
||||
->Where('blogarticle.blog=blog')
|
||||
->andwhere(":group MEMBER OF blog.groups")
|
||||
->setParameter('group', $group)
|
||||
->getQuery()->getOneOrNullResult();
|
||||
$value[$now->format("Y-m-d")]=($cpt["cpt"]?$cpt["cpt"]:0);
|
||||
$stat->setValue($value);
|
||||
$this->em->persist($stat);
|
||||
$this->em->flush();
|
||||
}
|
||||
|
||||
// groupcptprojecttask
|
||||
$this->writelnred('');
|
||||
$this->writelnred('== groupcptprojecttask');
|
||||
|
||||
foreach($groups as $group) {
|
||||
$stat=$this->em->getRepository("CadolesCoreBundle:Statistic")->findOneBy(["keyvalue"=>"groupcptprojecttask","group"=>$group]);
|
||||
if(!$stat) {
|
||||
$stat=new Statistic();
|
||||
$stat->setKeyvalue("groupcptprojecttask");
|
||||
$stat->setValue([]);
|
||||
$stat->setGroup($group);
|
||||
}
|
||||
$value=$stat->getValue();
|
||||
$cpt= $this->em->createQueryBuilder()
|
||||
->select('COUNT(projecttask.id) as cpt')
|
||||
->from('CadolesPortalBundle:Projecttask','projecttask')
|
||||
->from('CadolesPortalBundle:Project','project')
|
||||
->Where('projecttask.project=project')
|
||||
->andwhere(":group MEMBER OF project.groups")
|
||||
->setParameter('group', $group)
|
||||
->getQuery()->getOneOrNullResult();
|
||||
$value[$now->format("Y-m-d")]=($cpt["cpt"]?$cpt["cpt"]:0);
|
||||
$stat->setValue($value);
|
||||
$this->em->persist($stat);
|
||||
$this->em->flush();
|
||||
}
|
||||
|
||||
$this->writeln('');
|
||||
return 1;
|
||||
}
|
||||
|
||||
private function writelnred($string) {
|
||||
$this->output->writeln('<fg=red>'.$string.'</>');
|
||||
$this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
|
||||
if($this->byexec) $this->filesystem->appendToFile($this->rootlog.'exec.log', $string."\n");
|
||||
}
|
||||
private function writeln($string) {
|
||||
$this->output->writeln($string);
|
||||
$this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
|
||||
if($this->byexec) $this->filesystem->appendToFile($this->rootlog.'exec.log', $string."\n");
|
||||
}
|
||||
}
|
|
@ -127,28 +127,28 @@ class GroupController extends Controller
|
|||
->setParameter("value", "%".$search["value"]."%");
|
||||
}
|
||||
switch($order[0]["column"]) {
|
||||
case 1 :
|
||||
case 2 :
|
||||
$qb->orderBy('table.label',$order[0]["dir"]);
|
||||
break;
|
||||
case 2 :
|
||||
case 3 :
|
||||
$qb->orderBy('table.fgopen',$order[0]["dir"]);
|
||||
break;
|
||||
case 4 :
|
||||
case 5 :
|
||||
$qb->orderBy('table.fgcanshare',$order[0]["dir"]);
|
||||
break;
|
||||
case 5 :
|
||||
case 6 :
|
||||
$qb->orderBy('table.owner',$order[0]["dir"]);
|
||||
break;
|
||||
case 6 :
|
||||
case 7 :
|
||||
$qb->orderBy('table.fgcancreatepage',$order[0]["dir"]);
|
||||
break;
|
||||
case 7 :
|
||||
case 8 :
|
||||
$qb->orderBy('table.fgcancreatecalendar',$order[0]["dir"]);
|
||||
break;
|
||||
case 8 :
|
||||
case 9 :
|
||||
$qb->orderBy('table.fgcancreateblog',$order[0]["dir"]);
|
||||
break;
|
||||
case 9 :
|
||||
case 10 :
|
||||
$qb->orderBy('table.fgcancreateproject',$order[0]["dir"]);
|
||||
break;
|
||||
}
|
||||
|
@ -174,6 +174,8 @@ class GroupController extends Controller
|
|||
if($data->getId()>0&&!$data->getFgall()&&!$data->getFgTemplate()&&$this->isGranted('ROLE_ADMIN')) $action.="<a href='".$this->generateUrl('cadoles_core_config_group_delete', array('id'=>$data->getId()))."'><i class='fa fa-trash fa-fw fa-2x'></i></a>";
|
||||
if(!$data->getFgall()) $action .="<a href='".$this->generateUrl('cadoles_core_config_group_users', array('id'=>$data->getId()))."'><i class='fa fa-users fa-2x fa-fw'></i></a>";
|
||||
|
||||
if($data->getFgcanshare())
|
||||
$action.="<a href='".$this->generateUrl('cadoles_core_'.$access.'_group_statistic', array('id'=>$data->getId()))."'><i class='fa fa-bar-chart-o fa-fw fa-2x'></i></a>";
|
||||
}
|
||||
else {
|
||||
$fgproprio=($user==$data->getOwner());
|
||||
|
@ -190,9 +192,11 @@ class GroupController extends Controller
|
|||
$action .="<a href='".$this->generateUrl('cadoles_core_'.$access.'_group_users', array('id'=>$data->getId()))."'><i class='fa fa-users fa-2x fa-fw'></i></a>";
|
||||
}
|
||||
else {
|
||||
$action.="<a href='".$this->generateUrl('cadoles_core_'.$access.'_group_out', array('id'=>$data->getId()))."' data-method='out'><i class='fa fa-sign-out fa-fw fa-2x'></i></a>";
|
||||
$action.="<a href='".$this->generateUrl('cadoles_core_'.$access.'_group_out', array('id'=>$data->getId()))."'><i class='fa fa-sign-out fa-fw fa-2x'></i></a>";
|
||||
}
|
||||
|
||||
if($data->getFgcanshare())
|
||||
$action.="<a href='".$this->generateUrl('cadoles_core_'.$access.'_group_statistic', array('id'=>$data->getId()))."'><i class='fa fa-bar-chart-o fa-fw fa-2x'></i></a>";
|
||||
}
|
||||
|
||||
|
||||
|
@ -200,14 +204,22 @@ class GroupController extends Controller
|
|||
if($this->GetParameter("masteridentity")=="LDAP") $filtre=$data->getLdapfilter();
|
||||
if($this->GetParameter("masteridentity")=="SSO") $filtre=$data->getAttributes();
|
||||
|
||||
if ($data->getIcon())
|
||||
$groupinfo = "<img src='/".$this->container->getParameter('alias')."/".$data->getIcon()->getLabel()."' class='avatar' style='background-color:transparent'/>";
|
||||
else
|
||||
$groupinfo = "<img src='/".$this->container->getParameter('alias')."/uploads/icon/icon_pin.png' class='avatar' style='background-color:transparent'/>";
|
||||
|
||||
$userinfo="";
|
||||
if($data->getOwner()) {
|
||||
$userinfo.="<img style='cursor:pointer' onClick='seeUser(".$data->getOwner()->getId().")' src='/".$this->container->getParameter('alias')."/uploads/avatar/".$data->getOwner()->getAvatar()."' class='avatar' style='margin:0px 5px 0px 0px;display:inline-block;'>";
|
||||
$userinfo.=$data->getOwner()->getUsername();
|
||||
$userinfo.="<br>".$data->getOwner()->getUsername();
|
||||
}
|
||||
|
||||
|
||||
|
||||
array_push($output["data"],array(
|
||||
$action,
|
||||
$groupinfo,
|
||||
$data->getLabel(),
|
||||
($data->getFgopen()?"oui":"non"),
|
||||
$filtre,
|
||||
|
@ -1067,6 +1079,36 @@ class GroupController extends Controller
|
|||
return $response;
|
||||
}
|
||||
|
||||
public function statisticAction($id,$access) {
|
||||
$group=$this->getData($id);
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
if(!$group) throw $this->createNotFoundException('Permission denied');
|
||||
|
||||
if($access!="config") {
|
||||
$usergroup=$em->getRepository("CadolesCoreBundle:UserGroup")->findOneBy(["user"=>$this->getUser(),"group"=>$group]);
|
||||
if(!$usergroup) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
$groupcptvisite=$em->getRepository("CadolesCoreBundle:Statistic")->findOneBy(["keyvalue"=>"groupcptvisite","group"=>$group]);
|
||||
$groupcptmessage=$em->getRepository("CadolesCoreBundle:Statistic")->findOneBy(["keyvalue"=>"groupcptmessage","group"=>$group]);
|
||||
$groupcptblogarticle=$em->getRepository("CadolesCoreBundle:Statistic")->findOneBy(["keyvalue"=>"groupcptblogarticle","group"=>$group]);
|
||||
$groupcptprojecttask=$em->getRepository("CadolesCoreBundle:Statistic")->findOneBy(["keyvalue"=>"groupcptprojecttask","group"=>$group]);
|
||||
|
||||
|
||||
return $this->render('CadolesCoreBundle:Group:statistic.html.twig',[
|
||||
'useheader' => true,
|
||||
'usemenu' => false,
|
||||
'usesidebar' => ($access=="config"),
|
||||
'access' => $access,
|
||||
'group' => $group,
|
||||
'groupcptvisite' => $groupcptvisite,
|
||||
'groupcptmessage' => $groupcptmessage,
|
||||
'groupcptblogarticle' => $groupcptblogarticle,
|
||||
'groupcptprojecttask' => $groupcptprojecttask,
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
protected function canManager($group,$access) {
|
||||
if($access!="config") {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
<?php
|
||||
|
||||
namespace Cadoles\CoreBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
use Cadoles\PortalBundle\Entity\Page;
|
||||
|
||||
class StatisticController extends Controller
|
||||
{
|
||||
public function listAction(Request $request)
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
$totcptvisite=$em->getRepository("CadolesCoreBundle:Statistic")->findOneBy(["keyvalue"=>"totcptvisite"]);
|
||||
$totcptvisitegroup=$em->getRepository("CadolesCoreBundle:Statistic")->findOneBy(["keyvalue"=>"totcptvisitegroup"]);
|
||||
$totcptmessage=$em->getRepository("CadolesCoreBundle:Statistic")->findOneBy(["keyvalue"=>"totcptmessage"]);
|
||||
$totcptblogarticle=$em->getRepository("CadolesCoreBundle:Statistic")->findOneBy(["keyvalue"=>"totcptblogarticle"]);
|
||||
$totcptprojecttask=$em->getRepository("CadolesCoreBundle:Statistic")->findOneBy(["keyvalue"=>"totcptprojecttask"]);
|
||||
|
||||
//groupcptvisite
|
||||
$statistics=$em->getRepository("CadolesCoreBundle:Statistic")->findBy(["keyvalue"=>"groupcptvisite"]);
|
||||
$groupcptvisite=[];
|
||||
foreach($statistics as $statistic) {
|
||||
$value=$statistic->getValue();
|
||||
$tmp=[
|
||||
"id" => $statistic->getGroup()->getId(),
|
||||
"name" => $statistic->getGroup()->getLabel(),
|
||||
"value" => end($value),
|
||||
];
|
||||
array_push($groupcptvisite,$tmp);
|
||||
}
|
||||
usort($groupcptvisite, function($a, $b) {
|
||||
return $a['value'] <=> $b['value'];
|
||||
});
|
||||
$topgroupcptvisite = array_slice($groupcptvisite, -20);
|
||||
|
||||
//groupcptmessage
|
||||
$statistics=$em->getRepository("CadolesCoreBundle:Statistic")->findBy(["keyvalue"=>"groupcptmessage"]);
|
||||
$groupcptmessage=[];
|
||||
foreach($statistics as $statistic) {
|
||||
$value=$statistic->getValue();
|
||||
$tmp=[
|
||||
"id" => $statistic->getGroup()->getId(),
|
||||
"name" => $statistic->getGroup()->getLabel(),
|
||||
"value" => end($value),
|
||||
];
|
||||
array_push($groupcptmessage,$tmp);
|
||||
}
|
||||
usort($groupcptmessage, function($a, $b) {
|
||||
return $a['value'] <=> $b['value'];
|
||||
});
|
||||
$topgroupcptmessage = array_slice($groupcptmessage, -20);
|
||||
|
||||
//groupcptblogarticle
|
||||
$statistics=$em->getRepository("CadolesCoreBundle:Statistic")->findBy(["keyvalue"=>"groupcptblogarticle"]);
|
||||
$groupcptblogarticle=[];
|
||||
foreach($statistics as $statistic) {
|
||||
$value=$statistic->getValue();
|
||||
$tmp=[
|
||||
"id" => $statistic->getGroup()->getId(),
|
||||
"name" => $statistic->getGroup()->getLabel(),
|
||||
"value" => end($value),
|
||||
];
|
||||
array_push($groupcptblogarticle,$tmp);
|
||||
}
|
||||
usort($groupcptblogarticle, function($a, $b) {
|
||||
return $a['value'] <=> $b['value'];
|
||||
});
|
||||
$topgroupcptblogarticle = array_slice($groupcptblogarticle, -20);
|
||||
|
||||
//groupcptprojecttask
|
||||
$statistics=$em->getRepository("CadolesCoreBundle:Statistic")->findBy(["keyvalue"=>"groupcptprojecttask"]);
|
||||
$groupcptprojecttask=[];
|
||||
foreach($statistics as $statistic) {
|
||||
$value=$statistic->getValue();
|
||||
$tmp=[
|
||||
"id" => $statistic->getGroup()->getId(),
|
||||
"name" => $statistic->getGroup()->getLabel(),
|
||||
"value" => end($value),
|
||||
];
|
||||
array_push($groupcptprojecttask,$tmp);
|
||||
}
|
||||
usort($groupcptprojecttask, function($a, $b) {
|
||||
return $a['value'] <=> $b['value'];
|
||||
});
|
||||
$topgroupcptprojecttask = array_slice($groupcptprojecttask, -20);
|
||||
|
||||
|
||||
|
||||
return $this->render('CadolesCoreBundle:Statistic:list.html.twig',[
|
||||
'useheader' => true,
|
||||
'usemenu' => false,
|
||||
'usesidebar' => true,
|
||||
'totcptvisite' => $totcptvisite,
|
||||
'totcptvisitegroup' => $totcptvisitegroup,
|
||||
'totcptmessage' => $totcptmessage,
|
||||
'totcptblogarticle' => $totcptblogarticle,
|
||||
'totcptprojecttask' => $totcptprojecttask,
|
||||
'groupcptvisite' => $topgroupcptvisite,
|
||||
'groupcptmessage' => $topgroupcptmessage,
|
||||
'groupcptblogarticle' => $topgroupcptblogarticle,
|
||||
'groupcptprojecttask' => $topgroupcptprojecttask,
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -176,6 +176,10 @@ class Group
|
|||
*/
|
||||
protected $messages;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Statistic", mappedBy="group", cascade={"persist"}, orphanRemoval=true)
|
||||
*/
|
||||
private $statistics;
|
||||
|
||||
// Champs temporaire
|
||||
protected $nosynconly;
|
||||
|
@ -1018,4 +1022,38 @@ class Group
|
|||
{
|
||||
return $this->fgcancreateproject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add statistic
|
||||
*
|
||||
* @param \Cadoles\CoreBundle\Entity\Statistic $statistic
|
||||
*
|
||||
* @return Group
|
||||
*/
|
||||
public function addStatistic(\Cadoles\CoreBundle\Entity\Statistic $statistic)
|
||||
{
|
||||
$this->statistics[] = $statistic;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove statistic
|
||||
*
|
||||
* @param \Cadoles\CoreBundle\Entity\Statistic $statistic
|
||||
*/
|
||||
public function removeStatistic(\Cadoles\CoreBundle\Entity\Statistic $statistic)
|
||||
{
|
||||
$this->statistics->removeElement($statistic);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get statistics
|
||||
*
|
||||
* @return \Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getStatistics()
|
||||
{
|
||||
return $this->statistics;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,118 @@
|
|||
<?php
|
||||
namespace Cadoles\CoreBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="statistic")
|
||||
*/
|
||||
class Statistic
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string")
|
||||
*/
|
||||
protected $keyvalue;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(type="array", nullable=true)
|
||||
*/
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Group", inversedBy="statistics")
|
||||
* @ORM\JoinColumn(name="group_id", referencedColumnName="id", nullable=true)
|
||||
*/
|
||||
private $group;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set keyvalue
|
||||
*
|
||||
* @param string $keyvalue
|
||||
*
|
||||
* @return Statistic
|
||||
*/
|
||||
public function setKeyvalue($keyvalue)
|
||||
{
|
||||
$this->keyvalue = $keyvalue;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get keyvalue
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getKeyvalue()
|
||||
{
|
||||
return $this->keyvalue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set value
|
||||
*
|
||||
* @param array $value
|
||||
*
|
||||
* @return Statistic
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set group
|
||||
*
|
||||
* @param \Cadoles\CoreBundle\Entity\Group $group
|
||||
*
|
||||
* @return Statistic
|
||||
*/
|
||||
public function setGroup(\Cadoles\CoreBundle\Entity\Group $group = null)
|
||||
{
|
||||
$this->group = $group;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get group
|
||||
*
|
||||
* @return \Cadoles\CoreBundle\Entity\Group
|
||||
*/
|
||||
public function getGroup()
|
||||
{
|
||||
return $this->group;
|
||||
}
|
||||
}
|
|
@ -372,6 +372,10 @@ cadoles_core_config_group_users:
|
|||
path: /config/group/users/{id}
|
||||
defaults: { _controller: CadolesCoreBundle:Group:users, access: config }
|
||||
|
||||
cadoles_core_config_group_statistic:
|
||||
path: /config/group/statistic/{id}
|
||||
defaults: { _controller: CadolesCoreBundle:Group:statistic, access: config }
|
||||
|
||||
cadoles_core_config_group_ajax_usersnotin:
|
||||
path: /config/group/ajax/usersnotin/{id}
|
||||
defaults: { _controller: CadolesCoreBundle:Group:ajaxusersnotin, access: config }
|
||||
|
@ -421,6 +425,10 @@ cadoles_core_user_group_users:
|
|||
path: /user/group/users/{id}
|
||||
defaults: { _controller: CadolesCoreBundle:Group:users, access: user }
|
||||
|
||||
cadoles_core_user_group_statistic:
|
||||
path: /user/group/statistic/{id}
|
||||
defaults: { _controller: CadolesCoreBundle:Group:statistic, access: user }
|
||||
|
||||
cadoles_core_user_group_out:
|
||||
path: /user/group/out/{id}
|
||||
defaults: { _controller: CadolesCoreBundle:Group:out, access: user }
|
||||
|
@ -471,8 +479,10 @@ cadoles_core_config_whitelist_ajax_list:
|
|||
path: /config/whitelist/ajax/list
|
||||
defaults: { _controller: CadolesCoreBundle:Whitelist:ajaxlist }
|
||||
|
||||
|
||||
|
||||
#== Statistic =============================================================================================================
|
||||
cadoles_core_config_statistic:
|
||||
path: /config/statistic
|
||||
defaults: { _controller: CadolesCoreBundle:Statistic:list }
|
||||
|
||||
#== REST ==================================================================================================================
|
||||
cadoles_core_rest_user:
|
||||
|
|
|
@ -31,13 +31,14 @@
|
|||
<table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="130px" class="no-sort">Action</th>
|
||||
<th width="160px" class="no-sort">Action</th>
|
||||
<th class="no-sort text-center">Icone</th>
|
||||
<th>Label</th>
|
||||
<th>Ouvert</th>
|
||||
<th class="no-sort {% if masteridentity=="SQL" %} no-visible {% endif %}">Filtre</th>
|
||||
{% if portal_activate %}
|
||||
<th>Groupe de Travail</th>
|
||||
<th>Propriétaire</th>
|
||||
<th class="text-center">Propriétaire</th>
|
||||
{% if access=="config" %}
|
||||
<th>Création Pages</th>
|
||||
<th>Création Calendriers</th>
|
||||
|
@ -57,10 +58,10 @@
|
|||
{% block localjavascript %}
|
||||
$(document).ready(function() {
|
||||
$('#dataTables').DataTable({
|
||||
columnDefs: [ { "targets": 'no-sort', "orderable": false },{ "targets": 'no-visible', "visible": false } ],
|
||||
columnDefs: [ { "targets": 'no-sort', "orderable": false },{ "targets": 'no-visible', "visible": false },{"targets": "text-center", "className": "text-center"} ],
|
||||
responsive: true,
|
||||
iDisplayLength: 100,
|
||||
order: [[ 1, "asc" ]],
|
||||
order: [[ 2, "asc" ]],
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
ajax: "{{ path('cadoles_core_'~access~'_group_ajax_list') }}",
|
||||
|
|
|
@ -0,0 +1,131 @@
|
|||
{% extends '@CadolesCore/base.html.twig' %}
|
||||
|
||||
{% block pagewrapper %}
|
||||
<h1 class="page-header">Statistiques {{ group.label }}</h1>
|
||||
<a class="btn btn-default" href={{ path('cadoles_core_'~access~'_group') }}>Fermer</a>
|
||||
<br><br>
|
||||
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-table fa-fw"></i> Compteur de visites journalière
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="groupcptvisite"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col col-md-6">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-table fa-fw"></i> Evolution du nombre de message dans les tchat
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="groupcptmessage"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col col-md-6">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-table fa-fw"></i> Evolution du nombre d'articles de blog
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="groupcptblogarticle"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col col-md-6">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-table fa-fw"></i> Evolution du nombre de tâches
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="groupcptprojecttask"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block localjavascript %}
|
||||
$(document).ready(function() {
|
||||
groupcptvisite();
|
||||
groupcptmessage();
|
||||
groupcptblogarticle();
|
||||
groupcptprojecttask();
|
||||
|
||||
$(window).resize(function() {
|
||||
window.groupcptvisite.redraw();
|
||||
window.groupcptmessage.redraw();
|
||||
window.groupcptblogarticle.redraw();
|
||||
window.groupcptprojecttask.redraw();
|
||||
});
|
||||
});
|
||||
|
||||
function groupcptvisite() {
|
||||
window.groupcptvisite = Morris.Area({
|
||||
element: 'groupcptvisite',
|
||||
data: [
|
||||
{% set before = 0 %}
|
||||
{% for date, cpt in groupcptvisite.value %}
|
||||
{% set now = cpt - before %}
|
||||
{% set before = cpt %}
|
||||
{ x: '{{ date }}', a: {{ now }} }{% if not loop.last %},{%endif%}
|
||||
{% endfor %}
|
||||
],
|
||||
xkey: 'x',
|
||||
ykeys: ['a'],
|
||||
labels: ['Nombre de visites']
|
||||
});
|
||||
}
|
||||
|
||||
function groupcptmessage() {
|
||||
window.groupcptmessage = Morris.Area({
|
||||
element: 'groupcptmessage',
|
||||
data: [
|
||||
{% for date, cpt in groupcptmessage.value %}
|
||||
{ x: '{{ date }}', a: {{ cpt }} }{% if not loop.last %},{%endif%}
|
||||
{% endfor %}
|
||||
],
|
||||
xkey: 'x',
|
||||
ykeys: ['a'],
|
||||
labels: ['Nombre total de messages tchat']
|
||||
});
|
||||
}
|
||||
|
||||
function groupcptblogarticle() {
|
||||
window.groupcptblogarticle = Morris.Area({
|
||||
element: 'groupcptblogarticle',
|
||||
data: [
|
||||
{% for date, cpt in groupcptblogarticle.value %}
|
||||
{ x: '{{ date }}', a: {{ cpt }} }{% if not loop.last %},{%endif%}
|
||||
{% endfor %}
|
||||
],
|
||||
xkey: 'x',
|
||||
ykeys: ['a'],
|
||||
labels: ["Nombre total d'articles de blog"]
|
||||
});
|
||||
}
|
||||
|
||||
function groupcptprojecttask() {
|
||||
window.groupcptprojecttask = Morris.Area({
|
||||
element: 'groupcptprojecttask',
|
||||
data: [
|
||||
{% for date, cpt in groupcptprojecttask.value %}
|
||||
{ x: '{{ date }}', a: {{ cpt }} }{% if not loop.last %},{%endif%}
|
||||
{% endfor %}
|
||||
],
|
||||
xkey: 'x',
|
||||
ykeys: ['a'],
|
||||
labels: ["Nombre total de tâches"]
|
||||
});
|
||||
}
|
||||
{% endblock %}
|
|
@ -0,0 +1,263 @@
|
|||
{% extends '@CadolesCore/base.html.twig' %}
|
||||
|
||||
{% block pagewrapper %}
|
||||
<h1 class="page-header">Statistiques</h1>
|
||||
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-table fa-fw"></i> Compteur de visites journalière
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="totcptvisite"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-table fa-fw"></i> Compteur de visites journalière des groupes de travail
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="totcptvisitegroup"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col col-md-6">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-table fa-fw"></i> Evolution du nombre de message dans les tchat
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="totcptmessage"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col col-md-6">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-table fa-fw"></i> Evolution du nombre d'articles de blog
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="totcptblogarticle"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col col-md-6">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-table fa-fw"></i> Evolution du nombre de tâches
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="totcptprojecttask"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col col-md-6">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-table fa-fw"></i> TOP 20 des groupes les plus visités
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="groupcptvisite"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col col-md-6">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-table fa-fw"></i> TOP 20 des groupes avec le plus de messages chat
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="groupcptmessage"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col col-md-6">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-table fa-fw"></i> TOP 20 des groupes avec le plus d'articles de blog
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="groupcptblogarticle"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col col-md-6">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-table fa-fw"></i> TOP 20 des groupes avec le plus de tâches
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="groupcptprojecttask"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block localjavascript %}
|
||||
$(document).ready(function() {
|
||||
totcptvisite();
|
||||
totcptvisitegroup();
|
||||
totcptmessage();
|
||||
totcptblogarticle();
|
||||
totcptprojecttask();
|
||||
groupcptvisite();
|
||||
groupcptmessage();
|
||||
groupcptblogarticle();
|
||||
groupcptprojecttask();
|
||||
|
||||
$(window).resize(function() {
|
||||
window.totcptvisite.redraw();
|
||||
window.totcptvisitegroup.redraw();
|
||||
window.totcptmessage.redraw();
|
||||
window.totcptblogarticle.redraw();
|
||||
window.totcptprojecttask.redraw();
|
||||
});
|
||||
});
|
||||
|
||||
function totcptvisite() {
|
||||
window.totcptvisite = Morris.Area({
|
||||
element: 'totcptvisite',
|
||||
data: [
|
||||
{% set before = 0 %}
|
||||
{% for date, cpt in totcptvisite.value %}
|
||||
{% set now = cpt - before %}
|
||||
{% set before = cpt %}
|
||||
{ x: '{{ date }}', a: {{ now }} }{% if not loop.last %},{%endif%}
|
||||
{% endfor %}
|
||||
],
|
||||
xkey: 'x',
|
||||
ykeys: ['a'],
|
||||
labels: ['Nombre de visites']
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function totcptvisitegroup() {
|
||||
window.totcptvisitegroup = Morris.Area({
|
||||
element: 'totcptvisitegroup',
|
||||
data: [
|
||||
{% set before = 0 %}
|
||||
{% for date, cpt in totcptvisitegroup.value %}
|
||||
{% set now = cpt - before %}
|
||||
{% set before = cpt %}
|
||||
{ x: '{{ date }}', a: {{ now }} }{% if not loop.last %},{%endif%}
|
||||
{% endfor %}
|
||||
],
|
||||
xkey: 'x',
|
||||
ykeys: ['a'],
|
||||
labels: ['Nombre de visites des groupes']
|
||||
});
|
||||
}
|
||||
|
||||
function totcptmessage() {
|
||||
window.totcptmessage = Morris.Area({
|
||||
element: 'totcptmessage',
|
||||
data: [
|
||||
{% for date, cpt in totcptmessage.value %}
|
||||
{ x: '{{ date }}', a: {{ cpt }} }{% if not loop.last %},{%endif%}
|
||||
{% endfor %}
|
||||
],
|
||||
xkey: 'x',
|
||||
ykeys: ['a'],
|
||||
labels: ['Nombre total de messages tchat']
|
||||
});
|
||||
}
|
||||
|
||||
function totcptblogarticle() {
|
||||
window.totcptblogarticle = Morris.Area({
|
||||
element: 'totcptblogarticle',
|
||||
data: [
|
||||
{% for date, cpt in totcptblogarticle.value %}
|
||||
{ x: '{{ date }}', a: {{ cpt }} }{% if not loop.last %},{%endif%}
|
||||
{% endfor %}
|
||||
],
|
||||
xkey: 'x',
|
||||
ykeys: ['a'],
|
||||
labels: ["Nombre total d'articles de blog"]
|
||||
});
|
||||
}
|
||||
|
||||
function totcptprojecttask() {
|
||||
window.totcptprojecttask = Morris.Area({
|
||||
element: 'totcptprojecttask',
|
||||
data: [
|
||||
{% for date, cpt in totcptprojecttask.value %}
|
||||
{ x: '{{ date }}', a: {{ cpt }} }{% if not loop.last %},{%endif%}
|
||||
{% endfor %}
|
||||
],
|
||||
xkey: 'x',
|
||||
ykeys: ['a'],
|
||||
labels: ["Nombre total de tâches"]
|
||||
});
|
||||
}
|
||||
|
||||
function groupcptvisite() {
|
||||
window.groupcptvisite = Morris.Donut({
|
||||
element: 'groupcptvisite',
|
||||
data: [
|
||||
{% for cpt in groupcptvisite %}
|
||||
{label: "{{ cpt.name|raw }}", value: {{ cpt.value }}}{% if not loop.last %},{%endif%}
|
||||
{% endfor %}
|
||||
],
|
||||
resize: true,
|
||||
redraw: true
|
||||
});
|
||||
}
|
||||
|
||||
function groupcptmessage() {
|
||||
window.groupcptmessage = Morris.Donut({
|
||||
element: 'groupcptmessage',
|
||||
data: [
|
||||
{% for cpt in groupcptmessage %}
|
||||
{label: "{{ cpt.name|raw }}", value: {{ cpt.value }}}{% if not loop.last %},{%endif%}
|
||||
{% endfor %}
|
||||
],
|
||||
resize: true,
|
||||
redraw: true
|
||||
});
|
||||
}
|
||||
|
||||
function groupcptblogarticle() {
|
||||
window.groupcptblogarticle = Morris.Donut({
|
||||
element: 'groupcptblogarticle',
|
||||
data: [
|
||||
{% for cpt in groupcptblogarticle %}
|
||||
{label: "{{ cpt.name|raw }}", value: {{ cpt.value }}}{% if not loop.last %},{%endif%}
|
||||
{% endfor %}
|
||||
],
|
||||
resize: true,
|
||||
redraw: true
|
||||
});
|
||||
}
|
||||
|
||||
function groupcptprojecttask() {
|
||||
window.groupcptprojecttask = Morris.Donut({
|
||||
element: 'groupcptprojecttask',
|
||||
data: [
|
||||
{% for cpt in groupcptprojecttask %}
|
||||
{label: "{{ cpt.name|raw }}", value: {{ cpt.value }}}{% if not loop.last %},{%endif%}
|
||||
{% endfor %}
|
||||
],
|
||||
resize: true,
|
||||
redraw: true
|
||||
});
|
||||
}
|
||||
{% endblock %}
|
|
@ -26,7 +26,7 @@ class CronexecCommand extends ContainerAwareCommand
|
|||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('Cron:Exec')
|
||||
->setName('Cron:Run')
|
||||
->setDescription("Executer les commandes présente dans le bus des commandes à exécuter à la volet")
|
||||
;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class CronexecCommand extends ContainerAwareCommand
|
|||
$cronexecs=$this->em->getRepository("CadolesCronBundle:Cronexec")->findAll();
|
||||
if($cronexecs) {
|
||||
$this->writelnred('');
|
||||
$this->writelnred('== Cron:Exec');
|
||||
$this->writelnred('== Cron:Run');
|
||||
$this->writelnred('==========================================================================================================');
|
||||
|
||||
foreach($cronexecs as $cron) {
|
||||
|
|
|
@ -139,6 +139,25 @@ class InitDataCommand extends ContainerAwareCommand
|
|||
$entity->setNextexecdate($nextdate);
|
||||
$this->entityManager->persist($entity);
|
||||
}
|
||||
|
||||
// Job Statistic
|
||||
// Toute les 24h à 23h30
|
||||
$entity = $this->entityManager->getRepository('CadolesCronBundle:Cron')->find(210);
|
||||
if(!$entity) {
|
||||
$entity = new Cron;
|
||||
$nextdate=$entity->getSubmitdate();
|
||||
$nextdate->setTime(23,30);
|
||||
$entity->setCommand("Core:Statistic");
|
||||
$entity->setDescription("Cacul des indicateurs d'usages");
|
||||
$entity->setId(210);
|
||||
$entity->setStatut(2);
|
||||
$entity->setRepeatcall(0);
|
||||
$entity->setRepeatexec(0);
|
||||
$entity->setRepeatinterval(86400);
|
||||
$entity->setNextexecdate($nextdate);
|
||||
$this->entityManager->persist($entity);
|
||||
}
|
||||
|
||||
// CRON PORTAIL
|
||||
// Job purge des registrations obsolètes
|
||||
// Toute les 5mn
|
||||
|
|
|
@ -10,6 +10,9 @@ use Symfony\Bundle\FrameworkBundle\Console\Application;
|
|||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Output\BufferedOutput;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
||||
|
||||
|
||||
use Cadoles\CronBundle\Entity\Cron;
|
||||
use Cadoles\CronBundle\Form\CronType;
|
||||
|
@ -189,18 +192,21 @@ class CronController extends Controller
|
|||
return new Response(json_encode($content), 200);
|
||||
}
|
||||
|
||||
public function logAction(Request $request, $id)
|
||||
public function logAction()
|
||||
{
|
||||
$kernel = $this->get('kernel');
|
||||
$path = $this->get('kernel')->getRootDir() . '/../var/logs/'.$id.'.log';
|
||||
$content = file_get_contents($path);
|
||||
|
||||
return $this->render('CadolesCronBundle:Cron:logs.html.twig', [
|
||||
'useheader' => true,
|
||||
'usemenu' => false,
|
||||
'usesidebar' => true,
|
||||
"title" => "LOG = ".$id,
|
||||
"content" => $content
|
||||
'usesidebar' => true
|
||||
]);
|
||||
}
|
||||
|
||||
public function getlogAction(Request $request, $id)
|
||||
{
|
||||
$kernel = $this->get('kernel');
|
||||
$file = $this->get('kernel')->getRootDir() . '/../var/logs/'.$id.'.log';
|
||||
$response = new BinaryFileResponse($file);
|
||||
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT);
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,9 @@ cadoles_cron_config_cronexecread:
|
|||
defaults: { _controller: CadolesCronBundle:Cron:cronexecread }
|
||||
|
||||
cadoles_cron_config_log:
|
||||
path: /config/cron/log/{id}
|
||||
path: /config/cron/log
|
||||
controller: CadolesCronBundle:Cron:log
|
||||
defaults: { id: "cron" }
|
||||
|
||||
cadoles_cron_config_getlog:
|
||||
path: /config/cron/getlog/{id}
|
||||
controller: CadolesCronBundle:Cron:getlog
|
||||
|
|
|
@ -1,19 +1,9 @@
|
|||
{% extends '@CadolesCore/base.html.twig' %}
|
||||
|
||||
{% block pagewrapper %}
|
||||
<h1 class="page-header">{{ title }}</h1>
|
||||
<h1 class="page-header">Télécharger les logs</h1>
|
||||
|
||||
<a class="btn btn-default" href={{ path("cadoles_cron_config_log",{"id":"cron"}) }}>Log CRON</a>
|
||||
<a class="btn btn-default" href={{ path("cadoles_cron_config_log",{"id":"prod"}) }}>Log PROD</a>
|
||||
<a class="btn btn-default" href={{ path("cadoles_cron_config_log",{"id":"dev"}) }}>Log DEV</a>
|
||||
<br><br>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<i class="fa fa-pencil fa-fw"></i> Logs
|
||||
</div>
|
||||
|
||||
<div class="panel-body">
|
||||
{{ content | nl2br }}
|
||||
</div>
|
||||
</div>
|
||||
<a class="btn btn-default" href={{ path("cadoles_cron_config_getlog",{"id":"cron"}) }}>Log CRON</a>
|
||||
<a class="btn btn-default" href={{ path("cadoles_cron_config_getlog",{"id":"prod"}) }}>Log PROD</a>
|
||||
<a class="btn btn-default" href={{ path("cadoles_cron_config_getlog",{"id":"dev"}) }}>Log DEV</a>
|
||||
{% endblock %}
|
|
@ -40,8 +40,6 @@ INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `f
|
|||
(1240, 1200, 1240, 'Groupes', 'cadoles_core_config_group', 'fa-users', 'ROLE_ADMIN,ROLE_MODO', ''),
|
||||
(1250, 1200, 1250, 'Inscriptions', 'cadoles_core_config_registration', 'fa-pencil-square-o', 'ROLE_ADMIN,ROLE_MODO', ''),
|
||||
(1260, 1200, 1260, 'Utilisateurs', 'cadoles_core_config_user', 'fa-child', 'ROLE_ADMIN,ROLE_MODO', ''),
|
||||
(1270, 1200, 1270, 'Mailing', 'cadoles_core_config_mailing', 'fa-envelope', 'ROLE_ADMIN,ROLE_MODO', ''),
|
||||
(1280, 1200, 1280, 'Import Utilisateurs', 'cadoles_core_config_importuser', 'fa-download', 'ROLE_ADMIN,ROLE_MODO', 'importuser_activate'),
|
||||
|
||||
(1500, NULL, 1500, 'PORTAIL', NULL, 'fa-cubes', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
|
||||
(1510, 1500, 1510, 'Modèles de Page', 'cadoles_portal_config_pagetemplate', 'fa-copy', 'ROLE_ADMIN,ROLE_MODO', 'portal_activate'),
|
||||
|
@ -78,6 +76,11 @@ INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `f
|
|||
(3160, 3000, 3160, 'Piwik', 'cadoles_portal_config_syncpiwik', 'fa-signal', 'ROLE_ADMIN,ROLE_MODO', 'widpiwik_activate_syncenvole'),
|
||||
(3230, 3000, 3230, 'Wordpress', 'cadoles_portal_config_syncwordpress', 'fa-wordpress', 'ROLE_ADMIN,ROLE_MODO', 'activate_widwordpress'),
|
||||
|
||||
(6000, NULL, 6000, 'OUTILS', NULL, 'fa-wrench', 'ROLE_ADMIN,ROLE_MODO', ''),
|
||||
(6010, 6000, 6010, 'Statistiques', 'cadoles_core_config_statistic', 'fa-bar-chart-o', 'ROLE_ADMIN,ROLE_MODO', ''),
|
||||
(6020, 6000, 6020, 'Mailing', 'cadoles_core_config_mailing', 'fa-envelope', 'ROLE_ADMIN,ROLE_MODO', ''),
|
||||
(6030, 6000, 6030, 'Import Utilisateurs', 'cadoles_core_config_importuser', 'fa-download', 'ROLE_ADMIN,ROLE_MODO', 'importuser_activate'),
|
||||
|
||||
(7000, NULL, 7000, 'CRON', NULL, 'fa-bolt', 'ROLE_ADMIN,ROLE_MODO', 'cron_activate'),
|
||||
(7010, 7000, 7010, 'Jobs', 'cadoles_cron_config', 'fa-bullseye', 'ROLE_ADMIN,ROLE_MODO', 'cron_activate'),
|
||||
(7020, 7000, 7020, 'Logs', 'cadoles_cron_config_log', 'fa-list-alt', 'ROLE_ADMIN,ROLE_MODO', 'cron_activate');
|
||||
|
@ -131,8 +134,6 @@ INSERT IGNORE permmodo (`route`, `visible`) VALUES
|
|||
('cadoles_core_config_group',1),
|
||||
('cadoles_core_config_registration',1),
|
||||
('cadoles_core_config_user',1),
|
||||
('cadoles_core_config_mailing',1),
|
||||
('cadoles_core_config_importuser',0),
|
||||
('cadoles_portal_config_pagetemplate',1),
|
||||
('cadoles_portal_config_page',1),
|
||||
('cadoles_portal_config_item',1),
|
||||
|
@ -145,5 +146,8 @@ INSERT IGNORE permmodo (`route`, `visible`) VALUES
|
|||
('cadoles_portal_config_synclimesurvey',0),
|
||||
('cadoles_portal_config_syncmoodle',0),
|
||||
('cadoles_portal_config_syncwordpress',0),
|
||||
('cadoles_core_config_statistic',1),
|
||||
('cadoles_core_config_mailing',1),
|
||||
('cadoles_core_config_importuser',0),
|
||||
('cadoles_cron_config',0),
|
||||
('cadoles_cron_config_log',0);
|
||||
|
|
Loading…
Reference in New Issue