108 lines
2.8 KiB
PHP
108 lines
2.8 KiB
PHP
<?php
|
|
|
|
class DashboardController extends mfBaseController {
|
|
|
|
protected function init() {
|
|
$this->needlogin=true;
|
|
$me = new User();
|
|
$me->loadMe();
|
|
$this->me = $me;
|
|
$this->layout()->set("me",$me);
|
|
}
|
|
|
|
protected function indexAction() {
|
|
if($this->me->is("preorderfront")) {
|
|
$this->redirect("Preorder");
|
|
}
|
|
|
|
$newss = NewsModel::getAll();
|
|
$this->layout()->set("newss", $newss);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function testAction() {
|
|
var_dump(ADBWohneinheitModel::count(["hausnummer_id" => 1772369]));
|
|
exit;
|
|
}
|
|
|
|
protected function colorAction() {
|
|
|
|
foreach(TT_CABLE_COLORS as $name => $color) {
|
|
if(!$color['two-color']) continue;
|
|
$hex = $color['hex'];
|
|
$hexfg = $color['hexfg'];
|
|
$hex2 = $color['hex2'];
|
|
$hexfg2 = $color['hexfg2'];
|
|
$r = $color['r'];
|
|
$g = $color['g'];
|
|
$b = $color['b'];
|
|
$r2 = $color['r2'];
|
|
$g2 = $color['g2'];
|
|
$b2 = $color['b2'];
|
|
|
|
|
|
$class = ".btn-outline-".$name." {
|
|
color: #$hexfg;
|
|
border-left-color: #$hex;
|
|
border-top-color: #$hex;
|
|
border-right-color: #$hex2;
|
|
border-bottom-color: #$hex2;
|
|
background: linear-gradient(90deg, rgba($r,$g,$b,.5) 0%, rgba($r,$g,$b,.5) 50%, rgba($r2,$g2,$b2,.5) 50%, rgba($r2,$g2,$b2,.5) 100%);
|
|
}";
|
|
echo "<pre>$class</pre>\n";
|
|
}
|
|
exit;
|
|
}
|
|
|
|
protected function pdfAction() {
|
|
$order = new Order(7);
|
|
$owner = new Address(1);
|
|
|
|
$pdf = new Layout();
|
|
$pdf->setTemplate("Emailtemplates/attachments/new_order.pdf");
|
|
$pdf->set("ressourcePathPrefix", BASEDIR."/public/");
|
|
$pdf->set("owner", $owner);
|
|
$pdf->set("order", $order);
|
|
|
|
$pdfpath = $pdf->renderPDF();
|
|
$tvalue = $pdf->getReturnedValue();
|
|
$pdfname = $tvalue['filename'];
|
|
|
|
echo $pdfname;
|
|
|
|
exit;
|
|
return true;
|
|
//var_dump($pdfpath);exit;
|
|
|
|
// send email to customer
|
|
|
|
// TODO template rendern auslagern nach Emailtempate klasse
|
|
$tpl = new Layout();
|
|
$tpl->setTemplate("Emailtemplates/customer/new_order");
|
|
$tpl->set("owner", $owner);
|
|
$body = $tpl->render();
|
|
|
|
$values = $tpl->getReturnedValue();
|
|
|
|
$subject = $values['subject'];
|
|
$from = $values['from_email'];
|
|
$from_name = $values['from_email_name'];
|
|
$to = $owner->email;
|
|
|
|
if(!$subject || !$from || !$from_name || !$to) {
|
|
$this->log->warn("Service PIN Email not sent. (subject: '$subject', from: '$from', from_email: '$from_email', to: '$to')");
|
|
} else {
|
|
$email = new Emailnotification();
|
|
$email->setSubject($subject);
|
|
$email->setBody($body);
|
|
$email->setFrom($from, $from_name);
|
|
$email->setTo($to);
|
|
$email->setHeader("X-".MFAPPNAME."-oid", $order->id);
|
|
$email->setHeader("X-".MFAPPNAME."-pid", $product->id);
|
|
$email->addAttachment($pdfpath, null, $pdfname, "application/pdf");
|
|
$email->send();
|
|
}
|
|
}
|
|
} |