Ejemplo n.º 1
0
 public static function search_loop()
 {
     if (self::$cur_id == -1) {
         if (isset($_REQUEST["tp_id"])) {
             self::$current_page = esc_attr($_REQUEST["tp_id"]);
         }
         self::$tutors = TTR_db::find_tutor($_REQUEST['province'], $_REQUEST['city'], $_REQUEST['age'], $_REQUEST['subject'], self::$tutor_per_page, self::$current_page);
         self::$tutors_length = count(self::$tutors);
         if (self::$tutors_length <= 0) {
             _e("Results Not Found", "ttr-db");
             return false;
         } else {
             self::$cur_id = 0;
             return true;
         }
     } else {
         if (self::$cur_id < self::$tutors_length) {
             self::$tutor = self::$tutors[self::$cur_id];
             self::$cur_id++;
             return true;
         } else {
             self::$tutor = array();
             self::$cur_id = -1;
             return false;
         }
     }
 }