PHP User::getCountry Examples

PHP User::getCountry - 7 examples found. These are the top rated real world PHP examples of User::getCountry extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
 /**
  * @param User $user
  * @throws Sms_Backend_Exception
  */
 public function setUserSettings(User $user)
 {
     try {
         $this->setCountry($user->getCountry())->setProvider($user->getProvider());
     } catch (Sms_Backend_Exception $e) {
         if (!$user->getSmsaddr()) {
             throw new Sms_Backend_Exception('Missing SMS address.');
         }
         $this->setTargetEmail($user->getSmsaddr());
     }
 }
Example #2
0
$comment_rating = "";
if ($COMMENT['rating'] >= 0) {
    $comment_rating = translate('rated');
    $comment_rating = " (" . str_replace('VAR1', $COMMENT['rating'], $comment_rating) . ") ";
}
if (isset($counter)) {
    $anchor = "<a name=\"comment" . $counter . "\"></a>";
    //$anchor_url = " | <a href=\"#comment" . $counter . "\">#" . $counter . "</a>";
    $comment_id = $counter;
}
?>
			<tr style="background-color: white; border: 1px solid lightblue; width: 400px;">
			<td class="span4">
			<center>
            <img style="vertical-align:middle;" src="img/flags/16/<?php 
echo strtolower($U_PROFILE->getCountry());
?>
.png" alt="" />
			<a style='color: black;' href="index.php?action=profile&amp;id=<?php 
echo $COMMENT['user_id'];
?>
" title="<?php 
echo $U_PROFILE->getFirstname() . " " . $U_PROFILE->getLastname();
?>
" id="name_<?php 
echo $comment_id;
?>
"><?php 
echo $U_PROFILE->getFirstname() . " " . $U_PROFILE->getLastname();
?>
</a>
function getBiographicalFeature(User $user, $feature)
{
    switch ($feature) {
        case "name":
            $feat_str = $user->getName("%f %l");
            break;
        case "group":
            $feat_str = $user->getGroup();
            break;
        case "role":
            $feat_str = $user->getRole();
            break;
        case "photo":
            $official_photo = UserPhoto::get($user->getID(), UserPhoto::OFFICIAL);
            $feat_str = $official_photo->getFilename();
            break;
        case "organisation":
            $organisation = $user->getOrganisation();
            $feat_str = $organisation->getTitle();
            break;
        case "email":
            $feat_str = $user->getEmail();
            break;
        case "email_alt":
            $feat_str = $user->getEmailAlternate();
            break;
        case "address":
            $address = $user->getAddress();
            $postcode = $user->getPostalCode();
            $city = $user->getCity();
            $province = $user->getProvince();
            $prov_name = $province->getName();
            $country = $user->getCountry();
            $country_name = $country->getName();
            $feat_str = html_encode($address) . "<br />" . html_encode($city);
            if ($prov_name) {
                $feat_str .= ", " . html_encode($prov_name);
            }
            $feat_str .= "<br />";
            $feat_str .= html_encode($country_name);
            if ($postcode) {
                $feat_str .= ", " . html_encode($postcode);
            }
            break;
        case "phone":
            $feat_str = $user->getTelephone();
            break;
        case "fax":
            $feat_str = $user->getFax();
            break;
        default:
            Zend_Debug::dump($feature);
            return;
    }
    return $feat_str;
}
/**
 * This displays a person's name, picture etc. including basic biographical information and assistant info if relevant
 * @param User $user
 */
