当前位置: 首页>>代码示例>>PHP>>正文


PHP privilege函数代码示例

本文整理汇总了PHP中privilege函数的典型用法代码示例。如果您正苦于以下问题:PHP privilege函数的具体用法?PHP privilege怎么用?PHP privilege使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了privilege函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: startNewSession

 public function startNewSession()
 {
     if (!loggedIn() && (privilege() != 'dean' || privilege() != 'director' || privilege() != 'admin')) {
         return 0;
     }
     $this->_connect();
     if (!Session::exists('semester_session')) {
         $type = 'odd';
         $session = date('Y');
     } else {
         if (Session::get('semester_type') === 'even') {
             $type = 'odd';
             $session = Session::get('semester_session');
         } else {
             if (Session::get('semester_type') === 'odd') {
                 $type = 'even';
                 $session = Session::get('semester_session') + 1;
             }
         }
     }
     $timestamp = date('Y-m-d H:i:s');
     $query = "INSERT INTO semester_session (session,type,starting_timestamp) VALUES('" . $session . "','" . $type . "','" . $timestamp . "')";
     $result = $this->_db->query($query);
     if ($this->_db->affected_rows && $this->_db->error == '') {
         $this->getRunningSession();
         return 1;
     } else {
         return 0;
     }
 }
开发者ID:mkrdip,项目名称:Management-Information-System,代码行数:30,代码来源:Semester.php

示例2: importCSV

 public function importCSV($course_code, $course_dep, $filename)
 {
     if (!loggedIn() || privilege() == NULL || privilege() == 'admin') {
         return 0;
     }
     $file = fopen($filename, "r");
     $count = 0;
     while (($data = fgetcsv($file, 10000, ",")) !== FALSE) {
         $count++;
         if ($count > 1) {
             $save = $this->newEntry($data[0], $course_code, $course_dep, $data[1], $data[2]);
         }
     }
     fclose($file);
     return 1;
 }
开发者ID:mkrdip,项目名称:Management-Information-System,代码行数:16,代码来源:Attendance.php

示例3: privilegePriority

/**
 * Admin has a priority of 0
 * Director, Dean  has a priority of 1
 * HOD has a priority of 2
 * DUPC/DPPC has a priority of 3
 * Teacher has a priority of 4
 * Student has a priority of 5
 * @return integer
 * @author Harsh Vardhan Ladha & Yogesh Chauhan
 * @package MIS
 * @link http://mis.nits.ac.in
 * @license NIT Silchar
 */
function privilegePriority()
{
    switch (privilege()) {
        case 'admin':
            return 0;
        case 'director':
        case 'dean':
            return 1;
        case 'hod':
            return 2;
        case 'dupc':
        case 'dppc':
            return 3;
        case 'teacher':
            return 4;
        case 'student':
            return 5;
    }
}
开发者ID:mkrdip,项目名称:Management-Information-System,代码行数:32,代码来源:privilege.php

示例4: Validate

<?php

