Skip to content
This repository was archived by the owner on Apr 30, 2021. It is now read-only.

Commit abdff18

Browse files
committed
Missing function
1 parent b5f1f7c commit abdff18

File tree

1 file changed

+33
-23
lines changed

1 file changed

+33
-23
lines changed

sites.inc.php

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -796,36 +796,46 @@ function parse_SNGM(&$textall)
796796
*/
797797

798798
//////////////////////////
799-
// $textall : contenu de "http://www.camptocamp.org/outings/list/orderby/date/order/desc/page/$page"
799+
// $textall : contenu de "https://api.camptocamp.org/outings?pl=fr&act=skitouring"
800800
// $last_id : ne garde que les sorties dont l'id > $last_id
801801
// renvoie dans $textall un buffer pret a etre ecrit dans le fichier cache.
802802
// et en return value : $new_id (l'id le plus recent).
803-
function parse_Skirando(&$textall,$last_id)
803+
function parse_Skirando(&$textall, $last_id)
804804
{
805-
global $dlim;
805+
global $dlim;
806+
807+
$obj = json_decode($textall, true);
808+
$outings = $obj['documents'];
809+
$textall = '';
810+
$new_id = $last_id;
811+
812+
foreach ($outings as $outing) {
813+
$id = $outing['document_id'];
814+
$date = $outing['date_start'];
815+
$name = $outing['locales'][0]['title'];
816+
$link = 'https://www.camptocamp.org/outings/' . $id;
817+
$area = c2c_area($outing);
818+
$cotation = ""; // TODO get_cotation($outing);
819+
$author = $outing['author']['name'];
820+
if ($date < $dlim) break; // not older than one month
821+
$textall .= "c2c $id\n$date $cotation\n$name\n$link\n$area\n$author\n";
822+
if ($id > $new_id) $new_id = $id;
823+
}
824+
825+
return $new_id;
826+
}
806827

807-
$obj = json_decode($textall, true);
808-
$outings = $obj['documents'];
809-
$textall = '';
810-
811-
$new_id = $last_id;
812-
813-
foreach ($outings as $outing) {
814-
$id = $outing['document_id'];
815-
$date = $outing['date_start'];
816-
$name = $outing['locales'][0]['title'];
817-
$link = 'https://www.camptocamp.org/outings/' . $id;
818-
$area = get_area($outing);
819-
$cotation = ""; // TODO get_cotation($outing);
820-
$author = $outing['author']['name'];
821-
if ($date < $dlim) break; // not older than one month
822-
$textall .= "c2c $id\n$date $cotation\n$name\n$link\n$area\n$author\n";
823-
if ($id > $new_id) $new_id = $id;
824-
}
825-
826-
return $new_id;
828+
function c2c_area($outing) {
829+
foreach ($outing["areas"] as $area) {
830+
$name = $area["locales"][0]["title"];
831+
if ($area["area_type"] == "range") {
832+
break;
833+
}
834+
}
835+
return $name;
827836
}
828837

838+
829839
// cherche la cot d'une volo-course si dispo (et ajoute les participants !)
830840
function volo_cot($url,&$parts)
831841
{

0 commit comments

Comments
 (0)