<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
 * Class Memo
 * ------------------------------------------------------------------------------
 * 메모페이지
 */
class Memo extends WB_Controller {

    public function index()
    {
        $this->db->select('*');
        $this->db->from('memo');
        $this->db->where('status', 'Y');
        $this->db->order_by('idx DESC');
        $result = $this->db->get()->result_array();
        // SELECT * FROM wb_memo WHERE status = 'Y' ORDER BY idx DESC;


        $this->data['abcd'] = "1234";
        $this->data['list'] = $result;

        // 레이아웃 & 뷰파일 설정
        $this->theme    = $this->site->get_layout();
        $this->view     = "memo/index";
        $this->active   = "/memo/index";

    }

    public function view($getValue="")
    {
        $this->db->select('*');
        $this->db->from('memo');
        $this->db->where('status', 'Y');
        $this->db->where('idx', $getValue);
        $this->db->order_by('idx DESC');
        $result = $this->db->get()->row_array();
        if(! $result) {
            alert('요청하신 메모는 삭제되었습니다.');
            exit;
        }


        $this->data['result'] = $result;

        // 레이아웃 & 뷰파일 설정
        $this->theme    = $this->site->get_layout();
        $this->view     = "memo/view";
        $this->active   = "/memo/view";
    }
}