Example #1
0
 function handle_post($post)
 {
     /**
      * action is to update course pref.
      * old preference is deleted if exists
      * and new one is added only if preference is not 'none'
      */
     if ($post['action'] == 'update_course_prefs') {
         delete_existing_pref($this->get_username(), $post['course_id']);
         if ($post['pref'] != 'none') {
             mysql_insert_dang('prof_prefs', $post);
         }
     } else {
         if ($post['action'] == 'update_load_pref') {
             update_load_preference($this->get_username(), $post['pref']);
         } else {
             if ($post['action'] == 'special_request') {
                 mysql_insert_dang('special_requesta', $post);
                 $this->set_message("special request submitted.");
             } else {
                 if ($post['action'] == 'set_semester') {
                     $_SESSION['semester'] = $post['semester'];
                     $_SESSION['year'] = $post['year'];
                 } else {
                 }
             }
         }
     }
 }
Example #2
0
 function handle_post($post)
 {
     $action = $post['action'];
     /* 
      * action for adding a instructor
      */
     if ($action == 'add_instructor') {
         mysql_insert_dang('instructors', $post, array('password2'));
         $this->set_message("Eraider successfully added.");
     }
     /* 
      * action for adding eraider
      */
     if ($action == 'add_eraider') {
         mysql_insert_dang('eraiders', $post, array('password2'));
         $this->set_message("Teacher successfully added.");
     }
     /* 
      * action for business admin
      */
     if ($action == 'add_business_admin') {
         mysql_insert_dang('business_admins', $post);
         $this->set_message("Business administrator successfully added.");
     } else {
         if ($action == 'add_book') {
             mysql_insert_dang('books', $post);
             $this->set_message("Text book successfully added.");
         } else {
             if ($action == 'add_course') {
                 mysql_insert_dang('courses', $post);
                 $this->set_message("Course successfully added.");
             } else {
                 if ($action == 'add_ta') {
                     mysql_insert_dang('tas', $post);
                     $this->set_message("Course successfully added.");
                 } else {
                     if ($action == 'add_section') {
                         mysql_insert_dang('sections', $post);
                         $this->set_message("Section successfully added.");
                     } else {
                         if ($action == 'link_inst_sect') {
                             mysql_insert_dang('instructor_to_section', $post);
                             $this->set_message("Section and instructor successfully linked.");
                         } else {
                             if ($action == 'link_ta_to_section') {
                                 mysql_insert_dang('ta_to_section', $post);
                                 $this->set_message("TA Linked to Section.");
                             } else {
                             }
                         }
                     }
                 }
             }
         }
     }
     /*
      * after POST save messages in session and redirect
      * to same page but with a GET to avoid
      * annoying POST resubmission messages
      * on the browser's end.
      */
     $this->set_error(mysql_error());
 }