Rabu, 12 Desember 2018

EAS PWEB-C 2018

Nama : Hafidz Firman Asqalany
NRP   : 05111740000195
kelas  : PWEB-C

1. Rancangan Database yang kira-kira bakal saya buat seperti ini.


   ini merupakan database yang saya gunakan dalam tugas ini.


2.  Rancangan interface aplikasi yang bakal saya buat kira-kira seperti ini.


cara menjalankan aplikasi bagi user:
  1. pertama-tama tekan menu bar daftar sekarang yang berada di sebelah kanan bawah.
  2. setelah itu akan ada pemberitahuan "untuk melanjutkan anda harus memiliki sesi". sesi yang dimaksud ini merupakan user key yang didapatkan dari admin. Disini admin akan memberitahukan user key yang di  gunakan untuk login daftar siswa.(disini saya hanya menambahkan 1 key user yaitu (root93)).
  3. jika key yang di inputkan benar maka akan muncul pesan "kunci yang anda masukan benar " dan user dapat langsung mengisi biodata untuk melengkapi pendaftaran.
  4. ketika user telah melengkapi biodata, user bisa mengakses menu pengumuman yang berada di bawah menu daftar.
  5. di menu pengumuman user dapat melihat siapa saja yang telah mendaftar dan status mereka, apakah diterima, belum terverifikasi, atau ditolak oleh SMA yang di daftar. user juga bisa mencetak hasil pengumuman tersebut.
 cara menjalankan aplikasi bagi admin:
  1.  pertama-tama admin harus login ke menu admin dengan cara mengetikkan url seperti berikut : http://localhost/sekolah/root/.
  2. admin akan di minta untuk melakukan login form.(username dan password dapat dilihat di database yang telah di buat/source code).
  3. ketika login berhasil dilakukan maka admin dapat melakukan banyak hal. seperti edit data siswa, edit status pendaftaran, menghapus data, menambahkan data, memberikan key kepada user,  dan juga dapat mencetak data siswa yang telah di input.
  4. admin juga dapat mengganti header website dan keterangan  web ppdb online ini.
 cat: username admin : root93
       password  admin : admin


 ini merupakan tampilan programnya :

 tampilan home


tampilan daftar login








tampilan saat mengisi data



tampilan saat melihat pengumuman dan mencetak data siswa




tampilan awal masuk panel admin


tampilan ketika edit data siswa lewat panel admin


program ini saya buat dengan framework codeigniter, database mysql, php, dan bootstrap.
jadi bisa dilihat sourcenya di sini Link :
https://drive.google.com/file/d/18_azbXU8dFyfTxIqsNkCvTfusQnH3lTd/view?usp=sharing


link hosting :
https://ppdbeas.000webhostapp.com/
cat: buatlah nama database dan folder di htdoct dengan nama "sekolah".

Senin, 10 Desember 2018

EAS PBO-A 2018

Nama : Hafidz Firman Asqalany
NRP   : 05111740000195
Kelas  : PBO-A

Soal 

1. Gambarkan rancangan interfacenya.
2. Gambarkan dan jelaskan Class Diagram penyusun dari image viewer yang akan dibuat.
3. Implementasikan ke dalam program dan buat link nya di posting blog ini.

Jawaban

1.

2.  Tampilan Class Blue-j :

penjelasan setiap class : 

ImageViewer :
kelas utama aplikasi penampil gambar, menampilkan aplikasi GUI dan menginisialisasi semua komponen lainnya, dan untuk memulai aplikasi.

ImageFileManager :
Kelas utilitas kecil dengan metode statis untuk memuat dan menyimpan gambar.

ImagePanel :
komponen swing yang dapat menampilkan Class OFImage.

OFImage :
kelas yang mendefinisikan gambar dalam format OF(Objects First). 

Filter :
superclass abstrak untuk menjalankan semua filter yang ada di dalam program.

edgefilter :
merupakan bagian filter di program.

thresholdfilter :
merupakan bagian filter di program.

solarizefilter :
merupakan bagian filter di program.
pixelizefilter:
merupakan bagian filter di program.

smoothfilter :
merupakan bagian filter di program.
3.  Source Code :
ImageViewer :

 import java.awt.*;  
 import java.awt.event.*;  
 import java.awt.image.*;  
 import javax.swing.*;  
 import javax.swing.border.*;  
 import java.io.File;  
 import java.util.List;  
 import java.util.ArrayList;  
 import java.util.Iterator;  
 /**  
  * ImageViewer is the main class of the image viewer application. It builds and  
  * displays the application GUI and initialises all other components.  
  *   
  * To start the application, create an object of this class.  
  *   
  * @author Michael Kolling and David J Barnes   
  * @version 3.1  
  */  
 public class ImageViewer  
 {  
   // static fields:  
   private static final String VERSION = "Version 3.1";  
   private static JFileChooser fileChooser = new JFileChooser(System.getProperty("user.dir"));  
   // fields:  
   private JFrame frame;  
   private ImagePanel imagePanel;  
   private JLabel filenameLabel;  
   private JLabel statusLabel;  
   private JButton smallerButton;  
   private JButton largerButton;  
   private JButton cropButton;  
   private JButton textButton;  
   private JButton rotateleftButton;  
   private JButton rotaterightButton;  
   private OFImage currentImage;  
   private List<Filter> filters;  
   /**  
    * Create an ImageViewer and display its GUI on screen.  
    */  
   public ImageViewer()  
   {  
     currentImage = null;  
     filters = createFilters();  
     makeFrame();  
   }  
   // ---- implementation of menu functions ----  
   /**  
    * Open function: open a file chooser to select a new image file,  
    * and then display the chosen image.  
    */  
   private void openFile()  
   {  
     int returnVal = fileChooser.showOpenDialog(frame);  
     if(returnVal != JFileChooser.APPROVE_OPTION) {  
       return; // cancelled  
     }  
     File selectedFile = fileChooser.getSelectedFile();  
     currentImage = ImageFileManager.loadImage(selectedFile);  
     if(currentImage == null) {  // image file was not a valid image  
       JOptionPane.showMessageDialog(frame,  
           "The file was not in a recognized image file format.",  
           "Image Load Error",  
           JOptionPane.ERROR_MESSAGE);  
       return;  
     }  
     imagePanel.setImage(currentImage);  
     setButtonsEnabled(true);  
     showFilename(selectedFile.getPath());  
     showStatus("File loaded.");  
     frame.pack();  
   }  
   /**  
    * Close function: close the current image.  
    */  
   private void close()  
   {  
     currentImage = null;  
     imagePanel.clearImage();  
     showFilename(null);  
     setButtonsEnabled(false);  
   }  
   /**  
    * Save As function: save the current image to a file.  
    */  
   private void saveAs()  
   {  
     if(currentImage != null) {  
       int returnVal = fileChooser.showSaveDialog(frame);  
       if(returnVal != JFileChooser.APPROVE_OPTION) {  
         return; // cancelled  
       }  
       File selectedFile = fileChooser.getSelectedFile();  
       ImageFileManager.saveImage(currentImage, selectedFile);  
       showFilename(selectedFile.getPath());  
     }  
   }  
   /**  
    * Quit function: quit the application.  
    */  
   private void quit()  
   {  
     System.exit(0);  
   }  
   /**  
    * Apply a given filter to the current image.  
    *   
    * @param filter  The filter object to be applied.  
    */  
   private void applyFilter(Filter filter)  
   {  
     if(currentImage != null) {  
       filter.apply(currentImage);  
       frame.repaint();  
       showStatus("Applied: " + filter.getName());  
     }  
     else {  
       showStatus("No image loaded.");  
     }  
   }  
   /**  
    * 'About' function: show the 'about' box.  
    */  
   private void showAbout()  
   {  
     JOptionPane.showMessageDialog(frame,   
           "ImageViewer\n" + VERSION,  
           "About ImageViewer",   
           JOptionPane.INFORMATION_MESSAGE);  
   }  
   /**  
    * Make the current picture larger.  
    */  
   private void makeLarger()  
   {  
     if(currentImage != null) {  
       // create new image with double size  
       int width = currentImage.getWidth();  
       int height = currentImage.getHeight();  
       OFImage newImage = new OFImage(width * 2, height * 2);  
       // copy pixel data into new image  
       for(int y = 0; y < height; y++) {  
         for(int x = 0; x < width; x++) {  
           Color col = currentImage.getPixel(x, y);  
           newImage.setPixel(x * 2, y * 2, col);  
           newImage.setPixel(x * 2 + 1, y * 2, col);  
           newImage.setPixel(x * 2, y * 2 + 1, col);  
           newImage.setPixel(x * 2+1, y * 2 + 1, col);  
         }  
       }  
       currentImage = newImage;  
       imagePanel.setImage(currentImage);  
       frame.pack();  
     }  
   }  
   /**  
    * Make the current picture smaller.  
    */  
   private void makeSmaller()  
   {  
     if(currentImage != null) {  
       // create new image with double size  
       int width = currentImage.getWidth() / 2;  
       int height = currentImage.getHeight() / 2;  
       OFImage newImage = new OFImage(width, height);  
       // copy pixel data into new image  
       for(int y = 0; y < height; y++) {  
         for(int x = 0; x < width; x++) {  
           newImage.setPixel(x, y, currentImage.getPixel(x * 2, y * 2));  
         }  
       }  
       currentImage = newImage;  
       imagePanel.setImage(currentImage);  
       frame.pack();  
     }  
   }  
   private void crop()  
   {  
     if (currentImage != null)  
     {  
       int width = currentImage.getWidth();  
       int height = currentImage.getWidth();  
       int xAwal = Integer.parseInt(JOptionPane.showInputDialog("xAwal"));  
       int yAwal = Integer.parseInt(JOptionPane.showInputDialog("yAwal"));  
       int xAkhir = Integer.parseInt(JOptionPane.showInputDialog("xAkhir"));  
       int yAkhir = Integer.parseInt(JOptionPane.showInputDialog("yAkhir"));  
       OFImage newImage = new OFImage(xAkhir - xAwal, yAkhir - yAwal);  
       for (int y = 0; y < yAkhir - yAwal; y++)  
       {  
         for (int x = 0; x < xAkhir - xAwal; x++)  
         {  
           newImage.setPixel(x, y, currentImage.getPixel(x + xAwal, y + yAwal));  
         }  
       }  
       currentImage = newImage;  
       imagePanel.setImage(currentImage);  
       frame.pack();  
     }  
   }  
   private void makeText()  
   {  
     if(currentImage != null) {  
       int width = currentImage.getWidth();  
       int height = currentImage.getHeight();  
       int xPosition = Integer.parseInt(JOptionPane.showInputDialog("Posisi X"));  
       int yPosition = Integer.parseInt(JOptionPane.showInputDialog("Posisi Y"));  
       float fontSize = Float.parseFloat(JOptionPane.showInputDialog("Besar Font"));  
       String addText = JOptionPane.showInputDialog("Ketik sesuatu..");  
       OFImage newImage = new OFImage(width, height);  
       // copy pixel data into new image  
       for(int y = 0; y < height; y++) {  
         for(int x = 0; x < width; x++) {  
           Color col = currentImage.getPixel(x, y);  
           newImage.setPixel(x, y, col);  
         }  
       }  
       Graphics g = newImage.getGraphics();  
       g.setFont(g.getFont().deriveFont(fontSize));  
       g.drawString(addText, xPosition, yPosition);  
       g.dispose();  
       currentImage = newImage;  
       imagePanel.setImage(currentImage);  
     }  
   }  
    private void Rotate90left() {  
     if(currentImage != null) {  
       // create new image with double size  
       int width = currentImage.getWidth();  
       int height = currentImage.getHeight();  
       OFImage newImage = new OFImage(height, width);  
       //copy pixel data into new image  
       for(int y = 0; y < height; y++) {  
         for(int x = 0; x < width; x++) {  
           Color col = currentImage.getPixel(x, y);  
           newImage.setPixel(y, width-x-1, col);  
         }  
       }  
       currentImage = newImage;  
       imagePanel.setImage(currentImage);  
       frame.pack();  
     }  
   }  
   private void Rotate90right() {  
     if(currentImage != null) {  
       // create new image with double size  
       int width = currentImage.getWidth();  
       int height = currentImage.getHeight();  
       OFImage newImage = new OFImage(height, width);  
       //copy pixel data into new image  
       for(int y = 0; y < height; y++) {  
         for(int x = 0; x < width; x++) {  
           Color col = currentImage.getPixel(x, y);  
           newImage.setPixel(height-y-1, x, col);  
         }  
       }  
       currentImage = newImage;  
       imagePanel.setImage(currentImage);  
       frame.pack();  
     }  
   }  
   // ---- support methods ----  
   /**  
    * Show the file name of the current image in the fils display label.  
    * 'null' may be used as a parameter if no file is currently loaded.  
    *   
    * @param filename The file name to be displayed, or null for 'no file'.  
    */  
   private void showFilename(String filename)  
   {  
     if(filename == null) {  
       filenameLabel.setText("No file displayed.");  
     }  
     else {  
       filenameLabel.setText("File: " + filename);  
     }  
   }  
   /**  
    * Show a message in the status bar at the bottom of the screen.  
    * @param text The status message.  
    */  
   private void showStatus(String text)  
   {  
     statusLabel.setText(text);  
   }  
   /**  
    * Enable or disable all toolbar buttons.  
    *   
    * @param status 'true' to enable the buttons, 'false' to disable.  
    */  
   private void setButtonsEnabled(boolean status)  
   {  
     smallerButton.setEnabled(status);  
     largerButton.setEnabled(status);  
     cropButton.setEnabled(status);  
     textButton.setEnabled(status);  
     rotateleftButton.setEnabled(status);  
     rotaterightButton.setEnabled(status);  
   }  
   /**  
    * Create a list with all the known filters.  
    * @return The list of filters.  
    */  
   private List<Filter> createFilters()  
   {  
     List<Filter> filterList = new ArrayList<Filter>();  
     filterList.add(new DarkerFilter("Darker"));  
     filterList.add(new LighterFilter("Lighter"));  
     filterList.add(new ThresholdFilter("Threshold"));  
     filterList.add(new InvertFilter("Invert"));  
     filterList.add(new SolarizeFilter("Solarize"));  
     filterList.add(new SmoothFilter("Smooth"));  
     filterList.add(new PixelizeFilter("Pixelize"));  
     filterList.add(new MirrorFilter("Mirror"));  
     filterList.add(new GrayScaleFilter("Grayscale"));  
     filterList.add(new EdgeFilter("Edge Detection"));  
     filterList.add(new FishEyeFilter("Fish Eye"));  
     return filterList;  
   }  
   // ---- Swing stuff to build the frame and all its components and menus ----  
   /**  
    * Create the Swing frame and its content.  
    */  
   private void makeFrame()  
   {  
     frame = new JFrame("ImageViewer");  
     JPanel contentPane = (JPanel)frame.getContentPane();  
     contentPane.setBorder(new EmptyBorder(6, 6, 6, 6));  
     makeMenuBar(frame);  
     // Specify the layout manager with nice spacing  
     contentPane.setLayout(new BorderLayout(6, 6));  
     // Create the image pane in the center  
     imagePanel = new ImagePanel();  
     imagePanel.setBorder(new EtchedBorder());  
     contentPane.add(imagePanel, BorderLayout.CENTER);  
     // Create two labels at top and bottom for the file name and status messages  
     filenameLabel = new JLabel();  
     contentPane.add(filenameLabel, BorderLayout.NORTH);  
     statusLabel = new JLabel(VERSION);  
     contentPane.add(statusLabel, BorderLayout.SOUTH);  
     // Create the toolbar with the buttons  
     JPanel toolbar = new JPanel();  
     toolbar.setLayout(new GridLayout(0, 1));  
     smallerButton = new JButton("Smaller");  
     smallerButton.addActionListener(new ActionListener() {  
                 public void actionPerformed(ActionEvent e) { makeSmaller(); }  
               });  
     toolbar.add(smallerButton);  
     largerButton = new JButton("Larger");  
     largerButton.addActionListener(new ActionListener() {  
                 public void actionPerformed(ActionEvent e) { makeLarger(); }  
               });  
     toolbar.add(largerButton);  
     cropButton = new JButton("Crop");  
     cropButton.addActionListener(new ActionListener() {  
                 public void actionPerformed(ActionEvent e) { crop(); }  
               });   
     toolbar.add(cropButton);  
     textButton = new JButton("Add Text");  
     textButton.addActionListener(new ActionListener() {  
                 public void actionPerformed(ActionEvent e) { makeText();}  
               });  
     toolbar.add(textButton);  
     rotateleftButton = new JButton("rotate left");  
     rotateleftButton.addActionListener(new ActionListener() {  
                 public void actionPerformed(ActionEvent e) { Rotate90left();}  
               });  
     toolbar.add(rotateleftButton);  
     rotaterightButton = new JButton("rotate right");  
     rotaterightButton.addActionListener(new ActionListener() {  
                 public void actionPerformed(ActionEvent e) { Rotate90right();}  
               });  
     toolbar.add(rotaterightButton);  
     // Add toolbar into panel with flow layout for spacing  
     JPanel flow = new JPanel();  
     flow.add(toolbar);  
     contentPane.add(flow, BorderLayout.WEST);  
     // building is done - arrange the components     
     showFilename(null);  
     setButtonsEnabled(false);  
     frame.pack();  
     // place the frame at the center of the screen and show  
     Dimension d = Toolkit.getDefaultToolkit().getScreenSize();  
     frame.setLocation(d.width/2 - frame.getWidth()/2, d.height/2 - frame.getHeight()/2);  
     frame.setVisible(true);  
   }  
   /**  
    * Create the main frame's menu bar.  
    *   
    * @param frame  The frame that the menu bar should be added to.  
    */  
   private void makeMenuBar(JFrame frame)  
   {  
     final int SHORTCUT_MASK =  
       Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();  
     JMenuBar menubar = new JMenuBar();  
     frame.setJMenuBar(menubar);  
     JMenu menu;  
     JMenuItem item;  
     // create the File menu  
     menu = new JMenu("File");  
     menubar.add(menu);  
     item = new JMenuItem("Open...");  
       item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, SHORTCUT_MASK));  
       item.addActionListener(new ActionListener() {  
                 public void actionPerformed(ActionEvent e) { openFile(); }  
               });  
     menu.add(item);  
     item = new JMenuItem("Close");  
       item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, SHORTCUT_MASK));  
       item.addActionListener(new ActionListener() {  
                 public void actionPerformed(ActionEvent e) { close(); }  
               });  
     menu.add(item);  
     menu.addSeparator();  
     item = new JMenuItem("Save As...");  
       item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, SHORTCUT_MASK));  
       item.addActionListener(new ActionListener() {  
                 public void actionPerformed(ActionEvent e) { saveAs(); }  
               });  
     menu.add(item);  
     menu.addSeparator();  
     item = new JMenuItem("Quit");  
       item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, SHORTCUT_MASK));  
       item.addActionListener(new ActionListener() {  
                 public void actionPerformed(ActionEvent e) { quit(); }  
               });  
     menu.add(item);  
     // create the Filter menu  
     menu = new JMenu("Filter");  
     menubar.add(menu);  
     for(final Filter filter : filters) {  
       item = new JMenuItem(filter.getName());  
       item.addActionListener(new ActionListener() {  
                 public void actionPerformed(ActionEvent e) {   
                   applyFilter(filter);  
                 }  
               });  
        menu.add(item);  
      }  
     // create the Help menu  
     menu = new JMenu("Help");  
     menubar.add(menu);  
     item = new JMenuItem("About ImageViewer...");  
       item.addActionListener(new ActionListener() {  
                 public void actionPerformed(ActionEvent e) { showAbout(); }  
               });  
     menu.add(item);  
   }  
   // Import the basic graphics classes.  
 }  

