当前位置: 首页>>代码示例>>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;未经允许,请勿转载。