本文整理汇总了PHP中kJobsManager::addNotificationJob方法的典型用法代码示例。如果您正苦于以下问题:PHP kJobsManager::addNotificationJob方法的具体用法?PHP kJobsManager::addNotificationJob怎么用?PHP kJobsManager::addNotificationJob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kJobsManager
的用法示例。
在下文中一共展示了kJobsManager::addNotificationJob方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createNotification
//.........这里部分代码省略.........
// elseif ( $nofity_send_type == self::NOTIFICATION_MGR_SEND_SYNCH )
// {
// $not->setStatus( BatchJob::BATCHJOB_STATUS_FINISHED );
// }
//
// // return the notification to the caller
// $retrun_notification = ( $nofity_send_type == self::NOTIFICATION_MGR_SEND_SYNCH || $nofity_send_type == self::NOTIFICATION_MGR_SEND_BOTH );
//
////echo "retrun_notification: $retrun_notification<br>";
//
// $not->setPartnerId( $partner_id );
// $not->setPuserId( $puser_id );
// $not->setDc ( kDataCenterMgr::getCurrentDcId() );
// if ( $object_data instanceof BaseObject )
// {
// $not->setObjectId($object_data->getId() );
// $not->setData( self::createNotificationData ( $notification_type , $object_data, $extra_notification_data ) );
//
// if ( $object_data instanceof entry )
// {
// if (defined("KALTURA_API_V3"))
// $puser_id = $object_data->getKuser()->getPuserId();
// else
// $puser_id = PuserKuserPeer::getByKuserId( $object_data->getKuserId() , 1 );
//
// $not->setPuserId( $puser_id );
//
// }
// }
// else
// {
// // in this case all we have is the object data which is the id
// // this is probably the case of some delete and we mifght not have the object in hand but only the id
// $not->setObjectId( $object_data );
// }
// $not->save();
// Added by Tan-Tan, Nov 2009 to support the new batches
// if ( $nofity_send_type == self::NOTIFICATION_MGR_SEND_ASYNCH || $nofity_send_type == self::NOTIFICATION_MGR_SEND_BOTH)
// {
//
// // the notification should be in status pending so it will be sent in the
// $job->setStatus( BatchJob::BATCHJOB_STATUS_PENDING );
// }
// else
$dontSend = false;
if ($nofity_send_type == self::NOTIFICATION_MGR_SEND_SYNCH) {
$dontSend = true;
}
// return the notification to the caller
$retrun_notification = $nofity_send_type == self::NOTIFICATION_MGR_SEND_SYNCH || $nofity_send_type == self::NOTIFICATION_MGR_SEND_BOTH;
$objectId = null;
$notificationData = null;
if ($object_data instanceof BaseObject) {
$objectId = $object_data->getId();
$notificationData = self::createNotificationData($notification_type, $object_data, $extra_notification_data);
if ($object_data instanceof entry) {
if (kCurrentContext::isApiV3Context()) {
$kuser = $object_data->getKuser();
if ($kuser) {
$puser_id = $kuser->getPuserId();
} else {
$puser_id = null;
KalturaLog::log(__CLASS__ . '::' . __METHOD__ . ' [line: ' . __LINE__ . '] could not find kuser [' . $object_data->getKuserId() . '] from object [' . $object_data->getId() . ']');
}
} else {
$puser_id = PuserKuserPeer::getByKuserId($object_data->getKuserId(), 1);
// in flatten (or maybe other old batches), KALTURA_API_V3 is not defined, but entry user could have
// been created through api v3, in that case there will not be a record in puser_kuser table
if (is_null($puser_id)) {
$puser_id = $object_data->getPuserId();
// if entry was created on PS2 and from some reason puserId is still missing
if (is_null($puser_id)) {
$kuser = kuserPeer::retrieveByPK($object_data->getKuserId());
if ($kuser) {
$puser_id = $kuser->getPuserId();
}
}
}
if (is_null($puser_id)) {
KalturaLog::log(__CLASS__ . '::' . __METHOD__ . ' [line: ' . __LINE__ . '] could not get puser_id out of api_v3 context puserId from entry:[' . $object_data->getPuserId() . '] kuser ID:[' . $object_data->getKuserId() . '] entry:[' . $object_data->getId() . ']');
}
}
}
} else {
// in this case all we have is the object data which is the id
// this is probably the case of some delete and we mifght not have the object in hand but only the id
$objectId = $object_data;
}
$job = kJobsManager::addNotificationJob(null, $entry_id, $partner_id, $notification_type, $nofity_send_type, $puser_id, $objectId, $notificationData);
if ($retrun_notification) {
// return the notification id, notification object , url & the serialized data
$partner = PartnerPeer::retrieveByPK($partner_id);
list($url, $signature_key) = self::getPartnerNotificationInfo($partner);
list($params, $raw_signature) = self::prepareNotificationData($url, $signature_key, $job, $prefix);
$serialized_params = http_build_query($params, "", "&");
return array($job->getId(), $job, $url, $params, $serialized_params);
} else {
return $job->getId();
}
}