Plugin Directory

Changeset 927802


Ignore:
Timestamp:
06/06/2014 03:09:16 PM (12 years ago)
Author:
john ackers
Message:

add helper link() method to load a dbview into the page

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dbview/trunk/DBView.class.php

    r927730 r927802  
    66 Description: Presents the results of a database query in a table. The query can be saved as a view which can then be embedded in any post using a shortcode. Views can be created and edited in the admin pages. Cell contents can be manipulated with PHP snippets.
    77 Author: John Ackers
    8  Version: 0.5.4
     8 Version: 0.5.5
    99 Author URI: john . ackers ATT ymail . com
    1010 */
     
    2121  public $cellFunction = array();
    2222
     23  /**
     24   * create a permalink to another dbview
     25   * useful when creating PHP snippets.
     26   *
     27   * Clicking on the link, replaces the existing table with another table
     28   *
     29   * @param string $text
     30   * @param string $dbviewName
     31   */
     32
     33  static function link($text, $dbviewName, $arg1=null, $arg2=null)
     34  {
     35    $args = "" ;
     36    if (!empty($arg1)) $args .= "&arg1=".$arg1 ;
     37    if (!empty($arg2)) $args .= "&arg2=".$arg2 ;
     38    return "<a href=\"?action=dbview&verb=autoLoad&name=$dbviewName$args\" title=\"DBView '$dbviewName'\">$text</a>";
     39  }
     40
    2341/**
    2442 * create a permalink to another dbview
    2543 * useful when creating PHP snippets.
     44 * works only in dashboard.
     45 *
    2646 * @param string$text
    2747 * @param string $sqlQuery which cannot contain "
    2848 */
    29   static function linkToView($text, $name, $arg1=null, $arg2=null)
     49  static function linkToView($text, $dbviewName, $arg1=null, $arg2=null)
    3050  {
    3151    $args = "" ;
    3252    if (!empty($arg1)) $args .= "&arg1=".$arg1 ;
    3353    if (!empty($arg2)) $args .= "&arg2=".$arg2 ;
    34     return "<a href=\"?page=dbview&name=$name$args\" title=\"DBView '$name'\">$text</a>";
    35   }
     54    return "<a href=\"?page=dbview&name=$dbviewName$args\" title=\"DBView '$dbviewName'\">$text</a>";
     55  }
     56
    3657/**
    3758 * create a permalink to another database view with a query
     59 * works only in dashboard.
    3860 *
    3961 * @param string$text
Note: See TracChangeset for help on using the changeset viewer.