示例#1
0
		public function getAttributeValueObject($ak, $createIfNotFound = false) {
			$db = Loader::db();
			$av = false;
			$v = array($this->getUserID(), $ak->getAttributeKeyID());
			$avID = $db->GetOne("select avID from UserAttributeValues where uID = ? and akID = ?", $v);
			if ($avID > 0) {
				$av = UserAttributeValue::getByID($avID);
				if (is_object($av)) {
					$av->setUser($this);
					$av->setAttributeKey($ak);
				}
			}
			
			if ($createIfNotFound) {
				$cnt = 0;
			
				// Is this avID in use ?
				if (is_object($av)) {
					$cnt = $db->GetOne("select count(avID) from UserAttributeValues where avID = ?", $av->getAttributeValueID());
				}
				
				if ((!is_object($av)) || ($cnt > 1)) {
					$av = $ak->addAttributeValue();
				}
			}
			
			return $av;
		}
示例#2
0
 public function getAttributeValue($avID, $method = 'getValue')
 {
     $av = UserAttributeValue::getByID($avID);
     $av->setAttributeKey($this);
     return $av->{$method}();
 }
示例#3
0
 public function getAttributeValue($avID, $method = 'getValue')
 {
     $av = UserAttributeValue::getByID($avID);
     $av->setAttributeKey($this);
     return call_user_func_array(array($av, $method), array());
 }