public function view()
 {
     $uid = intval($_REQUEST['uid']);
     if (!$uid) {
         $this->error('错误用户');
     }
     $userModel = D('User');
     $intentionModel = D('Intention');
     $introModel = D('Intro');
     $userJoinKeywordModel = D('UserJoinKeyword');
     $userJoinFunctionModel = D('UserJoinFunction');
     $jobModel = D('Job');
     $projectModel = D('Project');
     $dictMajorModel = D('DictMajor');
     $dictLocationModel = D('DictLocation');
     $data = array();
     $data['user'] = $userModel->where(" uid = {$uid} ")->find();
     $data['intention'] = $intentionModel->where(" uid = {$uid} ")->find();
     $data['intro'] = $introModel->where(" uid = {$uid} ")->getfield('intro');
     $data['keyword'] = $userJoinKeywordModel->field('keyword.keyword')->join('LEFT JOIN keyword ON user_join_keyword.keyword_id = keyword.id ')->where(" uid = {$uid} ")->select();
     $data['function'] = $userJoinFunctionModel->field('dict_function.function_name')->join('LEFT JOIN dict_function ON user_join_function.function_id = dict_function.function_id ')->where(" uid = {$uid} ")->select();
     $data['job'] = $jobModel->where(" uid = {$uid} ")->select();
     $data['project'] = $projectModel->where(" uid = {$uid} ")->select();
     $data['user']['sex'] = getSex($data['user']['sex']);
     $data['user']['age'] = getAge($data['user']['birthday']);
     $data['user']['birthday'] = getBirthday($data['user']['birthday']);
     $data['user']['workyear'] = getDictValue('WORKYEAR', $data['user']['workyear']);
     $data['user']['location'] = $dictLocationModel->getLocationName($data['user']['location']);
     $data['user']['jobstatus'] = getDictValue('JOBSTATUS', $data['user']['jobstatus']);
     $data['user']['degrees'] = getDictValue('DEGREES', $data['user']['degrees']);
     $data['user']['major'] = $dictMajorModel->getMajorName($data['user']['major']);
     $data['intention']['jobarea'] = $dictLocationModel->getLocationName($data['intention']['jobarea']);
     $data['intention']['salary'] = getDictValue('SALARY', $data['intention']['salary']);
     $this->assign('data', $data);
     $this->assign('title', '查看');
     $this->display();
 }
Beispiel #2
0
function getUserBasics($typeOfUser = "******")
{
    global $lastNames;
    global $middleNames;
    global $emailProviders;
    global $states;
    global $ages;
    // global $subscribed;
    global $logFileHandle;
    /********************************************/
    // password - only if trad user
    if ($typeOfUser == "trad") {
        $thisUser["password"] = rand(100, 999) . rand(100, 999) . rand(100, 999) . rand(100, 999);
    }
    /********************************************/
    // birthday
    $age = getRandomValue($ages, max(array_keys($ages)));
    $yob = date("Y") - $age;
    $thisUser["birthday"] = getBirthday($yob);
    fwrite($logFileHandle, "<p>The yob is: " . $yob);
    /*******************************************/
    // gender
    // $thisUser["gender"] = "female";
    $thisUser["gender"] = getGender($age);
    // if (rand(1,100) > 56) { $thisUser["gender"] = "male"; }
    /*******************************************/
    // givenName
    $thisUser["givenName"] = getFirstName($thisUser["gender"], $yob);
    /*******************************************/
    // middleName
    // just a middle initial
    $thisUser["middleName"] = $middleNames[rand(0, sizeof($middleNames) - 1)];
    /*******************************************/
    // familyName
    $thisUser["familyName"] = $lastNames[rand(0, sizeof($lastNames) - 1)];
    // $fullname is used in creating the email address
    // tom.g.smith
    $fullName = strtolower($thisUser["givenName"] . "." . $thisUser["middleName"] . "." . $thisUser["familyName"]);
    // Get rid of apostrophe in O'Connor, for example
    $fullName = str_replace("'", "", $fullName);
    fwrite($logFileHandle, "<p>The full name is: " . $fullName);
    /*******************************************/
    // email
    $emailProvider = $emailProviders[rand(0, sizeof($emailProviders) - 1)];
    $thisUser["email"] = strtolower($fullName . "@" . $emailProvider);
    /*******************************************/
    // primaryAddress/country
    $thisUser["primaryAddress"]["country"] = getCountry();
    /*******************************************/
    // primaryAddress>stateAbbreviation
    if ($thisUser["primaryAddress"]["country"] == "United States") {
        $thisUser["primaryAddress"]["stateAbbreviation"] = getRandomValue($states, max(array_keys($states)));
    }
    /******************************************/
    // subscribed
    // Newsletter subscription status
    // $thisUser["subscribed"] = getRandomValue($subscribed);
    /******************************************/
    // Account created
    $thisUser["createdFake"] = getAccountCreationDate($thisUser["gender"]);
    fwrite($logFileHandle, "<p>The account creation date is: " . $thisUser["createdFake"]);
    /******************************************/
    // emailVerified
    $thisEmail = getEmailVerifiedDate();
    if (!empty($thisEmail)) {
        $thisUser["emailVerified"] = $thisEmail;
    }
    /******************************************/
    $thisUser["isAutogeneratedUser"] = "******";
    /******************************************/
    // Done!
    return $thisUser;
}
<?php

