diff --git a/2019/include/functions.php b/2019/include/class-UserSocialBox.php similarity index 51% copy from 2019/include/functions.php copy to 2019/include/class-UserSocialBox.php index 05c0dfa..345818b 100644 --- a/2019/include/functions.php +++ b/2019/include/class-UserSocialBox.php @@ -1,27 +1,44 @@ . /** - * Require a certain page from the template directory - * - * @param $name string page name (to be sanitized) - * @param $args mixed arguments to be passed to the page scope + * Rappresent an User Social Box */ -function template( $template_name, $template_args = [] ) { - extract( $template_args, EXTR_SKIP ); - return require CURRENT_CONFERENCE_ABSPATH . "/template/$template_name.php"; +class UserSocialBox { + + /** + * Spawn a social box + * + * @param string $user User + * @param string $social string Social title + * @param string $profile string Profile URL + * @param string $path string Icon path + * @param boolean $is_icon + */ + public static function spawn( $user, $social, $profile, $path, $is_icon = false ) { + + // call the related template + template( 'user-social-box', [ + 'user' => $user, + 'social' => $social, + 'profile' => $profile, + 'path' => $path, + 'is_icon' => $is_icon, + ] ); + } + } diff --git a/2019/include/functions.php b/2019/include/functions.php index 05c0dfa..fedead9 100644 --- a/2019/include/functions.php +++ b/2019/include/functions.php @@ -1,27 +1,42 @@ . /** * Require a certain page from the template directory * * @param $name string page name (to be sanitized) * @param $args mixed arguments to be passed to the page scope */ function template( $template_name, $template_args = [] ) { extract( $template_args, EXTR_SKIP ); return require CURRENT_CONFERENCE_ABSPATH . "/template/$template_name.php"; } + +/** + * Return a Materialize icon tag + * + * @param string $icon Icon name + * @param string $c Additional class name + */ +function icon( $icon = 'send', $c = null ) { + if( $c !== null ) { + $c = " $c"; + } else { + $c = ''; + } + return "$icon"; +} diff --git a/2019/template/user-social-box.php b/2019/template/user-social-box.php new file mode 100644 index 0000000..d8ab48d --- /dev/null +++ b/2019/template/user-social-box.php @@ -0,0 +1,50 @@ +. + +/* + * This is the template for an user social box + */ + +/* + * Args that should be passed: + * + * $user User + * $social string Social title + * $profile string Profile URL + * $path string Icon path + * $is_icon + */ + +// do not visit directly +defined( 'ABSPATH' ) or exit; +?> + +
+ getUserFullname(), + $social + ); + + $logo = $is_icon + ? icon( $path ) + : HTML::img( ROOT . "/2016/static/social/$path", $social, $title, 'responsive-img' ); + + echo HTML::a( $profile, $logo, $title, null, 'target="_blank" rel="noreferrer nofollow"' ); + ?> +
diff --git a/2019/user.php b/2019/user.php new file mode 100644 index 0000000..26506a1 --- /dev/null +++ b/2019/user.php @@ -0,0 +1,253 @@ +. + +require 'load.php'; + +$conference = FullConference::factoryFromUID( CURRENT_CONFERENCE_UID ) + ->queryRow(); + +$conference or die_with_404(); + +$user = User::factoryByUID( $_GET['uid'] ) + ->queryRow(); + +$user or die_with_404(); + +FORCE_PERMALINK && $user->forceUserPermalink(); + +template( 'header', [ + 'conference' => $conference, + 'title' => $user->getUserFullname(), + 'url' => $user->getUserURL(), + 'og' => [ + 'image' => $user->getUserImage(), + 'type' => 'profile', + 'profile:first_name' => $user->user_name, + 'profile:last_name' => $user->user_surname + ] +] ); +?> + hasPermissionToEditUser() ): ?> +

getUserUID()}", + __("Modifica") . icon('edit', 'left') + ) ?>

+ + +
+ + +
+
+
+ has( User::WEBSITE ) ): ?> + + + <?php
+							echo esc_attr( $user->getUserFullname() )
+						?> + has( User::WEBSITE ) ): ?> + + +
+
+ + + user_site ): ?> +
+
+

user_site, + __("Sito personale") . icon('contact_mail', 'right'), + null, + 'btn waves-effect purple darken-2', + 'target="_blank"' + ) ?>

+
+
+ + +
+ + + +
+ + + factoryUserSkills() + ->queryGenerator(); + ?> + valid() ): ?> +
+
+

+ +
getSkillCode() ?>
+ +
+
+ + + + + hasUserLovelicense() ): ?> +
+
+ getUserLovelicense() ?> +

%s."), + $license->getLink() + ) ?>

+
+
+ + + +
+ +
+ + + hasUserBio() ): ?> +
+
+

+ getUserBioHTML( ['p' => 'flow-text'] ) ?> +
+ + + +
+ +
+

+ + whereConference( $conference ) + ->whereUser( $user ) + ->joinTrackChapterRoom() + ->queryGenerator(); + ?> + valid() ): ?> + + + + + + + + + + + + + + + + + + + + + +
getEventURL(), + sprintf( + "%s", + esc_html( $title = $event->getEventTitle() ) + ), + sprintf( + __("Vedi %s"), + $title + ) + ) ?>getChapterName() ) ?>getTrackName() ) ?> + + getLocationName() ) ?> +
+ getRoomName() ) ?> +
+ %s (il %s)"), + $event->getEventStart("H:i"), + $event->getEventStart("d/m/Y") + ) ?>
+ getEventHumanStart() ?> +
+ +

+ +
+ + joinLocation() + ->whereConferenceNot( $conference ) + ->whereUser( $user ) + ->orderBy( Event::START, 'DESC' ) + ->queryGenerator(); + ?> + valid() ): ?> +
+

+ + + + + + + + + + + +
getEventTitle() ) ?>getConferenceTitle() ) ?> + + getLocationName() ) ?> +
+
+ %s (il %s)"), + $event->getEventStart("H:i"), + $event->getEventStart("d/m/Y") + ) ?>
+ getEventHumanStart() ?> +
+
+ + + + isUserSocial() ): ?> +
+
+

+
+ has( User::RSS ) and UserSocialBox::spawn( $user, "RSS", $user->get( User::RSS ), 'home.png' ); + $user->has( User::FACEBOOK ) and UserSocialBox::spawn( $user, "Facebook", $user->getUserFacebruck(), 'facebook_logo.png' ); + $user->has( User::GOOGLE_PLUS ) and UserSocialBox::spawn( $user, "Google+", $user->getUserGuggolpluz(), 'google.png' ); + $user->has( User::TWITTER ) and UserSocialBox::spawn( $user, "Twitter", $user->getUserTuitt(), 'twitter.png' ); + $user->has( User::LINKEDIN ) and UserSocialBox::spawn( $user, "Linkedin", $user->getUserLinkeddon(), 'linkedin.png' ); + $user->has( User::GITHUB ) and UserSocialBox::spawn( $user, "Github", $user->getUserGithubbo(), 'github.png' ); + ?> +
+
+ + +