function printSearchData($searchData) { $this->SetFont('Helvetica', 'B', 11); $this->Cell(0, 5, "Suchkriterien"); $this->Ln(7); $this->SetFont('Helvetica', '', 10); if (array_key_exists('keywords', $searchData) && !empty($searchData["keywords"])) { $this->Cell(0, 5, utf8_decode("Stichwörter: " . $searchData["keywords"])); $this->Ln(5); } if (array_key_exists('district', $searchData)) { $this->Cell(0, 5, "Bezirk: " . utf8_decode(getSingleDistrict($searchData["district"])['district_name'])); $this->Ln(5); } $this->Ln(2); unset($searchData['district']); unset($searchData['keywords']); unset($searchData['image_category']); unset($searchData['image_tags']); foreach ($searchData as $sp) { $attribute = $sp[0]; $values = $sp[1]; if ($attribute > -1 and !empty($values)) { $this->Cell(0, 5, utf8_decode(Idp_Main::getAttributeName($attribute)[0] . ": ")); $this->Ln(5); $this->Cell(5); $count_values = count($values); $this->MultiAlignCell(0, 5, utf8_decode(implode(", ", $values))); $this->Ln(5); } } $this->Ln(5); $this->Hline(); }
</form> <button type="button" class="btn btn-default" data-dismiss="modal"><?php _e('Cancel'); ?> </button> <button type="button" class="btn btn-primary" id="submitCrop"><?php _e('Crop', 'idp-theme'); ?> </button> </div> </div> </div> </div> <?php $tags = Idp_Main::getImageTags(); ?> <div id="imageTagsModal" name="imageTagsModal" class="modal fade" role="dialog" aria-labelledby="imageTagsModal" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h3 id="imageTagsModalLabel"><?php _e('Image tags', 'idp-theme'); ?> </h3> </div> <div class="modal-body"> <div class="row">
</td> <th class="manage-column column-col_value_name" scope="col"><?php echo __('Value', 'idp-plugin'); ?> </th> <th class="manage-column column-col_value_attribute" scope="col"><?php echo __('Attribute', 'idp-plugin'); ?> </th> </tr> </tfoot> <tbody class="searchable"> <?php $values = Idp_Main::getSelectableValues($attribute_id); $categories = Idp_Main::getAttributeCategories(); $row_alternate = true; foreach ($values as $value) { if ($row_alternate) { ?> <tr class=\"alternate\" valign=\"top\"> <?php } else { ?> <tr valign=\"top\"> <?php } ?> <th class="check-column" scope="row"> <label class="screen-reader-text" for="cb-select-<?php echo $value->id;
function generateListPDF($searchData = null) { $pdf = new BuildingListPDF(); $pdf->SetMargins(15, 20, 15); // mm $pdf->bottom_margin = 20; // mm $pdf->page_height = 297; // mm $pdf->SetAutoPageBreak(true, $pdf->bottom_margin); //set pagebreak auto=false $pdf->pagebreak = false; //used for manual pagebreak $pdf->AliasNbPages(); $pdf->SetFont('Helvetica', '', 12); $pdf->left_page_title = "Suchergebnisse"; setlocale(LC_TIME, "de_DE"); $pdf->right_page_title = ltrim(strftime("%d. %B %G"), '0'); $pdf->AddPage(); $pdf->Ln(5); if (is_null($searchData)) { $buildings_count = Idp_Main::getBuildings(true, 0, 1844674407371, 'published'); $buildings = Idp_Main::getBuildings(false, 0, 1844674407371, 'published'); } else { $buildings_count = Idp_Main::searchBuildings($searchData, false, true); $buildings = Idp_Main::searchBuildings($searchData, false, false); $pdf->printSearchData($searchData); } $counter = 1; foreach ($buildings as $building) { $building->address = Idp_Main::getBuildingAddress($building->id); } usort($buildings, create_function('$a, $b', 'return strnatcasecmp($a->address, $b->address);')); $pdf->offset_images = $pdf->GetX(); $pdf->offset_text = $pdf->GetX() + 40; $pdf->YafterImage = 0; $pdf->YafterDescription = 0; $space = 0; foreach ($buildings as $building) { $main_image_thumb = wp_get_attachment_image_src($building->main_image, 'thumbnail'); if ($main_image_thumb === false) { $main_image_thumb[0] = get_template_directory_uri() . "/images/spacer.png"; } $pdf->Y = $pdf->GetY(); $space_left = $pdf->page_height - ($pdf->Y + $pdf->bottom_margin); if (40 > $space_left) { $pdf->AddPage(); $pdf->Ln(5); $pdf->Y = $pdf->GetY(); $pdf->SetX($pdf->offset_images); } $pdf->Image($main_image_thumb[0], $pdf->offset_images, $pdf->Y, 36); $pdf->YafterImage = $pdf->GetY() + 45; $pdf->SetXY($pdf->offset_text, $pdf->Y); $pdf->SetFont('Helvetica', 'B', 12); $pdf->Write(5, utf8_decode($building->address)); $pdf->Ln(5); $pdf->SetFont('Helvetica', '', 12); if (strlen($building->description) > 0) { $pdf->SetX($pdf->offset_text); $pdf->MultiAlignCell(0, 5, utf8_decode($building->description), 0, 2, 'L'); $pdf->YafterDescription = $pdf->GetY(); } else { $pdf->YafterDescription = $pdf->YafterImage; } if ($pdf->YafterImage >= $pdf->YafterDescription) { $pdf->Y = $pdf->YafterImage; $space = 0; } else { $pdf->Y = $pdf->YafterDescription; $space = 5; } if ($pdf->pagebreak) { $pdf->SetY($pdf->YafterDescription + 5); $pdf->pagebreak = false; } else { $pdf->SetY($pdf->Y + $space); } if ($counter == 150) { break; } $counter++; } //all content printed to page -> finished $pdf->Output($pdf->left_page_title . ".pdf", "I", true); exit; }
<input id="cb-select-all-2" type="checkbox"> </td> <th class="manage-column column-col_category_name" scope="col"><?php echo __('Category', 'idp-plugin'); ?> </th> <th class="manage-column column-col_category_ranking" scope="col"><?php echo __('Ranking', 'idp-plugin'); ?> </th> </tr> </tfoot> <tbody class="searchable"> <?php $categories = Idp_Main::getImageCategories(); $row_alternate = true; foreach ($categories as $category) { if ($row_alternate) { ?> <tr class=\"alternate\" valign=\"top\"> <?php } else { ?> <tr valign=\"top\"> <?php } ?> <th class="check-column" scope="row"> <label class="screen-reader-text" for="cb-select-<?php echo $category->id;
if ($ref_image != false && $thumbnail != false && $building['main_image'] != $image_id) { if (($index - 1) % 3 == 0) { $toggle_div = true; ?> <div class="row"> <?php } $image_category = Idp_Main::getImageCategory($image_id); if (!empty($image_category) && $image_category[0]->id > 0) { $image_title = $image_category[0]->name; $image_category = preg_replace('/\\s+/', '', $image_category[0]->name); } else { $image_category = ""; $image_title = ""; } $image_tags = Idp_Main::getImageTags($image_id); $image_tags_string = ""; foreach ($image_tags as $image_tag) { $image_tags_string .= preg_replace('/\\s+/', '', $image_tag->name) . " "; } ?> <div class="col-sm-4 col-md-4 highlighter-images <?php echo $image_category . " " . $image_tags_string; ?> "> <a href="<?php echo $ref_image[0]; ?> " data-lightbox="buildingimages" class="thumbnail" title="<?php echo $image_title; ?>
function printFavButton($building_id, $large = true, $image_id = null) { if (current_user_can('add_favorites')) { $user_id = wp_get_current_user()->ID; $isFavorite = Idp_Main::isFavoriteOfUser($user_id, $building_id); //button contains image_id if available (such that even in image mode, all IDs are distinct) $buttonId = "favButton" . $building_id . ($image_id == null ? "" : "_" . $image_id); if ($large) { ?> <button id="<?php echo $buttonId; ?> " name="<?php echo $buttonId; ?> " type="button" class="btn btn-primary favButton <?php $isFavorite ? print 'active" aria-pressed="true"' : (print '" aria-pressed="false"'); ?> data-toggle="button" data-buildingid="<?php echo $building_id; ?> " autocomplete="off"><span class="glyphicon glyphicon-star<?php $isFavorite ? print '' : (print '-empty'); ?> " aria-hidden="true"></span> </button> <?php } else { ?> <a id="<?php echo $buttonId; ?> " name="<?php echo $buttonId; ?> " class="favButton <?php $isFavorite ? print 'active' : (print ''); ?> "><span class="glyphicon glyphicon-star<?php $isFavorite ? print '' : (print '-empty'); ?> " data-buildingid="<?php echo $building_id; ?> " style="font-size:20px" aria-hidden="true"></span> </a> <?php } if ($large) { ?> <script> $('#<?php echo $buttonId; ?> ').on("click", function () { var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?> '; var buttonName = '<?php echo $buttonId; ?> '; var updateElements = buttonName.split('_')[0]; if ($(this).hasClass('active')){ var data = {'action': 'removeBuildingFromFavorites', 'user_id': '<?php echo $user_id; ?> ', 'building_id': '<?php echo $building_id; ?> '}; jQuery.post(ajaxurl, data, function(response) { $('[id^='+updateElements+'] > span').removeClass().addClass(response); $('[id^='+updateElements+']').removeClass('active'); }); } else{ var data = {'action': 'addBuildingToFavorites', 'user_id': '<?php echo $user_id; ?> ', 'building_id': '<?php echo $building_id; ?> '}; jQuery.post(ajaxurl, data, function(response) { $('[id^='+updateElements+'] > span').removeClass().addClass(response); $('[id^='+updateElements+']').addClass('active'); }); } }); </script> <?php } } }
/** * Delete Building and all its data from the database * * @author Christopher Siewert * @return success */ public static function deleteBuilding($building_id) { global $wpdb; $errors = 0; $images = Idp_Main::getBuildingImages($building_id); foreach ($images as $image) { $result = Idp_Main::deleteBuildingImage($building_id, $image); if ($result === false) { $errors++; } } $building = Idp_Main::getBuildingBasicInfos($building_id); $result = $wpdb->delete($wpdb->prefix . 'building_attribute', array('building' => $building_id), array('%d')); if ($result === false) { $errors++; } $result = $wpdb->delete($wpdb->prefix . 'bounds', array('coordinates' => $building['bounds']), array('%s')); if ($result === false) { $errors++; } $result = $wpdb->delete($wpdb->prefix . 'building', array('id' => $building_id), array('%d')); if ($result === false) { $errors++; } if ($errors > 0) { return false; } else { return true; } }
"><?php echo __('Choose Building', 'idp-plugin'); ?> </label> <input id="cb-select-<?php echo $building->id; ?> " type="checkbox" name="buildings[]" value="<?php echo $building->id; ?> "> </th> <td class="has-row-actions column-primary column-col_building_name"> <?php if (empty($building->address)) { $building->address = Idp_Main::getBuildingAddress($building->id); } echo $building->address; ?> <div class="row-actions"> <span><a href="<?php echo get_page_link(40) . "?buildingid=" . $building->id; ?> " ><?php echo __('Show building', 'idp-plugin'); ?> </a> |</span> <span><a href="<?php echo get_page_link(155) . "?buildingid=" . $building->id; ?> "><?php
<tbody class="searchable"> <?php $categories = Idp_Main::getAttributeCategories(); $row_alternate = true; foreach ($categories as $category) { if ($row_alternate) { ?> <tr class=\"alternate\" valign=\"top\"> <?php } else { ?> <tr valign=\"top\"> <?php } if (count(Idp_Main::getAttributes($category->id)) > 0) { //Attributes exist for this category. Should have no possibility to delete this category $disabled = " disabled=\"disabled\" title=\"" . __('Attributes exist for this category. Move them to another category in order to delete.', 'idp-plugin') . "\" "; } else { $disabled = ""; } ?> <th class="check-column" scope="row"> <label class="screen-reader-text" for="cb-select-<?php echo $category->id; ?> "><?php echo __('Choose Category', 'idp-plugin'); ?> </label> <input id="cb-select-<?php
<small></small></h1> </div> </div> </div> <?php if (!is_user_logged_in()) { idp_showAlertMessage('notLoggedInList'); } else { if ($updated === true) { idp_showAlertMessage('submittedBuilding', 'success'); } else { if ($error === true) { idp_showAlertMessage('submittedError'); } } $buildings = Idp_Main::getStudentBuildings(); if (count($buildings) == 0) { idp_showAlertMessage('noBuildingsStudent', 'warning'); } ?> <div class="row"> <?php foreach ($buildings as $building) { $attachment = wp_get_attachment_image_src($building['main_image'], 'large-thumbnail'); if ($attachment === false) { $attachment[] = get_template_directory_uri() . "/images/spacer.png"; } ?> <div class="col-sm-6 col-lg-4"> <div class="thumbnail"> <img src="<?php
function printAttributeList() { $this->control_me = true; $checkbox_fields = Idp_Main::getCheckboxFields('name'); //define layout for bullet points $bullet_list = array(); $bullet_list['bullet'] = chr(149); $bullet_list['margin'] = ''; $bullet_list['indent'] = 2; $bullet_list['spacer'] = 0; foreach ($this->building['categories'] as $category_id => $category) { $bullet_list['text'] = array(); if ($category === 'Allgemeines') { continue; } $attribute_values = Idp_Main::getBuildingAttributeValues($this->building['id'], $category_id); $attr_value_count = count($attribute_values); if ($attr_value_count == 0) { continue; } for ($j = 0; $j < $attr_value_count; $j++) { if (in_array($attribute_values[$j]['attribute'], $checkbox_fields)) { if ($attribute_values[$j]['value'] === '0') { $attribute_values[$j]['value'] = "Nein"; } else { if ($attribute_values[$j]['value'] === '1') { $attribute_values[$j]['value'] = "Ja"; } } } $bullet_list['text'][$j] = utf8_decode($attribute_values[$j]['attribute'] . ": " . $attribute_values[$j]['value']); } $height_of_cell = 4 + $attr_value_count * 4; // mm, height of a category with its title and content $space_left = $this->page_height - ($this->GetY() + $this->bottom_margin); if ($height_of_cell > $space_left) { $this->AddPage(); // page break $this->pagebreak = true; } if ($this->pagebreak && $this->control_me) { $this->top_second_page = $this->GetY(); $this->left_second_page = $this->GetX(); $this->SetX($this->left_second_page + 120); $this->control_me = false; } $this->SetFont('Helvetica', 'B', 10); $this->MultiCell(0, 5, utf8_decode($category), 0); $this->SetFont('Helvetica', '', 10); if ($this->pagebreak) { $this->SetX($this->GetX() + 120); } $this->MultiCellBltArray(60, 4, $bullet_list); unset($bullet_list['text']); //reset for next category if ($this->pagebreak) { $this->SetX($this->GetX()); } $this->end_position_values = $this->GetY() + 5; } }
echo __('Buildings', 'idp-plugin'); ?> </th> </tr> </tfoot> <tbody class="searchable"> <?php $args = array('exclude' => array(1), 'orderby' => 'id', 'order' => 'ASC', 'fields' => 'all'); $students = get_users($args); usort($students, create_function('$a, $b', 'return strnatcasecmp(Idp_Admin::getUserDisplayName($a), Idp_Admin::getUserDisplayName($b));')); $row_alternate = true; foreach ($students as $student) { $user_roles = $student->roles; $roles_count = count($user_roles); $buildings = Idp_Main::getStudentBuildings($student->ID); $buildings_count = count($buildings); $status = __('Has not yet started.', 'idp-plugin'); if ($row_alternate) { ?> <tr class=\"alternate\" valign=\"top\"> <?php } else { ?> <tr valign=\"top\"> <?php } ?> <th class="check-column" scope="row"> <label class="screen-reader-text" for="cb-select-<?php echo $student->id;
<?php } } } } ?> </div> </div> <!-- CONTENT END --> <script> var all_building_bounds = []; <?php foreach ($districts as $district) { $all_building_bounds = Idp_Main::getAllBuildingBounds($district["district_id"]); echo "all_building_bounds.push(" . json_encode($all_building_bounds) . ");\n"; } ?> </script> <?php wp_enqueue_style('leaflet.draw', get_template_directory_uri() . '/css/leaflet.draw.css'); wp_enqueue_style('leaflet', get_template_directory_uri() . '/css/leaflet.css'); wp_enqueue_script('leaflet', get_template_directory_uri() . '/js/leaflet.js'); wp_enqueue_script('leaflet.draw', get_template_directory_uri() . '/js/leaflet.draw.js'); wp_enqueue_script('frontend-add-building', get_template_directory_uri() . '/js/frontend-add-building.js'); get_footer();
} ?> <!-- CONTENT START --> <div class="row"> <div class="col-lg-12"> <div class="page-header"> <h1> <?php _e('Delete building', 'idp-theme'); ?> <small> <?php if (!$error && !$success) { echo Idp_Main::getBuildingAddress($buildingid); } ?> </small> </h1> </div> </div> </div> <?php if (!is_user_logged_in()) { idp_showAlertMessage('notLoggedIn'); } else { if ($error) { ?> <div class="alert alert-danger" role="alert">
</div> </div> </div> <?php $search = [' ', '(', ')']; foreach ($categories as $category) { echo "<div class=\"panel panel-default\">"; echo "<div class=\"panel-heading\">"; echo "<h4 class=\"panel-title\">"; echo "<a data-toggle=\"collapse\" data-parent=\"#accordion\" href=\"#" . str_replace($search, '', $category->name) . "\">" . $category->name . "</a>"; echo "</h4>"; echo "</div>"; echo "<div id=\"" . str_replace($search, '', $category->name) . "\" class=\"panel-collapse collapse\">"; echo "<div class=\"panel-body\">"; $attributes = Idp_Main::getAttributes($category->id); $attribute_count = count($attributes); $row_counter = 1; echo "<div class=\"col-md-12\">"; // foreach ($attributes as $attribute) { if ($row_counter % 2 != 0) { echo "<div class=\"row\">"; } echo "<div class=\"col-md-6\">"; echo "<div class=\"form-group\" id=\"form-" . str_replace(' ', '', $attribute->attribute) . "\">"; if (trim($attribute->description) != '') { $tooltip = "<span data-toggle=\"tooltip\" title=\"{$attribute->description}\" class=\"glyphicon glyphicon-info-sign\"></span>"; } else { $tooltip = ""; }
<?php $pdf_url = content_url("pdf"); $path = parse_url($pdf_url); $pdf_directory = ABSPATH . ltrim($path['path'], '/'); require_once IDP__PLUGIN_DIR . 'lib/idp-functions-pdf.php'; $message = null; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (!empty($_POST) && check_admin_referer('submissions', 'submissions_nonce')) { if (!empty($_POST['buildings'])) { $buildings = $_POST['buildings']; foreach ($buildings as $building) { if (!empty($_POST['reject'])) { $result = Idp_Main::updateBuildingStatus($building, 'complete'); } else { $result = Idp_Main::updateBuildingStatus($building, 'published'); } $errors = 0; $success = 0; if ($result === false) { $errors += 1; } else { if (!empty($_POST['generate_pdf']) && $_POST['generate_pdf'] == "1" && !empty($_POST['publish'])) { generateSinglePDF($building, "F"); } $success += 1; } $message = $success - $errors . " " . __('out of', 'idp-plugin') . " " . count($buildings) . " " . __('marked buildings have been updated', 'idp-plugin'); } } }
<tbody class="searchable"> <?php $attributes = Idp_Main::getAttributes($category_id_filter); $row_alternate = true; foreach ($attributes as $attribute) { if ($row_alternate) { ?> <tr class=\"alternate\" valign=\"top\"> <?php } else { ?> <tr valign=\"top\"> <?php } if (count(Idp_Main::getAllSetValuesForAttribute($attribute->id)) > 0) { //there are published buildings with values set for this attribute. Don't allow to delete it $disabled = " disabled=\"disabled\" title=\"" . __('There are published buildings with values set for this attribute. Thus, it is not possible to delete this attribute. Please hide it instead.', 'idp-plugin') . "\""; } else { $disabled = ""; } ?> <th class="check-column" scope="row"> <label class="screen-reader-text" for="cb-select-<?php echo $attribute->id; ?> "><?php echo __('Choose Attribute', 'idp-plugin'); ?> </label> <input id="cb-select-<?php