Skip to content

Commit

Permalink
make 360° export optional
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasKrais committed Apr 15, 2023
1 parent 025b6b1 commit 9ffa2e1
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pages/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

<p>1.2.0:</p>
<ul>
<li>Feld für 360° Bilder hinzugefügt.</li>
<li>Feld für 360° Bilder hinzugefügt. Der Export von 360° Bildern kann in den Einstellungen jedes Portals manuell aktiviert werden.</li>
<li>Feld "Property::rent_plus_vat" war seit Version 1.1.1 deprecated und ist nun entfernt.</li>
<li>Twitter Support endgültig entfernt.</li>
<li>Ca. 1400 rexstan Level 9 Anpassungen.</li>
Expand Down
1 change: 1 addition & 0 deletions plugins/export/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
->ensureColumn(new \rex_sql_column('ftp_username', 'VARCHAR(50)', true))
->ensureColumn(new \rex_sql_column('ftp_password', 'VARCHAR(50)', true))
->ensureColumn(new \rex_sql_column('ftp_filename', 'VARCHAR(50)', true))
->ensureColumn(new \rex_sql_column('ftp_supports_360_pictures', 'TINYINT(1)', true, '0'))
->ensureColumn(new \rex_sql_column('social_app_id', 'VARCHAR(191)', true))
->ensureColumn(new \rex_sql_column('social_app_secret', 'VARCHAR(191)', true))
->ensureColumn(new \rex_sql_column('social_oauth_token', 'VARCHAR(191)', true))
Expand Down
1 change: 1 addition & 0 deletions plugins/export/lang/de_de.lang
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ d2u_immo_export_ftp_filename = Dateiname (nur wenn Name vom Portal vorgeschriebe
d2u_immo_export_ftp_password = FTP Passwort
d2u_immo_export_ftp_server = FTP Server
d2u_immo_export_ftp_settings = FTP Einstellungen für OpenImmo Schnittstellen
d2u_immo_export_ftp_supports_360_pictures = Portal unterstützt die Darstellung von 360° Bildern
d2u_immo_export_ftp_username = FTP Benutzername
d2u_immo_export_last_export_date = Letzter Export am
d2u_immo_export_image_too_large = Bilddatei ist zu groß um für den Export vorbereitet zu werden. Bitte ersetzen Sie das Bild im Medienpool mit einer verkleinerten Version.
Expand Down
10 changes: 6 additions & 4 deletions plugins/export/lib/aftpexport.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,12 @@ protected function preparePictures($max_pics = 10): void
++$pics_counter;
}
}
foreach ($property->pictures_360 as $picture_360) {
if (strlen($picture_360) > 3 && $pics_counter < $max_pics) {
$this->preparePicture($picture_360);
++$pics_counter;
if ($this->provider->ftp_supports_360_pictures) {
foreach ($property->pictures_360 as $picture_360) {
if (strlen($picture_360) > 3 && $pics_counter < $max_pics) {
$this->preparePicture($picture_360);
++$pics_counter;
}
}
}
foreach ($property->ground_plans as $groundplan) {
Expand Down
10 changes: 6 additions & 4 deletions plugins/export/lib/openimmo.php
Original file line number Diff line number Diff line change
Expand Up @@ -961,10 +961,12 @@ public function createXML()
++$zaehler;
}
}
foreach ($property->pictures_360 as $bild) {
if (strlen($bild) > 3) {
$objekt_anhaenge[$zaehler] = ['PANORAMA' => $bild];
++$zaehler;
if ($this->provider->ftp_supports_360_pictures) {
foreach ($property->pictures_360 as $bild) {
if (strlen($bild) > 3) {
$objekt_anhaenge[$zaehler] = ['PANORAMA' => $bild];
++$zaehler;
}
}
}
// Grundrisse auslesen
Expand Down
10 changes: 6 additions & 4 deletions plugins/export/lib/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ class Provider
/** @var string provider interface name */
public string $type = '';

/**
* @var int Redaxo language id. Represents the language, the object should
* be exported.
*/
/** @var int Redaxo language id. Represents the language, the object should be exported. */
public int $clang_id = 0;

/** @var string Company name (your company name) */
Expand All @@ -58,6 +55,9 @@ class Provider
/** @var string FTP filename (including file type, normally .zip) */
public string $ftp_filename = '';

/** @var bool If true, 360° pictures are supported */
public bool $ftp_supports_360_pictures = false;

/** @var string media manager type for exporting pictures */
public string $media_manager_type = 'd2u_immo_list_tile';

Expand Down Expand Up @@ -108,6 +108,7 @@ public function __construct($provider_id)
$this->ftp_username = (string) $result->getValue('ftp_username');
$this->ftp_password = (string) $result->getValue('ftp_password');
$this->ftp_filename = (string) $result->getValue('ftp_filename');
$this->ftp_supports_360_pictures = 1 === (int) $result->getValue('ftp_supports_360_pictures') ? true : false;
$this->company_name = (string) $result->getValue('company_name');
$this->company_email = (string) $result->getValue('company_email');
$this->media_manager_type = (string) $result->getValue('media_manager_type');
Expand Down Expand Up @@ -416,6 +417,7 @@ public function save()
."ftp_username = '". $this->ftp_username ."', "
."ftp_password = '". $this->ftp_password ."', "
."ftp_filename = '". $this->ftp_filename ."', "
.'ftp_supports_360_pictures = '. (int) $this->ftp_supports_360_pictures .', '
."social_app_id = '". $this->social_app_id ."', "
."social_app_secret = '". $this->social_app_secret ."', "
."social_oauth_token = '". $this->social_oauth_token ."', "
Expand Down
2 changes: 2 additions & 0 deletions plugins/export/pages/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
$provider->ftp_username = $form['ftp_username'];
$provider->ftp_password = $form['ftp_password'];
$provider->ftp_filename = $form['ftp_filename'];
$provider->ftp_supports_360_pictures = array_key_exists('ftp_supports_360_pictures', $form);
$provider->social_app_id = $form['social_app_id'];
$provider->social_app_secret = $form['social_app_secret'];
$provider->linkedin_email = $form['linkedin_email'];
Expand Down Expand Up @@ -113,6 +114,7 @@
d2u_addon_backend_helper::form_input('d2u_immo_export_ftp_username', 'form[ftp_username]', $provider->ftp_username, false, $readonly, 'text');
d2u_addon_backend_helper::form_input('d2u_immo_export_ftp_password', 'form[ftp_password]', $provider->ftp_password, false, $readonly, 'text');
d2u_addon_backend_helper::form_input('d2u_immo_export_ftp_filename', 'form[ftp_filename]', $provider->ftp_filename, false, $readonly, 'text');
d2u_addon_backend_helper::form_checkbox('d2u_immo_export_ftp_supports_360_pictures', 'form[ftp_supports_360_pictures]', 'true', $provider->ftp_supports_360_pictures, $readonly);
?>
</div>
</fieldset>
Expand Down

0 comments on commit 9ffa2e1

Please sign in to comment.