parent
cc8e7529db
commit
0306ed3d68
Binary file not shown.
@ -0,0 +1,21 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
declare(strict_types=1); |
||||||
|
|
||||||
|
namespace prj\ex\cli_controllers\app; |
||||||
|
|
||||||
|
class home_ctrl { |
||||||
|
|
||||||
|
public function index() { |
||||||
|
echo "Welcome to Index CLI..."; |
||||||
|
} |
||||||
|
|
||||||
|
public function name_demo() { |
||||||
|
echo "Name Demo CLI..."; |
||||||
|
} |
||||||
|
|
||||||
|
public function test($id) { |
||||||
|
echo "ID: $id"; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,39 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
declare(strict_types=1); |
||||||
|
|
||||||
|
namespace prj\ex\controllers\bills; |
||||||
|
|
||||||
|
class notices_ctrl { |
||||||
|
public $page_output; |
||||||
|
|
||||||
|
public function late_payment() { |
||||||
|
$view_as_pdf = true; |
||||||
|
$output = \prj\ex\outputs\bills\notices_out::late_rent($view_as_pdf); |
||||||
|
|
||||||
|
$html = new \tts\html_document(); |
||||||
|
|
||||||
|
$view = new \tts\view(); |
||||||
|
if (! $view_as_pdf) { |
||||||
|
$view->set('html', $html); |
||||||
|
$view->set_template('main'); |
||||||
|
} |
||||||
|
$view->set('view_as_pdf', $view_as_pdf); |
||||||
|
$view->set('template_assigns', $output); |
||||||
|
$view->set('font_url', TTS_PROJECT_BASE_REF . 'assets/fonts/JennaSue.ttf'); |
||||||
|
if (! $view_as_pdf) { |
||||||
|
$view->add_view('bills/notice_of_late_payment_css.php'); |
||||||
|
} |
||||||
|
$view->add_view('bills/notice_of_late_payment_pdf.tpl'); |
||||||
|
$html_code = $view->fetch($this); |
||||||
|
|
||||||
|
if (! $view_as_pdf) { |
||||||
|
echo $html_code; |
||||||
|
exit; |
||||||
|
} |
||||||
|
|
||||||
|
// Makes PDF output |
||||||
|
\prj\ex\outputs\bills\notices_out::gen_pdf_for_late_payment($html_code); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -1,14 +0,0 @@ |
|||||||
<?php |
|
||||||
|
|
||||||
declare(strict_types=1); |
|
||||||
|
|
||||||
namespace ex\controllers\cronjobs; |
|
||||||
|
|
||||||
class daily_ctrl { |
|
||||||
|
|
||||||
// public function skip_default_error_handler() {} |
|
||||||
public function index_cli() { |
|
||||||
echo "OKay!"; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
@ -0,0 +1,37 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
declare(strict_types=1); |
||||||
|
|
||||||
|
namespace prj\ex\logic\app; |
||||||
|
|
||||||
|
use \tts\safer_io as SafeIO; |
||||||
|
|
||||||
|
class home_logic { |
||||||
|
|
||||||
|
public static function name_demo(array & $input): void { |
||||||
|
$model = new \prj\ex\models\app\home_model(\tts\main\registry::get('db')); |
||||||
|
|
||||||
|
$submitted = true; |
||||||
|
foreach(SafeIO::logic_sanitize($input) as $data) { |
||||||
|
if (SafeIO::required_fields_were_NOT_all_submitted($data)) { |
||||||
|
$submitted = false; |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
$input['submitted'] = $submitted; |
||||||
|
|
||||||
|
if ($submitted) { |
||||||
|
$model->init_name_demo_table(); // Create Table if NOT exists! |
||||||
|
$model->populate(10); // INSERT 10 random rows of data |
||||||
|
|
||||||
|
$success = $model->save_new_user($input); // Save data from Request Data |
||||||
|
$input['model'] = ($success===true) ? |
||||||
|
$model->get_users(15) : |
||||||
|
$model->get_users(0); |
||||||
|
} else { |
||||||
|
$input['model'] = $model->get_users(0); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,43 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
declare(strict_types=1); |
||||||
|
|
||||||
|
namespace prj\ex\outputs\bills; |
||||||
|
|
||||||
|
class notices_out { |
||||||
|
public static function late_rent(bool $view_as_pdf): array { |
||||||
|
$output['pdf'] = $view_as_pdf; |
||||||
|
$output['entity'] = "ZXC99"; |
||||||
|
$output['full_name'] = "Robert Miller"; |
||||||
|
$output['address'] = "3030 Someplace Ave"; |
||||||
|
$output['address2'] = "Grand Rapids, MI 49503"; |
||||||
|
$output['past_due'] = "1139.00"; |
||||||
|
$output['paid'] = "200.00"; |
||||||
|
$output['todays_date'] = \tts\time_zones::convert_time_zone(array('format' => 'legal_date')); |
||||||
|
$output['wrap'] = ($view_as_pdf) ? "" : 'class="non-pdf-paper-wrap"'; |
||||||
|
$output['apt'] = '208'; |
||||||
|
$output['signatures'] = [ |
||||||
|
['here' => 'Manager', 'name' => 'Mark Smith'], |
||||||
|
['here' => 'Customer'] |
||||||
|
]; |
||||||
|
return $output; |
||||||
|
} |
||||||
|
|
||||||
|
public static function gen_pdf_for_late_payment(string $html_code): void { |
||||||
|
$style_sheet = file_get_contents(\tts\site_helper::get_root() . \tts\site_helper::get_project() . 'views/default/bills/notice_of_late_payment_css.php'); |
||||||
|
|
||||||
|
require_once TTS_VENDOR . 'autoload.php'; |
||||||
|
$mpdf = new \Mpdf\Mpdf(['tempDir' => \tts\site_helper::get_root() . '/tmp/mpdf']); // chown www-data, chmod 775 |
||||||
|
|
||||||
|
$mpdf->AddFontDirectory(PROJECT_ASSETS_DIR . '/fonts'); |
||||||
|
$mpdf->fontdata['jennasue'] = ['R'=>"JennaSue.ttf"]; |
||||||
|
$mpdf->available_unifonts[] = 'jennasue'; |
||||||
|
$mpdf->AddFont('jennasue', 'R'); |
||||||
|
$mpdf->SetFont('jennasue'); |
||||||
|
|
||||||
|
$mpdf->WriteHTML($style_sheet,\Mpdf\HTMLParserMode::HEADER_CSS); |
||||||
|
$mpdf->WriteHTML($html_code,\Mpdf\HTMLParserMode::HTML_BODY); |
||||||
|
$mpdf->Output(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,15 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
declare(strict_types=1); |
||||||
|
|
||||||
|
namespace prj\ex\routes; |
||||||
|
use \tts\router as Router; |
||||||
|
|
||||||
|
class cli_routes { |
||||||
|
|
||||||
|
public static function get() { |
||||||
|
Router::get('ex/example/{id}?', 'prj\ex\cli_controllers\app\home_ctrl@test'); |
||||||
|
//Router::route("ex/app/home/name_demo.html", "prj\ex\controllers\app\home_ctrl@name_demo"); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
declare(strict_types=1); |
||||||
|
|
||||||
|
namespace prj\ex\routes; |
||||||
|
use \tts\router as Router; |
||||||
|
|
||||||
|
class routes { |
||||||
|
|
||||||
|
public static function get() { |
||||||
|
Router::get('ex/example/{id}?', 'prj\ex\controllers\app\home_ctrl@test'); |
||||||
|
//Router::route("ex/app/home/name_demo.html", "prj\ex\controllers\app\home_ctrl@name_demo"); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,14 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
declare(strict_types=1); |
||||||
|
|
||||||
|
namespace prj\ex\routes; |
||||||
|
use \tts\router as Router; |
||||||
|
|
||||||
|
class test_routes { |
||||||
|
|
||||||
|
public static function get() { |
||||||
|
Router::get('ex/example/{id}?', 'prj\ex\test_controllers\app\first_ctrl@example'); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,23 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
namespace prj\ex\test_controllers\app; |
||||||
|
|
||||||
|
final class first_ctrl { |
||||||
|
|
||||||
|
public function returns_true(): bool { |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
public function same(): bool { |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
public function not_same(): bool { |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
public function example($id) { |
||||||
|
return $id; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -1,22 +1,25 @@ |
|||||||
<?php |
<?php |
||||||
|
|
||||||
declare(strict_types=1); |
declare(strict_types=1); |
||||||
$AJAX_FOLDER = \tts\site_helper::get_project() . "/assets/ajax"; |
$AJAX_FOLDER = PROJECT_ASSETS_BASE_REF. "/ajax/"; |
||||||
|
|
||||||
const JS_CDN_FILES = [ |
const JS_CDN_FILES = [ |
||||||
"https://cdn.metroui.org.ua/v4/js/metro.min.js" => [], |
"https://cdn.metroui.org.ua/v4/js/metro.min.js" => [], |
||||||
]; |
]; |
||||||
|
|
||||||
|
const JS_TSR = [ "js/trouble_shooting_routes.js" =>[] ]; |
||||||
|
|
||||||
const JS_FILES = [ |
const JS_FILES = [ |
||||||
"js/testing.js" => [], |
"js/router_loader.js" => [], |
||||||
|
"js/routes.js" => [], |
||||||
]; |
]; |
||||||
|
|
||||||
$JS = "tts_set_project(\"" . rtrim(\tts\site_helper::get_project(), '/') ."\");" . PHP_EOL; /* Set JS Error Handler */ |
$JS = "var ajax_folder = \"" . $AJAX_FOLDER . "\"" . PHP_EOL; /* assets AJAX foldername and path */ |
||||||
$JS .= "var ajax_folder = \"" . $AJAX_FOLDER . "\"" . PHP_EOL; /* assets AJAX foldername and path */ |
|
||||||
$JS .= "var debug = 1; /* Debug mode 1 = true */" . PHP_EOL; |
$JS .= "var debug = 1; /* Debug mode 1 = true */" . PHP_EOL; |
||||||
$JS .= "function debug_print(msg) { if (debug === 1) console.log(msg); }" . PHP_EOL; |
$JS .= "function debug_print(msg) { if (debug === 1) console.log(msg); }" . PHP_EOL; |
||||||
$JS .= \tts\assets::get_ajax_files(\tts\site_helper::get_root() . $AJAX_FOLDER . "/"); |
$JS .= \tts\assets::get_ajax_files(PROJECT_ASSETS_DIR . "/ajax/"); |
||||||
$html->add_to_javascript($JS); |
$html->add_to_javascript($JS); |
||||||
|
|
||||||
$html->set_assets_from_array(JS_CDN_FILES, 'main_js', 'cdn'); |
$html->set_assets_from_array(JS_CDN_FILES, 'main_js', 'cdn'); |
||||||
//$html->set_assets_from_array(JS_FILES, 'main_js'); |
$html->set_assets_from_array(JS_TSR, 'js', 'assets'); |
||||||
|
$html->set_assets_from_array(JS_FILES, 'js', 'project'); |
||||||
@ -1,10 +1,16 @@ |
|||||||
<h2>Welcome...to Example Codes</h2> |
|
||||||
|
|
||||||
<?php |
<?php |
||||||
|
|
||||||
declare(strict_types=1); |
declare(strict_types=1); |
||||||
$route_name_demo = "app/home"; |
$route_name_demo = "app/home"; |
||||||
$method_name_demo = "name_demo"; |
$method_name_demo = "name_demo"; |
||||||
|
|
||||||
|
$route_late_rent = "bills/notices"; |
||||||
|
$method_late_rent = "late_payment"; |
||||||
|
|
||||||
?> |
?> |
||||||
|
|
||||||
<a href="<?= \tts\request::get_url($route_name_demo, $method_name_demo) ?>">View Name Demo</a>
|
<h2>Welcome...to your Example Project</h2> |
||||||
|
|
||||||
|
<a href="<?= \tts\request::get_url($route_name_demo, $method_name_demo) ?>">View Name Demo</a> <br/><br/>
|
||||||
|
|
||||||
|
<a href="<?= \tts\request::get_url($route_late_rent, $method_late_rent) ?>">View Late Payment Signing</a>
|
||||||
@ -1,16 +1,19 @@ |
|||||||
<p>BLA BLA BLA okay...</p> |
<?php |
||||||
|
|
||||||
<pre> |
declare(strict_types=1); |
||||||
<?= $output['main'] ?> |
$route_name_demo = "app/home"; |
||||||
</pre> |
$method_name_demo_post = "name_demo_post"; |
||||||
|
?> |
||||||
<?= \ex\outputs\app\home_out::show_errors($output['errors']) ?> |
|
||||||
|
|
||||||
<br/><br/> |
<br/><br/> |
||||||
<form> |
<form method="post" action="<?= \tts\request::get_url($route_name_demo, $method_name_demo_post) ?>">
|
||||||
<label for="fname">First Name: <input type="text" id="fname" name="first_name" size="15" /></label><br/> |
<label for="fname">First Name: <input type="text" id="fname" name="first_name" size="15" /></label><br/> |
||||||
|
<label for="lname">Last Name: <input type="text" id="lname" name="last_name" size="15" /></label><br/> |
||||||
<label for="age">Age: <input type="text" id="age" name="age" size="2" maxlength="2" /></label><br/> |
<label for="age">Age: <input type="text" id="age" name="age" size="2" maxlength="2" /></label><br/> |
||||||
<input type="submit" /> |
<input type="submit" /> |
||||||
</form> |
</form> |
||||||
|
|
||||||
<?= \ex\outputs\app\home_out::show_user_details($output['model']) ?> |
<br> |
||||||
|
<hr> |
||||||
|
|
||||||
|
<a href="<?= \tts\request::get_url("app/home", "index") ?>">Back to Main</a>
|
||||||
@ -0,0 +1,22 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
declare(strict_types=1); |
||||||
|
|
||||||
|
$route_name_demo = "app/home"; |
||||||
|
$method_name_demo = "name_demo"; |
||||||
|
?> |
||||||
|
<a href="<?= \tts\request::get_url($route_name_demo, $method_name_demo) ?>">Back</a>
|
||||||
|
|
||||||
|
<p>BLA BLA BLA okay...</p> |
||||||
|
|
||||||
|
<pre> |
||||||
|
<?= $output['main'] ?> |
||||||
|
</pre> |
||||||
|
|
||||||
|
<?= \prj\ex\outputs\app\home_out::show_errors($output['errors']) ?> |
||||||
|
|
||||||
|
<?= \prj\ex\outputs\app\home_out::show_user_details($output['model']) ?> |
||||||
|
|
||||||
|
<br> |
||||||
|
<hr> |
||||||
|
<a href="<?= \tts\request::get_url($route_name_demo, $method_name_demo) ?>">Back</a>
|
||||||
@ -0,0 +1,124 @@ |
|||||||
|
<?= ($view_as_pdf) ? '' : '<style type="text/css">'; ?> |
||||||
|
|
||||||
|
.page { |
||||||
|
width: 8.5in; |
||||||
|
height: 11in; |
||||||
|
margin: 0mm auto; |
||||||
|
} |
||||||
|
|
||||||
|
body { |
||||||
|
font-family: FreeSans, sans-serif; |
||||||
|
font-size: <?= ($view_as_pdf) ? '14px' : '16px'; ?>;
|
||||||
|
} |
||||||
|
|
||||||
|
/* DivTable.com */ |
||||||
|
.divTable{ |
||||||
|
display: table; |
||||||
|
} |
||||||
|
.divTableRow { |
||||||
|
display: table-row; |
||||||
|
} |
||||||
|
.divTableHeading { |
||||||
|
display: table-header-group; |
||||||
|
} |
||||||
|
.divTableCell, .divTableHead { |
||||||
|
display: table-cell; |
||||||
|
} |
||||||
|
.divTableHeading { |
||||||
|
display: table-header-group; |
||||||
|
font-weight: bold; |
||||||
|
} |
||||||
|
.divTableFoot { |
||||||
|
display: table-footer-group; |
||||||
|
font-weight: bold; |
||||||
|
} |
||||||
|
.divTableBody { |
||||||
|
display: table-row-group; |
||||||
|
} |
||||||
|
/* End of DivTable */ |
||||||
|
|
||||||
|
.div-table-tr { |
||||||
|
height: 35pt; |
||||||
|
} |
||||||
|
|
||||||
|
.table-tr { |
||||||
|
height: 35pt; |
||||||
|
} |
||||||
|
|
||||||
|
.table-todays-date { font-weight: 500; } |
||||||
|
|
||||||
|
.div-table-todays-date { font-weight: 500; } |
||||||
|
|
||||||
|
.table-blank-td-space { |
||||||
|
padding-left: 100px; |
||||||
|
} |
||||||
|
|
||||||
|
.div-table-blank-td-space { |
||||||
|
padding-left: 100px; |
||||||
|
} |
||||||
|
|
||||||
|
.signers-table-fix { |
||||||
|
font-size: 29pt; |
||||||
|
height: 14pt; |
||||||
|
line-height: 16px; |
||||||
|
margin: 0; |
||||||
|
} |
||||||
|
|
||||||
|
.signers-div-table-fix { |
||||||
|
font-size: 32pt; |
||||||
|
height: 18pt; |
||||||
|
line-height: 26px; |
||||||
|
margin: 0; |
||||||
|
} |
||||||
|
|
||||||
|
.address { |
||||||
|
max-width: 4in; |
||||||
|
width: 3in; |
||||||
|
margin-bottom: 2.5mm; |
||||||
|
padding-bottom: 0.2mm; |
||||||
|
border-bottom: 0.25mm solid #000000; |
||||||
|
} |
||||||
|
|
||||||
|
.late-notice { |
||||||
|
font-size: 15pt; |
||||||
|
text-transform: uppercase; |
||||||
|
text-align: center; |
||||||
|
} |
||||||
|
|
||||||
|
.big-spaces { |
||||||
|
padding-bottom: 0.75in; |
||||||
|
} |
||||||
|
|
||||||
|
.small-spaces { |
||||||
|
padding-bottom: 0.45in; |
||||||
|
} |
||||||
|
|
||||||
|
.sign-here-line { |
||||||
|
max-width: 3in; |
||||||
|
width: 2.5in; |
||||||
|
border-bottom: 0.25mm solid #000000; |
||||||
|
} |
||||||
|
|
||||||
|
.non-pdf-paper-wrap { |
||||||
|
width: 80ch; |
||||||
|
word-break: break-normal; |
||||||
|
white-space: normal; |
||||||
|
} |
||||||
|
|
||||||
|
@font-face { |
||||||
|
font-family: jennasue; |
||||||
|
<?= (! $view_as_pdf) ? "src: url('".$font_url."');". PHP_EOL : PHP_EOL; ?> |
||||||
|
} |
||||||
|
|
||||||
|
.cursive { |
||||||
|
font-family: jennasue; |
||||||
|
font-style: normal; |
||||||
|
font-variant: normal; |
||||||
|
font-weight: 400; |
||||||
|
} |
||||||
|
|
||||||
|
.centered-text { |
||||||
|
text-align:center; |
||||||
|
} |
||||||
|
|
||||||
|
<?= ($view_as_pdf) ? '' : '</style>'; |
||||||
@ -0,0 +1,20 @@ |
|||||||
|
{% for sign in signatures %} |
||||||
|
<table> |
||||||
|
<tr class="table-tr"> |
||||||
|
<td class="table-todays-date"><u>{{ todays_date }}</u></td> |
||||||
|
<td class="table-blank-td-space"> </td> |
||||||
|
<td class="sign-here-line cursive centered-text signers-table-fix"> |
||||||
|
{% unless sign.here == 'Tenant' %} |
||||||
|
{{ sign.name }} |
||||||
|
{% endunless %} |
||||||
|
</td> |
||||||
|
</tr> |
||||||
|
|
||||||
|
<tr class="table-tr"> |
||||||
|
<td>Date</td> |
||||||
|
<td class="table-blank-td-space"> </td> |
||||||
|
<td>{{ sign.here }}</td> |
||||||
|
</tr> |
||||||
|
</table> |
||||||
|
<div class="small-spaces"></div> |
||||||
|
{% endfor %} |
||||||
Loading…
Reference in new issue