From e9eb15373faf2d01f5dde7b0db4ee4152e83d338 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Mon, 10 Oct 2011 16:48:38 +0200 Subject: [PATCH] Remove full profile html from php and add new template 'profile_advanced.tpl' --- include/profile_advanced.php | 303 +++++++---------------------------- view/profile_advanced.tpl | 143 +++++++++++++++++ 2 files changed, 205 insertions(+), 241 deletions(-) create mode 100644 view/profile_advanced.tpl 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 .= '

' . t('Profile') . '

'; + $o .= '

' . t('Profile') . '

'; -if($a->profile['name']) { - $lbl_fullname = t('Full Name:'); - $fullname = $a->profile['name']; + if($a->profile['name']) { -$o .= <<< EOT -
-
$lbl_fullname
-
$fullname
-
-
-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 -
-
$lbl_gender
-
$gender
-
-
-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 -
-
$lbl_birthday
-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 .= '
' - . ((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))) - . "
\r\n
"; + if($a->profile['with']) $profile['marital']['with'] = $a->profile['with']; + + + if($a->profile['sexual']) $profile['sexual'] = array( t('Sexual Preference:'), $a->profile['sexual'] ); + + if($a->profile['homepage']) $profile['homepage'] = array( t('Homepage:'), linkify($a->profile['homepage']) ); + + if($a->profile['politic']) $profile['politic'] = array( t('Political Views:'), $a->profile['politic']); + + if($a->profile['religion']) $profile['religion'] = array( t('Religion:'), $a->profile['religion']); + + if($txt = prepare_text($a->profile['about'])) $profile['about'] = array( t('About:'), $txt ); + + if($txt = prepare_text($a->profile['interest'])) $profile['interest'] = array( t('Hobbies/Interests:'), $txt); + + if($txt = prepare_text($a->profile['contact'])) $profile['contact'] = array( t('Contact information and Social Networks:'), $txt); + + 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($txt = prepare_text($a->profile['tv'])) $profile['tv'] = array( t('Television:'), $txt); + + if($txt = prepare_text($a->profile['film'])) $profile['film'] = array( t('Film/dance/culture/entertainment:'), $txt); + + 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['education'])) $profile['education'] = array( t('School/education:'), $txt ); + } + + + return replace_macros($tpl, array( + '$title' => t('Profile'), + '$profile' => $profile, + )); -$o .= '
'; } - -if($age = age($a->profile['dob'],$a->profile['timezone'],'')) { - $lbl_age = t('Age:'); -$o .= <<< EOT -
-
$lbl_age
-
$age
-
-
-EOT; -} - -if($a->profile['marital']) { - $lbl_marital = t(' Status:'); - $marital = $a->profile['marital']; - -$o .= <<< EOT -
-
$lbl_marital
-
$marital
-EOT; - -if($a->profile['with']) { - $with = $a->profile['with']; - $o .= "
($with)
"; -} -$o .= <<< EOT -
-
-EOT; -} - -if($a->profile['sexual']) { - $lbl_sexual = t('Sexual Preference:'); - $sexual = $a->profile['sexual']; - -$o .= <<< EOT -
-
$lbl_sexual
-
$sexual
-
-
-EOT; -} - -if($a->profile['homepage']) { - $lbl_homepage = t('Homepage:'); - $homepage = linkify($a->profile['homepage']); -$o .= <<< EOT -
-
$lbl_homepage
-
$homepage
-
-
-EOT; -} - -if($a->profile['politic']) { - $lbl_politic = t('Political Views:'); - $politic = $a->profile['politic']; -$o .= <<< EOT -
-
$lbl_politic
-
$politic
-
-
-EOT; -} - -if($a->profile['religion']) { - $lbl_religion = t('Religion:'); - $religion = $a->profile['religion']; -$o .= <<< EOT -
-
$lbl_religion
-
$religion
-
-
-EOT; -} -if($txt = prepare_text($a->profile['about'])) { - $lbl_about = t('About:'); -$o .= <<< EOT -
-
$lbl_about
-
-
$txt
-
-
-EOT; -} - -if($txt = prepare_text($a->profile['interest'])) { - $lbl_interests = t('Hobbies/Interests:'); -$o .= <<< EOT -
-
$lbl_interests
-
-
$txt
-
-
-EOT; -} - -if($txt = prepare_text($a->profile['contact'])) { - $lbl_contact = t('Contact information and Social Networks:'); -$o .= <<< EOT -
-
$lbl_contact
-
-
$txt
-
-
-EOT; -} - -if($txt = prepare_text($a->profile['music'])) { - $lbl_music = t('Musical interests:'); -$o .= <<< EOT -
-
$lbl_music
-
-
$txt
-
-
-EOT; -} - -if($txt = prepare_text($a->profile['book'])) { - $lbl_book = t('Books, literature:'); -$o .= <<< EOT -
-
$lbl_book
-
-
$txt
-
-
-EOT; -} - -if($txt = prepare_text($a->profile['tv'])) { - $lbl_tv = t('Television:'); -$o .= <<< EOT -
-
$lbl_tv
-
-
$txt
-
-
-EOT; -} - -if($txt = prepare_text($a->profile['film'])) { - $lbl_film = t('Film/dance/culture/entertainment:'); -$o .= <<< EOT -
-
$lbl_film
-
-
$txt
-
-
-EOT; -} - -if($txt = prepare_text($a->profile['romance'])) { - $lbl_romance = t('Love/Romance:'); -$o .= <<< EOT -
-
$lbl_romance
-
-
$txt
-
-
-EOT; -} - -if($txt = prepare_text($a->profile['work'])) { - $lbl_work = t('Work/employment:'); -$o .= <<< EOT -
-
$lbl_work
-
-
$txt
-
-
-EOT; -} - -if($txt = prepare_text($a->profile['education'])) { - $lbl_education = t('School/education:'); -$o .= <<< EOT -
-
$lbl_education
-
-
$txt
-
-
-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 @@ +

$title

+ +
+
$profile.fullname.0
+
$profile.fullname.1
+
+ +{{ if $profile.gender }} +
+
$profile.gender.0
+
$profile.gender.1
+
+{{ endif }} + +{{ if $profile.birthday }} +
+
$profile.birthday.0
+
$profile.birthday.1
+
+{{ endif }} + +{{ if $profile.age }} +
+
$profile.age.0
+
$profile.age.1
+
+{{ endif }} + +{{ if $profile.marital }} +
+
$profile.marital.0
+
$profile.marital.1 {{ if $profile.marital.with }}($profile.marital.with){{ endif }}
+
+{{ endif }} + +{{ if $profile.sexual }} +
+
$profile.sexual.0
+
$profile.sexual.1
+
+{{ endif }} + +{{ if $profile.homepage }} +
+
$profile.homepage.0
+
$profile.homepage.1
+
+{{ endif }} + +{{ if $profile.politic }} +
+
$profile.politic.0
+
$profile.politic.1
+
+{{ endif }} + +{{ if $profile.religion }} +
+
$profile.religion.0
+
$profile.religion.1
+
+{{ endif }} + +{{ if $profile.about }} +
+
$profile.about.0
+
$profile.about.1
+
+{{ endif }} + +{{ if $profile.interest }} +
+
$profile.interest.0
+
$profile.interest.1
+
+{{ endif }} + + +{{ if $profile.contact }} +
+
$profile.contact.0
+
$profile.contact.1
+
+{{ endif }} + + +{{ if $profile.music }} +
+
$profile.music.0
+
$profile.music.1
+
+{{ endif }} + + +{{ if $profile.book }} +
+
$profile.book.0
+
$profile.book.1
+
+{{ endif }} + + +{{ if $profile.tv }} +
+
$profile.tv.0
+
$profile.tv.1
+
+{{ endif }} + + +{{ if $profile.film }} +
+
$profile.film.0
+
$profile.film.1
+
+{{ endif }} + + +{{ if $profile.romance }} +
+
$profile.romance.0
+
$profile.romance.1
+
+{{ endif }} + + +{{ if $profile.work }} +
+
$profile.work.0
+
$profile.work.1
+
+{{ endif }} + +{{ if $profile.education }} +
+
$profile.education.0
+
$profile.education.1
+
+{{ endif }} + + + +