public function loadDemo() { $demo_code = <<<EOF \$js = new Javascript('check_all'); \$js->setType('button'); // button is default, may also use link or checkbox \$js->setCheckClass('fruits'); \$js2 = new Javascript('check_all'); \$js2->setType('link'); \$js2->setCheckClass('veggies'); EOF; $js = Javascript::factory('check_all'); $js->setType('button'); // button is default, may also use link or checkbox $js->setCheckClass('fruits'); $js2 = Javascript::factory('check_all'); $js2->setType('link'); $js2->setCheckClass('veggies'); $js->prepare(); $js2->prepare(); $demo1 = (string) $js; $demo2 = (string) $js2; $demo_example = <<<EOF <table cellpadding="6"><tr><td> <p><input type="checkbox" name="apple" class="fruits" value="1" /> Apple<br /> <input type="checkbox" name="banana" class="fruits" value="1" /> Banana<br /> <input type="checkbox" name="grape" class="fruits" value="1" /> Grape<br /> <input type="checkbox" name="melon" class="fruits" value="1" /> Melon<br /> <input type="checkbox" name="orange" class="fruits" value="1" /> Orange</p> {$demo1} </td> <td><p><input type="checkbox" name="carrot" class="veggies" value="1" /> Carrot<br /> <input type="checkbox" name="pepper" class="veggies" value="1" /> Pepper<br /> <input type="checkbox" name="lettuce" class="veggies" value="1" /> Lettuce<br /> <input type="checkbox" name="celery" class="veggies" value="1" /> Celery<br /> <input type="checkbox" name="cucumber" class="veggies" value="1" /> Cucumber</p> {$demo2} </td> </tr> </table> EOF; $this->prepare(); $this->setDemoCode($demo_code); $this->setDemoExample($demo_example); $this->setBodyScript(null); }
/** * Imports the elements of the form object into a template file and * returns the output * * @param string $template File location of template file * @return string */ public function printTemplate($template) { if (empty($this->id)) { $this->loadId(); } $value = $this->getInputStringArray(); if ($this->ajax_post) { $form_post = Javascript::factory('form_post'); $form_post->parseForm($this); } ob_start(); extract($value); include $template; $content = ob_get_contents(); ob_end_clean(); return $content; }