public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $prefix = null;
     $notData = new kNotificationJobData();
     $notData->setData('');
     $notData->setType(kNotificationJobData::NOTIFICATION_TYPE_TEST);
     $notData->setUserId($puser_id);
     $job = new BatchJob();
     $job->setId(kNotificationJobData::NOTIFICATION_TYPE_TEST + (int) time());
     $job->setData($notData);
     $job->setPartnerId($partner_id);
     $partner = PartnerPeer::retrieveByPK($partner_id);
     list($url, $signature_key) = myNotificationMgr::getPartnerNotificationInfo($partner);
     list($params, $raw_siganture) = myNotificationMgr::prepareNotificationData($url, $signature_key, $job, $prefix);
     $this->send($url, $params);
 }
 private static function getIndicator()
 {
     if (!self::$indicator) {
         self::$indicator = new myFileIndicator("gogonotifications");
     }
     return self::$indicator;
 }
 public static function prepareNotificationData($url, $signature_key, BatchJob $job, $prefix = null)
 {
     $type = $job->getData()->getType();
     $params = array("notification_id" => $job->getId(), "notification_type" => $job->getData()->getTypeAsString(), "puser_id" => $job->getData()->getUserId(), "partner_id" => $job->getPartnerId());
     if (kNotificationJobData::isEntryNotification($type)) {
         $params["entry_id"] = $job->getData()->getObjectId();
     }
     //$params["entryId"] = $not->getObjectId();
     if (kNotificationJobData::isKshowNotification($type)) {
         $params["kshow_id"] = $job->getData()->getObjectId();
     }
     //			$params["kshowId"] = $not->getObjectId();
     $object_data_params = myNotificationMgr::getDataAsArray($job->getData()->getData());
     if ($object_data_params) {
         $params = array_merge($params, $object_data_params);
     }
     $params = self::fixParams($params, $prefix);
     $params['signed_fields'] = '';
     foreach ($params as $key => $value) {
         $params['signed_fields'] .= $key . ',';
     }
     return self::signParams($signature_key, $params);
 }
Beispiel #4
0
 public static function addNotificationJob(BatchJob $parentJob = null, $entryId, $partnerId, $notificationType, $sendType, $puserId, $objectId, $notificationData)
 {
     $jobData = new kNotificationJobData();
     $jobData->setType($notificationType);
     $jobData->setSendType($sendType);
     $jobData->setUserId($puserId);
     $jobData->setObjectId($objectId);
     $jobData->setData($notificationData);
     $batchJob = null;
     if ($parentJob) {
         $batchJob = $parentJob->createChild(BatchJobType::NOTIFICATION, $notificationType);
     } else {
         $batchJob = new BatchJob();
         $batchJob->setEntryId($entryId);
         $batchJob->setPartnerId($partnerId);
     }
     if ($sendType == kNotificationJobData::NOTIFICATION_MGR_NO_SEND || $sendType == kNotificationJobData::NOTIFICATION_MGR_SEND_SYNCH) {
         $batchJob->setStatus(BatchJob::BATCHJOB_STATUS_DONT_PROCESS);
     }
     return self::addJob($batchJob, $jobData, BatchJobType::NOTIFICATION, $notificationType);
 }
