本文整理汇总了PHP中Main::GetData方法的典型用法代码示例。如果您正苦于以下问题:PHP Main::GetData方法的具体用法?PHP Main::GetData怎么用?PHP Main::GetData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Main
的用法示例。
在下文中一共展示了Main::GetData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Login
/**
*
*/
static function Login()
{
require VIEW . '/v_header.php';
$credentials = ['login' => Main::GetData()['login'], 'password' => Main::GetData()['password']];
if (Session::IsUserLogged()) {
header('Location: http://' . DOMAIN . '/home/display');
} else {
if (isset($credentials['login'], $credentials['password'])) {
Session::Login($credentials);
} else {
require VIEW . '/www/v_login.php';
}
}
require VIEW . '/v_footer.php';
}
示例2: Submit
static function Submit()
{
$data = Main::GetData();
if (isset($data['food_quantity'], $data['hotel_quantity'], $data['stop_over_quantity'], $data['kilometers_quantity'])) {
if (Database::Check((int) $data['food_quantity'], 'SMALLINT') && Database::Check((int) $data['hotel_quantity'], 'SMALLINT') && Database::Check((int) $data['stop_over_quantity'], 'SMALLINT') && Database::Check((int) $data['kilometers_quantity'], 'SMALLINT') && !Session::Get('accountant')) {
$now = new DateTime();
$now = $now->format('Y-m-d');
$report = ExpenseReport::GetReport($now, Session::Get('id'));
$query = 'UPDATE package_entry ' . 'SET quantity=:quantity ' . 'WHERE fk_expense_report=:fk_expense_report ' . 'AND fk_expense_package=:fk_expense_package';
Database::Exec($query, ['quantity' => (int) $data['food_quantity'], 'fk_expense_report' => (int) $report->getId(), 'fk_expense_package' => 4]);
Database::Exec($query, ['quantity' => (int) $data['hotel_quantity'], 'fk_expense_report' => (int) $report->getId(), 'fk_expense_package' => 3]);
Database::Exec($query, ['quantity' => (int) $data['stop_over_quantity'], 'fk_expense_report' => (int) $report->getId(), 'fk_expense_package' => 1]);
Database::Exec($query, ['quantity' => (int) $data['kilometers_quantity'], 'fk_expense_report' => (int) $report->getId(), 'fk_expense_package' => 2]);
$query = 'UPDATE expense_report ' . 'SET update_date=:update_date ' . 'WHERE id=:id';
$now = new DateTime();
$now = $now->format('Y-m-d');
Database::Exec($query, ['update_date' => $now, 'id' => $report->getId()]);
}
} elseif (isset($data['non_package_date'], $data['non_package_label'], $data['non_package_amount']) && !Session::Get('accountant')) {
if (Database::Check($data['non_package_label'], 'VARCHAR') && Database::Check((int) $data['non_package_amount'], 'MEDIUMINT')) {
$query = 'INSERT INTO non_package_entry(label, entry_date, amount, fk_expense_status, fk_expense_report) ' . 'VALUES(:label, :entry_date, :amount, 1, :fk_expense_report)';
$entry_date = new DateTime($data['non_package_date']);
$entry_date = $entry_date->format('Y-m-d');
$now = new DateTime();
$now = $now->format('Y-m-d');
$report = ExpenseReport::GetReport($now, Session::Get('id'));
Database::Exec($query, ['label' => $data['non_package_label'], 'entry_date' => $entry_date, 'amount' => $data['non_package_amount'], 'fk_expense_report' => $report->getId()]);
$query = 'UPDATE expense_report ' . 'SET update_date=:update_date ' . 'WHERE id=:id';
$now = new DateTime();
$now = $now->format('Y-m-d');
Database::Exec($query, ['update_date' => $now, 'id' => $report->getId()]);
}
} elseif (isset($data['status_change'], $data['report_id']) && Session::Get('accountant')) {
$query = '
UPDATE expense_report
SET fk_report_status=:status_change
WHERE id=:id
';
Database::Exec($query, ['status_change' => $data['status_change'], 'id' => $data['report_id']]);
$query = 'UPDATE expense_report ' . 'SET update_date=:update_date ' . 'WHERE id=:id';
$now = new DateTime();
$now = $now->format('Y-m-d');
Database::Exec($query, ['update_date' => $now, 'id' => $data['report_id']]);
} elseif (isset($data['report_id']) && Session::Get('accountant')) {
throw new Exception('Impossible de récupérer les données de formulaire.');
header('refresh:10; url=/home/display');
}
if (Session::Get('accountant')) {
header('Location: /report/validate');
} else {
header('Location: /report/edit');
}
}