public function actionCreate() { $model = new Teachers('insert'); $users_list = CHtml::listData(Users::model()->findAll(), 'id', 'username'); if (Yii::app()->request->isPostRequest) { $classroom = Yii::app()->request->getParam('Teachers'); $model->setAttributes($classroom); if (!Yii::app()->user->checkAccess('admin')) { $model->setAttribute('owner_id', Yii::app()->user->id); } if ($model->save()) { Yii::app()->user->setFlash('success', 'Преподаватель успешно создан'); $this->redirect(['index']); } } $this->render('form', ['model' => $model, 'users_list' => $users_list]); }
public function actionIndex() { $model = Teachers::model()->find(); $flag = 0; $flag1 = 0; if (!empty($_POST['Teachers'])) { $image1_old = $model->attributes['image1']; if (!empty(CUploadedFile::getInstance($model, 'image1')->name)) { $image1_old = $model->attributes['image1']; $path = realpath(Yii::app()->basePath . '/../upload/images/' . $image1_old); if (file_exists($path) && !empty($image1_old)) { unlink($path); } $model->attributes = $_POST['Teachers']; $model->image1 = CUploadedFile::getInstance($model, 'image1'); $image = $model->image1; $imageType = explode('.', $model->image1->name); $imageType = $imageType[count($imageType) - 1]; $imageName = md5(uniqid()) . '.' . $imageType; $model->image1 = $imageName; $images_path = Yii::getPathOfAlias('webroot') . '/upload/images/' . $imageName; $flag = 1; } else { $model->image1 = $image1_old; $model->attributes = $_POST['Teachers']; } $image2_old = $model->attributes['image2']; if (!empty(CUploadedFile::getInstance($model, 'image2')->name)) { $image2_old = $model->attributes['image2']; $path = realpath(Yii::app()->basePath . '/../upload/images/' . $image2_old); if (file_exists($path) && !empty($image2_old)) { unlink($path); } $model->image2 = CUploadedFile::getInstance($model, 'image2'); $image1 = $model->image2; $imageType = explode('.', $model->image2->name); $imageType = $imageType[count($imageType) - 1]; $imageName = md5(uniqid()) . '.' . $imageType; $model->image2 = $imageName; $images_path1 = Yii::getPathOfAlias('webroot') . '/upload/images/' . $imageName; $flag1 = 1; } else { $model->image2 = $image2_old; $model->attributes = $_POST['Teachers']; } if ($model->save()) { Yii::app()->user->setFlash('success', translate('Cập nhật thành công.')); if ($flag == 1) { $image->saveAs($images_path); } if ($flag1 == 1) { $image1->saveAs($images_path1); } $this->redirect(PIUrl::createUrl('/admin/teachers')); } } $this->render('index', array('model' => $model)); }
/** * Display a listing of the resource. * * @return Response */ public function getCreate() { $teachers = Teachers::getPublish(); $categories = Categories::getPublish(); $events = Events::getPublish(); $companies = Companies::getPublish(); $sections = Sections::getPublish(); $array = array('teachers' => $teachers, 'categories' => $categories, 'events' => $events, 'companies' => $companies, 'promotioners' => $companies, 'supporters' => $companies, 'sections' => $sections, 'route' => $this->route); // $courses = Courses::getUntrash(); return View::make("backend.courses.create")->with($array); }
public function get_by_id($id) { $this->db->connect(); $sql = "SELECT * FROM teachers WHERE id=?"; $stmt = $this->db->initialize($sql); $stmt->bind_param("i", $id); $stmt->execute(); $stmt->bind_result($id, $first_name, $last_name, $email, $contact_no, $faculty); $teacher = new Teachers(); while ($row = $stmt->fetch()) { $teacher->set_id($id); $teacher->set_first_name($first_name); $teacher->set_last_name($last_name); $teacher->set_email($email); $teacher->set_contact_no($contact_no); $teacher->set_faculty($faculty); } return $teacher; }
function show_more_teacher() { header('Content-Type: text/html; charset=utf-8'); global $display; $anchor_index = intval(Url::get('anchor_index', 0)); $teacher_list = Teachers::get_collection(' LIMIT ' . $anchor_index * 24 . ', 25', ' t.is_active = 1 ', ' name '); if (count($teacher_list) == 25) { $is_next = 1; array_pop($teacher_list); } else { $is_next = 0; } if (empty($teacher_list)) { exit; } $display->add('teacher_list', $teacher_list); $display->add('anchor_index', $anchor_index); $display->add('is_next', $is_next); $display->output('Giaovien/ajax/ShowMore'); exit; }
public function getUpdate($idCourse, $idContent = '') { if ($idContent == '') { return Redirect::to(self::parseRoute($idCourse)); } else { $content = CoursesSection::find($idContent); if (!$content) { return Redirect::to(self::parseRoute($idCourse))->with('msg_error', Lang::get('messages.contents_display_err')); } else { $course = Courses::find($idCourse); $array = array('course' => $course, 'content' => $content, 'route' => self::parseRoute($idCourse)); $view = null; switch ($content->section->type) { case 'text': $view = 'backend.content.section'; break; case 'teachers': $array['teachers'] = Teachers::getPublish(); $view = 'backend.content.teachers'; break; case 'helpers': $array['helpers'] = Companies::getPublish(); $view = 'backend.content.helpers'; break; case 'promotioners': $array['promotioners'] = Companies::getPublish(); $view = 'backend.content.promotioners'; break; case 'supporters': $array['supporters'] = Companies::getPublish(); $view = 'backend.content.supporters'; break; default: $view = 'backend.content.section'; break; } return View::make($view, $array); } } }
<?php /** * @author lolkittens * @copyright 2014 */ session_start(); include '../class/config.php'; include '../class/class_teachers.php'; $teacher = new Teachers(); $id = $_GET['id']; $teacher->teacherDeactivate($id);
public function getDelete($id = '') { if ($id == '') { return Redirect::to($this->route)->with('msg_error', Lang::get('messages.teachers_display_err')); } else { $teacher = Teachers::find($id); $delete = Teachers::destroy($id); if (!$delete) { return Redirect::to($this->route . '/trash')->with('msg_error', Lang::get('messages.teachers_delete_err', array('firstName' => $teacher->firstName, 'lastName' => $teacher->lastName))); } else { return Redirect::to($this->route . '/trash')->with('msg_success', Lang::get('messages.teachers_delete', array('firstName' => $teacher->firstName, 'lastName' => $teacher->lastName))); } } }
/** * @return \yii\db\ActiveQuery */ public function getTeacher() { return $this->hasOne(Teachers::className(), ['teacher_id' => 'id_teacher']); }
public function actionUpdateReplace($replace_id) { $semester = Semesters::model()->actual(); if (!$semester) { throw new CHttpException(404, 'Сейчас нет семестра :-('); } /** @var GroupReplace $model */ $model = GroupReplace::model()->findByPk($replace_id); if (!$model || strtotime($model->date) < strtotime(date('Y-m-d'))) { throw new CHttpException(404, 'Замена не найдена'); } $classrooms = CHtml::listData(Classrooms::model()->byName()->findAll(), 'id', 'name'); $subjects = CHtml::listData(Subjects::model()->byName()->findAll(), 'id', 'name'); $teachers = CHtml::listData(Teachers::model()->byLastName()->findAll(), 'id', function ($model) { return join(' ', [$model->lastname, $model->firstname, $model->middlename]); }); if (Yii::app()->request->isPostRequest) { $replace = Yii::app()->request->getParam('GroupReplace'); $model->setAttributes($replace); $model->setAttributes(['group_id' => self::$group->id]); if ($model->save()) { Yii::app()->user->setFlash('success', 'Замена успешна обновлена'); $this->redirect(['replaces', 'id' => self::$group->number]); } } $this->render('replace/form', ['semester' => $semester, 'model' => $model, 'teachers' => $teachers, 'subjects' => $subjects, 'classrooms' => $classrooms, 'numbers' => [1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5]]); }
<?php session_start(); include '../class/config.php'; include '../class/class_teachers.php'; $teacher = new Teachers(); if ($_SERVER["REQUEST_METHOD"] == "POST") { $first_name = mysql_escape_string($_POST['first_name']); $last_name = mysql_escape_string($_POST['last_name']); $middle_name = mysql_escape_string($_POST['middle_name']); $birthdate = mysql_escape_string($_POST['birthdate']); $email_add = mysql_escape_string($_POST['email_address']); $address = mysql_escape_string($_POST['address']); $contact = mysql_escape_string($_POST['contact']); $teacher->first_name = $first_name; $teacher->last_name = $last_name; $teacher->middle_name = $middle_name; $teacher->birthdate = $birthdate; $teacher->email_add = $email_add; $teacher->address = $address; $teacher->contact = $contact; $file_upload_1 = "true"; $file_up_size_1 = $_FILES['photo']['size']; if ($_FILES['photo']['size'] > 10000000) { $msg = $msg . "Your uploaded file size is more than 10MB so please reduce the file size and then upload.<BR>"; $file_upload_1 = "false"; } if (!($_FILES['photo']['type'] == "image/jpeg" or $_FILES['photo'][type] == "image/gif")) { $msg = $msg . "Your uploaded file must be of JPG or GIF. Other file types are not allowed<BR>"; $file_upload_1 = "false"; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Teachers::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php /** * @author lolkittens * @copyright 2014 */ session_start(); include '../class/config.php'; include '../class/class_teachers.php'; $teacher = new Teachers(); $id = $_GET['id']; $teacher->teacherActivate($id);
<?php session_start(); include '../class/config.php'; include '../class/class_teachers.php'; $teacher = new Teachers(); $id = $_GET['id']; if ($_SERVER["REQUEST_METHOD"] == "POST") { $id = mysql_escape_string($_POST['teacher_id']); $file_upload_1 = "true"; $file_up_size_1 = $_FILES['photo']['size']; if ($_FILES['photo']['size'] > 10000000) { $msg = $msg . "Your uploaded file size is more than 10MB so please reduce the file size and then upload.<BR>"; $file_upload_1 = "false"; } if (!($_FILES['photo']['type'] == "image/jpeg" or $_FILES['photo'][type] == "image/gif")) { $msg = $msg . "Your uploaded file must be of JPG or GIF. Other file types are not allowed<BR>"; $file_upload_1 = "false"; } $file_name_1 = $_FILES['photo']['name']; $add_1 = "images/" . $file_name_1; // the path with the file name where the file will be stored if ($file_upload_1 == "true") { if (move_uploaded_file($_FILES['photo']['tmp_name'], $add_1)) { //$update = mysql_query("UPDATE products SET photo_1='$add_1' WHERE product_id='$id'"); } else { //echo "Failed to upload file Contact Site admin to fix the problem"; } } else { echo $msg; }
<?php session_start(); include '../class/config.php'; include '../class/class_teachers.php'; $teacher = new Teachers(); $id = $_GET['id']; $teacher->teacherData($id); $teacher->teacherDepartmentData($teacher->department_id); if (!isset($_SESSION['username'])) { header("Location: ../login.php"); } //echo $_SESSION['admin_login']; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <title>E-Blast</title> <!-- Bootstrap Core CSS --> <link href="<?php echo $url; ?>
require_once "config.php"; require_once ROOT_PATH . "system/model/teachers.class.php"; require_once ROOT_PATH . "system/repository/teacherrepository.class.php"; require_once ROOT_PATH . "system/dbutil/dbconnection2.class.php"; ?> <?php include_once ROOT_PATH . "teachers/header.php"; ?> <?php if (!isset($_POST['submit'])) { header("Location: index.php"); exit; } $teacher = new Teachers(); $teacher->set_first_name($_POST['first_name']); $teacher->set_last_name($_POST['last_name']); $teacher->set_email($_POST['email']); $teacher->set_contact_no($_POST['contact_no']); $teacher->set_faculty($_POST['faculty']); $teacherrepository = new TeacherRepository(); if (isset($_POST['id']) && $_POST['id'] == "") { $result = $teacherrepository->insert($teacher); } else { $teacher->set_id($_POST['id']); $result = $teacherrepository->update($teacher); } if ($result > 0) { header("Location: index.php/?success=true"); }
<?php session_start(); include '../class/config.php'; include '../class/class_teachers.php'; $teacher = new Teachers(); $id = $_GET['id']; $teacher->teacherData($id); if ($_SERVER["REQUEST_METHOD"] == "POST") { $first_name = mysql_escape_string($_POST['first_name']); $last_name = mysql_escape_string($_POST['last_name']); $middle_name = mysql_escape_string($_POST['middle_name']); $birthdate = mysql_escape_string($_POST['birthdate']); $email_add = mysql_escape_string($_POST['email_address']); $address = mysql_escape_string($_POST['address']); $contact = mysql_escape_string($_POST['contact']); $teacherId = mysql_escape_string($_POST['teacher_id']); $status = mysql_escape_string($_POST['status']); $department = mysql_escape_string($_POST['department']); $teacher->first_name = $first_name; $teacher->last_name = $last_name; $teacher->middle_name = $middle_name; $teacher->birthdate = $birthdate; $teacher->email_add = $email_add; $teacher->address = $address; $teacher->contact_no = $contact; $teacher->status = $status; $teacher->department_id = $department; $teacher->teacherEdit($teacherId); } ?>
echo $form->labelEx($model, 'amount'); ?> <?php echo $form->textField($model, 'amount'); ?> <?php echo $form->error($model, 'amount'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'teacher_id'); ?> <?php echo $form->dropDownList($model, 'teacher_id', CHtml::listData(Teachers::model()->findAll(), 'id', 'first_name'), array('empty' => 'Select a teacher')); ?> <?php echo $form->error($model, 'teacher_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'payed'); ?> <?php echo $form->checkbox($model, 'payed'); ?> <?php echo $form->error($model, 'payed');
<?php session_start(); include '../class/config.php'; include '../class/class_teachers.php'; $teacher = new Teachers(); if (!isset($_SESSION['username'])) { header("Location: ../login.php"); } //echo $_SESSION['admin_login']; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <title>E-Blast</title> <!-- Bootstrap Core CSS --> <link href="<?php echo $url; ?> css/bootstrap.min.css" rel="stylesheet"> <!-- MetisMenu CSS -->
function show_more_history_student() { header('Content-Type: text/html; charset=utf-8'); global $display; $id_view = intval(Url::get('id_view', 0)); $anchor_index = intval(Url::get('anchor_index_h', 0)); if ($id_view) { $history_student = Classes::get_list_teacher_log(' LIMIT ' . $anchor_index * 6 . ', 7', ' WHERE uid = ' . $id_view, 'ORDER BY id DESC'); } else { $history_student = Classes::get_list_teacher_log(' LIMIT ' . $anchor_index * 6 . ', 7', ' WHERE uid = ' . $_SESSION['user_id'], 'ORDER BY id DESC'); } $list_teacher = Teachers::get_collection(null); $list_lesson = Lessons::get_collection_with_join(null); if (count($history_student) == 7) { $is_next_h = 1; array_pop($history_student); } else { $is_next_h = 0; } if (empty($history_student)) { exit; } $display->add('history_student', $history_student); $display->add('list_teacher', $list_teacher); $display->add('list_lesson', $list_lesson); $display->add('anchor_index', $anchor_index); $display->add('is_next_h', $is_next_h); $display->output('Personal/ajax/ShowMoreHistory'); exit; }