PHP Classes

File: engine/modules/core/jumper/jumper.qtags.inc

Recommend this page to a friend!
  Classes of Aldo Tripiciano   Quanta CMS   engine/modules/core/jumper/jumper.qtags.inc   Download  
File: engine/modules/core/jumper/jumper.qtags.inc
Role: Example script
Content type: text/plain
Description: Example script
Class: Quanta CMS
Manage content that works without a database
Author: By
Last change:
Date: 5 years ago
Size: 1,241 bytes
 

Contents

Class file image Download
<?php
/**
 *
 * @category Qtags
 * @file jumper.qtags.inc
 * @package Quanta
 * @author Aldo Tripiciano <aldo.tripiciano@gmail.com>
 * @license http://www.quantacms.com Open
 * @link http://www.quantacms.com
 *
 * All qtags implemented by the jumper module.
 */
define("JUMPER_EMPTY", "_empty");

/**
 * Implements qtag JUMPER.
 *
 * Create a jumper to quick access nodes.
 *
 * @param Environment $env
 * The Environment.
 * @param string $target
 * The qtag's target.
 * @param array $attributes
 * The qtag's attributes.
 *
 * @return string
 * The rendered qtag.
 */
function qtag_JUMPER($env, $target, $attributes) {
 
// Which folder to use.
 
$dirlist = new DirList($env, $target, 'jumper', array('sortbytime' => 'asc') + $attributes, 'jumper');

 
$ajax = (isset($attributes['ajax'])) ? $attributes['ajax'] : '_self';
 
$empty = (isset($attributes['empty'])) ? $attributes['empty'] : '----------';
 
$tpl = (isset($attributes['tpl'])) ? ('tpl="' . $attributes['tpl'] . '"') : '';

 
// Render the jumper.
  // TODO: maybe use FORM tags?
 
$jumper = '<select class="jumper" rel="' . $ajax . '" ' . $tpl . '><option value="' . JUMPER_EMPTY . '">' . $empty . '</option>' . $dirlist->render() . '</select>';

  return
$jumper;
}