當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Teacher::add方法代碼示例

本文整理匯總了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>
開發者ID:mkrdip,項目名稱:Management-Information-System,代碼行數:31,代碼來源:signup_teacher.php

示例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">&times;</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">&times;</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">&times;</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">';
開發者ID:mkrdip,項目名稱:Management-Information-System,代碼行數:31,代碼來源:add_new_teacher.php


注:本文中的Teacher::add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。