Merge branch 'master' into dist/envole/6/master
This commit is contained in:
commit
2e5a8d39a5
@ -48,6 +48,7 @@ class FileController extends Controller
|
||||
// Récupérer en session le mode de visualisation
|
||||
$sessionviewdirectory = $this->get('session')->get('sessionviewdirectory');
|
||||
if(!is_array($sessionviewdirectory)) $sessionviewdirectory=[$directory=>$defaultview];
|
||||
if(!array_key_exists($directory,$sessionviewdirectory)) $sessionviewdirectory[$directory]=$defaultview;
|
||||
if($view)
|
||||
$sessionviewdirectory[$directory] = $view;
|
||||
$this->get('session')->set('sessionviewdirectory',$sessionviewdirectory);
|
||||
|
@ -1350,7 +1350,7 @@ class InitDataCommand extends ContainerAwareCommand
|
||||
$entityWidget->setBorder(true);
|
||||
$entityWidget->setOpened(true);
|
||||
$entityWidget->setAccess(["config","group"]);
|
||||
$parameter = json_decode('{"fields": [{"id": "apponly", "loc": "col1", "type": "apponly", "label": "Afficher", "value": "0", "mandatory": "true"}]}');
|
||||
$parameter = json_decode('{"fields": [{"id": "apponly", "loc": "col1", "type": "apponly", "label": "Afficher", "value": "0", "mandatory": "true"},{"id": "modelist", "loc": "col1", "type": "modelist", "label": "Mode Affichage", "value": "0", "mandatory": "true"}]}');
|
||||
$entityWidget->setParameter($parameter);
|
||||
$em->persist($entityWidget);
|
||||
}
|
||||
|
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace Cadoles\PortalBundle\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Form\FormError;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\HttpFoundation\File\File;
|
||||
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
|
||||
class FrameController extends Controller
|
||||
{
|
||||
|
||||
public function onlyAction($directory,Request $request,$access="config") {
|
||||
|
||||
$canupdate= $this->getPermission($access,$directory,$widget,$grp);
|
||||
$subdirectory=$request->get("subdirectory");
|
||||
$clear=$request->get("clear");
|
||||
$view=$request->get("view");
|
||||
$defaultview=$request->get("defaultview");
|
||||
|
||||
// Récupérer en session le dernier subdirectory visité
|
||||
$sessionsubdirectory = $this->get('session')->get('sessionsubdirectory');
|
||||
if(!is_array($sessionsubdirectory)) $sessionsubdirectory=[];
|
||||
|
||||
if($clear) {
|
||||
if(array_key_exists($directory,$sessionsubdirectory)) unset($sessionsubdirectory[$directory]);
|
||||
$this->get('session')->set('sessionsubdirectory',$sessionsubdirectory);
|
||||
}
|
||||
else {
|
||||
if(!$subdirectory) {
|
||||
if(array_key_exists($directory,$sessionsubdirectory)) $subdirectory=$sessionsubdirectory[$directory];
|
||||
}
|
||||
else {
|
||||
$sessionsubdirectory[$directory] = $subdirectory;
|
||||
$this->get('session')->set('sessionsubdirectory',$sessionsubdirectory);
|
||||
}
|
||||
}
|
||||
|
||||
// Récupérer en session le mode de visualisation
|
||||
$sessionviewdirectory = $this->get('session')->get('sessionviewdirectory');
|
||||
if(!is_array($sessionviewdirectory)) $sessionviewdirectory=[$directory=>$defaultview];
|
||||
if(!array_key_exists($directory,$sessionviewdirectory)) $sessionviewdirectory[$directory]=$defaultview;
|
||||
if($view)
|
||||
$sessionviewdirectory[$directory] = $view;
|
||||
$this->get('session')->set('sessionviewdirectory',$sessionviewdirectory);
|
||||
|
||||
// Initialiser le service only
|
||||
$onlyservice = $this->container->get('cadoles.portal.service.only');
|
||||
$firstfolder=($subdirectory?$subdirectory:null);
|
||||
$files=$onlyservice->getDocument($grp->getId(), $firstfolder, $parents, $tasks);
|
||||
|
||||
// Récupération du numéro de groupe oo
|
||||
if($grp) $idonly= $grp->getIdOnlyoffice();
|
||||
else $idonly=0;
|
||||
|
||||
// Récupération des paramétres du widget
|
||||
$apponly=0;
|
||||
foreach($widget->getParameter()["fields"] as $parameter) {
|
||||
switch($parameter["id"]) {
|
||||
case "apponly":
|
||||
$apponly=$parameter["value"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render('CadolesPortalBundle:Frame:only.html.twig',[
|
||||
'useheader' => false,
|
||||
'usemenu' => false,
|
||||
'usesidebar' => false,
|
||||
'access' => $access,
|
||||
'urlonly' => $this->getParameter("widonlyoffice_url")."/products/projects/tmdocs.aspx?prjID=".$idonly."#".$firstfolder,
|
||||
'directory' => $directory,
|
||||
'parents' => $parents,
|
||||
'subdirectory' => $subdirectory,
|
||||
'files' => $files,
|
||||
'canupdate' => $canupdate,
|
||||
'view' => $sessionviewdirectory[$directory],
|
||||
'tasks' => $tasks,
|
||||
'apponly' => $apponly
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function getPermission($access, $id, &$widget, &$group) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
// Récupération du widget & de la page
|
||||
$widget=$em->getRepository("CadolesPortalBundle:Pagewidget")->find($id);
|
||||
if (!$widget) throw $this->createNotFoundException('Unable to find entity.');
|
||||
$page=$widget->getPage();
|
||||
|
||||
$groups=$page->getGroups();
|
||||
$group=$groups[0];
|
||||
|
||||
if($access=="user") {
|
||||
// On s'assure que l'utilisateur à la permission de voir
|
||||
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
|
||||
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
else $canupdate=true;
|
||||
|
||||
return $canupdate;
|
||||
}
|
||||
}
|
@ -2388,22 +2388,32 @@ class PagewidgetController extends Controller
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
$onlyservice = $this->container->get('cadoles.portal.service.only');
|
||||
$files=$onlyservice->getDocument($group, $folders, $firstfolder, $tasks);
|
||||
$firstfolder=null;
|
||||
$files=$onlyservice->getDocument($group, $firstfolder, $tasks);
|
||||
|
||||
$grp=null;
|
||||
if($group) $grp=$em->getRepository("CadolesCoreBundle:Group")->find($group);
|
||||
if($grp) $idonly= $grp->getIdOnlyoffice();
|
||||
else $idonly=0;
|
||||
*/
|
||||
|
||||
// Récupération des paramétres du widget
|
||||
$apponly=0;
|
||||
$view="small";
|
||||
foreach($entity->getParameter()["fields"] as $parameter) {
|
||||
switch($parameter["id"]) {
|
||||
case "apponly":
|
||||
$apponly=$parameter["value"];
|
||||
break;
|
||||
break;
|
||||
case "modelist":
|
||||
$view=($parameter["value"]==0?"small":"list");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
// Render
|
||||
return $this->render($this->labelentity.':viewonlydoc.html.twig', [
|
||||
@ -2411,13 +2421,22 @@ class PagewidgetController extends Controller
|
||||
'canadd' => $cansee,
|
||||
'canupdate' => $cansee,
|
||||
'firstfolder' => $firstfolder,
|
||||
'folders' => $folders,
|
||||
'tasks' => $tasks,
|
||||
'urlonly' => $this->getParameter("widonlyoffice_url")."/products/projects/projects.aspx?prjID=".$idonly,
|
||||
'apponly' => $apponly,
|
||||
'files' => $files,
|
||||
'access' => $access,
|
||||
]);
|
||||
*/
|
||||
|
||||
return $this->render($this->labelentity.':viewonlydoc.html.twig', [
|
||||
'entity' => $entity,
|
||||
'canadd' => $canupdate,
|
||||
'canupdate' => $canupdate,
|
||||
'access' => $access,
|
||||
'directory' => $id,
|
||||
'view' => $view,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1152,3 +1152,13 @@ cadoles_portal_user_panelwidget_view_onlydoc:
|
||||
path: /pagewidget/view/onlydoc/{id}
|
||||
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewonlydoc, access: user }
|
||||
|
||||
|
||||
#== FRAME ==========================================================================================================================================
|
||||
|
||||
cadoles_portal_config_frame_only:
|
||||
path: /config/frame/only/{directory}
|
||||
defaults: { _controller: CadolesPortalBundle:Frame:only, access: config }
|
||||
|
||||
cadoles_portal_user_frame_only:
|
||||
path: /pagewidget/frame/only/{directory}
|
||||
defaults: { _controller: CadolesPortalBundle:Frame:only, access: user }
|
||||
|
@ -0,0 +1,179 @@
|
||||
{% extends '@CadolesCore/base.html.twig' %}
|
||||
|
||||
{% block localstyle %}
|
||||
#page-wrapper {
|
||||
min-height:0px !important;
|
||||
}
|
||||
|
||||
.grid .grid-list .grid-item-logo {
|
||||
margin:0px;
|
||||
}
|
||||
|
||||
.grid .grid-list .grid-item-title h2 {
|
||||
font-size: 14px;
|
||||
line-height: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
.grid-item-title h2 {
|
||||
text-transform: initial !important;
|
||||
}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block pagewrapper %}
|
||||
|
||||
<div id="explorer">
|
||||
<div class="btn-toolbar" role="toolbar" aria-label="Toolbar with button groups" style="margin-top:5px">
|
||||
{% if canupdate %}
|
||||
<div class="btn-group mr-2" role="group" aria-label="First group">
|
||||
<a type="button" class="btn btn-primary" href="{{urlonly}}" target="_blank" title='Plus de fonctionnalités'>
|
||||
<i class="fa fa-plus"></i>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="btn-group mr-2" role="group" aria-label="Second group">
|
||||
{% if view=="small" %}
|
||||
{%set action="list" %}
|
||||
{% else %}
|
||||
{%set action="small" %}
|
||||
{% endif %}
|
||||
|
||||
{% if not subdirectory is empty %}
|
||||
<a href="{{ path('cadoles_portal_'~access~'_frame_only',{'directory':directory,'subdirectory':subdirectory,'view':action }) }}" type="button" class="btn btn-primary">
|
||||
{% else %}
|
||||
<a href="{{ path('cadoles_portal_'~access~'_frame_only',{'directory':directory,'clear':true,'view':action }) }}" type="button" class="btn btn-primary">
|
||||
{% endif %}
|
||||
|
||||
{% if view=="small" %}
|
||||
<i class="fas fa-list"></i>
|
||||
{% else %}
|
||||
<i class="fas fa-th"></i>
|
||||
{% endif %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{{ path('cadoles_portal_'~access~'_frame_only',{'directory':directory, 'clear':true }) }}">Home</a></li>
|
||||
|
||||
{% for parent in parents|reverse %}
|
||||
<li class="breadcrumb-item"><a href="{{ path('cadoles_portal_'~access~'_frame_only',{'directory':directory,'subdirectory':parent.id }) }}">{{parent.name}}</a></li>
|
||||
{% endfor %}
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<div class="grid clearfix">
|
||||
<div class="grid-sizer grid-{{view}}"></div>
|
||||
<div class="grid-gutter-sizer"></div>
|
||||
|
||||
|
||||
{% for dir in files %}
|
||||
{% for folder in dir.folders %}
|
||||
<div class="grid-item grid-{{view}}">
|
||||
<div class="grid-item-content">
|
||||
<a style="cursor:pointer" href="{{ path('cadoles_portal_'~access~'_frame_only',{'directory':directory,'subdirectory':folder.info.id }) }}">
|
||||
<div class="item-link clearfix">
|
||||
<div class="grid-item-logo">
|
||||
<img class="grid-item-img" height="110" src="/{{ alias }}/bundles/cadolescore/images/files/dir.png">
|
||||
</div>
|
||||
|
||||
<div class="grid-item-title">
|
||||
<h2>{{ folder.info.title }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% for file in dir.files %}
|
||||
<div class="grid-item grid-{{view}}">
|
||||
<div class="grid-item-content">
|
||||
<a href="{{ file.webUrl }}" target="_blank">
|
||||
<div class="item-link clearfix">
|
||||
<div class="grid-item-logo">
|
||||
{% if file.fileExst ==".png" or file.fileExst ==".jpg" or file.fileExst ==".jpeg" or file.fileExst ==".svg" or file.fileExst ==".gif"%}
|
||||
<img class="grid-item-img" height="110" src="{{file.viewUrl}}">
|
||||
{% else %}
|
||||
<img class="grid-item-img" height="110" src="/{{ alias }}/bundles/cadolescore/images/files/{{ file.fileExst | replace({".":""})}}.png">
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="grid-item-title">
|
||||
<h2>{{ file.title }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if not tasks is empty %}
|
||||
<div id="onlytasks" style='margin-top:20px;'>
|
||||
{% if apponly==0 %}
|
||||
<h4 style='margin-bottom:5px;border-bottom:1px solid;'>Tâches</h4>
|
||||
{%endif%}
|
||||
|
||||
{% if apponly==0 or apponly==2 %}
|
||||
{% for task in tasks %}
|
||||
<li>{{ task.title }}</li>
|
||||
{% if not task.subtasks is empty %}
|
||||
<ul>
|
||||
{% for subtask in task.subtasks %}
|
||||
<li>{{ subtask.title }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{%endif%}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block localjavascript %}
|
||||
var optiongrid={columnWidth: '.grid-sizer',itemSelector: '.grid-item', gutter: '.grid-gutter-sizer'};
|
||||
|
||||
|
||||
// Création des grilles d'items
|
||||
$('body').imagesLoaded(function() {
|
||||
var grid = $('.grid').masonry(optiongrid);
|
||||
ajust();
|
||||
});
|
||||
|
||||
$('document').ready(function(){
|
||||
if(inIframe()) {
|
||||
color=$("#frame-{{directory}}",window.parent.document).data("color");
|
||||
}
|
||||
else {
|
||||
color = "#{{ color["main"]}}";
|
||||
}
|
||||
|
||||
$(".grid-item-title > h2").css("color",color);
|
||||
$("#onlytasks").css("color",color);
|
||||
});
|
||||
|
||||
$(window).resize(function() {
|
||||
ajust();
|
||||
});
|
||||
|
||||
|
||||
function ajust(formodal) {
|
||||
if(inIframe()) {
|
||||
if(!$("#frame-{{directory}}",window.parent.document).hasClass("notframeajust")) {
|
||||
$("#frame-{{directory}}",window.parent.document).height($("#page-wrapper").height() + 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
@ -36,10 +36,6 @@
|
||||
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
|
||||
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
|
||||
{% endif %}
|
||||
|
||||
{% if canadd %}
|
||||
<!-- <a style="{{ stylewidgetmenu }}" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Fichiers','{{ path('cadoles_core_'~access~'_file_upload',{'id': 'widget-'~entity.id,'type':'all'}) }}');" title='Ajouter des Fichiers'><i class="fa fa-plus fa-fw"></i></a> -->
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
{% set stylewidgetheader = constants.mystylewidgetheader(entity) %}
|
||||
{% set stylewidgetbody = constants.mystylewidgetbody(entity) %}
|
||||
{% set stylewidgetbodyreverse = constants.mystylewidgetbodyreverse(entity) %}
|
||||
{% set stylewidgetbodyframe = constants.mystylewidgetbodyframe(entity) %}
|
||||
|
||||
{% set color = app.session.get('color') %}
|
||||
|
||||
@ -20,9 +21,13 @@
|
||||
|
||||
|
||||
{% set colorbodyfont = entity.colorbodyfont %}
|
||||
{% if colorbodyfont is null %}
|
||||
{% if entity.border and colorbodyfont is null %}
|
||||
{% set colorbodyfont = color['fontcolorhover'] %}
|
||||
{% endif %}
|
||||
{% if colorbodyfont is null %}
|
||||
{% set colorbodyfont = color['main'] %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-file" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
|
||||
{% if canupdate or canadd %}
|
||||
@ -31,10 +36,6 @@
|
||||
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
|
||||
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
|
||||
{% endif %}
|
||||
|
||||
{% if canadd %}
|
||||
<a style="{{ stylewidgetmenu }}" href="{{urlonly}}" target="_blank" title='Plus de fonctionnalités'><i class="fa fa-plus fa-fw"></i></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@ -48,82 +49,11 @@
|
||||
<span class="title">{{ entity.name }}</span>
|
||||
</div>
|
||||
|
||||
{% if files|length >= 1 or canupdate %}
|
||||
<div class="widgetbody" style="{{ stylewidgetbody }}">
|
||||
{% if apponly==0 %}
|
||||
<div style='width:90%; margin:auto;'>
|
||||
<h4 style='margin-bottom:5px;border-bottom:1px solid;'>Documents</h4>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="widgetbody" style="{{ stylewidgetbodyframe }}">
|
||||
|
||||
{% if apponly==0 or apponly==1 %}
|
||||
<div class="grid clearfix">
|
||||
<div class="grid-sizer grid-small"></div>
|
||||
<div class="grid-gutter-sizer"></div>
|
||||
<iframe id="frame-{{directory}}" src="{{ path("cadoles_portal_"~access~"_frame_only",{'directory':directory,'defaultview':view}) }}" data-color="#{{colorbodyfont}}" style="{{ stylewidgetbodyframe }}" class="{% if not entity.autoajust %}notframeajust {% endif %}"></iframe>
|
||||
|
||||
{% for file in files %}
|
||||
<div class="grid-item grid-small">
|
||||
<div class="grid-item-content">
|
||||
<a href="{{ file.webUrl }}" target="_blank">
|
||||
<div class="item-link clearfix">
|
||||
<div class="grid-item-logo">
|
||||
{% if file.fileExst ==".png" or file.fileExst ==".jpg" or file.fileExst ==".jpeg" or file.fileExst ==".svg" or file.fileExst ==".gif"%}
|
||||
<img class="grid-item-img" height="110" src="{{file.viewUrl}}">
|
||||
{% else %}
|
||||
<img class="grid-item-img" height="110" src="/{{ alias }}/bundles/cadolescore/images/files/{{ file.fileExst | replace({".":""})}}.png">
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="grid-item-title">
|
||||
<h2 style="color:#{{colorbodyfont}}">{{ file.title }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% if canadd %}
|
||||
<div class="grid-item grid-small">
|
||||
<div class="grid-item-content">
|
||||
<a href="{{urlonly}}" target="_blank" title='Plus de fonctionnalités'>
|
||||
<div class="item-link clearfix">
|
||||
<div class="grid-item-logo">
|
||||
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_add.png">
|
||||
</div>
|
||||
<div class="grid-item-title">
|
||||
<h2>Plus</h2>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{%endif%}
|
||||
|
||||
{% if not tasks is empty %}
|
||||
<div style='width:90%; margin:auto;'>
|
||||
{% if apponly==0 %}
|
||||
<h4 style='margin-bottom:5px;border-bottom:1px solid;'>Tâches</h4>
|
||||
{%endif%}
|
||||
|
||||
{% if apponly==0 or apponly==2 %}
|
||||
{% for task in tasks %}
|
||||
<li>{{ task.title }}</li>
|
||||
{% if not task.subtasks is empty %}
|
||||
<ul>
|
||||
{% for subtask in task.subtasks %}
|
||||
<li>{{ subtask.title }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{%endif%}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -36,9 +36,9 @@ class onlyService
|
||||
}
|
||||
}
|
||||
|
||||
public function getDocument($idgroup,&$folders,&$firstfolder,&$tasks) {
|
||||
public function getDocument($idgroup,&$firstfolder,&$parents,&$tasks) {
|
||||
$files=[];
|
||||
$folders=[];
|
||||
$parents=[];
|
||||
$tasks=[];
|
||||
|
||||
if(!is_null($idgroup)) {
|
||||
@ -48,24 +48,29 @@ class onlyService
|
||||
if($this->authOnly()) {
|
||||
$response = \Unirest\Request::get($this->only_url.'/project/'.$group->getIdonlyoffice(),$this->headers);
|
||||
if(!$this->koresponse($response)) {
|
||||
$firstfolder=$response->body->response->projectFolder;;
|
||||
$home=$response->body->response->projectFolder;
|
||||
if(!$firstfolder) $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);
|
||||
}
|
||||
}
|
||||
$files[$firstfolder] = $this->scanfolder($firstfolder,"",$this->headers);
|
||||
|
||||
// Construction du tableau des parents
|
||||
$currentchild=$firstfolder;
|
||||
|
||||
while($currentchild!=$home) {
|
||||
$response = \Unirest\Request::get($this->only_url.'/files/'.$currentchild,$this->headers);
|
||||
if($this->koresponse($response)) return 0;
|
||||
|
||||
// Récupérer les informations du folder
|
||||
$tmp=["id"=>$response->body->response->current->id,"name"=>$response->body->response->current->title];
|
||||
array_push($parents,$tmp);
|
||||
|
||||
// Aller sur le folder parent
|
||||
$currentchild=$response->body->response->current->parentId;
|
||||
}
|
||||
|
||||
$response = \Unirest\Request::get($this->only_url.'/project/'.$group->getIdonlyoffice().'/task/open',$this->headers);
|
||||
if(!$this->koresponse($response)) $tasks=$response->body->response;
|
||||
}
|
||||
if(!$this->koresponse($response)) $tasks=$response->body->response;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -75,6 +80,10 @@ class onlyService
|
||||
return $files;
|
||||
}
|
||||
|
||||
private function getFiles($idfolder) {
|
||||
|
||||
return $files;
|
||||
}
|
||||
private function authOnly() {
|
||||
// Only Office est-il dans le domaine
|
||||
if(stripos($this->only_url,"/")===0)
|
||||
@ -119,19 +128,15 @@ class onlyService
|
||||
if($this->debug) error_log($texte);
|
||||
}
|
||||
|
||||
private function scanfolder($folderid,&$folders,$headers) {
|
||||
$files=[];
|
||||
private function scanfolder($folderid,$folderonly,$headers) {
|
||||
$files=["info"=>$folderonly,"files"=>[],"folders"=>[]];
|
||||
$response = \Unirest\Request::get($this->only_url.'/files/'.$folderid,$headers);
|
||||
if($this->koresponse($response)) return 0;
|
||||
foreach($response->body->response->files as $fileonly) {
|
||||
array_push($files,$fileonly);
|
||||
array_push($files["files"],$fileonly);
|
||||
}
|
||||
foreach($response->body->response->folders as $folderonly) {
|
||||
$folders['"'.$folderonly->id.'"']=$folderonly;
|
||||
$subfolder=$this->scanfolder($folderonly->id,$folders,$headers);
|
||||
foreach($subfolder as $file) {
|
||||
array_push($files,$file);
|
||||
}
|
||||
$files["folders"][$folderonly->id] = $this->scanfolder($folderonly->id,$folderonly,$headers);
|
||||
}
|
||||
|
||||
return $files;
|
||||
|
Loading…
Reference in New Issue
Block a user