<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>出票系统</title>
        <link rel="stylesheet" href="/css/information-system3.css?v=201508112" type="text/css" />
        <script type="text/javascript" src="/min/?f=/js/information-system3.min.js,/js/common.js"></script>
        <link rel="shortcut icon" href="/bootstrap/img/glyphicons_290_skull.png">
    </head>

    <body>
        <nav class="navbar navbar-inverse">
            <div class="container-fluid">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-9" aria-expanded="false">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="/"><span class="glyphicon glyphicon-home text-white"></span></a>
                </div>

                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-9">
                    <ul class="nav navbar-nav navbar-right">
                        <?php
                        $all_unread_sms = get_all_unread_sms();
                        $info_unread_sms = get_all_unread_sms('info');
                        if (isset($information->ic_id))
                            $current_msg = $information->ic_id;
                        if (isset($task->t_id))
                            $current_msg = $task->t_id;
                        $total_count = $all_unread_sms['sms_count'] + $info_unread_sms['sms_count']; //计算未读消息总数
                        $unread_sms_ic_id = 0; //用于设置所有收录消息为已读
                        if ($total_count != 0) {
                            ?>
                            <!-- 如果当前页面存在未读消息，则消息数减一 -->
                            <?php
                            if (isset($current_msg) && isset($all_unread_sms['sms'][$current_msg])) {
                                $total_count = $total_count - count($all_unread_sms['sms'][$current_msg]);
                                unset($all_unread_sms['sms'][$current_msg]);
                            }
                            ?>
                            <?php
                            if (isset($current_msg) && isset($info_unread_sms['sms'][$current_msg])) {
                                $total_count = $total_count - count($info_unread_sms['sms'][$current_msg]);
                                unset($info_unread_sms['sms'][$current_msg]);
                            }
                            ?>
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                    <i class="icon-envelope icon-white pull-left" style="margin-top:3px;"></i> <span class="badge badge-important pull-right"><?php echo $total_count; ?></span>
                                </a>
                                <ul class="dropdown-menu">
                                    <!-- 信息平台的消息 -->
                                    <?php if (isset($info_unread_sms['sms']) && !empty($info_unread_sms['sms'])) { ?>
                                        <a style="padding-left:20px;" href="javascript:void(0);" onclick="set_allmsg_to_read($('#unreadinfomsg').val());">标记全部收录信息为已读</a>
                                        <li class="divider"></li>
                                        <?php foreach ($info_unread_sms['sms'] as $m) { ?>
                                            <li><a href="<?php echo site_url('information/edit/' . $m[0]->is_id); ?>"><?php
                                                    $t_title = get_text_short($m[0]->t_title, 15);
                                                    echo '[' . $m[0]->ic_sitecode . '] ' . $t_title['content'] . ' (' . $m[0]->m_content . ')';
                                                    ?></a></li>
                                            <?php $unread_sms_ic_id.=',' . $m[0]->m_object_id; ?>
                                        <?php } ?>
                                        <li class="divider"></li>
                                        <input type="hidden" name="unreadinfomsg" id="unreadinfomsg" value="<?php echo $unread_sms_ic_id; ?>">
                                    <?php } ?>
                                    <!--作者平台的消息-->
                                    <?php foreach ($all_unread_sms['sms'] as $am) { ?>
                                        <li><a href="<?php echo site_url('author/edit_task/' . $am[0]->m_object_id); ?>"><?php
                                                $t_title = get_text_short($am[0]->t_title, 15);
                                                echo $t_title['content'] . ' (' . count($am) . ')';
                                                ?></a></li>
                                    <?php } ?>
                                </ul>
                            </li>
                        <?php } ?>
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                <?php
                                echo $this->config->item('site_code');
                                echo ' -';
                                $admin_info = $this->session->userdata('session_admin');
                                echo $admin_info['OPI_Name'];
                                ?>
                                <b class="caret"></b>
                            </a>
                            <ul class="dropdown-menu">
                                <?php foreach ($this->config->item('site') as $site_item) { ?>
                                    <li> <a href="<?php echo site_url('login/change_site/' . $site_item['site_code']); ?>" ><?php echo $site_item['site_code'] ?></a></li>
                                <?php } ?>
                                <li><a href="<?php echo site_url('login/out'); ?>" >退出</a></li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
        </nav>