require_once '../core/init.php';
if (Input::exists() && privilege() != NULL && privilege() != 'admin') {
    $validate = new Validate();
    $validation = $validate->check($_POST, array('course_id' => array('required' => true)));
    if ($validate->passed()) {
        if (empty($_FILES["file"]["tmp_name"])) {
            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 'Please Select CSV File';
            echo '</div>';
            die;
        }
        $input = explode(',', Input::get('course_id'));
        $m = new Attendance();
        $import = $m->importCSV($input[0], $input[1], $_FILES["file"]["tmp_name"]);
        if ($import) {
            echo '<div class="alert alert-success 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 "Successfully Imported";
            echo '</div>';
        } else {
            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 "Temporary problem!";
            echo '</div>';
        }
    } else {
        echo '<div class="alert alert-warning 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>';
开发者ID:mkrdip,项目名称:Management-Information-System,代码行数:31,代码来源:import_attendance.php

示例5: Validate

<?php

require_once '../core/init.php';
if (Input::exists('post') && privilege() != NULL) {
    $validate = new Validate();
    $validation = $validate->check($_POST, array('coursecode' => array('required' => true), 'department' => array('required' => true), 'teacher' => array('required' => true), 'semester' => array('required' => true)));
    if ($validate->passed()) {
        $course = new Course();
        $add = $course->appointCourse(Input::get('teacher'), Input::get('coursecode'), Input::get('semester'), Input::get('department'));
        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, This teacher is not yet approved to use this system.';
            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 'Same course is already assigned to same teacher in this department.';
                echo '</div>';
            } else {
                if ($add == 1) {
                    echo '<div class="alert alert-success 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 'Course assigned to teacher successfully.';
                    echo '</div>';
                } else {
                    if ($add == 0) {
                        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 'Temporary Error!';
开发者ID:mkrdip,项目名称:Management-Information-System,代码行数:31,代码来源:assign_course_teacher.php

示例6: Student

<?php

require_once '../core/init.php';
if (!loggedIn() || privilege() == NULL || privilege() == 'admin') {
    die;
}
?>
<!-- DATA TABLES -->
<link href="css/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css" />
<?php 
$s = new Student();
$s->getInfo(Session::get('sn'));
?>
				<section class="content-header">
                    <h1>
                        Attendance System
                        <small>View attendance</small>
                    </h1>
                    <ol class="breadcrumb">
                        <li><a href="home.php"><i class="fa fa-dashboard"></i> Home</a></li>
                        <li><a href="#">Attendance System</a></li>
                        <li class="active">View attendance</li>
                    </ol>
                </section>

                <!-- Main content -->
                <section class="content">
                	<div class="row">
                		<div class="col-md-1">
                			&nbsp;
                		</div>
开发者ID:mkrdip,项目名称:Management-Information-System,代码行数:31,代码来源:attendance_page.php

示例7: Validate

<?php

require_once '../core/init.php';
if (Input::exists() && privilege() != NULL) {
    $validate = new Validate();
    $validation = $validate->check($_POST, array('course_id' => array('required' => true), 'examtype' => array('required' => true), 'category' => array('required' => true)));
    if ($validate->passed()) {
        $m = new Marks();
        $lastdate = $m->getLastDate(Input::get('examtype'))->fetch_object()->date;
        $today = date('Y-m-d');
        if ($today >= $lastdate) {
            $date = date_create($lastdate);
            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 "Last Date for " . strtoupper(Input::get('examtype')) . " was " . date_format($date, 'd-M-Y');
            echo '</div>';
            die;
        }
        if (empty($_FILES["file"]["tmp_name"])) {
            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 'Please Select CSV File';
            echo '</div>';
            die;
        }
        $input = explode(',', Input::get('course_id'));
        $m = new Marks();
        $import = $m->importCSV($input[0], $input[1], Input::get('examtype'), Input::get('category'), $_FILES["file"]["tmp_name"]);
        if ($import) {
            echo '<div class="alert alert-success 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>';
开发者ID:mkrdip,项目名称:Management-Information-System,代码行数:31,代码来源:import_excel.php

示例8:

<?php

require_once '../core/init.php';
if (!loggedIn()) {
    die;
}
if (privilege() == NULL) {
    die;
}
?>
                    <div class="row" id="content_area">
                        <div class="col-xs-12">
                            <div class="box">
                                <div class="box-header">
                                    <h3 class="box-title">List of all Teachers</h3>
                                </div><!-- /.box-header -->
                                <div class="box-body table-responsive">
                                    <table id="example1" class="table table-bordered table-striped">
                                        <thead>
                                            <tr>
                                                <th>Name</th>
                                                <th>Privilege</th>
                                                <th>Department</th>
                                                <th>Email</th>
                                                <th>Mobile</th>
                                                <th>Approved</th>
                                                <th>Blocked</th>
                                                <th>&nbsp;</th>
                                            </tr>
                                        </thead>
                                        <tbody>
开发者ID:mkrdip,项目名称:Management-Information-System,代码行数:31,代码来源:load_teacher.php

示例9: updateBiography

 public function updateBiography($scholar_no, $biography, $cv = '')
 {
     if (!loggedIn() || privilege() == NULL) {
         return 0;
     }
     $this->_connect();
     $scholar_no = $this->_db->real_escape_string(escape($scholar_no));
     $biography = $this->_db->real_escape_string($biography);
     if ($cv == '') {
         $query = "UPDATE students_info SET biography = '" . $biography . "' WHERE scholar_no='" . $scholar_no . "'";
     } else {
         $cv = $this->_db->real_escape_string($cv);
         $query = "UPDATE students_info SET biography = '" . $biography . "', cv_link='" . $cv . "' WHERE scholar_no='" . $scholar_no . "'";
     }
     $result = $this->_db->query($query);
     if ($this->_db->error == '') {
         if ($this->_db->affected_rows) {
             return 1;
         } else {
             return 2;
         }
     } else {
         return 0;
     }
 }
开发者ID:mkrdip,项目名称:Management-Information-System,代码行数:25,代码来源:Student.php

示例10:

                            </ul>
                        </li>
                        <?php 
if (privilege() != 'admin') {
    ?>
                        <li <?php 
    echo Session::get('side-nav-active') === 'attendance' ? 'class=active' : '';
    ?>
 >
                            <a href="attendance.php">
                                <i class="fa fa-calendar"></i> <span>Attendance System</span>
                            </a>
                        </li>
                        <?php 
}
if (privilege() === 'admin' || privilege() === 'director' || privilege() === 'dean') {
    ?>
                        <li <?php 
    echo Session::get('side-nav-active') === 'settings' ? 'class=active' : '';
    ?>
 >
                            <a href="settings.php">
                                <i class="fa fa-wrench"></i> <span>System Settings</span>
                            </a>
                        </li>
                        <?php 
}
?>
                    </ul>
                </section>
                <!-- /.sidebar -->
开发者ID:mkrdip,项目名称:Management-Information-System,代码行数:31,代码来源:sidebar.php

示例11:

<?php

require_once 'core/init.php';
if (!loggedIn()) {
    Redirect::to('index.php');
} else {
    if (loggedIn() && (privilege() === 'teacher' || privilege() === 'dppc' || privilege() === 'dupc') || privilege() === 'student') {
        include 'includes/errors/404.php';
        die;
    }
}
?>
<link rel="icon" href="images/nits2.jpg">
<link rel="shortcut icon" href="images/nits2.jpg" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/result.css">
<script>
	function load_pie(type){
		$("#pie").load('ajax/log_pie.php?type='+type);
	}
</script>
<div class="tableh">System Log</div>
		<div class="res">
			<table>
				<tr>
					<td class="sel">
						Select Log Type
					</td>
					<td>
						<select name="credit" class="box" OnChange="load_pie(this.value);">
							<option value="" selected>Default</option>
开发者ID:mkrdip,项目名称:Management-Information-System,代码行数:31,代码来源:system_log.php

示例12: Approval

<?php

require_once '../core/init.php';
if (loggedIn() && privilege() != NULL) {
    if (Input::exists('get')) {
        $tid = Input::get('tid');
        $cid = Input::get('cid');
        $did = Input::get('did');
        $a = new Approval();
        $b = $a->approve($tid, $cid, $did);
        if ($b === 1) {
            echo '<div class="alert alert-success alert-dismissible" role="alert">';
            echo 'Result approved!';
            echo '</div>';
        } else {
            if ($b === 2) {
                echo '<div class="alert alert-warning alert-dismissible" role="alert">';
                echo 'Already approved by you!';
                echo '</div>';
            } else {
                if ($b === 0) {
                    echo '<div class="alert alert-success alert-dismissible" role="alert">';
                    echo 'Temporary Error!';
                    echo '</div>';
                } else {
                    echo '<div class="alert alert-danger alert-dismissible" role="alert">';
                    echo $b;
                    echo '</div>';
                }
            }
        }
开发者ID:mkrdip,项目名称:Management-Information-System,代码行数:31,代码来源:approve_result.php

示例13: remove_appointed_course

 public function remove_appointed_course($id, $course_code, $department, $semester)
 {
     if (!loggedIn()) {
         return 'Temporary Problem.';
     }
     if (loggedIn() && (privilege() === 'teacher' || privilege() === 'dppc' || privilege() === 'dupc' || privilege() == NULL)) {
         return 'Access Denied. No privilege.';
     }
     $this->_connect();
     $id = $this->_db->real_escape_string($id);
     $course_code = $this->_db->real_escape_string($course_code);
     $department = $this->_db->real_escape_string($department);
     $semester = $this->_db->real_escape_string($semester);
     $query = "DELETE FROM courses_appointed WHERE id='" . $id . "' AND course_code='" . $course_code . "' AND course_dep='" . $department . "' AND course_sem='" . $semester . "'AND timestamp>=' " . Session::get('semester_timestamp') . "'";
     $result = $this->_db->query($query);
     if ($this->_db->affected_rows) {
         if ($this->_db->error == '') {
             return 'Entry has been Deleted';
         } else {
             echo '1';
             die($this->_db->error);
         }
     } else {
         return 'Temporary Problem.';
     }
 }
开发者ID:mkrdip,项目名称:Management-Information-System,代码行数:26,代码来源:Course.php

示例14: deleteT

 public function deleteT($t_id = '', $privilege = 'teacher')
 {
     if (loggedIn() && ($privilege === 'director' && (privilege() === 'hod' || privilege() === 'dupc' || privilege() === 'dppc' || privilege() === 'teacher') || $privilege === 'dean' && (privilege() === 'hod' || privilege() === 'dupc' || privilege() === 'dppc' || privilege() === 'teacher') || $privilege === 'hod' && (privilege() === 'dupc' || privilege() === 'dppc' || privilege() === 'teacher') || $privilege === 'dppc' && privilege() === 'teacher' || $privilege === 'dupc' && privilege() === 'teacher')) {
         return 'No privilege';
     }
     if (loggedIn() && $this->deleteTeacherError($t_id)) {
         return "Sorry, cannot remove this teacher because he/she already has<br/>(<i>in this running session</i>)<br/>" . ($this->_tce != 0 ? " <b>{$this->_tce}</b> courses appointed.<br/>" : "") . ($this->_tae != 0 ? " <b>{$this->_tae}</b> subject results not fully approved." : "");
     }
     if (loggedIn()) {
         if (Session::exists('teacher_id')) {
             if (Session::get('teacher_id') == $t_id) {
                 return 'Can\'t delete yourself.';
             }
         }
         $this->_connect();
         $this->_id = $this->_db->real_escape_string(escape($t_id));
         $query = "DELETE FROM teachers WHERE teacher_id='" . $this->_id . "'";
         $result = $this->_db->query($query);
         if ($this->_db->affected_rows) {
             if ($this->_db->error == '') {
                 return 'Teacher removed.';
             } else {
                 die($this->_db->error);
             }
         } else {
             return 'Temporary Error';
         }
     }
     if (!loggedIn()) {
         return 'Temporary error';
     }
 }
开发者ID:mkrdip,项目名称:Management-Information-System,代码行数:32,代码来源:Teacher.php

示例15: Semester

<?php

require_once '../core/init.php';
if (Input::exists('get') && Input::get('a') != '' && (privilege() == 'dean' || privilege() == 'director' || privilege() == 'admin')) {
    $ab = Input::get('a');
    $s = new Semester();
    if ($ab == 1) {
        $a = $s->startRegistration();
        if ($a == 1) {
            echo '<div class="alert alert-success 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 'Registration process started.';
            echo '</div>';
        } else {
            if ($a == 2) {
                echo '<div class="alert alert-warning 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 'No changes made.';
                echo '</div>';
            } else {
                if ($a == 0) {
                    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 'Invalid authentication. Please try again later or re-login.';
                    echo '</div>';
                }
            }
        }
    }
    if ($ab == 2) {
        $a = $s->stopRegistration();
开发者ID:mkrdip,项目名称:Management-Information-System,代码行数:31,代码来源:registration_action.php


注:本文中的privilege函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。