Example #1
0
    $mail->addAddress($m);
}
//POST HANDLING
if (isset($_POST['sendthehorde'])) {
    $m_subject = $_POST['mail_subject'];
    $m_content = $_POST['mail_content'];
    $mail->Subject = $m_subject;
    $mail->msgHTML($m_content);
    $view->db->Insert('send_newsletters', ["subject", "content", "date"], [$m_subject, $m_content, date("Y-m-d H:i:s")]);
    if (!$mail->send()) {
        echo "Mailer Error: " . $mail->ErrorInfo;
    } else {
        echo '<div class="alert alert-success" role="alert">
                <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                  <span aria-hidden="true">
                    &times;
                  </span>
                </button>
                Wysłano wiadomość!
                <a href="index.php?page=newsletter">Odświerz strone</a>
              </div>';
    }
}
$form = new Form();
$form->Textbox('mail_subject', 'Nagłówek', 'Promocja wrześniowa w LAI Gliwice!', true);
$form->Textarea('mail_content', 'Treść wiadomości', '', true, '', 7, 100);
//RENDERING VIEW
$view->Header('Newsletter');
$view->Custom($form->Render('Wyślij', 'sendthehorde') . '<br>');
$view->Table(["name" => "Wczesniejsze newslettery", "ordinal" => false, "class" => "default-table", "column_names" => ['ID', 'Nagłówek', 'Treść wiadomości', 'Data'], "data" => $nwltrs, "html" => false]);
$view->Render();
Example #2
0
            $form->Select('groupmodule', 'Moduł grupy:', ['cisco' => 'CISCO', 'www' => 'Aplikacje'], true, $group['module']);
            $form->Select('groupyears', 'Ilość lat:', ['1' => 'Jeden rok', '2' => 'Dwa lata'], true, $group['years']);
            $form->Select('groupdays', 'Dni tygodnia:', ['Tydzień' => 'Tydzień roboczy', 'Weekend' => 'Weekendy'], true, $group['days']);
            $form->Number('groupmaxstudents', 'Maksymalna ilość uczniów w grupie:', '15', true, '1', '', 'value="' . $group['max_students'] . '"');
            $form->Range('groupactive', 'Aktywność', 0, $group['module'] == 'cisco' ? 5 : 100, true, 'step="1" value="' . $group['active'] . '"');
            $form->DateMin('groupstart', 'Data otwarcia grupy', $group['start'], true, 'value="' . $group['start'] . '"');
            $form->DateMin('groupend', 'Data zamknięcia grupy', $group['start'], true, 'value="' . $group['start'] . '"');
            $form->Textarea('groupadditional', 'Notatki dotyczące grupy:', $group['additional'], false, 'maxlength="200"');
            $stable = $view->Table(["name" => 'Studenci należący do tej grupy', "ordinal" => false, "class" => 'default-table group_table', "column_names" => ['ID', 'Imię', 'Nazwisko', 'Email', 'Telefon', 'Aktywność', 'Usuń'], "data" => $stds, "html" => true]);
            $view->Header('Edytuj grupę: #' . $id);
            $view->Custom('<div style="float: left; width: 30%;">' . $form->Render('Zapisz zmiany.', 'groupsubmitted') . '</div>');
            $view->Custom('<div style="float: left; width: 70%;">' . $stable . "</div>");
            $view->Render();
            break;
        case 'payment':
            $pid = $_GET['payment'];
            $payment = $view->db->Select('payments', ['*'], ['idpay' => $pid])[0];
            $form = new Form(false, 'post', '#', 'default-form');
            $form->Number('amount', 'Wartość (zł)', $payment['amount'], true, 0, 'false', 'value="' . $payment['amount'] . '"');
            $form->Textbox('payment_for', 'Płatność za', $payment['payment_for'], true, 'value="' . $payment['payment_for'] . '"');
            $form->Textbox('payer', 'Uczeń', $payment['payer'], true, 'value="' . $payment['payer'] . '"');
            $form->Date('payment_date', 'Data płatności', true, 'value="' . $payment['payment_date'] . '"');
            $form->Textarea('additional', 'Dodatkowe informacje', $payment['additional'], false);
            $view->Header("Edytujesz płatność: #" . $pid);
            $view->Custom($form->Render('Zapisz zmiany.', 'paymentsubmitted'));
            $view->Render();
            break;
    }
} else {
    header('Location: index.php');
}
Example #3
0
            $students = $view->db->Select('students', ['name', 'surname', 'cisco', 'www', 'cisco_group', 'www_group']);
            $students_list = [];
            $groups = $view->db->Select('groups', ['group_name']);
            $groups_list = [];
            foreach ($students as $k => $v) {
                $students_list[$v['name'] . ' ' . $v['surname']] = $v['name'] . ' ' . $v['surname'];
                foreach ($groups as $i => $g) {
                    if ($v['cisco_group'] == explode('_', $g['group_name'])[1]) {
                        $groups_list[$v['name'] . ' ' . $v['surname']] = $g['group_name'];
                    }
                    if ($v['www_group'] == explode('_', $g['group_name'])[1]) {
                        $groups_list[$v['name'] . ' ' . $v['surname']] = $g['group_name'];
                    }
                }
            }
            $form = new Form(true, 'post', '#', 'default-form horizontal-form');
            $form->Number('amount', 'Wartość (zł)', '300', true, 0);
            $form->Select('payer', 'Uczeń', $students_list, true);
            $form->Select('payment_for', 'Płatność za', []);
            $form->Date('payment_date', 'Data płatności', true);
            $form->Textarea('additional', 'Dodatkowe informacje', '', false, '', 1, 60);
            $view->Header("Dodaj płatności");
            $view->Custom('<div class="allrowsofforms"><div class="rowofform">' . $form->Render() . '</div></div>');
            $view->Custom('<br><span id="addrowofform"> <i class="fa fa-plus" aria-hidden="true"></i> Dodaj kolejną płatność</span>');
            $view->Custom('<button id="addpayment"> Dodaj płatności </button>');
            $view->Render();
            break;
    }
} else {
    header('Location: index.php');
}