Esempio n. 1
0
 public function compile(Fps_Viewer_CompileParser $compiler)
 {
     $compiler->write('// If block node')->raw("\n");
     /*
     $compiler->write('var_dump($this->getValue($this->context, \'fps_user_id\'));');
     $compiler->write('var_dump((');
     $compiler->subcompile($this->tests[0]);
     $compiler->write('));')->raw("\n");
     */
     for ($i = 0; $i < count($this->tests); $i += 2) {
         if ($i > 0) {
             $compiler->outdent()->write('} else if (');
         } else {
             $compiler->write('if (');
         }
         //pr($this->tests);
         $compiler->subcompile($this->tests[$i])->raw(") {\n")->indent();
         foreach ($this->tests[$i + 1] as $k => $v) {
             $compiler->subcompile($v);
         }
     }
     if (!empty($this->else)) {
         $compiler->outdent()->write("} else {\n")->indent();
         foreach ($this->else as $key => $val) {
             $compiler->subcompile($val);
         }
     }
     $compiler->outdent()->write("}\n");
 }
Esempio n. 2
0
 public function compile(Fps_Viewer_CompileParser $compiler)
 {
     $compiler->write('// For block node')->raw("\n")->write('foreach (');
     $compiler->subcompile($this->expr)->raw(") {\n")->indent();
     foreach ($this->body as $key => $val) {
         $val->compile($compiler);
     }
     $compiler->outdent()->write("}\n");
 }