Exemplo n.º 1
0
 function ajax_()
 {
     if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) {
         $types = array("article", "news", "video");
         $i = 0;
         $json_data = '{"data" : [ ';
         foreach ($types as $type) {
             $result = $this->comment_model->get_list_comment($type);
             foreach ($result as $data) {
                 $ban_id = $data->id . "-" . $type;
                 $ban = Tb::button('Ban', array('type' => Tb::BUTTON_TYPE_LINK, 'onclick' => "setId('" . $ban_id . "')", 'size' => Tb::BUTTON_SIZE_SMALL, 'color' => Tb::BUTTON_COLOR_DANGER, 'url' => '#modal_confirm', 'data-toggle' => 'modal'));
                 $temp = (object) array_merge((array) $data, array("no" => $i + 1, "type" => $type, "action" => $ban));
                 if ($i != 0) {
                     $json_data .= ',';
                 }
                 $json_data .= json_encode($temp);
                 $i++;
             }
         }
         $json_data .= ']}';
         echo $json_data;
     } else {
         $data = array("status" => false, "error_message" => "Ajax request isn't required!");
         echo json_encode($data);
     }
 }
Exemplo n.º 2
0
 function get_list_article($start, $limit, $keyword = '')
 {
     $result = $this->article_model->get_article_list(0, $start, $limit, $keyword);
     $data_array = "";
     $i = 1;
     $number = 0;
     if ($result) {
         $session_data = $this->session->userdata('logged_in');
         foreach ($result as $row) {
             $number = $start + $i;
             $id = $row->article_id;
             $button[0] = Tb::button('Detail', array('type' => Tb::BUTTON_TYPE_LINK, 'url' => base_url() . "admin/article/detail/" . $id, 'size' => Tb::BUTTON_SIZE_SMALL, 'color' => Tb::BUTTON_COLOR_PRIMARY));
             if ($session_data['role'] == 'superadmin' || $session_data['id'] == $row->user_id) {
                 $button[1] = Tb::button('Edit', array('type' => Tb::BUTTON_TYPE_LINK, 'url' => base_url() . "admin/article/update/" . $id, 'size' => Tb::BUTTON_SIZE_SMALL, 'color' => Tb::BUTTON_COLOR_SUCCESS));
                 $button[2] = Tb::button('Delete', array('type' => Tb::BUTTON_TYPE_LINK, 'onclick' => "setId(" . $id . ")", 'size' => Tb::BUTTON_SIZE_SMALL, 'color' => Tb::BUTTON_COLOR_DANGER, 'url' => '#modal_confirm', 'data-toggle' => 'modal'));
             }
             if ($session_data['role'] == 'superadmin') {
                 $button[3] = Tb::button('Approve', array('type' => Tb::BUTTON_TYPE_LINK, 'onclick' => "setId(" . $id . ")", 'size' => Tb::BUTTON_SIZE_SMALL, 'color' => Tb::BUTTON_COLOR_WARNING, 'url' => '#modal_approve', 'data-toggle' => 'modal'));
             }
             $d1 = explode(" ", $row->created_date);
             $d2 = explode("-", $d1[0]);
             $url = $row->status == 'published' ? "<a target='_blank' href='" . base_url("article/read/" . $d2[0] . "/" . $d2[1] . "/" . $d2[2] . "/" . $id . "/" . $this->utils->slug($row->title_article)) . "'>View</a>" : "";
             $btn = implode("&nbsp;", $button);
             $data_array .= "<tr><td>" . $number . "</td>";
             $data_array .= "<td>" . $row->title_category . "</td>";
             $data_array .= "<td>" . $row->title_article . "</td>";
             $data_array .= "<td>" . $row->status . "</td>";
             $data_array .= "<td>" . $url . "</td>";
             $data_array .= "<td>" . $btn . "</td></tr>";
             $button[1] = "";
             $button[2] = "";
             $button[3] = "";
             $i++;
         }
         return $data_array . "</tr>";
     } else {
         return "";
     }
 }
Exemplo n.º 3
0
 function get_list_message()
 {
     if (AJAX_REQUEST) {
         $i = 0;
         $json_data = '{"data" : [ ';
         $result = $this->contact_model->get_all_message();
         foreach ($result as $data) {
             $id = $data->contact_id;
             $read = Tb::button('Detail', array('type' => Tb::BUTTON_TYPE_LINK, 'onclick' => "detailMessage(" . $data->from_name . "," . $data->subject . "," . $data->created_time . ")", 'size' => Tb::BUTTON_SIZE_SMALL, 'color' => Tb::BUTTON_COLOR_PRIMARY, 'url' => '#modal_read', 'data-toggle' => 'modal'));
             $delete = Tb::button('Delete', array('type' => Tb::BUTTON_TYPE_LINK, 'onclick' => "setId(" . $id . ")", 'size' => Tb::BUTTON_SIZE_SMALL, 'color' => Tb::BUTTON_COLOR_DANGER, 'url' => '#modal_confirm', 'data-toggle' => 'modal'));
             $temp = (object) array_merge((array) $data, array("no" => $i + 1, "action" => $read . " " . $delete));
             if ($i != 0) {
                 $json_data .= ',';
             }
             $json_data .= json_encode($temp);
             $i++;
         }
         $json_data .= ']}';
         echo $json_data;
     } else {
         $data = array("status" => false, "error_message" => "Ajax request isn't required!");
         echo json_encode($data);
     }
 }
