Example #1
0
 public static function view_loop()
 {
     if (self::$cur_id == -1) {
         if (!isset($_REQUEST['tutor_id'])) {
             _e("Tutor Not Found", "ttr-db");
             return false;
         }
         self::$tutor = TTR_db::get_tutor($_REQUEST['tutor_id']);
         if (!isset(self::$tutor)) {
             _e("Tutor Not Found", "ttr-db");
             return false;
         } else {
             self::$cur_id++;
             return true;
         }
     } else {
         if (self::$cur_id == 0) {
             self::$cur_id++;
             return true;
         } else {
             self::$cur_id = -1;
             return false;
         }
     }
 }
 public function prepare_items()
 {
     /* Generate Headers */
     $this->_column_headers = array($this->get_columns(), array(), array(), 'fname');
     // Write Bulk Action Prossesing
     $this->process_bulk_action();
     // Sets Pagination Data
     $per_page = 10;
     //TODO make changable
     $cur_page = $this->get_pagenum();
     $this->set_pagination_args(array('total_items' => TTR_db::get_count(), 'per_page' => $per_page));
     // Sets Tutors For Database
     $this->items = TTR_db::get_tutors($per_page, $cur_page);
 }
Example #3
0
function ttr_db_admin_render()
{
    ttr_db_admin_style();
    if (!isset($_GET["type"])) {
        $_GET["type"] = "list";
    }
    switch ($_GET["type"]) {
        case "add":
            ttr_db_admin_form();
            break;
        case "edit":
            $itm = TTR_db::get_tutor($_GET['id']);
            ttr_db_admin_form($itm['id'], stripslashes($itm['fname']), stripslashes($itm['lname']), stripslashes($itm['mname']), stripslashes($itm['min_age']), stripslashes($itm['max_age']), stripslashes($itm['province']), stripslashes($itm['city']), stripslashes($itm['subject']), stripslashes($itm['description']));
            break;
        case "sbj":
            ttr_db_subject_editor();
            break;
        case "csv":
            ttr_db_admin_csv();
            break;
        default:
            ttr_db_admin_table();
            break;
    }
}