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


PHP Subject::get_by_id方法代码示例

本文整理汇总了PHP中Subject::get_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Subject::get_by_id方法的具体用法?PHP Subject::get_by_id怎么用?PHP Subject::get_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Subject的用法示例。


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

示例1: header

$grades = Grade::get_by_sql("SELECT * FROM " . T_STUDENT_GRADES . " WHERE " . C_GRADE_STUDENT_ID . " = " . $student_id . " ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}");
header("Content-type: text/xml;charset=utf-8");
$s = "<?xml version='1.0' encoding='utf-8'?>";
$s .= "<rows>";
$s .= "<page>" . $page . "</page>";
$s .= "<total>" . $total_pages . "</total>";
$s .= "<records>" . $count . "</records>";
foreach ($grades as $grade) {
    if (Subject::get_by_id($grade->subject_id)->course_id != $student->course_id) {
        continue;
    }
    if (Subject::get_by_id($grade->subject_id)->semester != $student->semester) {
        //continue;
    }
    $s .= "<row id='" . $grade->id . "'>";
    $s .= "<cell>" . $grade->id . "</cell>";
    $s .= "<cell>" . Subject::get_by_id($grade->subject_id)->code . "</cell>";
    $s .= "<cell>" . Subject::get_by_id($grade->subject_id)->description . "</cell>";
    $s .= "<cell>" . $grade->grade . "</cell>";
    $s .= "<cell>" . Subject::get_by_id($grade->subject_id)->units . "</cell>";
    $s .= "<cell>" . Subject::get_by_id($grade->subject_id)->year . "</cell>";
    if ($grade->grade >= 75) {
        $remarks = "PASSED";
    } else {
        $remarks = "FAILED";
    }
    $s .= "<cell>" . $remarks . "</cell>";
    $s .= "</row>";
}
$s .= "</rows>";
echo $s;
开发者ID:NemOry,项目名称:OnlineSubjectEvaluationSystem,代码行数:31,代码来源:student_grades_subjects_xml2.php

示例2: Grade

        $newgrade = Grade::get_by_subj_stud($id, $student_id);
        $newgrade->delete();
    }
    $newgrade = new Grade();
    $newgrade->subject_id = $id;
    $newgrade->student_id = $student_id;
    $newgrade->grade = 0;
    $newgrade->create();
    $pre_subject = Subject::get_by_id($id);
    if (!EvaluatedSubject::exists($id, $student_id)) {
        $grade = Grade::get_by_subj_stud($pre_subject->id, $student_id);
        $gradepre = Grade::get_by_subj_stud($pre_subject->prereq_subject_id, $student_id);
        if (has_prerequisite($pre_subject->prereq_subject_id, $student_subjects)) {
            if ($gradepre != null) {
                if (Grade::get_by_subj_stud($pre_subject->prereq_subject_id, $student_id)->grade <= 74) {
                    $warnings .= "Cannot add " . $pre_subject->code . " because it's previous subject:" . Subject::get_by_id($pre_subject->prereq_subject_id)->code . " is failed\n\n";
                } else {
                    $eval_subject = new EvaluatedSubject();
                    $eval_subject->student_id = $student_id;
                    $eval_subject->subject_id = $id;
                    $eval_subject->create();
                }
            }
        } else {
            $eval_subject = new EvaluatedSubject();
            $eval_subject->student_id = $student_id;
            $eval_subject->subject_id = $id;
            $eval_subject->create();
        }
    }
}
开发者ID:NemOry,项目名称:OnlineSubjectEvaluationSystem,代码行数:31,代码来源:evaluate.php

示例3: redirect_to

<?php

require_once "../includes/initialize.php";
global $session;
if (!$session->is_logged_in()) {
    //     redirect_to("index.php");
    // }else{
    //     if(isset($session->student_id)){
    redirect_to("index.php");
    //}
}
$subject = Subject::get_by_id($_GET['subject_id']);
?>
<!DOCTYPE HTML>
<html>
<head>

    <meta charset="UTF-8" />
    <title>LasalTech Subject Advising System</title>

    <link href="css/fonts.css" rel="stylesheet"/>
    <link href="css/app.css" rel="stylesheet"/>
    <link href="css/bundledfun-ui/jquery-ui-1.8.23.custom.css" rel="stylesheet" media="screen" />
    <link href="css/ui.jqgrid.css" rel="stylesheet" media="screen" />
    <!-- <link href="css/bootstrap.min.css" rel="stylesheet"/> -->
</head>

<body style="background:#235c88;">

    <div id="main_container">
