当前位置: 首页>>代码示例>>PHP>>正文


PHP kJobsManager::addNotificationJob方法代码示例

本文整理汇总了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();
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:101,代码来源:myNotificationMgr.class.php


注:本文中的kJobsManager::addNotificationJob方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。