Spaces:
Running
Running
File size: 6,769 Bytes
971eb1e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | <?php
/*
* Author = Dian Hermanto
* Create Date = 22 Maret 2017
* File Name = Project_owner.php
* Location = -
*/
class Progress_indicator extends CI_Controller
{
public function index()
{
$sqlApp = "SELECT * FROM tappname";
$resultaApp = $this->db->query($sqlApp)->result();
foreach($resultaApp as $therow) :
$appName = $therow->app_name;
endforeach;
$url = site_url('c_help/progress_indicator/index1/?id='.$this->url_encryption_helper->encode_url($appName));
redirect($url);
}
public function index1($offset=0)
{
$this->load->model('m_help/m_progress_indicator', '', TRUE);
if ($this->session->userdata('login') == TRUE)
{
$idAppName = $_GET['id'];
$appName = $this->url_encryption_helper->decode_url($idAppName);
$data['title'] = $appName;
$data['h2_title'] = 'Project Owner';
$data['secAddURL'] = site_url('c_help/progress_indicator/add/?id='.$this->url_encryption_helper->encode_url($appName));
$data['srch_url'] = site_url('c_help/progress_indicator/get_last_ten_docpattern_src/?id='.$this->url_encryption_helper->encode_url($appName));
$num_rows = $this->m_progress_indicator->count_all_num_rows();
$data["recordcount"] = $num_rows;
$data['viewIndic'] = $this->m_progress_indicator->get_last_ten_indic()->result();
$this->load->view('v_help/v_progress_indicator/progress_indicator', $data);
}
else
{
redirect('login');
}
}
// End
function add() // OK
{
$this->load->model('m_help/m_progress_indicator', '', TRUE);
if ($this->session->userdata('login') == TRUE)
{
$idAppName = $_GET['id'];
$appName = $this->url_encryption_helper->decode_url($idAppName);
$data['title'] = $appName;
$data['task'] = 'add';
$data['h2_title'] = 'Add Indicator';
$data['h3_title'] = 'dashboard';
$data['main_view'] = 'v_help/v_progress_indicator/progress_indicator_form';
$data['form_action'] = site_url('c_help/progress_indicator/add_process');
$data['link'] = array('link_back' => anchor('c_help/progress_indicator/','<input type="button" name="btnCancel" id="btnCancel" class="btn btn-danger" value="Cancel" />', array('style' => 'text-decoration: none;')));
$data['backURL'] = site_url('c_help/progress_indicator/');
$data['default']['VendCat_Code'] = '';
$this->load->view('v_help/v_progress_indicator/progress_indicator_form', $data);
}
else
{
redirect('login'); // by. DH on 16 Maret 14 : Failed, so ... load back to login
}
}
function add_process() // OK
{
$this->load->model('m_help/m_progress_indicator', '', TRUE);
$IK_PARENT = $this->input->post('IK_PARENT');
$sqlINDICLV = "SELECT IK_LEVEL
FROM tbl_indikator WHERE IK_CODE = '$IK_PARENT'";
$resINDICLV = $this->db->query($sqlINDICLV)->result();
foreach($resINDICLV as $rowINDICLV) :
$IK_LEVEL = $rowINDICLV->IK_LEVEL;
endforeach;
$IK_LEVELNEW = $IK_LEVEL + 1;
$indic = array('IK_CODE' => $this->input->post('IK_CODE'),
'IK_PARENT' => $this->input->post('IK_PARENT'),
'IK_DESC' => $this->input->post('IK_DESC'),
'IK_TARGET' => $this->input->post('IK_TARGET'),
'IK_PROCESSED' => $this->input->post('IK_PROCESSED'),
'IK_ISHEADER' => $this->input->post('IK_ISHEADER'),
'IK_LEVEL' => $IK_LEVELNEW);
$this->m_progress_indicator->add($indic);
$sqlApp = "SELECT * FROM tappname";
$resultaApp = $this->db->query($sqlApp)->result();
foreach($resultaApp as $therow) :
$appName = $therow->app_name;
endforeach;
$url = site_url('c_help/progress_indicator/index1/?id='.$this->url_encryption_helper->encode_url($appName));
redirect($url);
}
function update() // OK
{
$this->load->model('m_help/m_progress_indicator', '', TRUE);
$sqlApp = "SELECT * FROM tappname";
$resultaApp = $this->db->query($sqlApp)->result();
foreach($resultaApp as $therow) :
$appName = $therow->app_name;
endforeach;
$IK_CODE = $_GET['id'];
$IK_CODE = $this->url_encryption_helper->decode_url($IK_CODE);
if ($this->session->userdata('login') == TRUE)
{
$data['title'] = $appName;
$data['task'] = 'edit';
$data['h2_title'] = 'Edit Indicator';
$data['h3_title'] = 'dashboard';
$data['main_view'] = 'v_help/v_progress_indicator/progress_indicator_form';
$data['form_action'] = site_url('c_help/progress_indicator/update_process');
$data['link'] = array('link_back' => anchor('c_help/progress_indicator/','<input type="button" name="btnCancel" id="btnCancel" value="Cancel" class="btn btn-danger" />', array('style' => 'text-decoration: none;')));
$data['backURL'] = site_url('c_help/progress_indicator/');
$getindic = $this->m_progress_indicator->get_indic_by_code($IK_CODE)->row();
$data['default']['IK_CODE'] = $getindic->IK_CODE;
$data['default']['IK_PARENT'] = $getindic->IK_PARENT;
$data['default']['IK_DESC'] = $getindic->IK_DESC;
$data['default']['IK_TARGET'] = $getindic->IK_TARGET;
$data['default']['IK_PROCESSED']= $getindic->IK_PROCESSED;
$data['default']['IK_ISHEADER'] = $getindic->IK_ISHEADER;
$data['default']['IK_LEVEL'] = $getindic->IK_LEVEL;
$this->load->view('v_help/v_progress_indicator/progress_indicator_form', $data);
}
else
{
redirect('login');
}
}
function update_process() // OK
{
$this->load->model('m_help/m_progress_indicator', '', TRUE);
$IK_CODE = $this->input->post('IK_CODE');
$IK_PARENT = $this->input->post('IK_PARENT');
$sqlINDICLV = "SELECT IK_LEVEL
FROM tbl_indikator WHERE IK_CODE = '$IK_PARENT'";
$resINDICLV = $this->db->query($sqlINDICLV)->result();
foreach($resINDICLV as $rowINDICLV) :
$IK_LEVEL = $rowINDICLV->IK_LEVEL;
endforeach;
$IK_LEVELNEW = $IK_LEVEL + 1;
$indic = array('IK_CODE' => $this->input->post('IK_CODE'),
'IK_PARENT' => $this->input->post('IK_PARENT'),
'IK_DESC' => $this->input->post('IK_DESC'),
'IK_TARGET' => $this->input->post('IK_TARGET'),
'IK_PROCESSED' => $this->input->post('IK_PROCESSED'),
'IK_ISHEADER' => $this->input->post('IK_ISHEADER'),
'IK_LEVEL' => $IK_LEVELNEW);
$this->m_progress_indicator->update($IK_CODE, $indic);
$sqlApp = "SELECT * FROM tappname";
$resultaApp = $this->db->query($sqlApp)->result();
foreach($resultaApp as $therow) :
$appName = $therow->app_name;
endforeach;
$url = site_url('c_help/progress_indicator/index1/?id='.$this->url_encryption_helper->encode_url($appName));
redirect($url);
}
} |