Beispiel #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);
     }
 }
Beispiel #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 "";
     }
 }
Beispiel #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);
     }
 }
        <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");
Beispiel #5
0
<?php

defined('BASEPATH') or exit('No direct script access allowed');
?>

<?php 
$form = Tb::form(['type' => Tb::FORM_TYPE_HORIZONTAL, 'id' => 'form', 'leftRow' => 3, 'rightRow' => 9]);
echo $form->textField('id', '', ['type' => 'hidden']);
echo $form->textFieldRow('client_name', 'Company Name', ['placeholder' => 'Enter company name']);
echo $form->textFieldRow('partner', 'Partner', ['placeholder' => 'Enter patner']);
echo $form->textFieldRow('contact_name1', 'Contact Name 1', ['placeholder' => 'Enter contact Name 1']);
echo $form->textFieldRow('contact_number1', 'Contact Number 1', ['placeholder' => 'Enter contact Number 1']);
echo $form->textFieldRow('contact_name2', 'Contact Name 2', ['placeholder' => 'Enter contact Name 2']);
echo $form->textFieldRow('contact_number2', 'Contact Number 2', ['placeholder' => 'Enter contact Number 2']);
echo $form->textFieldRow('business_sector', 'Business Sector', ['placeholder' => 'Enter Business Sector']);
$form->end();
?>
        
    
Beispiel #6
0
    <script type="text/javascript" src="<?php 
echo base_url() . 'ajax/general.js';
?>
"></script>
    
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
    <script type="text/javascript" src="<?php 
echo base_url() . 'ajax/general.js';
?>
"></script>
    <?php 
echo Tb::modal(array('id' => 'modal_confirm', 'header' => 'Delete', 'body' => '<strong>Apakah Anda yakin ingin memghapus message ini?</strong>', 'footer' => array(Tb::button('Ya', array('onclick' => "deleted('delete')", 'color' => Tb::BUTTON_COLOR_WARNING)), TB::button('Tidak', array('data-dismiss' => 'modal')))));
?>
    <?php 
echo Tb::modal(array('id' => 'modal_read', 'header' => 'Detail Message', 'body' => $this->load->view('admin/inbox/detail_message', array(), true)));
?>
</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");
?>
            <!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
            <?php 
Beispiel #7
0
					$( '[name="tax_number"]' ).val ( obj[ 'tax_number' ] );
					$( '[name="business_sector"]' ).val ( obj[ 'business_sector' ] );
					$( '#modal_client' ).modal ( 'show' );
				}
			} );
		}
		function save() {
			$.ajax ( {
				url: "<?php 
echo site_url('admin/clients/ajax_save');
?>
",
				type: "POST",
				data: $( '#form' ).serialize (),
				success: function (data) {
					$( '#modal_client' ).modal ( 'hide' );
					reload_table();
				},
				error: function (jqXHR, textStatus, errorThrown) {
					alert( 'Error adding / update data' );
				}
			} );
		}
		function reload_table() {
			table.ajax.reload ( null, false );
		}

	</script>
<?php 
echo Tb::modal(['id' => 'modal_client', 'header' => '', 'body' => $this->load->view('admin/clients/edit', [], TRUE), 'footer' => modal_footer('save()')]);
    <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 -->
Beispiel #9
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']]));
 }
Beispiel #10
0
<?php

defined('BASEPATH') or exit('No direct script access allowed');
?>

<?php 
$form = Tb::form(['type' => Tb::FORM_TYPE_HORIZONTAL, 'id' => 'form_acc_type']);
echo $form->textField('id', '', ['type' => 'hidden']);
echo $form->textFieldRow('name', 'Description', ['placeholder' => 'Enter Description']);
echo $form->textFieldRow('note', 'Normal Balance', ['placeholder' => 'Enter Normal Balance']);
$form->end();
?>
        
    
Beispiel #11
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 "";
     }
 }
Beispiel #12
0
					$( '[name="name"]' ).val( obj[ 'name' ] );
					$( '[name="title"]' ).val( obj[ 'title' ] );
					$( '#modal_client' ).modal( 'show' );
				}
			} );
		}

		function delete_agenda(id) {
			var url = "<?php 
echo site_url('admin/agenda/delete_agenda');
?>
";
			delete_by_id( id, url, tb_agenda );
		}

		function delete_client(id) {
			var url = "<?php 
echo site_url('admin/agenda/delete_client');
?>
";
			delete_by_id( id, url, tb_client );
		}

	</script>
