本文整理汇总了PHP中Teacher::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Teacher::add方法的具体用法?PHP Teacher::add怎么用?PHP Teacher::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Teacher
的用法示例。
在下文中一共展示了Teacher::add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Validate
<?php
require_once 'core/init.php';
if (!Session::exists('teacher_email') && !loggedIn()) {
Redirect::to('index.php');
}
if (Input::exists('post')) {
$validate = new Validate();
$validation = $validate->check($_POST, array('mobile' => array('required' => true, 'min' => 10, 'max' => 10)));
if ($validate->passed()) {
$dep = new Teacher();
$add = $dep->add(Session::get('displayname'), Session::get('teacher_email'), 'teacher', Input::get('department'), Input::get('mobile'), '0');
if ($add == 1) {
Session::destroy();
Redirect::to('includes/errors/not_approved.php');
$log = new Log();
$log->actionLog('Added Teacher');
} else {
if ($add == 0) {
echo 'Temporary Error, while creating saving information.';
}
}
}
}
/*******************************************************************************************************************************************/
/*******************************************************************************************************************************************/
/*******************************************************************************************************************************************/
/*******************************************************************************************************************************************/
?>
<!DOCTYPE html>
<html>
示例2: Validate
<?php
require_once '../core/init.php';
if (Input::exists('post') && privilege() != NULL) {
$validate = new Validate();
$validation = $validate->check($_POST, array('name' => array('required' => true), 'email' => array('required' => true, 'email' => true), 'privilege' => array('required' => true), 'mobile' => array('required' => true, 'min' => 10, 'max' => 10)));
if ($validate->passed()) {
$dep = new Teacher();
$add = $dep->add(Input::get('name'), Input::get('email'), Input::get('privilege'), Input::get('department'), Input::get('mobile'), '1');
if ($add == 4) {
echo '<div class="alert alert-danger alert-dismissible" role="alert">';
echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>';
echo 'Maximum no. of possible ' . Input::get('privilege') . ' exists.';
echo '</div>';
} else {
if ($add == 3) {
echo '<div class="alert alert-danger alert-dismissible" role="alert">';
echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>';
echo 'Sorry, you don\'t have privilege to add <b>' . Input::get('privilege') . '</b>. ';
echo '</div>';
} else {
if ($add == 2) {
echo '<div class="alert alert-danger alert-dismissible" role="alert">';
echo '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>';
echo 'Teacher already registered';
echo '</div>';
} else {
if ($add == 1) {
$log = new Log();
$log->actionLog('Added Teacher');
echo '<div class="alert alert-success alert-dismissible" role="alert">';