本文整理汇总了PHP中Registration::checkIfAdmin方法的典型用法代码示例。如果您正苦于以下问题:PHP Registration::checkIfAdmin方法的具体用法?PHP Registration::checkIfAdmin怎么用?PHP Registration::checkIfAdmin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registration
的用法示例。
在下文中一共展示了Registration::checkIfAdmin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
function process($parameters)
{
$registration = new Registration();
if (!$registration->checkIfAdmin($_SESSION['id_user'])) {
$this->redirect('error');
}
//catch registration (button is pressed)
if (isset($_POST['sent'])) {
$data = $registration->sanitize(["email" => $_POST['email'], "tariff" => $_POST['tariff'], "firstname" => $_POST['firstname'], "surname" => $_POST['surname'], "telephone" => $_POST['telephone'], 'address' => $_POST['address'], "startDate" => $_POST['startDate'], "ic" => $_POST['ic'], "p" => $registration->getRandomHash()]);
$this->data = $data;
//for autofilling from previous page
$result = $registration->validateData($data);
if ($result['s'] == 'success') {
$fakturoid = new FakturoidWrapper();
$newCustomer = $fakturoid->createCustomer($data);
if ($newCustomer == false) {
$result = ['s' => 'error', 'cs' => 'Bohužel se nepovedlo uložit data do Faktuoidu; zkus to prosím za pár minut', 'en' => 'Sorry, we didn\'n safe your data into Fakturoid; try it again after a couple of minutes please'];
} else {
//add fakturoid_id into data structure
$data['fakturoid_id'] = $newCustomer->id;
$result = $registration->registerUser($data, $this->language);
}
}
//change success message for admin
if ($result['s'] == 'success') {
$result = ['s' => 'success', 'cs' => 'Nový uživatel je úspěšně zaregistrován', 'en' => 'New member is successfully registred'];
}
$this->messages[] = $result;
}
$this->header['title'] = ['cs' => 'Registrace nového uživatele', 'en' => 'Registration of new user'];
$this->data['tariffs'] = $registration->returnTariffsData($this->language);
$this->view = 'forceRegistration';
}
示例2: process
function process($parameters)
{
$registration = new Registration();
if (!$registration->checkIfAdmin($_SESSION['id_user'])) {
$this->redirect('error');
}
//catch registration (button is pressed)
if (isset($_POST['sent'])) {
$data = $registration->sanitize(["email" => $_POST['email'], "tariff" => $_POST['tariff'], "firstname" => $_POST['firstname'], "surname" => $_POST['surname'], "telephone" => $_POST['telephone'], "startDate" => $_POST['startDate'], "ic" => $_POST['ic'], "p" => $registration->getRandomHash()]);
$this->data = $data;
//for autofilling from previous page
$result = $registration->validateData($data);
if ($result['s'] == 'success') {
$result = $registration->registerUser($data, $this->language);
}
$this->messages[] = $result;
}
$this->header['title'] = ['cs' => 'Registrace nového uživatele', 'en' => 'Registration of new user'];
$this->data['tariffs'] = $registration->returnTariffsData($this->language);
$this->view = 'forceRegistration';
}