opencity-labs/cid-pat-integrations
最新稳定版本:1.6.7
Composer 安装命令:
composer require opencity-labs/cid-pat-integrations
包简介
Strumenti per le integrazioni Progetto CID PAT
README 文档
README
EventLink
Gli Eventi pubblicati da APPA sul rispettivo Portale sono importati nel Portale PaT. L’evento di APPA deve essere ricercabile e mostrato nella sezione Eventi del Portale PAT, al pari Eventi caricati sul Portale PAT, e nelle liste automatiche-paginate-query del Portale. L’evento di APPA deve essere relazionabile ad altri oggetti del Portale PAT, al pari degli Eventi caricati nel Portale.
Esempio di utilizzo
use Opencontent\EventLink\EventPusher;
$pusher = new EventPusher(
eventId: $eventId,
targetUrl: $siteUrl,
username: $username,
password: $password,
eventiPath: '/api/openapi/news/eventi',
sourceUrl: 'https://www.appa.provincia.tn.it'
);
try{
return $pusher->parse();
} catch(Throwable $e) {
echo 'Error: ' . $e->getMessage());
}
Organigramma
- In questo documento il Manuale e le istruzioni operative per il servizio di integrazione
- Le modifiche all’API sono sempre documentate in questo doc
- In questa tabella vengono riepilogati i Ruoli dei dipendenti, per come arrivano dal flusso e per come devono essere mostrati sul Portale.
Esempio di utilizzo
use Opencontent\Organigramma\ApiClient;
use Opencontent\Organigramma\Client;
use Opencontent\Organigramma\Logger;
use Opencontent\Organigramma\Persona;
use Opencontent\Organigramma\PersonaActions;
use Opencontent\Organigramma\Ruolo;
use Opencontent\Organigramma\RuoloActions;
use Opencontent\Organigramma\Struttura;
use Opencontent\Organigramma\StrutturaActions;
$apiClient = new ApiClient(
$siteUrl,
$username,
$password,
$gmapkey,
);
$client = new Client(
$remoteclientConfig
);
$logger = new Logger();
try {
$logger->info('Impongo filtro su struttura U551');
$client->setByStructure('U551');
$logger->info('Ottengo strutture');
$strutture = $client->getStrutture();
$logger->info('Importo strutture');
$strutturaActions = new StrutturaActions($apiClient);
foreach ($strutture as $struttura) {
$logger->info(' - ' . Struttura::fromData($struttura));
$strutturaActions->importa($struttura);
}
$logger->info('Ottengo persone');
$persone = $client->getElencoTelefonico();
$logger->info('Importo persone');
$personaActions = new PersonaActions($apiClient);
foreach ($persone as $persona) {
$logger->info(' - ' . Persona::fromData($persona));
$personaActions->importa($persona);
}
$logger->info('Importo ruoli');
$ruoloActions = new RuoloActions($apiClient);
foreach ($strutture as $struttura) {
$s = Struttura::fromData($struttura);
$ruolo = Ruolo::fromStruttura($s);
if ($ruolo) {
$logger->info( ' - ' . $ruolo);
}
$ruoloActions->importaDaStruttura($struttura);
}
foreach ($persone as $persona) {
$p = Persona::fromData($persona);
$ruoli = Ruolo::fromPersona($p);
foreach ($ruoli as $ruolo) {
$logger->info( ' - ' . $ruolo);
}
$ruoloActions->importaDaPersona($persona);
}
} catch (Throwable $exception) {
$logger->error($exception->getMessage());
$logger->error($exception->getTraceAsString());
}
UfficioStampa
I comunicati stampa prodotti in https://www.ufficiostampa.provincia.tn.it/ vengono pubblicati sul sito
Esempio di utilizzo
use Opencontent\Provvedimenti\ApiClient;
use Opencontent\UfficioStampa\Pusher;
$apiClient = new ApiClient(
$siteUrl,
$username,
$password,
$gmapkey,
);
$requestExample = [
"metadata" => [
"remoteId" => "8f1f8e2e66bfcb966bfa9324d6435035",
"stateIdentifiers" => [
"privacy.public",
]
],
"data" => [
"ita-IT" => [
"title" => "Esempio comunicato",
"abstract" => "Esempio abstract",
"content_type" => [
"Comunicato stampa",
],
"id_comunicato" => "1573-v1",
"author" => [
[
"remoteId" => "structureU226",
],
],
"image" => [
[
"remoteId" => "b31c5ce0a07b416e5ac197b19e941dc7",
],
],
"published" => "2025-06-08T17:40:59+02:00",
"topics" => [
[
"remoteId" => "9c6bb9fd24be27d9de27693ed21eed45",
],
[
"remoteId" => "766fd8c1ac024d72975aeb95387605dc",
],
],
"body" => "<p>Testo del comunicato</p>",
"location" => "https://www.ufficiostampa.provincia.tn.it/Comunicati/...",
],
],
];
$parser = new Pusher($apiClient);
$parser->push(
$requestExample['metadata'],
$requestExample['data'],
);
ServiceLink
I servizi relativi alle unità organizzative di APPA vengono inviati al relativo portale come service_link
Esempio di utilizzo
use Opencontent\Logger;
use Opencontent\ServiceLink\ServicePusher;
$parser = new ServicePusher(
$id,
$appaSiteUrl,
$username,
$password,
$patSiteUrl,
);
$parser->parse();
Provvedimenti
Le delibere di giunta sono importate sul sito dal relativo webservice
Esempio di utilizzo
use GuzzleHttp\Exception\RequestException;
use Opencontent\Provvedimenti\Client;
use Opencontent\Provvedimenti\ApiClient;
use Opencontent\Provvedimenti\Provvedimento;
use Opencontent\Provvedimenti\Pusher;
$apiClient = new ApiClient(
$siteUrl,
$username,
$password,
$gmapkey,
);
$client = new Client(
$remoteclientConfig
);
$pusher = new Pusher($apiClient);
$toDateTime = new DateTimeImmutable();
$fromDateTime = $toDateTime->sub(new DateInterval('P1D'));
$data = $client->getProvvedimenti(
$fromDateTime,
$toDateTime
);
foreach ($data as $item) {
$provvedimento = Provvedimento::fromData($item);
$pusher->push($provvedimento);
}
统计信息
- 总下载量: 7k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-15