本文整理匯總了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">';