开发者ID:NemOry,项目名称:OnlineSubjectEvaluationSystem,代码行数:30,代码来源:teacherstudents.php

示例4: trim

}
$course_id = Course::get_by_sql("SELECT * FROM " . T_COURSES . " WHERE " . C_COURSE_CODE . "='" . trim($_POST['course_code']) . "'")[0]->id;
$rows = Subject::get_by_sql("SELECT * FROM " . T_SUBJECTS . " WHERE " . C_SUBJECT_CODE . "='" . $_POST['code'] . "' AND " . C_SUBJECT_COURSE_ID . "=" . $course_id);
if ($_POST['oper'] == 'add') {
    if (count($rows) > 0) {
        die("exists");
    }
    $subject = new Subject();
    $subject->code = $_POST['code'];
    $subject->description = $_POST['description'];
    $subject->units = $_POST['units'];
    $subject->prereq_subject_id = $prereq_subject_id;
    $subject->course_id = $course_id;
    $subject->year = $_POST['year'];
    $subject->semester = $_POST['semester'];
    $subject->curriculum_id = $_POST['curriculum_id'];
    $subject->create();
} else {
    if ($_POST['oper'] == 'edit') {
        $subject = Subject::get_by_id($_POST['id']);
        $subject->code = $_POST['code'];
        $subject->description = $_POST['description'];
        $subject->units = $_POST['units'];
        $subject->prereq_subject_id = $prereq_subject_id;
        $subject->course_id = $course_id;
        $subject->year = $_POST['year'];
        $subject->semester = $_POST['semester'];
        $subject->curriculum_id = $_POST['curriculum_id'];
        $subject->update();
    }
}
开发者ID:NemOry,项目名称:OnlineSubjectEvaluationSystem,代码行数:31,代码来源:update_subject.php

示例5: header

}
//$student_subjects = Grade::get_by_sql("SELECT * FROM " . T_STUDENT_GRADES . " WHERE ".C_GRADE_STUDENT_ID."=".$student->id);
$future_subjects = Subject::get_by_sql("SELECT * FROM " . T_SUBJECTS . " WHERE " . C_SUBJECT_COURSE_ID . "=" . $student->course_id . " AND " . C_SUBJECT_SEMESTER . " = " . $future_sem . " ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}");
// $student_current_subjects = array();
// foreach($student_subjects as $student_subject)
// {
//     array_push($student_current_subjects, Subject::get_by_id($student_subject->subject_id));
// }
header("Content-type: text/xml;charset=utf-8");
$s = "<?xml version='1.0' encoding='utf-8'?>";
$s .= "<rows>";
$s .= "<page>" . $page . "</page>";
$s .= "<total>" . $total_pages . "</total>";
$s .= "<records>" . $count . "</records>";
if (count($future_subjects) > 0) {
    foreach ($future_subjects as $final_subject) {
        $s .= "<row id='" . $final_subject->id . "'>";
        $s .= "<cell>" . $final_subject->id . "</cell>";
        $s .= "<cell>" . $final_subject->code . "</cell>";
        $s .= "<cell>" . $final_subject->description . "</cell>";
        $s .= "<cell>" . $final_subject->units . "</cell>";
        $subject_code = $final_subject->prereq_subject_id == 0 ? "NONE" : Subject::get_by_id($final_subject->prereq_subject_id)->code;
        $s .= "<cell>" . $subject_code . "</cell>";
        $s .= "<cell>" . Course::get_by_id($final_subject->course_id)->code . "</cell>";
        $s .= "<cell>" . $final_subject->semester . "</cell>";
        $s .= "<cell>" . $final_subject->year . "</cell>";
        $s .= "</row>";
    }
}
$s .= "</rows>";
echo $s;
开发者ID:NemOry,项目名称:OnlineSubjectEvaluationSystem,代码行数:31,代码来源:student_evaluated_subjects_xml.php

示例6: redirect_to

require_once "../includes/initialize.php";
global $session;
if (!$session->is_logged_in()) {
    redirect_to("index.php");
}
$id = $_POST['id'];
$teacher_id = $_POST['teacher_id'];
$subject_id = $_POST['subject_id'];
$operator = $_POST['oper'];
if ($operator == 'add') {
    $object = new TeacherSubject();
    $object->teacher_id = $teacher_id;
    $object->subject_id = $subject_id;
    if (Subject::get_by_id($object->subject_id) != null && User::get_by_id($object->teacher_id) != null) {
        $object->create();
    }
} else {
    if ($operator == 'edit') {
        $object = TeacherSubject::get_by_id($id);
        $object->teacher_id = $teacher_id;
        $object->subject_id = $subject_id;
        if (Subject::get_by_id($object->subject_id) != null && User::get_by_id($object->teacher_id) != null) {
            $object->update();
        }
    } else {
        if ($operator == 'del') {
            TeacherSubject::get_by_id($id)->delete();
        }
    }
}
开发者ID:NemOry,项目名称:OnlineSubjectEvaluationSystem,代码行数:30,代码来源:update_teacher_subject.php

