本文整理汇总了PHP中Course::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Course::update方法的具体用法?PHP Course::update怎么用?PHP Course::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Course
的用法示例。
在下文中一共展示了Course::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doEdit
function doEdit()
{
$courseid = $_GET['id'];
$singledept = new Course();
$object = $singledept->single_course($courseid);
if (isset($_POST['savecourse'])) {
if ($_POST['coursename'] == "" or $_POST['coursedesc'] == "") {
message("All field is required!", "error");
} else {
$course = new Course();
$courseid = $_GET['id'];
$coursename = $_POST['coursename'];
$courselevel = $_POST['level'];
$coursemajor = $_POST['major'];
$coursedesc = $_POST['coursedesc'];
$coursedept = $_POST['dept'];
$course->COURSE_NAME = $coursename;
$course->COURSE_LEVEL = $courselevel;
$course->COURSE_MAJOR = $coursemajor;
$course->COURSE_DESC = $coursedesc;
$course->DEPT_ID = $coursedept;
$course->update($courseid);
message($coursename . " has updated successfully!", "info");
redirect('index.php');
}
}
}
示例2: Course
function test_update()
{
$name = "Western Civ";
$number = "HST 101";
$test_course = new Course($name, $number);
$test_course->save();
$new_name = "Eastern Meds";
$test_course->update($new_name);
$this->assertEquals("Eastern Meds", $test_course->getName());
}
示例3: testUpdate
function testUpdate()
{
$name = "History";
$course_number = "HIST100";
$test_course = new Course($name, $course_number);
$test_course->save();
$new_name = "Home Economics";
$test_course->update($new_name, $course_number);
$this->assertEquals($new_name, $test_course->getName());
}
示例4: testUpdate
function testUpdate()
{
//Arrange
$id = 1;
$name = "History";
$number = 101;
$test_course = new Course($name, $number, $id);
$test_course->save();
//Act
$new_name = "Auto";
$test_course->update($new_name);
//Assert
$this->assertEquals("Auto", $test_course->getName());
}
示例5: testUpdate
function testUpdate()
{
//Arrange
$course_name = "Intro to Art";
$course_number = "ART101";
$id = 1;
$test_course = new Course($course_name, $course_number, $id);
$test_course->save();
//Act
$new_course_name = "Intro to Fine Arts";
$test_course->update($new_course_name);
//Assert
$this->assertEquals("Intro to Fine Arts", $test_course->getCourseName());
}
示例6: save
function save()
{
$id = array_shift($this->param);
Security::checkEditor($id);
$translator = new Translator();
$obj = new Course();
try {
$data = array('name' => '', 'category_id' => 0, 'format_id' => 0, 'prerequisites' => '', 'language' => 0, 'describe' => '', 'skills' => '', 'duration' => 0, 'equipment' => '', 'min' => 0, 'max' => 0, 'author' => '', 'questions' => 0, 'active' => 'false', 'exam' => 'false', 'need_approve' => 'false', 'exam_duration' => 0);
foreach ($data as $key => $val) {
if (isset($_POST[$key])) {
$data[$key] = $_POST[$key];
}
}
$data['updated'] = date('Y-m-d H:i:s', time());
$data['category_name'] = $obj->getCategoryName($data['category_id']);
$obj->update($id, $data);
if (isset($_FILES['file'])) {
$this->uploadFiles($id);
}
echo <<<EOF
<div class="container">
<div class="page-header">
<h1>{$translator->Course_updated}</h1>
</div>
<p class="lead">{$translator->Course_updated_Desc}</p>
<p >{$translator->Error_Backadmincourses}</p>
</div>
<script type="text/javascript">
//window.location.href='/admin_courses';
</script>
EOF;
} catch (Exception $e) {
echo <<<EOF
<div class="container">
<div class="page-header">
<h1>{$translator->Course_error}</h1>
</div>
<p class="lead">{$translator->Course_error_Desc}</p> {$e}
<p >{$translator->Error_Backadmincourses}</p>
</div>
EOF;
}
}
示例7: update
public static function update($courseid)
{
$params = $_POST;
$params['courseid'] = $courseid;
$course_params = array('courseid' => $courseid, 'name' => $params['name'], 'city' => $params['city']);
$course = new Course($course_params);
$errors = $course->errors();
// Check hole validity before saving anything
$holes = Hole::course_holes($courseid);
foreach ($holes as $hole) {
$hole->par = $params['hole' . $hole->hole_num];
$errors = array_merge($errors, $hole->errors());
}
if (count($errors) == 0) {
// Course and holes were all valid
$course->update();
foreach ($holes as $hole) {
$hole->update();
}
Redirect::to('/course/' . $courseid, array('message' => 'Rata ja sen väylät päivitetty.'));
} else {
View::make('course/edit.html', array('errors' => $errors, 'attributes' => $params, 'hole_count' => $params['hole_count']));
}
}
示例8: Course
function test_update()
{
//Arrange
$title = "Intro to Typing: COM-91";
$teacher = "Ancient Raven";
$time = "TH 9PM-11PM";
$semester = "Fall";
$test_course = new Course($title, $teacher, $time, $semester);
$test_course->save();
$title2 = "Intro to Ladders: SHOP-10";
$teacher2 = "Jeff Winger";
$time2 = "MWF 11AM-12PM";
$semester2 = "Spring";
$test_course->update($title2, $teacher2, $time2, $semester2);
//Act
$id = $test_course->getId();
$result = new Course($title2, $teacher2, $time2, $semester2, $id);
//Assert
$this->assertEquals(Course::find($id), $result);
}
示例9: testUpdate
function testUpdate()
{
//Arrange
$name = "Math";
$id = 1;
$test_course = new Course($name, $id);
$test_course->save();
$new_name = "Science";
//Act
$test_course->update($new_name);
//Assert
$this->assertEquals("Science", $test_course->getName());
}
示例10: Course
function test_update()
{
$course_name = "History";
$course_number = "HIST 101";
$test_course = new Course($course_name, $course_number);
$test_course->save();
$column_to_update = "course_name";
$new_course_name = "Intro to History";
$test_course->update($column_to_update, $new_course_name);
$result = Course::getAll();
$this->assertEquals("Intro to History", $result[0]->getCourseName());
}
示例11: header
$url = 'index.php?file=Courses&AX=Yes' . $qs . '&var_msg=' . $msg;
header("Location:" . $url);
exit;
} else {
if ($mode == "Update") {
$update_sql = "UPDATE CourseClasses SET eStatus = '" . $eStatus . "'\n\t\t\tWHERE iCourseId IN(" . $iCourseId . ")";
#echo $update_sql;exit;
$obj->sql_query($update_sql);
$sql_check = "SELECT eStatus FROM Course WHERE iCourseId='" . $iCourseId . "' ";
$check_status = $obj->select($sql_check);
$check = $check_status[0]['eStatus'];
if ($check == 'Inactive' && $eStatus == "Active") {
$user_emails = $userObj->getNotificationUsers($iSGroupId);
if (is_Array($user_emails) && count($user_emails) > 0) {
for ($i = 0; $i < count($user_emails); $i++) {
$sql_insert = "INSERT INTO `cron_email` (`vEmail` ,`vUsername` ,`vName` ,`vAdmin_email` ,`vCategoryName` ,`eType` ,`iID`)\n\t\t\t\t\tVALUES ('" . $user_emails[$i]['vEmail'] . "', '" . $user_emails[$i]['vUsername'] . "', '" . $vCoursename . "', '" . $user_emails['admin_email'] . "', '', 'Course', '" . $iCourseId . "')";
//echo $sql_insert;exit;
$id = $obj->insert($sql_insert);
// $emailObj->send_add_coursemail($user_emails[$i]['vUsername'],$vCoursename,$user_emails['admin_email'],$user_emails[$i]['vEmail']);
}
}
}
$courseObj->setdCourseDateTime($dCourseDateTime);
$courseObj->setiSGroupId($iSGroupId);
$courseObj->update($iCourseId);
$msg = MSG_UPDATE;
$url = 'index.php?file=Courses&AX=Yes' . $qs . '&var_msg=' . $msg;
header("Location:" . $url);
exit;
}
}
示例12: testUpdate
function testUpdate()
{
//Arrange
$name = "Math";
$course_num = "101";
$id = 1;
$test_course = new Course($name, $course_num, $id);
$test_course->save();
$new_name = "English";
$new_course_num = "200";
//Act
$test_course->update($new_name, $new_course_num);
//Assert
$this->assertEquals("English", $test_course->getName());
$this->assertEquals("200", $test_course->getCourseNum());
}
示例13: testUpdateCourse
function testUpdateCourse()
{
//Arrange
$id = null;
$name = "Intro to Math";
$number = "MATH100";
$test_course = new Course($id, $name, $number);
$test_course->save();
$name2 = "Math for Dummies";
$number2 = "MATH000";
//Act
$test_course->update($name2, $number2);
//Assert
$this->assertEquals($name2, $test_course->getName());
$this->assertEquals($number2, $test_course->getNumber());
}
示例14: showCourse
function showCourse()
{
global $connector;
$page = "course.php";
$course = new Course();
$course->setConnector($connector);
if ($_POST['operation']) {
list($operation, $params) = explode("#", $_POST['operation']);
switch ($operation) {
case 'saveChanges':
$course->storeFormValues($_POST);
$error_msg = $course->insert();
if ($error_msg) {
$result['edit'] = $course;
}
break;
case 'delete':
$error_msg = $course->delete($params);
break;
case 'edit':
$result['edit'] = $course->getById($params);
break;
case 'editChanges':
$course->storeFormValues($_POST);
$error_msg = $course->update();
break;
default:
$error_msg = "Operazione non valida";
}
if ($error_msg != "") {
$result["errorMessage"] = $error_msg;
} elseif ($operation != 'edit') {
$result["statusMessage"] = "Operazione completata!";
}
}
if (isset($_POST['search'])) {
$result["courses"] = $course->search($_POST['search']);
} else {
$result["courses"] = $course->getList();
}
$page = "course.php";
include_once BASE_PATH . "template.php";
}
示例15: testUpdate
function testUpdate()
{
//Arrange
$course_name = "History";
$id = 1;
$crn = "HIST101";
$test_course = new Course($course_name, $crn, $id);
$test_course->save();
$new_course_name = "Economics";
//Act
$test_course->update($new_course_name);
//Assert
$this->assertEquals("Economics", $test_course->getCourseName());
}