ImageFileManager :

 import java.awt.image.*;  
 import javax.imageio.*;  
 import java.io.*;  
 /**  
  * ImageFileManager is a small utility class with static methods to load  
  * and save images.  
  *   
  * The files on disk can be in JPG or PNG image format. For files written  
  * by this class, the format is determined by the constant IMAGE_FORMAT.  
  *   
  * @author Michael Kolling and David J Barnes   
  * @version 2.0  
  */  
 public class ImageFileManager  
 {  
   // A constant for the image format that this writer uses for writing.  
   // Available formats are "jpg" and "png".  
   private static final String IMAGE_FORMAT = "jpg";  
   /**  
    * Read an image file from disk and return it as an image. This method  
    * can read JPG and PNG file formats. In case of any problem (e.g the file   
    * does not exist, is in an undecodable format, or any other read error)   
    * this method returns null.  
    *   
    * @param imageFile The image file to be loaded.  
    * @return      The image object or null is it could not be read.  
    */  
   public static OFImage loadImage(File imageFile)  
   {  
     try {  
       BufferedImage image = ImageIO.read(imageFile);  
       if(image == null || (image.getWidth(null) < 0)) {  
         // we could not load the image - probably invalid file format  
         return null;  
       }  
       return new OFImage(image);  
     }  
     catch(IOException exc) {  
       return null;  
     }  
   }  
   /**  
    * Write an image file to disk. The file format is JPG. In case of any   
    * problem the method just silently returns.  
    *   
    * @param image The image to be saved.  
    * @param file  The file to save to.  
    */  
   public static void saveImage(OFImage image, File file)  
   {  
     try {  
       ImageIO.write(image, IMAGE_FORMAT, file);  
     }  
     catch(IOException exc) {  
       return;  
     }  
   }  
 }  

ImagePanel :

 import java.awt.*;  
 import javax.swing.*;  
 import java.awt.image.*;  
 /**  
  * An ImagePanel is a Swing component that can display an OFImage.  
  * It is constructed as a subclass of JComponent with the added functionality  
  * of setting an OFImage that will be displayed on the surface of this  
  * component.  
  *   
  * @author Michael Kolling and David J. Barnes  
  * @version 1.0  
  */  
 public class ImagePanel extends JComponent  
 {  
   // The current width and height of this panel  
   private int width, height;  
   // An internal image buffer that is used for painting. For  
   // actual display, this image buffer is then copied to screen.  
   private OFImage panelImage;  
   /**  
    * Create a new, empty ImagePanel.  
    */  
   public ImagePanel()  
   {  
     width = 360;  // arbitrary size for empty panel  
     height = 240;  
     panelImage = null;  
   }  
   /**  
    * Set the image that this panel should show.  
    *   
    * @param image The image to be displayed.  
    */  
   public void setImage(OFImage image)  
   {  
     if(image != null) {  
       width = image.getWidth();  
       height = image.getHeight();  
       panelImage = image;  
       repaint();  
     }  
   }  
   /**  
    * Clear the image on this panel.  
    */  
   public void clearImage()  
   {  
     Graphics imageGraphics = panelImage.getGraphics();  
     imageGraphics.setColor(Color.LIGHT_GRAY);  
     imageGraphics.fillRect(0, 0, width, height);  
     repaint();  
   }  
   // The following methods are redefinitions of methods  
   // inherited from superclasses.  
   /**  
    * Tell the layout manager how big we would like to be.  
    * (This method gets called by layout managers for placing  
    * the components.)  
    *   
    * @return The preferred dimension for this component.  
    */  
   public Dimension getPreferredSize()  
   {  
     return new Dimension(width, height);  
   }  
   /**  
    * This component needs to be redisplayed. Copy the internal image   
    * to screen. (This method gets called by the Swing screen painter   
    * every time it want this component displayed.)  
    *   
    * @param g The graphics context that can be used to draw on this component.  
    */  
   public void paintComponent(Graphics g)  
   {  
     Dimension size = getSize();  
     g.clearRect(0, 0, size.width, size.height);  
     if(panelImage != null) {  
       g.drawImage(panelImage, 0, 0, null);  
     }  
   }  
 }  

