数据集为空容错判断

hotfix/远程访问多媒体中心
尹诚诚 8 years ago
parent f3e68cbdc2
commit 6951aed701

@ -1,5 +1,8 @@
<ol style="padding-left: 15px;padding-top:15px;"> <ol style="padding-left: 15px;padding-top:15px;">
<?php foreach ($search_list as $key => $list) { ?> <?php
if (!empty($search_list)) {
foreach ($search_list as $key => $list) {
?>
<?php if ((!isset($search_type) && !in_array($list->ic_id, explode(',', $ic_id_list))) || isset($search_type)) { ?> <?php if ((!isset($search_type) && !in_array($list->ic_id, explode(',', $ic_id_list))) || isset($search_type)) { ?>
<li style="line-height:30px;"> <li style="line-height:30px;">
<a target="_blank" href="<?php echo $this->config->item('site_url') . $list->ic_url; ?>"><?php echo $list->ic_url_title; ?><?php if (isset($search_type) && $search_type == 'recommended') echo '[已选择]'; ?></a> <a target="_blank" href="<?php echo $this->config->item('site_url') . $list->ic_url; ?>"><?php echo $list->ic_url_title; ?><?php if (isset($search_type) && $search_type == 'recommended') echo '[已选择]'; ?></a>
@ -10,7 +13,8 @@
<?php } ?> <?php } ?>
</li> </li>
<?php } ?> <?php } ?>
<?php } ?> <?php }
} ?>
</ol> </ol>
<script type="text/javascript"> <script type="text/javascript">
@ -24,8 +28,10 @@
for (var i = 0; i < list.length; i++) { for (var i = 0; i < list.length; i++) {
if (ic_id != list[i] && list[i] != '') { if (ic_id != list[i] && list[i] != '') {
new_list += list[i] + ','; new_list += list[i] + ',';
}; }
}; ;
}
;
$('#' + popoverID).val(new_list); $('#' + popoverID).val(new_list);
var $a = $(that).prev('a'); var $a = $(that).prev('a');
@ -34,7 +40,8 @@
var html = '<li style="line-height:30px;"><a target="_blank" href="' + href + '">' + ic_url_title + '</a><span class="pull-right" style="cursor: pointer;" data-icid="' + ic_id + '" onclick="javascript:add_recommend_list(this,' + ic_id + ');">添加</span></li>'; var html = '<li style="line-height:30px;"><a target="_blank" href="' + href + '">' + ic_url_title + '</a><span class="pull-right" style="cursor: pointer;" data-icid="' + ic_id + '" onclick="javascript:add_recommend_list(this,' + ic_id + ');">添加</span></li>';
if ($("#recommend_list>ol").length == 0) { if ($("#recommend_list>ol").length == 0) {
$("#recommend_list").append('<ol style="padding-left: 15px;padding-top:15px;"></ol>'); $("#recommend_list").append('<ol style="padding-left: 15px;padding-top:15px;"></ol>');
}; }
;
$("#recommend_list>ol").prepend(html); $("#recommend_list>ol").prepend(html);
setTimeout(resize_recommend_list(9), 0); setTimeout(resize_recommend_list(9), 0);
$(that).parent('li').remove(); $(that).parent('li').remove();
@ -51,7 +58,8 @@
var html = '<li style="line-height:30px;"><a target="_blank" href="' + href + '">' + ic_url_title + '[已选择]</a><span class="pull-right text-danger" style="cursor: pointer;" data-icid="' + ic_id + '" onclick="javascript:del_recommend(this,' + ic_id + ');">移除</span></li>'; var html = '<li style="line-height:30px;"><a target="_blank" href="' + href + '">' + ic_url_title + '[已选择]</a><span class="pull-right text-danger" style="cursor: pointer;" data-icid="' + ic_id + '" onclick="javascript:del_recommend(this,' + ic_id + ');">移除</span></li>';
if ($("#recommended_list>ol").length == 0) { if ($("#recommended_list>ol").length == 0) {
$("#recommended_list").append('<ol style="padding-left: 15px;padding-top:15px;"></ol>'); $("#recommended_list").append('<ol style="padding-left: 15px;padding-top:15px;"></ol>');
}; }
;
$("#recommended_list>ol").append(html); $("#recommended_list>ol").append(html);
setTimeout(resize_recommend_list(10), 0); setTimeout(resize_recommend_list(10), 0);
$(that).parent('li').remove(); $(that).parent('li').remove();

Loading…
Cancel
Save