<?php 
echo Tb::modal(['id' => 'modal_agenda', 'header' => '', 'body' => $this->load->view('admin/agenda/agenda', [], TRUE), 'footer' => modal_footer('save_agenda()', 'form_agenda')]);
?>

<?php 
echo Tb::modal(['id' => 'modal_client', 'header' => '', 'body' => $this->load->view('admin/agenda/client', [], TRUE), 'footer' => modal_footer('save_client()', 'form_client')]);
Beispiel #13
0
					$( '#modal_acc_type' ).modal( 'show' );
				}
			} );
		}

		function save_acc_type() {
			$.ajax( {
				url: "<?php 
echo site_url('admin/accounts/ajax_save_acc_type');
?>
",
				type: "POST",
				data: $( '#form_acc_type' ).serialize(),
				success: function (data) {
					$( '#modal_acc_type' ).modal( 'hide' );
					reload_table();
				},
				error: function (jqXHR, textStatus, errorThrown) {
					alert( 'Error adding / update data' );
				}
			} );
		}

		function reload_table() {
			table.ajax.reload( null, false );
		}

	</script>
<?php 
echo Tb::modal(['id' => 'modal_acc_type', 'header' => '', 'body' => $this->load->view('admin/accounts/account_type', [], TRUE), 'footer' => [Tb::buttonGroup(['item' => ['label' => 'Submit', 'icon' => Tb::ICON_FLOPPY_SAVE, 'type' => Tb::BUTTON_TYPE_SUBMIT, 'onclick' => 'save_acc_type()', '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']])]]);
Beispiel #14
0
<?php

defined('BASEPATH') or exit('No direct script access allowed');
?>

<?php 
$form = Tb::form(['type' => Tb::FORM_TYPE_HORIZONTAL, 'id' => 'form_acc_type']);
echo $form->textField('id', '', ['type' => 'hidden']);
echo $form->textFieldRow('name', 'Description', ['placeholder' => 'Enter Description']);
echo $form->textFieldRow('note', 'Normal Balance', ['placeholder' => 'Enter Normal Balance']);
echo $form->formControlGroup('', Tb::buttonGroup(['item' => ['label' => 'Submit', 'icon' => Tb::ICON_FLOPPY_SAVE, 'type' => Tb::BUTTON_TYPE_SUBMIT, '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'], ['label' => 'Cancel', 'icon' => Tb::ICON_BACKWARD, 'type' => Tb::BUTTON_TYPE_LINK, 'url' => '#', 'class' => 'btn-flat']]));
$form->end();
?>
        
    
Beispiel #15
0
<!-- FORM -->
<?php 
$form = Tb::form(array('type' => Tb::FORM_TYPE_HORIZONTAL, 'leftRow' => 3, 'rightRow' => 9, 'id' => 'form_read', 'name' => 'form_read'));
//echo $form->textField('id', '', array('type' => 'hidden')); // HIDDEN FIELD
echo $form->label('From') . "<br>";
echo $form->label('Email') . "<br>";
echo $form->label('Subject') . "<br>";
echo $form->label('Message') . "<br>";
echo $form->label('IP Address') . "<br>";
echo $form->label('Created Time') . "<br>";
$form->end();
Beispiel #16
0
					$( '[name="note5"]' ).val( obj[ 'note5' ] );
					$( '#modal_price_cat' ).modal( 'show' );
				}
			} );
		}
		function save_price_cat() {
			$.ajax( {
				url: "<?php 
echo site_url('admin/prices/upsert_price_cat');
?>
",
				type: "POST",
				data: $( '#form_price_cat' ).serialize(),
				success: function (data) {
					$( '#modal_price_cat' ).modal( 'hide' );
					reload_table( tb_price_cat );
				},
				error: function (jqXHR, textStatus, errorThrown) {
					alert( 'Error adding / update data' );
				}
			} );
		}

	</script>
<?php 
echo Tb::modal(['id' => 'modal_price_cat', 'header' => '', 'body' => $this->load->view('admin/prices/price_category', [], TRUE), 'footer' => modal_footer('save_price_cat()', 'form_price_cat')]);
?>

<?php 
echo Tb::modal(['id' => 'modal_price', 'header' => '', 'body' => $this->load->view('admin/prices/price', [], TRUE), 'footer' => modal_footer('save_price()', 'form_price')]);