예제 #1
0
	function validate(&$action) {
		Apu::dispatch($action->validation);
		if (!empty($GLOBALS["VALIDATION"])) {
			reset($GLOBALS["VALIDATION"]);
			while (list($method, $methodValidations) = each($GLOBALS["VALIDATION"])) {
				if ($method == "-" || $method == $action->method) {
					reset($methodValidations);
					while (list($field, $fieldValidations) = each($methodValidations)) {
						$fieldValue = $action->get($field);
						while (list($i, $val) = each($fieldValidations)) {
							$function = $val["validate"];
							$not = false;
							if (substr($val["validate"], 0, 1) == "!") {
								$function = trim($function, "!");
								$not = true;
							}
							$validate = Bean::invoke("Validation", $function, array(&$action, $val, $field, $not));
							if ($not) {
								$validate = !$validate;
							}
							if (!$validate) {
								$defaultMessage = $GLOBALS["CFG_VALIDATION"]->MSG[$val["validate"]];
								$action->addMsgMessage($defaultMessage, $field);
							}
						}
					}
				}
			}
		}
	}
예제 #2
0
	function doIndex() {
		$modules = array();
		reset($GLOBALS['CFG_RPC']->MODULES);
		while (list($moduleKey,$moduleCfg) = each($GLOBALS['CFG_RPC']->MODULES)) {
			try {
				$clazz = new ReflectionClass($moduleCfg->NAME);
				$module["name"] = $moduleCfg->NAME;
				while (list(,$methodCfg) = each($moduleCfg->METHODS)) {
					$methodRef = $clazz->getMethod($methodCfg);
					$parameterCfgs = $methodRef->getParameters();
					$parameters = array();
					$args = array();
					while(list(,$param) = each($parameterCfgs)) {
						$parameters[] = $param->getName();
						$args[] = "'ps[]=' + ".$param->getName();
					}
					$parameters[] = '__callback';
	
					$method = array();
					$method["name"] = $methodCfg;
					$method["parameters"] = implode(', ', $parameters);
					$method["args"] = implode(" + '&' + ", $args);
	
					$module["methods"][] = $method;
				}
				$modules[] = $module;
			} catch (Exception $e) {
				continue;
			}
		}
		$this->modules = $modules;
		header('Content-type: text/plain');
		Apu::dispatch("/faces/rpc.php");
		exit;
	}
예제 #3
0
	function doIndex() {
		reset($GLOBALS["MENU"]);
		$menus = array();
		while (list($id, $menu) = each($GLOBALS["MENU"])) {
			$menu["name"] = $id;
			MenuAction::insertMenu($menus, ltrim($id, 'menu.'), $menu);
			
		}
		$_REQUEST["menu"] = $menus;
		$date = new Date();
		$_REQUEST["date"] = $date->__toString();
		Apu::dispatch("/todo/faces/menu/menu.php");
	}
예제 #4
0
파일: Msg.php 프로젝트: reekoheek/php-fw
	function init() {
		$lang = Locale::lang();
		if ($GLOBALS["CFG_APU"]->DEBUG) {
			Session::remove(MSG_SCOPE, "lang");
		}
		if (Session::load(MSG_SCOPE, "lang") != $lang) {
			reset($GLOBALS["CFG_MSG"]->NS);
			while (list(,$value) = each($GLOBALS["CFG_MSG"]->NS)) {
				try { Apu::dispatch($value.".php"); } catch (Exception $e) {}
				try { Apu::dispatch($value.'_'.strtolower($lang).".php"); } catch (Exception $e) {}
			}
			Session::save(MSG_SCOPE, $lang, "lang");			
			//Session::save(MSG_SCOPE, $GLOBALS[MSG_SCOPE], "msgList");
		}
	}
예제 #5
0
	function doEdit() {
		$this->fetch("lookup");
		if (empty($this->lookup)) {
			$this->lookup = LookupDao::byId($this->id);
		}

		$allType = LookupDao::findAllType();
		$_REQUEST["lookup.type"] = array();
		if (!empty($allType)) {
			reset($allType);
			while(list(,$type) = each($allType)) {
				$_REQUEST["lookup.type"][] = $type["type"];
			}
		}
		$this->messages = Msg::fetch();
		Apu::dispatch("/todo/faces/lookup/lookup_edit.php");
		$this->remove("lookup");
	}
예제 #6
0
	function doAdd() {
		Apu::dispatch("/todo/faces/task/task_add.php");
	}
예제 #7
0
	function doIndex() {
		$this->fetch("login");
		Apu::dispatch("/todo/faces/login/login.php");
		$this->messages = Msg::fetch();
		$this->remove();
	}