<?PHP
/*
* generator.php Actions wrapper
* copyright (c)2005 Marco Islas &lt;markuz@islascruz.org&gt;
*/
/*
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
  
 class generator
 {
 	function default_action(){
 		if (!isset($_REQUEST["theme"]) || !isset($_REQUEST["limit"]))
 			return $GLOBALS["functions"]->error("Error Critico");
 		else{ 
	 		$url   = $GLOBALS["functions"]->get_registry_value("/pagval/url");
	 		$title = $GLOBALS["functions"]->get_registry_value("/pagval/title");
			$tpl = new template(CINTILLA_PATH."xhtml/");
			$tpl->load("layout","generator.html");
			$tpl->setBlock("main","layout");
				$tpl->set_variable("theme",$_REQUEST["theme"]);
				$tpl->set_variable("limit",$_REQUEST["limit"]);
				$tpl->set_variable("url",$url);
				$tpl->set_variable("title",$title);
				$tpl->set_variable("styles",$GLOBALS["functions"]->get_themes());
				$tpl->set_variable("limits",$this->limits());
			$tpl->expand("expmain","main");
			return $tpl->export("expmain");
		}
 	}
 	
 	function limits(){
 		$limit = $GLOBALS["functions"]->get_registry_value("/cintilla/limit");
 		$option = " ";
 		$b=0;
 		for ($i=1;$i<=$limit;$i++){
 			if (isset($_REQUEST["limit"]) && $b==0)
 				$option .= "<option selected value=\"".$_REQUEST["limit"]."\">".$_REQUEST["limit"]."</option>\n";
 				$b++;
 			if ($i!=$_REQUEST["limit"])
 				$option .= "<option value=\"".$i."\">".$i."</option>\n";
 		}
 		return $option;	
 	}
 }
 ?>