Skip to content

Commit

Permalink
Version 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasKrais committed Jun 26, 2017
1 parent 4c6f29b commit 07fcbc0
Show file tree
Hide file tree
Showing 13 changed files with 249 additions and 44 deletions.
10 changes: 1 addition & 9 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
$clang_id = count(rex_clang::getAllIds()) == 1 ? rex_clang::getStartId() : 0;
if($sql->getRows() == 0) {
$sql->setQuery("INSERT INTO `". rex::getTablePrefix() ."url_generate` (`article_id`, `clang_id`, `url`, `table`, `table_parameters`, `relation_table`, `relation_table_parameters`, `relation_insert`, `createdate`, `createuser`, `updatedate`, `updateuser`) VALUES
(". rex_article::getSiteStartArticleId() .", ". $clang_id .", '', '1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties', '{\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_field_1\":\"name\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_field_2\":\"\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_field_3\":\"\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_id\":\"property_id\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_clang_id\":\"clang_id\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_restriction_field\":\"\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_restriction_operator\":\"=\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_restriction_value\":\"\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_url_param_key\":\"property_id\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_seo_title\":\"seo_title\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_seo_description\":\"seo_description\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_sitemap_add\":\"1\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_sitemap_frequency\":\"monthly\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_sitemap_priority\":\"1.0\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_sitemap_lastmod\":\"updatedate\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_path_names\":\"\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_path_categories\":\"0\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_relation_field\":\"category_id\"}', '1_xxx_relation_". rex::getTablePrefix() ."d2u_immo_url_categories', '{\"1_xxx_relation_". rex::getTablePrefix() ."d2u_immo_url_categories_field_1\":\"parent_name\",\"1_xxx_relation_". rex::getTablePrefix() ."d2u_immo_url_categories_field_2\":\"name\",\"1_xxx_relation_". rex::getTablePrefix() ."d2u_immo_url_categories_field_3\":\"\",\"1_xxx_relation_". rex::getTablePrefix() ."d2u_immo_url_categories_id\":\"category_id\",\"1_xxx_relation_". rex::getTablePrefix() ."d2u_immo_url_categories_clang_id\":\"clang_id\"}', 'before', UNIX_TIMESTAMP(), 'd2u_immo_addon_installer', UNIX_TIMESTAMP(), 'd2u_immo_addon_installer');");
(". rex_article::getSiteStartArticleId() .", ". $clang_id .", '', '1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties', '{\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_field_1\":\"name\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_field_2\":\"property_id\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_field_3\":\"\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_id\":\"property_id\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_clang_id\":\"clang_id\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_restriction_field\":\"\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_restriction_operator\":\"=\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_restriction_value\":\"\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_url_param_key\":\"property_id\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_seo_title\":\"seo_title\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_seo_description\":\"seo_description\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_sitemap_add\":\"1\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_sitemap_frequency\":\"monthly\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_sitemap_priority\":\"1.0\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_sitemap_lastmod\":\"updatedate\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_path_names\":\"\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_path_categories\":\"0\",\"1_xxx_". rex::getTablePrefix() ."d2u_immo_url_properties_relation_field\":\"category_id\"}', '1_xxx_relation_". rex::getTablePrefix() ."d2u_immo_url_categories', '{\"1_xxx_relation_". rex::getTablePrefix() ."d2u_immo_url_categories_field_1\":\"parent_name\",\"1_xxx_relation_". rex::getTablePrefix() ."d2u_immo_url_categories_field_2\":\"name\",\"1_xxx_relation_". rex::getTablePrefix() ."d2u_immo_url_categories_field_3\":\"\",\"1_xxx_relation_". rex::getTablePrefix() ."d2u_immo_url_categories_id\":\"category_id\",\"1_xxx_relation_". rex::getTablePrefix() ."d2u_immo_url_categories_clang_id\":\"clang_id\"}', 'before', UNIX_TIMESTAMP(), 'd2u_immo_addon_installer', UNIX_TIMESTAMP(), 'd2u_immo_addon_installer');");
}
$sql->setQuery("SELECT * FROM ". rex::getTablePrefix() ."url_generate WHERE `table` = '1_xxx_". rex::getTablePrefix() ."d2u_immo_url_categories'");
if($sql->getRows() == 0) {
Expand All @@ -170,14 +170,6 @@
$sql->setQuery("INSERT INTO ". rex::getTablePrefix() ."media_manager_type_effect (`type_id`, `effect`, `parameters`, `priority`, `createdate`, `createuser`) VALUES
(". $last_id .", 'resize', '{\"rex_effect_convert2img\":{\"rex_effect_convert2img_convert_to\":\"jpg\",\"rex_effect_convert2img_density\":\"100\"},\"rex_effect_crop\":{\"rex_effect_crop_width\":\"\",\"rex_effect_crop_height\":\"\",\"rex_effect_crop_offset_width\":\"\",\"rex_effect_crop_offset_height\":\"\",\"rex_effect_crop_hpos\":\"left\",\"rex_effect_crop_vpos\":\"top\"},\"rex_effect_filter_blur\":{\"rex_effect_filter_blur_repeats\":\"\",\"rex_effect_filter_blur_type\":\"\",\"rex_effect_filter_blur_smoothit\":\"\"},\"rex_effect_filter_colorize\":{\"rex_effect_filter_colorize_filter_r\":\"\",\"rex_effect_filter_colorize_filter_g\":\"\",\"rex_effect_filter_colorize_filter_b\":\"\"},\"rex_effect_filter_sharpen\":{\"rex_effect_filter_sharpen_amount\":\"\",\"rex_effect_filter_sharpen_radius\":\"\",\"rex_effect_filter_sharpen_threshold\":\"\"},\"rex_effect_flip\":{\"rex_effect_flip_flip\":\"X\"},\"rex_effect_header\":{\"rex_effect_header_download\":\"open_media\",\"rex_effect_header_cache\":\"no_cache\"},\"rex_effect_insert_image\":{\"rex_effect_insert_image_brandimage\":\"\",\"rex_effect_insert_image_hpos\":\"left\",\"rex_effect_insert_image_vpos\":\"top\",\"rex_effect_insert_image_padding_x\":\"\",\"rex_effect_insert_image_padding_y\":\"\"},\"rex_effect_mediapath\":{\"rex_effect_mediapath_mediapath\":\"\"},\"rex_effect_mirror\":{\"rex_effect_mirror_height\":\"\",\"rex_effect_mirror_set_transparent\":\"colored\",\"rex_effect_mirror_bg_r\":\"\",\"rex_effect_mirror_bg_g\":\"\",\"rex_effect_mirror_bg_b\":\"\"},\"rex_effect_resize\":{\"rex_effect_resize_width\":\"768\",\"rex_effect_resize_height\":\"768\",\"rex_effect_resize_style\":\"maximum\",\"rex_effect_resize_allow_enlarge\":\"not_enlarge\"},\"rex_effect_rotate\":{\"rex_effect_rotate_rotate\":\"0\"},\"rex_effect_rounded_corners\":{\"rex_effect_rounded_corners_topleft\":\"\",\"rex_effect_rounded_corners_topright\":\"\",\"rex_effect_rounded_corners_bottomleft\":\"\",\"rex_effect_rounded_corners_bottomright\":\"\"},\"rex_effect_workspace\":{\"rex_effect_workspace_width\":\"\",\"rex_effect_workspace_height\":\"\",\"rex_effect_workspace_hpos\":\"left\",\"rex_effect_workspace_vpos\":\"top\",\"rex_effect_workspace_set_transparent\":\"colored\",\"rex_effect_workspace_bg_r\":\"\",\"rex_effect_workspace_bg_g\":\"\",\"rex_effect_workspace_bg_b\":\"\"}}', 1, '". date("Y-m-d H:i:s") ."', 'd2u_immo');");
}
$sql->setQuery("SELECT * FROM ". rex::getTablePrefix() ."media_manager_type WHERE name = 'd2u_immo_overview'");
if($sql->getRows() == 0) {
$sql->setQuery("INSERT INTO ". rex::getTablePrefix() ."media_manager_type (`status`, `name`, `description`) VALUES
(1, 'd2u_immo_overview', 'D2U Immobilien Bild auf Immobilien Übersichtsseite.');");
$last_id = $sql->getLastId();
$sql->setQuery("INSERT INTO ". rex::getTablePrefix() ."media_manager_type_effect (`type_id`, `effect`, `parameters`, `priority`, `createdate`, `createuser`) VALUES
(". $last_id .", 'resize', '{\"rex_effect_convert2img\":{\"rex_effect_convert2img_convert_to\":\"jpg\",\"rex_effect_convert2img_density\":\"100\"},\"rex_effect_crop\":{\"rex_effect_crop_width\":\"\",\"rex_effect_crop_height\":\"\",\"rex_effect_crop_offset_width\":\"\",\"rex_effect_crop_offset_height\":\"\",\"rex_effect_crop_hpos\":\"left\",\"rex_effect_crop_vpos\":\"top\"},\"rex_effect_filter_blur\":{\"rex_effect_filter_blur_repeats\":\"\",\"rex_effect_filter_blur_type\":\"\",\"rex_effect_filter_blur_smoothit\":\"\"},\"rex_effect_filter_colorize\":{\"rex_effect_filter_colorize_filter_r\":\"\",\"rex_effect_filter_colorize_filter_g\":\"\",\"rex_effect_filter_colorize_filter_b\":\"\"},\"rex_effect_filter_sharpen\":{\"rex_effect_filter_sharpen_amount\":\"\",\"rex_effect_filter_sharpen_radius\":\"\",\"rex_effect_filter_sharpen_threshold\":\"\"},\"rex_effect_flip\":{\"rex_effect_flip_flip\":\"X\"},\"rex_effect_header\":{\"rex_effect_header_download\":\"open_media\",\"rex_effect_header_cache\":\"no_cache\"},\"rex_effect_insert_image\":{\"rex_effect_insert_image_brandimage\":\"\",\"rex_effect_insert_image_hpos\":\"left\",\"rex_effect_insert_image_vpos\":\"top\",\"rex_effect_insert_image_padding_x\":\"\",\"rex_effect_insert_image_padding_y\":\"\"},\"rex_effect_mediapath\":{\"rex_effect_mediapath_mediapath\":\"\"},\"rex_effect_mirror\":{\"rex_effect_mirror_height\":\"\",\"rex_effect_mirror_set_transparent\":\"colored\",\"rex_effect_mirror_bg_r\":\"\",\"rex_effect_mirror_bg_g\":\"\",\"rex_effect_mirror_bg_b\":\"\"},\"rex_effect_resize\":{\"rex_effect_resize_width\":\"768\",\"rex_effect_resize_height\":\"768\",\"rex_effect_resize_style\":\"maximum\",\"rex_effect_resize_allow_enlarge\":\"enlarge\"},\"rex_effect_rotate\":{\"rex_effect_rotate_rotate\":\"0\"},\"rex_effect_rounded_corners\":{\"rex_effect_rounded_corners_topleft\":\"\",\"rex_effect_rounded_corners_topright\":\"\",\"rex_effect_rounded_corners_bottomleft\":\"\",\"rex_effect_rounded_corners_bottomright\":\"\"},\"rex_effect_workspace\":{\"rex_effect_workspace_width\":\"\",\"rex_effect_workspace_height\":\"\",\"rex_effect_workspace_hpos\":\"left\",\"rex_effect_workspace_vpos\":\"top\",\"rex_effect_workspace_set_transparent\":\"colored\",\"rex_effect_workspace_bg_r\":\"\",\"rex_effect_workspace_bg_g\":\"\",\"rex_effect_workspace_bg_b\":\"\"}}', 1, '". date("Y-m-d H:i:s") ."', 'd2u_immo');");
}

// YForm e-mail template
$sql->setQuery("SELECT * FROM ". rex::getTablePrefix() ."yform_email_template WHERE name = 'd2u_immo_request'");
Expand Down
14 changes: 12 additions & 2 deletions lib/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,23 @@ public function isChild() {

/**
* Gets the properties of the category.
* @param string $market_type KAUF, MIETE_PACHT, ERBPACHT, LEASING or empty (all)
* @param boolean $only_online Show only online properties
* @return Property[] Properties in this category
*/
public function getProperties() {
public function getProperties($market_type = '', $only_online = FALSE) {
$query = "SELECT lang.property_id FROM ". rex::getTablePrefix() ."d2u_immo_properties_lang AS lang "
."LEFT JOIN ". rex::getTablePrefix() ."d2u_immo_properties AS properties "
."ON lang.property_id = properties.property_id "
."WHERE category_id = ". $this->category_id ." AND clang_id = ". $this->clang_id .' ';
."WHERE category_id = ". $this->category_id ." AND clang_id = ". $this->clang_id ." ";
if($only_online || $market_type != '') {
if($only_online) {
$query .= "AND online_status = 'online' ";
}
if($market_type != '') {
$query .= "AND market_type = '". $market_type ."' ";
}
}
if(rex_addon::get('d2u_immo')->hasConfig('default_property_sort') && rex_addon::get('d2u_immo')->getConfig('default_property_sort') == 'priority') {
$query .= 'ORDER BY priority ASC';
}
Expand Down
3 changes: 3 additions & 0 deletions lib/d2u_immo_module_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ public static function getD2UImmoModules() {
$modules[] = new D2UModule("70-2",
"D2U Immo Addon - Infobox Ansprechpartner",
1);
$modules[] = new D2UModule("70-3",
"D2U Immo Addon - Ausgabe Kategorie",
1);
return $modules;
}
}
2 changes: 1 addition & 1 deletion lib/property.php
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ public function changeWindowAdvertisingStatus() {
* @return string OpenImm Object ID
*/
private function createOpenImmoObjectID() {
return "OD2U". date('YmdHis', time()) ."000". rand(1000000000, 9999999999);
return "OD2U". date('YmdHis', time()) ."000". rand(10000, 99999). rand(10000, 99999);
}

/**
Expand Down
50 changes: 27 additions & 23 deletions modules/70/1/output.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function printPropertylist($properties) {
if($property->object_reserved) {
print '<div class="reserved">';
}
print '<img src="index.php?rex_media_type=d2u_immo_overview&rex_media_file='.
print '<img src="index.php?rex_media_type=d2u_helper_sm&rex_media_file='.
$property->pictures[0] .'" alt='. $property->name .' class="listpic">';
if($property->object_reserved) {
print '<span>'. $tag_open .'d2u_immo_object_reserved'. $tag_close .'</span>';
Expand Down Expand Up @@ -153,22 +153,25 @@ function printImages($pics) {
}
$property = new Property($property_id, rex_clang::getCurrentId());

print '<div class="col-12 expose-navi hidden-print">';
print '<ul>';
print '<li><small><a href="'. rex_getUrl($d2u_immo->getConfig('article_id')) .'"><span class="icon back"></span> '. $tag_open .'d2u_immo_back_to_list'. $tag_close .'</a></small></li>';
print '<li><small><a href="'. $property->getURL(TRUE).'?print=small" target="blank"><span class="icon print"></span> '. $tag_open .'d2u_immo_print_short_expose'. $tag_close .'</a></small></li>';
print '<li><small><a href="'. $property->getURL(TRUE).'?print=full" target="blank"><span class="icon print"></span> '. $tag_open .'d2u_immo_print_expose'. $tag_close .'</a></small></li>';
if($property->market_type == "MIETE_PACHT" && $d2u_immo->hasConfig('even_informative_pdf') && $d2u_immo->getConfig('even_informative_pdf') != '') {
print '<li><small><a href="'. rex_url::media('mieterselbstauskunft.pdf') .'"><span class="icon pdf"></span> '. $tag_open .'d2u_immo_tentant_information'. $tag_close .'</a></small></li>';
}
print '</ul>';
print '</div>';
if($print == "") {
print '<div class="col-12 expose-navi hidden-print">';
print '<ul>';
print '<li><small><a href="'. rex_getUrl($d2u_immo->getConfig('article_id')) .'"><span class="icon back"></span> '. $tag_open .'d2u_immo_back_to_list'. $tag_close .'</a></small></li>';
// Following links see Chrome print bug: https://github.com/twbs/bootstrap/issues/22753
print '<li><small><a href="javascript:onclick=window.open(\''. $property->getURL(TRUE).'?print=small\', \'_blank\',\'width=500, height=500\');" target="blank"><span class="icon print"></span> '. $tag_open .'d2u_immo_print_short_expose'. $tag_close .'</a></small></li>';
print '<li><small><a href="javascript:onclick=window.open(\''. $property->getURL(TRUE).'?print=full\', \'_blank\',\'width=500, height=500\');" target="blank"><span class="icon print"></span> '. $tag_open .'d2u_immo_print_expose'. $tag_close .'</a></small></li>';
if($property->market_type == "MIETE_PACHT" && $d2u_immo->hasConfig('even_informative_pdf') && $d2u_immo->getConfig('even_informative_pdf') != '') {
print '<li><small><a href="'. rex_url::media('mieterselbstauskunft.pdf') .'"><span class="icon pdf"></span> '. $tag_open .'d2u_immo_tentant_information'. $tag_close .'</a></small></li>';
}
print '</ul>';
print '</div>';

print '<div class="col-12 visible-print-inline">';
print '<p>'. $property->contact->firstname .' '. $property->contact->lastname .'<br>';
print $tag_open .'d2u_immo_form_phone'. $tag_close .': '. $property->contact->phone .'<br>';
print $tag_open .'d2u_immo_form_email'. $tag_close .': '. $property->contact->email .'<p>';
print '</div>';
print '<div class="col-12 visible-print-inline">';
print '<p>'. $property->contact->firstname .' '. $property->contact->lastname .'<br>';
print $tag_open .'d2u_immo_form_phone'. $tag_close .': '. $property->contact->phone .'<br>';
print $tag_open .'d2u_immo_form_email'. $tag_close .': '. $property->contact->email .'<p>';
print '</div>';
}

// Tabs
if($print == "") {
Expand Down Expand Up @@ -211,13 +214,13 @@ function printImages($pics) {
if($property->object_reserved || $property->object_sold) {
print '<div class="reserved">';
}
print '<img src="index.php?rex_media_type=d2u_immo_overview&rex_media_file='.
print '<img src="index.php?rex_media_type=d2u_helper_sm&rex_media_file='.
$property->pictures[0] .'" alt="'. $property->name .'" class="overviewpic">';
if($property->object_reserved) {
print '<span>'. $tag_open .'d2u_immo_object_reserved'. $tag_close .'</span>';
print '<span class="hidden-print">'. $tag_open .'d2u_immo_object_reserved'. $tag_close .'</span>';
}
else if($property->object_sold) {
print '<span>'. $tag_open .'d2u_immo_object_sold'. $tag_close .'</span>';
print '<span class="hidden-print">'. $tag_open .'d2u_immo_object_sold'. $tag_close .'</span>';
}
if($property->object_reserved || $property->object_sold) {
print '</div>'; // <div class="reserved">
Expand Down Expand Up @@ -417,7 +420,8 @@ function printImages($pics) {
print '<div class="col-12">&nbsp;</div>';
}

if(strtoupper($property->object_type) == "HAUS" || strtoupper($property->object_type) == "WOHNUNG" || strtoupper($property->object_type) == "BUERO_PRAXEN") {
if((strtoupper($property->object_type) == "HAUS" || strtoupper($property->object_type) == "WOHNUNG" || strtoupper($property->object_type) == "BUERO_PRAXEN")
&& (count($property->bath) > 0 || count($property->kitchen) > 0 || count($property->floor_type) > 0 || count($property->elevator) > 0 || $property->cable_sat_tv || count($property->broadband_internet) > 0)) {
if($print != "") { // Remove when https://github.com/twbs/bootstrap/issues/22753 is solved
print '<div class="row page-break-avoid">';
}
Expand Down Expand Up @@ -558,7 +562,7 @@ function printImages($pics) {
if($print != "full") {
print '<div id="tab_pictures" class="tab-pane immo-tab fade">'; // START tab picures
}
print '<div class="row page-break-avoid">'; // START pictures
print '<div class="row">'; // START pictures
print '<div class="col-12 visible-print-inline print-border-h">';
print "<h2>". $tag_open .'d2u_immo_tab_pictures'. $tag_close ."</h2>";
print '</div>';
Expand All @@ -569,7 +573,7 @@ function printImages($pics) {
print '</div>'; // END pictures

if(count($property->ground_plans) > 0) {
print '<div class="row page-break-avoid">';
print '<div class="row">';
print '<div class="col-12 print-border-h">';
print "<h2>". $tag_open .'d2u_immo_ground_plans'. $tag_close ."</h2>";
print '</div>';
Expand All @@ -579,7 +583,7 @@ function printImages($pics) {
}

if (count($property->location_plans) > 0) {
print '<div class="row page-break-avoid">';
print '<div class="row">';
print '<div class="col-12 print-border-h">';
print "<h2>". $tag_open .'d2u_immo_location_plans'. $tag_close ."</h2>";
print '</div>';
Expand Down
Empty file removed modules/70/1/styles.css
Empty file.
Loading

0 comments on commit 07fcbc0

Please sign in to comment.