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


PHP Teacher::setByArray方法代碼示例

本文整理匯總了PHP中Teacher::setByArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP Teacher::setByArray方法的具體用法?PHP Teacher::setByArray怎麽用?PHP Teacher::setByArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Teacher的用法示例。


在下文中一共展示了Teacher::setByArray方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: validateconfirm

 protected function validateconfirm()
 {
     $required = array("teacher_id" => "Teacher Id", "admission_date" => "Admission Date", "name" => "Name", "subject_id" => "Subject", "date_of_birth" => "Date of Birth", "gender" => "Gender", "mobile" => "Mobile");
     global $user;
     global $objPDO;
     $student = new Student($objPDO, $user->getuserId());
     if ($user->checkAdmin() == true || $student->checkTeacher() == true) {
         if (isset($_POST)) {
             foreach ($required as $key => $value) {
                 if (!isset($_POST[$key]) || $_POST[$key] == '' || $_POST[$key] == 'select') {
                     echo $value . ' is Required<br/>';
                     return;
                 }
             }
             if (!is_numeric($_POST['mobile'])) {
                 echo "Mobile number must be Numeric";
             } else {
                 if (isset($_POST['permanent_pincode']) && $_POST['permanent_pincode'] != '' && !is_numeric($_POST['permanent_pincode']) || isset($_POST['correspondence_pincode']) && $_POST['correspondence_pincode'] != '' && !is_numeric($_POST['correspondence_pincode'])) {
                     echo "Pincode must be Numeric";
                 } else {
                     echo 'Saving...';
                     require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/teacher_class.php';
                     $teacherProfile = new Teacher($objPDO);
                     if ($user->checkAdmin() == true) {
                         $teacher_id = $_GET['uid'];
                     } else {
                         $teacher_id = $student->getID();
                     }
                     if ($_POST['blood_group'] == 'select') {
                         unset($_POST['blood_group']);
                     }
                     $teacherProfile->loadByUserId($teacher_id);
                     $teacherProfile->setByArray($_POST);
                     $teacherProfile->save();
                     echo '<meta http-equiv="Refresh" content="0;url=http://localhost/cloud/teacher/view/' . $teacher_id . '"/>';
                 }
             }
         }
     } else {
         echo '<meta http-equiv="Refresh" content="0;url=http://localhost/cloud/teacher/view/"/>';
     }
 }
開發者ID:srinivasans,項目名稱:educloud,代碼行數:42,代碼來源:teacherController.php


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