<?php require APPPATH_MVC.'views/header.php'; ?>

<!--会员中心主体 Start-->
<div class="w960 clearfix mt10 pepcenterBox">
<?php require APPPATH_MVC.'views/left.php'; ?>
    <!--会员左侧 End-->
	<div class="user-main user-main02">
			<div class="hd-bar pos-r">
        	 <h2>求租</h2><a class="btnLink" href="<?php echo GB_PUBLISH_URL;?>?kind=4<?php echo GB_CITY=='wh'?'&newWh=1':'' ?>" target="_blank">我要求租</a>
        </div>
    <div class="user-main user-main03">
        <form id="search_form" name="search_form" accept-charset="gbk" method="post" action="/want/rentlist"> 
        <div class="mod-list for-rent">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table-style-a">
            <?php if(is_array($rent_data) && !empty($rent_data) ){?>
              <tr>
                <th>目标区域</th>
                <th>要求</th>
                <th>状态</th>
                <th width="110">操作</th>
              </tr>
                <?php
                foreach($rent_data as $key =>$value)
		{
                    //背景
                     if($value['esta']==1)
                     {
                        $bg =  $key % 2 == 1 ? 'class="odd"' : 'class=""' ;
                     }
                     else
                     {
                        $bg =  $key % 2 == 1 ? 'class="odd info2"' : 'class=" info2 "' ;
                     }

                    //建筑面积
                    if( $value['buildarea1'] > 0 || $value['buildarea2'] > 0)
                    {
                            $buildarea = $value['buildarea1'].'-'.$value['buildarea2'].'㎡<em class="t-line">|</em>';
                    }
                    else if( $value['buildarea1'] != '' && $value['buildarea2'] != '-' )
                    {
                            $buildarea = $value['buildarea'].'㎡<em class="t-line">|</em>';
                    }
                    else
                    {
                            $buildarea = '';
                    }

                    //价格
                    if( $value['price1'] > 0 || $value['price2'] > 0)
                    {
                            $price = $value['price1'].'-'.$value['price2'].'元/月<em class="t-line">|</em>';
                    }
                    else if( $value['price'] != '' && $value['buildyear'] != '-' )
                    {
                            $price = $value['price'].'元/月<em class="t-line">|</em>';
                    }
                    else
                    {
                            $price = '';
                    }

                    //户型
                    if( $value['room'] > 0 && $value['room'] > 0)
                    {
                            $room = $value['room'].'室<em class="t-line">|</em>';
                    }
                    else
                    {
                            $room = '';
                    }

                    //租赁方式
                    if( $value['renttype'] != '')
                    {
                            $renttype = $value['renttype'].'<em class="t-line">|</em>';
                    }
                    else
                    {
                            $renttype = '';
                    }

                    //来源
                    if( $value['infofrom'] >= 0 && $value['infofrom'] >= 0)
                    {
                            $infofrom = $value['infofrom'] == 0 ? '不限' : $house['infofrom'][$value['infofrom']];
                    }
                    else
                    {
                            $infofrom = '';
                    }
               ?>
              <tr <?php echo $bg;?>>
                <td title="<?=$value['address'];?>">
                <?php if($value['esta']==1){?>
               <?=csubstr2($value['address'],38,1);?>
                <?php }else{?>
                <?=csubstr2($value['address'],38,1);?>
                <?php }?>
                </td>
                <td><?=$buildarea.$price.$renttype.$room.$infofrom;?></td>
                <?php if($value['esta']==1){?>
                    <?php if($value['allow_match'] == 1 && GB_CITY=='nj'){?>
                    <td>有<span class="c-ff8400"><?=$value['new_matched_num'];?></span>条新房源</td>
                    <?php }elseif(GB_CITY=='nj'){?>
                    <td>未参与匹配</td>
                    <?php }else{?>
					<td>已激活</td>
					<?php }?>
                <?php }else if( $value['esta'] == 0 || $value['esta'] == '-10' ){?>
                <td>审核中</td>
                <?php }else if($value['esta'] == 2 || $value['esta']== 3 || $value['esta']==  4 ){?>
                <td>已删除</td>
                <?php }else{?>
                <td>审核未通过</td>
                <?php }?>
                <?php if( $value['esta']==1  && $value['allow_match'] == 1 && $value['matched_num'] >= 1  && GB_CITY=='nj'){ ?>
                <td><a href="javascript:void(0)" class="lookFor" want_id='<?=$value['id'];?>'>查看匹配</a>
                <a class="lookFor002" href="javascript:submit_all_del('del',<?=$value['id'];?>,'0','<?php echo md5($value['id'].'house365')?>')">删除</a></td>
                <?php }elseif($value['esta']==1 && GB_CITY=='nj'){ ?>
                <td><span class="lookForNone" style="float:left;line-height:38px;width:70px;">查看匹配</span><a class="lookFor002" href="javascript:submit_all_del('del',<?=$value['id'];?>,'0','<?php echo md5($value['id'].'house365')?>')">删除</a></td>
                <?php }elseif(GB_CITY=='nj'){ ?>
                <td><span class="lookForNone">查看匹配</span></td>
                <? }elseif(GB_CITY!='nj' && $value['esta']==1){?>
				<td><a href="javascript:submit_all_del('del',<?=$value['id'];?>,'0','<?php echo md5($value['id'].'house365')?>')">删除</a></td>
			    <?php }elseif(GB_CITY!='nj' && $value['esta']!=1){?>
			    <td><a class="lookForNone">删除</a></td>
				<?php } ?>

              </tr>
              <?php
               }}else{
              ?>
              <div class="no-result">您还没有发布求租信息，去发布吧。<a href="<?php echo GB_PUBLISH_URL.'?kind=4';?>" target="_blank">立即前往&gt;&gt;</a></div>
              <?php } ?>
            </table>
			<?php if(is_array($rent_data) && !empty($rent_data) ){?>	<div class="solidDiv">&nbsp;</div><?php }?>
            <div class="showBox">
            	<a href="javascript:void(0)" class="showBox-close">关闭</a>
                <iframe frameborder="0"  height="332" id='matched_window' scrolling="no" width="703" src=""></iframe>
            </div>
        </div>
        <?=form_hidden('page', $page);?>
        <input type='hidden' name='want_type' id='want_type' value="<?=$want_type?>" >
        <?php if( !empty($pagination) ): ?>
        <!--分页-->
        <div class="cut-page"><?=$pagination?></div>
        <!--分页-->
        <? endif; ?>

         <?=form_close()?>
				 		<div style="margin-top:11px; height:1px; overflow:hidden; zoom:1; font-size:0; line-height:normal;">&nbsp;</div>
		 <div class="nounExplanation">
						<p>1、求购求租必须为真实、有效的个人房源需求，联系电话为本人电话。</p>
						<p>2、中介冒充个人进行发布，房源将不允许上传。</p>
						<p>3、<strong class="title">待审核：</strong>待审核中的信息除了您自己外，其他人无法看到，不能修改，工作人员会在24小时内为您审核。</p>
						<p>4、<strong class="title">审核未通过：</strong>该房源未经过网站二次房源审核，必要时向网站提供相关材料给网站，验证合格后，方可发布，需要电话客服。</p>
                        <?php if(GB_CITY=='nj'){?>
						<p>5、前台默认勾选“我要参加房源匹配”，房源不在前台展示，进入后台进行匹配。如果您选的是个人，则只收到您的需求相关最新的个人房源，如果您选择中介房源，将定期收到中介发送过来的相关房源。</p>
						<p>6、您每天会收到给您匹配的房源，您可以登陆个人会员中心进行查看。</p>
                        <?php }?>
				</div>
    </div>
    <!--会员右侧 End-->
