本文整理汇总了PHP中myPartnerUtils::shouldNotify方法的典型用法代码示例。如果您正苦于以下问题:PHP myPartnerUtils::shouldNotify方法的具体用法?PHP myPartnerUtils::shouldNotify怎么用?PHP myPartnerUtils::shouldNotify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myPartnerUtils
的用法示例。
在下文中一共展示了myPartnerUtils::shouldNotify方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getClientNotificationAction
/**
* Return the notifications for a specific entry id and type
*
* @action getClientNotification
* @param string $entryId
* @param KalturaNotificationType $type
* @return KalturaClientNotification
*/
function getClientNotificationAction($entryId, $type)
{
// in case of a multirequest, a mediaService.addFromUploadedFile may fail and therefore the resulting entry id will be empty
// in such a case return immidiately without looking for the notification
if ($entryId == '') {
throw new KalturaAPIException(KalturaErrors::NOTIFICATION_FOR_ENTRY_NOT_FOUND, $entryId);
}
$notifications = BatchJobPeer::retrieveByEntryIdAndType($entryId, BatchJobType::NOTIFICATION, $type);
// FIXME: throw error if not found
if (count($notifications) == 0) {
throw new KalturaAPIException(KalturaErrors::NOTIFICATION_FOR_ENTRY_NOT_FOUND, $entryId);
}
$notification = $notifications[0];
$partnerId = $this->getPartnerId();
$nofication_config_str = null;
list($nofity, $nofication_config_str) = myPartnerUtils::shouldNotify($partnerId);
if (!$nofity) {
return new KalturaClientNotification();
}
$nofication_config = myNotificationsConfig::getInstance($nofication_config_str);
$nofity_send_type = $nofication_config->shouldNotify($type);
if ($nofity_send_type != myNotificationMgr::NOTIFICATION_MGR_SEND_SYNCH && $nofity_send_type != myNotificationMgr::NOTIFICATION_MGR_SEND_BOTH) {
return new KalturaClientNotification();
}
$partner = PartnerPeer::retrieveByPK($partnerId);
list($url, $signatureKey) = myNotificationMgr::getPartnerNotificationInfo($partner);
list($params, $rawSignature) = myNotificationMgr::prepareNotificationData($url, $signatureKey, $notification, null);
$serializedParams = http_build_query($params, "", "&");
$result = new KalturaClientNotification();
$result->url = $url;
$result->data = $serializedParams;
return $result;
}
示例2: createNotification
/**
* $notification_type -
* $puser_id - the puser_id of the kuser that caused the modification
* $object_data - can be either an object or an object id (if the object no longer exists
* $partner_id - if exists, use this (usually in case of $object_data is an id), if not - use the partner_id from the object
* $entry_id is optional
*/
public static function createNotification($notification_type, $object_data, $partner_id = null, $puser_id = null, $prefix = null, $extra_notification_data = null, $entry_id = null)
{
if (!$entry_id && $object_data instanceof entry) {
$entry_id = $object_data->getId();
}
if (!$partner_id) {
if ($object_data instanceof BaseObject) {
$partner_id = $object_data->getPartnerId();
} else {
KalturaLog::log("Cannot create notification [{$notification_type}] [{$object_data}] [{$partner_id}]");
return false;
}
}
// echo "[$partner_id]";
$nofication_config_str = null;
list($nofity, $nofication_config_str) = myPartnerUtils::shouldNotify($partner_id);
if (!$nofity) {
return false;
}
$nofication_config = myNotificationsConfig::getInstance($nofication_config_str);
$nofity_send_type = $nofication_config->shouldNotify($notification_type);
//echo "nofication_config_str: $nofication_config_str<br>notification_type:$notification_type<br>";
if ($nofity_send_type == self::NOTIFICATION_MGR_NO_SEND) {
return false;
}
//echo "nofity_send_type: $nofity_send_type<br>";
// now check what type of notification to use - none / synch / a-synch
// Remarked by Tan-Tan, Nov 5 2009 to support the new batches
//
// $not = new notification();
// $not->setType( $notification_type );
// 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
// $not->setStatus( BatchJob::BATCHJOB_STATUS_PENDING );
// }
// 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) {
//.........这里部分代码省略.........