<?php

    echo "<div class='col-md-5'>
          <div class='box'>
            <div class='box-header'>
              <h3 class='box-title'>Selamat Datang di Halaman Psikolog</h3>
            </div>
            <div class='box-body'>
              <p>Silahkan klik menu pilihan yang berada di sebelah kiri untuk mengelola Tulisan anda pada web ini, berikut informasi akun anda saat ini : </p>
              <dl class='dl-horizontal'>
                <dt>Username</dt>
                <dd>$users[username]</dd>

                <dt>Password</dt>
                <dd>***********</dd>

                <dt>Nama Lengkap</dt>
                <dd>$users[nama_lengkap]</dd>

                <dt>Alamat Email</dt>
                <dd>$users[email]</dd>

                <dt>No. Telpon</dt>
                <dd>$users[no_telp]</dd>

                <dt>Level</dt>
                <dd>$users[level]</dd>

                <dt>Hak Akses</dt>
                <dd>"; 
                    $hakakses = $this->db->query("SELECT * FROM modul,users_modul WHERE modul.id_modul=users_modul.id_modul AND users_modul.id_session='".$this->session->id_session."'");
                    foreach ($hakakses->result_array() as $mod1) {
                        echo "<a href='$mod1[link]'>$mod1[nama_modul]</a>, ";
                    }
                echo "</dd>
              </dl>
              <div class='alert alert-success alert-dismissible'>
                <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
                <h4><i class='icon fa fa-info'></i> Info Penting!</h4>
                Diharapkan informasi akun sesuai dengan identitas pada Kartu Pengenal anda, Untuk Mengubah informasi Profile anda klik <a href='".base_url()."administrator/edit_manajemenuser/".$this->session->username."'>disini</a>.
              </div>
            </div>
          </div>
        </div>

        <section class='col-lg-7 connectedSortable'>
            <div class='box box-success'>
            <div class='box-header'>
            <i class='fa fa-th-list'></i>
            <h3 class='box-title'>Semua Konsultasi Masuk</h3>
                <div class='box-tools pull-right'>
                   <button class='btn btn-box-tool' data-widget='collapse' data-toggle='tooltip' title='Collapse'><i class='fa fa-minus'></i></button>
                    <button class='btn btn-box-tool' data-widget='remove' data-toggle='tooltip' title='Remove'><i class='fa fa-times'></i></button>
                </div>
                </div>

        <div class='box-body chat' id='chat-box'>
        <table id='example1' class='table table-bordered table-striped table-condensed'>
            <thead>
              <tr>
                <th style='width:20px'>No</th>
                <th>Judul Topic</th>
                <th></th>
                <th></th>
              </tr>
            </thead>
            <tbody>";
            $no = 1;
            $records = $this->db->query("SELECT a.*, b.nama_kategori, b.kategori_seo FROM konsul a JOIN kategori_konsul b ON a.id_kategori_konsul=b.id_kategori_konsul ORDER BY a.id_konsul DESC");
            foreach ($records->result_array() as $row){
            $komentar = $this->db->query("SELECT * FROM komentar_konsul where id_konsul='$row[id_konsul]' AND aktif='Y'")->num_rows();
            if ($row['status']=='Y'){ $status = '<span style="color:green">Published</span>'; }else{ $status = '<span style="color:red">Unpublished</span>'; }
            $cek_terakhir = cek_terakhir($row['tanggal'].' '.$row['jam']);
            echo "<tr><td>$no</td>
                      <td><a target='_BLANK' href='".base_url()."konsultasi/detail/$row[judul_seo]'><b>$row[judul]</b></a></td>
                      <td>$cek_terakhir lalu</td>
                      <td>$komentar Komentar</td>
                  </tr>";
              $no++;
            }

          echo "</tbody>
        </table>
        </div>
        </div>
        </section>";