* @project ApPHP Medical Appointment * @copyright (c) 2012 ApPHP * @author ApPHP <*****@*****.**> * @license http://www.gnu.org/licenses/ */ // *** Make sure the file isn't accessed directly defined('APPHP_EXEC') or die('Restricted Access'); //-------------------------------------------------------------------------- if ($objLogin->IsLoggedInAsCustomer() && Modules::IsModuleInstalled('listings')) { $action = MicroGrid::GetParameter('action'); $rid = MicroGrid::GetParameter('rid'); $listing_id = MicroGrid::GetParameter('listing_id', false); $mode = 'view'; $msg = ''; if (!empty($listing_id)) { $objListingsCategories = new ListingsCategories($listing_id, 'me'); if ($action == 'add') { $mode = 'add'; } else { if ($action == 'create') { if ($objListingsCategories->AddRecord()) { $msg = draw_success_message(_ADDING_OPERATION_COMPLETED, false); $mode = 'view'; } else { $msg = draw_important_message($objListingsCategories->error, false); $mode = 'add'; } } else { if ($action == 'edit') { $mode = 'edit'; } else {
/** * Draw single listing * @param $draw */ public function DrawListing($draw = true) { $output = ''; $nl = "\n"; if (isset($this->listing_info[1]) && $this->listing_info[1] > 0) { // get info about some fields that depends on advertise plan $advertise_plan_info = AdvertisePlans::GetPlanInfo($this->GetField('advertise_plan_id')); $bpf_business_name = $advertise_plan_info[0]['business_name']; $bpf_business_description = $advertise_plan_info[0]['business_description']; $bpf_address = $advertise_plan_info[0]['address']; $bpf_logo = $advertise_plan_info[0]['logo']; $bpf_images_count = $advertise_plan_info[0]['images_count']; $bpf_phone = $advertise_plan_info[0]['phone']; $bpf_map = $advertise_plan_info[0]['map']; $bpf_video_link = $advertise_plan_info[0]['video_link']; $bpf_inquiry_button = $advertise_plan_info[0]['inquiry_button']; $bpf_rating_button = $advertise_plan_info[0]['rating_button']; $nl = "\n"; if ($bpf_logo && $bpf_images_count && !Application::Get('js_included', 'lytebox')) { $output .= '<!-- LyteBox v3.22 Author: Markus F. Hay Website: http://www.dolem.com/lytebox -->' . $nl; $output .= '<link rel="stylesheet" href="modules/lytebox/css/lytebox.css" type="text/css" media="screen" />' . $nl; $output .= '<script type="text/javascript" language="javascript" src="modules/lytebox/js/lytebox.js"></script>' . $nl; } if (Modules::IsModuleInstalled('ratings') == 'yes' && $bpf_rating_button) { $output .= '<link href="modules/ratings/css/ratings.css" rel="stylesheet" type="text/css" />'; if (Application::Get('lang_dir') == 'rtl') { $output .= '<link href="modules/ratings/css/ratings-rtl.css" rel="stylesheet" type="text/css" />'; } $ratings_lang = file_exists('modules/ratings/langs/' . Application::Get('lang') . '.js') ? Application::Get('lang') : 'en'; $output .= '<script src="modules/ratings/langs/' . $ratings_lang . '.js" type="text/javascript"></script>'; $output .= '<script src="modules/ratings/js/ratings.js" type="text/javascript"></script>'; } $output .= '<div class="listing_description">'; $output .= '<div class="wide_block">' . $nl; if ($bpf_rating_button) { $output .= '<div class="ratings_stars" id="rt_listing_' . $this->GetField('id') . '"></div>' . $nl; } if ($bpf_business_name) { $output .= '<h2>' . $this->GetField('business_name') . '</h2><br />' . $nl; } $output .= '<ul class="l_items">' . $nl; if ($bpf_address && $this->GetField('business_address') != '') { $output .= '<li><span class="l_item">' . _ADDRESS . ':</span> <span class="l_description">' . $this->GetField('business_address') . '</span></li>' . $nl; } if ($bpf_phone && $this->GetField('business_phone') != '') { $output .= '<li><span class="l_item">' . _PHONE . ':</span> <span class="l_description">' . $this->GetField('business_phone') . '</span></li>' . $nl; } if ($bpf_phone && $this->GetField('business_fax') != '') { $output .= '<li><span class="l_item">' . _FAX . ':</span> <span class="l_description">' . $this->GetField('business_fax') . '</span></li>' . $nl; } if ($this->GetField('website_url') != '') { $output .= '<li><span class="l_item">' . _WEB_SITE . ':</span> <span class="l_description"><a href="' . $this->GetField('website_url') . '" target="_blank">' . $this->GetField('website_url') . '</a> <img src="images/external_link.gif" alt="" /></span></li>' . $nl; } if ($this->GetField('business_email') != '') { $output .= '<li><span class="l_item">' . _EMAIL_ADDRESS . ':</span> <span class="l_description"><a href="mailto:' . $this->GetField('business_email') . '" target="_blank">' . $this->GetField('business_email') . '</a></span></li>' . $nl; } if ($bpf_video_link && $this->GetField('video_url') != '') { $output .= '<li><span class="l_item">' . _VIDEO . ':</span> <span class="l_description"><a href="' . $this->GetField('video_url') . '" target="_blank">' . $this->GetField('video_url') . '</a> <img src="images/external_link.gif" alt="" /></span></li>' . $nl; } $output .= '<li><span class="l_item">' . _LOCATION . ':</span> <span class="l_description">' . $this->GetField('listing_location') . '</span></li>' . $nl; $output .= '<li><span class="l_item">' . _SUB_LOCATION . ':</span> <span class="l_description">' . $this->GetField('listing_sub_location') . '</span></li>' . $nl; if ($this->GetField('date_published') != '0000-00-00 00:00:00') { $output .= '<li><span class="l_item">' . _PUBLISHED . ':</span> <span class="l_description">' . format_datetime($this->GetField('date_published'), get_datetime_format(false), _UNKNOWN) . '</span></li>' . $nl; } if ($bpf_business_description) { $output .= '<li><span class="l_item">' . _DESCRIPTION . ':</span> <br>' . $this->GetField('business_description') . '</li>' . $nl; } $added_categories = ListingsCategories::GetCategoriesForListing($this->GetField('id')); $arr_added_categories = array(); $output .= '<li><span class="l_item">' . _CATEGORIES . ':</span><br>'; $categories = ''; foreach ($added_categories[0] as $key => $val) { $categories .= !empty($categories) ? ', ' : ''; $categories .= prepare_link('category', 'cid', $val['category_id'], '', $val['name'], '', ''); } $output .= $categories; $output .= '</li>'; $output .= '</ul>'; $output .= '</div>'; $output .= '<div class="narrow_block">'; $output .= '<div class="listing_images_wrapper">'; if ($bpf_logo) { $image_file = $this->GetField('image_file') != '' ? $this->GetField('image_file') : ''; $image_file_thumb = $this->GetField('image_file_thumb') != '' ? $this->GetField('image_file_thumb') : 'no_image.png'; if (!empty($image_file)) { $output .= '<a href="images/listings/' . $image_file . '" rel="lyteshow' . $this->GetField('id') . '">'; } $output .= '<img class="listing_image' . ($image_file == '' ? ' no_hover' : '') . '" src="images/listings/' . $image_file_thumb . '" alt="" />'; if (!empty($image_file)) { $output .= '</a>'; } $output .= '<br />'; } $additional_images = array(); for ($i = 1; $i <= $bpf_images_count; $i++) { $additional_image = $this->GetField('image_' . $i) != '' ? $this->GetField('image_' . $i) : ''; $additional_image_thumb = $this->GetField('image_' . $i . '_thumb') != '' ? $this->GetField('image_' . $i . '_thumb') : ''; if ($additional_image != '') { $output .= '<a href="images/listings/' . $additional_image . '" rel="lyteshow' . $this->GetField('id') . '">'; $output .= '<img class="listing_icon" src="images/listings/' . $additional_image_thumb . '" alt="" />'; $output .= '</a>'; } } $output .= '</div>'; $map_code = $this->GetField('map_code', false); if ($bpf_map && $map_code != '') { $map_code = preg_replace('/width="(.*?)"/', 'width="240px"', $map_code); $map_code = preg_replace('/height="(.*?)"/', 'height="200px"', $map_code); $output .= '<div class="map">' . $map_code . '</div><br /><br />'; } if (Modules::IsModuleInstalled('inquiries') == 'yes' && $bpf_inquiry_button) { $output .= '<form name="frmDirectInquiry" action="index.php?page=inquiry_form" method="post">'; $output .= draw_token_field(false); $output .= draw_hidden_field('listing_id', $this->listing_info[0]['id'], false); $output .= draw_hidden_field('visitor_locations', $this->listing_info[0]['listing_location_id'], false); $output .= draw_hidden_field('visitor_sub_locations', $this->listing_info[0]['listing_sub_location_id'], false); $output .= draw_hidden_field('business_name', $this->GetField('business_name'), false); $output .= draw_hidden_field('inquiry_type', '1', false); $output .= '<center><input type="submit" class="form_button" value="' . _SUBMIT_INQUIRY . '"></center>'; $output .= '</form><br /><br />'; } $output .= '</div>'; $output .= '<div style="clear:both;"></div>'; $output .= '</div>'; } else { $output .= draw_important_message(_NO_LISTINGS_TO_DISPLAY, false); } if ($draw) { echo $output; } else { return $output; } }