persons rough rendering + click functionality

This commit is contained in:
Ulf Gebhardt 2019-08-25 20:18:27 +02:00
parent a335f8a66c
commit b5bf9246b2
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD
7 changed files with 85 additions and 47 deletions

View File

@ -16,6 +16,46 @@ class default_page implements \SYSTEM\PAGE\DefaultPage {
new PPAGE('default_page/css/default_page.scss')
)));
}
private static function getPersons(){
$result = '';
$column_counter = 0;
$_content_persons_imgs = '';
$_content_persons_details = '';
$persons = \SQL\SELECT_PERSONS::QQ();
$person_badges = \SQL\SELECT_PERSON_BADGES::QA(); // This part we filter phpside due to performance.
while($row = $persons->next()){
$badges = array_filter($person_badges, function($v)use($row){return $v['person'] == $row['id'];});
$row['badges'] = '';
foreach($badges as $badge){
$row['badges'] .= \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_page/tpl/person_badge.tpl'))->SERVERPATH(),$badge);
}
$_content_persons_imgs .= \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_page/tpl/person_img.tpl'))->SERVERPATH(),$row);
$_content_persons_details .= \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_page/tpl/person_details.tpl'))->SERVERPATH(),$row);
// Insert full row and start a new row
if($column_counter++ === 2){
$result .= \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_page/tpl/persons_row.tpl'))->SERVERPATH(),
array( '_content_persons_imgs' => $_content_persons_imgs,
'_content_persons_details' => $_content_persons_details));
$column_counter = 0;
$_content_persons_imgs = '';
$_content_persons_details = '';
}
}
// Insert incomplete rows
if($column_counter != 0){
$result .= \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_page/tpl/persons_row.tpl'))->SERVERPATH(),
array( '_content_persons_imgs' => $_content_persons_imgs,
'_content_persons_details' => $_content_persons_details));
}
return $result;
}
public function html($_escaped_fragment_ = null){
$vars = array();
@ -23,7 +63,8 @@ class default_page implements \SYSTEM\PAGE\DefaultPage {
if(!$_escaped_fragment_){
$vars['js'] = self::js();}
$vars['css'] = self::css();
$vars['_content_persons'] = \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_page/tpl/content_persons.tpl'))->SERVERPATH());
//$vars['_content_persons'] = \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_page/tpl/content_persons.tpl'))->SERVERPATH());
$vars['_content_persons'] = self::getPersons();
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('wecker_manufaktur'));
return \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_page/tpl/default_page.tpl'))->SERVERPATH(), $vars);
}

View File

@ -1,3 +1,12 @@
$(document).ready(function() {
new SYSTEM('./api.php',1,'start');
//new SYSTEM('./api.php',1,'start');
$('.person-link').click(function(e){
e.preventDefault();
$person = $(this).attr('person');
$isHidden = $('#person-details-'+$person).hasClass('d-none');
$('.person-details').addClass('d-none');
if($isHidden){
$('#person-details-'+$person).removeClass('d-none');
}
})
});

View File

@ -1,45 +0,0 @@
<div class="row">
<div class="col-lg-4">
<div>
<img src="https://www.democracy-deutschland.de/files/wir/Ulf2.png" class="rounded-circle" alt="Cinque Terre" style="object-fit: cover; width: 300px; height: 300px;">
</div>
<div>
<a href="#">Peter Zwegat <i class="fa fa-angle-down"></i></a>
</div>
</div>
<div class="col-12" style="text-align: left;">
<div>
<table class="table table-borderless">
<tr>
<th scope="row">Talente</th>
<td>
<span class="badge badge-primary">Primary</span>
<span class="badge badge-secondary">Secondary</span>
<span class="badge badge-success">Success</span>
<span class="badge badge-danger">Danger</span>
<span class="badge badge-warning">Warning</span>
<span class="badge badge-info">Info</span>
<span class="badge badge-light">Light</span>
<span class="badge badge-dark">Dark</span>
</td>
</tr>
<tr>
<th scope="row">Kurzinfo</th>
<td>
Peter Zwegat wuchs in Berlin-Pankow auf. Seine Eltern verließen mit ihm und seinen beiden Geschwistern die DDR, als er 10 Jahre alt war.[1] Nach einer Ausbildung zum Verwaltungsbeamten studierte er von 1970 bis 1974 Sozialpädagogik an einer Fachhochschule und schloss als Diplom-Sozialpädagoge ab. Von 1974 bis 1987 war er im Sozial- und Gesundheitswesen bzw. in der Jugendhilfe beim Land Berlin beschäftigt.
1987 wechselte er zum gemeinnützigen Verein Dienstleistung für Arbeitnehmer und Betriebe, einer Schuldner- und Insolvenzberatungsstelle im Bezirk Kreuzberg, wo er bis 2018 Geschäftsführer und Vorstandsvorsitzender war. Seitdem führt er keine Beratungen mehr durch.[2]
2017/2018 war Zwegat als Lebensberater beim Berliner Start-up „my better life“ tätig.[3][2]
Zwegat ist seit 2006 mit Liane Scholze liiert, die eine Beratungsagentur in Berlin führt und mit der er gemeinsam ein Ratgeberbuch veröffentlichte. Medienberichten zufolge hat er zwei Kinder.[1] Am 25. Dezember 2011 heirateten sie auf Sansibar.[4]
</td>
</tr>
<tr>
<th scope="row">Projekte</th>
<td>PETER</td>
</tr>
</table>
</div>
</div>
</div>

View File

@ -0,0 +1 @@
<span class="badge ${color}">${badge}</span>

View File

@ -0,0 +1,18 @@
<div id="person-details-${id}" class="col-12 d-none person-details" style="text-align: left;">
<div>
<table class="table table-borderless">
<tr>
<th scope="row">Talente</th>
<td>${badges}</td>
</tr>
<tr>
<th scope="row">Kurzinfo</th>
<td>${info}</td>
</tr>
<tr>
<th scope="row">Projekte</th>
<td>TODO</td>
</tr>
</table>
</div>
</div>

View File

@ -0,0 +1,10 @@
<div class="col-lg-4">
<a href="#" person="${id}" class="person-link">
<div>
<img src="./files/persons/${img}" class="rounded-circle" alt="${name}" style="object-fit: cover; width: 300px; height: 300px;">
</div>
<div>
${name} <i class="fa fa-angle-down"></i>
</div>
</a>
</div>

View File

@ -0,0 +1,4 @@
<div class="row">
${_content_persons_imgs}
${_content_persons_details}
</div>