OFImage :

 import java.awt.*;  
 import java.awt.image.*;  
 import javax.swing.*;  
 /**  
  * OFImage is a class that defines an image in OF (Objects First) format.  
  *   
  * @author Michael Kolling and David J. Barnes  
  * @version 2.0  
  */  
 public class OFImage extends BufferedImage  
 {  
   /**  
    * Create an OFImage copied from a BufferedImage.  
    * @param image The image to copy.  
    */  
   public OFImage(BufferedImage image)  
   {  
      super(image.getColorModel(), image.copyData(null),   
         image.isAlphaPremultiplied(), null);  
   }  
   /**  
    * Create an OFImage with specified size and unspecified content.  
    * @param width The width of the image.  
    * @param height The height of the image.  
    */  
   public OFImage(int width, int height)  
   {  
     super(width, height, TYPE_INT_RGB);  
   }  
   /**  
    * Set a given pixel of this image to a specified color. The  
    * color is represented as an (r,g,b) value.  
    * @param x The x position of the pixel.  
    * @param y The y position of the pixel.  
    * @param col The color of the pixel.  
    */  
   public void setPixel(int x, int y, Color col)  
   {  
     int pixel = col.getRGB();  
     setRGB(x, y, pixel);  
   }  
   /**  
    * Get the color value at a specified pixel position.  
    * @param x The x position of the pixel.  
    * @param y The y position of the pixel.  
    * @return The color of the pixel at the given position.  
    */  
   public Color getPixel(int x, int y)  
   {  
     int pixel = getRGB(x, y);  
     return new Color(pixel);  
   }  
 }  

EdgeFilter :

 import java.awt.Color;  
 import java.util.List;  
 import java.util.ArrayList;  
 /**  
  * An image filter to detect edges and highlight them, a bit like   
  * a colored pencil drawing.  
  *   
  * @author Michael Kolling and David J Barnes   
  * @version 1.0  
  */  
 public class EdgeFilter extends Filter  
 {  
   private static final int TOLERANCE = 20;  
   private OFImage original;  
   private int width;  
   private int height;  
   /**  
    * Constructor for objects of class EdgeFilter.  
    * @param name The name of the filter.  
    */  
   public EdgeFilter(String name)  
   {  
     super(name);  
   }  
   /**  
    * Apply this filter to an image.  
    *   
    * @param image The image to be changed by this filter.  
    */  
   public void apply(OFImage image)  
   {  
     original = new OFImage(image);  
     width = original.getWidth();  
     height = original.getHeight();  
     for(int y = 0; y < height; y++) {  
       for(int x = 0; x < width; x++) {  
         image.setPixel(x, y, edge(x, y));  
       }  
     }  
   }  
   /**  
    * Return a new color that is the smoothed color of a given  
    * position. The "smoothed color" is the color value that is the  
    * average of this pixel and all the adjacent pixels.  
    * @param xpos The x position of the pixel.  
    * @param ypos The y position of the pixel.  
    * @return The smoothed color.  
    */  
   private Color edge(int xpos, int ypos)  
   {  
     List<Color> pixels = new ArrayList<Color>(9);  
     for(int y = ypos-1; y <= ypos+1; y++) {  
       for(int x = xpos-1; x <= xpos+1; x++) {  
         if( x >= 0 && x < width && y >= 0 && y < height ) {  
           pixels.add(original.getPixel(x, y));  
         }  
       }  
     }  
     return new Color(255 - diffRed(pixels), 255 - diffGreen(pixels), 255 - diffBlue(pixels));  
   }  
   /**  
    * @param pixels The list of pixels to be averaged.  
    * @return The average of all the red values in the given list of pixels.  
    */  
   private int diffRed(List<Color> pixels)  
   {  
     int max = 0;  
     int min = 255;  
     for(Color color : pixels) {  
       int val = color.getRed();  
       if(val > max) {  
         max = val;  
       }  
       if(val < min) {  
         min = val;  
       }  
     }  
     int difference = max - min - TOLERANCE;  
     if(difference < 0) {  
       difference = 0;  
     }  
     return difference;  
   }  
   /**  
    * @param pixels The list of pixels to be averaged.  
    * @return The average of all the green values in the given list of pixels.  
    */  
   private int diffGreen(List<Color> pixels)  
   {  
     int max = 0;  
     int min = 255;  
     for(Color color : pixels) {  
       int val = color.getGreen();  
       if(val > max) {  
         max = val;  
       }  
       if(val < min) {  
         min = val;  
       }  
     }  
     int difference = max - min - TOLERANCE;  
     if(difference < 0) {  
       difference = 0;  
     }  
     return difference;  
   }  
   /**  
    * @param pixels The list of pixels to be averaged.  
    * @return The average of all the blue values in the given list of pixels.  
    */  
   private int diffBlue(List<Color> pixels)  
   {  
     int max = 0;  
     int min = 255;  
     for(Color color : pixels) {  
       int val = color.getBlue();  
       if(val > max) {  
         max = val;  
       }  
       if(val < min) {  
         min = val;  
       }  
     }  
     int difference = max - min - TOLERANCE;  
     if(difference < 0) {  
       difference = 0;  
     }  
     return difference;  
   }  
 }  

ThresholdFilter :

 import java.awt.Color;  
 /**  
  * An three-level gray-based threshold filter.  
  *   
  * @author Michael Kolling and David J Barnes   
  * @version 1.0  
  */  
 public class ThresholdFilter extends Filter  
 {  
      /**  
       * Constructor for objects of class ThresholdFilter.  
    * @param name The name of the filter.  
       */  
      public ThresholdFilter(String name)  
   {  
     super(name);  
      }  
   /**  
    * Apply this filter to an image.  
    *   
    * @param image The image to be changed by this filter.  
    */  
   public void apply(OFImage image)  
   {  
     int height = image.getHeight();  
     int width = image.getWidth();  
     for(int y = 0; y < height; y++) {  
       for(int x = 0; x < width; x++) {  
         Color pixel = image.getPixel(x, y);  
         int brightness = (pixel.getRed() + pixel.getBlue() + pixel.getGreen()) / 3;  
         if(brightness <= 85) {  
           image.setPixel(x, y, Color.BLACK);  
         }  
         else if(brightness <= 170) {  
           image.setPixel(x, y, Color.GRAY);  
         }  
         else {  
           image.setPixel(x, y, Color.WHITE);  
         }  
       }  
     }  
   }  
 }  

SolarizeFilter :

 import java.awt.Color;  
 /**  
  * An image filter to create a solarization effect.  
  *   
  * @author Michael Kolling and David J Barnes   
  * @version 1.0  
  */  
 public class SolarizeFilter extends Filter  
 {  
   /**  
    * Constructor for objects of class Solarize.  
    * @param name The name of the filter.  
    */  
   public SolarizeFilter(String name)  
   {  
     super(name);  
   }  
   /**  
    * Apply this filter to an image.  
    *   
    * @param image The image to be changed by this filter.  
    */  
   public void apply(OFImage image)  
   {  
     int height = image.getHeight();  
     int width = image.getWidth();  
     for(int y = 0; y < height; y++) {  
       for(int x = 0; x < width; x++) {  
         Color pix = image.getPixel(x, y);  
         int red = pix.getRed();  
         if(red <= 127) {  
           red = 255 - red;  
         }  
         int green = pix.getGreen();  
         if(green <= 127) {  
           green = 255 - green;  
         }  
         int blue = pix.getBlue();  
         if(blue <= 127) {  
           blue = 255 - blue;  
         }  
         image.setPixel(x, y, new Color(red, green, blue));  
       }  
     }  
   }  
 }  

PixelizeFilter :

 import java.awt.Color;  
 /**  
  * An image filter to create a pixelization effect, like an enlarged  
  * low-resolution digital image.  
  *   
  * @author Michael Kolling and David J Barnes   
  * @version 1.0  
  */  
 public class PixelizeFilter extends Filter  
 {  
   /**  
    * Constructor for objects of class PixelizeFilter.  
    * @param name The name of the filter.  
    */  
   public PixelizeFilter(String name)  
   {  
     super(name);  
   }  
   /**  
    * Apply this filter to an image.  
    *   
    * @param image The image to be changed by this filter.  
    */  
   public void apply(OFImage image)  
   {  
     final int PIXEL_SIZE = 5;  
     int width = image.getWidth();  
     int height = image.getHeight();  
     for(int y = 0; y < height; y += PIXEL_SIZE) {  
       for(int x = 0; x < width; x += PIXEL_SIZE) {  
         Color pix = image.getPixel(x, y);  
         for(int dy = y; dy < y + PIXEL_SIZE; dy++) {  
           for(int dx = x; dx < x + PIXEL_SIZE; dx++) {  
             if( dx < width && dy < height )  
               image.setPixel(dx, dy, pix);  
           }  
         }  
       }  
     }  
   }  
 }  

SmoothFilter :

 import java.awt.Color;  
 import java.util.List;  
 import java.util.ArrayList;  
 /**  
  * An image filter to reduce sharp edges and pixelization. A bit like  
  * a soft lens.  
  *   
  * @author Michael Kolling and David J Barnes   
  * @version 1.0  
  */  
 public class SmoothFilter extends Filter  
 {  
   private OFImage original;  
   private int width;  
   private int height;  
   /**  
    * Constructor for objects of class SmoothFilter.  
    * @param name The name of the filter.  
    */  
   public SmoothFilter(String name)  
   {  
     super(name);  
   }  
   /**  
    * Apply this filter to an image.  
    *   
    * @param image The image to be changed by this filter.  
    */  
   public void apply(OFImage image)  
   {  
     original = new OFImage(image);  
     width = original.getWidth();  
     height = original.getHeight();  
     for(int y = 0; y < height; y++) {  
       for(int x = 0; x < width; x++) {  
         image.setPixel(x, y, smooth(x, y));  
       }  
     }  
   }  
   /**  
    * Return a new color that is the smoothed color of a given  
    * position. The "smoothed color" is the color value that is the  
    * average of this pixel and all the adjacent pixels.  
    * @param xpos The xposition of the pixel.  
    * @param ypos The yposition of the pixel.  
    * @return The smoothed color.  
    */  
   private Color smooth(int xpos, int ypos)  
   {  
     List<Color> pixels = new ArrayList<Color>(9);  
     for(int y = ypos - 1; y <= ypos + 1; y++) {  
       for(int x = xpos - 1; x <= xpos + 1; x++) {  
         if( x >= 0 && x < width && y >= 0 && y < height )  
           pixels.add(original.getPixel(x, y));  
       }  
     }  
     return new Color(avgRed(pixels), avgGreen(pixels), avgBlue(pixels));  
   }  
   /**  
    * @param pixels The list of pixels.  
    * @return The average of all the red values in the given list of pixels.  
    */  
   private int avgRed(List<Color> pixels)  
   {  
     int total = 0;  
     for(Color color : pixels) {  
       total += color.getRed();  
     }  
     return total / pixels.size();  
   }  
   /**  
    * @param pixels The list of pixels.  
    * @return The average of all the green values in the given list of pixels.  
    */  
   private int avgGreen(List<Color> pixels)  
   {  
     int total = 0;  
     for(Color color : pixels) {  
       total += color.getGreen();  
     }  
     return total / pixels.size();  
   }  
   /**  
    * @param pixels The list of pixels.  
    * @return The average of all the blue values in the given list of pixels.  
    */  
   private int avgBlue(List<Color> pixels)  
   {  
     int total = 0;  
     for(Color color : pixels) {  
       total += color.getBlue();  
     }  
     return total / pixels.size();  
   }  
 }  

Filter :
 /**  
  * Filter is an abstract superclass for all image filters in this  
  * application. Filters can be applied to OFImages by invoking the apply   
  * method.  
  *   
  * @author Michael Kolling and David J Barnes   
  * @version 1.0  
  */  
 public abstract class Filter  
 {  
   private String name;  
   /**  
    * Create a new filter with a given name.  
    * @param name The name of the filter.  
    */  
   public Filter(String name)  
   {  
     this.name = name;  
   }  
   /**  
    * Return the name of this filter.  
    *   
    * @return The name of this filter.  
    */  
   public String getName()  
   {  
     return name;  
   }  
   /**  
    * Apply this filter to an image.  
    *   
    * @param image The image to be changed by this filter.  
    */  
   public abstract void apply(OFImage image);  
 }  

