WordPress and Ajax - reload shortcode content - php

In a custom plugin, I generate a demoConnectors shortcode and initialize its content. This one contains PHP variables in input of type select. The user must therefore select the parameters and the PHP variables are updated via ajax. Depending on the selected parameters, the content of the shortcode is modified.
The problem is that I don't know how to update the shortcode content after the Ajax is triggered.
Here is my PHP code:
<?php
/**
* Plugin Name: demoConnecteurs
* Description: Plugin de démo des connecteurs Jenkins et Mantis
**/
require_once(file_with_external_fonctions.php);
$inst_demoConnecteurs = new demoConnecteurs();
if (isset($inst_demoConnecteurs)){
}
class demoConnecteurs{
private $projects;
private $versions;
private $project_id;
private $project_name;
private $version_id;
function __construct(){
$this->setProjects();
$this->initAjaxActions();
add_action('admin_enqueue_scripts', array($this,'demo_scripts'));
add_action('wp_enqueue_scripts', array($this,'demo_scripts'));
$this->init();
}
function initAjaxActions(){
add_action('wp_ajax_setProjectChosen', array($this,'setProjectChosen'));
add_action('wp_ajax_nopriv_setProjectChosen', array($this,'setProjectChosen'));
}
function demo_scripts(){
wp_register_script( 'ajaxHandle', plugins_url() . '/DemoConnecteurs/buttons_ajax.js');
wp_localize_script( 'ajaxHandle', 'ajax_object', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
wp_enqueue_script( 'ajaxHandle');
}
function init(){
add_shortcode( 'demoConnecteurs', array($this,'demoConnecteurs_shortcode') );
}
function demoConnecteurs_shortcode () {
return $this->contentDemoConnecteurs();
}
public function setProjects(){
$this->projects = getProjects();
}
public function setProjectChosen(){
if (isset ($_POST['demo_projet_name']))$this->project_name = $_POST['demo_projet_name'];
$this->project_id = getProjectIdFromName($this->mantisClient, $_SESSION['username'], $_SESSION['password'], $this->project_name);
$this->setVersions();
echo $this->contentDemoConnecteurs();
wp_die();
}
public function setVersions(){
$this->versions = getVersionsOfProjectChosen($this->project_id);
}
function contentDemoConnecteurs(){
$html = "";
$html .= 'Choix du projet : ';
$html .= '<select id="projectChosen" name="project">';
foreach($this->projects as $p) {
$selected = ($p->id == $this->project_id) ? 'selected="selected"' : '';
$html .= '<option value="' . $p->name .'" '. $selected . ' >' . $p->name . '</option>';
}
$html .= '</select><br>';
$html .= 'Choix de la version : ';
if (isset ($this->versions)){
$html .= '<select id="versionChosen" name="version">';
foreach($this->versions as $v) {
$selected = ($v->id == $this->version_id) ? 'selected="selected"' : '';
$html .= '<option value="' . $v->id .'" '. $selected . ' >' . $v->id . '</option>';
}
$html .= '</select>';
}
return $html;
}
}
And here my jQuery code:
jQuery(document).ready(function($) {
$('#projectChosen').on('change', function () {
jQuery.ajax({
type: "POST",
url: ajax_object.ajaxurl,
data: {
'action': 'setProjectChosen',
'demo_projet_name': $('#projectChosen option:selected').val()
},
success: function (output) {
//how can I update the content of my shortcode with my variable output
},
error: function(errorThrown){
console.log(errorThrown);
}
});
} );
} );
EDITS
I'm trying to use the filter do_shortcode_tag to update the content of the shortcode, I don't manage to make this work.. It just does not update the content
public function setProjectChosen(){
if (isset ($_POST['demo_projet_name']))$this->project_name = $_POST['demo_projet_name'];
$this->project_id = getProjectIdFromName($this->mantisClient, $_SESSION['username'], $_SESSION['password'], $this->project_name);
$this->setVersions();
apply_filters( 'do_shortcode_tag', array($this, 'contentDemoConnecteurs'), 'demoConnecteurs',10,3 );
wp_die();
}

I would wirte a comment, but my current reputation only lets me to write an answer. Here id my solution to reprint the content of the AJAX output.
On PHP, add a container div with ID:
function contentDemoConnecteurs(){
$html = '<div id="projectSelector">';
$html .= 'Choix du projet : ';
$html .= '<select id="projectChosen" name="project">';
foreach($this->projects as $p) {
$selected = ($p->id == $this->project_id) ? 'selected="selected"' : '';
$html .= '<option value="' . $p->name .'" '. $selected . ' >' . $p->name . '</option>';
}
$html .= '</select><br>';
$html .= 'Choix de la version : ';
if (isset ($this->versions)){
$html .= '<select id="versionChosen" name="version">';
foreach($this->versions as $v) {
$selected = ($v->id == $this->version_id) ? 'selected="selected"' : '';
$html .= '<option value="' . $v->id .'" '. $selected . ' >' . $v->id . '</option>';
}
$html .= '</select>';
}
$html .= '</div>';
return $html;
}
On JQuery:
jQuery(document).ready(function($) {
$('#projectChosen').on('change', function () {
jQuery.ajax({
type: "POST",
url: ajax_object.ajaxurl,
data: {
'action': 'setProjectChosen',
'demo_projet_name': $('#projectChosen option:selected').val()
},
success: function (output) {
$( "div#projectSelector" ).replaceWith(output);
},
error: function(errorThrown){
console.log(errorThrown);
}
});
} );
} );
I hope that's what you need.

I finally made it, I got confused about what I wanted to do...
<?php
/**
* Plugin Name: demoConnecteurs
* Description: Plugin de démo des connecteurs Jenkins et Mantis
**/
require_once(file_with_external_fonctions.php);
$inst_demoConnecteurs = new demoConnecteurs();
if (isset($inst_demoConnecteurs)){
}
class demoConnecteurs{
private $projects;
private $versions;
private $project_id;
private $project_name;
private $version_id;
function __construct(){
$this->setProjects();
$this->initAjaxActions();
add_action('admin_enqueue_scripts', array($this,'demo_scripts'));
add_action('wp_enqueue_scripts', array($this,'demo_scripts'));
$this->init();
}
function initAjaxActions(){
add_action('wp_ajax_setProjectChosen', array($this,'setProjectChosen'));
add_action('wp_ajax_nopriv_setProjectChosen', array($this,'setProjectChosen'));
}
function demo_scripts(){
wp_register_script( 'ajaxHandle', plugins_url() . '/DemoConnecteurs/buttons_ajax.js');
wp_localize_script( 'ajaxHandle', 'ajax_object', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
wp_enqueue_script( 'ajaxHandle');
}
function init(){
add_shortcode( 'demoConnecteurs', array($this,'demoConnecteurs_shortcode') );
}
function demoConnecteurs_shortcode () {
return $this->contentDemoConnecteurs();
}
public function setProjects(){
$this->projects = getProjects();
}
public function setProjectChosen(){
if (isset ($_POST['demo_projet_name']))$this->project_name = $_POST['demo_projet_name'];
$this->project_id = getProjectIdFromName($this->mantisClient, $_SESSION['username'], $_SESSION['password'], $this->project_name);
$this->setVersions();
echo $this->contentDemoConnecteurs();
wp_die();
}
public function setVersions(){
$this->versions = getVersionsOfProjectChosen($this->project_id);
}
function contentDemoConnecteurs(){
$html = '<div id="contentDemoConnecteurs">';
$html .= 'Choix du projet : ';
$html .= '<select id="projectChosen" name="project">';
foreach($this->projects as $p) {
$selected = ($p->id == $this->project_id) ? 'selected="selected"' : '';
$html .= '<option value="' . $p->name .'" '. $selected . ' >' . $p->name . '</option>';
}
$html .= '</select><br>';
$html .= 'Choix de la version : ';
if (isset ($this->versions)){
$html .= '<select id="versionChosen" name="version">';
foreach($this->versions as $v) {
$selected = ($v->id == $this->version_id) ? 'selected="selected"' : '';
$html .= '<option value="' . $v->id .'" '. $selected . ' >' . $v->id . '</option>';
}
$html .= '</select>';
}
$html .= '</div>';
return $html;
}
}
jQuery(document).ready(function($) {
$('#projectChosen').on('change', function () {
jQuery.ajax({
type: "POST",
url: ajax_object.ajaxurl,
data: {
'action': 'setProjectChosen',
'demo_projet_name': $('#projectChosen option:selected').val()
},
success: function (output) {
$('#contentDemoConnecteurs').replaceWith(output);
},
error: function(errorThrown){
console.log(errorThrown);
}
});
} );
} );

Related

CodeIgniter 3 - function search value in database return error 500

I try search value (ean) and if exist in database return title product assigned to this ean.
I've 2 tables:
products
product_details
in products table I have EAN and in product_details I've title.
products.id = product_details.product_id
View:
<div class="form-group">
<label><?= trans("search"); ?></label>
<input type="text" id="input_product_exist" class="form-control" placeholder="<?= trans("category_name"); ?>">
<div id="product_search_result" class="category-search-result"></div>
</div>
Script in view:
<script>
$(document).on("input", "#input_product_exist", function () {
var val = $(this).val();
val = val.trim();
if (val.length > 1) {
var data = {
"ean": val,
"sys_lang_id": sys_lang_id
};
data[csfr_token_name] = $.cookie(csfr_cookie_name);
$.ajax({
type: "POST",
url: base_url + "ajax_controller/search_products",
data: data,
success: function (response) {
var obj = JSON.parse(response);
if (obj.result == 1) {
document.getElementById("product_search_result").innerHTML = obj.content;
}
}
});
} else {
document.getElementById("product_search_result").innerHTML = "";
}
});
ajax_controller:
//search products
public function search_products()
{
$ean = $this->input->post('ean', true);
$products = $this->category_model->search_products_by_ean($product_ean);
$content = '<ul>';
if (!empty($products)) {
foreach ($products as $item) {
$content .= '<li>' . html_escape($item->name) . ' - <strong>' . trans("id") . ': ' . $item->id . '</strong></li>';
}
$content .= '</ul>';
} else {
$content = '<p class="m-t-15 text-center text-muted">' . trans("no_records_found") . '</p>';
}
$data = array(
'result' => 1,
'content' => $content
);
echo json_encode($data);
}
category_model.php
//search products by ean
public function search_products_by_ean($product_ean)
{
$this->db->select('products.id, product_details.title as name');
$this->db->join('product_details', 'product_details.product_id = products.id');
$this->db->like('name', clean_str($product_ean));
//$this->db->where('visibility', 1);
//$this->db->order_by('categories.parent_id');
$this->db->order_by('name');
$query = $this->db->get('products');
return $query->result();
}
Now I try start search: white page.
I check in log console:
jquery.min.js:4 POST https://thisismywebsite.com/ajax_controller/search_products 500
send # jquery.min.js:4
ajax # jquery.min.js:4
(anonymous) # add-product:1581
dispatch # jquery.min.js:3
q.handle # jquery.min.js:3
#update:
I think still I have any issue in step 3, category_model/search_products_by_ean
Here I build working query in phpmyadmin:
SELECT products.ean, product_details.title FROM products INNER JOIN product_details ON products.id = product_details.product_id;
and I get correct output:
#update
you can enable php errors with
error_reporting(E_ALL);
ini_set('display_errors', 1);
for view current error not 500
in ajax controller your must send $ean not $product_ean
//search products
public function search_products()
{
$ean = $this->input->post('ean', true);
// $products = $this->category_model->search_products_by_ean($product_ean);
$products = $this->category_model->search_products_by_ean($ean);//istead $product_ean
$content = '<ul>';
if (!empty($products)) {
foreach ($products as $item) {
$content .= '<li>' . html_escape($item->name) . ' - <strong>' . trans("id") . ': ' . $item->id . '</strong></li>';
}
$content .= '</ul>';
} else {
$content = '<p class="m-t-15 text-center text-muted">' . trans("no_records_found") . '</p>';
}
$data = array(
'result' => 1,
'content' => $content
);
echo json_encode($data);
}

Extract form and input fields from HTML

I want to extract and echo Attribute Values from both form and input fields from a given HTML. I found that its possible with DOMDocument.
One specific input needs to be grouped by a <div style="position: absolute; left: -5000px;"></div>
I thought that I can either search for if the parent element of the input has this style attributes or if the name of the input field is similiar to b_7e0d9965bedeea1cc5f7217a9_4685998a30. But I have no idea how to do that.
This is the code:
$html = $theme['html']; // From a text input field
$dom = new DOMDocument();
if (#$dom->loadHTML($html)) {
$forms = $dom->getelementsbytagname('form');
foreach ($forms as $form) {
$form_action = $form->getAttribute('action');
$form_method = $form->getAttribute('method');
$form_id = $form->getAttribute('id');
$form_name = $form->getAttribute('name');
$form_class = $form->getAttribute('class');
$form_target = $form->getAttribute('target');
echo '<form';
if (!empty($form_action)) { echo ' action="'. $form_action .'"'; }
if (!empty($form_method)) { echo ' method="'. $form_method .'"'; }
if (!empty($form_id)) { echo ' id="'. $form_id .'"'; }
if (!empty($form_name)) { echo ' name="'. $form_name .'"'; }
if (!empty($form_class)) { echo ' class="'. $form_class .'"'; }
if (!empty($form_target)) { echo ' target="'. $form_target .'"'; }
echo '>';
$inputs = $dom->getelementsbytagname('input');
foreach ($inputs as $input) {
$input_name = $input->getAttribute('name');
$input_value = $input->getAttribute('value');
$input_id = $input->getAttribute('id');
$input_type = $input->getAttribute('type');
$input_class = $input->getAttribute('class');
echo '<input';
if (!empty($input_name)) { echo ' name="'. $input_name .'"'; }
if (!empty($input_value)) { echo ' value="'. $input_value .'"'; }
if (!empty($input_id)) { echo ' id="'. $input_id .'"'; }
if (!empty($input_type)) { echo ' type="'. $input_type .'"'; }
if (!empty($input_class)) { echo ' class="'. $input_class .'"'; }
echo '>';
}
echo '</form>';
}
}
Some Background Info: I want the user to copy and paste his Email Form Code into a Textbox. Then I want to extract the attributes of the Input Fields to use them inside my Template.
Here are the few things wrong with your syntax
$html = $theme['html']; // Make sure $html is a String
$dom = new DOMDocument();
//if (#$dom->loadHTML($html)) {
if ($dom->loadHTML($html)) { //remove #
//$forms = $dom->getelementsbytagname('form');
$forms = $dom->getElementsByTagName("form");
Make these changes and check again. Hope it should work then
To get the parent node of each input field, you can use
$parentOfInput = $input->parentNode();
$parentAttribute = $parentOfInput->getAttribute('style');
To group each form in a div, try doing this:
//echo '<form';
echo '<div style="position: absolute; left: -5000px;"><form'
and at the end
//echo '</form>';
echo '</form></div>'
In case you want to insert the whole form in an existing div, you cannot do this with PHP. As once the HTML is renedered, you cannot insert HTML using PHP.
However you can use javascript or in your case AJAX. Save the whole HTML that you are echoing, in a variable. Then pass that variable in an AJAX call.
$.ajax({url: "urFile.php"}).done(function( stringOfHTMLYouFormed ) {
$("#divID").append(stringOfHTMLYouFormed );
});
I added $parent = $input->parentNode->getAttribute('style'); into the foreach loop to look for the style of the Parent.
Right after it I use to test if the $parent has the desired style to wrap then the corresponding input field into a div.
$parent = $input->parentNode->getAttribute('style');
if ($parent == 'position: absolute; left: -5000px;') {
echo '<div style="position: absolute; left: -5000px;">';
echo '<input';
if (!empty($input_name)) { echo ' name="'. $input_name .'"'; }
if (!empty($input_value)) { echo ' value="'. $input_value .'"'; }
if (!empty($input_id)) { echo ' id="'. $input_id .'"'; }
if (!empty($input_type)) { echo ' type="'. $input_type .'"'; }
if (!empty($input_class)) { echo ' class="'. $input_class .'"'; }
echo '></div>';
} else {
echo '<input';
if (!empty($input_name)) { echo ' name="'. $input_name .'"'; }
if (!empty($input_value)) { echo ' value="'. $input_value .'"'; }
if (!empty($input_id)) { echo ' id="'. $input_id .'"'; }
if (!empty($input_type)) { echo ' type="'. $input_type .'"'; }
if (!empty($input_class)) { echo ' class="'. $input_class .'"'; }
echo '>';
}

nestedSortable on codeigniter

I do sorting function with codeigniter for pages with "nestedSortable".. When i click submit button it doesnt find " {sortable: cSortable}"
my code example:
in views
$(document).ready(function() {
$.post('<?php echo site_url('admin/pages/order_ajax'); ?>', {}, function(data) {
$('#orderResult').html(data);
});
$('#save').click(function() {
oSortable = $('.sortable').nestedSortable('toArray');
$.post('<?php echo site_url('admin/pages/order_ajax'); ?>', {sortable: cSortable}, function(data) {
$('#orderResult').html(data);
});
});
});
in model file
public function save_order($pages) {
if (count($pages)) {
foreach ($pages as $order => $page) {
dump($page);
if ($page['item_id'] != '') {
$data = array('parent_id' => (int) $page['parent_id'], 'order' => $order);
$this->db->set($data)->where($this->_primary_key, $page['item_id'])->update($this->_table_name);
echo '<pre>' . $this->db->last_query() . '</pre>';
}
}
}
}
in the controller file
public function order_ajax() {
// save order from ajax call
if (isset($_POST['sortable'])) {
$this->page_m->save_order($_POST['sortable']);
}
//fetch all pages
$this->data['pages'] = $this->page_m->get_nested();
//fetch view
$this->load->view('admin/pages/order_ajax', $this->data);
}
I see this error http://i57.tinypic.com/2uj6wpd.jpg
another error:
<?php
echo get_ol($pages);
function get_ol($array, $child = FALSE) {
$str = '';
if (count($array)) {
$str .= $child == FALSE ? '<ol class="sortable">' : '<ol>';
foreach ($array as $item) {
$str .= '<li id="list_' . $item['id'] . '">';
$str .= '<div>' . $item['title'] . '</div>';
//do we have childrens ?
if (isset($item['children']) && count($item['children'])) {
$str .= get_ol($item['children'], TRUE);
}
$str .= '</li>' . PHP_EOL;
}
$str .= '</ol>' . PHP_EOL;
}
return $str;
}
?>
so i dont get it shows me on line 10 and 11 that could't find name and title
"TypeError: parentItem is null
pid = parentItem[2];"
Looks like a type, wrong variable name. Should cSortable actually be oSortable?

Geolocation script issues

I've some issues with a geolocation script I'm working on and maybe someone could help me here :).
For this script I have 4 files :
functions.js:
function geolocation(){
GMaps.geolocate({
success: function(position) {
var userLat = position.coords.latitude;
var userLng = position.coords.longitude;
var dataString = 'userLat='+userLat+'&userLng='+userLng;
$.ajax({
type : 'POST',
url : 'getEvents.php',
data : dataString,
dataType : 'text',
success : function(msg){
console.log(msg);
}
});
},
error: function(error) {
alert('Echec de la localisation...');
},
not_supported: function() {
alert('Votre navigateur ne supporte pas la géolocalisation...');
}
});
}
index.php:
<?php require 'php/getEvents.php'; ?>
<!DOCTYPE html>
<html lang="fr">
<?php include('inc/head.html'); ?>
<body>
<div class="mosaic">
<?php echo visitorMosaicBox($data); ?>
</div>
<script type="text/javascript">
$(document).ready(function(){
geolocation();
});
</script>
</body>
</html>
getEvents.php:
<?php
session_start();
require 'db-connect.php';
require 'lib.php';
$userLat = $_POST['userLat'];
$userLng = $_POST['userLng'];
$area = 10;
$i = 0;
$data = array();
if($userLat != '' && $userLng != ''){
if(isset($_SESSION['id'])){
echo 'Logged';
}else{
try{
$sql = "SELECT restaurants.cover, restaurants.name, restaurants.address, restaurants.location, restaurants.zip, events.title, events.trailer, events.id
FROM events
LEFT JOIN restaurants ON restaurants.id = events.fk_restaurants";
$req = $db->query($sql);
}catch(PDOException $e){
echo 'Erreur: '.$e->getMessage();
}
while($res = $req->fetch()){
$fetchAddress = $res['address'].', '.$res['zip'].' '.$res['location'];
$fixedAddress = str_replace(' ','+',$fetchAddress);
$geocode = file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?address='.$fixedAddress.'&sensor=false');
$output = json_decode($geocode);
$lat = $output->results[0]->geometry->location->lat;
$lng = $output->results[0]->geometry->location->lng;
$distance = distance($userLat, $userLng, $lat, $lng, false);
if($distance <= $area){
$data[$i] = array(
"id" => $res['id'],
"name" => $res['name'],
"cover" => $res['cover'],
"address" => $fetchAddress,
"title" => $res['title'] ,
"trailer" => $res['trailer'],
);
$i++;
}
}
}
}else{
$data = 'ERROR';
}
?>
lib.php :
<?php
function visitorMosaicBox($array){
for($i=0; $i<sizeOf($array);$i++){
$html = '<div class="box" id="box-'.$i.'">';
$html .= '<img src="'.$array[$i]['cover'].'" alt="'.$array[$i]['name'].'" />';
$html .= '<span class="ribbon"></span>';
$html .= '<div class="back"></div>';
$html .= '<div class="infos" id="event-'.$array[$i]['id'].'">';
$html .= '<p class="msg"></p>';
$html .= '<div class="txt-1">';
$html .= '<span class="sits"><span class="dinners">5</span></span>';
$html .= '<h3>'.$array[$i]['title'].'<span class="block">'.$array[$i]['name'].'</span></h3>';
$html .= '<ul class="actions">';
$html .= '<li>Partager</li>';
$html .= '<li>Participer</li>';
$html .= '<li class="last">Info</li>';
$html .= '</ul>';
$html .= '</div>'; // Fin de .txt-1
$html .= '<div class="txt-2">';
$html .= '<h3>'.$array[$i]['title'].'</h3>';
$html .= '<p>'.$array[$i]['trailer'].'</p>';
$html .= 'Fermer';
$html .= '</div>'; // Fin de .txt-2
$html .= '</div>'; // Fin de .infos
$html .= '</div>'; // Fin de .box
return $html;
}
}
?>
So now what's that's supposed to do...
1/ functions.js geolocates the visitor, gets his coordonates (lat,lng) and send them to my getEvents.php
2/ getEvents.php receives the coordonates from functions.js, and compare them with the results from the database.
3/ If the distance between the result and the user is lower than the area (10) then I store all the datas from the result in my array $data.
4/ The function visitorMosaicBox() creates as many divs as there are results in my array.
5/ In index.php, I simply call visitorMosaicBox() by passing my array $data.
My problem is that no divs are created even if there are results. I receive the visitor's coordonates in my getEvents.php file but in my index.php file the coordonates doesn't exists.
Does anyone know why my coordonates can't pass from my getEvents.php file to my index.php file please ? Any solution ?
If I split my script in these 4 files it's because I'll need to do other stuffs on my getEvents.php file depending on the visitor is connected or not, etc...
Thanks and sorry for this long question.
Antho

Trying to echo buttons for HTML table

I'm trying to understand when I run the btn_actions function I have nothing returned to me. I'm attempting to get two buttons to be echoed out in my table.
echo $this->functions_model->btn_actions(1);
die();
public function btn_actions($item_id)
{
$content = '<div class="controls center">';
$content = $this->btn_edit($item_id);
$content = $this->btn_delete($item_id);
$content = '</div>';
return $content;
}
public function btn_edit($item_id)
{
$button = '<a class="tip" href="'. current_url() . '/edit/' . $item_id .'" oldtitle="Edit Task" aria-describeby="ui-tooltip-8"><span class="icon12 icomoon-icon-pencil"></span></a>';
return $button;
}
public function btn_delete($item_id)
{
$button = '<a class="tip" href="'. current_url() . '/soft-delete/' . $item_id .'" oldtitle="Delete Task"><span class="icon12 icomoon-icon-remove"></span></a>';
return $button;
}
You need to concatenate using .
$content = '<div class="controls center">';
$content .= $this->btn_edit($item_id);
$content .= $this->btn_delete($item_id);
$content .= '</div>';
return $content;
Try this :
echo $this->functions_model->btn_actions(1);
die();
public function btn_actions($item_id)
{
$content = '<div class="controls center">';
$content = $content . $this->btn_edit($item_id);
$content = $content . $this->btn_delete($item_id);
$content = $content . '</div>';
return $content;
}
public function btn_edit($item_id)
{
$button = '<a class="tip" href="'. current_url() . '/edit/' . $item_id .'" oldtitle="Edit Task" aria-describeby="ui-tooltip-8"><span class="icon12 icomoon-icon-pencil"></span></a>';
return $button;
}
public function btn_delete($item_id)
{
$button = '<a class="tip" href="'. current_url() . '/soft-delete/' . $item_id .'" oldtitle="Delete Task"><span class="icon12 icomoon-icon-remove"></span></a>';
return $button;
}

Categories