add webside implementation for party show
authorMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Mon, 21 Dec 2015 07:14:14 +0000 (08:14 +0100)
committerMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Mon, 21 Dec 2015 07:14:14 +0000 (08:14 +0100)
web/Obj/brisk.phh
web/Obj/dbase_pgsql.phh
web/index.php
web/info.js

index 4592179..830a239 100644 (file)
@@ -1693,6 +1693,8 @@ class Brisk
           }
           $user_tos_vers = $user_item->tos_vers_get();
 
+          $partyskill = $bdb->usersnet_partyskill($user->code, $user_item->code);
+
           $widefriend = $bdb->usersnet_widefriend($user->code, $user_item->code);
           $widefriend['skill'] = $bdb->usersnet_wideskill($user->code, $user_item->code);
           $narrowfriend = $bdb->usersnet_narrowfriend($user->code, $user_item->code);
@@ -1731,6 +1733,7 @@ class Brisk
                                        "Normale" : "Stato sconosciuto"))),
                                     "guar" => ($user_item->type & USER_FLAG_TY_APPR ?
                                                "" : $guar_login),
+                                    "party" => $partyskill,
                                     "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" => usersnet_friend_getlabel($usersnet_item->friend),
index 48ca78e..8027377 100644 (file)
@@ -942,6 +942,27 @@ INSERT INTO %smails (code, ucode, type, tstamp, subj, body_txt, body_htm, hash)
         return ($narrowskill);
     }
 
+    function usersnet_partyskill($owner, $target)
+    {
+        GLOBAL $G_dbpfx;
+
+        $partyskill = "non disponibile";
+
+        $pskl_sql = sprintf("SELECT * FROM %susersnet_party WHERE owner = %d AND target = %d;",
+                            $G_dbpfx, $owner, $target);
+        if (($pskl_pg  = $this->query($pskl_sql)) == FALSE) {
+            return ($partyskill);
+        }
+
+        if (pg_numrows($pskl_pg) > 0) {
+            $pskl_obj = pg_fetch_object($pskl_pg, 0);
+            // TODO: UNCOMMENT IF THE NETWORK WORKS VERY WELL
+            // if ($wskl_obj->count >= 3)
+            $partyskill = sprintf("%3.2f", $pskl_obj->skill);
+        }
+        return ($partyskill);
+    }
+
     function usersnet_bycode($owner, $target, $widefriend, $narrowfriend)
     {
         GLOBAL $G_dbpfx;
index 2f3b04b..8a2de19 100644 (file)
@@ -240,6 +240,10 @@ $mlang_room = array( 'userpassuse'  => array('it' => 'Il tuo nickname &egrave; g
                                            'en' => 'Matches'),
                      'info_match_tit' => array('it' => 'Partite giocate ai tavoli riservati.',
                                            'en' => 'Matches played at reserved tables.'),
+                     'info_party' => array('it' => 'Party',
+                                           'en' => 'Party'),
+                     'info_party_tit' => array('it' => 'Bravura calcolata in base ad amici, agli amici fidati e agli amici degli amici fidati in base alla credibilità degli amici fidati.',
+                                           'en' => 'Skill calculated with party rules.'),
                      'info_game' => array('it' => 'Mani',
                                           'en' => 'Hands'),
                      'info_game_tit' => array('it' => 'Mani giocate ai tavoli riservati.',
@@ -1398,12 +1402,13 @@ type="submit" class="button" onclick="this.form.elements['realsub'].value = 'chi
 <tr>
 <td class="head"><span><?php echo $mlang_room['info_guar'][$G_lang]; ?>:</span></td>
 <td class="ri b-right data"><span class="guar_id"></span></td>
-<td></td><td></td>
+<td class="head"><span class="title" title="<?php echo $mlang_room['info_match_tit'][$G_lang]; ?>"><?php echo $mlang_room['info_match'][$G_lang]; ?>:</span></td>
+<td class="ri data"><span class="match_id"></span></td>
 </tr>
 
 <tr>
-<td class="head"><span class="title" title="<?php echo $mlang_room['info_match_tit'][$G_lang]; ?>"><?php echo $mlang_room['info_match'][$G_lang]; ?>:</span></td>
-<td class="ri b-right data"><span class="match_id"></span></td>
+<td class="head"><span class="title" title="<?php echo $mlang_room['info_party_tit'][$G_lang]; ?>"><?php echo $mlang_room['info_party'][$G_lang]; ?>:</span></td>
+<td class="ri b-right data"><span class="party_id"></span></td>
 <td class="head"><span class="title" title="<?php echo $mlang_room['info_game_tit'][$G_lang]; ?>"><?php echo $mlang_room['info_game'][$G_lang]; ?>:</span></td>
 <td class="ri data"><span class="game_id"></span></td>
 </tr>
index bf63b9c..54d9093 100644 (file)
@@ -46,6 +46,7 @@ function info_fld(dobj)
                                                          } },
                    match: { type: 'value', perms: 'ro' },
                    game: { type: 'value', perms: 'ro' },
+                   party: { type: 'value', perms: 'ro' },
                    friend: { type: 'radio' },
                    skill: { type: 'radio' },
                    trust: { type: 'radio' }