kopia lustrzana https://github.com/magicbug/Cloudlog
[Station Logbooks] Added the basics for the index page
rodzic
e254753bec
commit
ef65494eb6
|
@ -728,5 +728,4 @@ class Logbook extends CI_Controller {
|
|||
return $this->db->get();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
Handles Displaying of information for Station Logbooks
|
||||
*/
|
||||
|
||||
class Logbooks extends CI_Controller {
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper(array('form', 'url'));
|
||||
|
||||
$this->load->model('user_model');
|
||||
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
||||
}
|
||||
|
||||
function index() {
|
||||
$this->load->model('logbooks_model');
|
||||
|
||||
$data['my_logbooks'] = $this->logbooks_model->show_all();
|
||||
|
||||
// Render Page
|
||||
$data['page_title'] = "Station Logbooks";
|
||||
$this->load->view('interface_assets/header', $data);
|
||||
$this->load->view('logbooks/index');
|
||||
$this->load->view('interface_assets/footer');
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Logbooks_model extends CI_Model {
|
||||
|
||||
function __construct()
|
||||
{
|
||||
// Call the Model constructor
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
function show_all() {
|
||||
$this->db->where('user_id', $this->session->userdata('user_id'));
|
||||
return $this->db->get('station_logbooks');
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -185,6 +185,8 @@
|
|||
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||
<a class="dropdown-item" href="<?php echo site_url('user/edit')."/".$this->session->userdata('user_id'); ?>" title="Account"><i class="fas fa-user"></i> Account</a>
|
||||
|
||||
<a class="dropdown-item" href="<?php echo site_url('logbooks');?>" title="Manage station logbooks"><i class="fas fa-home"></i> Station Logbooks</a>
|
||||
|
||||
<a class="dropdown-item" href="<?php echo site_url('station');?>" title="Manage station locations"><i class="fas fa-home"></i> Station Locations</a>
|
||||
|
||||
<div class="dropdown-divider"></div>
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
<div class="container">
|
||||
|
||||
<br>
|
||||
<?php if($this->session->flashdata('message')) { ?>
|
||||
<!-- Display Message -->
|
||||
<div class="alert-message error">
|
||||
<p><?php echo $this->session->flashdata('message'); ?></p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<h2><?php echo $page_title; ?></h2>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Station Locations
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="card-text">Intro to Station Logbooks.</p>
|
||||
|
||||
<p><a href="<?php echo site_url('logbooks/create'); ?>" class="btn btn-primary"><i class="fas fa-plus"></i> Create a Station Logbook</a></p>
|
||||
|
||||
<?php if ($my_logbooks->num_rows() > 0) { ?>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($my_logbooks->result() as $row) { ?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php echo $row->logbook_name;?><br>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<a href="<?php echo site_url('logbooks/edit')."/".$row->logbook_id; ?>" class="btn btn-outline-primary btn-sm"><i class="fas fa-edit"></i> Edit</a>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<a href="<?php echo site_url('station/delete')."/".$row->logbook_id; ?>" class="btn btn-danger btn-sm" onclick="return confirm('Are you sure you want delete station profile <?php echo $row->station_profile_name; ?> this will delete all QSOs within this station logbook?');"><i class="fas fa-trash-alt"></i> Delete Station Logbook</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
<table>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
Ładowanie…
Reference in New Issue