<?php
    /*
     *      Osclass – software for creating and publishing online classified
     *                           advertising platforms
     *
     *                        Copyright (C) 2012 OSCLASS
     *
     *       This program is free software: you can redistribute it and/or
     *     modify it under the terms of the GNU Affero General Public License
     *     as published by the Free Software Foundation, either version 3 of
     *            the License, or (at your option) any later version.
     *
     *     This program is distributed in the hope that it will be useful, but
     *         WITHOUT ANY WARRANTY; without even the implied warranty of
     *        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     *             GNU Affero General Public License for more details.
     *
     *      You should have received a copy of the GNU Affero General Public
     * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
     */

       osc_get_premiums(5);
    if(osc_count_premiums() > 0) {
?>

        <?php while(osc_has_premiums()) { ?>
		<?php  $index = 0;
				         
                ?>
            <div class="estate" style="background:#F6EBCB">
                <div class="left">
                    <a href="<?php echo osc_premium_url() ; ?>"><?php if( osc_images_enabled_at_items() ) { ?>
                        <?php if( osc_count_premium_resources() ) { ?>
                            <img src="<?php echo osc_resource_thumbnail_url() ; ?>" title="<?php echo osc_premium_title(); ?>" alt="<?php echo osc_premium_title(); ?>"/>
                        <?php } else { ?>
                            <img src="<?php echo osc_current_web_theme_url('images/no_photo.gif') ; ?>" alt="" title=""/>
                        <?php } ?>
                   
                    <?php } ?>
                    <?php if( osc_price_enabled_at_items() ) { ?><div class="price" style="background:#ff0000"><?php echo osc_premium_formated_price() ; ?></div> <?php } ?>
                    </a>
                </div>
                <div class="right">
                    <div class="title">
                        <h3><a href="<?php echo osc_premium_url() ; ?>"><?php if(strlen(osc_premium_title()) > 101){ echo mb_substr(osc_premium_title(), 0, 100,'UTF-8').'...'; } else { echo osc_premium_title(); } ?></a></h3> </div>
						<div class="list_des">
						<?php if(strlen(osc_premium_description()) > 351){ echo mb_substr(osc_premium_description(), 0, 350,'UTF-8').'...'; } else { echo osc_premium_description(); } ?>
						</div>
					<div class="more" style="display:inline;">
					<div class="city" style="float:left;">&nbsp;&nbsp;<i class="fa fa-map-marker-v fa-lm2"></i>&nbsp;<?php echo osc_premium_city();?></div>
                    <div class="data" style="float:right;"><i class="fa fa-clock-o-v fa-lm2"></i>&nbsp;<?php echo osc_format_date(osc_premium_pub_date()); ?></div>
                        </div>
                </div>
            </div>
        <?php
                            $index++;
                            if($index == 5){
                                break; 
                            }
                        }
                    ?>  
<?php } ?>
   
		
		<?php $i = 0; ?>
		<?php while(osc_has_items()) { $i++; ?>
				
            <div class="estate">
                <div class="left" >
                    <a href="<?php echo osc_item_url() ; ?>"><?php if( osc_images_enabled_at_items() ) { ?>
                        <?php if( osc_count_item_resources() ) { ?>
                            <img src="<?php echo osc_resource_thumbnail_url() ; ?>" title="<?php echo osc_item_title(); ?>" alt="<?php echo osc_item_title(); ?>"/>
                        <?php } else { ?>
                            <img src="<?php echo osc_current_web_theme_url('images/no_photo.gif') ; ?>" alt="" title=""/>
                        <?php } ?>
              
                    <?php } ?>
                    <?php if( osc_price_enabled_at_items() ) { ?><div class="price"><?php echo osc_item_formated_price() ; ?></div> <?php } ?>
                    </a>
                </div>
                <div class="right">
                    <div class="title">
                        <h3><a href="<?php echo osc_item_url() ; ?>"><?php if(strlen(osc_item_title()) > 101){ echo mb_substr(osc_item_title(), 0, 100,'UTF-8').'...'; } else { echo osc_item_title(); } ?></a></h3> </div>
						<div class="list_des">
						<?php if(strlen(osc_item_description()) > 351){ echo strip_tags( mb_substr(osc_item_description(), 0, 350,'UTF-8').'...'); } else { echo osc_item_description(); } ?>
						</div>
					<div class="more" style="display:inline;">
					
                    <div class="city" style="float:left;">&nbsp;&nbsp;<i class="fa fa-map-marker fa-lm2"></i>&nbsp;<?php echo osc_item_city();?></div>
                    <div class="data" style="float:right;"><i class="fa fa-clock-o fa-lm2"></i>&nbsp;<?php echo osc_format_date(osc_item_pub_date()); ?></div>
                        
 
					</div>
                </div>
            </div>
			<?php if( $i == 5 ) { ?>
			<?php osc_run_hook('search_middle'); ?>
<?php } ?>
        <?php } ?>
		<br>
		