Beispiel #1
0
	function get($key = null) {
		$scope = $GLOBALS["CFG_ACTION"]->SCOPE;
		if ($scope == "_REQUEST" || $scope == "_POST" || $scope == "_GET") {
			$key = str_replace(".", "_", $key);
		}
		return Bean::get('$'.$scope, $key);
	}
Beispiel #2
0
	function valueString() {
		reset($this->meta);
		$values = array();
		while(list(,$meta) = each($this->meta)) {
			$value = Bean::get($this->value, String::camelize($meta["name"]));
			$values[] = $this->escape($value, $meta["name"]);
		}
		return implode(', ', $values);
	}
Beispiel #3
0
	function load($name, $property = null) {
		Session::start();
		if (empty($property)) {
			return $_SESSION[$name];
		} else {
			$session = Bean::get($_SESSION[$name], $property);
			return $session;
		}
	}
Beispiel #4
0
	function populate() {
		$scope = $GLOBALS["CFG_ACTION"]->SCOPE;
		$scopeVars = Bean::get('$'.$scope);
		while (list($key, $var) = each($scopeVars)) {
			if ($scope == "_REQUEST" || $scope == "_POST" || $scope == "_GET") {
				$key = str_replace("_", ".", $key);
			}
			Bean::set($this, $key, $var);
		}
	}
Beispiel #5
0
	function delete($table, $obj, $schema = "DEFAULT") {
		$driver = $GLOBALS["CFG_DB"]->CON[$schema]->DRIVER;
		$objId = Bean::get($obj, "__ID__");
		if (empty($objId)) {
			throw new Exception("Cannot delete unpersisted object");
		}
		$delete = new Delete($table, $obj, $schema);
		$success = DB::query($delete, $schema);
		if (!$success) {
			$result = Bean::invoke(String::camelize('_'.$driver.'_driver'), "error", array($schema));
			throw new Exception("Cannot delete object. ".$result);
		}
	}
Beispiel #6
0
	function copy($source, &$destination, $includes) {
		while(list(,$include) = each($includes)) {
			$value = Bean::get($source, $include);
			Bean::set($destination, $include, $value);
		}
	}