Exemplo n.º 4
0
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
     <!-- jQuery -->
    <script src="<?php 
echo base_url();
?>
assets/js/jquery.js"></script>
   
    <!-- Bootstrap Core JavaScript -->
    <script src="<?php 
echo base_url();
?>
assets/js/bootstrap.min.js"></script>
    <?php 
echo Tb::modal(array('id' => 'modal_confirm', 'header' => 'Delete', 'body' => '<strong>Apakah Anda yakin ingin menghapus user ini?</strong>', 'footer' => array(Tb::button('Ya', array('onclick' => "deleted('user')", 'color' => Tb::BUTTON_COLOR_WARNING)), TB::button('Tidak', array('data-dismiss' => 'modal')))));
?>
    <script type="text/javascript" src="<?php 
echo base_url() . 'ajax/general.js';
?>
"></script>
</head>

<body>
    <div id="wrapper">

        <!-- Navigation -->
        <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
            <!-- Brand and toggle get grouped for better mobile display -->
            <?php 
$this->load->view("admin/templates/header");
Exemplo n.º 5
0
    <link href="<?php 
echo base_url();
?>
assets/css/font-awesome.css" rel="stylesheet" type="text/css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
   <?php 
echo Tb::modal(array('id' => 'modal_confirm', 'header' => 'Delete', 'body' => '<strong>Apakah Anda yakin ingin menghapus video ini?</strong>', 'footer' => array(Tb::button('Ya', array('onclick' => "deleted('video')", 'color' => Tb::BUTTON_COLOR_WARNING)), TB::button('Tidak', array('data-dismiss' => 'modal')))));
?>
    <?php 
echo Tb::modal(array('id' => 'modal_approve', 'header' => 'Approve', 'body' => '<strong>Apakah Anda yakin ingin meng-approve video ini?</strong>', 'footer' => array(Tb::button('Ya', array('onclick' => "approve('video')", 'color' => Tb::BUTTON_COLOR_WARNING)), TB::button('Tidak', array('data-dismiss' => 'modal')))));
?>
    <script type="text/javascript" src="<?php 
echo base_url() . 'ajax/general.js';
?>
"></script>

</head>

<body>

    <div id="wrapper">

        <!-- Navigation -->
        <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
            <!-- Brand and toggle get grouped for better mobile display -->
Exemplo n.º 6
0
 function modal_footer($save_act, $form)
 {
     return Tb::panelControlGroup(Tb::button('Cancel', ['icon' => Tb::ICON_BACKWARD, 'type' => Tb::BUTTON_TYPE_HTML, 'url' => '#', 'class' => 'btn-flat', 'data-dismiss' => 'modal']), Tb::buttonGroup(['item' => ['label' => 'Save', 'icon' => Tb::ICON_FLOPPY_SAVE, 'type' => Tb::BUTTON_TYPE_SUBMIT, 'onclick' => $save_act, 'form' => $form, 'color' => Tb::BUTTON_COLOR_PRIMARY, 'class' => 'btn-flat'], ['label' => 'Reset', 'icon' => Tb::ICON_REFRESH, 'type' => Tb::BUTTON_TYPE_RESET, 'color' => Tb::BUTTON_COLOR_WARNING, 'class' => 'btn-flat']]));
 }
Exemplo n.º 7
0
 function get_user_list($start, $limit)
 {
     $result = $this->user_model->get_user_list($start, $limit);
     $data_array = "";
     $i = 1;
     $number = 0;
     if ($result) {
         foreach ($result as $row) {
             $number = $start + $i;
             $id = $row->user_id;
             $detail = Tb::button('Detail', array('type' => Tb::BUTTON_TYPE_LINK, 'url' => base_url() . "admin/user/detail/" . $id, 'size' => Tb::BUTTON_SIZE_SMALL, 'color' => Tb::BUTTON_COLOR_PRIMARY));
             $edit = Tb::button('Edit', array('type' => Tb::BUTTON_TYPE_LINK, 'url' => base_url() . "admin/user/update/" . $id, 'size' => Tb::BUTTON_SIZE_SMALL, 'color' => Tb::BUTTON_COLOR_SUCCESS));
             $delete = Tb::button('Delete', array('type' => Tb::BUTTON_TYPE_LINK, 'onclick' => "setId(" . $id . ")", 'size' => Tb::BUTTON_SIZE_SMALL, 'color' => Tb::BUTTON_COLOR_DANGER, 'url' => '#modal_confirm', 'data-toggle' => 'modal'));
             $data_array .= "<tr><td>" . $number . "</td>";
             $data_array .= "<td>" . $row->nama_lengkap . "</td>";
             $data_array .= "<td>" . $row->user_name . "</td>";
             $data_array .= "<td>" . $row->user_role . "</td>";
             $data_array .= "<td>" . $row->position . "</td>";
             $data_array .= "<td>" . $row->created_date . "</td>";
             $data_array .= "<td>" . $detail . "&nbsp;" . $edit . "&nbsp;" . $delete . "</td></tr>";
             $i++;
         }
         return $data_array . "</tr>";
     } else {
         return "";
     }
 }