Link Action plugin for slGrid

There was recently a plugin system added to slGrid, which is great because I recently found the need for a plugin that creates a link around specific cell content and decided to write one.

Link Action allows you to create a URL around the contents of a cell using the unique database column ID. It also allows you to pass the target page for the URL and optional URL arguments. If no target page is passed, it defaults to the current page calling the grid.

<?php
/*
 * Example usage:
 * $_SESSION["grid"]->SetPlugin("Full_Name", "link_action", array("target" => "users.php", "extra_args" => "&action=edit"));
 *
 * Assuming the database column ID is 24, and the Full_Name is Raam Dev, here is what the cell would contain:
 * Raam Dev
 */

require_once('class.plugin.php');

class link_action_Plugin extends Grid_Plugin
{

	function introspect()
	{
		return(array(
			"name" 			=> "Link Action",
			"description" 	=> "Creates a URL to call an action using the unique database column ID",
			"author"		=> "Raam Dev ",
			"version"		=> "1.0"
			));
	}

	function generateContent($cell, $args)
	{
		if(empty($args["target"])){
			$args["target"] = $PHP_SELF;
		}
		if(empty($args["extra_args"])){
			$args["extra_args"] = "";
		}
		return("$cell");
	}
}
?>

Write a Comment

Comment

  1. Wow — I was searching Google today for slGrid plugins and found my own post in the search results! I totally forgot I even wrote a post about slGrid plugins, let alone the fact that I created my own plugin for slGrid!

  2. i want to add a new colum to the grid right side of the delete how do i do that?? and when click that view a window shuld go to new page with row id.

    thx for the help in advance