function display_person(User $user)
{
    global $ENTRADA_ACL;
    $photos = $user->getPhotos();
    $user_id = $user->getID();
    $is_administrator = $ENTRADA_ACL->amIallowed('user', 'update');
    $prefix = $user->getPrefix();
    $firstname = $user->getFirstname();
    $lastname = $user->getLastname();
    $fullname = $user->getName("%f %l");
    $departments = $user->getDepartments();
    if (0 < count($departments)) {
        $dep_titles = array();
        foreach ($departments as $department) {
            $dep_titles[] = ucwords($department->getTitle());
        }
        $group_line = implode("<br />", $dep_titles);
    } else {
        $group = $user->getGroup();
        $role = $user->getRole();
        $group_line = ucwords($group . " > " . ($group == "student" ? "Class of " : "") . $role);
    }
    $privacy_level = $user->getPrivacyLevel();
    $organisation = $user->getOrganisation();
    $org_name = $organisation ? $organisation->getTitle() : "";
    $email = 1 < $privacy_level || $is_administrator ? $user->getEmail() : "";
    $email_alt = $user->getAlternateEmail();
    if (2 < $privacy_level || $is_administrator) {
        $show_address = true;
        $city = $user->getCity();
        $province = $user->getProvince();
        $prov_name = $province->getName();
        $country = $user->getCountry();
        $country_name = $country->getName();
        $phone = $user->getTelephone();
        $fax = $user->getFax();
        $address = $user->getAddress();
        $postcode = $user->getPostalCode();
        $office_hours = $user->getOfficeHours();
    }
    $assistants = $user->getAssistants();
    //there are 4 photo cases (at time of writing): no photos, official only, uploaded only, or both.
    //privacy options also need to be considered here.
    ob_start();
    ?>
	<div id="result-<?php 
    echo $user_id;
    ?>
" class="person-result">
		<div id="img-holder-<?php 
    echo $user_id;
    ?>
" class="img-holder">
		<?php 
    $num_photos = count($photos);
    if (0 === $num_photos) {
        echo display_photo_placeholder();
    } else {
        foreach ($photos as $photo) {
            echo display_photo($photo);
        }
        if (2 <= $num_photos) {
            $label = 0;
            foreach ($photos as $photo) {
                echo display_photo_link($photo, ++$label);
            }
        }
        echo display_zoom_controls($user_id);
    }
    ?>
		</div>
		<div class="person-data">
			<div class="basic">
				<span class="person-name"><?php 
    echo html_encode($fullname);
    ?>
</span>
				<span class="person-group"><?php 
    echo html_encode($group_line);
    ?>
</span>
				<span class="person-organisation"><?php 
    echo html_encode($org_name);
    ?>
</span>
				<div class="email-container">
				<?php 
    if ($email) {
        echo display_person_email($email);
        if ($email_alt) {
            echo display_person_email($email_alt);
        }
    }
    ?>
				</div>
			</div>
			<div class="address">
			<?php 
    if ($show_address) {
        if ($phone) {
            ?>
						<div>
							<span class="address-label">Telephone:</span>
							<span class="address-value"><?php 
            echo html_encode($phone);
            ?>
</span>
						</div>
						<?php 
        }
        if ($fax) {
            ?>
						<div>
							<span class="address-label">Fax:</span>
							<span class="address-value"><?php 
            echo html_encode($fax);
            ?>
</span>
						</div>
						<?php 
        }
        if ($address && $city) {
            ?>
						<div>
							<span class="address-label">Address:</span><br />
							<span class="address-value">
							<?php 
            echo html_encode($address) . "<br />" . html_encode($city);
            if ($prov_name) {
                echo ", " . html_encode($prov_name);
            }
            echo "<br />";
            echo html_encode($country_name);
            if ($postcode) {
                echo ", " . html_encode($postcode);
            }
            ?>
							</span>
						</div>
						<?php 
        }
        if ($office_hours) {
            ?>
						<div>
							<span class="address-label">Office Hours:</span>
							<span class="address-value"><?php 
            echo html_encode($office_hours);
            ?>
</span>
						</div>
						<?php 
        }
    }
    ?>
			</div>
			<div class="assistant"><?php 
    if (count($assistants) > 0) {
        ?>
				<span class="content-small">Administrative Assistants:</span>
				<ul class="assistant-list">
					<?php 
        foreach ($assistants as $assistant) {
            echo "<li>" . display_person_email($assistant->getEmail(), $assistant->getName("%f %l")) . "</li>";
        }
        ?>
				</ul><?php 
    }
    ?>
			</div>
		</div>
		<div></div>
		<div class="clearfix">&nbsp;</div>
	</div>

	<?php 
    return ob_get_clean();
}
 function ShowURL($params)
 {
     $tempUser = new User($params['CustomerID']);
     //Customer Information from CE
     $params['userID'] = "CE" . $tempUser->getId();
     $params['userEmail'] = $tempUser->getEmail();
     $params['userFirstName'] = $tempUser->getFirstName();
     $params['userLastName'] = $tempUser->getLastName();
     $params['userOrganization'] = $tempUser->getOrganization();
     $params['userAddress'] = $tempUser->getAddress();
     $params['userCity'] = $tempUser->getCity();
     $params['userState'] = $tempUser->getState();
     $params['userZipcode'] = $tempUser->getZipCode();
     $params['userCountry'] = $tempUser->getCountry();
     $params['userPhone'] = $tempUser->getPhone();
     // Get customer Authnet CIM profile
     $customerProfile = $this->getCustomerProfile($params);
     if ($customerProfile['error']) {
         return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
             <html xmlns="http://www.w3.org/1999/xhtml">
                 <head>
                     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                     <title>Untitled Document</title>
                 </head>
                 <body>' . $customerProfile['detail'] . '</body>
             </html>';
     }
     //Authorize.net CIM Credentials from CE plugin
     $myapilogin = $this->settings->get('plugin_authnetcim_Authorize.Net CIM API Login ID');
     $mYtRaNsaCTiOnKEy = $this->settings->get('plugin_authnetcim_Authorize.Net CIM Transaction Key');
     $sandbox = $this->settings->get('plugin_authnetcim_Authorize.Net CIM Test Mode');
     $USE_DEVELOPMENT_SERVER = $sandbox ? AuthnetCIM::USE_DEVELOPMENT_SERVER : AuthnetCIM::USE_PRODUCTION_SERVER;
     //Need to check to see if user is coming from signup
     if ($params['isSignup']) {
         // Actually handle the signup URL setting
         if ($this->settings->get('Signup Completion URL') != '') {
             $returnURL = $this->settings->get('Signup Completion URL') . '?success=1';
         } else {
             $returnURL = $params["clientExecURL"] . "/order.php?step=complete&pass=1";
         }
         $hosted_Profile_Page_Border_Visible = 'true';
     } else {
         $hosted_Profile_Page_Border_Visible = 'false';
         $returnURL = $params['returnURL'];
     }
     // Get the Hosted Profile Page
     $hosted_Profile_Return_Url_Text = 'Continue to confirmation page.';
     $hosted_Profile_Card_Code_Required = 'true';
     $hosted_Profile_Billing_Address_Required = 'true';
     try {
         $cim = new AuthnetCIM($myapilogin, $mYtRaNsaCTiOnKEy, $USE_DEVELOPMENT_SERVER);
         $cim->setParameter('customerProfileId', $customerProfile['profile_id']);
         if ($params['isSignup']) {
             $cim->setParameter('hostedProfileReturnUrl', $returnURL);
         } else {
             $cim->setParameter('hostedProfileIFrameCommunicatorUrl', $returnURL);
         }
         $cim->setParameter('hostedProfileReturnUrlText', $hosted_Profile_Return_Url_Text);
         $cim->setParameter('hostedProfilePageBorderVisible', $hosted_Profile_Page_Border_Visible);
         $cim->setParameter('hostedProfileCardCodeRequired', $hosted_Profile_Card_Code_Required);
         $cim->setParameter('hostedProfileBillingAddressRequired', $hosted_Profile_Billing_Address_Required);
         $cim->getHostedProfilePage();
         // Get the token for the profile
         if ($cim->isSuccessful()) {
             $profile_token = $cim->getProfileToken();
             return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                 <html xmlns="http://www.w3.org/1999/xhtml">
                     <body>
                         <form id="formAuthorizeNetPage" method="post" action="https://' . ($sandbox ? 'test' : 'secure') . '.authorize.net/profile/manage">
                             <input type="hidden" name="token" value="' . $profile_token . '"/>
                         </form>
                         <script type="text/javascript">
                             document.getElementById("formAuthorizeNetPage").submit();
                         </script>
                     </body>
                 </html>';
         } else {
             return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                 <html xmlns="http://www.w3.org/1999/xhtml">
                     <head>
                         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                         <title>Untitled Document</title>
                     </head>
                     <body>' . $cim->getResponseSummary() . '</body>
                 </html>';
         }
     } catch (AuthnetCIMException $e) {
         return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
             <html xmlns="http://www.w3.org/1999/xhtml">
                 <head>
                     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                     <title>Untitled Document</title>
                 </head>
                 <body>' . $e . '</body>
             </html>';
     }
 }
Example #6
0
<?php

include '../config.php';
include '../class/User.php';
$configobj = new config();
$conn = $configobj->getConnection();
$userobj = new User();
echo json_encode($userobj->getCountry($conn));
Example #7
0
 public function save(User $user)
 {
     $stmt = $this->db->prepare("INSERT INTO `USER` (`login`,`password`,`fullname`,\n\t    \t`email`,`phone`,`country`) VALUES (?,?,?,?,?,?)");
     $stmt->execute(array($user->getLogin(), $user->getPassword(), $user->getFullName(), $user->getEmail(), $user->getPhone(), $user->getCountry()));
 }