Notice: Undefined property: stdClass::$json_content 在 h5p_insert() (行 438 在 \modules\contrib\h5p\h5p.module).
Notice: Undefined property: stdClass::$embed_type 在 h5p_insert() (行 439 在 \modules\contrib\h5p\h5p.module).
Notice: Undefined property: stdClass::$main_library_id 在 h5p_insert() (行 441 在 \modules\contrib\h5p\h5p.module).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'json_content' cannot be null: INSERT INTO {h5p_nodes} (content_id, nid, json_content, embed_type, main_library_id, filtered) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5); Array ( [:db_insert_placeholder_0] => 21 [:db_insert_placeholder_1] => 21 [:db_insert_placeholder_2] => [:db_insert_placeholder_3] => div [:db_insert_placeholder_4] => [:db_insert_placeholder_5] => ) 在 H5PDrupal->insertContent() (行 389 在 \modules\contrib\h5p\h5p.classes.inc).

Comments

falcon’s picture

We'll be looking into this, thanks for reporting!

falcon’s picture

Category: Bug report » Feature request
adamtong’s picture

I have some issue in making the h5p content type to be course object in Courses module:

Notice: Undefined property: stdClass::$json_content in h5p_insert() (line 346 of /sites/all/modules/h5p/h5p.module).
Notice: Undefined property: stdClass::$embed_type in h5p_insert() (line 347 of /sites/all/modules/h5p/h5p.module).
Notice: Undefined property: stdClass::$main_library_id in h5p_insert() (line 349 of /sites/all/modules/h5p/h5p.module).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'json_content' cannot be null: INSERT INTO {h5p_nodes} (content_id, nid, json_content, embed_type, main_library_id, filtered) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5); Array ( [:db_insert_placeholder_0] => 111 [:db_insert_placeholder_1] => 81 [:db_insert_placeholder_2] => [:db_insert_placeholder_3] => div [:db_insert_placeholder_4] => [:db_insert_placeholder_5] => ) in H5PDrupal->insertContent() (line 398 of /sites/all/modules/h5p/h5p.classes.inc).

wacoo’s picture

I have the same problem here. When i add interactive content as a course object, it displays the following error:
Notice: Undefined property: stdClass::$json_content in h5p_insert() (line 407 of /var/aegir/platforms/drupal-7.37/sites/testsite.org/modules/h5p/h5p.module).
Notice: Undefined property: stdClass::$embed_type in h5p_insert() (line 408 of /var/aegir/platforms/drupal-7.37/sites/testsite.org/modules/h5p/h5p.module).
Notice: Undefined property: stdClass::$disable in h5p_insert() (line 409 of /var/aegir/platforms/drupal-7.37/sites/testsite.org/modules/h5p/h5p.module).
Notice: Undefined property: stdClass::$main_library_id in h5p_insert() (line 411 of /var/aegir/platforms/drupal-7.37/sites/testsite.org/modules/h5p/h5p.module).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'json_content' cannot be null: INSERT INTO {h5p_nodes} (content_id, nid, json_content, embed_type, main_library_id, filtered, disable) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => 31 [:db_insert_placeholder_1] => 31 [:db_insert_placeholder_2] => [:db_insert_placeholder_3] => div [:db_insert_placeholder_4] => [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => ) in H5PDrupal->insertContent() (line 407 of /var/aegir/platforms/drupal-7.37/sites/testsite.org/modules/h5p/h5p.classes.inc).

falcon’s picture

Project: H5P - Create and Share Rich Content and Applications » Course

I'm sorry for taking a very long time to respond here.

You can use H5P within courses if you use course_quiz, quiz and quiz_h5p modules and add H5P to courses as part of a quiz.

Using H5P directly by enabling the Interactive Content type as a Course content type does not work since Course tries to save an H5P node without adding the required data into the node object.

There are at least two ways of solving this, (1) make Course not save nodes automatically but perhaps have Course save something in its own datastructure instead and turn it into nodes as they get edited or (2) make H5P support saving H5P nodes without H5P content in them.

(2) is something we'll have to think about. It would add more flexibility, but allowing for "incomplete" data in the database will probably result in bugs and problems and higher complexity. Doing (2) doesn't take time, but testing it takes some time, and we're not sure if this is something we want to do.

What does the Course maintainers think about this? Are you running into problems with other required fields and similar issues with your current approach?

djdevin’s picture

The built in course_content module is really just for use with regular content types without additional behavior. Even if you were able to put a H5P node inside of a Course, there would be no fulfillment check, i.e. the course object would be immediately complete upon viewing the content.

If you did want H5P content to be inside of a Course, it would be best to create a course_h5p module that does the necessary node creation and also checks the H5P content for completion.

falcon’s picture

Ok, and if I know you right you see this a something that should go into a separate project?

djdevin’s picture

Yes please :)

wacoo’s picture

Thanks a lot for your help, i'm new to drupal. I really like to see the project started.

webservant316’s picture

I think you could put a H5P content type as a required page in a course book.

webservant316’s picture

yep, that works fine. I just need to find a way to remove the H5P content type from the course object listing so as not to confuse trainers. Then H5P content can only be added to course books :-)

webservant316’s picture

To handle this I simply disallow H5P content as course objects, but allow it as book pages. Then H5P content can be added to my courses via books. Of course I can also add H5P via quizzes which does offer integrated scoring with the course module.

The caveat with H5P content in books however is that there will not be any integrated scoring or grading with the course module. So it is simply a means to add great content into course books, but scores will not trickle down to the course evaluation module.

webservant316’s picture

I use H5P content for course Books so the H5P content is not directly part of the outline. However, I am creating an automatic course outline uploader that creates the entire course outline from a data table. Thus, I ran into a similar problem when trying to automatically create H5P content within Course Books. H5P must have a the H5P content type assigned. So solve this problem I automatically assign the H5P content to the simplest H5P type, and then the content author can change the assignment later manually.

This works great and could be a solution to putting H5P content directly on the course outline. Create the H5P content with a H5P placeholder initially assigned. I think an even better solution would be for the H5P module designers to add new H5P content type for developers that is a placeholder for programmatic creation, since it is not feasible to leave the h5p content type field empty. So that is a third option to add to the list in #5 above.

See a detailed example here https://www.drupal.org/node/2756639#comment-11347155