Skip to content
This repository has been archived by the owner on Mar 22, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release/2013.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoor committed Dec 5, 2013
2 parents 8ec1d46 + 709e28a commit e0ef856
Show file tree
Hide file tree
Showing 16 changed files with 339 additions and 164 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
configs/config.php
cache/templates/*
photos/*.*
statements/*.*
cache/images/*.*
13 changes: 11 additions & 2 deletions class/Exceptions_handler_lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
class MySQLIConnectException extends Exception
{
function __construct($inErrmsg, $inErrcode)
{
{
header ('Content-type: text/html; charset=utf-8');
echo ("Wystąpił błąd podczas próby połączenia z bazą danych. Dalsza praca może okazać się niemożliwa. Spróbuj ponownie póżniej lub powiadom administratora systemu");
echo ("Wystąpił błąd podczas próby połączenia z bazą danych. Dalsza praca może okazać się niemożliwa. Spróbuj ponownie póżniej lub powiadom administratora systemu");
die;
}
}
Expand Down Expand Up @@ -118,4 +118,13 @@ public function __construct($in_errormsg)
{
parent::__construct("Błąd zapytania mysqli - treść komunikatu o błędzie: ".$in_errormsg);
}
}

class FileException extends Exception
{
function __construct($in_errormsg=Null,$in_errorcode=Null)
{
parent::__construct("Bład pliku:
{$in_errormsg}",$in_errorcode);
}
}
38 changes: 37 additions & 1 deletion class/displayManager.Class.php
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,20 @@ public function activate($data){
*/
public function volunteer_list(){
$this->secure('view');
$volunteers = $this->engine->loadVolunteers(null, array('surname', 'name', 'PESEL', 'login','type','id','photo'));
$volunteers = $this->engine->loadVolunteers(null,
array(
'surname',
'name',
'PESEL',
'login',
'type',
'id',
'photo',
'statement_file',
'statement_downloaded',
'statement_downloaded_timestamp',
)
);
$idents = array();
foreach ($volunteers as $v){
$idents[$v->id]= $this->engine->getIdentNr($v->id, $finalNr) ? $this->engine->getIdentNr($v->id, $finalNr) : 'nie ma';
Expand Down Expand Up @@ -831,5 +844,28 @@ public function meetings(){
$this->assign_by_ref('meetings',$meetings);
$this->display('meetings.html');
}

/**
* download statement
* @param $_REQUEST, can have id -> volunteer id, not required.
* @return statement file contents
*/
public function download_statement($data){
if ($data['id']){
/* id is set, logged in user should be superadmin */
$this->secure('admin');
$volunteer = $this->engine->loadVolunteers(array('id'=>$data['id']));
$volunteer = $volunteer[0];
$volunteer->getStatementFileContents(false);
}else{
/* else only currently logged in user statement is available */
$this->secure('self');
if (!$this->user->statement_downloaded){
$this->user->getStatementFileContents();
}else{
HTTP::redirect('/');
}
}
}
}
?>
75 changes: 69 additions & 6 deletions class/volunteer.Class.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ final class volunteer extends genericClass implements PHPSucks{
private $phone ;
private $p_phone ;
private $r_date ;
private $rank ;
private $rank ; //ocena, liczby całkowite 1 - 5
private $statement_file ; //Nazwa pliku pdf z oświadczeniem Wolontariusza, pobranym z /
//systemu Fundacji WOŚP.
private $statement_downloaded; //Czy oświadczenie zostało pobrane przez wolontariusza?
private $statement_downloaded_timestamp; //Timestamp pobrania oświadczenia
private $active ;
private $doc_id ;
private $doc_type ; //enum: available: legitymacja szkolna, legitymacja studencka,
Expand All @@ -43,11 +47,7 @@ final class volunteer extends genericClass implements PHPSucks{
private $consent_processing_of_personal_data ; // zgoda na przetwarzanie danych. Wymagana do rejestracji.
//Jedyna możliwa wartość - on
private $date_consent_processing_of_personal_data ; // zgoda na przetwarzanie danych - data wyrażenia zgody.
/*private $processing_of_personal_data_for_marketing_purposes ; //zgoda na przetwarzanie danych w celach marketingowych.
//Dopuszczalne wartosci - tak, nie
private $date_processing_of_personal_data_for_marketing_purposes ; //data zmiany statusu wyrażenia zgodny na
//przerwarzanie danych w celach marketingowych
*/

private $accept_of_sending_data_to_WOSP ; //zgoda na przekazanie danych do Fundacji WOSP.
//wymagana do rejestracji w systemie. Jedyna możliwa wartosc: on

Expand Down Expand Up @@ -124,6 +124,69 @@ public function getNotices(){
return $this->notices;
}

/**
* Check statement state
* @return string
* - brak dokumentu - when file name is not declared in DB
* - gotowe do pobrania - when file name is declared and missing downloaded timestamp
* - pobrane: timestamp
*/
public function getStatementState(){
$sf = $this->statement_file;
$sd = $this->statement_downloaded;
$sdt = $this->statement_downloaded_timestamp;
if (!$sf){
return "Brak dokumentu";
}
if ($sf && !$sd){
return "Gotowe do pobrania";
}
if ($sf && $sd && $sdt){
return "Pobrane: ".$sdt;
}
return 'błąd?';
}

/**
* Proxy for getting this user statement contents.
* @param updateStatementDownload default true - to update statement download status & timestamp
* @return file contents or error.
*/
public function getStatementFileContents($updateStatementDownload = true){
/**
* - check statement state
* - check if file exists
* - get file contents
* - update counter
* - spit contents of the file for download
*/
if (!$this->statement_file){
throw new FileException("Brak zadeklarowanej nazwy pliku? Sprawdź pola bazy danych");
}

$file = $_SERVER['DOCUMENT_ROOT'].config::statements_path().$this->statement_file;
if (!file_exists($file)){
throw new FileException("Plik nie istnieje!");
}
if ($updateStatementDownload){
$this->statement_downloaded = 1;
$this->statement_downloaded_timestamp = date('Y-m-d H:i:s');
$this->changed_flag = 'updated';
}
header('Content-Description: File Transfer');
header('Content-Type: application/pdf');
header('Content-Disposition: attachment; filename='.'oswiadczenie_wolontariusza_'.$this->name.'_'.$this->surname.'.pdf');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit();
}

/**
* check user rights
* @param $role_name
Expand Down
5 changes: 5 additions & 0 deletions configs/config_template.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ final class config{
private static $photo_save_path = '/photos/';

private static $photo_deadline = '2013/12/26';

private static $statements_path ="/statements/";

public static function hostname(){
return self::$hostname;
Expand Down Expand Up @@ -110,5 +112,8 @@ public static function photo_save_path(){
public static function photo_deadline(){
return self::$photo_deadline;
}
public static function statements_path(){
return self::$statements_path;
}
}
?>
3 changes: 3 additions & 0 deletions configs/tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ CREATE TABLE IF NOT EXISTS `volunteers` (
`p_phone` varchar(45) DEFAULT NULL COMMENT '''numer do rodzica''',
`r_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '''data rejestracji''',
`rank` tinyint(4) NOT NULL DEFAULT '0' COMMENT '''ocena''',
`statement_file` varchar(255) NULL DEFAULT NULL COMMENT '''Nazwa pliku pdf z oświadczeniem Wolontariusza, pobranym z systemu Fundacji WOŚP.''',
`statement_downloaded` binary(1) NOT NULL DEFAULT 0 COMMENT '''Czy oświadczenie zostało pobrane przez wolontariusza?''',
`statement_downloaded_timestamp` timestamp NULL DEFAULT NULL COMMENT '''Timestamp pobrania oświadczenia''',
`active` binary(1) NOT NULL DEFAULT '0' COMMENT 'do potwierdzania adresu email - po potwierdzeniu 1 co uaktywnia konto',
`doc_id` varchar(45) NOT NULL DEFAULT '0' COMMENT 'numer dokumentu tożsamości',
`doc_type` enum('legitymacja szkolna','legitymacja studencka','dowód osobisty','paszport','karta stałego pobytu','prawo jazdy','książeczka wojskowa','inne') NOT NULL,
Expand Down
5 changes: 5 additions & 0 deletions configs/tables_update.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
''' Adding fields for statement 4.12.2013 '''
Alter table `volunteers`
Add column `statement_file` varchar(255) NULL DEFAULT NULL after rank,
Add column `statement_downloaded` binary(1) NOT NULL DEFAULT 0 after statement,
Add column `statement_downloaded_timestamp` timestamp NULL DEFAULT NULL after statement_downloaded;
5 changes: 4 additions & 1 deletion css/layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,7 @@ fieldset {
float:right;
}
h3{overflow:hidden;}
h3 span{ float:left;}
h3 span{ float:left;}
.text-left{
text-align:left;
}
7 changes: 5 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@
$smarty->meetings();
break;

case 'download_statement':
$smarty->download_statement($_REQUEST);
break;

default: $smarty->default_action();
}

?>

?>
3 changes: 3 additions & 0 deletions statements/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Limit GET POST HEAD>
Deny from all
</Limit>
20 changes: 19 additions & 1 deletion templates/account.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,21 @@ <h3>Twój profil</h3>
<th>Data rejestracji w systemie: </th>
<td>{$user->r_date}</td>
</tr>
{ if $user->statement_file && !$user->statement_downloaded }
<tr>
<th colspan="2"><a href="/?action=download_statement">Pobierz oświadczenie dla wolontariusza</a> <br>
<strong class="error">OŚWIADCZENIE MOŻE BYĆ POBRANE TYLKO RAZ! ZAPISZ LUB OD RAZU WYDRUKUJ I PODPISZ. <br>
UWAGA! <br>
SAMO KLIKNIĘCIE W POWYŻSZY LINK ZABLOKUJE KOLEJNĄ MOŻLIWOŚĆ POBRANIA PLIKU. NIE KLIKAJ JEŚLI NIE JESTEŚ PEWIEN!
</strong><br>
(jeśli nie możesz otworzyć tego pliku potrzebujesz programu Adobe Reader, do pobrania <a href="http://get.adobe.com/pl/reader/" target="_blank">tutaj</a> (otwiera nowe okno))
</th>
</tr>
{ elseif $user->statement_downloaded }
<tr>
<th colspan="2">Oświadczenie wolontariusza zostało pobrane: {$user->statement_downloaded_timestamp}</th>
</tr>
{ /if }
</table>

<div id="meeting">
Expand All @@ -101,7 +116,10 @@ <h3>Twój profil</h3>
mapka: <a href="http://www.gim17wroc.pl/kontakt.html">http://www.gim17wroc.pl/kontakt.html</a><br>
w dniu: <b>{$meeting->date}</b><br />
o godzinie: <b>{$meeting->time}</b><br />
<strong>Oświadczenie rodzica / opiekuna osoby niepełnoletniej można pobrać pod adresem: <a href="{$site_root}/zgoda.pdf">{$site_root}/zgoda.pdf</a></strong>
<strong>Oświadczenie rodzica / opiekuna osoby niepełnoletniej można pobrać pod adresem: <a href="{$site_root}/zgoda.pdf">{$site_root}/zgoda.pdf</a>
<br>
(jeśli nie możesz otworzyć tego pliku potrzebujesz programu Adobe Reader, do pobrania <a href="http://get.adobe.com/pl/reader/" target="_blank">tutaj</a> (otwiera nowe okno))
</strong>
</p>

{/if}
Expand Down
93 changes: 51 additions & 42 deletions templates/allVolunteers.html
Original file line number Diff line number Diff line change
@@ -1,47 +1,56 @@
{include file="layout/header.html"}
{if $user->ACL_check('view')}
<h3>Lista wszystkich wolontariuszy (razem: {$volunteers|@count})</h3>
<p class="legend">legenda:</p>
<ul class="legend">
<li class="czarnaLista">Czarna lista</li>
<li class="ppatrol">Pokojowy Patrol</li>
<li class="sztab">Sztab</li>
<li class="zaufany">Zaufany</li>
<li class="naFinale">Zakwalifikowany na finał</li>
<li class="naFinaleDanewFundacji">Dane w systemie fundacyjnym (zakwalifikowany na finał)</li>
<li>Nie dotyczy</li>
</ul>
<table border="1" summary="Lista Wolontariuszy" width="100%" id="allVolunteers">
<tr><th>Nazwisko</th><th>Imię</th><th>Login</th><th>PESEL</th><th>Nr. identyfikatora</th><th>Zdjęcie</th></tr>
{if $volunteers}
{foreach from=$volunteers item="v"}
<tr class="{if $v->type=='czarna lista'} czarnaLista
{elseif $v->type=='ppatrol'} ppatrol
{elseif $v->type=='sztab'} sztab
{elseif $v->type=='zaufany'} zaufany
{elseif $v->type=='dane w systemie fundacyjnym (zakwalifikowany na finał)'}naFinaleDanewFundacji
{elseif $v->type=='zakwalifikowany na finał'} naFinale {/if}" >
<td><a href="/?action=volunteer_view&amp;id={$v->id}">{$v->surname}</a></td>
<td><a href="/?action=volunteer_view&amp;id={$v->id}">{$v->name}</a></td>
<td><a href="/?action=volunteer_view&amp;id={$v->id}">{$v->login}</a></td>
<td><a href="/?action=volunteer_view&amp;id={$v->id}">{$v->PESEL}</a></td>
{assign var="id" value= $v->id}
<td><a href="/?action=volunteer_view&amp;id={$v->id}">{$idents.$id}</a></td>
<td>{include file="box/photo.html" photo=$v->photo}</td>
</tr>
{/foreach}
{/if}
</table>
<p class="legend">legenda:</p>
<ul class="legend">
<li class="czarnaLista">Czarna lista</li>
<li class="ppatrol">Pokojowy Patrol</li>
<li class="sztab">Sztab</li>
<li class="zaufany">Zaufany</li>
<li class="naFinale">Zakwalifikowany na finał</li>
<li class="naFinaleDanewFundacji">Dane w systemie fundacyjnym (zakwalifikowany na finał)</li>
<li>Nie dotyczy</li>
</ul>
<h3>Lista wszystkich wolontariuszy (razem: {$volunteers|@count})</h3>
<p class="legend">legenda:</p>
<ul class="legend">
<li class="czarnaLista">Czarna lista</li>
<li class="ppatrol">Pokojowy Patrol</li>
<li class="sztab">Sztab</li>
<li class="zaufany">Zaufany</li>
<li class="naFinale">Zakwalifikowany na finał</li>
<li class="naFinaleDanewFundacji">Dane w systemie fundacyjnym (zakwalifikowany na finał)</li>
<li>Nie dotyczy</li>
</ul>
<table border="1" summary="Lista Wolontariuszy" width="100%" id="allVolunteers">
<tr>
<th>Nazwisko</th>
<th>Imię</th>
<th>Login</th>
<th>PESEL</th>
<th>Status oświadczenia</th>
<th>Nr. identyfikatora</th>
<th>Zdjęcie</th>
</tr>
{if $volunteers}
{foreach from=$volunteers item="v"}
<tr class="{if $v->type=='czarna lista'} czarnaLista
{elseif $v->type=='ppatrol'} ppatrol
{elseif $v->type=='sztab'} sztab
{elseif $v->type=='zaufany'} zaufany
{elseif $v->type=='dane w systemie fundacyjnym (zakwalifikowany na finał)'}naFinaleDanewFundacji
{elseif $v->type=='zakwalifikowany na finał'} naFinale {/if}" >
<td><a href="/?action=volunteer_view&amp;id={$v->id}">{$v->surname}</a></td>
<td><a href="/?action=volunteer_view&amp;id={$v->id}">{$v->name}</a></td>
<td><a href="/?action=volunteer_view&amp;id={$v->id}">{$v->login}</a></td>
<td><a href="/?action=volunteer_view&amp;id={$v->id}">{$v->PESEL}</a></td>
{assign var="id" value= $v->id}
<td><a href="/?action=volunteer_view&amp;id={$v->id}">{$v->getStatementState()}</a></td>
<td><a href="/?action=volunteer_view&amp;id={$v->id}">{$idents.$id}</a></td>
<td>{include file="box/photo.html" photo=$v->photo}</td>
</tr>
{/foreach}
{/if}
</table>
<p class="legend">legenda:</p>
<ul class="legend">
<li class="czarnaLista">Czarna lista</li>
<li class="ppatrol">Pokojowy Patrol</li>
<li class="sztab">Sztab</li>
<li class="zaufany">Zaufany</li>
<li class="naFinale">Zakwalifikowany na finał</li>
<li class="naFinaleDanewFundacji">Dane w systemie fundacyjnym (zakwalifikowany na finał)</li>
<li>Nie dotyczy</li>
</ul>
{else}
<h2 class="error">Brak uprawnień.</h2>
{/if}
Expand Down
4 changes: 3 additions & 1 deletion templates/box/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
{/if}
</li>
<li {if $error_fields.birth_date}class="error"{/if}><label>data urodzenia:</label><input type="text" value="{$values.birth_date}" class="jq_date" name="fields[birth_date]" /> (RRRR-MM-DD)
<p><strong>Oświadczenie rodzica / opiekuna osoby niepełnoletniej można pobrać pod adresem: <a href="{$site_root}/zgoda.pdf">{$site_root}/zgoda.pdf</a></strong></p>
<p><strong>Oświadczenie rodzica / opiekuna osoby niepełnoletniej można pobrać pod adresem: <a href="{$site_root}/zgoda.pdf">{$site_root}/zgoda.pdf</a></strong> <br>
(jeśli nie możesz otworzyć tego pliku potrzebujesz programu Adobe Reader, do pobrania <a href="http://get.adobe.com/pl/reader/" target="_blank">tutaj</a> (otwiera nowe okno))
</p>
</li>
<li {if $error_fields.PESEL}class="error"{/if}><label>PESEL:</label><input type="text" value="{$values.PESEL}" name="fields[PESEL]" />
{$PESEL_unique_error}
Expand Down
Loading

0 comments on commit e0ef856

Please sign in to comment.