本文整理汇总了PHP中date_date_set函数的典型用法代码示例。如果您正苦于以下问题:PHP date_date_set函数的具体用法?PHP date_date_set怎么用?PHP date_date_set使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了date_date_set函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: decoupage_full_title
/**
* Prend un titre complet au format "dd/mm/yyyy - Title",
* et le découpe en deux variables prêtes à être utilisées dans une requête.
*
* @return Un tableau de deux chaînes de caractères, avec la date formatée et le titre.
*/
function decoupage_full_title($full_title)
{
$date = substr($full_title, 0, 10);
$dateT = date_create();
date_date_set($dateT, substr($date, 6, 4), substr($date, 3, 2), substr($date, 0, 2));
$date = date_format($dateT, "Y-m-d");
$title = substr($full_title, 13, strlen($full_title) - 1);
return array($date, $title);
}
示例2: index
public function index()
{
//@todo move this to init when init supports exceptions
// Boilerplate special page permissions
if ($this->wg->user->isBlocked()) {
$this->wg->out->blockedPage();
return false;
// skip rendering
}
if (!$this->wg->user->isAllowed('specialgamingcalendar')) {
$this->displayRestrictionError();
return false;
}
if (wfReadOnly() && !wfAutomaticReadOnly()) {
$this->wg->out->readOnlyPage();
return false;
}
$this->response->addAsset('resources/wikia/libraries/jquery-ui/jquery-ui-1.8.14.custom.js');
$this->response->addAsset('extensions/wikia/GamingCalendar/js/GamingCalendarSpecialPage.js');
$this->response->addAsset('extensions/wikia/GamingCalendar/css/GamingCalendarSpecialPage.scss');
$type = $this->getVal('type', null);
$year = $this->getVal('year', null);
$month = $this->getVal('month', null);
$date = null;
$entries = array();
if (!empty($type) && !empty($year) && !empty($month)) {
// get entries
$date = date_create();
date_date_set($date, $year, $month, 1);
$entries = GamingCalendar::loadEntries(0, 5, $type, date_timestamp_get($date), false);
}
$typeName = GamingCalendar::getCalendarName($type);
$this->setVal('typeName', $typeName);
$this->setVal('type', $type);
$this->setVal('year', $year);
$this->setVal('month', $month);
$this->setVal('date', $date ? date_timestamp_get($date) : '');
$this->setVal('types', GamingCalendar::getCalendarTypes());
$this->setVal('entries', $entries);
}
示例3: date_default_timezone_set
<?php
date_default_timezone_set('UTC');
$dto = date_create("2006-12-12");
var_dump($dto);
var_dump($dto->format("Y.m.d H:i:s"));
var_dump(date_date_set());
var_dump($dto->format("Y.m.d H:i:s"));
var_dump(date_date_set($dto, 2006, 5));
var_dump($dto->format("Y.m.d H:i:s"));
var_dump(date_date_set($dto, 2006, 2, 15));
var_dump($dto->format("Y.m.d H:i:s"));
var_dump(date_date_set($dto, 2006, 24, 60));
var_dump($dto->format("Y.m.d H:i:s"));
echo "Done\n";
示例4: create
/**
* Construct a date object out of it's time values If a timezone string
* the date will be set into that zone - defaulting to the system's
* default timezone of none is given.
*
* @param int year
* @param int month
* @param int day
* @param int hour
* @param int minute
* @param int second
* @param util.TimeZone tz default NULL
* @return util.Date
*/
public static function create($year, $month, $day, $hour, $minute, $second, TimeZone $tz = null)
{
$date = date_create();
if ($tz) {
date_timezone_set($date, $tz->getHandle());
}
if (false === @date_date_set($date, $year, $month, $day) || false === @date_time_set($date, $hour, $minute, $second)) {
throw new IllegalArgumentException(sprintf('One or more given arguments are not valid: $year=%s, $month=%s, $day= %s, $hour=%s, $minute=%s, $second=%s', $year, $month, $day, $hour, $minute, $second));
}
return new self($date);
}
示例5: ParseOzi
function ParseOzi($trackFile, &$trackData)
{
if (!preg_match('/OziExplorer/i', $trackFile, $m)) {
return 0;
}
$nbPts = 0;
foreach (preg_split('/[\\n\\r]+/', $trackFile, null, PREG_SPLIT_NO_EMPTY) as $line) {
if (preg_match('/^\\s+
(?P<lat>[-\\d\\.]+)[,\\s]+
(?P<lon>[-\\d\\.]+)[,\\s]+[01][,\\s]+
(?P<elev>[-\\d\\.]+)[,\\s]+
(?P<date>[\\d\\.]+).*$
/xim', $line, $m)) {
$trackData['lat'][$nbPts] = floatval($m['lat']);
$trackData['lon'][$nbPts] = floatval($m['lon']);
$trackData['elev'][$nbPts] = max(intval($m['elev'] * 0.3048), 0);
$time = floatval($m['date']) - intval($m['date']);
$time = $time * 24;
$hour = intval($time);
$time = ($time - $hour) * 60;
$min = intval($time);
$time = ($time - $min) * 60;
$sec = intval($time);
$trackData['time']['hour'][$nbPts] = $hour;
$trackData['time']['min'][$nbPts] = $min;
$trackData['time']['sec'][$nbPts] = $sec;
$nbPts++;
}
}
if ($nbPts > 5) {
$date = date_create();
date_date_set($date, 1899, 12, 30);
date_modify($date, intval($m['date']) . ' days');
$trackData['date']['day'] = intval(date_format($date, 'j'));
$trackData['date']['month'] = intval(date_format($date, 'n'));
$trackData['date']['year'] = intval(date_format($date, 'Y'));
}
return $nbPts;
}
示例6: foreach
$date_debut = null;
$date_fin = null;
$id_eleve_array = null;
$id_saisie_array = null;
foreach ($traitement->getAbsenceEleveSaisies() as $saisie) {//$saisie = new AbsenceEleveSaisie();
if ($date_debut == null || $saisie->getDebutAbs('U') < $date_debut->format('U')) {
$date_debut = clone $saisie->getDebutAbs(null);
}
if ($date_fin == null || $saisie->getFinAbs('U') > $date_fin->format('U')) {
$date_fin = clone $saisie->getFinAbs(null);
}
$id_eleve_array[] = $saisie->getEleveId();
$id_saisie_array[] = $saisie->getId();
}
if ($date_debut != null) date_date_set($date_debut, $date_debut->format('Y'), $date_debut->format('m'), $date_debut->format('d') - 1);
if ($date_fin != null) date_date_set($date_fin, $date_fin->format('Y'), $date_fin->format('m'), $date_fin->format('d') + 1);
$query->filterByPlageTemps($date_debut, $date_fin)->filterByEleveId($id_eleve_array)->filterById($id_saisie_array, Criteria::NOT_IN);
}
$order = getFiltreRechercheParam('order');
if ($order == "asc_id") {
$query->orderBy('Id', Criteria::ASC);
} else if ($order == "des_id") {
$query->orderBy('Id', Criteria::DESC);
} else if ($order == "asc_utilisateur") {
$query->useUtilisateurProfessionnelQuery()->orderBy('Nom', Criteria::ASC)->endUse();
} else if ($order == "des_utilisateur") {
$query->useUtilisateurProfessionnelQuery()->orderBy('Nom', Criteria::DESC)->endUse();
} else if ($order == "asc_eleve") {
$query->useEleveQuery()->orderBy('Nom', Criteria::ASC)->orderBy('Prenom', Criteria::ASC)->endUse();
示例7: amr_get_events_in_weeks_format
function amr_get_events_in_weeks_format($events, $weeks, $start)
{
// should be using dummmyYMD?
global $amr_globaltz;
$wkst = ical_get_weekstart();
// get the wp start of week
if (isset($_GET['debugwks'])) {
echo '<br />Separate ' . count($events) . ' events into weeks for ' . $weeks . ' weeks using wkst: ' . $wkst;
}
$weeksofevents = array();
// prepare the months array so we show a calendar even if no events
$dummydate = new Datetime();
//if cloning dont need tz
$dummydate = clone $start;
$dummydate = amr_get_human_start_of_week($dummydate, $wkst);
for ($i = 0; $i < $weeks; $i++) {
$weekbeginning = $dummydate->format('Ymj');
//numerical so do not need amr_date_format
if (empty($firstweekbeginning)) {
$firstweekbeginning = $weekbeginning;
}
if (isset($_GET['debugwks'])) {
echo '<br />weekbeginning' . $weekbeginning;
}
$weeksofevents[$weekbeginning] = array();
date_modify($dummydate, '+7 days');
}
// assign events to the box of their year and month
if (!empty($events)) {
foreach ($events as $event) {
if (!empty($event['dummyYMD'])) {
// ahh need the dummy date, not the Event Date
date_date_set($dummydate, substr($event['dummyYMD'], 0, 4), substr($event['dummyYMD'], 4, 2), substr($event['dummyYMD'], 6, 2));
if (isset($_GET['debugwks'])) {
echo '<br />date:' . $event['dummyYMD'];
}
$dummydate = amr_get_human_start_of_week($dummydate, $wkst);
$weekbeginning = $dummydate->format('Ymj');
if (isset($_GET['debugwks'])) {
echo '<br />start of week:' . $weekbeginning;
}
if (isset($weeksofevents[$weekbeginning])) {
$weeksofevents[$weekbeginning][] = $event;
} else {
// the week beginning is not in our current set - might be a multi day that started the previous week or even earlier
if (isset($_GET['debugwks'])) {
echo '<br />No week begin of ' . $weekbeginning . ' for ? ' . $dummydate->format('c') . ' ' . $event['SUMMARY'];
//$weeksofevents[$weekbeginning][] = $event; // assign our multi day to first week
//var_dump($event);
}
}
} else {
if (isset($_GET['debugwks'])) {
echo '<br />event with no dummy date';
var_dump($event);
}
}
}
}
if (isset($_GET['debugwks'])) {
echo '<br />Have dates for:' . count($weeksofevents) . ' weeks';
foreach ($weeksofevents as $i => $bunchevents) {
echo '<br />' . $i . ' ' . count($bunchevents);
foreach ($bunchevents as $i => $e) {
echo '<br /> ' . $e['EventDate']->format('Ymd');
//numerical so do not need amr_date_format
}
}
}
return $weeksofevents;
}
示例8: DateTime
$dt_date_absence_eleve = new DateTime(str_replace("/", ".", $date_absence_eleve));
} catch (Exception $x) {
try {
$dt_date_absence_eleve = new DateTime($date_absence_eleve);
} catch (Exception $x) {
$dt_date_absence_eleve = new DateTime('now');
}
}
} else {
$dt_date_absence_eleve = new DateTime('now');
}
if ($nav_date == "precedent") {
date_date_set($dt_date_absence_eleve, $dt_date_absence_eleve->format('Y'), $dt_date_absence_eleve->format('m'), $dt_date_absence_eleve->format('d') - 1);
}
if ($nav_date == "suivant") {
date_date_set($dt_date_absence_eleve, $dt_date_absence_eleve->format('Y'), $dt_date_absence_eleve->format('m'), $dt_date_absence_eleve->format('d') + 1);
}
//==============================================
$style_specifique[] = "mod_abs2/lib/abs_style";
$javascript_specifique[] = "mod_abs2/lib/include";
$titre_page = "Absences du jour";
$utilisation_jsdivdrag = "non";
$_SESSION['cacher_header'] = "y";
$dojo = true;
$javascript_specifique[] = "lib/tablekit";
$utilisation_tablekit="ok";
require_once("../lib/header.inc.php");
//**************** FIN EN-TETE *****************
示例9: get_relative_bydays
/**
* Get results for relative BYDAY values.
*
* BYDAYs with parameters like -1SU (last Sun) or
* 2TH (second Thur) need to be processed one month or
* year at a time.
*/
protected function get_relative_bydays($relative_days)
{
$finished = FALSE;
$this->current_day = clone $this->start_date;
while (!$finished) {
foreach ($relative_days as $day) {
// Find the BYDAY date in the current period.
switch ($this->rrule['FREQ']) {
case 'MONTHLY':
if ($this->set_month_day($day['day'], $day['direction_count'], $day['direction'])) {
$this->add_current_day();
}
break;
case 'YEARLY':
if ($this->set_year_day($day['day'], $day['direction_count'], $day['direction'])) {
$this->add_current_day();
}
break;
}
}
$finished = $this->is_finished();
// Reset to beginning of period before jumping to next period.
// Needed especially when working with values like 'last
// Saturday' to be sure we don't skip months like February.
$year = $this->current_day->format('Y');
$month = $this->current_day->format('n');
switch ($this->rrule['FREQ']) {
case 'MONTHLY':
date_date_set($this->current_day, $year, $month, 1);
break;
case 'YEARLY':
date_date_set($this->current_day, $year, 1, 1);
break;
}
// Jump to the next period.
$this->current_day->add($this->jump);
}
}
示例10: date_increment_round
/**
* Helper function to round minutes and seconds to requested value.
*/
function date_increment_round(&$date, $increment)
{
// Round minutes and seconds, if necessary.
if (is_object($date) && $increment > 1) {
$day = intval(date_format($date, 'j'));
$hour = intval(date_format($date, 'H'));
$second = intval(round(intval(date_format($date, 's')) / $increment) * $increment);
$minute = intval(date_format($date, 'i'));
if ($second == 60) {
$minute += 1;
$second = 0;
}
$minute = intval(round($minute / $increment) * $increment);
if ($minute == 60) {
$hour += 1;
$minute = 0;
}
date_time_set($date, $hour, $minute, $second);
if ($hour == 24) {
$day += 1;
$hour = 0;
$year = date_format($date, 'Y');
$month = date_format($date, 'n');
date_date_set($date, $year, $month, $day);
}
}
return $date;
}
示例11: incrementRound
/**
* Rounds minutes and seconds to nearest requested value.
*
* @param $date
*
* @param $increment
*
* @return
*/
protected static function incrementRound(&$date, $increment)
{
// Round minutes and seconds, if necessary.
if ($date instanceof DrupalDateTime && $increment > 1) {
$day = intval(date_format($date, 'j'));
$hour = intval(date_format($date, 'H'));
$second = intval(round(intval(date_format($date, 's')) / $increment) * $increment);
$minute = intval(date_format($date, 'i'));
if ($second == 60) {
$minute += 1;
$second = 0;
}
$minute = intval(round($minute / $increment) * $increment);
if ($minute == 60) {
$hour += 1;
$minute = 0;
}
date_time_set($date, $hour, $minute, $second);
if ($hour == 24) {
$day += 1;
$year = date_format($date, 'Y');
$month = date_format($date, 'n');
date_date_set($date, $year, $month, $day);
}
}
return $date;
}
示例12: loadPlansFromCsvFiles
function loadPlansFromCsvFiles($dir)
{
var_dump('loading daily and mensual plans for the services...');
var_dump($dir);
$em = $this->manager;
$entries = scandir($dir);
$i = 0;
foreach ($entries as $e) {
$i++;
var_dump('parsing files in folder ' . $i);
$subdir = $dir . '\\' . $e;
if (is_dir($subdir) && $e != '.' && $e != '..') {
foreach (scandir($subdir) as $file) {
$csvFile = $subdir . '\\' . $file;
if (is_file($csvFile) && pathinfo($csvFile)['extension'] == "csv") {
$fileHandle = fopen($csvFile, "r");
$row = 0;
$date = "";
while (($data = fgetcsv($fileHandle, 1000, ",")) != false) {
if ($row == 3) {
// extract day here
$date = date_parse($data[5]);
//var_dump ("Loading plan for day: ".$date['day'].'/'.$date['month']);
}
if ($row >= 6) {
if (is_numeric($data[0])) {
$code = $data[1];
$service = $em->getRepository('sisconeeAppBundle:Servicio')->findOneByCodClienteEE($code);
if ($service == null) {
continue;
}
$lecturaDiariaActual = $em->getRepository('sisconeeAppBundle:LecturaDiariaServicio')->getLectura($date['day'], $date['month'], $date['year'], $service->getId());
if ($lecturaDiariaActual == null) {
$planDia = $data[6];
$consumoDia = $data[7];
$lecturaDiariaActual = new LecturaDiariaServicio();
$lecturaDiariaActual->setPlan($planDia);
$lecturaDiariaActual->setConsumo($consumoDia);
$lecturaDiariaActual->setIdServicio($service);
$dateDT = date_create();
date_date_set($dateDT, $date['year'], $date['month'], $date['day']);
$lecturaDiariaActual->setFecha($dateDT);
$em->persist($lecturaDiariaActual);
//plandiario
$this->manager->flush();
//var_dump ('saving service '.$service->getId());
} else {
//var_dump("Existe " . date_format($lecturaDiariaActual->getFecha(), "m:d:y"));
}
$lecturaMensual = $em->getRepository('sisconeeAppBundle:PlanAnualEntidad')->getPlanOfAServiceInAMonthYear($service, $date['month'], $date['year']);
if ($lecturaMensual == null) {
$planMensualValue = $data[5];
$planMensual = new PlanmensualServicio();
$planMensual->setPlan($planMensualValue);
$planMensual->setServicio($service);
$planMensual->setMes($date['month']);
$planMensual->setAnno($date['year']);
$em->persist($planMensual);
//planmensual
$this->manager->flush();
}
}
}
$row++;
}
$this->manager->flush();
}
}
}
}
}
示例13: getRangeFromDateString
public static function getRangeFromDateString($string)
{
$formats = ['Y/m/d', 'Y/m', 'Y'];
$deltas = ['+1 day', '+1 month', '+1 year'];
$to = null;
while ($format = array_pop($formats)) {
$delta = array_pop($deltas);
$from = date_create_from_format($format, $string);
if ($from !== false) {
// Rewind to start of range
$month = 1;
$day = 1;
switch ($format) {
case 'Y/m/d':
$day = (int) $from->format('d');
case 'Y/m':
$month = (int) $from->format('m');
case 'Y':
$year = (int) $from->format('Y');
}
date_date_set($from, $year, $month, $day);
date_time_set($from, 0, 0, 0);
// Create end of the the range
$to = date_modify(clone $from, $delta);
break;
}
}
if (!$from || !$to) {
throw new \InvalidArgumentException(sprintf('Invalid date "%s".', $string));
}
return ['from' => $from->format(Mapping::DATE_FORMAT_CAPTION_PHP), 'to' => $to->format(Mapping::DATE_FORMAT_CAPTION_PHP)];
}
示例14: fix_date_i18n
/** https://core.trac.wordpress.org/ticket/25768
*
* Modified from the original patch to use the currently set
* timezone from PHP, like PHP's date(), and to make the code
* more readable.
*
* @param $j
* @param $req_format
* @param bool $i
* @param bool $gmt
* @return bool|string
*/
function fix_date_i18n($j, $req_format, $i = false, $gmt = false)
{
/* @var $wp_locale WP_Locale */
global $wp_locale;
$timestamp = $i;
// get current timestamp if $i is false
if (false === $timestamp) {
if ($gmt) {
$timestamp = time();
} else {
$timestamp = current_time('timestamp');
}
}
// get components of the date (timestamp) as array
$date_components = getdate($timestamp);
// numeric representation of a month, with leading zeros
$date_month = $wp_locale->get_month($date_components['mon']);
$date_month_abbrev = $wp_locale->get_month_abbrev($date_month);
// numeric representation of the day of the week
$date_weekday = $wp_locale->get_weekday($date_components['wday']);
$date_weekday_abbrev = $wp_locale->get_weekday_abbrev($date_weekday);
// get if hour is Ante meridiem or Post meridiem
$meridiem = $date_components['hours'] >= 12 ? 'pm' : 'am';
// lowercase Ante meridiem and Post meridiem hours
$date_meridiem = $wp_locale->get_meridiem($meridiem);
// uppercase Ante meridiem and Post meridiem
$date_meridiem_capital = $wp_locale->get_meridiem(strtoupper($meridiem));
// escape literals
$date_weekday_abbrev = backslashit($date_weekday_abbrev);
$date_month = backslashit($date_month);
$date_weekday = backslashit($date_weekday);
$date_month_abbrev = backslashit($date_month_abbrev);
$date_meridiem = backslashit($date_meridiem);
$date_meridiem_capital = backslashit($date_meridiem_capital);
// the translated format string
$translated_date_format_string = '';
// the 2 arrays map a format literal to its translation (e. g. 'F' to the escaped month translation)
$translate_formats = array('D', 'F', 'l', 'M', 'a', 'A', 'c', 'r');
$translations = array($date_weekday_abbrev, $date_month, $date_weekday, $date_month_abbrev, $date_meridiem, $date_meridiem_capital, 'Y-m-d\\TH:i:sP', sprintf('%s, d %s Y H:i:s O', $date_weekday_abbrev, $date_month_abbrev));
// find each format literal that needs translation and replace it by its translation
// respects the escaping
// iterate $req_format from ending to beginning
for ($i = strlen($req_format) - 1; $i > -1; $i--) {
// test if current char is format literal that needs translation
$translate_formats_index = array_search($req_format[$i], $translate_formats);
if ($translate_formats_index !== false) {
// counts the slashes (the escape char) in front of the current char
$slashes_counter = 0;
// count all slashes left-hand side of the current char
for ($j = $i - 1; $j > -1; $j--) {
if ($req_format[$j] == '\\') {
$slashes_counter++;
} else {
break;
}
}
// number of slashes is even
if ($slashes_counter % 2 == 0) {
// current char is not escaped, therefore it is a format literal
$translated_date_format_string = $translations[$translate_formats_index] . $translated_date_format_string;
} else {
// current char is escaped, therefore it is not a format literal, just add it unchanged
$translated_date_format_string = $req_format[$i] . $translated_date_format_string;
}
} else {
// current char is no a format literal, just add it unchanged
$translated_date_format_string = $req_format[$i] . $translated_date_format_string;
}
}
$req_format = $translated_date_format_string;
if ($gmt) {
// get GMT date string
$date_formatted = gmdate($req_format, $timestamp);
} else {
// get Wordpress time zone
// $timezone_string = get_option('timezone_string');
// Haha, just kidding. Let's get the currently set timezone, as God and Rasmus intended
$timezone_string = date_default_timezone_get();
if ($timezone_string) {
// create time zone object
$timezone_object = timezone_open($timezone_string);
// create date object from time zone object
$local_date_object = date_create(null, $timezone_object);
// set time and date of $local_date_object to $timestamp
$date_components = isset($date_components) ? $date_components : getdate($timestamp);
date_date_set($local_date_object, $date_components['year'], $date_components['mon'], $date_components['mday']);
date_time_set($local_date_object, $date_components['hours'], $date_components['minutes'], $date_components['seconds']);
// format date according to the Wordpress time zone
//.........这里部分代码省略.........
示例15: import
//.........这里部分代码省略.........
if (is_array($cDati) && count($cDati) > 0) {
$person->setData(array_merge($cDati, array_filter($dati)));
$person->update();
} else {
$person->setData($dati);
$person->insert();
}
} else {
if ($dati['codFisc'] != '') {
$dati['partIVA'] = $dati['codFisc'];
$dati['ragSoc'] = (string) $soggetto->denominazione;
$company->setData(array());
$company->loadFromId($dati['codFisc']);
$cDati = $company->getData();
if (is_array($cDati) && count($cDati) > 0) {
$company->setData(array_merge($cDati, array_filter($dati)));
$company->update();
} else {
$company->setData($dati);
$company->insert();
}
}
}
$correlati = $sXML->xpath('/ADTIReport/visuraCatastale/elencoInfoCatasto/infoCatasto/elencoUnitaImmobiliari/unitaImmobiliari/elencoIntestatari/intestatari/soggetto');
if (!is_array($correlati)) {
$richieste->next();
continue;
}
foreach ($correlati as $correlato) {
$rDati = array();
$rDati['codFisc'] = (string) $correlato->codiceFiscale;
if (strlen($rDati['codFisc']) == 16) {
$rDati['nome'] = (string) $correlato->nominativo->nome;
$rDati['cognome'] = (string) $correlato->nominativo->cognome;
$rDati['dataNas'] = '';
if (is_object($correlato->datiNascita->data) && !is_null($correlato->datiNascita->data->anno)) {
$dateObject = date_date_set(new \DateTime(), (string) $correlato->datiNascita->data->anno, (string) $correlato->datiNascita->data->mese, (string) $correlato->datiNascita->data->giorno);
if (is_object($dateObject)) {
$rDati['dataNas'] = (string) date_format($dateObject, 'Y-m-d');
}
}
$rDati['luogoNas'] = '';
if (is_object($correlato->datiNascita->comune) && !is_null($correlato->datiNascita->comune->descrComune)) {
$rDati['luogoNas'] = trim(preg_replace('/\\(.*\\)/', '', (string) $correlato->datiNascita->comune->descrComune));
}
$rPerson->setData(array());
$rPerson->loadFromId($rDati['codFisc']);
$cDati = $rPerson->getData();
if (is_array($cDati) && count($cDati) > 0) {
$rPerson->setData(array_merge($cDati, array_filter($rDati)));
$rPerson->update();
} else {
$rPerson->setData($rDati);
$rPerson->insert();
}
if ($dati['codFisc'] == $rDati['codFisc']) {
continue;
}
if (strlen($dati['codFisc']) == 16) {
$person->addRelatedPerson($rPerson);
} else {
if ($dati['codFisc'] != '') {
$company->addRelatedExponent($rPerson);
}
}
} else {
if ($rDati['codFisc'] != '') {
$rDati['partIVA'] = $rDati['codFisc'];
$rDati['ragSoc'] = (string) $correlato->denominazione;
$rCompany->setData(array());
$rCompany->loadFromId($rDati['partIVA']);
$cDati = $rCompany->getData();
if (is_array($cDati) && count($cDati) > 0) {
$rCompany->setData(array_merge($cDati, array_filter($rDati)));
$rCompany->update();
} else {
$rCompany->setData($rDati);
$rCompany->insert();
}
if ($dati['codFisc'] == $rDati['codFisc']) {
continue;
}
if (strlen($dati['codFisc']) == 16) {
$rCompany->addRelatedExponent($person);
} else {
if ($dati['codFisc'] != '') {
$rCompany->addRelatedCompany($company);
}
}
}
}
}
$richieste->next();
}
}
if (isset($statHandler)) {
fclose($statHandler);
}
echo PHP_EOL;
}