Exemplo n.º 1
0
">
<?php 
if ($user->getAgencySize() > 1) {
    echo $user->getAgencySize() . " Soldiers";
} else {
    echo "1 Soldier";
}
?>
            </a>
        <?php 
$soldier_code = '';
if ($user->getAgencyCode() != "") {
    $soldier_code = $user->getAgencyCode();
} else {
    $soldierCode = new SoldierCode();
    $code = SoldierCode::getSoldierCode();
    if ($code[0]->getCode() != "") {
        $user->updateUserSoldierCode($code[0]->getCode());
        $soldierCode->deleteCode($code[0]->getCode());
    }
}
?>
        <p>S.Code: <?php 
echo $user->getAgencyCode();
?>
</p>
    </div>			

</div>
<div id="mainbuttons">
Exemplo n.º 2
0
 public static function createUserUdid($uuid, $os, $mac)
 {
     $soldierCode = new SoldierCode();
     $code = SoldierCode::getSoldierCode();
     if ($code[0]->getCode() == "") {
         $code = SoldierCode::getSoldierCode();
         if ($code[0]->getCode() == "") {
             $code = SoldierCode::getSoldierCode();
         }
     }
     $userparams = array();
     $userparams['udid'] = $uuid;
     $userparams['soldier_code'] = $code[0]->getCode();
     $userparams['device_os'] = $os;
     $userparams['device_mac'] = $mac;
     $userparams['diamonds'] = 10;
     // setting max experience points for first level
     $userparams['next_level_experince_points'] = 15;
     $justAddedID = ConnectionFactory::InsertIntoTableBasicReturnInsertID("users", $userparams);
     if ($justAddedID) {
         $usercitiesparams = array();
         $usertimerparams = array();
         $success = '';
         $timer_success = '';
         /*
          * Inserting User cities with rank
          * Currently we are dealing with 4 cities so loop iterates 4 times
          */
         for ($i = 1; $i <= 4; $i++) {
             $usercitiesparams['user_id'] = $justAddedID;
             $usercitiesparams['city_id'] = $i;
             $usercitiesparams['rank_avail'] = 1;
             $success = ConnectionFactory::InsertIntoTableBasic("users_cities", $usercitiesparams);
         }
         $usertimerparams['user_id'] = $justAddedID;
         $timer_success = ConnectionFactory::InsertIntoTableBasic("user_timers", $usertimerparams);
         $achievement['user_id'] = $justAddedID;
         $success = ConnectionFactory::InsertIntoTableBasic("users_achievements", $achievement);
         if ($success && $timer_success) {
             if ($soldierCode->deleteCode($code[0]->getCode())) {
                 return self::getUser($justAddedID);
             }
         }
     }
     return NULL;
 }