Commit 6ede11c0 authored by Sebastian Kotte's avatar Sebastian Kotte

[FEATURE] add Configuration and Templates for userprofile list

parent 401e3f65
File added
<?php
declare(strict_types = 1);
namespace T3o\T3omy\ViewHelpers;
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
* Class IsSlackOnlineViewhelper
* @package T3o\T3omy\ViewHelpers
*/
class IsSlackOnlineViewhelper extends AbstractViewHelper
{
/**
* @var \T3o\T3oSlack\Domain\Repository\SlackUserRepository
* @inject
*/
public $slackUserRepository;
/**
* Check if a property of the userprofile is visible in the current context
*
* @param int $frontendUserUID
* @return string
*/
public function render(int $frontendUserUID)
{
$feUser = $this->slackFrontendUserRepository->findByUid($frontendUserUID);
$slackUser = $this->slackUserRepository->findBySlackId($feUser->getSlackId());
if ($slackUser) {
if ($slackUser->getPresence() === 'active') {
$content = '<a href="https://typo3.slack.com/messages/' . $slackUser->getLink() . '" target="_blank">' . $slackUser->getSlackUserName() . ' </a> Realname: ' . $slackUser->getRealName() . ' status: ' . $slackUser->getPresence();
} else {
$content = 'Slack username: ' . $slackUser->getSlackUserName() . ' Realname: ' . $slackUser->getRealName() . ' status: ' . $slackUser->getPresence();
}
} else {
// @todo render link to register for slack
if ($GLOBALS['TSFE']->fe_user->user['uid'] == $frontendUserUID) {
// @todo add TS configuration
$content = '<a href="https://my.typo3.org/?id=23">Get your TYPO3 Slack Account</a>';
} else {
$content = 'No Slack profile yet';
}
}
return $content;
}
}
\ No newline at end of file
......@@ -3,6 +3,9 @@ plugin.tx_userprofile {
templateRootPaths {
20 = EXT:t3omy/Resources/Private/Templates/UserProfile/
}
partialRootPaths {
20 = EXT:t3omy/Resources/Private/Partials/UserProfile/
}
}
settings {
privacy {
......
{namespace userprofile=In2code\Userprofile\ViewHelpers}
{namespace slack=T3o\T3oSlack\ViewHelpers}
<f:debug>{frontendUser}</f:debug>
<f:link.action class="user-box" controller="UserProfile" action="show" arguments="{user:frontendUser}">
<div class="user-box-image ">
<f:if condition="{frontendUser.image} AND {userprofile:isPropertyVisible(propertyName: 'image', user: '{frontendUser}')}">
<f:then>
<f:for each="{frontendUser.image}" as="file" iteration="iter">
<f:if condition="{iter.isFirst}">
<f:media class="img-fluid rounded-circle"
file="{file}"
width="150px"
height="150px"
alt="{file.alternative}"
title="{file.title}" />
</f:if>
</f:for>
</f:then>
<f:else>
<f:image class="img-fluid rounded-circle"
src="EXT:t3omy/Resources/Public/Images/UserProfile/UserProfile-Blank.svg"
width="150px"
height="150px"
alt="User Image Placeholder"/>
</f:else>
</f:if>
</div>
<div class="user-box-text ">
<f:if condition="{frontendUser.name} AND {userprofile:isPropertyVisible(propertyName: 'name', user: '{frontendUser}')}">
<h4 class="user-box-text__name text-uppercase text-large">{frontendUser.name}</h4>
{f:variable(name:"hasHeading", value:"1")}
</f:if>
<f:if condition="{frontendUser.company} AND {userprofile:isPropertyVisible(propertyName: 'company', user: '{frontendUser}')}">
<h5 class="user-box-text__company text-large">{frontendUser.company}</h5>
{f:variable(name:"hasHeading", value:"1")}
</f:if>
<f:if condition="{hasHeading} == 1">
<hr class="hr">
</f:if>
<f:if condition="{frontendUser.email} AND {userprofile:isPropertyVisible(propertyName: 'email', user: '{frontendUser}')}">
<div class="user-box-text__icon">
<i class="fa fa-envelope"></i>
<span>{frontendUser.email}</span>
</div>
</f:if>
<f:if condition="{frontendUser.telephone} AND {userprofile:isPropertyVisible(propertyName: 'telephone', user: '{frontendUser}')}">
<div class="user-box-text__icon">
<i class="fa fa-phone"></i>
<span>{frontendUser.telephone}</span>
</div>
</f:if>
</div>
<f:if condition="userprofile.isSlackOnline">
<div class="user-box-badge slack-online">
<i class="fa fa-2x fa-slack" aria-hidden="true"></i>
</div>
</f:if>
</f:link.action>
<section class="container">
<h1>Our community</h1>
<f:debug>{frontendUsers}</f:debug>
<table>
<div class="row">
<f:for each="{frontendUsers}" as="frontendUser">
<f:if condition="{frontendUser.publicProfile}">
<tr>
<td><f:link.action controller="UserProfile" action="show" arguments="{user:frontendUser}">{frontendUser.username}</f:link.action></td>
</tr>
<div class="col-lg-6">
<f:render partial="ListUser" arguments="{_all}"/>
</div>
</f:if>
</f:for>
</table>
</div>
</section>
<?xml version="1.0" encoding="UTF-8"?>
<svg width="120px" height="120px" viewBox="0 0 120 120" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 53 (72520) - https://sketchapp.com -->
<title>Shape</title>
<desc>Created with Sketch.</desc>
<g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="member-list/box/no-member-picture" transform="translate(-19.000000, -18.000000)" fill="#515151" fill-rule="nonzero">
<g id="picture" transform="translate(19.000000, 18.000000)">
<g id="user-circle">
<path d="M60,0 C26.8548387,0 0,26.8548387 0,60 C0,93.1451613 26.8548387,120 60,120 C93.1451613,120 120,93.1451613 120,60 C120,26.8548387 93.1451613,0 60,0 Z M60,23.2258065 C71.7580645,23.2258065 81.2903226,32.7580645 81.2903226,44.516129 C81.2903226,56.2741935 71.7580645,65.8064516 60,65.8064516 C48.2419355,65.8064516 38.7096774,56.2741935 38.7096774,44.516129 C38.7096774,32.7580645 48.2419355,23.2258065 60,23.2258065 Z M60,106.451613 C45.7983871,106.451613 33.0725806,100.016129 24.5564516,89.9516129 C29.1048387,81.3870968 38.0080645,75.483871 48.3870968,75.483871 C48.9677419,75.483871 49.5483871,75.5806452 50.1048387,75.75 C53.25,76.766129 56.5403226,77.4193548 60,77.4193548 C63.4596774,77.4193548 66.7741935,76.766129 69.8951613,75.75 C70.4516129,75.5806452 71.0322581,75.483871 71.6129032,75.483871 C81.9919355,75.483871 90.8951613,81.3870968 95.4435484,89.9516129 C86.9274194,100.016129 74.2016129,106.451613 60,106.451613 Z" id="Shape"></path>
</g>
</g>
</g>
</g>
</svg>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment