function getData($buildingid) { $this->building = Idp_Main::getBuildingBasicInfos($buildingid); if (!array_key_exists('id', $this->building)) { return false; } $this->main_image = wp_get_attachment_image_src($this->building['main_image'], 'large-thumbnail'); if ($this->main_image === false) { $this->main_image[0] = get_template_directory_uri() . "/images/spacer.png"; } $this->building_images = Idp_Main::getBuildingImages($buildingid); $this->images_total_count = count($this->building_images) > 18 ? 18 : count($this->building_images); $this->main_address = Idp_Main::getBuildingAddress($buildingid); if (!empty($this->building['submission_date'])) { $tmp_date = $this->building['submission_date']; } else { $tmp_date = $this->building['creation_date']; } $this->date = mysql2date('d.m.Y', $tmp_date); $user_info = get_userdata($this->building['creation_user']); $this->student = $user_info->last_name . ", " . $user_info->first_name; return true; }
} ?> <!-- 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">
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; }
"><?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