private static function createZones() { $id_provincia = Zone::getIdByName(SeurLib::$seur_zones[0]); if ($id_provincia) { self::$provincia = new Zone($id_provincia); self::$provincia->active = 1; } else { self::$provincia = new Zone(); self::$provincia->name = html_entity_decode(SeurLib::$seur_zones[0]); } $id_peninsula = Zone::getIdByName(SeurLib::$seur_zones[1]); if ($id_peninsula) { self::$peninsula = new Zone($id_peninsula); self::$peninsula->active = 1; } else { self::$peninsula = new Zone(); self::$peninsula->name = html_entity_decode(SeurLib::$seur_zones[1]); } $id_portugal = Zone::getIdByName(SeurLib::$seur_zones[2]); if ($id_portugal) { self::$portugal = new Zone($id_portugal); self::$portugal->active = 1; } else { self::$portugal = new Zone(); self::$portugal->name = html_entity_decode(SeurLib::$seur_zones[2]); } $id_baleares = Zone::getIdByName(SeurLib::$seur_zones[3]); if ($id_baleares) { self::$baleares = new Zone($id_baleares); self::$baleares->active = 1; } else { self::$baleares = new Zone(); self::$baleares->name = html_entity_decode(SeurLib::$seur_zones[3]); } $id_canarias = Zone::getIdByName(SeurLib::$seur_zones[4]); if ($id_canarias) { self::$canarias = new Zone($id_canarias); self::$canarias->active = 1; } else { self::$canarias = new Zone(); self::$canarias->name = html_entity_decode(SeurLib::$seur_zones[4]); } $id_ceuta_melilla = Zone::getIdByName(SeurLib::$seur_zones[5]); if ($id_ceuta_melilla) { self::$ceuta_melilla = new Zone($id_ceuta_melilla); self::$ceuta_melilla->active = 1; } else { self::$ceuta_melilla = new Zone(); self::$ceuta_melilla->name = html_entity_decode(SeurLib::$seur_zones[5]); } if (!self::$provincia->save() || !self::$peninsula->save() || !self::$portugal->save() || !self::$baleares->save() || !self::$canarias->save() || !self::$ceuta_melilla->save()) { return false; } return true; }