}
$user_tos_vers = $user_item->tos_vers_get();
- if (($usernet_item = $bdb->usernet_bycode($user->code, $user_item->code)) == FALSE) {
- $usernet_item = $bdb->usernet_default($user->code, $user_item->code);
+ if (($usersnet_item = $bdb->usersnet_bycode($user->code, $user_item->code)) == FALSE) {
+ $usersnet_item = $bdb->usersnet_default($user->code, $user_item->code);
}
if (versions_cmp($user_tos_vers, "1.2") < 0) {
"" : $guar_login),
"match" => (versions_cmp($user_tos_vers, "1.4") < 0 ? "non autorizzato" : $user_item->match_cnt) ,
"game" => (versions_cmp($user_tos_vers, "1.4") < 0 ? "non autorizzato" : $user_item->game_cnt),
- "friend" => "unknown"));
+ "friend" => usersnet_friend_getlabel($usersnet_item->friend),
+ "skill" => $usersnet_item->skill,
+ "trust" => $usersnet_item->trust));
}
return $jret;
}
}
-define('USERNET_FRIEND', 0);
-define('USERNET_CLEVER', 1);
-define('USERNET_TRUST', 2);
-class UserNetItem {
+define('USERSNET_FRIEND', 1);
+define('USERSNET_SKILL', 1);
+define('USERSNET_TRUST', 2);
+class UsersNetItem {
var $owner;
var $target;
var $friend;
- var $clever;
+ var $skill;
var $trust;
var $from_db;
- function UserNetItem($owner, $target, $friend, $clever, $trust, $from_db)
+ function UsersNetItem($owner, $target, $friend, $skill, $trust, $from_db)
{
$this->owner = $owner;
$this->target = $target;
$this->friend = $friend;
- $this->clever = $clever;
+ $this->skill = $skill;
$this->trust = $trust;
$this->from_db = $from_db;
}
- static function UserNetItemFromRecord($rec)
+ static function UsersNetItemFromRecord($rec)
{
- $ret = new UserNetItem($rec->owner, $rec->target, $rec->friend,
- $rec->clever, $rec->trust, TRUE);
+ $ret = new UsersNetItem($rec->owner, $rec->target, $rec->friend,
+ $rec->skill, $rec->trust, TRUE);
return ($ret);
}
- static function UserNetItemDefaults($owner, $target)
+ static function UsersNetItemDefaults($owner, $target)
{
- $ret = new UserNetItem($owner, $target, USERNET_FRIEND,
- USERNET_CLEVER, USERNET_TRUST, FALSE);
+ $ret = new UsersNetItem($owner, $target, USERSNET_FRIEND,
+ USERSNET_SKILL, USERSNET_TRUST, FALSE);
return ($ret);
}
return (TRUE);
}
- function usernet_bycode($owner, $target)
+ function usersnet_bycode($owner, $target)
{
GLOBAL $G_dbpfx;
$ret = FALSE;
- $net_sql = sprintf("SELECT * FROM %susers_net WHERE owner = %d AND target = %d;",
+ $net_sql = sprintf("SELECT * FROM %susersnet WHERE owner = %d AND target = %d;",
$G_dbpfx, $owner, $target);
if (($net_pg = $this->query($net_sql)) == FALSE) {
return FALSE;
$net_obj = pg_fetch_object($net_pg, 0);
- return (UserNetItem::UserNetItemFromRecord($net_obj));
+ return (UsersNetItem::UsersNetItemFromRecord($net_obj));
}
- function usernet_default($owner, $target)
+ function usersnet_default($owner, $target)
{
- return (UserNetItem::UserNetItemDefaults($owner, $target));
+ return (UsersNetItem::UsersNetItemDefaults($owner, $target));
}
} // End class BriskDB
} // end class User
+if (!isset($__usersnet_friend_map)) {
+ $__usersnet_friend_map = array("black", "unknown", "test", "friend", "bff");
+}
+
+function usersnet_friend_getlabel($id)
+{
+ GLOBAL $__usersnet_friend_map;
+
+ $id_i = intval($id);
+ if ($id_i < 0 || $id_i >= count($__usersnet_friend_map)) {
+ return FALSE;
+ }
+ return ($__usersnet_friend_map[$id_i]);
+}
?>
function Fieldify(ancestor, fieldsdescr)
{
this.ancestor = ancestor;
-
+
this.field = new Array();
for (k in fieldsdescr) {
this.field[k] = fieldsdescr[k];
Fieldify.prototype = {
ancestor: null,
field: null,
-
+
visible: function(is_visible) {
this.ancestor.style.visibility = (is_visible ? "visible" : "hidden" );
},
fld_value_set: function(name, value)
{
- console.log(name + "=" + value);
this.ancestor.getElementsByClassName(name + '_id')[0].innerHTML = value;
},
-
+
fld_radio_set: function(name, value)
{
var arr = this.ancestor.getElementsByClassName(name + '_id');
- console.log(name + "=" + value);
-
for (k in arr) {
if (arr[k].value == value)
arr[k].checked = true;
- else
+ else
arr[k].checked = false;
}
},
<td class="c3t">3</td>
<td class="c4t">4</td>
<td class="c5t">5</td></tr>
- <tr><td class="c1b"><input type="radio" name="credib" class="credib_id" value="1"></td>
- <td class="c2b"><input type="radio" name="credib" class="credib_id" value="2"></td>
- <td class="c3b"><input type="radio" name="credib" class="credib_id" value="3"></td>
- <td class="c4b"><input type="radio" name="credib" class="credib_id" value="4"></td>
- <td class="c5b"><input type="radio" name="credib" class="credib_id" value="5"></td>
+ <tr><td class="c1b"><input type="radio" name="trust" class="trust_id" value="1"></td>
+ <td class="c2b"><input type="radio" name="trust" class="trust_id" value="2"></td>
+ <td class="c3b"><input type="radio" name="trust" class="trust_id" value="3"></td>
+ <td class="c4b"><input type="radio" name="trust" class="trust_id" value="4"></td>
+ <td class="c5b"><input type="radio" name="trust" class="trust_id" value="5"></td>
</tr>
</table>
</td></tr>
guar: { type: 'value' },
match: { type: 'value' },
game: { type: 'value' },
- friend: { type: 'radio' } };
+ friend: { type: 'radio' },
+ skill: { type: 'radio' },
+ trust: { type: 'radio' }
+ };
info = new Fieldify($('info'), fields);
info.populate(info_in);