$remoteRequestUrl = rtrim($remoteRequest, '/') . '/classtools/definition/'; } if ($remoteRequestUrl) { $remoteRequestSuffix = '?remote=' . $remoteRequest; } } $remote = null; try { if ($module->isCurrentAction('Install')) { $tools = new OCClassTools($id, true, array(), $remoteRequestUrl); $tools->sync(); return $module->redirectTo('/classtools/compare/' . $id . $remoteRequestSuffix); } $tools = new OCClassTools($id, false, array(), $remoteRequestUrl); $remote = $tools->getRemote(); $locale = $tools->getLocale(); if ($remote === null) { throw new Exception('Impossibile trovare la classe remota'); } if ($module->isCurrentAction('Sync')) { $force = false; $removeExtra = false; if ($http->hasPostVariable('ForceSync')) { $force = $http->postVariable('ForceSync') == 1; } if ($http->hasPostVariable('RemoveExtra')) { $removeExtra = $http->postVariable('RemoveExtra') == 1; } $tools->sync($force, $removeExtra); return $module->redirectTo('/classtools/compare/' . $id . $remoteRequestSuffix); }
<?php $module = $Params['Module']; $id = $Params['ID']; try { $tools = new OCClassTools($id); $result = $tools->getLocale(); // carico gli attributi $result->attribute('data_map'); // carico i gruppi di appartenenza $result->fetchGroupList(); // carico tutti i gruppi $result->fetchAllGroups(); } catch (Exception $e) { $result = array('error' => $e->getMessage()); } header('Content-Type: application/json'); echo json_encode($result); eZExecution::cleanExit();