示例7: header

    $page = $total_pages;
}
$start = $limit * $page - $limit;
if ($start < 0) {
    $start = 0;
}
if (!$sidx) {
    $sidx = 1;
}
$TeacherSubjects = TeacherSubject::get_by_sql("SELECT * FROM " . T_TEACHER_SUBJECTS . " ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}");
header("Content-type: text/xml;charset=utf-8");
$s = "<?xml version='1.0' encoding='utf-8'?>";
$s .= "<rows>";
$s .= "<page>" . $page . "</page>";
$s .= "<total>" . $total_pages . "</total>";
$s .= "<records>" . $count . "</records>";
foreach ($TeacherSubjects as $TeacherSubject) {
    $subject = Subject::get_by_id($TeacherSubject->subject_id);
    $teacher = User::get_by_id($TeacherSubject->teacher_id);
    $s .= "<row id='" . $TeacherSubject->id . "'>";
    $s .= "<cell></cell>";
    $s .= "<cell>" . $TeacherSubject->id . "</cell>";
    $s .= "<cell>" . $teacher->id . "</cell>";
    $s .= "<cell>" . $teacher->name . "</cell>";
    $s .= "<cell>" . $subject->id . "</cell>";
    $s .= "<cell>" . $subject->code . "</cell>";
    $s .= "<cell>" . $subject->description . "</cell>";
    $s .= "</row>";
}
$s .= "</rows>";
echo $s;
开发者ID:NemOry,项目名称:OnlineSubjectEvaluationSystem,代码行数:31,代码来源:teacher_subjects_xml.php

示例8: foreach

</style>
<?php 
require_once "../../includes/initialize.php";
$student = Student::get_by_id($_GET['student_id']);
$grades = Grade::get_by_sql("SELECT * FROM " . T_STUDENT_GRADES . " WHERE " . C_GRADE_STUDENT_ID . " = " . $student->id);
$s = "<table>";
$s .= "<tr>";
$s .= "<td>SUBJECT</td>";
$s .= "<td>GRADE</td>";
$s .= "<td>REMARKS</td>";
$s .= "</tr>";
foreach ($grades as $grade) {
    $s .= "<tr>";
    if (Subject::get_by_id($grade->subject_id)->course_id != $student->course_id) {
        continue;
    }
    if (Subject::get_by_id($grade->subject_id)->semester != $student->semester) {
        continue;
    }
    $s .= "<td>" . Subject::get_by_id($grade->subject_id)->code . "</td>";
    $s .= "<td>" . $grade->grade . "</td>";
    if ($grade->grade >= 75) {
        $remarks = "PASSED";
    } else {
        $remarks = "FAILED";
    }
    $s .= "<td>" . $remarks . "</td>";
    $s .= "</tr>";
}
$s .= "</table>";
echo $s;
开发者ID:NemOry,项目名称:OnlineSubjectEvaluationSystem,代码行数:31,代码来源:student_subjects_grades.php

示例9: foreach

				<td>UNITS</td>
				<td>PREREQUISITE</td>
				<td>COURSE</td>
				<td>YEAR</td>
				<td>SEMESTER</td>
				<td>CURRICULUM</td>
			</tr>
		</thead>
		<?php 
$subjects = Subject::getByCurriculum($curriculumid);
if (count($subjects) > 0) {
    foreach ($subjects as $subject) {
        $course = Course::get_by_id($subject->course_id);
        $curriculum = Curriculum::get_by_id($subject->curriculum_id);
        if ($subject->prereq_subject_id != "") {
            $prerequisitesubject = Subject::get_by_id($subject->prereq_subject_id);
            if (!$prerequisitesubject) {
                $prerequisitesubject = new Subject();
                $prerequisitesubject->code = "NONE";
            }
        } else {
            $prerequisitesubject = new Subject();
            $prerequisitesubject->code = "NONE";
        }
        if ($subject->semester == 1) {
            $subject->semester = "First";
        } else {
            if ($subject->semester == 2) {
                $subject->semester = "Second";
            }
        }
开发者ID:NemOry,项目名称:OnlineSubjectEvaluationSystem,代码行数:31,代码来源:viewsubjects.php


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