function createSelect($id, $name, $default_value, $list_name, $pid_str = null)
{
    $host = requestUtils::getHost();
    $limited = getLimited();
    //global $arrays;
    $download_file_formats = array("avi" => "avi", "mp4" => "mp4", "mov" => "mov", "flv" => "flv", "mp3" => "mp3", "3gp" => "3gp", "original" => "original");
    $media_type_list = array("1" => "Video", "2" => "Image", "5" => "Audio", "11" => "Document", "12" => "Swf", "-1" => "Automatic");
    $media_source_list = array("20" => "Kaltura", "21" => "MyClips", "23" => "KalturaPartner", "26" => "KalturaKshow", "27" => "KalturaPartnerKshow", "1" => "* File", "2" => "* Webcam", "3" => "Flickr", "4" => "YouTube", "5" => "* URL", "7" => "MySpace", "8" => "PhotoBucket", "9" => "Jamendo", "10" => "CCMixter", "11" => "NYPL", "13" => "MediaCommons", "22" => "Archive.org", "24" => "MetaCafe");
    if (!$limited) {
        $media_source_list = array("25" => "KalturaQa") + $media_source_list;
    }
    $protocol = requestUtils::getRequestProtocol();
    $current_server = str_replace("{$protocol}://", "", requestUtils::getRequestHost());
    $service_url_list[$current_server] = $current_server;
    if ($limited) {
        $format_list = array("1" => "JSON", "2" => "XML", "3" => "PHP");
        if (strpos($host, "sandbox") !== false) {
            $service_url_list["sandbox.kaltura.com"] = "Sandbox";
            $service_url_list["www.kaltura.com"] = "Kaltura";
        } else {
            $service_url_list["www.kaltura.com"] = "Kaltura";
            $service_url_list["sandbox.kaltura.com"] = "Sandbox";
        }
        $index_path_list = array("index.php" => "index");
    } else {
        $format_list = array("1" => "JSON", "2" => "XML", "3" => "PHP", "4" => "PHP_ARR", "5" => "PHP_OBJ", "8" => "mRSS");
        $service_url_list = array_merge($service_url_list, array("localhost" => "localhost", "qac.kaltura.dev" => "qac", "kelev.kaltura.com:9007" => "qac-external", "kaldev.kaltura.com" => "kaldev", "www.kaltura.com" => "Kaltura", "sandbox.kaltura.com" => "Sandbox"));
        $index_path_list = array("index.php" => "index", "kaltura_dev.php" => "debug");
        $service_url_list["debian.kaltura.dev/kalturaCE"] = "debian";
    }
    $clazz_list = array("kshow" => "kshow", "kuser" => "kuser", "entry" => "entry", "PuserKuser" => "PuserKuser");
    $moderation_object_type = array("1" => "kshow", "2" => "entry", "3" => "kuser", "" => "none");
    $moderation_status = array("1" => "pending", "2" => "allow", "3" => "block", "4" => "delete", "5" => "review");
    $notification_status = array("" => "All", "1" => "Pending", "2" => "Sent", "3" => "Error", "4" => "Should Resend");
    $entry_status = array("" => "All", "-1" => "ERROR_CONVERTING", "0" => "IMPORT", "1" => "PRECONVERT", "2" => "READY", "3" => "DELETED", "4" => "PENDING", "5" => "MODERATE", "6" => "BLOCKED");
    $entry_type = array("" => "All", "1" => "Clip", "2" => "Roughcut", "10" => "Document", "-1" => "Automatic");
    $entry_media_type = array("1" => "Video", "2" => "Image", "5" => "Audio", "6" => "Roughcut", "10" => "XML", "11" => "Document", "-1" => "Automatic");
    $entry_media_type_filter = array("" => "All", "1" => "Video", "2" => "Image", "5" => "Audio", "6" => "Roughcut", "10" => "XML", "11" => "Document", "-1" => "Automatic");
    $widget_security_type = array("1" => "none", "2" => "timehash");
    $entries_list_type = array("15" => "All", "1" => "Kshow", "2" => "Kuser", "4" => "Roughcut", "8" => "Episode");
    $boolean_type = array("true" => "true", "false" => "false");
    $boolean_int_type = array("" => "", "1" => "true", "0" => "false");
    $display_in_search_filter = array("" => "All", "0" => "Not displayed", "1" => "In Partner", "2" => "Kaltura Network");
    $usage_graph_resolutions = array("days" => "days", "months" => "months");
    $months_list = array("1" => "1", "2" => "2", "3" => "3", "4" => "4", "5" => "5", "6" => "6", "7" => "7", "8" => "8", "9" => "9", "10" => "10", "11" => "11", "12" => "12");
    $obj_type_list = array("kshow" => "kshow", "entry" => "entry");
    // TODO - fix list for moderation_status
    $entry_moderation_status = array("1" => "PENDING", "2" => "ALLOW", "3" => "BLOCK");
    $entry_moderation_status_filter = array("" => "All", "1" => "PENDING", "2" => "ALLOW", "3" => "BLOCK");
    $arrays = array("format_list" => $format_list, "media_type" => $media_type_list, "media_source" => $media_source_list, "download_file_formats" => $download_file_formats, "service_urls" => $service_url_list, "service_urls1" => array_merge(array("" => ""), $service_url_list), "index_paths" => $index_path_list, "clazz_list" => $clazz_list, "moderation_object_type" => $moderation_object_type, "moderation_status" => $moderation_status, "boolean_type" => $boolean_type, "boolean_int_type" => $boolean_int_type, "notification_status" => $notification_status, "notification_type" => array_merge(array("" => "All"), kNotificationJobData::getNotificationTypeMap()), "entry_media_type" => $entry_media_type, "entry_media_type_filter" => $entry_media_type_filter, "entry_type" => $entry_type, "entry_status" => $entry_status, "widget_security_type" => $widget_security_type, "entries_list_type" => $entries_list_type, "entry_moderation_status_filter" => $entry_moderation_status_filter, "entry_moderation_status" => $entry_moderation_status, "entries_filter_order_by" => array("" => "None", "+id" => "id asc", "-id" => "id desc", "+created_at" => "created_at asc", "-created_at" => "created_at desc", "+media_date" => "media_date asc", "-media_date" => "media_date desc", "+name" => "name asc", "-name" => "name desc", "+views" => "views asc", "-views" => "views desc", "+type" => "type asc", "-type" => "type desc", "+media_type" => "media_type asc", "-media_type" => "media_type desc", "+plays" => "plays asc", "-plays" => "plays desc", "+views" => "views asc", "-views" => "views desc", "+rank" => "rank asc", "-rank" => "rank desc", "+moderation_count" => "moderation_count asc", "-moderation_count" => "moderation_count desc", "+moderation_status" => "moderation_status asc", "-moderation_status" => "moderation_status desc"), "obj_type_list" => $obj_type_list, "command_list" => array("view" => "view", "play" => "play", "viewEnd" => "viewEnd"), "display_in_search_filter" => $display_in_search_filter, "playlist_media_type" => array("10" => "Dynamic", "3" => "Static", "101" => "External"), "playlist_media_type_filter" => array("" => "All", "10" => "Dynamic", "3" => "Static", "101" => "External"), "conversion_profile_type" => array("low" => "low", "med" => "med", "high" => "high", "hd" => "HD"), "conversion_profile_aspect_ratio" => array("1" => "keep aspect ratio", "2" => "keep original size", "3" => "4:3", "4" => "16:9"), "uiconf_obj_type" => array("1" => "kdp", "2" => "kcw", "3" => "kse", "4" => "kae", "6" => "app-studio"), "uiconf_obj_type_filter" => array("" => "ALL", "1" => "kdp", "2" => "kcw", "3" => "kse", "4" => "kae", "6" => "app-studio"), "uiconf_filter_order_by" => array("" => "None", "+id" => "id asc", "-id" => "id desc", "+created_at" => "created_at asc", "-created_at" => "created_at desc", "+updated_at" => "updated_at asc", "-updated_at" => "updated_at desc"), "conversion_quality" => array("" => "DEFAULT", "low" => "low", "med" => "medium", "high" => "high", "hd" => "hd"), "download_job_type_filter" => array("" => "ALL", "3" => "flatten", "6" => "download"), "download_filter_order_by" => array("" => "None", "+id" => "id asc", "-id" => "id desc", "+created_at" => "created_at asc", "-created_at" => "created_at desc"), "uiconf_creation_mode" => array("1" => "Manual", "2" => "Wizard", "3" => "Advance"), "months_list" => $months_list, "usage_graph_resolutions" => $usage_graph_resolutions);
    $list = $arrays[$list_name];
    if (!$list) {
        die("<div>cannot find list of name: [{$list_name}]</div>");
    }
    //echo "createSelect: list_name:[$list_name] count:[" . count ( $list ) . "]<br>";
    $str = "<select id='{$id}' style='font-family:arial; font-size:12px;' name='{$name}' onkeyup='updateSelect( this )' onchange='updateSelect( this )' {$pid_str}>";
    $default_value_selected = "";
    foreach ($list as $value => $option) {
        // not always the default value is found
        if ($value == $default_value) {
            $default_value_selected = $default_value;
        }
        if ($default_value === "") {
            $selected = $value === "" ? "selected='selected'" : "";
        } else {
            $selected = $value == $default_value ? "selected='selected'" : "";
        }
        $str .= "<option value='{$value}' {$selected} >{$option}</option>\n";
    }
    $str .= "</select> <span style='color:blue;' id='{$id}_current_value'>{$default_value_selected}</span>\n";
    return $str;
}