public static function Lesson($type, $data)
 {
     require_once 'lesson.class.php';
     $class = new Lesson();
     $status = false;
     $device = ManagementFunction::getPostVariable('device');
     $number_device = ManagementFunction::getPostVariable('number_dv');
     $class->setData($data);
     $class->device = $device;
     $class->number_device = $number_device;
     switch ($type) {
         case 'add':
             $status = $class->add();
             break;
         case 'update':
             $status = $class->update();
             break;
         case 'delete':
             $status = $class->delete();
             break;
         case 'getsingle':
             $status = $class->getsingle();
             break;
         case 'getpage':
             $status = $class->getpage();
             break;
         case 'search':
             $status = $class->search();
             break;
         case 'getlessondetail':
             $status = $class->getLessonDetail();
             break;
         case 'dellessondetail':
             $status = $class->delLessonDetail();
             break;
         case 'updatelessondetail':
             $status = $class->updatelessondetail();
             break;
         case 'add-lesson-detail':
             $status = $class->addlessondetail();
             break;
         case 'getroom':
             $status = $class->getroom();
             break;
         case 'print':
             $status = $class->print_data();
             break;
         default:
             break;
     }
     if ($status) {
         wp_send_json_success($status);
     } else {
         wp_send_json_error($class->error);
     }
 }