This commit is contained in:
afornerot 2020-04-15 10:51:11 +02:00
parent 9f0915789b
commit 0105a44141
2 changed files with 27 additions and 24 deletions

View File

@ -2222,9 +2222,12 @@ class PagewidgetController extends Controller
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate); $em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
if(!$cansee) throw $this->createNotFoundException('Permission denied'); if(!$cansee) throw $this->createNotFoundException('Permission denied');
} }
$onlyservice = $this->container->get('cadoles.portal.service.only'); $onlyservice = $this->container->get('cadoles.portal.service.only');
$files=$onlyservice->getDocument($group, $folders, $firstfolder, $tasks); $files=$onlyservice->getDocument($group, $folders, $firstfolder, $tasks);
$grp=$em->getRepository("CadolesCoreBundle:Group")->find($group); $grp=null;
if($group) $grp=$em->getRepository("CadolesCoreBundle:Group")->find($group);
if($grp) $idonly= $grp->getIdOnlyoffice(); if($grp) $idonly= $grp->getIdOnlyoffice();
else $idonly=0; else $idonly=0;

View File

@ -41,31 +41,31 @@ class onlyService
$folders=[]; $folders=[];
$tasks=[]; $tasks=[];
dump($idgroup); if(!is_null($idgroup)) {
$group=$this->em->getRepository("CadolesCoreBundle:Group")->find($idgroup); $group=$this->em->getRepository("CadolesCoreBundle:Group")->find($idgroup);
if($group&&$group->getIdonlyoffice()) { if($group&&$group->getIdonlyoffice()) {
if($this->only_activate) { if($this->only_activate) {
if($this->authOnly()) { if($this->authOnly()) {
$response = \Unirest\Request::get($this->only_url.'/project/'.$group->getIdonlyoffice(),$this->headers); $response = \Unirest\Request::get($this->only_url.'/project/'.$group->getIdonlyoffice(),$this->headers);
if(!$this->koresponse($response)) {
$firstfolder=$response->body->response->projectFolder;;
$response = \Unirest\Request::get($this->only_url.'/project/'.$group->getIdonlyoffice().'/files',$this->headers);
if(!$this->koresponse($response)) { if(!$this->koresponse($response)) {
foreach($response->body->response->files as $fileonly) { $firstfolder=$response->body->response->projectFolder;;
array_push($files,$fileonly);
} $response = \Unirest\Request::get($this->only_url.'/project/'.$group->getIdonlyoffice().'/files',$this->headers);
foreach($response->body->response->folders as $folderonly) { if(!$this->koresponse($response)) {
$folders[$folderonly->id]=$folderonly; foreach($response->body->response->files as $fileonly) {
$subfolder=$this->scanfolder($folderonly->id,$folders,$this->headers); array_push($files,$fileonly);
foreach($subfolder as $file) { }
array_push($files,$file); foreach($response->body->response->folders as $folderonly) {
} $folders[$folderonly->id]=$folderonly;
} $subfolder=$this->scanfolder($folderonly->id,$folders,$this->headers);
foreach($subfolder as $file) {
array_push($files,$file);
}
}
$response = \Unirest\Request::get($this->only_url.'/project/'.$group->getIdonlyoffice().'/task/open',$this->headers); $response = \Unirest\Request::get($this->only_url.'/project/'.$group->getIdonlyoffice().'/task/open',$this->headers);
error_log($this->only_url.'/project/'.$group->getIdonlyoffice().'/tasks/open'); if(!$this->koresponse($response)) $tasks=$response->body->response;
if(!$this->koresponse($response)) $tasks=$response->body->response; }
} }
} }
} }