</div>
 </div>
<!--会员中心主体 End-->

<script>


function submit_all_del(type,id,mark,code){

    if(id) {
    if(mark==1)
    {
     $("#pop_win_1").hide();
     $.ajax({
     type: 'post',
     url : '<?php echo USER_CENTER;?>want/updatewant',
     data: 'type='+type+'&id='+id+'&code='+code+'&tbl=rentwanted',
     dataType:'html',
     success: function(msg){

              if(type == 'del')
              {
                  switch(msg)
                  {
                   case '1':
                   $("#war-text").html("删除成功");
                   break;

                   case '2':
                   $("#war-text").html("验证不通过，来源不正确");
                   break;

                   case '3':
                   $("#war-text").html("删除失败");
                   break;
                  }
              }
                openWin('warning');

         }
       });

    }else{

        if(type == 'del')
        {
        $("#pop_text").html("确定要删除这条求租信息吗");
        $("#pop_sure").attr("href","javascript:submit_all_del('"+type+"',"+id+",1,'"+code+"')");
        }
        openWin('pop_win_1');
    }

    }
}
</script>

<?php
if($isa_website!=''){
?>
<script type="text/javascript">
	var isa_website = "<?=$isa_website?>";
	var isa_city = "<?=$isa_city?>";
	var isa_addones = "<?=$isa_addones?>";

	var _analyze365 = (('https:' == document.location.protocol) ? ' https://': ' http://');
	document.write(unescape('%3Cscript src="'+ _analyze365 + '<?=$isa_url?>" type="text/javascript"%3E%3C/script%3E'));
</script>
<?php
}
?>
<script type='text/javascript'>
	var website="2";
    var ga_city = "<?=$isa_city?>";
    var ga_channel = 'center';
    var ga_page= "/个人中心/求租";