hasil output Program :

tampilan awal :



ketika menambahkan foto :


ketika meng-klik menu rotate left :



ketika meng-klik menu rotate right :


Ketika meng-klik menu Add Text :


Anda bisa mengubah Filter gambar dengan mengklik menu Filter dan pilih sesuai selera( disini saya memilih filter Threshold) :
 






ketika memilih menu crop :



Sabtu, 01 Desember 2018

Membuat Framework PHP Menggunakan Codeigniter

Nama : Hafidz Firman Asqalany
NRP   : 05111740000195
Kelas  : PWEB-C

Kali ini saya akan menampilkan hasil Membuat Framework PHP Menggunakan Codeigniter dari tutorial petani kode 1-6 (https://petanikode.com/codeigniter-pemula/). langsung saja berikut hasilnya :

1. Tampilan awal dari source code Codeigniter


 2. Tampilan awal Versi saya



 3. Tampilan contact us

4. Tampilan about us

5 Tampilan awal web yang telah di edit


6. Tampilan ketika menambahkan product


 7. tampilan ketika klik menu list siswa(melihat hasil dari product yang telah di input). Disini juga         kita bisa menghapus atau mengedit product yang telah di input.



8. database gudanghiphop


Berikut merupakan hasil Source Code saya :

1.  welcome_message.php

 <?php  
 defined('BASEPATH') OR exit('No direct script access allowed');  
 ?><!DOCTYPE html>  
 <html lang="en">  
 <head>  
      <meta charset="utf-8">  
      <title>Welcome to CodeIgniter</title>  
      <style type="text/css">  
      ::selection { background-color: #E13300; color: white; }  
      ::-moz-selection { background-color: #E13300; color: white; }  
      body {  
           background-color: #fff;  
           margin: 40px;  
           font: 13px/20px normal Helvetica, Arial, sans-serif;  
           color: #4F5155;  
      }  
      a {  
           color: #003399;  
           background-color: transparent;  
           font-weight: normal;  
      }  
      h1 {  
           color: #444;  
           background-color: transparent;  
           border-bottom: 1px solid #D0D0D0;  
           font-size: 19px;  
           font-weight: normal;  
           margin: 0 0 14px 0;  
           padding: 14px 15px 10px 15px;  
      }  
      code {  
           font-family: Consolas, Monaco, Courier New, Courier, monospace;  
           font-size: 12px;  
           background-color: #f9f9f9;  
           border: 1px solid #D0D0D0;  
           color: #002166;  
           display: block;  
           margin: 14px 0 14px 0;  
           padding: 12px 10px 12px 10px;  
      }  
      #body {  
           margin: 0 15px 0 15px;  
      }  
      p.footer {  
           text-align: right;  
           font-size: 11px;  
           border-top: 1px solid #D0D0D0;  
           line-height: 32px;  
           padding: 0 10px 0 10px;  
           margin: 20px 0 0 0;  
      }  
      #container {  
           margin: 10px;  
           border: 1px solid #D0D0D0;  
           box-shadow: 0 0 8px #D0D0D0;  
      }  
      </style>  
 </head>  
 <body>  
 <div id="container">  
      <h1>Welcome to gudanghiphop</h1>  
      <div id="body">  
           <p>The page you are looking at is being generated dynamically by CodeIgniter.</p>  
           <p>If you would like to edit this page you'll find it located at:</p>  
           <code>application/views/welcome_message.php</code>  
           <p>The corresponding controller for this page is found at:</p>  
           <code>application/controllers/Welcome.php</code>  
           <p>If you are exploring CodeIgniter for the very first time, you should start by reading the <a href="user_guide/">User Guide</a>.</p>  
      </div>  
      <p class="footer">Page rendered in <strong>{elapsed_time}</strong> seconds. <?php echo (ENVIRONMENT === 'development') ? 'CodeIgniter Version <strong>' . CI_VERSION . '</strong>' : '' ?></p>  
 </div>  
 </body>  
 </html>  

2. about.php

 <h1>About Us</h1>  
 <p>gudanghiphop adalah oldshop fashion hip-hop masa kini dimana semua barangnya 100% original dan terpercaya.</p>  

3. contact.php

 <h1>Contact Us</h1>  
 <p>email : hafidzasqalany28@gmail.com</p>  
 <p>Line : 30059928</p>  
 <p>WA  : 085243131373</p>  
 <p>IG  : 30059928</p>  

4.config.php

 <?php  
 defined('BASEPATH') OR exit('No direct script access allowed');  
 /*  
 |--------------------------------------------------------------------------  
 | Base Site URL  
 |--------------------------------------------------------------------------  
 |  
 | URL to your CodeIgniter root. Typically this will be your base URL,  
 | WITH a trailing slash:  
 |  
 |     http://example.com/  
 |  
 | WARNING: You MUST set this value!  
 |  
 | If it is not set, then CodeIgniter will try guess the protocol and path  
 | your installation, but due to security concerns the hostname will be set  
 | to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise.  
 | The auto-detection mechanism exists only for convenience during  
 | development and MUST NOT be used in production!  
 |  
 | If you need to allow multiple domains, remember that this file is still  
 | a PHP script and you can easily do that on your own.  
 |  
 */  
 $config['base_url'] = 'http://localhost/gudanghiphop';  
 /*  
 |--------------------------------------------------------------------------  
 | Index File  
 |--------------------------------------------------------------------------  
 |  
 | Typically this will be your index.php file, unless you've renamed it to  
 | something else. If you are using mod_rewrite to remove the page set this  
 | variable so that it is blank.  
 |  
 */  
 $config['index_page'] = 'index.php';  
 /*  
 |--------------------------------------------------------------------------  
 | URI PROTOCOL  
 |--------------------------------------------------------------------------  
 |  
 | This item determines which server global should be used to retrieve the  
 | URI string. The default setting of 'REQUEST_URI' works for most servers.  
 | If your links do not seem to work, try one of the other delicious flavors:  
 |  
 | 'REQUEST_URI'  Uses $_SERVER['REQUEST_URI']  
 | 'QUERY_STRING'  Uses $_SERVER['QUERY_STRING']  
 | 'PATH_INFO'   Uses $_SERVER['PATH_INFO']  
 |  
 | WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!  
 */  
 $config['uri_protocol']     = 'REQUEST_URI';  
 /*  
 |--------------------------------------------------------------------------  
 | URL suffix  
 |--------------------------------------------------------------------------  
 |  
 | This option allows you to add a suffix to all URLs generated by CodeIgniter.  
 | For more information please see the user guide:  
 |  
 | https://codeigniter.com/user_guide/general/urls.html  
 */  
 $config['url_suffix'] = '';  
 /*  
 |--------------------------------------------------------------------------  
 | Default Language  
 |--------------------------------------------------------------------------  
 |  
 | This determines which set of language files should be used. Make sure  
 | there is an available translation if you intend to use something other  
 | than english.  
 |  
 */  
 $config['language']     = 'english';  
 /*  
 |--------------------------------------------------------------------------  
 | Default Character Set  
 |--------------------------------------------------------------------------  
 |  
 | This determines which character set is used by default in various methods  
 | that require a character set to be provided.  
 |  
 | See http://php.net/htmlspecialchars for a list of supported charsets.  
 |  
 */  
 $config['charset'] = 'UTF-8';  
 /*  
 |--------------------------------------------------------------------------  
 | Enable/Disable System Hooks  
 |--------------------------------------------------------------------------  
 |  
 | If you would like to use the 'hooks' feature you must enable it by  
 | setting this variable to TRUE (boolean). See the user guide for details.  
 |  
 */  
 $config['enable_hooks'] = FALSE;  
 /*  
 |--------------------------------------------------------------------------  
 | Class Extension Prefix  
 |--------------------------------------------------------------------------  
 |  
 | This item allows you to set the filename/classname prefix when extending  
 | native libraries. For more information please see the user guide:  
 |  
 | https://codeigniter.com/user_guide/general/core_classes.html  
 | https://codeigniter.com/user_guide/general/creating_libraries.html  
 |  
 */  
 $config['subclass_prefix'] = 'MY_';  
 /*  
 |--------------------------------------------------------------------------  
 | Composer auto-loading  
 |--------------------------------------------------------------------------  
 |  
 | Enabling this setting will tell CodeIgniter to look for a Composer  
 | package auto-loader script in application/vendor/autoload.php.  
 |  
 |     $config['composer_autoload'] = TRUE;  
 |  
 | Or if you have your vendor/ directory located somewhere else, you  
 | can opt to set a specific path as well:  
 |  
 |     $config['composer_autoload'] = '/path/to/vendor/autoload.php';  
 |  
 | For more information about Composer, please visit http://getcomposer.org/  
 |  
 | Note: This will NOT disable or override the CodeIgniter-specific  
 |     autoloading (application/config/autoload.php)  
 */  
 $config['composer_autoload'] = FALSE;  
 /*  
 |--------------------------------------------------------------------------  
 | Allowed URL Characters  
 |--------------------------------------------------------------------------  
 |  
 | This lets you specify which characters are permitted within your URLs.  
 | When someone tries to submit a URL with disallowed characters they will  
 | get a warning message.  
 |  
 | As a security measure you are STRONGLY encouraged to restrict URLs to  
 | as few characters as possible. By default only these are allowed: a-z 0-9~%.:_-  
 |  
 | Leave blank to allow all characters -- but only if you are insane.  
 |  
 | The configured value is actually a regular expression character group  
 | and it will be executed as: ! preg_match('/^[<permitted_uri_chars>]+$/i  
 |  
 | DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!  
 |  
 */  
 $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';  
 /*  
 |--------------------------------------------------------------------------  
 | Enable Query Strings  
 |--------------------------------------------------------------------------  
 |  
 | By default CodeIgniter uses search-engine friendly segment based URLs:  
 | example.com/who/what/where/  
 |  
 | You can optionally enable standard query string based URLs:  
 | example.com?who=me&what=something&where=here  
 |  
 | Options are: TRUE or FALSE (boolean)  
 |  
 | The other items let you set the query string 'words' that will  
 | invoke your controllers and its functions:  
 | example.com/index.php?c=controller&m=function  
 |  
 | Please note that some of the helpers won't work as expected when  
 | this feature is enabled, since CodeIgniter is designed primarily to  
 | use segment based URLs.  
 |  
 */  
 $config['enable_query_strings'] = FALSE;  
 $config['controller_trigger'] = 'c';  
 $config['function_trigger'] = 'm';  
 $config['directory_trigger'] = 'd';  
 /*  
 |--------------------------------------------------------------------------  
 | Allow $_GET array  
 |--------------------------------------------------------------------------  
 |  
 | By default CodeIgniter enables access to the $_GET array. If for some  
 | reason you would like to disable it, set 'allow_get_array' to FALSE.  
 |  
 | WARNING: This feature is DEPRECATED and currently available only  
 |     for backwards compatibility purposes!  
 |  
 */  
 $config['allow_get_array'] = TRUE;  
 /*  
 |--------------------------------------------------------------------------  
 | Error Logging Threshold  
 |--------------------------------------------------------------------------  
 |  
 | You can enable error logging by setting a threshold over zero. The  
 | threshold determines what gets logged. Threshold options are:  
 |  
 |     0 = Disables logging, Error logging TURNED OFF  
 |     1 = Error Messages (including PHP errors)  
 |     2 = Debug Messages  
 |     3 = Informational Messages  
 |     4 = All Messages  
 |  
 | You can also pass an array with threshold levels to show individual error types  
 |  
 |      array(2) = Debug Messages, without Error Messages  
 |  
 | For a live site you'll usually only enable Errors (1) to be logged otherwise  
 | your log files will fill up very fast.  
 |  
 */  
 $config['log_threshold'] = 0;  
 /*  
 |--------------------------------------------------------------------------  
 | Error Logging Directory Path  
 |--------------------------------------------------------------------------  
 |  
 | Leave this BLANK unless you would like to set something other than the default  
 | application/logs/ directory. Use a full server path with trailing slash.  
 |  
 */  
 $config['log_path'] = '';  
 /*  
 |--------------------------------------------------------------------------  
 | Log File Extension  
 |--------------------------------------------------------------------------  
 |  
 | The default filename extension for log files. The default 'php' allows for  
 | protecting the log files via basic scripting, when they are to be stored  
 | under a publicly accessible directory.  
 |  
 | Note: Leaving it blank will default to 'php'.  
 |  
 */  
 $config['log_file_extension'] = '';  
 /*  
 |--------------------------------------------------------------------------  
 | Log File Permissions  
 |--------------------------------------------------------------------------  
 |  
 | The file system permissions to be applied on newly created log files.  
 |  
 | IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal  
 |      integer notation (i.e. 0700, 0644, etc.)  
 */  
 $config['log_file_permissions'] = 0644;  
 /*  
 |--------------------------------------------------------------------------  
 | Date Format for Logs  
 |--------------------------------------------------------------------------  
 |  
 | Each item that is logged has an associated date. You can use PHP date  
 | codes to set your own date formatting  
 |  
 */  
 $config['log_date_format'] = 'Y-m-d H:i:s';  
 /*  
 |--------------------------------------------------------------------------  
 | Error Views Directory Path  
 |--------------------------------------------------------------------------  
 |  
 | Leave this BLANK unless you would like to set something other than the default  
 | application/views/errors/ directory. Use a full server path with trailing slash.  
 |  
 */  
 $config['error_views_path'] = '';  
 /*  
 |--------------------------------------------------------------------------  
 | Cache Directory Path  
 |--------------------------------------------------------------------------  
 |  
 | Leave this BLANK unless you would like to set something other than the default  
 | application/cache/ directory. Use a full server path with trailing slash.  
 |  
 */  
 $config['cache_path'] = '';  
 /*  
 |--------------------------------------------------------------------------  
 | Cache Include Query String  
 |--------------------------------------------------------------------------  
 |  
 | Whether to take the URL query string into consideration when generating  
 | output cache files. Valid options are:  
 |  
 |     FALSE   = Disabled  
 |     TRUE    = Enabled, take all query parameters into account.  
 |            Please be aware that this may result in numerous cache  
 |            files generated for the same page over and over again.  
 |     array('q') = Enabled, but only take into account the specified list  
 |            of query parameters.  
 |  
 */  
 $config['cache_query_string'] = FALSE;  
 /*  
 |--------------------------------------------------------------------------  
 | Encryption Key  
 |--------------------------------------------------------------------------  
 |  
 | If you use the Encryption class, you must set an encryption key.  
 | See the user guide for more info.  
 |  
 | https://codeigniter.com/user_guide/libraries/encryption.html  
 |  
 */  
 $config['encryption_key'] = '';  
 /*  
 |--------------------------------------------------------------------------  
 | Session Variables  
 |--------------------------------------------------------------------------  
 |  
 | 'sess_driver'  
 |  
 |     The storage driver to use: files, database, redis, memcached  
 |  
 | 'sess_cookie_name'  
 |  
 |     The session cookie name, must contain only [0-9a-z_-] characters  
 |  
 | 'sess_expiration'  
 |  
 |     The number of SECONDS you want the session to last.  
 |     Setting to 0 (zero) means expire when the browser is closed.  
 |  
 | 'sess_save_path'  
 |  
 |     The location to save sessions to, driver dependent.  
 |  
 |     For the 'files' driver, it's a path to a writable directory.  
 |     WARNING: Only absolute paths are supported!  
 |  
 |     For the 'database' driver, it's a table name.  
 |     Please read up the manual for the format with other session drivers.  
 |  
 |     IMPORTANT: You are REQUIRED to set a valid save path!  
 |  
 | 'sess_match_ip'  
 |  
 |     Whether to match the user's IP address when reading the session data.  
 |  
 |     WARNING: If you're using the database driver, don't forget to update  
 |          your session table's PRIMARY KEY when changing this setting.  
 |  
 | 'sess_time_to_update'  
 |  
 |     How many seconds between CI regenerating the session ID.  
 |  
 | 'sess_regenerate_destroy'  
 |  
 |     Whether to destroy session data associated with the old session ID  
 |     when auto-regenerating the session ID. When set to FALSE, the data  
 |     will be later deleted by the garbage collector.  
 |  
 | Other session cookie settings are shared with the rest of the application,  
 | except for 'cookie_prefix' and 'cookie_httponly', which are ignored here.  
 |  
 */  
 $config['sess_driver'] = 'files';  
 $config['sess_cookie_name'] = 'ci_session';  
 $config['sess_expiration'] = 7200;  
 $config['sess_save_path'] = NULL;  
 $config['sess_match_ip'] = FALSE;  
 $config['sess_time_to_update'] = 300;  
 $config['sess_regenerate_destroy'] = FALSE;  
 /*  
 |--------------------------------------------------------------------------  
 | Cookie Related Variables  
 |--------------------------------------------------------------------------  
 |  
 | 'cookie_prefix'  = Set a cookie name prefix if you need to avoid collisions  
 | 'cookie_domain'  = Set to .your-domain.com for site-wide cookies  
 | 'cookie_path'   = Typically will be a forward slash  
 | 'cookie_secure'  = Cookie will only be set if a secure HTTPS connection exists.  
 | 'cookie_httponly' = Cookie will only be accessible via HTTP(S) (no javascript)  
 |  
 | Note: These settings (with the exception of 'cookie_prefix' and  
 |    'cookie_httponly') will also affect sessions.  
 |  
 */  
 $config['cookie_prefix']     = '';  
 $config['cookie_domain']     = '';  
 $config['cookie_path']          = '/';  
 $config['cookie_secure']     = FALSE;  
 $config['cookie_httponly']      = FALSE;  
 /*  
 |--------------------------------------------------------------------------  
 | Standardize newlines  
 |--------------------------------------------------------------------------  
 |  
 | Determines whether to standardize newline characters in input data,  
 | meaning to replace \r\n, \r, \n occurrences with the PHP_EOL value.  
 |  
 | WARNING: This feature is DEPRECATED and currently available only  
 |     for backwards compatibility purposes!  
 |  
 */  
 $config['standardize_newlines'] = FALSE;  
 /*  
 |--------------------------------------------------------------------------  
 | Global XSS Filtering  
 |--------------------------------------------------------------------------  
 |  
 | Determines whether the XSS filter is always active when GET, POST or  
 | COOKIE data is encountered  
 |  
 | WARNING: This feature is DEPRECATED and currently available only  
 |     for backwards compatibility purposes!  
 |  
 */  
 $config['global_xss_filtering'] = FALSE;  
 /*  
 |--------------------------------------------------------------------------  
 | Cross Site Request Forgery  
 |--------------------------------------------------------------------------  
 | Enables a CSRF cookie token to be set. When set to TRUE, token will be  
 | checked on a submitted form. If you are accepting user data, it is strongly  
 | recommended CSRF protection be enabled.  
 |  
 | 'csrf_token_name' = The token name  
 | 'csrf_cookie_name' = The cookie name  
 | 'csrf_expire' = The number in seconds the token should expire.  
 | 'csrf_regenerate' = Regenerate token on every submission  
 | 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks  
 */  
 $config['csrf_protection'] = FALSE;  
 $config['csrf_token_name'] = 'csrf_test_name';  
 $config['csrf_cookie_name'] = 'csrf_cookie_name';  
 $config['csrf_expire'] = 7200;  
 $config['csrf_regenerate'] = TRUE;  
 $config['csrf_exclude_uris'] = array();  
 /*  
 |--------------------------------------------------------------------------  
 | Output Compression  
 |--------------------------------------------------------------------------  
 |  
 | Enables Gzip output compression for faster page loads. When enabled,  
 | the output class will test whether your server supports Gzip.  
 | Even if it does, however, not all browsers support compression  
 | so enable only if you are reasonably sure your visitors can handle it.  
 |  
 | Only used if zlib.output_compression is turned off in your php.ini.  
 | Please do not use it together with httpd-level output compression.  
 |  
 | VERY IMPORTANT: If you are getting a blank page when compression is enabled it  
 | means you are prematurely outputting something to your browser. It could  
 | even be a line of whitespace at the end of one of your scripts. For  
 | compression to work, nothing can be sent before the output buffer is called  
 | by the output class. Do not 'echo' any values with compression enabled.  
 |  
 */  
 $config['compress_output'] = FALSE;  
 /*  
 |--------------------------------------------------------------------------  
 | Master Time Reference  
 |--------------------------------------------------------------------------  
 |  
 | Options are 'local' or any PHP supported timezone. This preference tells  
 | the system whether to use your server's local time as the master 'now'  
 | reference, or convert it to the configured one timezone. See the 'date  
 | helper' page of the user guide for information regarding date handling.  
 |  
 */  
 $config['time_reference'] = 'local';  
 /*  
 |--------------------------------------------------------------------------  
 | Rewrite PHP Short Tags  
 |--------------------------------------------------------------------------  
 |  
 | If your PHP installation does not have short tag support enabled CI  
 | can rewrite the tags on-the-fly, enabling you to utilize that syntax  
 | in your view files. Options are TRUE or FALSE (boolean)  
 |  
 | Note: You need to have eval() enabled for this to work.  
 |  
 */  
 $config['rewrite_short_tags'] = FALSE;  
 /*  
 |--------------------------------------------------------------------------  
 | Reverse Proxy IPs  
 |--------------------------------------------------------------------------  
 |  
 | If your server is behind a reverse proxy, you must whitelist the proxy  
 | IP addresses from which CodeIgniter should trust headers such as  
 | HTTP_X_FORWARDED_FOR and HTTP_CLIENT_IP in order to properly identify  
 | the visitor's IP address.  
 |  
 | You can use both an array or a comma-separated list of proxy addresses,  
 | as well as specifying whole subnets. Here are a few examples:  
 |  
 | Comma-separated:     '10.0.1.200,192.168.5.0/24'  
 | Array:          array('10.0.1.200', '192.168.5.0/24')  
 */  
 $config['proxy_ips'] = '';  

5. constants.php

 <?php  
 defined('BASEPATH') OR exit('No direct script access allowed');  
 /*  
 |--------------------------------------------------------------------------  
 | Display Debug backtrace  
 |--------------------------------------------------------------------------  
 |  
 | If set to TRUE, a backtrace will be displayed along with php errors. If  
 | error_reporting is disabled, the backtrace will not display, regardless  
 | of this setting  
 |  
 */  
 defined('SHOW_DEBUG_BACKTRACE') OR define('SHOW_DEBUG_BACKTRACE', TRUE);  
 /*  
 |--------------------------------------------------------------------------  
 | File and Directory Modes  
 |--------------------------------------------------------------------------  
 |  
 | These prefs are used when checking and setting modes when working  
 | with the file system. The defaults are fine on servers with proper  
 | security, but you may wish (or even need) to change the values in  
 | certain environments (Apache running a separate process for each  
 | user, PHP under CGI with Apache suEXEC, etc.). Octal values should  
 | always be used to set the mode correctly.  
 |  
 */  
 defined('FILE_READ_MODE') OR define('FILE_READ_MODE', 0644);  
 defined('FILE_WRITE_MODE') OR define('FILE_WRITE_MODE', 0666);  
 defined('DIR_READ_MODE')  OR define('DIR_READ_MODE', 0755);  
 defined('DIR_WRITE_MODE') OR define('DIR_WRITE_MODE', 0755);  
 /*  
 |--------------------------------------------------------------------------  
 | File Stream Modes  
 |--------------------------------------------------------------------------  
 |  
 | These modes are used when working with fopen()/popen()  
 |  
 */  
 defined('FOPEN_READ')              OR define('FOPEN_READ', 'rb');  
 defined('FOPEN_READ_WRITE')           OR define('FOPEN_READ_WRITE', 'r+b');  
 defined('FOPEN_WRITE_CREATE_DESTRUCTIVE')    OR define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care  
 defined('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE') OR define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care  
 defined('FOPEN_WRITE_CREATE')          OR define('FOPEN_WRITE_CREATE', 'ab');  
 defined('FOPEN_READ_WRITE_CREATE')       OR define('FOPEN_READ_WRITE_CREATE', 'a+b');  
 defined('FOPEN_WRITE_CREATE_STRICT')      OR define('FOPEN_WRITE_CREATE_STRICT', 'xb');  
 defined('FOPEN_READ_WRITE_CREATE_STRICT')    OR define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');  
 /*  
 |--------------------------------------------------------------------------  
 | Exit Status Codes  
 |--------------------------------------------------------------------------  
 |  
 | Used to indicate the conditions under which the script is exit()ing.  
 | While there is no universal standard for error codes, there are some  
 | broad conventions. Three such conventions are mentioned below, for  
 | those who wish to make use of them. The CodeIgniter defaults were  
 | chosen for the least overlap with these conventions, while still  
 | leaving room for others to be defined in future versions and user  
 | applications.  
 |  
 | The three main conventions used for determining exit status codes  
 | are as follows:  
 |  
 |  Standard C/C++ Library (stdlibc):  
 |    http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html  
 |    (This link also contains other GNU-specific conventions)  
 |  BSD sysexits.h:  
 |    http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits  
 |  Bash scripting:  
 |    http://tldp.org/LDP/abs/html/exitcodes.html  
 |  
 */  
 defined('EXIT_SUCCESS')    OR define('EXIT_SUCCESS', 0); // no errors  
 defined('EXIT_ERROR')     OR define('EXIT_ERROR', 1); // generic error  
 defined('EXIT_CONFIG')     OR define('EXIT_CONFIG', 3); // configuration error  
 defined('EXIT_UNKNOWN_FILE')  OR define('EXIT_UNKNOWN_FILE', 4); // file not found  
 defined('EXIT_UNKNOWN_CLASS') OR define('EXIT_UNKNOWN_CLASS', 5); // unknown class  
 defined('EXIT_UNKNOWN_METHOD') OR define('EXIT_UNKNOWN_METHOD', 6); // unknown class member  
 defined('EXIT_USER_INPUT')   OR define('EXIT_USER_INPUT', 7); // invalid user input  
 defined('EXIT_DATABASE')    OR define('EXIT_DATABASE', 8); // database error  
 defined('EXIT__AUTO_MIN')   OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code  
 defined('EXIT__AUTO_MAX')   OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code  
 /*  
 |--------------------------------------------------------------------------  
 | Constants for Site  
 |--------------------------------------------------------------------------  
 |  
 */  
 define('SITE_NAME', 'gudanghiphop');  

6. overview.php

 <!DOCTYPE html>  
 <html lang="en">  
 <head>  
      <?php $this->load->view("admin/_partials/head.php") ?>  
 </head>  
 <body id="page-top">  
 <?php $this->load->view("admin/_partials/navbar.php") ?>  
 <div id="wrapper">  
      <?php $this->load->view("admin/_partials/sidebar.php") ?>  
      <div id="content-wrapper">  
           <div class="container-fluid">  
     <!--   
     karena ini halaman overview (home), kita matikan partial breadcrumb.  
     Jika anda ingin mengampilkan breadcrumb di halaman overview,  
     silahkan hilangkan komentar (//) di tag PHP di bawah.  
     -->  
           <?php //$this->load->view("admin/_partials/breadcrumb.php") ?>  
           <!-- Icon Cards-->  
           <div class="row">  
                <div class="col-xl-3 col-sm-6 mb-3">  
                <div class="card text-white bg-primary o-hidden h-100">  
                     <div class="card-body">  
                     <div class="card-body-icon">  
                          <i class="fas fa-fw fa-comments"></i>  
                     </div>  
                     <div class="mr-5">26 New Messages!</div>  
                     </div>  
                     <a class="card-footer text-white clearfix small z-1" href="#">  
                     <span class="float-left">View Details</span>  
                     <span class="float-right">  
                          <i class="fas fa-angle-right"></i>  
                     </span>  
                     </a>  
                </div>  
                </div>  
                <div class="col-xl-3 col-sm-6 mb-3">  
                <div class="card text-white bg-warning o-hidden h-100">  
                     <div class="card-body">  
                     <div class="card-body-icon">  
                          <i class="fas fa-fw fa-list"></i>  
                     </div>  
                     <div class="mr-5">11 New Tasks!</div>  
                     </div>  
                     <a class="card-footer text-white clearfix small z-1" href="#">  
                     <span class="float-left">View Details</span>  
                     <span class="float-right">  
                          <i class="fas fa-angle-right"></i>  
                     </span>  
                     </a>  
                </div>  
                </div>  
                <div class="col-xl-3 col-sm-6 mb-3">  
                <div class="card text-white bg-success o-hidden h-100">  
                     <div class="card-body">  
                     <div class="card-body-icon">  
                          <i class="fas fa-fw fa-shopping-cart"></i>  
                     </div>  
                     <div class="mr-5">123 New Orders!</div>  
                     </div>  
                     <a class="card-footer text-white clearfix small z-1" href="#">  
                     <span class="float-left">View Details</span>  
                     <span class="float-right">  
                          <i class="fas fa-angle-right"></i>  
                     </span>  
                     </a>  
                </div>  
                </div>  
                <div class="col-xl-3 col-sm-6 mb-3">  
                <div class="card text-white bg-danger o-hidden h-100">  
                     <div class="card-body">  
                     <div class="card-body-icon">  
                          <i class="fas fa-fw fa-life-ring"></i>  
                     </div>  
                     <div class="mr-5">13 New Tickets!</div>  
                     </div>  
                     <a class="card-footer text-white clearfix small z-1" href="#">  
                     <span class="float-left">View Details</span>  
                     <span class="float-right">  
                          <i class="fas fa-angle-right"></i>  
                     </span>  
                     </a>  
                </div>  
                </div>  
           </div>  
           <!-- Area Chart Example-->  
           <div class="card mb-3">  
                <div class="card-header">  
                <i class="fas fa-chart-area"></i>  
                Visitor Stats</div>  
                <div class="card-body">  
                <canvas id="myAreaChart" width="100%" height="30"></canvas>  
                </div>  
                <div class="card-footer small text-muted">Updated yesterday at 11:59 PM</div>  
           </div>  
           </div>  
           <!-- /.container-fluid -->  
           <!-- Sticky Footer -->  
           <?php $this->load->view("admin/_partials/footer.php") ?>  
      </div>  
      <!-- /.content-wrapper -->  
 </div>  
 <!-- /#wrapper -->  
 <?php $this->load->view("admin/_partials/scrolltop.php") ?>  
 <?php $this->load->view("admin/_partials/modal.php") ?>  
 <?php $this->load->view("admin/_partials/js.php") ?>  
 </body>  
 </html>  

7. Overview.php

 <?php  
 class Overview extends CI_Controller {  
   public function __construct()  
   {  
           parent::__construct();  
      }  
      public function index()  
      {  
     // load view admin/overview.php  
     $this->load->view("admin/overview");  
      }  
 }  

8. routes.php

 <?php  
 defined('BASEPATH') OR exit('No direct script access allowed');  
 /*  
 | -------------------------------------------------------------------------  
 | URI ROUTING  
 | -------------------------------------------------------------------------  
 | This file lets you re-map URI requests to specific controller functions.  
 |  
 | Typically there is a one-to-one relationship between a URL string  
 | and its corresponding controller class/method. The segments in a  
 | URL normally follow this pattern:  
 |  
 |     example.com/class/method/id/  
 |  
 | In some instances, however, you may want to remap this relationship  
 | so that a different class/function is called than the one  
 | corresponding to the URL.  
 |  
 | Please see the user guide for complete details:  
 |  
 |     https://codeigniter.com/user_guide/general/routing.html  
 |  
 | -------------------------------------------------------------------------  
 | RESERVED ROUTES  
 | -------------------------------------------------------------------------  
 |  
 | There are three reserved routes:  
 |  
 |     $route['default_controller'] = 'welcome';  
 |  
 | This route indicates which controller class should be loaded if the  
 | URI contains no data. In the above example, the "welcome" class  
 | would be loaded.  
 |  
 |     $route['404_override'] = 'errors/page_missing';  
 |  
 | This route will tell the Router which controller/method to use if those  
 | provided in the URL cannot be matched to a valid route.  
 |  
 |     $route['translate_uri_dashes'] = FALSE;  
 |  
 | This is not exactly a route, but allows you to automatically route  
 | controller and method names that contain dashes. '-' isn't a valid  
 | class or method name character, so it requires translation.  
 | When you set this option to TRUE, it will replace ALL dashes in the  
 | controller and method URI segments.  
 |  
 | Examples:     my-controller/index     -> my_controller/index  
 |          my-controller/my-method     -> my_controller/my_method  
 */  
 $route['default_controller'] = 'welcome';  
 $route['404_override'] = '';  
 $route['translate_uri_dashes'] = FALSE;  
 $route['about'] = 'welcome/about';  
 $route['contact'] = 'welcome/contact';  
 $route['admin'] = 'admin/overview';  

9. breadcrumb.php

 <!-- Breadcrumbs-->  
 <ol class="breadcrumb">  
 <?php foreach ($this->uri->segments as $segment): ?>  
      <?php   
           $url = substr($this->uri->uri_string, 0, strpos($this->uri->uri_string, $segment)) . $segment;  
           $is_active = $url == $this->uri->uri_string;  
      ?>  
      <li class="breadcrumb-item <?php echo $is_active ? 'active': '' ?>">  
           <?php if($is_active): ?>  
                <?php echo ucfirst($segment) ?>  
           <?php else: ?>  
                <a href="<?php echo site_url($url) ?>"><?php echo ucfirst($segment) ?></a>  
           <?php endif; ?>  
      </li>  
 <?php endforeach; ?>  
 </ol>  

10. footer.php

 <!-- Sticky Footer -->  
 <footer class="sticky-footer">  
  <div class="container my-auto">  
   <div class="copyright text-center my-auto">  
    <span>Copyright © <?php echo SITE_NAME ." ". Date('Y') ?></span>  
   </div>  
  </div>  
 </footer>  

11. head.php

 <head>  
 <meta charset="utf-8">  
 <meta http-equiv="X-UA-Compatible" content="IE=edge">  
 <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">  
 <title><?php echo SITE_NAME .": ". ucfirst($this->uri->segment(1)) ." - ". ucfirst($this->uri->segment(2)) ?></title>  
 <!-- Bootstrap core CSS-->  
 <link href="<?php echo base_url('assets/bootstrap/css/bootstrap.min.css') ?>" rel="stylesheet">  
 <!-- Custom fonts for this template-->  
 <link href="<?php echo base_url('assets/fontawesome-free/css/all.min.css') ?>" rel="stylesheet" type="text/css">  
 <!-- Page level plugin CSS-->  
 <link href="<?php echo base_url('assets/datatables/dataTables.bootstrap4.css') ?>" rel="stylesheet">  
 <!-- Custom styles for this template-->  
 <link href="<?php echo base_url('css/sb-admin.css') ?>" rel="stylesheet">  
 </head>  

12. js.php

 <!-- Bootstrap core JavaScript-->  
 <script src="<?php echo base_url('assets/jquery/jquery.min.js') ?>"></script>  
 <script src="<?php echo base_url('assets/bootstrap/js/bootstrap.bundle.min.js') ?>"></script>  
 <!-- Core plugin JavaScript-->  
 <script src="<?php echo base_url('assets/jquery-easing/jquery.easing.min.js') ?>"></script>  
 <!-- Page level plugin JavaScript-->  
 <script src="<?php echo base_url('assets/chart.js/Chart.min.js') ?>"></script>  
 <script src="<?php echo base_url('assets/datatables/jquery.dataTables.js') ?>"></script>  
 <script src="<?php echo base_url('assets/datatables/dataTables.bootstrap4.js') ?>"></script>  
 <!-- Custom scripts for all pages-->  
 <script src="<?php echo base_url('js/sb-admin.min.js') ?>"></script>  
 <!-- Demo scripts for this page-->  
 <script src="<?php echo base_url('js/demo/datatables-demo.js') ?>"></script>  
 <script src="<?php echo base_url('js/demo/chart-area-demo.js') ?>"></script>  

13. modal.php

 <!-- Logout Modal-->  
 <div class="modal fade" id="logoutModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">  
  <div class="modal-dialog" role="document">  
   <div class="modal-content">  
    <div class="modal-header">  
     <h5 class="modal-title" id="exampleModalLabel">Ready to Leave?</h5>  
     <button class="close" type="button" data-dismiss="modal" aria-label="Close">  
      <span aria-hidden="true">×</span>  
     </button>  
    </div>  
    <div class="modal-body">Select "Logout" below if you are ready to end your current session.</div>  
    <div class="modal-footer">  
     <button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>  
     <a class="btn btn-primary" href="login.html">Logout</a>  
    </div>  
   </div>  
  </div>  
 </div>  
 <!-- Logout Delete Confirmation-->  
 <div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">  
  <div class="modal-dialog" role="document">  
   <div class="modal-content">  
    <div class="modal-header">  
     <h5 class="modal-title" id="exampleModalLabel">Are you sure?</h5>  
     <button class="close" type="button" data-dismiss="modal" aria-label="Close">  
      <span aria-hidden="true">×</span>  
     </button>  
    </div>  
    <div class="modal-body">Data yang dihapus tidak akan bisa dikembalikan.</div>  
    <div class="modal-footer">  
     <button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button>  
     <a id="btn-delete" class="btn btn-danger" href="#">Delete</a>  
    </div>  
   </div>  
  </div>  
 </div>  

14. navbar.php

 <nav class="navbar navbar-expand navbar-dark bg-success static-top">  
   <a class="navbar-brand mr-1" href="<?php echo site_url('admin') ?>"><?php echo SITE_NAME ?></a>  
   <button class="btn btn-link btn-sm text-white order-1 order-sm-0" id="sidebarToggle" href="#">  
     <i class="fas fa-bars"></i>  
   </button>  
   <!-- Navbar Search -->  
   <form class="d-none d-md-inline-block form-inline ml-auto mr-0 mr-md-3 my-2 my-md-0">  
     <div class="input-group">  
       <input type="text" class="form-control" placeholder="Search for..." aria-label="Search" aria-describedby="basic-addon2">  
       <div class="input-group-append">  
         <button class="btn btn-light" type="button">  
           <i class="fas fa-search"></i>  
         </button>  
       </div>  
     </div>  
   </form>  
   <!-- Navbar -->  
   <ul class="navbar-nav ml-auto ml-md-0">  
     <li class="nav-item dropdown no-arrow mx-1">  
       <a class="nav-link dropdown-toggle" href="#" id="alertsDropdown" role="button" data-toggle="dropdown" aria-haspopup="true"  
         aria-expanded="false">  
         <i class="fas fa-bell fa-fw"></i>  
         <span class="badge badge-danger">9+</span>  
       </a>  
       <div class="dropdown-menu dropdown-menu-right" aria-labelledby="alertsDropdown">  
         <a class="dropdown-item" href="#">Action</a>  
         <a class="dropdown-item" href="#">Another action</a>  
         <div class="dropdown-divider"></div>  
         <a class="dropdown-item" href="#">Something else here</a>  
       </div>  
     </li>  
     <li class="nav-item dropdown no-arrow mx-1">  
       <a class="nav-link dropdown-toggle" href="#" id="messagesDropdown" role="button" data-toggle="dropdown" aria-haspopup="true"  
         aria-expanded="false">  
         <i class="fas fa-envelope fa-fw"></i>  
         <span class="badge badge-danger">7</span>  
       </a>  
       <div class="dropdown-menu dropdown-menu-right" aria-labelledby="messagesDropdown">  
         <a class="dropdown-item" href="#">Action</a>  
         <a class="dropdown-item" href="#">Another action</a>  
         <div class="dropdown-divider"></div>  
         <a class="dropdown-item" href="#">Something else here</a>  
       </div>  
     </li>  
     <li class="nav-item dropdown no-arrow">  
       <a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true"  
         aria-expanded="false">  
         <i class="fas fa-user-circle fa-fw"></i> Admin  
       </a>  
       <div class="dropdown-menu dropdown-menu-right" aria-labelledby="userDropdown">  
         <a class="dropdown-item" href="#">Settings</a>  
         <a class="dropdown-item" href="#">Activity Log</a>  
         <div class="dropdown-divider"></div>  
         <a class="dropdown-item" href="#" data-toggle="modal" data-target="#logoutModal">Logout</a>  
       </div>  
     </li>  
   </ul>  
 </nav>  

15. scrolltop.php

 <!-- Scroll to Top Button-->  
 <a class="scroll-to-top rounded" href="#page-top">  
      <i class="fas fa-angle-up"></i>  
 </a>  

16. sidebar.php

 <!-- Sidebar -->  
 <ul class="sidebar navbar-nav">  
   <li class="nav-item <?php echo $this->uri->segment(2) == 'products' ? 'active': '' ?>">  
     <a class="nav-link" href="<?php echo site_url('admin') ?>">  
       <i class="fas fa-fw fa-tachometer-alt"></i>  
       <span>Overview</span>  
     </a>  
   </li>  
   <li class="nav-item dropdown <?php echo $this->uri->segment(2) == 'products' ? 'active': '' ?>">  
     <a class="nav-link dropdown-toggle" href="#" id="pagesDropdown" role="button" data-toggle="dropdown" aria-haspopup="true"  
       aria-expanded="false">  
       <i class="fas fa-fw fa-boxes"></i>  
       <span>Products</span>  
     </a>  
     <div class="dropdown-menu" aria-labelledby="pagesDropdown">  
       <a class="dropdown-item" href="<?php echo site_url('admin/products/add') ?>">New Product</a>  
       <a class="dropdown-item" href="<?php echo site_url('admin/products') ?>">List Product</a>  
     </div>  
   </li>  
   <li class="nav-item">  
     <a class="nav-link" href="#">  
       <i class="fas fa-fw fa-users"></i>  
       <span>Users</span></a>  
   </li>  
   <li class="nav-item">  
     <a class="nav-link" href="#">  
       <i class="fas fa-fw fa-cog"></i>  
       <span>Settings</span></a>  
   </li>  
 </ul>  

17. database.php

 <?php  
 defined('BASEPATH') OR exit('No direct script access allowed');  
 /*  
 | -------------------------------------------------------------------  
 | DATABASE CONNECTIVITY SETTINGS  
 | -------------------------------------------------------------------  
 | This file will contain the settings needed to access your database.  
 |  
 | For complete instructions please consult the 'Database Connection'  
 | page of the User Guide.  
 |  
 | -------------------------------------------------------------------  
 | EXPLANATION OF VARIABLES  
 | -------------------------------------------------------------------  
 |  
 |     ['dsn']   The full DSN string describe a connection to the database.  
 |     ['hostname'] The hostname of your database server.  
 |     ['username'] The username used to connect to the database  
 |     ['password'] The password used to connect to the database  
 |     ['database'] The name of the database you want to connect to  
 |     ['dbdriver'] The database driver. e.g.: mysqli.  
 |               Currently supported:  
 |                     cubrid, ibase, mssql, mysql, mysqli, oci8,  
 |                     odbc, pdo, postgre, sqlite, sqlite3, sqlsrv  
 |     ['dbprefix'] You can add an optional prefix, which will be added  
 |                     to the table name when using the Query Builder class  
 |     ['pconnect'] TRUE/FALSE - Whether to use a persistent connection  
 |     ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.  
 |     ['cache_on'] TRUE/FALSE - Enables/disables query caching  
 |     ['cachedir'] The path to the folder where cache files should be stored  
 |     ['char_set'] The character set used in communicating with the database  
 |     ['dbcollat'] The character collation used in communicating with the database  
 |                     NOTE: For MySQL and MySQLi databases, this setting is only used  
 |                      as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7  
 |                     (and in table creation queries made with DB Forge).  
 |                      There is an incompatibility in PHP with mysql_real_escape_string() which  
 |                      can make your site vulnerable to SQL injection if you are using a  
 |                      multi-byte character set and are running versions lower than these.  
 |                      Sites using Latin-1 or UTF-8 database character set and collation are unaffected.  
 |     ['swap_pre'] A default table prefix that should be swapped with the dbprefix  
 |     ['encrypt'] Whether or not to use an encrypted connection.  
 |  
 |               'mysql' (deprecated), 'sqlsrv' and 'pdo/sqlsrv' drivers accept TRUE/FALSE  
 |               'mysqli' and 'pdo/mysql' drivers accept an array with the following options:  
 |  
 |                    'ssl_key'  - Path to the private key file  
 |                    'ssl_cert'  - Path to the public key certificate file  
 |                    'ssl_ca'   - Path to the certificate authority file  
 |                    'ssl_capath' - Path to a directory containing trusted CA certificates in PEM format  
 |                    'ssl_cipher' - List of *allowed* ciphers to be used for the encryption, separated by colons (':')  
 |                    'ssl_verify' - TRUE/FALSE; Whether verify the server certificate or not ('mysqli' only)  
 |  
 |     ['compress'] Whether or not to use client compression (MySQL only)  
 |     ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections  
 |                                   - good for ensuring strict SQL while developing  
 |     ['ssl_options']     Used to set various SSL options that can be used when making SSL connections.  
 |     ['failover'] array - A array with 0 or more data for connections if the main should fail.  
 |     ['save_queries'] TRUE/FALSE - Whether to "save" all executed queries.  
 |                     NOTE: Disabling this will also effectively disable both  
 |                     $this->db->last_query() and profiling of DB queries.  
 |                     When you run a query, with this setting set to TRUE (default),  
 |                     CodeIgniter will store the SQL statement for debugging purposes.  
 |                     However, this may cause high memory usage, especially if you run  
 |                     a lot of SQL queries ... disable this to avoid that problem.  
 |  
 | The $active_group variable lets you choose which connection group to  
 | make active. By default there is only one group (the 'default' group).  
 |  
 | The $query_builder variables lets you determine whether or not to load  
 | the query builder class.  
 */  
 $active_group = 'default';  
 $query_builder = TRUE;  
 $db['default'] = array(  
      'dsn'     => '',  
      'hostname' => 'localhost',  
      'username' => 'root',  
      'password' => '',  
      'database' => 'gudanghiphop',  
      'dbdriver' => 'mysqli',  
      'dbprefix' => '',  
      'pconnect' => FALSE,  
      'db_debug' => (ENVIRONMENT !== 'production'),  
      'cache_on' => FALSE,  
      'cachedir' => '',  
      'char_set' => 'utf8',  
      'dbcollat' => 'utf8_general_ci',  
      'swap_pre' => '',  
      'encrypt' => FALSE,  
      'compress' => FALSE,  
      'stricton' => FALSE,  
      'failover' => array(),  
      'save_queries' => TRUE  
 );  

18. Product_model.php

 <?php defined('BASEPATH') OR exit('No direct script access allowed');  
 class Product_model extends CI_Model  
 {  
   private $_table = "products";  
   public $product_id;  
   public $name;  
   public $price;  
   public $image = "default.jpg";  
   public $description;  
   public function rules()  
   {  
     return [  
       ['field' => 'name',  
       'label' => 'Name',  
       'rules' => 'required'],  
       ['field' => 'price',  
       'label' => 'Price',  
       'rules' => 'numeric'],  
       ['field' => 'description',  
       'label' => 'Description',  
       'rules' => 'required']  
     ];  
   }  
   public function getAll()  
   {  
     return $this->db->get($this->_table)->result();  
   }  
   public function getById($id)  
   {  
     return $this->db->get_where($this->_table, ["product_id" => $id])->row();  
   }  
   public function save()  
   {  
     $post = $this->input->post();  
     $this->product_id = uniqid();  
     $this->name = $post["name"];  
     $this->price = $post["price"];  
     $this->image = $this->_uploadImage();  
     $this->description = $post["description"];  
     $this->db->insert($this->_table, $this);  
   }  
   public function update()  
   {  
     $post = $this->input->post();  
     $this->product_id = $post["id"];  
     $this->name = $post["name"];  
     $this->price = $post["price"];  
     if (!empty($_FILES["image"]["name"])) {  
       $this->image = $this->_uploadImage();  
     } else {  
       $this->image = $post["old_image"];  
     }  
     $this->description = $post["description"];  
     $this->db->update($this->_table, $this, array('product_id' => $post['id']));  
   }  
   public function delete($id)  
   {  
     $this->_deleteImage($id);  
     return $this->db->delete($this->_table, array("product_id" => $id));  
   }  
   private function _uploadImage()  
 {  
   $config['upload_path']     = './upload/product/';  
   $config['allowed_types']    = 'gif|jpg|png';  
   $config['file_name']      = $this->product_id;  
   $config['overwrite']               = true;  
   $config['max_size']       = 1024; // 1MB  
   // $config['max_width']      = 1024;  
   // $config['max_height']      = 768;  
   $this->load->library('upload', $config);  
   if ($this->upload->do_upload('image')) {  
     return $this->upload->data("file_name");  
   }  
   return "default.jpg";  
 }  
 private function _deleteImage($id)  
 {  
   $product = $this->getById($id);  
   if ($product->image != "default.jpg") {  
        $filename = explode(".", $product->image)[0];  
           return array_map('unlink', glob(FCPATH."upload/product/$filename.*"));  
   }  
 }  
 }  

19. Product.php

 <?php  
 defined('BASEPATH') OR exit('No direct script access allowed');  
 class Products extends CI_Controller  
 {  
   public function __construct()  
   {  
     parent::__construct();  
     $this->load->model("product_model");  
     $this->load->library('form_validation');  
   }  
   public function index()  
   {  
     $data["products"] = $this->product_model->getAll();  
     $this->load->view("admin/product/list", $data);  
   }  
   public function add()  
   {  
     $product = $this->product_model;  
     $validation = $this->form_validation;  
     $validation->set_rules($product->rules());  
     if ($validation->run()) {  
       $product->save();  
       $this->session->set_flashdata('success', 'Berhasil disimpan');  
     }  
     $this->load->view("admin/product/new_form");  
   }  
   public function edit($id = null)  
   {  
     if (!isset($id)) redirect('admin/products');  
     $product = $this->product_model;  
     $validation = $this->form_validation;  
     $validation->set_rules($product->rules());  
     if ($validation->run()) {  
       $product->update();  
       $this->session->set_flashdata('success', 'Berhasil disimpan');  
     }  
     $data["product"] = $product->getById($id);  
     if (!$data["product"]) show_404();  
     $this->load->view("admin/product/edit_form", $data);  
   }  
   public function delete($id=null)  
   {  
     if (!isset($id)) show_404();  
     if ($this->product_model->delete($id)) {  
       redirect(site_url('admin/products'));  
     }  
   }  
 }  

20 edit-form.php

 <!DOCTYPE html>  
 <html lang="en">  
 <head>  
      <?php $this->load->view("admin/_partials/head.php") ?>  
 </head>  
 <body id="page-top">  
      <?php $this->load->view("admin/_partials/navbar.php") ?>  
      <div id="wrapper">  
           <?php $this->load->view("admin/_partials/sidebar.php") ?>  
           <div id="content-wrapper">  
                <div class="container-fluid">  
                     <?php $this->load->view("admin/_partials/breadcrumb.php") ?>  
                     <?php if ($this->session->flashdata('success')): ?>  
                     <div class="alert alert-success" role="alert">  
                          <?php echo $this->session->flashdata('success'); ?>  
                     </div>  
                     <?php endif; ?>  
                     <!-- Card -->  
                     <div class="card mb-3">  
                          <div class="card-header">  
                               <a href="<?php echo site_url('admin/products/') ?>"><i class="fas fa-arrow-left"></i>  
                                    Back</a>  
                          </div>  
                          <div class="card-body">  
                               <form action="<?php base_url('admin/product/edit') ?>" method="post" enctype="multipart/form-data">  
                                    <input type="hidden" name="id" value="<?php echo $product->product_id?>" />  
                                    <div class="form-group">  
                                         <label for="name">Name*</label>  
                                         <input class="form-control <?php echo form_error('name') ? 'is-invalid':'' ?>"  
                                          type="text" name="name" placeholder="Product name" value="<?php echo $product->name ?>" />  
                                         <div class="invalid-feedback">  
                                              <?php echo form_error('name') ?>  
                                         </div>  
                                    </div>  
                                    <div class="form-group">  
                                         <label for="price">Price</label>  
                                         <input class="form-control <?php echo form_error('price') ? 'is-invalid':'' ?>"  
                                          type="number" name="price" min="0" placeholder="Product price" value="<?php echo $product->price ?>" />  
                                         <div class="invalid-feedback">  
                                              <?php echo form_error('price') ?>  
                                         </div>  
                                    </div>  
                                    <div class="form-group">  
                                         <label for="name">Photo</label>  
                                         <input class="form-control-file <?php echo form_error('image') ? 'is-invalid':'' ?>"  
                                          type="file" name="image" />  
                                         <input type="hidden" name="old_image" value="<?php echo $product->image ?>" />  
                                         <div class="invalid-feedback">  
                                              <?php echo form_error('image') ?>  
                                         </div>  
                                    </div>  
                                    <div class="form-group">  
                                         <label for="name">Description*</label>  
                                         <textarea class="form-control <?php echo form_error('description') ? 'is-invalid':'' ?>"  
                                          name="description" placeholder="Product description..."><?php echo $product->description ?></textarea>  
                                         <div class="invalid-feedback">  
                                              <?php echo form_error('description') ?>  
                                         </div>  
                                    </div>  
                                    <input class="btn btn-success" type="submit" name="btn" value="Save" />  
                               </form>  
                          </div>  
                          <div class="card-footer small text-muted">  
                               * required fields  
                          </div>  
                     </div>  
                     <!-- /.container-fluid -->  
                     <!-- Sticky Footer -->  
                     <?php $this->load->view("admin/_partials/footer.php") ?>  
                </div>  
                <!-- /.content-wrapper -->  
           </div>  
           <!-- /#wrapper -->  
           <?php $this->load->view("admin/_partials/scrolltop.php") ?>  
           <?php $this->load->view("admin/_partials/js.php") ?>  
 </body>  
 </html>  

21. list.php

 <!DOCTYPE html>  
 <html lang="en">  
 <head>  
      <?php $this->load->view("admin/_partials/head.php") ?>  
 </head>  
 <body id="page-top">  
      <?php $this->load->view("admin/_partials/navbar.php") ?>  
      <div id="wrapper">  
           <?php $this->load->view("admin/_partials/sidebar.php") ?>  
           <div id="content-wrapper">  
                <div class="container-fluid">  
                     <?php $this->load->view("admin/_partials/breadcrumb.php") ?>  
                     <!-- DataTables -->  
                     <div class="card mb-3">  
                          <div class="card-header">  
                               <a href="<?php echo site_url('admin/products/add') ?>"><i class="fas fa-plus"></i> Add New</a>  
                          </div>  
                          <div class="card-body">  
                               <div class="table-responsive">  
                                    <table class="table table-hover" id="dataTable" width="100%" cellspacing="0">  
                                         <thead>  
                                              <tr>  
                                                   <th>Name</th>  
                                                   <th>Price</th>  
                                                   <th>Photo</th>  
                                                   <th>Description</th>  
                                                   <th>Action</th>  
                                              </tr>  
                                         </thead>  
                                         <tbody>  
                                              <?php foreach ($products as $product): ?>  
                                              <tr>  
                                                   <td width="150">  
                                                        <?php echo $product->name ?>  
                                                   </td>  
                                                   <td>  
                                                        <?php echo $product->price ?>  
                                                   </td>  
                                                   <td>  
                                                        <img src="<?php echo base_url('upload/product/'.$product->image) ?>" width="64" />  
                                                   </td>  
                                                   <td class="small">  
                                                        <?php echo substr($product->description, 0, 120) ?>...</td>  
                                                   <td width="250">  
                                                        <a href="<?php echo site_url('admin/products/edit/'.$product->product_id) ?>"  
                                                         class="btn btn-small"><i class="fas fa-edit"></i> Edit</a>  
                                                        <a onclick="deleteConfirm('<?php echo site_url('admin/products/delete/'.$product->product_id) ?>')"  
                                                         href="#!" class="btn btn-small text-danger"><i class="fas fa-trash"></i> Hapus</a>  
                                                   </td>  
                                              </tr>  
                                              <?php endforeach; ?>  
                                         </tbody>  
                                    </table>  
                               </div>  
                          </div>  
                     </div>  
                </div>  
                <!-- /.container-fluid -->  
                <!-- Sticky Footer -->  
                <?php $this->load->view("admin/_partials/footer.php") ?>  
           </div>  
           <!-- /.content-wrapper -->  
      </div>  
      <!-- /#wrapper -->  
      <?php $this->load->view("admin/_partials/scrolltop.php") ?>  
      <?php $this->load->view("admin/_partials/modal.php") ?>  
      <?php $this->load->view("admin/_partials/js.php") ?>  
 <script>  
 function deleteConfirm(url){  
      $('#btn-delete').attr('href', url);  
      $('#deleteModal').modal();  
 }  
 </script>  
 </body>  
 </html>  

22. new_form.php

 <!DOCTYPE html>  
 <html lang="en">  
 <head>  
      <?php $this->load->view("admin/_partials/head.php") ?>  
 </head>  
 <body id="page-top">  
      <?php $this->load->view("admin/_partials/navbar.php") ?>  
      <div id="wrapper">  
           <?php $this->load->view("admin/_partials/sidebar.php") ?>  
           <div id="content-wrapper">  
                <div class="container-fluid">  
                     <?php $this->load->view("admin/_partials/breadcrumb.php") ?>  
                     <?php if ($this->session->flashdata('success')): ?>  
                     <div class="alert alert-success" role="alert">  
                          <?php echo $this->session->flashdata('success'); ?>  
                     </div>  
                     <?php endif; ?>  
                     <div class="card mb-3">  
                          <div class="card-header">  
                               <a href="<?php echo site_url('admin/products/') ?>"><i class="fas fa-arrow-left"></i> Back</a>  
                          </div>  
                          <div class="card-body">  
                               <form action="<?php base_url('admin/product/add') ?>" method="post" enctype="multipart/form-data" >  
                                    <div class="form-group">  
                                         <label for="name">Name*</label>  
                                         <input class="form-control <?php echo form_error('name') ? 'is-invalid':'' ?>"  
                                          type="text" name="name" placeholder="Product name" />  
                                         <div class="invalid-feedback">  
                                              <?php echo form_error('name') ?>  
                                         </div>  
                                    </div>  
                                    <div class="form-group">  
                                         <label for="price">Price*</label>  
                                         <input class="form-control <?php echo form_error('price') ? 'is-invalid':'' ?>"  
                                          type="number" name="price" min="0" placeholder="Product price" />  
                                         <div class="invalid-feedback">  
                                              <?php echo form_error('price') ?>  
                                         </div>  
                                    </div>  
                                    <div class="form-group">  
                                         <label for="name">Photo</label>  
                                         <input class="form-control-file <?php echo form_error('price') ? 'is-invalid':'' ?>"  
                                          type="file" name="image" />  
                                         <div class="invalid-feedback">  
                                              <?php echo form_error('image') ?>  
                                         </div>  
                                    </div>  
                                    <div class="form-group">  
                                         <label for="name">Description*</label>  
                                         <textarea class="form-control <?php echo form_error('description') ? 'is-invalid':'' ?>"  
                                          name="description" placeholder="Product description..."></textarea>  
                                         <div class="invalid-feedback">  
                                              <?php echo form_error('description') ?>  
                                         </div>  
                                    </div>  
                                    <input class="btn btn-success" type="submit" name="btn" value="Save" />  
                               </form>  
                          </div>  
                          <div class="card-footer small text-muted">  
                               * required fields  
                          </div>  
                     </div>  
                     <!-- /.container-fluid -->  
                     <!-- Sticky Footer -->  
                     <?php $this->load->view("admin/_partials/footer.php") ?>  
                </div>  
                <!-- /.content-wrapper -->  
           </div>  
           <!-- /#wrapper -->  
           <?php $this->load->view("admin/_partials/scrolltop.php") ?>  
           <?php $this->load->view("admin/_partials/js.php") ?>  
 </body>  
 </html>