Fixing my rubbish code

pull/1660/head
Peter Goodhall 2022-10-11 14:54:34 +01:00
rodzic 930d80c1fb
commit 8bbc0ba9bc
3 zmienionych plików z 8 dodań i 8 usunięć

Wyświetl plik

@ -12,7 +12,7 @@ class Welcome extends CI_Controller {
public function index()
{
if($this->config->item('option_version2_trigger') == "false") {
if($this->optionslib->get_option('version2_trigger') == "false") {
$data['page_title'] = "Welcome to Cloudlog Version 2.0";
// load stations model
@ -31,7 +31,8 @@ class Welcome extends CI_Controller {
$this->load->model('note');
$data['NumberOfNotes'] = $this->note->CountAllNotes();
if(!$data['CountAllStationLocations'] && !$data['NumberOfStationLogbooks'] && !$data['NumberOfAPIKeys'] && !$data['NumberOfNotes']) {
if($data['CountAllStationLocations'] == 0 || $data['NumberOfStationLogbooks'] == 0 || $data['NumberOfAPIKeys'] == 0 || $data['NumberOfNotes'] > 0) {
// load views
$this->load->view('interface_assets/mini_header', $data);
$this->load->view('welcome/index');

Wyświetl plik

@ -57,9 +57,9 @@ class Note extends CI_Model {
function CountAllNotes() {
// count all notes
// where user_id is not NULL
$this->db->where('user_id !=', NULL);
return $this->db->count_all('notes');
$this->db->where('user_id', NULL);
$query = $this->db->get('notes');
return $query->num_rows();
}
}

Wyświetl plik

@ -116,10 +116,9 @@
<br>
<?php } ?>
<?php if(!$NumberOfNotes) { ?>
<?php if($NumberOfNotes > 0) { ?>
<div class="card">
<div class="card-header">Claim Notes <?php echo $NumberOfNotes; ?></div>
<div class="card-header">Claim Notes</div>
<div class="card-body">
<p class="card-text">Looks like you have some notes saved, we need to assign them to your username.</p>
<button type="button" class="btn btn-primary" hx-post="<?php echo site_url('welcome/claimnotes'); ?>">Claim Notes</button>