Beispiel #1
0
 function submit_upload($tugas_id = '', $unix_id = '')
 {
     if (!is_siswa()) {
         redirect('tugas');
     }
     $tugas_id = (int) $tugas_id;
     $tugas = $this->tugas_model->retrieve($tugas_id);
     if (empty($tugas) or $tugas['type_id'] != 1) {
         redirect('tugas');
     }
     if (empty($unix_id)) {
         redirect('tugas');
     }
     # cek sudah mengerjakan belum
     if (sudah_ngerjakan($tugas['id'], get_sess_data('user', 'id'))) {
         $this->session->set_flashdata('tugas', get_alert('warning', 'Anda sudah mengerjakan tugas ini.'));
         redirect('tugas');
     }
     $field_id = 'mengerjakan-' . get_sess_data('user', 'id') . '-' . $tugas['id'];
     $check_field = retrieve_field($field_id);
     if (!empty($check_field)) {
         # bandingkan unix_id nya
         $check_field_value = json_decode($check_field['value'], 1);
         if ($unix_id != $check_field_value['unix_id']) {
             $this->session->set_flashdata('tugas', get_alert('warning', 'Anda tidak mengerjakan tugas ini.'));
             redirect('tugas');
         }
         $config['upload_path'] = get_path_file();
         $config['allowed_types'] = 'doc|zip|rar|txt|docx|xls|xlsx|pdf|tar|gz|jpg|jpeg|JPG|JPEG|png|ppt|pptx';
         $config['max_size'] = '0';
         $config['max_width'] = '0';
         $config['max_height'] = '0';
         $config['file_name'] = $unix_id;
         $this->upload->initialize($config);
         if ($this->upload->do_upload()) {
             $upload_data = $this->upload->data();
             $check_field_value['file_name'] = $upload_data['file_name'];
         } else {
             $this->session->set_flashdata('upload', '<span class="text-error">' . $this->upload->display_errors() . '</span>');
             redirect('tugas/kerjakan/' . $tugas['id']);
         }
         # hapus field tambahan
         delete_field($field_id);
         # simpan history
         $new_field_id = 'history-mengerjakan-' . get_sess_data('user', 'id') . '-' . $tugas['id'];
         $sekarang = date('Y-m-d H:i:s');
         $check_field_value['tgl_submit'] = $sekarang;
         create_field($new_field_id, 'History pengerjaan tugas', json_encode($check_field_value));
         $this->session->set_flashdata('tugas', get_alert('success', 'Anda telah berhasil mengerjakan tugas ini.'));
         redirect('tugas');
     }
     redirect('tugas');
 }
 public function block_content($context, array $blocks = array())
 {
     // line 8
     echo "<div class=\"module\">\n    <div class=\"module-head\">\n        <h3>Tugas</h3>\n    </div>\n    <div class=\"module-body\">\n        ";
     // line 13
     echo get_flashdata("tugas");
     echo "\n\n        <div class=\"bs-callout bs-callout-info\">\n            ";
     // line 16
     if (is_siswa() == false) {
         // line 17
         echo "            <div class=\"btn-group pull-right\" style=\"margin-top:-5px;\">\n                ";
         // line 18
         echo anchor("tugas/add/3", "Tambah Tugas Ganda", array("class" => "btn btn-primary"));
         echo "\n                ";
         // line 19
         echo anchor("tugas/add/2", "Tambah Tugas Essay", array("class" => "btn btn-primary"));
         echo "\n                ";
         // line 20
         echo anchor("tugas/add/1", "Tambah Tugas Upload", array("class" => "btn btn-primary"));
         echo "\n            </div>\n            ";
     }
     // line 23
     echo "            <b><a class=\"as-link\" data-toggle=\"collapse\" data-target=\"#form-filter\"><i class=\"icon-search\" style=\"line-height: 0px;\"></i> Filter</a></b>\n\n            <div id=\"form-filter\" class=\"collapse\" style=\"margin-top: 5px;\">\n                ";
     // line 26
     echo form_open("tugas");
     echo "\n                    <table class=\"table table-condensed\">\n                        <tr>\n                            <th  style=\"border-top: none;\">Mapel</th>\n                            <td  style=\"border-top: none;\">\n                                <ul class=\"unstyled inline\" style=\"margin-left: -5px;\">\n                                    ";
     // line 32
     $context['_parent'] = (array) $context;
     $context['_seq'] = twig_ensure_traversable(isset($context["mapel"]) ? $context["mapel"] : null);
     foreach ($context['_seq'] as $context["_key"] => $context["m"]) {
         // line 33
         echo "                                    <li>\n                                        <label class=\"checkbox inline\">\n                                            <input type=\"checkbox\" name=\"mapel_id[]\" value=\"";
         // line 35
         echo twig_escape_filter($this->env, $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "id"), "html", null, true);
         echo "\" ";
         echo twig_escape_filter($this->env, set_checkbox("mapel_id[]", $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "id"), !twig_test_empty($this->getAttribute(isset($context["filter"]) ? $context["filter"] : null, "mapel_id")) && in_array($this->getAttribute(isset($context["m"]) ? $context["m"] : null, "id"), $this->getAttribute(isset($context["filter"]) ? $context["filter"] : null, "mapel_id")) ? true : ""), "html", null, true);
         echo "> ";
         echo twig_escape_filter($this->env, $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "nama"), "html", null, true);
         echo "\n                                        </label>\n                                    </li>\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 39
     echo "                                </ul>\n                            </td>\n                        </tr>\n                        ";
     // line 42
     if (is_siswa() == false) {
         // line 43
         echo "                        <tr>\n                            <th>Kelas</th>\n                            <td>\n                                <ul class=\"unstyled inline\" style=\"margin-left: -5px;\">\n                                    ";
         // line 47
         $context['_parent'] = (array) $context;
         $context['_seq'] = twig_ensure_traversable(isset($context["kelas"]) ? $context["kelas"] : null);
         foreach ($context['_seq'] as $context["_key"] => $context["k"]) {
             // line 48
             echo "                                    <li>\n                                        <label class=\"checkbox inline\">\n                                            <input type=\"checkbox\" name=\"kelas_id[]\" value=\"";
             // line 50
             echo twig_escape_filter($this->env, $this->getAttribute(isset($context["k"]) ? $context["k"] : null, "id"), "html", null, true);
             echo "\" ";
             echo twig_escape_filter($this->env, set_checkbox("kelas_id[]", $this->getAttribute(isset($context["k"]) ? $context["k"] : null, "id"), !twig_test_empty($this->getAttribute(isset($context["filter"]) ? $context["filter"] : null, "kelas_id")) && in_array($this->getAttribute(isset($context["k"]) ? $context["k"] : null, "id"), $this->getAttribute(isset($context["filter"]) ? $context["filter"] : null, "kelas_id")) ? true : ""), "html", null, true);
             echo "> ";
             echo twig_escape_filter($this->env, $this->getAttribute(isset($context["k"]) ? $context["k"] : null, "nama"), "html", null, true);
             echo "\n                                        </label>\n                                    </li>\n                                    ";
         }
         $_parent = $context['_parent'];
         unset($context['_seq'], $context['_iterated'], $context['_key'], $context['k'], $context['_parent'], $context['loop']);
         $context = array_intersect_key($context, $_parent) + $_parent;
         // line 54
         echo "                                </ul>\n                            </td>\n                        </tr>\n                        ";
     }
     // line 58
     echo "                        <tr>\n                            <th>Tipe</th>\n                            <td>\n                                <ul class=\"unstyled inline\" style=\"margin-left: -5px;\">\n                                    <li>\n                                        <label class=\"checkbox inline\">\n                                            <input type=\"checkbox\" name=\"type[]\" value=\"3\" ";
     // line 64
     echo twig_escape_filter($this->env, set_checkbox("type[]", "3", !twig_test_empty($this->getAttribute(isset($context["filter"]) ? $context["filter"] : null, "type")) && in_array("3", $this->getAttribute(isset($context["filter"]) ? $context["filter"] : null, "type")) ? true : ""), "html", null, true);
     echo "> Ganda\n                                        </label>\n                                    </li>\n                                    <li>\n                                        <label class=\"checkbox inline\">\n                                            <input type=\"checkbox\" name=\"type[]\" value=\"2\" ";
     // line 69
     echo twig_escape_filter($this->env, set_checkbox("type[]", "2", !twig_test_empty($this->getAttribute(isset($context["filter"]) ? $context["filter"] : null, "type")) && in_array("2", $this->getAttribute(isset($context["filter"]) ? $context["filter"] : null, "type")) ? true : ""), "html", null, true);
     echo "> Essay\n                                        </label>\n                                    </li>\n                                    <li>\n                                        <label class=\"checkbox inline\">\n                                            <input type=\"checkbox\" name=\"type[]\" value=\"1\" ";
     // line 74
     echo twig_escape_filter($this->env, set_checkbox("type[]", "1", !twig_test_empty($this->getAttribute(isset($context["filter"]) ? $context["filter"] : null, "type")) && in_array("1", $this->getAttribute(isset($context["filter"]) ? $context["filter"] : null, "type")) ? true : ""), "html", null, true);
     echo "> Upload\n                                        </label>\n                                    </li>\n                                </ul>\n                            </td>\n                        </tr>\n                        <tr>\n                            <th width=\"15%\">Judul</th>\n                            <td>\n                                <input type=\"text\" name=\"judul\" class=\"span4\" value=\"";
     // line 83
     echo twig_escape_filter($this->env, set_value("judul", $this->getAttribute(isset($context["filter"]) ? $context["filter"] : null, "judul")), "html", null, true);
     echo "\">\n                            </td>\n                        </tr>\n                        <tr>\n                            <th>Info</th>\n                            <td>\n                                <input type=\"text\" name=\"info\" class=\"span5\" value=\"";
     // line 89
     echo twig_escape_filter($this->env, set_value("info", $this->getAttribute(isset($context["filter"]) ? $context["filter"] : null, "info")), "html", null, true);
     echo "\">\n                            </td>\n                        </tr>\n                        ";
     // line 92
     if (is_pengajar() == false) {
         // line 93
         echo "                        <tr>\n                            <th>Pembuat</th>\n                            <td>\n                                <input type=\"text\" name=\"pembuat\" class=\"span4\" value=\"";
         // line 96
         echo twig_escape_filter($this->env, set_value("pembuat", $this->getAttribute(isset($context["filter"]) ? $context["filter"] : null, "pembuat")), "html", null, true);
         echo "\">\n                            </td>\n                        </tr>\n                        ";
     }
     // line 100
     echo "                        <tr>\n                            <th>Status</th>\n                            <td>\n                                <ul class=\"unstyled inline\" style=\"margin-left: -5px;\">\n                                    <li>\n                                        <label class=\"checkbox inline\">\n                                            <input type=\"checkbox\" name=\"status[]\" value=\"1\" ";
     // line 106
     echo twig_escape_filter($this->env, set_checkbox("status[]", "1", !twig_test_empty($this->getAttribute(isset($context["filter"]) ? $context["filter"] : null, "status")) && in_array("1", $this->getAttribute(isset($context["filter"]) ? $context["filter"] : null, "status")) ? true : ""), "html", null, true);
     echo "> Terbit\n                                        </label>\n                                    </li>\n                                    <li>\n                                        <label class=\"checkbox inline\">\n                                            <input type=\"checkbox\" name=\"status[]\" value=\"0\" ";
     // line 111
     echo twig_escape_filter($this->env, set_checkbox("status[]", "0", $this->getAttribute(isset($context["filter"]) ? $context["filter"] : null, "status") != "" && in_array("0", $this->getAttribute(isset($context["filter"]) ? $context["filter"] : null, "status")) ? true : ""), "html", null, true);
     echo "> Tutup\n                                        </label>\n                                    </li>\n                                </ul>\n                            </td>\n                        </tr>\n                        <tr>\n                            <td></td>\n                            <td>\n                                <button type=\"submit\" class=\"btn btn-primary\">Filter</button>\n                            </td>\n                        </tr>\n                    </table>\n                </form>\n            </div>\n\n        </div>\n\n        <br>\n\n        <table class=\"table table-striped\">\n            <thead>\n                <tr>\n                    <th width=\"7%\">ID</th>\n                    <th>Informasi Tugas</th>\n                    <th width=\"15%\">Tipe Tugas</th>\n                    <th width=\"15%\"></th>\n                </tr>\n            </thead>\n            <tbody>\n                ";
     // line 141
     $context['_parent'] = (array) $context;
     $context['_seq'] = twig_ensure_traversable(isset($context["tugas"]) ? $context["tugas"] : null);
     foreach ($context['_seq'] as $context["no"] => $context["m"]) {
         // line 142
         echo "                <tr ";
         echo is_siswa() && $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "aktif") == 1 && sudah_ngerjakan($this->getAttribute(isset($context["m"]) ? $context["m"] : null, "id"), get_sess_data("user", "id")) == false ? "class=\"success\"" : "";
         echo ">\n                    <td><b>";
         // line 143
         echo twig_escape_filter($this->env, $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "id"), "html", null, true);
         echo "</b></td>\n                    <td>\n                        <strong class=\"text-warning\">";
         // line 145
         echo twig_escape_filter($this->env, $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "judul"), "html", null, true);
         echo "</strong>\n                        <br><small><b>";
         // line 146
         echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute(isset($context["m"]) ? $context["m"] : null, "mapel"), "nama"), "html", null, true);
         echo "</b>\n\n                        ";
         // line 148
         $context['_parent'] = (array) $context;
         $context['_seq'] = twig_ensure_traversable($this->getAttribute(isset($context["m"]) ? $context["m"] : null, "tugas_kelas"));
         foreach ($context['_seq'] as $context["_key"] => $context["mk"]) {
             // line 149
             echo "                            , ";
             echo twig_escape_filter($this->env, $this->getAttribute(isset($context["mk"]) ? $context["mk"] : null, "nama"), "html", null, true);
             echo "\n                        ";
         }
         $_parent = $context['_parent'];
         unset($context['_seq'], $context['_iterated'], $context['_key'], $context['mk'], $context['_parent'], $context['loop']);
         $context = array_intersect_key($context, $_parent) + $_parent;
         // line 151
         echo "\n                        ";
         // line 152
         if ($this->getAttribute(isset($context["m"]) ? $context["m"] : null, "type_label") == "Ganda" || $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "type_label") == "Essay") {
             // line 153
             echo "                            , ";
             echo twig_escape_filter($this->env, $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "durasi"), "html", null, true);
             echo " Menit\n                        ";
         }
         // line 155
         echo "\n                        </small>\n                        <br><small><b>Pembuat : </b> <a href=\"";
         // line 157
         echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute(isset($context["m"]) ? $context["m"] : null, "pembuat"), "link_profil"), "html", null, true);
         echo "\">";
         echo twig_escape_filter($this->env, $this->getAttribute($this->getAttribute(isset($context["m"]) ? $context["m"] : null, "pembuat"), "nama"), "html", null, true);
         echo "</a>, ";
         echo twig_escape_filter($this->env, tgl_jam_indo($this->getAttribute(isset($context["m"]) ? $context["m"] : null, "tgl_buat")), "html", null, true);
         echo "</small>\n                        ";
         // line 158
         if (is_siswa() && $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "info") != "") {
             // line 159
             echo "                            <hr style=\"margin-top: 5px;margin-bottom: 5px;border:none;border-bottom: 1px dashed black;\">\n                            ";
             // line 160
             echo $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "info");
             echo "\n                        ";
         }
         // line 162
         echo "                    </td>\n                    <td>\n                        ";
         // line 164
         if ($this->getAttribute(isset($context["m"]) ? $context["m"] : null, "type_label") == "Ganda") {
             // line 165
             echo "                            <span class=\"label label-success\">Ganda</span>\n                        ";
         } elseif ($this->getAttribute(isset($context["m"]) ? $context["m"] : null, "type_label") == "Essay") {
             // line 167
             echo "                            <span class=\"label label-info\">Essay</span>\n                        ";
         } elseif ($this->getAttribute(isset($context["m"]) ? $context["m"] : null, "type_label") == "Upload") {
             // line 169
             echo "                            <span class=\"label label-warning\">Upload</span>\n                        ";
         }
         // line 171
         echo "                    </td>\n                    <td>\n                        <div class=\"btn-group\">\n                        ";
         // line 174
         if (is_siswa() == false) {
             // line 175
             echo "                            ";
             if ($this->getAttribute(isset($context["m"]) ? $context["m"] : null, "type_label") == "Ganda" || $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "type_label") == "Essay") {
                 // line 176
                 echo "                                ";
                 echo anchor("tugas/manajemen_soal/" . $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "id"), "<i class=\"icon icon-tasks\"></i> Soal", array("class" => "btn btn-primary btn-small"));
                 echo "\n                            ";
             }
             // line 178
             echo "                            ";
             if ($this->getAttribute(isset($context["m"]) ? $context["m"] : null, "aktif") == 0) {
                 // line 179
                 echo "                                ";
                 echo anchor("tugas/terbitkan/" . $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "id") . "/" . enurl_redirect(current_url()), "<i class=\"icon-ok\"></i> Terbitkan", array("class" => "btn btn-success btn-small"));
                 echo "\n                            ";
             } elseif ($this->getAttribute(isset($context["m"]) ? $context["m"] : null, "aktif") == 1) {
                 // line 181
                 echo "                                ";
                 echo anchor("tugas/tutup/" . $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "id") . "/" . enurl_redirect(current_url()), "<i class=\"icon-minus\"></i> Tutup", array("class" => "btn btn-danger btn-small"));
                 echo "\n                            ";
             }
             // line 183
             echo "\n                            ";
             // line 184
             echo anchor("tugas/edit/" . $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "id") . "/" . enurl_redirect(current_url()), "<i class=\"icon-edit\"></i> Edit", array("class" => "btn btn-default btn-small"));
             echo "\n                            ";
             // line 185
             if ($this->getAttribute(isset($context["m"]) ? $context["m"] : null, "type_id") == 3) {
                 // line 186
                 echo "                                ";
                 echo anchor("tugas/nilai/" . $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "id"), "<i class=\"icon-eye-open\"></i> Lihat Nilai", array("class" => "btn btn-info btn-small"));
                 echo "\n                            ";
             } else {
                 // line 188
                 echo "                                ";
                 echo anchor("tugas/koreksi/" . $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "id"), "<i class=\"icon-check\"></i> Koreksi", array("class" => "btn btn-info btn-small"));
                 echo "\n                            ";
             }
             // line 190
             echo "                        ";
         } elseif (is_siswa() == true) {
             // line 191
             echo "                            ";
             if ($this->getAttribute(isset($context["m"]) ? $context["m"] : null, "aktif") == 1) {
                 // line 192
                 echo "                                ";
                 if (sudah_ngerjakan($this->getAttribute(isset($context["m"]) ? $context["m"] : null, "id"), get_sess_data("user", "id")) == false) {
                     // line 193
                     echo "                                    ";
                     echo anchor("tugas/kerjakan/" . $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "id"), "<i class=\"icon-ok-sign\"></i> Mulai Kerjakan", array("class" => "btn btn-success btn-small", "onclick" => "return confirm('Anda yakin ingin memulai mengerjakan tugas ini?')"));
                     echo "\n                                ";
                 }
                 // line 195
                 echo "                            ";
             } else {
                 // line 196
                 echo "                                ";
                 echo anchor("tugas/nilai/" . $this->getAttribute(isset($context["m"]) ? $context["m"] : null, "id"), "<i class=\"icon-flag\"></i> Lihat Nilai", array("class" => "btn btn-info btn-small iframe-lihat-nilai"));
                 echo "\n                            ";
             }
             // line 198
             echo "                        ";
         }
         // line 199
         echo "                        </div>\n                    </td>\n                </tr>\n                ";
     }
     $_parent = $context['_parent'];
     unset($context['_seq'], $context['_iterated'], $context['no'], $context['m'], $context['_parent'], $context['loop']);
     $context = array_intersect_key($context, $_parent) + $_parent;
     // line 203
     echo "            </tbody>\n        </table>\n        <br>\n        ";
     // line 206
     echo isset($context["pagination"]) ? $context["pagination"] : null;
     echo "\n\n    </div>\n</div>\n";
 }