/*
function with multiple parameters
*/
function getBirthday($name, $date)
{
    return 'Your name is ' . $name . ' and your birthday is ' . $date;
}
echo getBirthday('Aaron', 'May 14th, 1987');
Beispiel #4
0
    ?>
"><div class="friend clearFix">
		<div class="profile-picture floater">
				<img src="<?php 
    echo $friend->picture;
    ?>
" class="friendPic"/>
		</div>
        
        <div class="floater bdayInfo">
		<div class="name"><?php 
    echo $friend->name;
    ?>
</div> 
		<div class="birthday"><?php 
    echo getBirthday($friend);
    ?>
</div>    
        </div>
        
        <div class="floater arrow">
        <a href="choose.php?friendID=<?php 
    echo $friend->id;
    ?>
"><img src="/img/arrow.png"/></a>
        </div>
	</div></a>
    <div style="clear:both;"></div>
	<?php 
}
?>
Beispiel #5
0
 /**
  * Loads values
  *
  * @return integer
  */
 function load()
 {
     if ($this->id == 0) {
         return 0;
     }
     $sql = "SELECT *, DATE_FORMAT(date_created, '%d-%m-%Y') AS date_created_dk,\r\n            DATE_FORMAT(dato_start, CONCAT(\r\n                '%d. ',\r\n                ELT(\r\n                    MONTH(dato_start), 'januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'\r\n                ),\r\n                ' %Y'\r\n            )) AS dato_start_dk_streng,\r\n            DATE_FORMAT(dato_slut, CONCAT(\r\n                '%d. ',\r\n                ELT(\r\n                    MONTH(dato_slut), 'januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'\r\n                ),\r\n                ' %Y'\r\n            )) AS dato_slut_dk_streng,\r\n            DATE_FORMAT(dato_start, '%d-%m-%Y') AS dato_start_dk,\r\n            DATE_FORMAT(dato_slut, '%d-%m-%Y') AS dato_slut_dk\r\n            FROM langtkursus_tilmelding\r\n            WHERE id = " . $this->id;
     $db = new DB_Sql();
     $db->query($sql);
     if (!$db->nextRecord()) {
         return 0;
     }
     $this->id = $db->f('id');
     $this->kursus = new VIH_Model_LangtKursus($db->f('kursus_id'));
     if ($db->f('adresse_id') > 0) {
         $adresse = new VIH_Model_Adresse($db->f('adresse_id'));
         // skal lige overskrives, s� den ikke t�mmer arrayet
         $this->value['navn'] = $adresse->get('navn');
         $this->value['adresse'] = $adresse->get('adresse');
         $this->value['postnr'] = $adresse->get('postnr');
         $this->value['postby'] = $adresse->get('postby');
         $this->value['email'] = $adresse->get('email');
         $this->value['mobil'] = $adresse->get('mobil');
         $this->value['telefon'] = $adresse->get('telefon');
         //$this->value['arbejdstelefon'] = $adresse->get('arbejdstelefon');
     }
     $this->value['vaerelse'] = $db->f('vaerelse');
     if ($db->f('kontakt_adresse_id') > 0) {
         $kontakt_adresse = new VIH_Model_Adresse($db->f('kontakt_adresse_id'));
         $this->value['kontakt_navn'] = $kontakt_adresse->get('navn');
         $this->value['kontakt_adresse'] = $kontakt_adresse->get('adresse');
         $this->value['kontakt_postnr'] = $kontakt_adresse->get('postnr');
         $this->value['kontakt_postby'] = $kontakt_adresse->get('postby');
         $this->value['kontakt_email'] = $kontakt_adresse->get('email');
         $this->value['kontakt_mobil'] = $kontakt_adresse->get('mobil');
         $this->value['kontakt_telefon'] = $kontakt_adresse->get('telefon');
         $this->value['kontakt_arbejdstelefon'] = $kontakt_adresse->get('arbejdstelefon');
     }
     $this->value['id'] = $db->f('id');
     $this->value['session_id'] = $db->f('session_id');
     $this->value['kursus_id'] = $db->f('kursus_id');
     $this->value['cpr'] = $db->f('cpr');
     $this->value['birthday'] = getBirthday($db->f('cpr'));
     $this->value['age'] = $this->getAge();
     $this->value['adresse_id'] = $db->f('adresse_id');
     $this->value['kontakt_adresse_id'] = $db->f('kontakt_adresse_id');
     $this->value['kursus_id'] = $db->f('kursus_id');
     $this->value['cpr'] = $db->f('cpr');
     $this->value['besked'] = $db->f('besked');
     $this->value['status_key'] = $db->f('status_key');
     $this->value['status'] = $this->status[$db->f('status_key')];
     $this->value['active'] = $db->f('active');
     if ($db->f('uddannelse')) {
         $this->value['uddannelse'] = $this->uddannelse[$db->f('uddannelse')];
     } else {
         $this->value['uddannelse'] = 'Ingen';
     }
     $this->value['uddannelse_key'] = $db->f('uddannelse');
     $this->value['nationalitet'] = $db->f('nationalitet');
     $this->value['kommune'] = $db->f('kommune');
     $this->value['date_created'] = $db->f('date_created');
     $this->value['date_created_dk'] = $db->f('date_created_dk');
     //$this->value['rabat'] = $db->f('rabat');
     $this->value['kompetencestotte'] = $db->f('kompetencestotte');
     $this->value['elevstotte'] = $db->f('elevstotte');
     $this->value['ugeantal_elevstotte'] = $db->f('ugeantal_elevstotte');
     $this->value['kommunestotte'] = $db->f('kommunestotte');
     $this->value['statsstotte'] = $db->f('statsstotte');
     $this->value['aktiveret_tillaeg'] = $db->f('aktiveret_tillaeg');
     $this->value['pris_afbrudt_ophold'] = $db->f('pris_afbrudt_ophold');
     $this->value['code'] = $db->f('code');
     $this->value['pic_id'] = $db->f('pic_id');
     $this->value['sex'] = $db->f('sex');
     $this->value['ugeantal'] = $db->f('ugeantal');
     $this->value['pris_uge'] = $db->f('pris_uge');
     $this->value['pris_tilmeldingsgebyr'] = $db->f('pris_tilmeldingsgebyr');
     $this->value['dato_start'] = $db->f('dato_start');
     $this->value['dato_start_dk'] = $db->f('dato_start_dk');
     $this->value['dato_start_dk_streng'] = $db->f('dato_start_dk_streng');
     $this->value['dato_slut'] = $db->f('dato_slut');
     $this->value['dato_slut_dk'] = $db->f('dato_slut_dk');
     $this->value['dato_slut_dk_streng'] = $db->f('dato_slut_dk_streng');
     $this->value['pris_materiale'] = $db->f('pris_materiale');
     $this->value['pris_noegledepositum'] = $db->f('pris_noegledepositum');
     $this->value['pris_rejsedepositum'] = $db->f('pris_rejsedepositum');
     $this->value['pris_rejserest'] = (double) $db->f('pris_rejserest');
     $this->value['pris_rejselinje'] = $db->f('pris_rejselinje');
     $this->value['pris_total'] = $this->get('pris_tilmeldingsgebyr') + $this->get("ugeantal") * $this->get("pris_uge") + $this->get("pris_materiale") + $this->get("pris_rejsedepositum") + $this->get("pris_rejselinje") + $this->get("pris_noegledepositum") + $this->get("aktiveret_tillaeg") - $this->get("elevstotte") * $this->get('ugeantal_elevstotte') - $this->get("statsstotte") * $this->get('ugeantal') - $this->get("kompetencestotte") * $this->get('ugeantal') - $this->get('kommunestotte') + $this->get("pris_afbrudt_ophold") + $this->get('pris_rejserest');
     $this->value['betaling_key'] = $db->f('betaling');
     if ($this->value['betaling_key']) {
         $this->value['betaling'] = $this->betaling[$db->f('betaling')];
     } else {
         $this->value['betaling'] = 'Ingen';
     }
     // hvad bruges f*g id til?
     $this->value['fag_id'] = $db->f('fag_id');
     $this->value['tekst_diplom'] = $db->f('tekst_diplom');
     if (empty($this->value['tekst_diplom'])) {
         $this->value['tekst_diplom'] = $this->kursus->get('tekst_diplom');
     }
     if (!$this->get('code')) {
         $db->query("UPDATE langtkursus_tilmelding SET code = '" . vih_random_code(12) . "' WHERE id = " . $this->id);
     }
     return $this->id = $db->f('id');
 }