</script>
<script language="javascript" src="http://stat.house365.com/365count.js"></script>


<?php require APPPATH_MVC.'views/footer.php'; ?>
<div style="display:none;width:390px;height:200px; position:absolute;left:50%;top:300px;margin-left:-85px;-moz-box-shadow: 0 0 34px #cacaca;-webkit-box-shadow: 0 0 34px #cacaca;box-shadow: 0 0 34px #cacaca; z-index:9999" id="pop_win_1" class="pop_win">
		<div style="height:40px;background:#FF8400" class="hd">
				<h2 style="font-size:14px;color:#fff;font-weight:800; position:absolute;left:10px;top:10px">提示</h2>
				<a style="display:block;width:30px;height:30px;background:url(<?php echo USER_CENTER;?>images/pop-ico.gif) 0 -80px no-repeat; position:absolute;right:10px;top:6px; text-indent:-999px; overflow:hidden" class="close-win" href="javascript:void(0)">关闭</a></div>
		<div style="background:#fff;height:160px" class="bd">
				<div style="width:70px;height:80px;background:url(<?php echo USER_CENTER;?>images/pop-ico.gif) no-repeat -2px -113px; position:absolute;left:70px;top:60px"></div>
				<p style="position:absolute;left:140px;top:85px;font-size:14px" id="pop_text">你确定要删除该求租信息吗？</p>
				<div style="text-align:center;position:absolute;top:155px;width:100%;"><a style="*position:relative;background:#29B966;color:#fff;padding:7px 15px;margin:0 5px;border:1px solid #26AB5E" class="refresh-ok" href="javascript:submit_all(1)" date-num="0" id="pop_sure">确定</a><a style="*position:relative;background:#F5F5F5;color:#666;padding:7px 15px;margin:0 5px;border:1px solid #CCCCCC" class="close-win" href="javascript:void(0)">取消</a></div>
		</div>
</div>
<div id="warning" class="pop" style=" display:none;z-index:100">
		<div class="hd">
				<h2>提示</h2>
				<a href="javascript:void(0)" class="close-win">关闭</a> </div>
		<div class="bd">
				<div class="warning-inner">
						<div class="war-bg" style="background:url(<?php echo USER_CENTER;?>images/pop-ico.gif)  0 0 no-repeat;"></div>
						<p class="war-text" id="war-text"></p>
				</div>
				<div class="pop-btn-area"><a href="javascript:location.reload();" class="close-win" style="background:#29B966;color:#fff;padding:7px 15px;margin:0 5px;border:1px solid #26AB5E">确定</a></div>
		</div>
</div>