public function add() { $columns = array('weekday'); $table = new simple_table_ops(); $table->set_table_name('weekdays'); $table->set_table_column_names($columns); $table->add(); }
public function add() { $columns = array('nom', 'prenom', 'nom_khmer', 'prenom_khmer', 'matricule', 'dob', 'sex_id', 'program_id', 'active_id'); $table = new simple_table_ops(); $table->set_table_name('students'); $table->set_table_column_names($columns); $table->add(); header("Location: http://" . WEBSITE_URL . "/index.php?controller={$_GET['controller']}&action=index"); }
public function add() { $columns = array('course_id', 'teacher_id', 'subject_id'); $table = new simple_table_ops(); $table->set_table_name('curricula'); $table->set_table_column_names($columns); $table->add(); header("Location: http://" . WEBSITE_URL . "/index.php?controller={$_GET['controller']}&action=index"); }
public function add() { $columns = array('level'); $table = new simple_table_ops(); $table->set_table_name('levels'); $table->set_table_column_names($columns); $table->add(); header("Location: http://" . WEBSITE_URL . "/index.php?controller={$_GET['controller']}&action=index"); }
public function add() { $columns = array('school_year_id', 'level_id'); $_POST['school_year_id'] = $_SESSION['current_school_year_id']; $table = new simple_table_ops(); $table->set_table_name('courses'); $table->set_table_column_names($columns); $table->add(); header("Location: http://" . WEBSITE_URL . "/index.php?controller={$_GET['controller']}&action=index"); }
public function add() { // First, add the new school_year to [school_years] table: $columns = array('school_year'); $table = new simple_table_ops(); $table->set_table_name('school_years'); $table->set_table_column_names($columns); $table->add(); // then, gets the last inserted id (not through lastInsertedId function, because it may be buggy: /* SELECT article, dealer, price FROM shop WHERE price=(SELECT MAX(price) FROM shop); */ $sql = "SELECT school_year_id, school_year\n FROM school_years\n WHERE school_year_id=(SELECT MAX(school_year_id) FROM school_years)\n "; $school_years_handle = new database(); $new_school_year_result = $school_years_handle->query($sql); $new_school_year_id = $new_school_year_result[0]['school_year_id']; $new_school_year = $new_school_year_result[0]['school_year']; /* Populate automatically [courses] table with values from level_id and $_SESSION['current_school_year_id'] */ $levels_handler = new database(); $sql = "SELECT level_id FROM levels"; $result = $levels_handler->query($sql); $insert_sql = "INSERT INTO courses (school_year_id, level_id) VALUES (?, ?)"; foreach ($result as $row) { foreach ($row as $value) { // insert $value into courses and $_SESSION['current_school_year_id'] $data = array($new_school_year_id, $value); $levels_handler->insert($insert_sql, $data); } } // Update current_school_year_id to the newly added school_year: $_SESSION['current_school_year_id'] = $new_school_year_id; $_SESSION['current_school_year'] = $new_school_year; header("Location: http://" . WEBSITE_URL . "/index.php?controller={$_GET['controller']}&action=index"); }
public function add() { //todo: check if time slot is not already occupied // receives $_GET['id'] to redirect to page showing same page $columns = array('curriculum_id', 'timetable_period_id', 'start_time_id', 'end_time_id', 'weekday_id', 'classroom_id'); $table = new simple_table_ops(); $table->set_table_name('timetables'); $table->set_table_column_names($columns); $table->add(); header("Location: http://" . WEBSITE_URL . "/index.php?controller=timetable&action=show&submit=yes&timetable_period_id={$_POST['timetable_period_id']}"); }
public function profiles_add() { // First, add the new school_year to [school_years] table: $columns = array('profile'); $table = new simple_table_ops(); $table->set_table_name('profiles'); $table->set_table_column_names($columns); $table->add(); header("Location: http://" . WEBSITE_URL . "/index.php?controller={$_GET['controller']}&action=profiles_index"); }