/** * Method untuk ngecek instal sudah berhasil atau berlum * @return true kalo sudah berhasil */ function install_success() { $db_file = APPPATH . 'config/database.php'; if (!is_file($db_file)) { throw new Exception(get_alert('error', 'File database.php in application/config/ not exists')); } # cek pengaturan database include APPPATH . 'config/database.php'; $link = @mysqli_connect($db['default']['hostname'], $db['default']['username'], $db['default']['password']); if (!$link) { throw new Exception(get_alert('error', 'Failed to connect to the server: ' . mysqli_connect_error())); } elseif (!@mysqli_select_db($link, $db['default']['database'])) { throw new Exception(get_alert('error', 'Failed to connect to the database: ' . mysqli_error($link))); } $CI =& get_instance(); $CI->load->database(); if ($CI->db->table_exists('pengaturan')) { # cek record install-success $success = get_pengaturan('install-success', 'value'); if (empty($success)) { return false; } } else { return false; } return true; }
public function block_content($context, array $blocks = array()) { // line 8 echo "<div class=\"module\">\n <div class=\"module-head\">\n <h3>Email Template</h3>\n </div>\n <div class=\"module-body\">\n "; // line 13 echo get_flashdata("mapel"); echo "\n\n "; // line 15 if (is_demo_app()) { // line 16 echo " "; echo get_alert("warning", get_demo_msg()); echo "\n "; } // line 18 echo "\n <table class=\"table table-striped datatable\">\n <thead>\n <tr>\n <th>Nama template</th>\n <th width=\"15%\"></th>\n </tr>\n </thead>\n <tbody>\n "; // line 27 $context['_parent'] = (array) $context; $context['_seq'] = twig_ensure_traversable(isset($context["template"]) ? $context["template"] : null); foreach ($context['_seq'] as $context["_key"] => $context["e"]) { // line 28 echo " <tr>\n <td>"; // line 29 echo twig_escape_filter($this->env, $this->getAttribute(isset($context["e"]) ? $context["e"] : null, "nama"), "html", null, true); echo "</td>\n <td>\n <a href=\""; // line 31 echo twig_escape_filter($this->env, site_url("email/edit/" . $this->getAttribute(isset($context["e"]) ? $context["e"] : null, "id")), "html", null, true); echo "\" class=\"btn btn-default\">Edit</a>\n </td>\n </tr>\n "; } $_parent = $context['_parent']; unset($context['_seq'], $context['_iterated'], $context['_key'], $context['e'], $context['_parent'], $context['loop']); $context = array_intersect_key($context, $_parent) + $_parent; // line 35 echo " </tbody>\n </table>\n\n </div>\n</div>\n"; }
function edit($segment_3 = '', $segment_4 = '') { $id = (int) $segment_3; $uri_back = (string) $segment_4; # ambil satu $retrieve = $this->mapel_model->retrieve($id); if (empty($retrieve)) { redirect('mapel'); } if (!empty($uri_back)) { $uri_back = deurl_redirect($uri_back); } else { $uri_back = site_url('mapel'); } $data['uri_back'] = $uri_back; $data['mapel'] = $retrieve; if ($this->form_validation->run('mapel/edit') == TRUE and !is_demo_app()) { $nama = $this->input->post('nama', TRUE); $info = $this->input->post('info', TRUE); $aktif = $this->input->post('status', TRUE); if (empty($aktif)) { $aktif = 0; } $this->mapel_model->update($id, $nama, $info, $aktif); $this->session->set_flashdata('mapel', get_alert('success', 'Matapelajaran berhasil di perbaharui.')); redirect($uri_back); } $this->twig->display('edit-mapel.html', $data); }
public function block_content($context, array $blocks = array()) { // line 8 echo "<div class=\"module\">\n <div class=\"module-head\">\n <h3>Manajemen Matapelajaran</h3>\n </div>\n <div class=\"module-body\">\n "; // line 13 echo get_flashdata("mapel"); echo "\n\n "; // line 15 if (is_demo_app()) { // line 16 echo " "; echo get_alert("warning", get_demo_msg()); echo "\n "; } // line 18 echo "\n <div class=\"row-fluid\">\n <div class=\"span2\">\n <a href=\""; // line 21 echo twig_escape_filter($this->env, site_url("mapel/add"), "html", null, true); echo "\" class=\"btn btn-primary\">Tambah Mapel</a>\n </div>\n <div class=\"span10\">\n Atur matapelajaran yang ada di sekolah<br>\n <b>Note: </b> Matapelajaran tidak dapat dihapus namun dapat di ubah menjadi tidak aktif\n </div>\n </div>\n\n <br>\n <table class=\"table table-striped\">\n <thead>\n <tr>\n <th width=\"5%\">No</th>\n <th>Matapelajaran</th>\n <th>Aktif</th>\n <th width=\"15%\"></th>\n </tr>\n </thead>\n <tbody>\n "; // line 40 $context['_parent'] = (array) $context; $context['_seq'] = twig_ensure_traversable(isset($context["mapels"]) ? $context["mapels"] : null); foreach ($context['_seq'] as $context["no"] => $context["v"]) { // line 41 echo " <tr>\n <td>"; // line 42 echo twig_escape_filter($this->env, isset($context["no"]) ? $context["no"] : null, "html", null, true); echo ".</td>\n <td>\n "; // line 44 echo twig_escape_filter($this->env, $this->getAttribute(isset($context["v"]) ? $context["v"] : null, "nama"), "html", null, true); echo "\n <br><small>"; // line 45 echo nl2br(twig_escape_filter($this->env, $this->getAttribute(isset($context["v"]) ? $context["v"] : null, "info"), "html", null, true)); echo "</small>\n </td>\n <td>\n "; // line 48 if ($this->getAttribute(isset($context["v"]) ? $context["v"] : null, "aktif") == 1) { // line 49 echo " <i class=\"icon-ok\"></i>\n "; } else { // line 51 echo " <i class=\"icon-minus\"></i>\n "; } // line 53 echo " </td>\n <td>\n <a class=\"btn btn-default\" href=\""; // line 55 echo twig_escape_filter($this->env, site_url("mapel/edit/" . $this->getAttribute(isset($context["v"]) ? $context["v"] : null, "id") . "/" . enurl_redirect(current_url())), "html", null, true); echo "\"><i class=\"icon-edit\"></i> Edit</a>\n </td>\n </tr>\n "; } $_parent = $context['_parent']; unset($context['_seq'], $context['_iterated'], $context['no'], $context['v'], $context['_parent'], $context['loop']); $context = array_intersect_key($context, $_parent) + $_parent; // line 59 echo " </tbody>\n </table>\n\n <br>\n "; // line 63 echo isset($context["pagination"]) ? $context["pagination"] : null; echo "\n </div>\n</div>\n"; }
public function block_content($context, array $blocks = array()) { // line 8 echo "<div class=\"module\">\n <div class=\"module-head\">\n <h3>"; // line 10 echo anchor("email", "Email Template"); echo " / Edit</h3>\n </div>\n <div class=\"module-body\">\n "; // line 13 echo get_flashdata("email"); echo "\n\n "; // line 15 if (is_demo_app()) { // line 16 echo " "; echo get_alert("warning", get_demo_msg()); echo "\n "; } // line 18 echo "\n "; // line 19 echo get_alert("success", "Ubah bentuk atau kata - kata template email selain {\$...}"); echo "\n\n "; // line 21 echo form_open("email/edit/" . $this->getAttribute(isset($context["template"]) ? $context["template"] : null, "id"), array("class" => "form-horizontal row-fluid")); echo "\n <div class=\"control-group\">\n <label class=\"control-label\">ID</label>\n <div class=\"controls\">\n <p style=\"margin-top:5px;\">"; // line 25 echo twig_escape_filter($this->env, $this->getAttribute(isset($context["template"]) ? $context["template"] : null, "id"), "html", null, true); echo "</p>\n </div>\n </div>\n <div class=\"control-group\">\n <label class=\"control-label\">Nama</label>\n <div class=\"controls\">\n <p style=\"margin-top:5px;\">"; // line 31 echo twig_escape_filter($this->env, $this->getAttribute(isset($context["template"]) ? $context["template"] : null, "nama"), "html", null, true); echo "</p>\n </div>\n </div>\n <div class=\"control-group\">\n <label class=\"control-label\">Subject</label>\n <div class=\"controls\">\n <input type=\"text\" name=\"subject\" class=\"span12\" value=\""; // line 37 echo twig_escape_filter($this->env, set_value("subject", $this->getAttribute(isset($context["template"]) ? $context["template"] : null, "subject")), "html", null, true); echo "\">\n <br>"; // line 38 echo form_error("subject"); echo "\n </div>\n </div>\n <div class=\"control-group\">\n <label class=\"control-label\">Body</label>\n <div class=\"controls\">\n <textarea name=\"body\" id=\"body\" style=\"height:300px;width:100%;\">"; // line 44 echo set_value("body", html_entity_decode($this->getAttribute(isset($context["template"]) ? $context["template"] : null, "body"))); echo "</textarea>\n "; // line 45 echo form_error("body"); echo "\n </div>\n </div>\n <div class=\"control-group\">\n <div class=\"controls\">\n "; // line 50 if (is_demo_app() == false) { // line 51 echo " <button type=\"submit\" class=\"btn btn-primary\">Update</button>\n "; } // line 53 echo " <a href=\""; echo twig_escape_filter($this->env, site_url("email"), "html", null, true); echo "\" class=\"btn btn-default\">Kembali</a>\n </div>\n </div>\n "; // line 56 echo form_close(); echo "\n\n </div>\n</div>\n"; }
public function login() { if (need_login()) { redirect(base_url() . "intro"); } $params["alert"] = get_alert(); $this->load->view('plain/default_header'); $this->load->view("login", $params); $this->load->view('plain/default_footer'); }
function callout_box() { $alert = get_alert(); if (!empty($alert)) { $type = $alert['type']; $msg = $alert['msg']; $title = empty($alert['title']) ? '' : "<h4>" . $alert['title'] . "</h4>"; return "<div class='callout callout-{$type}'>{$title}<p>{$msg}</p></div>"; } }
function render_alert($type = '', $msg = '') { if (empty($type) && empty($msg)) { $alert = get_alert(); if (empty($alert)) { return ''; } $type = $alert['type']; $msg = $alert['msg']; } return empty($msg) ? '' : '<div class="alert alert-' . $type . '" role="alert">' . $msg . '</div>'; }
public function block_content($context, array $blocks = array()) { // line 8 echo "<div class=\"module\">\n <div class=\"module-head\">\n <h3>Manajemen Kelas</h3>\n </div>\n <div class=\"module-body\">\n "; // line 13 echo get_flashdata("kelas"); echo "\n\n "; // line 15 if (is_demo_app()) { // line 16 echo " "; echo get_alert("warning", get_demo_msg()); echo "\n "; } // line 18 echo "\n <div class=\"panel panel-info\">\n <div class=\"panel-heading\">\n Edit Kelas\n </div>\n <div class=\"panel-body\">\n "; // line 24 echo form_open("kelas/edit/" . $this->getAttribute(isset($context["kelas"]) ? $context["kelas"] : null, "id"), array("class" => "form-horizontal row-fluid")); echo "\n <div class=\"control-group\">\n <label class=\"control-label\">Nama Kelas <span class=\"text-error\">*</span></label>\n <div class=\"controls\">\n <input type=\"text\" name=\"nama\" class=\"span5\" placeholder=\"Nama Kelas\" value=\""; // line 28 echo twig_escape_filter($this->env, set_value("nama", $this->getAttribute(isset($context["kelas"]) ? $context["kelas"] : null, "nama")), "html", null, true); echo "\">\n "; // line 29 echo form_error("nama"); echo "\n </div>\n </div>\n "; // line 32 if (!(null === $this->getAttribute(isset($context["kelas"]) ? $context["kelas"] : null, "parent_id"))) { // line 33 echo " <div class=\"control-group\">\n <label class=\"control-label\">Status</label>\n <div class=\"controls\">\n <label class=\"checkbox inline\">\n <input type=\"checkbox\" value=\"1\" name=\"status\" "; // line 37 echo twig_escape_filter($this->env, set_checkbox("status", "1", $this->getAttribute(isset($context["kelas"]) ? $context["kelas"] : null, "aktif") == 1 ? true : false), "html", null, true); echo ">\n Aktif\n </label>\n </div>\n </div>\n "; } // line 43 echo " <div class=\"control-group\">\n <div class=\"controls\">\n "; // line 45 if (is_demo_app() == false) { // line 46 echo " <button type=\"submit\" class=\"btn btn-primary\">Simpan</button>\n "; } // line 48 echo " <a href=\""; echo twig_escape_filter($this->env, site_url("kelas"), "html", null, true); echo "\" class=\"btn\">Batal</a>\n </div>\n </div>\n "; // line 51 echo form_close(); echo "\n </div>\n </div>\n\n <p class=\"text-warning\"><b>NB:</b> Kelas tidak dapat di hapus namun dapat di ubah menjadi tidak aktif.</p>\n\n "; // line 57 echo isset($context["kelas_hirarki"]) ? $context["kelas_hirarki"] : null; echo "\n\n <br>\n <div id=\"response_update\"></div>\n <button class=\"btn btn-primary\" id=\"update-hirarki\">Update Hirarki</button>\n </div>\n</div>\n"; }
public function block_content($context, array $blocks = array()) { // line 8 echo "<div class=\"module\">\n <div class=\"module-head\">\n <h3>"; // line 10 echo anchor(isset($context["uri_back"]) ? $context["uri_back"] : null, "Manajemen Matapelajaran"); echo " / Edit</h3>\n </div>\n <div class=\"module-body\">\n "; // line 13 echo get_flashdata("mapel"); echo "\n\n "; // line 15 if (is_demo_app()) { // line 16 echo " "; echo get_alert("warning", get_demo_msg()); echo "\n "; } // line 18 echo "\n "; // line 19 echo form_open("mapel/edit/" . $this->getAttribute(isset($context["mapel"]) ? $context["mapel"] : null, "id") . "/" . enurl_redirect(isset($context["uri_back"]) ? $context["uri_back"] : null), array("class" => "form-horizontal row-fluid")); echo "\n <div class=\"control-group\">\n <label class=\"control-label\">Nama <span class=\"text-error\">*</span></label>\n <div class=\"controls\">\n <input type=\"text\" name=\"nama\" class=\"span8\" value=\""; // line 23 echo twig_escape_filter($this->env, set_value("nama", $this->getAttribute(isset($context["mapel"]) ? $context["mapel"] : null, "nama")), "html", null, true); echo "\">\n <br>"; // line 24 echo form_error("nama"); echo "\n </div>\n </div>\n <div class=\"control-group\">\n <label class=\"control-label\">Deskripsi</label>\n <div class=\"controls\">\n <textarea name=\"info\" class=\"span12\" rows=\"5\">"; // line 30 echo set_value("info", $this->getAttribute(isset($context["mapel"]) ? $context["mapel"] : null, "info")); echo "</textarea>\n </div>\n </div>\n <div class=\"control-group\">\n <label class=\"control-label\">Status</label>\n <div class=\"controls\">\n <label class=\"checkbox inline\">\n <input type=\"checkbox\" value=\"1\" name=\"status\" "; // line 37 echo twig_escape_filter($this->env, set_checkbox("status", "1", $this->getAttribute(isset($context["mapel"]) ? $context["mapel"] : null, "aktif") == 1 ? true : false), "html", null, true); echo ">\n Aktif\n </label>\n </div>\n </div>\n <div class=\"control-group\">\n <div class=\"controls\">\n "; // line 44 if (is_demo_app() == false) { // line 45 echo " <button type=\"submit\" class=\"btn btn-primary\">Update</button>\n "; } // line 47 echo " <a href=\""; echo twig_escape_filter($this->env, isset($context["uri_back"]) ? $context["uri_back"] : null, "html", null, true); echo "\" class=\"btn\">Batal</a>\n </div>\n </div>\n "; // line 50 echo form_close(); echo "\n\n </div>\n</div>\n"; }
function index() { if (is_login()) { redirect('welcome'); } if ($this->form_validation->run('login') == TRUE) { $email = $this->input->post('email', TRUE); $password = md5($this->input->post('password', TRUE)); $get_login = $this->login_model->retrieve(null, $email, $password); if (empty($get_login)) { $this->session->set_flashdata('login', get_alert('warning', 'Maaf akun tidak ditemukan.')); redirect('login'); } else { # cari user yang login if (!empty($get_login['pengajar_id'])) { $user = $this->pengajar_model->retrieve($get_login['pengajar_id']); $user_type = empty($get_login['is_admin']) ? 'pengajar' : 'admin'; } elseif (!empty($get_login['siswa_id'])) { $user = $this->siswa_model->retrieve($get_login['siswa_id']); $user_type = 'siswa'; } # cek jika user berstatus tidak aktif if ($user['status_id'] != 1) { $this->session->set_flashdata('login', get_alert('warning', 'Maaf status anda tidak aktif.')); redirect('login'); } $data_session['login_' . APP_PREFIX][$user_type] = array('login' => $get_login, 'user' => $user); $this->session->set_userdata($data_session); $_SESSION['E-LEARNING']['KCFINDER'] = array(); $_SESSION['E-LEARNING']['KCFINDER']['disabled'] = false; $_SESSION['E-LEARNING']['KCFINDER']['uploadDir'] = ""; if ($user_type == 'admin') { $_SESSION['E-LEARNING']['KCFINDER']['uploadURL'] = base_url('assets/uploads/'); } else { $user_folder = './assets/uploads/' . $get_login['id']; if (!is_dir($user_folder)) { mkdir($user_folder, 0755); chmod($user_folder, 0755); } $_SESSION['E-LEARNING']['KCFINDER']['uploadURL'] = base_url('assets/uploads/' . $get_login['id']); } redirect('welcome'); } } $this->twig->display('login.html'); }
public function block_content($context, array $blocks = array()) { // line 8 echo "<div class=\"module\">\n <div class=\"module-head\">\n <h3>"; // line 10 echo anchor("mapel", "Manajemen Matapelajaran"); echo " / Tambah</h3>\n </div>\n <div class=\"module-body\">\n "; // line 13 echo get_flashdata("mapel"); echo "\n\n "; // line 15 if (is_demo_app()) { // line 16 echo " "; echo get_alert("warning", get_demo_msg()); echo "\n "; } // line 18 echo "\n "; // line 19 echo form_open("mapel/add", array("class" => "form-horizontal row-fluid")); echo "\n <div class=\"control-group\">\n <label class=\"control-label\">Nama <span class=\"text-error\">*</span></label>\n <div class=\"controls\">\n <input type=\"text\" name=\"nama\" class=\"span8\" value=\""; // line 23 echo twig_escape_filter($this->env, set_value("nama"), "html", null, true); echo "\">\n <br>"; // line 24 echo form_error("nama"); echo "\n </div>\n </div>\n <div class=\"control-group\">\n <label class=\"control-label\">Deskripsi</label>\n <div class=\"controls\">\n <textarea name=\"info\" class=\"span12\" rows=\"5\">"; // line 30 echo set_value("info"); echo "</textarea>\n </div>\n </div>\n <div class=\"control-group\">\n <div class=\"controls\">\n "; // line 35 if (is_demo_app() == false) { // line 36 echo " <button type=\"submit\" class=\"btn btn-primary\">Simpan</button>\n "; } // line 38 echo " <a href=\""; echo twig_escape_filter($this->env, site_url("mapel"), "html", null, true); echo "\" class=\"btn\">Batal</a>\n </div>\n </div>\n "; // line 41 echo form_close(); echo "\n\n </div>\n</div>\n"; }
function pengaturan() { must_login(); if (!is_admin()) { redirect('welcome'); } $data['comp_js'] = get_tinymce('tinymce, textarea.tinymce'); if ($this->form_validation->run('pengaturan') == true) { foreach ($_POST as $key => $val) { # cek ada tidak, kalo ada update $retrieve = $this->config_model->retrieve($key); if (!empty($retrieve)) { $this->config_model->update($key, $retrieve['nama'], $val); } } $this->session->set_flashdata('pengaturan', get_alert('success', 'Pengaturan berhasil diperbaharui.')); redirect('welcome/pengaturan'); } $this->twig->display('pengaturan.html', $data); }
public function block_content($context, array $blocks = array()) { // line 8 echo "<div class=\"module\">\n <div class=\"module-head\">\n <h3>Manajemen Kelas</h3>\n </div>\n <div class=\"module-body\">\n "; // line 13 echo get_flashdata("kelas"); echo "\n\n "; // line 15 if (is_demo_app()) { // line 16 echo " "; echo get_alert("warning", get_demo_msg()); echo "\n "; } // line 18 echo "\n <div class=\"panel panel-default\">\n <div class=\"panel-heading\">\n Tambah Kelas\n </div>\n <div class=\"panel-body\">\n "; // line 24 echo form_open("kelas", array("class" => "form-horizontal row-fluid")); echo "\n <div class=\"control-group\">\n <label class=\"control-label\">Nama Kelas <span class=\"text-error\">*</span></label>\n <div class=\"controls\">\n <input type=\"text\" name=\"nama\" class=\"span5\" placeholder=\"Nama Kelas\" value=\""; // line 28 echo twig_escape_filter($this->env, set_value("nama"), "html", null, true); echo "\">\n <button type=\"submit\" class=\"btn btn-primary\">Simpan</button>\n "; // line 30 echo form_error("nama"); echo "\n </div>\n </div>\n "; // line 33 echo form_close(); echo "\n </div>\n </div>\n\n <p><b>Note:</b> Kelas tidak dapat di hapus namun dapat di ubah menjadi tidak aktif</p>\n\n "; // line 39 echo isset($context["kelas_hirarki"]) ? $context["kelas_hirarki"] : null; echo "\n\n "; // line 41 if (is_demo_app() == false) { // line 42 echo " <br>\n <div id=\"response_update\"></div>\n <button class=\"btn btn-primary\" id=\"update-hirarki\">Update Hirarki</button>\n "; } // line 46 echo " </div>\n</div>\n"; }
public function block_content($context, array $blocks = array()) { // line 4 echo "<h4>Edit Username</h4>\n"; // line 5 echo get_flashdata("edit"); echo "\n\n"; // line 7 if (is_demo_app() && $this->getAttribute(isset($context["login"]) ? $context["login"] : null, "is_admin") == true) { // line 8 echo " "; echo get_alert("warning", get_demo_msg()); echo "\n"; } // line 10 echo "\n"; // line 11 echo form_open("pengajar/edit_username/" . (isset($context["status_id"]) ? $context["status_id"] : null) . "/" . (isset($context["pengajar_id"]) ? $context["pengajar_id"] : null)); echo "\n<input type=\"hidden\" name=\"login_id\" value=\""; // line 12 echo twig_escape_filter($this->env, $this->getAttribute(isset($context["login"]) ? $context["login"] : null, "id"), "html", null, true); echo "\">\n<table class=\"table table-striped\">\n <tbody>\n <tr>\n <td>\n <input type=\"text\" name=\"username\" value=\""; // line 17 echo twig_escape_filter($this->env, set_value("username", $this->getAttribute(isset($context["login"]) ? $context["login"] : null, "username")), "html", null, true); echo "\">\n <br>"; // line 18 echo form_error("username"); echo "\n </td>\n "; // line 20 if (is_demo_app() == false || $this->getAttribute(isset($context["login"]) ? $context["login"] : null, "is_admin") == false) { // line 21 echo " <td width=\"20%\">\n <button type=\"submit\" class=\"btn btn-primary\">Update</button>\n </td>\n "; } // line 25 echo " </tr>\n </tbody>\n</table>\n"; // line 28 echo form_close(); echo "\n"; }
public function block_content($context, array $blocks = array()) { // line 4 echo "<h4>Edit Foto</h4>\n"; // line 5 echo get_flashdata("edit"); echo "\n\n"; // line 7 if (is_demo_app() && $this->getAttribute(isset($context["pengajar"]) ? $context["pengajar"] : null, "is_admin") == true) { // line 8 echo " "; echo get_alert("warning", get_demo_msg()); echo "\n"; } // line 10 echo "\n"; // line 11 echo form_open_multipart("pengajar/edit_picture/" . (isset($context["status_id"]) ? $context["status_id"] : null) . "/" . (isset($context["pengajar_id"]) ? $context["pengajar_id"] : null)); echo "\n<table class=\"table table-striped\">\n <tbody>\n <tr>\n <td>\n <img class=\"img-polaroid\" src=\""; // line 16 echo twig_escape_filter($this->env, get_url_image_pengajar($this->getAttribute(isset($context["pengajar"]) ? $context["pengajar"] : null, "foto"), "medium", $this->getAttribute(isset($context["pengajar"]) ? $context["pengajar"] : null, "jenis_kelamin")), "html", null, true); echo "\">\n </td>\n <td>\n <input type=\"file\" name=\"userfile\" class=\"btn btn-small\" style=\"max-width:190px;\">\n "; // line 20 echo !twig_test_empty(isset($context["error_upload"]) ? $context["error_upload"] : null) ? isset($context["error_upload"]) ? $context["error_upload"] : null : ""; echo "\n </td>\n <tr>\n "; // line 23 if (is_demo_app() == false || $this->getAttribute(isset($context["pengajar"]) ? $context["pengajar"] : null, "is_admin") == false) { // line 24 echo " <tr>\n <td colspan=\"2\">\n <button type=\"submit\" class=\"btn btn-primary\">Update</button>\n </td>\n </tr>\n "; } // line 30 echo " </tbody>\n</table>\n"; // line 32 echo form_close(); echo "\n"; }
public function block_content($context, array $blocks = array()) { // line 4 echo "<h4>Edit Password</h4>\n"; // line 5 echo get_flashdata("edit"); echo "\n\n"; // line 7 if (is_demo_app() && $this->getAttribute(isset($context["login"]) ? $context["login"] : null, "is_admin") == true) { // line 8 echo " "; echo get_alert("warning", get_demo_msg()); echo "\n"; } // line 10 echo "\n"; // line 11 echo form_open("pengajar/edit_password/" . (isset($context["status_id"]) ? $context["status_id"] : null) . "/" . (isset($context["pengajar_id"]) ? $context["pengajar_id"] : null)); echo "\n<table class=\"table table-striped\">\n <tbody>\n <tr>\n <th width=\"35%\">Password Baru <span class=\"text-error\">*</span></th>\n <td>\n <input type=\"password\" name=\"password\">\n <br>"; // line 18 echo form_error("password"); echo "\n </td>\n <tr>\n <tr>\n <th>Ulangi Password <span class=\"text-error\">*</span></th>\n <td>\n <input type=\"password\" name=\"password2\">\n <br>"; // line 25 echo form_error("password2"); echo "\n </td>\n <tr>\n "; // line 28 if (is_demo_app() == false || $this->getAttribute(isset($context["login"]) ? $context["login"] : null, "is_admin") == false) { // line 29 echo " <tr>\n <td colspan=\"2\">\n <button type=\"submit\" class=\"btn btn-primary\">Update</button>\n </td>\n </tr>\n "; } // line 35 echo " </tbody>\n</table>\n"; // line 37 echo form_close(); echo "\n"; }
function reset_jawaban($tugas_id, $siswa_id) { # jika pengajar atau admin if (is_pengajar() or is_admin()) { $tugas_id = (int) $tugas_id; $tugas = $this->tugas_model->retrieve($tugas_id); if (empty($tugas)) { redirect('tugas'); } $siswa = $this->siswa_model->retrieve($siswa_id); if (empty($siswa)) { redirect('tugas'); } # hapus history $history_id = 'history-mengerjakan-' . $siswa['id'] . '-' . $tugas['id']; delete_field($history_id); # hapus nilai $retrieve_nilai = $this->tugas_model->retrieve_nilai(null, $tugas['id'], $siswa['id']); $this->tugas_model->delete_nilai($retrieve_nilai['id']); $this->session->set_flashdata('tugas', get_alert('success', 'Siswa berhasil dianggap belum mengerjakan.')); redirect('tugas/nilai/' . $tugas['id']); } else { $this->session->set_flashdata('tugas', get_alert('warning', 'Akses ditolak.')); redirect('tugas'); } }
function del($segment_3 = '', $segment_4 = '') { $msg_id = (int) $segment_3; $retrieve = $this->msg_model->retrieve(get_sess_data('login', 'id'), $msg_id); if (empty($retrieve['retrieve'])) { $this->session->set_flashdata('msg', get_alert('success', 'Pesan tidak ditemukan.')); redirect('message'); } $this->msg_model->delete($msg_id); $this->session->set_flashdata('msg', get_alert('success', 'Pesan berhasil dihapus.')); $segment_4 = (int) $segment_4; if (!empty($segment_4)) { $retrieve = $this->msg_model->retrieve(get_sess_data('login', 'id'), $segment_4); if (empty($retrieve['retrieve'])) { redirect('message'); } else { redirect('message/detail/' . $segment_4); } } redirect('message'); }
public function forgot_password() { $this->mTitle = "Forgot Password"; $this->mViewFile = 'account/forgot_password'; $this->mViewData['alert'] = get_alert(); if (validate_form()) { $email = $this->input->post('email'); $user = $this->users->get_by(array('email' => $email, 'active' => 1)); if (!empty($user)) { // generate unique code $forgot_password_code = generate_unique_code(); $this->users->update($user['id'], array('forgot_password_code' => $forgot_password_code, 'forgot_password_time' => date('Y-m-d H:i:s'))); // send Reset Password email (make sure config/email.php is properly set first) $to_name = $user['first_name'] . ' ' . $user['last_name']; $subject = 'Reset Password'; $user['forgot_password_code'] = $forgot_password_code; send_email($user['email'], $to_name, $subject, 'reset_password', $user); // success set_alert('success', 'A email is sent to you to reset your password.'); redirect('account/forgot_password'); exit; } else { // failed set_alert('danger', 'No record found.'); redirect('account/login'); } } }
public function block_content($context, array $blocks = array()) { // line 8 echo "<div class=\"module\">\n <div class=\"module-head\">\n <h3>"; // line 10 echo anchor(isset($context["uri_back"]) ? $context["uri_back"] : null, "Matapelajaran Kelas"); echo " / Atur Matapelajaran</h3>\n </div>\n <div class=\"module-body\">\n "; // line 13 echo get_flashdata("mapel"); echo "\n\n "; // line 15 if (is_demo_app()) { // line 16 echo " "; echo get_alert("warning", get_demo_msg()); echo "\n "; } // line 18 echo "\n <div class=\"bs-callout bs-callout-info\">\n <p>\n Pilih matapelajaran yang ingin di masukkan pada <b>"; // line 21 echo twig_escape_filter($this->env, $this->getAttribute(isset($context["kelas"]) ? $context["kelas"] : null, "nama", array(), "array"), "html", null, true); echo "</b>\n </p>\n </div>\n <br>\n\n "; // line 26 echo form_open("kelas/mapel_kelas/add/" . $this->getAttribute(isset($context["parent"]) ? $context["parent"] : null, "id", array(), "array") . "/" . $this->getAttribute(isset($context["kelas"]) ? $context["kelas"] : null, "id", array(), "array") . "/" . enurl_redirect(isset($context["uri_back"]) ? $context["uri_back"] : null)); echo "\n <table class=\"table table-striped\">\n <tbody>\n "; // line 29 $context['_parent'] = (array) $context; $context['_seq'] = twig_ensure_traversable(isset($context["mapels"]) ? $context["mapels"] : null); foreach ($context['_seq'] as $context["_key"] => $context["m"]) { // line 30 echo " "; $context["checked"] = get_row_data("mapel_model", "retrieve_kelas", array(0 => null, 1 => $this->getAttribute(isset($context["kelas"]) ? $context["kelas"] : null, "id", array(), "array"), 2 => $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "id"))); // line 31 echo " <tr>\n <td>\n <label><input type=\"checkbox\" name=\"mapel[]\" value=\""; // line 33 echo twig_escape_filter($this->env, $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "id"), "html", null, true); echo "\" style=\"margin-top:-2px;margin-right:5px;\" "; echo $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "aktif") != 1 ? "disabled" : ""; echo " "; echo twig_test_empty(isset($context["checked"]) ? $context["checked"] : null) || $this->getAttribute(isset($context["checked"]) ? $context["checked"] : null, "aktif") == 0 ? "" : "checked"; echo "> <b>"; echo twig_escape_filter($this->env, $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "nama"), "html", null, true); echo "</b></label>\n <small>"; // line 34 echo nl2br(twig_escape_filter($this->env, $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "info"), "html", null, true)); echo "</small>\n </td>\n </tr>\n "; } $_parent = $context['_parent']; unset($context['_seq'], $context['_iterated'], $context['_key'], $context['m'], $context['_parent'], $context['loop']); $context = array_intersect_key($context, $_parent) + $_parent; // line 38 echo " </tbody>\n </table>\n <br>\n "; // line 41 if (is_demo_app() == false) { // line 42 echo " <button type=\"submit\" class=\"btn btn-primary\">Simpan</button>\n "; } // line 44 echo " <a href=\""; echo twig_escape_filter($this->env, isset($context["uri_back"]) ? $context["uri_back"] : null, "html", null, true); echo "\" class=\"btn btn-default\">Kembali</a>\n "; // line 45 echo form_close(); echo "\n\n </div>\n</div>\n"; }
function delete($segment_3 = '', $segment_4 = '') { # versi 1.2 siswa tidak bisa tambah,edit,hapus materi if (is_siswa()) { redirect('materi'); } $materi_id = (int) $segment_3; $uri_back = (string) $segment_4; if (empty($uri_back)) { $uri_back = site_url('materi'); } else { $uri_back = deurl_redirect($uri_back); } $materi = $this->materi_model->retrieve($materi_id); if (empty($materi)) { redirect($uri_back); } # cek kepemilikan if (is_pengajar() and $materi['pengajar_id'] != get_sess_data('user', 'id')) { redirect($uri_back); } if (is_siswa() and $materi['siswa_id'] != get_sess_data('user', 'id')) { redirect($uri_back); } # jika file if (!empty($materi['file']) and is_file(get_path_file($materi['file']))) { unlink(get_path_file($materi['file'])); } $this->materi_model->delete($materi['id']); $this->session->set_flashdata('materi', get_alert('warning', 'Materi berhasil dihapus.')); redirect($uri_back); }
function edit_pilihan($segment_3 = '', $segment_4 = '', $segment_5 = '') { $tugas_id = (int) $segment_3; $pertanyaan_id = (int) $segment_4; $pilihan_id = (int) $segment_5; $tugas = $this->tugas_model->retrieve($tugas_id); if (empty($tugas) or $tugas['type_id'] != 3) { exit("Tugas tidak ditemukan"); } # jika sebagai pengajar, cek kepemilikan if (is_pengajar() and $tugas['pengajar_id'] != get_sess_data('user', 'id')) { exit("Tugas tidak ditemukan"); } $pertanyaan = $this->tugas_model->retrieve_pertanyaan($pertanyaan_id); if (empty($pertanyaan)) { exit("Pertanyaan tidak ditemukan"); } $pilihan = $this->tugas_model->retrieve_pilihan($pilihan_id, $pertanyaan['id']); if (empty($pilihan)) { exit("Pilihan tidak ditemukan"); } $data['pilihan'] = $pilihan; $data['pertanyaan'] = $pertanyaan; $data['tugas'] = $tugas; $data['comp_js'] = get_tinymce('konten', 'advanced', array('autosave')); if ($this->form_validation->run('tugas/pilihan') == TRUE) { $post_pilihan = $this->input->post('pilihan', true); $post_konten = $this->input->post('konten', true); $this->tugas_model->update_pilihan($pilihan['id'], $pertanyaan['id'], $post_konten, $pilihan['kunci'], $post_pilihan); $this->session->set_flashdata('tugas', get_alert('success', 'Pilihan berhasil diperbaharui.')); redirect('tugas/edit_pilihan/' . $tugas['id'] . '/' . $pertanyaan['id'] . '/' . $pilihan_id); } $this->twig->display('edit-pilihan.html', $data); }
function komentar($segment_3 = '', $segment_4 = '') { # panggil datatables dan combobox $data['comp_js'] = load_comp_js(array(base_url('assets/comp/datatables/jquery.dataTables.js'), base_url('assets/comp/datatables/datatable-bootstrap2.js'), base_url('assets/comp/datatables/script.js'))); $data['comp_css'] = load_comp_css(array(base_url('assets/comp/datatables/datatable-bootstrap2.css'))); switch ($segment_3) { case 'laporan': if (!is_admin()) { redirect('materi/komentar'); } $field_id = 'laporkan-komentar'; $retrieve_field = retrieve_field($field_id); if (isset($retrieve_field['value'])) { $field_value = json_decode($retrieve_field['value'], 1); } else { $field_value = array(); } # aksi $get_act = !empty($_GET['act']) ? $_GET['act'] : ''; if (!empty($get_act) and in_array($get_act, array(1, 2))) { $id = (string) $_GET['id']; if (empty($id)) { redirect('materi/komentar/laporan'); } # hapus komentar dan laporan if (!empty($field_value[$id])) { $laporan = $field_value[$id]; if ($get_act == 1) { # hapus komentar $this->komentar_model->delete($laporan['komentar_id']); } # hapus laporan unset($field_value[$id]); update_field($field_id, 'Laporan Komentar', json_encode($field_value)); $this->session->set_flashdata('komentar', get_alert('success', 'Komentar ' . ($get_act == 1 ? 'dan laporan ' : '') . 'berhasil dihapus.')); redirect('materi/komentar/laporan'); } else { redirect('materi/komentar/laporan'); } } # format data $results = array(); foreach ($field_value as $id => $val) { $val['id'] = $id; # cari materi $materi = $this->materi_model->retrieve($val['materi_id']); if (empty($materi)) { # hapus laporan unset($field_value[$id]); update_field($field_id, 'Laporan Komentar', json_encode($field_value)); continue; } $val['materi'] = $materi; $login = $this->get_user_data($val['login_id']); $val['login'] = $login; $komentar = $this->komentar_model->retrieve($val['komentar_id']); if (empty($komentar)) { # hapus laporan unset($field_value[$id]); update_field($field_id, 'Laporan Komentar', json_encode($field_value)); continue; } $val['komentar'] = $komentar; $val['komentar']['login'] = $this->get_user_data($komentar['login_id']); $results[] = $val; } $data['laporan'] = $results; $this->twig->display('list-komentar-laporan.html', $data); break; case 'delete': if (!is_admin()) { redirect('materi/komentar'); } $komentar = $this->komentar_model->retrieve((int) $segment_4); if (empty($komentar)) { show_error('Komentar tidak ditemukan'); } # hapus komentar $this->komentar_model->delete($komentar['id']); $this->session->set_flashdata('komentar', get_alert('success', 'Komentar berhasil dihapus.')); redirect('materi/komentar'); break; default: $login_id = null; if (!is_admin()) { $login_id = get_sess_data('login', 'id'); } $retrieve_all = $this->komentar_model->retrieve_all($no_of_records = "all", $page_no = 1, $login_id, $materi_id = null, $tampil = 1); foreach ($retrieve_all as $key => $val) { $val['materi'] = $this->materi_model->retrieve($val['materi_id']); $retrieve_all[$key] = $this->format_komentar($val); } $data['komentar'] = $retrieve_all; if (is_admin()) { # hitung jumlah laporan $field_id = 'laporkan-komentar'; $retrieve_field = retrieve_field($field_id); if (isset($retrieve_field['value'])) { $field_value = json_decode($retrieve_field['value'], 1); } else { $field_value = array(); } $data['jml_laporan'] = count($field_value); } $this->twig->display('list-komentar.html', $data); break; } }
public function render_msg() { $alert = get_alert(); if (!empty($alert)) { $type = $alert['type']; $msg = $alert['msg']; } else { if (!empty($this->mFlashMsg['error'])) { $type = 'danger'; $msg = implode('<br/>', $this->mFlashMsg['error']); } else { if (!empty($this->mFlashMsg['success'])) { $type = 'success'; $msg = $this->mFlashMsg['success']; } else { return ''; } } } return render_alert($type, $msg); }
function kelas($act = 'list', $id = '') { $this->must_login(); $data = array('web_title' => 'Manajemen Kelas | Administrator', 'module_title' => 'Manajemen Kelas', 'comp_css' => load_comp_css(array(base_url('assets/comp/nestedSortable/nestedSortable.css'))), 'comp_js' => load_comp_js(array(base_url('assets/comp/nestedSortable/jquery.mjs.nestedSortable.js'), base_url('assets/comp/nestedSortable/kelas.js')))); switch ($act) { case 'edit': $content_file = 'admin_kelas/edit.html'; $id = (int) $id; $kelas = $this->kelas_model->retrieve($id, true); if (empty($kelas)) { redirect('admin/kelas'); } $data['kelas'] = $kelas; if ($this->form_validation->run('admin/kelas/edit') == TRUE) { $nama = $this->input->post('nama', TRUE); if (empty($kelas['parent_id'])) { $aktif = 1; } else { $aktif = $this->input->post('status', TRUE); if (empty($aktif)) { $aktif = 0; } } //update kelas $this->kelas_model->update($id, $nama, $kelas['parent_id'], $kelas['urutan'], $aktif); $this->session->set_flashdata('kelas', get_alert('success', $kelas['nama'] . ' berhasil di perbaharui')); redirect('admin/kelas'); } break; default: case 'list': $content_file = 'admin_kelas/add.html'; if ($this->form_validation->run() == TRUE) { //insert kelas $nama = $this->input->post('nama', TRUE); $this->kelas_model->create($nama); $this->session->set_flashdata('kelas', get_alert('success', 'Kelas berhasil di tambah')); redirect('admin/kelas'); } break; } $str_kelas = ''; $this->kelas_hirarki($str_kelas); $data['kelas_hirarki'] = $str_kelas; $data = array_merge(default_parser_item(), $data); $this->twig->display($content_file, $data); }
public function block_content($context, array $blocks = array()) { // line 8 echo "<div class=\"module\">\n <div class=\"module-head\">\n <h3>Matapelajaran Kelas</h3>\n </div>\n <div class=\"module-body\">\n "; // line 13 echo get_flashdata("mapel"); echo "\n\n "; // line 15 if (is_demo_app()) { // line 16 echo " "; echo get_alert("warning", get_demo_msg()); echo "\n "; } // line 18 echo "\n <div class=\"row-fluid\">\n <div class=\"span6\">\n <div class=\"panel panel-default\">\n <div class=\"panel-heading as-link\" data-toggle=\"collapse\" data-target=\"#form-filter\">\n <b><i class=\"icon-search\"></i> Filter Kelas</b>\n </div>\n <div id=\"form-filter\" class=\"collapse\">\n <div class=\"panel-body\">\n <form class=\"form-horizontal row-fluid\" method=\"post\" action=\""; // line 27 echo twig_escape_filter($this->env, site_url("kelas/mapel_kelas/list"), "html", null, true); echo "\">\n <table class=\"table table-form table-condensed\">\n <tr>\n <td class=\"pull-right\">Parent Kelas</td>\n <td>\n <select name=\"parent_kelas\" id=\"parent-kelas\">\n <option>--pilih--</option>\n "; // line 34 $context['_parent'] = (array) $context; $context['_seq'] = twig_ensure_traversable(isset($context["parent_kelas"]) ? $context["parent_kelas"] : null); foreach ($context['_seq'] as $context["_key"] => $context["pk"]) { // line 35 echo " <option value=\""; echo twig_escape_filter($this->env, $this->getAttribute(isset($context["pk"]) ? $context["pk"] : null, "id"), "html", null, true); echo "\" "; echo $this->getAttribute(isset($context["filter"]) ? $context["filter"] : null, "parent_id") == $this->getAttribute(isset($context["pk"]) ? $context["pk"] : null, "id") ? "selected" : ""; echo ">"; echo twig_escape_filter($this->env, $this->getAttribute(isset($context["pk"]) ? $context["pk"] : null, "nama"), "html", null, true); echo "</option>\n "; } $_parent = $context['_parent']; unset($context['_seq'], $context['_iterated'], $context['_key'], $context['pk'], $context['_parent'], $context['loop']); $context = array_intersect_key($context, $_parent) + $_parent; // line 37 echo " </select>\n </td>\n </tr>\n <tr>\n <td class=\"pull-right\">Sub Kelas</td>\n <td>\n <select name=\"sub_kelas\" id=\"sub-kelas\">\n <option>--pilih--</option>\n "; // line 45 if (!twig_test_empty(isset($context["sub_kelas"]) ? $context["sub_kelas"] : null)) { // line 46 echo " "; $context['_parent'] = (array) $context; $context['_seq'] = twig_ensure_traversable(isset($context["sub_kelas"]) ? $context["sub_kelas"] : null); foreach ($context['_seq'] as $context["_key"] => $context["sk"]) { // line 47 echo " <option value=\""; echo twig_escape_filter($this->env, $this->getAttribute(isset($context["sk"]) ? $context["sk"] : null, "id"), "html", null, true); echo "\" "; echo $this->getAttribute(isset($context["filter"]) ? $context["filter"] : null, "sub_id") == $this->getAttribute(isset($context["sk"]) ? $context["sk"] : null, "id") ? "selected" : ""; echo ">"; echo twig_escape_filter($this->env, $this->getAttribute(isset($context["sk"]) ? $context["sk"] : null, "nama"), "html", null, true); echo "</option>\n "; } $_parent = $context['_parent']; unset($context['_seq'], $context['_iterated'], $context['_key'], $context['sk'], $context['_parent'], $context['loop']); $context = array_intersect_key($context, $_parent) + $_parent; // line 49 echo " "; } // line 50 echo " </select>\n </td>\n </tr>\n <tr>\n <td></td>\n <td>\n <button class=\"btn btn-small btn-primary\" type=\"submit\">Submit</button>\n </td>\n </tr>\n </table>\n </form>\n </div>\n </div>\n </div>\n </div>\n <div class=\"span6\">\n Atur matapelajaran yang ada pada masing - masing kelas\n </div>\n </div>\n\n "; // line 70 echo isset($context["mapel_kelas_hirarki"]) ? $context["mapel_kelas_hirarki"] : null; echo "\n\n </div>\n</div>\n"; }
function index($step = '') { switch ($step) { case '4': if (!empty($this->db_error)) { redirect('setup/index/1'); } $check = $this->config_model->retrieve('nama-sekolah'); if (empty($check)) { redirect('setup/index/2'); } # cek kelas $check = $this->db->count_all_results('kelas'); if (empty($check)) { redirect('setup/index/3'); } if ($this->form_validation->run('register/pengajar') == true) { $nip = $this->input->post('nip', TRUE); $nama = $this->input->post('nama', TRUE); $jenis_kelamin = $this->input->post('jenis_kelamin', TRUE); $tempat_lahir = $this->input->post('tempat_lahir', TRUE); $tgl_lahir = $this->input->post('tgl_lahir', TRUE); $bln_lahir = $this->input->post('bln_lahir', TRUE); $thn_lahir = $this->input->post('thn_lahir', TRUE); $alamat = $this->input->post('alamat', TRUE); $username = $this->input->post('username', TRUE); $password = $this->input->post('password2', TRUE); $is_admin = 1; $foto = null; if (empty($thn_lahir)) { $tanggal_lahir = null; } else { $tanggal_lahir = $thn_lahir . '-' . $bln_lahir . '-' . $tgl_lahir; } # simpan data siswa $pengajar_id = $this->pengajar_model->create($nip, $nama, $jenis_kelamin, $tempat_lahir, $tanggal_lahir, $alamat, $foto, 1); # simpan data login $this->login_model->create($username, $password, null, $pengajar_id, $is_admin); # create success install $this->config_model->create('install-success', 'install-success', '1'); $this->session->set_flashdata('login', get_alert('success', 'Instalasi e-learning berhasil, silahkan login sebagai administrator.')); redirect('login'); } # cek admin $this->db->where('is_admin', 1); $result = $this->db->get('login'); $result = $result->row_array(); $data['success'] = false; if (!empty($result)) { $data['success'] = true; } $this->twig->display('install-step-4.html', $data); break; case '3': if (!empty($this->db_error)) { redirect('setup/index/1'); } $check = $this->config_model->retrieve('nama-sekolah'); if (empty($check)) { redirect('setup/index/2'); } # cek kelas $check = $this->db->count_all_results('kelas'); if (!empty($check)) { redirect('setup/index/4'); } if (!empty($_POST)) { # simpan kelas foreach ($_POST['kelas'] as $key => $val) { # cek parent sudah ada belum $this->db->where('nama', "KELAS {$key}"); $this->db->where('parent_id', null); $result = $this->db->get('kelas'); $parent = $result->row_array(); if (empty($parent)) { $parent_id = $this->kelas_model->create("KELAS {$key}", null); } else { $parent_id = $parent['id']; } # simpan child foreach ($val as $child) { $this->db->where('nama', "KELAS {$key} - {$child}"); $this->db->where('parent_id', $parent_id); $result = $this->db->get('kelas'); $result = $result->row_array(); if (empty($result)) { $this->kelas_model->create("KELAS {$key} - {$child}", $parent_id); } } } # simpan mapel foreach ($_POST['mapel'] as $nama) { # cek mapel $this->db->where('nama', $nama); $result = $this->db->get('mapel'); $result = $result->row_array(); if (empty($result)) { $this->mapel_model->create($nama); } } redirect('setup/index/4'); } $data['jenjang'] = get_pengaturan('jenjang', 'value'); $this->twig->display('install-step-3.html', $data); break; case '2': if (!empty($this->db_error)) { redirect('setup/index/1'); } $check = $this->config_model->retrieve('nama-sekolah'); if (!empty($check)) { redirect('setup/index/3'); } if ($this->form_validation->run('setup/index/2') == true) { foreach ($_POST as $key => $val) { $this->config_model->create($key, $key, $val); } redirect('setup/index/3'); } $this->twig->display('install-step-2.html'); break; case '1': default: if (empty($this->db_error)) { # cek tabel pengaturan, jika sudah ada lanjut ke step 2 if ($this->db->table_exists('pengaturan')) { redirect('setup/index/2'); } # run query $sql = file_get_contents(APPPATH . 'install/table-master'); $sql = str_replace('{$prefix}', $this->prefix, $sql); $sqls = explode(';', $sql); array_pop($sqls); $this->db->trans_start(); foreach ($sqls as $statement) { $statment = $statement . ";"; $this->db->query($statement); } $this->db->trans_complete(); redirect('setup/index/2'); } $set_base_url = explode('index.php', current_url()); $data['set_base_url'] = $set_base_url[0]; $data['error'] = $this->db_error; $this->twig->display('install-step-1.html', $data); break; } }
function reset_password($kode = '') { if (empty($kode)) { redirect('welcome/lupa_password'); } $login = $this->login_model->retrieve($id = null, $username = null, $password = null, $siswa_id = null, $pengajar_id = null, $is_admin = null, $reset_kode = $kode); if (empty($login)) { $this->session->set_flashdata('lupa_password', get_alert('warning', 'Reset kode tidak benar.')); redirect('login/lupa_password'); } if ($this->form_validation->run('reset_password') == true) { # update password $this->login_model->update_password($login['id'], $this->input->post('password', true)); # update reset kode $this->login_model->update($id = $login['id'], $username = $login['username'], $siswa_id = $login['siswa_id'], $pengajar_id = $login['pengajar_id'], $is_admin = $login['is_admin'], $reset_kode = null); $this->session->set_flashdata('login', get_alert('success', 'Password berhasil diperbaharui, silahkan login menggunakan password baru anda.')); redirect('login'); } $data['login'] = $login; $this->twig->display('reset-password.html', $data); }
function reset_jawaban($tugas_id, $siswa_id) { # jika pengajar atau admin if (is_pengajar() or is_admin()) { $tugas_id = (int) $tugas_id; $tugas = $this->tugas_model->retrieve($tugas_id); if (empty($tugas)) { redirect('tugas'); } $siswa = $this->siswa_model->retrieve($siswa_id); if (empty($siswa)) { redirect('tugas'); } # hapus history $history_id = 'history-mengerjakan-' . $siswa['id'] . '-' . $tugas['id']; $history = retrieve_field($history_id); $history_value = json_decode($history['value'], 1); delete_field($history_id); # hapus nilai $retrieve_nilai = $this->tugas_model->retrieve_nilai(null, $tugas['id'], $siswa['id']); $this->tugas_model->delete_nilai($retrieve_nilai['id']); $this->session->set_flashdata('tugas', get_alert('success', 'Siswa berhasil dianggap belum mengerjakan.')); if ($tugas['type_id'] == 3) { redirect('tugas/nilai/' . $tugas['id']); } else { # jika tugas upload, dihapus juga file uploadnya biar g menuh-menuhin space if ($tugas['type_id'] == 1 && is_file(get_path_file($history_value['file_name']))) { @unlink(get_path_file($history_value['file_name'])); } redirect('tugas/koreksi/' . $tugas['id']); } } else { $this->session->set_flashdata('tugas', get_alert('warning', 'Akses ditolak.')); redirect('tugas'); } }