added leader and helpers field to camp

This commit is contained in:
Ricsi
2017-06-16 21:46:31 +02:00
parent f0d4bb9e7a
commit b85da38e8a
5 changed files with 65 additions and 6 deletions

View File

@@ -9,6 +9,8 @@ class camp
private $camp_city;
private $camp_from;
private $camp_to;
private $camp_leader;
private $camp_helpers;
private $camp_camp_type_ct_id; //ID
private $camp_type; //OBJ
private $camp_shuttle = array(); //array
@@ -197,6 +199,26 @@ class camp
return $this;
}
public function get_camp_leader() {
return $this->camp_leader;
}
private function set_camp_leader($_item) {
$this->camp_leader = $_item;
return $this;
}
public function get_camp_helpers() {
return $this->camp_helpers;
}
private function set_camp_helpers($_item) {
$this->camp_helpers = $_item;
return $this;
}
public function has_pending_apply() {
global $sql;
return $sql->num_of_rows("select * from camp join camp_apply on capp_camp_id = camp_id where capp_status = 2 AND camp_id = " . $this->get_camp_id());
@@ -234,13 +256,15 @@ class camp
}
public static function create_camp($_city, $_from, $_to, $_is_open, $_ct_id, $_shuttles, $_accoms) {
public static function create_camp($_city, $_from, $_to, $_leader, $_helpers, $_is_open, $_ct_id, $_shuttles, $_accoms) {
global $sql;
$new_camp_id = $sql->insert_into('camp',array(
'camp_city' => $_city,
'camp_from' => $_from,
'camp_to' => $_to,
'camp_leader' => $_leader,
'camp_helpers' => $_helpers,
'camp_is_open' => $_is_open,
'camp_camp_type_ct_id' => $_ct_id
));
@@ -259,13 +283,15 @@ class camp
}
public static function update_camp($_city, $_from, $_to, $_is_open, $_ct_id, $_shuttles, $_accoms, $_camp_id) {
public static function update_camp($_city, $_from, $_to, $_leader, $_helpers, $_is_open, $_ct_id, $_shuttles, $_accoms, $_camp_id) {
global $sql;
$new_camp_id = $sql->update_table('camp',array(
'camp_city' => $_city,
'camp_from' => $_from,
'camp_to' => $_to,
'camp_leader' => $_leader,
'camp_helpers' => $_helpers,
'camp_is_open' => $_is_open,
'camp_camp_type_ct_id' => $_ct_id
),

View File

@@ -360,7 +360,7 @@ if (isset($_POST['action'])) {
$accoms = $_POST['accomodations'];
}
camp::create_camp($_POST['camp_city'], $_POST['camp_from'], $_POST['camp_to'], (!empty($_POST['camp_is_open'])?1:0), $_POST['camp_camp_type_ct_id'], $shuttles, $accoms);
camp::create_camp($_POST['camp_city'], $_POST['camp_from'], $_POST['camp_to'], $_POST['camp_leader'], $_POST['camp_helpers'], (!empty($_POST['camp_is_open'])?1:0), $_POST['camp_camp_type_ct_id'], $shuttles, $accoms);
log::register('new_camp', $_POST['camp_from'] . " (" . $_POST['camp_city'] . ")");
break;
case 'camp_update':
@@ -375,7 +375,7 @@ if (isset($_POST['action'])) {
$accoms = $_POST['accomodations'];
}
camp::update_camp($_POST['camp_city'], $_POST['camp_from'], $_POST['camp_to'], (!empty($_POST['camp_is_open'])?1:0), $_POST['camp_camp_type_ct_id'], $shuttles, $accoms, $_POST['camp_id']);
camp::update_camp($_POST['camp_city'], $_POST['camp_from'], $_POST['camp_to'], $_POST['camp_leader'], $_POST['camp_helpers'], (!empty($_POST['camp_is_open'])?1:0), $_POST['camp_camp_type_ct_id'], $shuttles, $accoms, $_POST['camp_id']);
log::register('update_camp', $_POST['camp_from'] . " (" . $_POST['camp_city'] . ")");
header('Location: /admin/camps/' . $_POST['camp_id']);

View File

@@ -108,13 +108,29 @@
</label>
<div>
{$apply->get_capp_camp_id()->get_camp_from()|substr:0:4}.
{$months[$apply->get_capp_camp_id()->get_camp_from()|date_format:"%m"]}. {$apply->get_capp_camp_id()->get_camp_from()|date_format:"%e"}. -
{$months[$apply->get_capp_camp_id()->get_camp_from()|date_format:"%m"]} {$apply->get_capp_camp_id()->get_camp_from()|date_format:"%e"}. -
{if $apply->get_capp_camp_id()->get_camp_from()|date_format:"%m" != $apply->get_capp_camp_id()->get_camp_to()|date_format:"%m"}
{$months[$apply->get_capp_camp_id()->get_camp_to()|date_format:"%m"]}.
{/if}
{$apply->get_capp_camp_id()->get_camp_to()|date_format:"%e"}.
</div>
</div>
{if $page == 'admin' || $page == 'taborvezeto'}
<div class="list_item">
<label class="desc">
<img src="/_image/person.png">
Táborvezető:
</label>
<div>{$apply->get_capp_camp_id()->get_camp_leader()}</div>
</div>
<div class="list_item">
<label class="desc">
<img src="/_image/person.png">
Segítők:
</label>
<div>{$apply->get_capp_camp_id()->get_camp_helpers()}</div>
</div>
{/if}
<div class="list_item">
<label class="desc">
<img src="/_image/person.png">
@@ -123,6 +139,7 @@
<div>{$apply->get_capp_accomodation_type()->get_cat_name()}</div>
</div>
<div class="list_item">
<label class="desc">
<img src="/_image/person.png">

View File

@@ -14,6 +14,14 @@
<label class="desc" for="camp_to">Tábor vége:</label>
<div><input type="text" name="camp_to" id="camp_to" required></div>
</div>
<div>
<label class="desc" for="camp_leader">Táborvezető:</label>
<div><input type="text" name="camp_leader" id="camp_leader"></div>
</div>
<div>
<label class="desc" for="camp_helpers">Segítők:</label>
<div><input type="text" name="camp_helpers" id="camp_helpers"></div>
</div>
<div>
<label class="desc" for="camp_is_open">Lehet jelentkezni:</label>
<div><input type="checkbox" name="camp_is_open" id="camp_is_open" value="1" checked></div>

View File

@@ -18,6 +18,14 @@
<label class="desc" for="camp_to">Tábor vége:</label>
<div><input type="text" name="camp_to" id="camp_to" value="{$camp->get_camp_to()}" required></div>
</div>
<div>
<label class="desc" for="camp_leader">Táborvezető:</label>
<div><input type="text" name="camp_leader" id="camp_leader" value="{$camp->get_camp_leader()}"></div>
</div>
<div>
<label class="desc" for="camp_helpers">Segítők:</label>
<div><input type="text" name="camp_helpers" id="camp_helpers" value="{$camp->get_camp_helpers()}"></div>
</div>
<div>
<label class="desc" for="camp_is_open">Lehet jelentkezni:</label>
<div><input type="checkbox" name="camp_is_open" id="camp_is_open" value="1" {if 1==$camp->get_camp_is_open()}checked{/if}></div>