Adjusted time.php to honor note on separate row option.
[timetracker.git] / WEB-INF / lib / smarty / sysplugins / smarty_internal_compile_continue.php
1 <?php
2
3 /**
4  * Smarty Internal Plugin Compile Continue
5  * 
6  * Compiles the {continue} tag
7  * 
8  * @package Smarty
9  * @subpackage Compiler
10  * @author Uwe Tews 
11  */
12 /**
13  * Smarty Internal Plugin Compile Continue Class
14  */
15 class Smarty_Internal_Compile_Continue extends Smarty_Internal_CompileBase {
16         // attribute definitions
17     public $optional_attributes = array('levels'); 
18     public $shorttag_order = array('levels');
19
20     /**
21      * Compiles code for the {continue} tag
22      * 
23      * @param array $args array with attributes from parser
24      * @param object $compiler compiler object
25      * @param array $parameter array with compilation parameter
26      * @return string compiled code
27      */
28     public function compile($args, $compiler, $parameter)
29     {
30         $this->compiler = $compiler;
31         $this->smarty = $compiler->smarty;
32         // check and get attributes
33         $_attr = $this->_get_attributes($args);
34
35         if ($_attr['nocache'] === true) {
36                 $this->compiler->trigger_template_error('nocache option not allowed', $this->compiler->lex->taglineno);
37         }
38
39         if (isset($_attr['levels'])) {
40             if (!is_numeric($_attr['levels'])) {
41                 $this->compiler->trigger_template_error('level attribute must be a numeric constant', $this->compiler->lex->taglineno);
42             } 
43             $_levels = $_attr['levels'];
44         } else {
45             $_levels = 1;
46         } 
47         $level_count = $_levels;
48         $stack_count = count($compiler->_tag_stack) - 1;
49         while ($level_count > 0 && $stack_count >= 0) {
50             if (in_array($compiler->_tag_stack[$stack_count][0], array('for', 'foreach', 'while', 'section'))) {
51                 $level_count--;
52             } 
53             $stack_count--;
54         } 
55         if ($level_count != 0) {
56             $this->compiler->trigger_template_error("cannot continue {$_levels} level(s)", $this->compiler->lex->taglineno);
57         } 
58         // this tag does not return compiled code
59         $this->compiler->has_code = true;
60         return "<?php continue {$_levels}?>";
61     } 
62
63
64 ?>