You are here

function kaltura_notify_node_entry_add in Kaltura 6

Same name and namespace in other branches
  1. 5 includes/kaltura.notification.inc \kaltura_notify_node_entry_add()
  2. 6.2 includes/kaltura.notification.inc \kaltura_notify_node_entry_add()
1 call to kaltura_notify_node_entry_add()
kaltura_forward_notification in includes/kaltura.notification.inc

File

includes/kaltura.notification.inc, line 143

Code

function kaltura_notify_node_entry_add($type, $notification_data) {
  if ($notification_data['partner_data']) {
    $data_exploded = explode('|', $notification_data['partner_data']);
    foreach ($data_exploded as $data) {
      $splited = explode('@', $data);
      $partner_data[$splited[0]] = $splited[1];
    }
  }
  $node->title = $notification_data['name'];
  $node->body = '';

  //'test '. time(); // print_r($notification_data,TRUE).PHP_EOL.print_r($_REQUEST,TRUE);
  $node->type = 'kaltura_' . $type;
  $node->uid = $notification_data['puser_id'] ? $notification_data['puser_id'] : FALSE;
  if ($node->uid === FALSE) {
    $node->uid = $partner_data['user_id'] ? $partner_data['user_id'] : 0;
  }
  $node->status = 1;
  $node->created = time();
  $node->comment = FALSE;
  $node->changed = time();
  $node->promote = 0;
  $node->sticky = 0;
  $node->kstatus = $notification_data['status'];
  if ($partner_data['entry_as_comment'] == 'yes') {
    $node->kaltura_video_comment = 1;
  }
  else {
    $node->kaltura_video_comment = 0;
  }
  kaltura_push_extra_data($node, $notification_data);
  $node->kaltura_entry_data = serialize(array(
    $notification_data,
  ));
  $node->kaltura_tags = $notification_data['tags'];
  if ($type == 'entry') {
    $node->kaltura_entryId = $notification_data['entry_id'];
  }
  else {
    if (WORK_WITH_KSHOW) {
      $node->kaltura_entryId = $notification_data['kshow_id'];
    }
    else {
      $node->kaltura_entryId = $notification_data['show_entry_id'];
    }
  }
  $node->kaltura_admin_tags = '';
  if ($type == 'mix' && $partner_data['create_kshow'] == 'yes' || $type == 'entry') {
    node_save($node);
    module_invoke('node_kaltura_' . $type, 'hook_insert', $node);
  }
}