Skip to Content Skip to Menu

Autoaction Query and chained statements

  • activha
  • activha
  • OFFLINE
  • Posts: 2326
  • Thanks: 117
  • Karma: 13
2 years 10 months ago #327462 by activha
Replied by activha on topic Autoaction Query and chained statements
ahhh ok
thanks a lot

Please Log in or Create an account to join the conversation.

  • activha
  • activha
  • OFFLINE
  • Posts: 2326
  • Thanks: 117
  • Karma: 13
2 years 10 months ago - 2 years 10 months ago #327480 by activha
Replied by activha on topic Autoaction Query and chained statements
So following your advices I wrote the following but cannot get the link and my drophscat is set to 0 instead of 50
Code:
// Create a gallery object $item = new \CB\Plugin\Gallery\Table\ItemTable(); $item->set( 'id', '[var3_params_gallery]' ); $mime = $item->mimeType(); $result = $item->path(); if ( $mime=== 'video/x-youtube' ) { if ( preg_match( '%(?:(?:watch\?v=)|(?:embed/)|(?:be/))([A-Za-z0-9_-]+)%', $result, $matches ) ) { $link = '<iframe src="https://www.youtube.com/embed/' . htmlspecialchars( $matches[1] ) . '?autoplay=1" loading="lazy" width="100%" height="100%" style="width: 100%; height: 100%;" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" class="position-absolute galleryVideoPlayer"></iframe>'; } } elseif ( $mime === 'video/x-vimeo' ) { if ( preg_match( '%/(\d+)$%i', $result, $matches ) ) { $link = '<iframe src="https://player.vimeo.com/video/' . htmlspecialchars( $matches[1] ) . '?autoplay=1" loading="lazy" width="100%" height="100%" style="width: 100%; height: 100%;" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" class="position-absolute galleryVideoPlayer"></iframe>'; } } // Create the event object $row = new \CB\Plugin\GroupJiveEvents\Table\EventTable(); // Set the events data $row->set( 'user_id', '[user_id]'); $row->set( 'group', 56 ); $row->set( 'title', '[var3_params_campaign]' ); $row->set( 'published', 1 ); $row->set( 'event', $link); $row->set( 'params', '{"drophscat":"50","gid":"[var3_params_gallery]","gallery":"[var3_asset]"}'); // Validate and store the event // if ( $row->getError() || ( ! $row->check() ) ) { // return; // } if ( $row->getError() || ( ! $row->store() ) ) { return; } // Create the initial attendence (event owner default attending) $attend = new \CB\Plugin\GroupJiveEvents\Table\AttendanceTable(); $attend->set( 'user_id', $row->getInt( 'user_id', 0 ) ); $attend->set( 'event', $row->getInt( 'id', 0 ) ); $attend->store();

Also can I use your classes to retrieve an existing item like :
Code:
$attend = new \CB\Plugin\GroupJiveEvents\Table\AttendanceTable(); $attend->set('event', 26); $attend->load();

I think it's the last ones on this post to get me done on this ;-)
Last edit: 2 years 10 months ago by activha.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48423
  • Thanks: 8274
  • Karma: 1443
2 years 10 months ago #327486 by krileon
Replied by krileon on topic Autoaction Query and chained statements

So following your advices I wrote the following but cannot get the link and my drophscat is set to 0 instead of 50

The way you're trying to load a gallery entry is not valid. Loading is done with ->load( ID_HERE ). "gallery" is also an array. It may have more than 1 media id if they uploaded more than 1 at time of posting. I explained below how to access it as an array through API.

www.joomlapolis.com/forum/255-developer-members-support/244523-cb-activity-to-groupjive-data?start=12#327453

Also can I use your classes to retrieve an existing item like :

You don't call ->set for a load. You'd just call ->load( EVENT_ID_HERE ). You really need to be using an IDE like phpstorm and have your Joomla root as the project. We've phpdoc for basically everything, which you can't see without an IDE.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • activha
  • activha
  • OFFLINE
  • Posts: 2326
  • Thanks: 117
  • Karma: 13
2 years 10 months ago #327492 by activha
Replied by activha on topic Autoaction Query and chained statements
I just installed PhpStorm, seems easier to get the info.
A little difficult to move from BBEdit but just need to learn :-)
Anyway, thanks a lot for all your help, this is beginning to develop
Looking forward to CB 6 beta ;-)
The following user(s) said Thank You: krileon

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum