You are here

function kaltura_notify_node_update in Kaltura 5

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

File

includes/kaltura.notification.inc, line 117

Code

function kaltura_notify_node_update($notification) {
  $get_nid_from_entry = 'SELECT nid FROM {node_kaltura} WHERE kaltura_entryId = \'%s\'';
  $nodes = db_query($get_nid_from_entry, $notification['entry_id']);
  while ($obj = db_fetch_object($nodes)) {
    $node_ids[] = $obj->nid;
  }
  $updatable_data = array(
    'tags' => 'kaltura_tags',
    'admin_tags' => 'kaltura_admin_tags',
    'status' => 'kstatus',
  );
  if (count($node_ids) == 1) {
    $updated_node = node_load($node_ids[0]);
    foreach ($updatable_data as $notification_key => $node_key) {
      if ($updated_node->{$node_key} != $notification[$notification_key]) {
        $updated_node->{$node_key} = $notification[$notification_key];
        $updated_node->notification_update = TRUE;
      }
    }
    kaltura_push_extra_data($updated_node, $notification);
  }
  else {

    //watchdog('nod', 'found more than 1 node '. count($node_ids));
  }
  node_save($updated_node);
}