diff options
-rw-r--r-- | include/profile_advanced.php | 275 | ||||
-rw-r--r-- | view/profile_advanced.tpl | 143 |
2 files changed, 191 insertions, 227 deletions
diff --git a/include/profile_advanced.php b/include/profile_advanced.php index 22e035fe6..ccecb95de 100644 --- a/include/profile_advanced.php +++ b/include/profile_advanced.php @@ -2,257 +2,78 @@ function advanced_profile(&$a) { -$o .= ''; + $o .= ''; -$o .= '<h2>' . t('Profile') . '</h2>'; + $o .= '<h2>' . t('Profile') . '</h2>'; -if($a->profile['name']) { - $lbl_fullname = t('Full Name:'); - $fullname = $a->profile['name']; + if($a->profile['name']) { -$o .= <<< EOT -<div id="advanced-profile-name-wrapper" > -<div id="advanced-profile-name-text" class="advanced-profile-label">$lbl_fullname</div> -<div id="advanced-profile-name" class="advanced-profile-content">$fullname</div> -</div> -<div id="advanced-profile-name-end"></div> -EOT; -} + $tpl = get_markup_template('profile_advanced.tpl'); + + $profile = array(); + + $profile['fullname'] = array( t('Full Name:'), $a->profile['name'] ) ; + + if($a->profile['gender']) $profile['gender'] = array( t('Gender:'), $a->profile['gender'] ); + -if($a->profile['gender']) { - $lbl_gender = t('Gender:'); - $gender = $a->profile['gender']; + if(($a->profile['dob']) && ($a->profile['dob'] != '0000-00-00')) { + + $year_bd_format = t('j F, Y'); + $short_bd_format = t('j F'); -$o .= <<< EOT -<div id="advanced-profile-gender-wrapper" > -<div id="advanced-profile-gender-text" class="advanced-profile-label">$lbl_gender</div> -<div id="advanced-profile-gender" class="advanced-profile-content">$gender</div> -</div> -<div id="advanced-profile-gender-end"></div> -EOT; -} + + $val = ((intval($a->profile['dob'])) + ? day_translate(datetime_convert('UTC','UTC',$a->profile['dob'] . ' 00:00 +00:00',$year_bd_format)) + : day_translate(datetime_convert('UTC','UTC','2001-' . substr($a->profile['dob'],6) . ' 00:00 +00:00',$short_bd_format))); + + $profile['birthday'] = array( t('Birthday:'), $val); -if(($a->profile['dob']) && ($a->profile['dob'] != '0000-00-00')) { - $lbl_birthday = t('Birthday:'); + } -$o .= <<< EOT -<div id="advanced-profile-dob-wrapper" > -<div id="advanced-profile-dob-text" class="advanced-profile-label">$lbl_birthday</div> -EOT; + if($age = age($a->profile['dob'],$a->profile['timezone'],'')) $profile['age'] = array( t('Age:'), $age ); + -// If no year, add an arbitrary one so just we can parse the month and day. + if($a->profile['marital']) $profile['marital'] = array( t('Status:'), $a->profile['marital']); -$year_bd_format = t('j F, Y'); -$short_bd_format = t('j F'); -$o .= '<div id="advanced-profile-dob" class="advanced-profile-content">' - . ((intval($a->profile['dob'])) - ? day_translate(datetime_convert('UTC','UTC',$a->profile['dob'] . ' 00:00 +00:00',$year_bd_format)) - : day_translate(datetime_convert('UTC','UTC','2001-' . substr($a->profile['dob'],6) . ' 00:00 +00:00',$short_bd_format))) - . "</div>\r\n</div>"; + if($a->profile['with']) $profile['marital']['with'] = $a->profile['with']; -$o .= '<div id="advanced-profile-dob-end"></div>'; -} + if($a->profile['sexual']) $profile['sexual'] = array( t('Sexual Preference:'), $a->profile['sexual'] ); -if($age = age($a->profile['dob'],$a->profile['timezone'],'')) { - $lbl_age = t('Age:'); -$o .= <<< EOT -<div id="advanced-profile-age-wrapper" > -<div id="advanced-profile-age-text" class="advanced-profile-label">$lbl_age</div> -<div id="advanced-profile-age" class="advanced-profile-content">$age</div> -</div> -<div id="advanced-profile-age-end"></div> -EOT; -} + if($a->profile['homepage']) $profile['homepage'] = array( t('Homepage:'), linkify($a->profile['homepage']) ); -if($a->profile['marital']) { - $lbl_marital = t('<span class="heart">♥</span> Status:'); - $marital = $a->profile['marital']; + if($a->profile['politic']) $profile['politic'] = array( t('Political Views:'), $a->profile['politic']); -$o .= <<< EOT -<div id="advanced-profile-marital-wrapper" > -<div id="advanced-profile-marital-text" class="advanced-profile-label">$lbl_marital</div> -<div id="advanced-profile-marital" class="advanced-profile-content">$marital</div> -EOT; + if($a->profile['religion']) $profile['religion'] = array( t('Religion:'), $a->profile['religion']); -if($a->profile['with']) { - $with = $a->profile['with']; - $o .= "<div id=\"advanced-profile-with\">($with)</div>"; -} -$o .= <<< EOT -</div> -<div id="advanced-profile-marital-end"></div> -EOT; -} + if($txt = prepare_text($a->profile['about'])) $profile['about'] = array( t('About:'), $txt ); -if($a->profile['sexual']) { - $lbl_sexual = t('Sexual Preference:'); - $sexual = $a->profile['sexual']; + if($txt = prepare_text($a->profile['interest'])) $profile['interest'] = array( t('Hobbies/Interests:'), $txt); -$o .= <<< EOT -<div id="advanced-profile-sexual-wrapper" > -<div id="advanced-profile-sexual-text" class="advanced-profile-label">$lbl_sexual</div> -<div id="advanced-profile-sexual" class="advanced-profile-content">$sexual</div> -</div> -<div id="advanced-profile-sexual-end"></div> -EOT; -} + if($txt = prepare_text($a->profile['contact'])) $profile['contact'] = array( t('Contact information and Social Networks:'), $txt); -if($a->profile['homepage']) { - $lbl_homepage = t('Homepage:'); - $homepage = linkify($a->profile['homepage']); -$o .= <<< EOT -<div id="advanced-profile-homepage-wrapper" > -<div id="advanced-profile-homepage-text" class="advanced-profile-label">$lbl_homepage</div> -<div id="advanced-profile-homepage" class="advanced-profile-content">$homepage</div> -</div> -<div id="advanced-profile-homepage-end"></div> -EOT; -} + if($txt = prepare_text($a->profile['music'])) $profile['music'] = array( t('Musical interests:'), $txt); + + if($txt = prepare_text($a->profile['book'])) $profile['book'] = array( t('Books, literature:'), $txt); -if($a->profile['politic']) { - $lbl_politic = t('Political Views:'); - $politic = $a->profile['politic']; -$o .= <<< EOT -<div id="advanced-profile-politic-wrapper" > -<div id="advanced-profile-politic-text" class="advanced-profile-label">$lbl_politic</div> -<div id="advanced-profile-politic" class="advanced-profile-content">$politic</div> -</div> -<div id="advanced-profile-politic-end"></div> -EOT; -} + if($txt = prepare_text($a->profile['tv'])) $profile['tv'] = array( t('Television:'), $txt); -if($a->profile['religion']) { - $lbl_religion = t('Religion:'); - $religion = $a->profile['religion']; -$o .= <<< EOT -<div id="advanced-profile-religion-wrapper" > -<div id="advanced-profile-religion-text" class="advanced-profile-label">$lbl_religion</div> -<div id="advanced-profile-religion" class="advanced-profile-content">$religion</div> -</div> -<div id="advanced-profile-religion-end"></div> -EOT; -} -if($txt = prepare_text($a->profile['about'])) { - $lbl_about = t('About:'); -$o .= <<< EOT -<div id="advanced-profile-about-wrapper" > -<div id="advanced-profile-about-text" class="advanced-profile-label">$lbl_about</div> -<br /> -<div id="advanced-profile-about" class="advanced-profile-content">$txt</div> -</div> -<div id="advanced-profile-about-end"></div> -EOT; -} + if($txt = prepare_text($a->profile['film'])) $profile['film'] = array( t('Film/dance/culture/entertainment:'), $txt); -if($txt = prepare_text($a->profile['interest'])) { - $lbl_interests = t('Hobbies/Interests:'); -$o .= <<< EOT -<div id="advanced-profile-interest-wrapper" > -<div id="advanced-profile-interest-text" class="advanced-profile-label">$lbl_interests</div> -<br /> -<div id="advanced-profile-interest" class="advanced-profile-content">$txt</div> -</div> -<div id="advanced-profile-interest-end"></div> -EOT; -} + if($txt = prepare_text($a->profile['romance'])) $profile['romance'] = array( t('Love/Romance:'), $txt); + + if($txt = prepare_text($a->profile['work'])) $profile['work'] = array( t('Work/employment:'), $txt); -if($txt = prepare_text($a->profile['contact'])) { - $lbl_contact = t('Contact information and Social Networks:'); -$o .= <<< EOT -<div id="advanced-profile-contact-wrapper" > -<div id="advanced-profile-contact-text" class="advanced-profile-label">$lbl_contact</div> -<br /> -<div id="advanced-profile-contact" class="advanced-profile-content">$txt</div> -</div> -<div id="advanced-profile-contact-end"></div> -EOT; -} + if($txt = prepare_text($a->profile['education'])) $profile['education'] = array( t('School/education:'), $txt ); + } -if($txt = prepare_text($a->profile['music'])) { - $lbl_music = t('Musical interests:'); -$o .= <<< EOT -<div id="advanced-profile-music-wrapper" > -<div id="advanced-profile-music-text" class="advanced-profile-label">$lbl_music</div> -<br /> -<div id="advanced-profile-music" class="advanced-profile-content">$txt</div> -</div> -<div id="advanced-profile-music-end"></div> -EOT; -} - -if($txt = prepare_text($a->profile['book'])) { - $lbl_book = t('Books, literature:'); -$o .= <<< EOT -<div id="advanced-profile-book-wrapper" > -<div id="advanced-profile-book-text" class="advanced-profile-label">$lbl_book</div> -<br /> -<div id="advanced-profile-book" class="advanced-profile-content">$txt</div> -</div> -<div id="advanced-profile-book-end"></div> -EOT; -} - -if($txt = prepare_text($a->profile['tv'])) { - $lbl_tv = t('Television:'); -$o .= <<< EOT -<div id="advanced-profile-tv-wrapper" > -<div id="advanced-profile-tv-text" class="advanced-profile-label">$lbl_tv</div> -<br /> -<div id="advanced-profile-tv" class="advanced-profile-content">$txt</div> -</div> -<div id="advanced-profile-tv-end"></div> -EOT; -} - -if($txt = prepare_text($a->profile['film'])) { - $lbl_film = t('Film/dance/culture/entertainment:'); -$o .= <<< EOT -<div id="advanced-profile-film-wrapper" > -<div id="advanced-profile-film-text" class="advanced-profile-label">$lbl_film</div> -<br /> -<div id="advanced-profile-film" class="advanced-profile-content">$txt</div> -</div> -<div id="advanced-profile-film-end"></div> -EOT; -} - -if($txt = prepare_text($a->profile['romance'])) { - $lbl_romance = t('Love/Romance:'); -$o .= <<< EOT -<div id="advanced-profile-romance-wrapper" > -<div id="advanced-profile-romance-text" class="advanced-profile-label">$lbl_romance</div> -<br /> -<div id="advanced-profile-romance" class="advanced-profile-content">$txt</div> -</div> -<div id="advanced-profile-romance-end"></div> -EOT; -} + + return replace_macros($tpl, array( + '$title' => t('Profile'), + '$profile' => $profile, + )); -if($txt = prepare_text($a->profile['work'])) { - $lbl_work = t('Work/employment:'); -$o .= <<< EOT -<div id="advanced-profile-work-wrapper" > -<div id="advanced-profile-work-text" class="advanced-profile-label">$lbl_work</div> -<br /> -<div id="advanced-profile-work" class="advanced-profile-content">$txt</div> -</div> -<div id="advanced-profile-work-end"></div> -EOT; -} - -if($txt = prepare_text($a->profile['education'])) { - $lbl_education = t('School/education:'); -$o .= <<< EOT -<div id="advanced-profile-education-wrapper" > -<div id="advanced-profile-education-text" class="advanced-profile-label">$lbl_education</div> -<br /> -<div id="advanced-profile-education" class="advanced-profile-content">$txt</div> -</div> -<div id="advanced-profile-education-end"></div> -EOT; -} -return $o; } diff --git a/view/profile_advanced.tpl b/view/profile_advanced.tpl new file mode 100644 index 000000000..136edf8d7 --- /dev/null +++ b/view/profile_advanced.tpl @@ -0,0 +1,143 @@ +<h2>$title</h2> + +<dl> + <dt>$profile.fullname.0</dt> + <dd>$profile.fullname.1</dd> +</dl> + +{{ if $profile.gender }} +<dl> + <dt>$profile.gender.0</dt> + <dd>$profile.gender.1</dd> +</dl> +{{ endif }} + +{{ if $profile.birthday }} +<dl> + <dt>$profile.birthday.0</dt> + <dd>$profile.birthday.1</dd> +</dl> +{{ endif }} + +{{ if $profile.age }} +<dl> + <dt>$profile.age.0</dt> + <dd>$profile.age.1</dd> +</dl> +{{ endif }} + +{{ if $profile.marital }} +<dl> + <dt><span class="heart">♥</span> $profile.marital.0</dt> + <dd>$profile.marital.1 {{ if $profile.marital.with }}($profile.marital.with){{ endif }}</dd> +</dl> +{{ endif }} + +{{ if $profile.sexual }} +<dl> + <dt>$profile.sexual.0</dt> + <dd>$profile.sexual.1</dd> +</dl> +{{ endif }} + +{{ if $profile.homepage }} +<dl> + <dt>$profile.homepage.0</dt> + <dd>$profile.homepage.1</dd> +</dl> +{{ endif }} + +{{ if $profile.politic }} +<dl> + <dt>$profile.politic.0</dt> + <dd>$profile.politic.1</dd> +</dl> +{{ endif }} + +{{ if $profile.religion }} +<dl> + <dt>$profile.religion.0</dt> + <dd>$profile.religion.1</dd> +</dl> +{{ endif }} + +{{ if $profile.about }} +<dl> + <dt>$profile.about.0</dt> + <dd>$profile.about.1</dd> +</dl> +{{ endif }} + +{{ if $profile.interest }} +<dl> + <dt>$profile.interest.0</dt> + <dd>$profile.interest.1</dd> +</dl> +{{ endif }} + + +{{ if $profile.contact }} +<dl> + <dt>$profile.contact.0</dt> + <dd>$profile.contact.1</dd> +</dl> +{{ endif }} + + +{{ if $profile.music }} +<dl> + <dt>$profile.music.0</dt> + <dd>$profile.music.1</dd> +</dl> +{{ endif }} + + +{{ if $profile.book }} +<dl> + <dt>$profile.book.0</dt> + <dd>$profile.book.1</dd> +</dl> +{{ endif }} + + +{{ if $profile.tv }} +<dl> + <dt>$profile.tv.0</dt> + <dd>$profile.tv.1</dd> +</dl> +{{ endif }} + + +{{ if $profile.film }} +<dl> + <dt>$profile.film.0</dt> + <dd>$profile.film.1</dd> +</dl> +{{ endif }} + + +{{ if $profile.romance }} +<dl> + <dt>$profile.romance.0</dt> + <dd>$profile.romance.1</dd> +</dl> +{{ endif }} + + +{{ if $profile.work }} +<dl> + <dt>$profile.work.0</dt> + <dd>$profile.work.1</dd> +</dl> +{{ endif }} + +{{ if $profile.education }} +<dl> + <dt>$profile.education.0</dt> + <dd>$profile.education.1</dd> +</dl> +{{ endif }} + + + + |