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);
if(!$cansee) throw $this->createNotFoundException('Permission denied');
}
$onlyservice = $this->container->get('cadoles.portal.service.only');
$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();
else $idonly=0;

View File

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