コード例 #1
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $allow_empty = $this->getP("allow_empty_field", false);
     if ($allow_empty == "false" || $allow_empty === 0) {
         $allow_empty = false;
     }
     $partner = new Partner();
     $obj_wrapper = objectWrapperBase::getWrapperClass($partner, 0);
     $updateable_fields = $obj_wrapper->getUpdateableFields();
     // TODO - use fillObjectFromMapOrderedByFields instead
     $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $partner, "partner_", $updateable_fields, BasePeer::TYPE_PHPNAME, $allow_empty);
     // check that mandatory fields were set
     // TODO
     if (count($fields_modified) > 0) {
         $target_partner = PartnerPeer::retrieveByPK($partner_id);
         if ($partner && $target_partner) {
             if (@$fields_modified["adminEmail"] && $target_partner->getAdminEmail() != $fields_modified["adminEmail"]) {
                 myPartnerUtils::emailChangedEmail($partner_id, $target_partner->getAdminEmail(), $fields_modified["adminEmail"], $target_partner->getName(), PartnerPeer::KALTURAS_PARTNER_EMAIL_CHANGE);
             }
             $partner->setType($target_partner->getType());
             baseObjectUtils::fillObjectFromObject($updateable_fields, $partner, $target_partner, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME, $allow_empty);
             $target_partner->save();
             $this->addMsg("partner", objectWrapperBase::getWrapperClass($target_partner, objectWrapperBase::DETAIL_LEVEL_DETAILED));
             $this->addDebug("added_fields", $fields_modified);
         } else {
             $this->addError(APIErrors::UNKNOWN_PARTNER_ID);
         }
     } else {
         $this->addError(APIErrors::NO_FIELDS_SET_FOR_PARTNER);
     }
 }
コード例 #2
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $this->applyPartnerFilterForClass(new uiConfPeer(), $partner_id);
     $allow_empty = $this->getP("allow_empty_field", false);
     if ($allow_empty == "false" || $allow_empty === 0) {
         $allow_empty = false;
     }
     $prefix = $this->getObjectPrefix();
     $uiconf_id = $this->getPM("{$prefix}_id");
     $uiconf = uiConfPeer::retrieveByPK($uiconf_id);
     if (!$uiconf) {
         $this->addError(APIErrors::INVALID_UI_CONF_ID, $uiconf_id);
         return;
     }
     if ($uiconf && !$uiconf->isValid()) {
         $this->addError(APIErrors::INTERNAL_SERVERL_ERROR, "uiConf object [{$uiconf->getId()}] is not valid");
         return;
     }
     // get the new properties for the uiconf from the request
     $uiconf_update_data = new uiConf();
     $uiconf_update_data->setPartnerId($partner_id);
     // set this once before filling the object and once after
     $obj_wrapper = objectWrapperBase::getWrapperClass($uiconf_update_data, 0);
     $updateable_fields = $obj_wrapper->getUpdateableFields();
     $fields_modified = baseObjectUtils::fillObjectFromMapOrderedByFields($this->getInputParams(), $uiconf_update_data, "{$prefix}_", $updateable_fields, BasePeer::TYPE_PHPNAME, $allow_empty);
     if (count($fields_modified) > 0) {
         if ($uiconf_update_data) {
             baseObjectUtils::fillObjectFromObject($updateable_fields, $uiconf_update_data, $uiconf, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME, $allow_empty);
         }
         $uiconf->save();
     }
     $wrapper = objectWrapperBase::getWrapperClass($uiconf, objectWrapperBase::DETAIL_LEVEL_REGULAR);
     $this->addMsg("{$prefix}", $wrapper);
     $this->addDebug("modified_fields", $fields_modified);
 }
コード例 #3
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $user_id = $this->getPM("user_id");
     $target_puser_kuser = PuserKuserPeer::retrieveByPartnerAndUid($partner_id, null, $user_id, true);
     if (!$target_puser_kuser) {
         $this->addError(APIErrors::INVALID_USER_ID, $user_id);
     }
     $kuser = $target_puser_kuser->getKuser();
     // get the new properties for the kuser from the request
     $kuser_update_data = new kuser();
     $obj_wrapper = objectWrapperBase::getWrapperClass($kuser, 0);
     $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $kuser_update_data, "user_", $obj_wrapper->getUpdateableFields());
     if (count($fields_modified) > 0) {
         if (!$partner_id) {
             $kuser_from_db = kuserPeer::getKuserByScreenName($kuser->getScreenName());
             // check if there is a kuser with such a name in the system (and this kuser is not the current one)
             if ($kuser_from_db && $kuser_from_db->getId() == $kuser->getId()) {
                 $this->addError(APIErrors::USER_ALREADY_EXISTS_BY_SCREEN_NAME, $kuser->getScreenName());
                 return;
             }
         }
         if ($kuser_update_data) {
             baseObjectUtils::fillObjectFromObject($obj_wrapper->getUpdateableFields(), $kuser_update_data, $kuser, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME);
             $target_puser_kuser->setKuser($kuser);
         }
         $kuser->save();
     }
     $wrapper = objectWrapperBase::getWrapperClass($target_puser_kuser, objectWrapperBase::DETAIL_LEVEL_DETAILED);
     $wrapper->removeFromCache("kuser", $kuser->getId());
     $this->addMsg("user", $wrapper);
     $this->addDebug("modified_fields", $fields_modified);
 }
コード例 #4
0
 public function execute()
 {
     $this->forceSystemAuthentication();
     myDbHelper::$use_alternative_con = null;
     $this->ok_to_save = $this->getP("oktosave");
     $conv_profile_id = $this->getP("convprofile_id");
     if ($conv_profile_id < 0) {
         $conv_profile_id = "";
     }
     $this->message = "";
     $this->display_disabled = $this->getP("display_disabled");
     $command = $this->getP("command");
     if ($command == "removeCache") {
     } elseif ($command == "save") {
         $conv_profile = new ConversionProfile();
         $wrapper = objectWrapperBase::getWrapperClass($conv_profile, 0);
         $extra_fields = array("partnerId", "enabled");
         // add fields that cannot be updated using the API
         $allowed_params = array_merge($wrapper->getUpdateableFields(), $extra_fields);
         $fields_modified = baseObjectUtils::fillObjectFromMap($_REQUEST, $conv_profile, "convprofile_", $allowed_params, BasePeer::TYPE_PHPNAME, true);
         if ($conv_profile_id) {
             $conv_profile_from_db = ConversionProfilePeer::retrieveByPK($conv_profile_id);
             if ($conv_profile_from_db) {
                 baseObjectUtils::fillObjectFromObject($allowed_params, $conv_profile, $conv_profile_from_db, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME, true);
             }
             $conv_profile_from_db->save();
         } else {
             $conv_profile->save();
             $conv_profile_id = $conv_profile->getId();
         }
     }
     $this->conv_profile = ConversionProfilePeer::retrieveByPK($conv_profile_id);
     $this->conv_profile_id = $conv_profile_id;
     if ($this->conv_profile) {
         $this->conv_profile_type = $this->conv_profile->getProfileType();
         $this->fallback_mode = array();
         $this->conv_params_list = ConversionParamsPeer::retrieveByConversionProfile($this->conv_profile, $this->fallback_mode, false);
         // to see if there are any disabled params - call again with true
         $tmp_fallback = array();
         $tmp_conv_params_list = ConversionParamsPeer::retrieveByConversionProfile($this->conv_profile, $tmp_fallback, true);
         if ($tmp_fallback["mode"] == $this->fallback_mode["mode"]) {
             $this->fallback_mode = $tmp_fallback;
             $this->conv_params_list = $tmp_conv_params_list;
         } else {
             if ($this->display_disabled) {
                 $this->fallback_mode = $tmp_fallback;
                 $this->conv_params_list = $tmp_conv_params_list;
                 $this->message = "This display is missleading due to [dispaly disabled=true]<br>It shows params that are disabled for this profile and WOULD NOT be used at run-time";
             }
         }
     } else {
         $this->conv_profile_type = null;
         $this->conv_params_list = null;
     }
 }
コード例 #5
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $prefix = $this->getObjectPrefix();
     if (!$puser_kuser) {
         $this->addError(APIErrors::INVALID_USER_ID, $puser_id);
         return;
     }
     $allow_empty = $this->getP("allow_empty_field", false);
     if ($allow_empty == "false" || $allow_empty === 0) {
         $allow_empty = false;
     }
     $entry_id = $this->getPM("{$prefix}_id");
     $entry = entryPeer::retrieveByPK($entry_id);
     if (!$entry) {
         $this->addError(APIErrors::INVALID_ENTRY_ID, $prefix, $entry_id);
         return;
     }
     $this->validateInputEntry($entry);
     // TODO - verify the user is allowed to modify the entry
     if (!$this->isOwnedBy($entry, $puser_kuser->getKuserId())) {
         $this->verifyEntryPrivileges($entry);
         // user was granted explicit permissions when initiatd the ks
     }
     // get the new properties for the kuser from the request
     $entry_update_data = new entry();
     // assume the type and media_type of the entry from the DB are the same as those of the one from the user - if not -they will be overriden
     $entry_update_data->setType($entry->getType());
     $entry_update_data->setMediaType($entry->getMediaType());
     $entry_update_data->setId($entry->getId());
     $entry_update_data->setPartnerId($entry->getPartnerId());
     $entry_update_data->setData($entry->getData(), true);
     $obj_wrapper = objectWrapperBase::getWrapperClass($entry_update_data, 0);
     $field_level = $this->isAdmin() ? 2 : 1;
     $updateable_fields = $obj_wrapper->getUpdateableFields($field_level);
     $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $entry_update_data, "{$prefix}_", $updateable_fields, BasePeer::TYPE_PHPNAME, $allow_empty);
     if (count($fields_modified) > 0) {
         if ($entry_update_data) {
             // allow admins to set admin more fields
             baseObjectUtils::fillObjectFromObject($updateable_fields, $entry_update_data, $entry, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME, $allow_empty);
         }
         $this->validateEntry($entry);
         // TODO - chack to see that the permissions changed, not just any attributes
         myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_UPDATE_PERMISSIONS, $entry);
         $entry->save();
     }
     $wrapper = objectWrapperBase::getWrapperClass($entry, objectWrapperBase::DETAIL_LEVEL_DETAILED);
     $wrapper->removeFromCache("entry", $entry->getId());
     $this->addMsg("{$prefix}", $wrapper);
     $this->addDebug("modified_fields", $fields_modified);
 }
コード例 #6
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $notifications_updated = 0;
     $notifications = array();
     for ($i = 0; $i <= 50; ++$i) {
         $index = $i === 0 ? "" : $i;
         // the first notification can be with no index
         $prefix = "notification{$index}";
         $notification_id = $this->getP("{$prefix}_id");
         if ($i >= 1 && empty($notification_id)) {
             break;
         }
         $target_notification = notificationPeer::retrieveByPK($notification_id);
         if (!$target_notification) {
             $this->addError(APIErrors::INVALID_NOTIFICATION_ID, $notification_id);
             continue;
         }
         $notification_update_data = new notification();
         $obj_wrapper = objectWrapperBase::getWrapperClass($notification_update_data, 0);
         $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $notification_update_data, "{$prefix}_", $obj_wrapper->getUpdateableFields());
         if (count($fields_modified) > 0) {
             if ($notification_update_data) {
                 baseObjectUtils::fillObjectFromObject($obj_wrapper->getUpdateableFields(), $notification_update_data, $target_notification, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME);
             }
             $target_notification->save();
         }
         //	$this->addMsg ( "{$prefix}" , objectWrapperBase::getWrapperClass( $target_notification , objectWrapperBase::DETAIL_LEVEL_DETAILED) );
         $notifications[] = $target_notification;
         $notifications_updated++;
     }
     $this->addMsg("notifications", objectWrapperBase::getWrapperClass($notifications, objectWrapperBase::DETAIL_LEVEL_DETAILED));
     if ($notifications_updated == 0) {
         $this->addError(APIErrors::NO_NOTIFICATIONS_UPDATED);
     } else {
         $this->addDebug("notifications_updated", $notifications_updated);
     }
 }
コード例 #7
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $prefix = $this->getObjectPrefix();
     $batchjob_id = $this->getPM("{$prefix}_id");
     $batchjob = BatchJobPeer::retrieveByPK($batchjob_id);
     if (!$batchjob) {
         $this->addError(APIErrors::INVALID_BATCHJOB_ID, $batchjob_id);
         return;
     }
     // get the new properties for the batchjob from the request
     $batchjob_update_data = new BatchJob();
     $obj_wrapper = objectWrapperBase::getWrapperClass($batchjob_update_data, 0);
     $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $batchjob_update_data, "{$prefix}_", $obj_wrapper->getUpdateableFields());
     if (count($fields_modified) > 0) {
         if ($batchjob_update_data) {
             baseObjectUtils::fillObjectFromObject($obj_wrapper->getUpdateableFields(), $batchjob_update_data, $batchjob, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME);
         }
         $batchjob->save();
     }
     $wrapper = objectWrapperBase::getWrapperClass($batchjob, objectWrapperBase::DETAIL_LEVEL_REGULAR);
     $wrapper->removeFromCache("batchjob", $batchjob->getId());
     $this->addMsg("{$prefix}", $wrapper);
     $this->addDebug("modified_fields", $fields_modified);
 }
コード例 #8
0
 /**
  * @param int $id
  * @param kExclusiveLockKey $lockKey
  * @param BatchJob $object
  * @return BatchJob
  */
 public static function updateExclusive($id, kExclusiveLockKey $lockKey, BatchJob $object)
 {
     $c = new Criteria();
     $c->add(BatchJobLockPeer::ID, $id);
     $c->add(BatchJobLockPeer::SCHEDULER_ID, $lockKey->getSchedulerId());
     $c->add(BatchJobLockPeer::WORKER_ID, $lockKey->getWorkerId());
     $c->add(BatchJobLockPeer::BATCH_INDEX, $lockKey->getBatchIndex());
     $db_lock_object = BatchJobLockPeer::doSelectOne($c);
     if (!$db_lock_object) {
         throw new APIException(APIErrors::UPDATE_EXCLUSIVE_JOB_FAILED, $id, $lockKey->getSchedulerId(), $lockKey->getWorkerId(), $lockKey->getBatchIndex(), print_r($db_lock_object, true));
     }
     if ($db_lock_object) {
         $db_object = $db_lock_object->getBatchJob();
     } else {
         $db_object = BatchJobPeer::retrieveByPk($id);
     }
     baseObjectUtils::fillObjectFromObject(BatchJobPeer::getFieldNames(), $object, $db_object, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME);
     $db_object->save();
     return $db_object;
 }
 public function execute()
 {
     $this->forceSystemAuthentication();
     myDbHelper::$use_alternative_con = null;
     $this->ok_to_save = $this->getP("oktosave");
     $this->error = "";
     $conv_params_id = $this->getP("convparams_id");
     $command = $this->getP("command");
     $this->close_after_save = $this->getP("close_after_save");
     if ($command == "removeCache") {
     } elseif ($command == "save" || $command == "fill") {
         $conv_params = new ConversionParams();
         $wrapper = objectWrapperBase::getWrapperClass($conv_params, 0);
         $extra_fields = array("partnerId", "ffmpegParams", "mencoderParams", "flixParams");
         // add fields that cannot be updated using the API
         $allowed_params = array_merge($wrapper->getUpdateableFields(), $extra_fields);
         $fields_modified = baseObjectUtils::fillObjectFromMap($_REQUEST, $conv_params, "convparams_", $allowed_params, BasePeer::TYPE_PHPNAME, true);
         if ($command == "save") {
             if ($conv_params_id) {
                 $conv_params_from_db = ConversionParamsPeer::retrieveByPK($conv_params_id);
                 if ($conv_params_from_db) {
                     baseObjectUtils::fillObjectFromObject($allowed_params, $conv_params, $conv_params_from_db, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME, true);
                 }
                 $conv_params_from_db->save();
             } else {
                 $conv_params->save();
                 $conv_params_id = $conv_params->getId();
             }
         }
     }
     if ($command == "fill") {
         // when in command fill - don't fetch object from db
         $this->conv_params = $conv_params;
     } else {
         $this->conv_params = ConversionParamsPeer::retrieveByPK($conv_params_id);
         if (!$this->conv_params) {
             $this->error = "Cannot find ConversionParams [{$conv_params_id}]";
         }
     }
     $this->conv_params_id = $conv_params_id;
     $this->simulation = null;
     // will help simulate the conversion strings:
     if ($this->conv_params) {
         $conv_param_from_db = $this->conv_params;
         $conv_params = new kConversionParams();
         $conv_params->width = $conv_param_from_db->getName();
         $conv_params->width = $conv_param_from_db->getWidth();
         $conv_params->height = $conv_param_from_db->getHeight();
         $conv_params->aspect_ratio = $conv_param_from_db->getAspectRatio();
         $conv_params->gop_size = $conv_param_from_db->getGopSize();
         $conv_params->bitrate = $conv_param_from_db->getBitrate();
         $conv_params->qscale = $conv_param_from_db->getQscale();
         $conv_params->file_suffix = $conv_param_from_db->getFileSuffix();
         $conv_params->ffmpeg_params = $conv_param_from_db->getFfmpegParams();
         $conv_params->mencoder_params = $conv_param_from_db->getMencoderParams();
         $conv_params->flix_params = $conv_param_from_db->getFlixParams();
         $conv_params->comercial_transcoder = $conv_param_from_db->getCommercialTranscoder();
         // is not really used today per ConvParams
         $conv_params->framerate = $conv_param_from_db->getFramerate();
         $conv_params->audio_bitrate = $conv_param_from_db->getAudioBitrate();
         $conv_params->audio_sampling_rate = $conv_param_from_db->getAudioSamplingRate();
         $conv_params->audio_channels = $conv_param_from_db->getAudioChannels();
         $conv_params_list = array();
         $conv_cmd = new kConversionCommand();
         $conv_params_list[] = $conv_params;
         $conv_cmd->conversion_params_list = $conv_params_list;
         $this->simulation = kConversionEngineMgr::simulate($conv_cmd);
     }
 }
 public function execute()
 {
     ini_set("memory_limit", "64M");
     $this->forceSystemAuthentication();
     myDbHelper::$use_alternative_con = null;
     $partner_id = $this->getP("partner_id");
     $search_text = $this->getP("search_text");
     $command = $this->getP("command");
     if ($command == "removeCache") {
         PartnerPeer::resetPartnerInCache($partner_id);
         return $this->renderText("Removed partner [{$partner_id}] from cache");
     } elseif ($command == "save") {
         $partner = new Partner();
         $pw = objectWrapperBase::getWrapperClass($partner, 0);
         $extra_fields = array("partnerName", "description", "adminName", "adminEmail", "useDefaultKshow", "conversionString", "flvConversionString", "allowQuickEdit", "shouldForceUniqueKshow", "returnDuplicateKshow", "notificationsConfig", "notify", "allowMultiNotification", "appearInSearch", "mergeEntryLists", "allowLks", "allowAnonymousRanking", "isFirstLogin", "matchIp", "host", "cdnHost", "rtmpUrl", "defThumbOffset", "defThumbDensity", "landingPage", "userLandingPage", "status", "serviceConfigId", "moderateContent", "currentConversionProfileType", "monitorUsage", "templatePartnerId", "addEntryMaxFiles", "defaultConversionProfileId", "partnerGroupType", "partnerParentId", "enableAnalyticsTab", "liveStreamEnabled", "storageServePriority", "storageDeleteFromKaltura", "enableSilverLight", "partnerSpecificServices", "partnerSpecificServices", "enable508Players", "enableVast", "appStudioExampleEntry", "appStudioExamplePlayList0", "appStudioExamplePlayList1", "delivryBlockCountries", "deliveryRestrictions", "maxLoginAttempts", "loginBlockPeriod", "numPrevPassToKeep", "passReplaceFreq");
         $allowed_params = array_merge($pw->getUpdateableFields(), $extra_fields);
         $fields_modified = baseObjectUtils::fillObjectFromMap($_REQUEST, $partner, "partner_", $allowed_params, BasePeer::TYPE_PHPNAME, true);
         if (!isset($_REQUEST['partner_partnerParentId']) || $_REQUEST['partner_partnerParentId'] == '') {
             $partner->setPartnerParentId(null);
         }
         $partner_from_db = PartnerPeer::retrieveByPK($partner_id);
         if ($partner_from_db) {
             baseObjectUtils::fillObjectFromObject($allowed_params, $partner, $partner_from_db, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME, true);
         }
         if (class_exists('MetadataPlugin')) {
             $partner_from_db->setPluginEnabled(MetadataPlugin::PLUGIN_NAME, $_REQUEST['partner_enableMetadata']);
         }
         if (class_exists('AuditPlugin')) {
             $partner_from_db->setPluginEnabled(AuditPlugin::PLUGIN_NAME, $_REQUEST['partner_enableAuditTrail']);
         }
         if (class_exists('AnnotationPlugin')) {
             $partner_from_db->setPluginEnabled(AnnotationPlugin::PLUGIN_NAME, $_REQUEST['partner_enableAnnotation']);
         }
         if (class_exists('VirusScanPlugin')) {
             $partner_from_db->setPluginEnabled(VirusScanPlugin::PLUGIN_NAME, $_REQUEST['partner_enableVirusScan']);
         }
         if ($partner_from_db->getServiceConfigId() == "") {
             $partner_from_db->setServiceConfigId(null);
         }
         if ($partner_from_db->getPartnerParentId() == -1000) {
             $partner_from_db->setPartnerParentId(null);
         }
         $partner_from_db->save();
         //			PartnerPeer::resetPartnerInCache ( $partner_id);
     }
     $c = new Criteria();
     if (true) {
         $c->add(PartnerPeer::ID, $partner_id);
     }
     if ($search_text) {
         $crit = $c->getNewCriterion(PartnerPeer::PARTNER_NAME, "%{$search_text}%", Criteria::LIKE);
         $crit->addOr($c->getNewCriterion(PartnerPeer::DESCRIPTION, "%{$search_text}%", Criteria::LIKE));
         $c->addAnd($crit);
     }
     $c->setLimit(1);
     //$this->partner = PartnerPeer::retrieveByPK( $partner_id );
     $this->partner_list = PartnerPeer::doSelect($c);
     if (count($this->partner_list) == 1) {
         $this->partner = $this->partner_list[0];
     } else {
         $this->partner = null;
     }
     $this->partner_id = $partner_id;
     $this->search_text = $search_text;
 }
コード例 #11
0
ファイル: uiConf.php プロジェクト: DBezemer/server
 public function cloneToNew($new_ui_conf_obj, $new_name = null)
 {
     $cloned = new uiConf();
     $cloned->setCopiedFrom($this);
     $all_fields = uiConfPeer::getFieldNames();
     $ignore_list = array("Id", "ConfFilePath");
     // clone from current
     baseObjectUtils::fillObjectFromObject($all_fields, $this, $cloned, baseObjectUtils::CLONE_POLICY_PREFER_NEW, $ignore_list, BasePeer::TYPE_PHPNAME);
     //		$cloned->setNew(true);
     // override with data from the $new_ui_conf_obj - the name can be chosen to override
     if ($new_ui_conf_obj) {
         baseObjectUtils::fillObjectFromObject($all_fields, $new_ui_conf_obj, $cloned, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME);
     }
     if ($new_name) {
         $cloned->setName($new_name);
     }
     foreach (self::$validSubTypes as $subType) {
         $suffix = $this->getSuffixBySubType($subType);
         $content = $this->getConfFileBySuffix($suffix);
         $cloned->setConfFileBySuffix($suffix, $content);
     }
     $cloned->save(null, true);
     return $cloned;
 }
コード例 #12
0
 public static function copyData($source_entry_id, entry $target)
 {
     // the source_entry can be from any partner - not only of the current context
     entryPeer::getCriteriaFilter()->disable();
     // TODO - should not be switched of - it sohuld work ok with the new ks/kn mechanism and only public entries should be copied
     $source_entry = entryPeer::retrieveByPK($source_entry_id);
     if (!$source_entry) {
         return false;
     }
     $exclude_fields = array("id", "comments", "total_rank", "views", "votes", "favorites", "conversion_profile_id", "access_control_id", "categories", "categories_ids", "start_date", "end_date");
     baseObjectUtils::fillObjectFromObject(entryPeer::getFieldNames(BasePeer::TYPE_FIELDNAME), $source_entry, $target, baseObjectUtils::CLONE_POLICY_PREFER_EXISTING, $exclude_fields);
     $wrapper = objectWrapperBase::getWrapperClass($target, objectWrapperBase::DETAIL_LEVEL_REGULAR);
     $target->setDimensions($source_entry->getWidth(), $source_entry->getHeight());
     $target->getCustomDataObj();
     //		$target->setLengthInMsecs( $source_entry->getLengthInMsecs() );
     //		$target->setMediaType( $source_entry->getMediaType() );
     //		$target->setTags ( $source_entry->getTags () );
     $sourceThumbKey = $source_entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
     //replaced__getThumbnailPat
     $sourceDataKey = $source_entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
     //replaced__getDataPath
     $sourceDataEditKey = $source_entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA_EDIT);
     //replaced__getDataPathEdit
     //		$target->setThumbnail ( $source_thumbnail_path );
     //		$target->setData ( $source_data_path );
     $targetThumbKey = $target->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
     //replaced__getThumbnailPath
     $targetDataKey = $target->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
     //replaced__getDataPath
     $targetDataEditKey = $target->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA_EDIT);
     //replaced__getDataPathEdit
     $content = myContentStorage::getFSContentRootPath();
     //		echo "[$content] [$source_thumbnail_path]->[$target_thumbnail_path] [$source_data_path]->[$target_data_path]";
     if (kFileSyncUtils::file_exists($sourceDataKey, true)) {
         kFileSyncUtils::softCopy($sourceDataKey, $targetDataKey);
     }
     if (kFileSyncUtils::file_exists($sourceThumbKey, true)) {
         kFileSyncUtils::softCopy($sourceThumbKey, $targetThumbKey);
     }
     if (kFileSyncUtils::file_exists($sourceDataEditKey, true)) {
         kFileSyncUtils::softCopy($sourceDataEditKey, $targetDataEditKey);
     }
     // added by Tan-Tan 12/01/2010 to support falvors copy
     $sourceFlavorAssets = flavorAssetPeer::retrieveByEntryId($source_entry_id);
     foreach ($sourceFlavorAssets as $sourceFlavorAsset) {
         $sourceFlavorAsset->copyToEntry($target->getId(), $target->getPartnerId());
     }
     return true;
 }
コード例 #13
0
 public static function autoFillObjectFromObject(BaseObject $source_obj, BaseObject &$target_obj, $allow_empty = false)
 {
     $obj_wrapper = objectWrapperBase::getWrapperClass($source_obj, 0);
     $updateable_fields = $obj_wrapper->getUpdateableFields();
     baseObjectUtils::fillObjectFromObject($updateable_fields, $source_obj, $target_obj, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME, $allow_empty);
 }
コード例 #14
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     if (!$puser_kuser) {
         $this->addError(APIErrors::INVALID_USER_ID, $puser_id);
         return;
     }
     // get the new properties for the kshow from the request
     $kshow_update_data = new kshow();
     $start_obj_creation = microtime(true);
     $kshow = new kshow();
     $obj_wrapper = objectWrapperBase::getWrapperClass($kshow, 0);
     //		$this->addDebug ( "timer_getWrapperClass1" , ( microtime( true ) - $start_obj_creation ) );
     $timer = microtime(true);
     $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $kshow, "kshow_", $obj_wrapper->getUpdateableFields());
     //		$this->addDebug ( "timer_fillObjectFromMap" , ( microtime( true ) - $timer ) );
     $kshow->setName(trim($kshow->getName()));
     $kshow_id = $this->getPM("kshow_id");
     $detailed = $this->getP("detailed", false);
     $allow_duplicate_names = $this->getP("allow_duplicate_names", true, true);
     if ($allow_duplicate_names === "false" || $allow_duplicate_names === 0) {
         $allow_duplicate_names = false;
     }
     if (count($fields_modified) > 0) {
         $timer = microtime(true);
         $kshow_from_db = kshowPeer::retrieveByPK($kshow_id);
         if (!$kshow_from_db) {
             // kshow with this id does not exists in the DB
             $this->addError(APIErrors::INVALID_KSHOW_ID, $kshow_id);
             return;
         }
         if (!$this->isOwnedBy($kshow_from_db, $puser_kuser->getKuserId())) {
             $this->verifyPrivileges("edit", $kshow_id);
         }
         // user was granted explicit permissions when initiatd the ks
         if (myPartnerUtils::shouldForceUniqueKshow($partner_id, $allow_duplicate_names)) {
             $kshow_with_name_from_db = kshowPeer::getFirstKshowByName($kshow->getName());
             if ($kshow_with_name_from_db && $kshow_with_name_from_db->getId() != $kshow_id) {
                 $this->addError(APIErrors::DUPLICATE_KSHOW_BY_NAME, $kshow->getName());
                 $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
                 if (myPartnerUtils::returnDuplicateKshow($partner_id)) {
                     $this->addMsg("kshow", objectWrapperBase::getWrapperClass($kshow_from_db, $level));
                 }
                 return;
             }
         }
         $this->addMsg("old_kshow", objectWrapperBase::getWrapperClass($kshow_from_db->copy(), objectWrapperBase::DETAIL_LEVEL_REGULAR));
         //			$this->addDebug ( "timer_db_retrieve" , ( microtime( true ) - $timer ) );
         $timer = microtime(true);
         // copy relevant fields from $kshow -> $kshow_update_data
         baseObjectUtils::fillObjectFromObject($obj_wrapper->getUpdateableFields(), $kshow, $kshow_from_db, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME);
         //			$this->addDebug ( "timer_fillObjectFromObject" , ( microtime( true ) - $timer ) );
         $timer = microtime(true);
         // TODO - move to some generic place myKshowUtils / kshow.php
         // TODO - this should be called only for the first time or whenever the user wants to force overriding the sample_text
         $force_sample_text = $this->getP("force_sample_text", false);
         $force_sample_text = false;
         $kuser_id = $puser_kuser->getKuserId();
         /*
         			$sample_text = "This is a collaborative video for &#xD;'" . $kshow_from_db->getIndexedCustomData3() . "'.&#xD;Click 'Add to Video' to get started";
         			$kshow_from_db->initFromTemplate ( $kuser_id ,$sample_text );
         */
         // be sure to save the $kshow_from_db and NOT $kshow - this will create a new entry in the DB
         $kshow_from_db->save();
         // update the name of the roughcut too
         $show_entry_id = $kshow_from_db->getShowEntryId();
         $showEntry = entryPeer::retrieveByPK($show_entry_id);
         if ($showEntry) {
             $showEntry->setName($kshow_from_db->getName());
             $showEntry->save();
         }
         // TODO - decide which of the notifications should be called
         myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_KSHOW_UPDATE_INFO, $kshow_from_db);
         // or
         //myNotificationMgr::createNotification( notification::NOTIFICATION_TYPE_KSHOW_UPDATE_PERMISSIONS , $kshow_from_db );
         //			$this->addDebug ( "timer_db_save" , ( microtime( true ) - $timer ) );
         $end_obj_creation = microtime(true);
         $this->addDebug("obj_creation_time", $end_obj_creation - $start_obj_creation);
     } else {
         $kshow_from_db = $kshow;
         // no fiends to update !
     }
     // see if trying to rollback
     $desired_version = $this->getP("kshow_version");
     if ($desired_version) {
         $result = $kshow_from_db->rollbackVersion($desired_version);
         if (!$result) {
             $this->addError(APIErrors::ERROR_KSHOW_ROLLBACK, $kshow_id, $desired_version);
         }
     }
     $this->addMsg("kshow", objectWrapperBase::getWrapperClass($kshow_from_db, objectWrapperBase::DETAIL_LEVEL_REGULAR));
     $this->addDebug("modified_fields", $fields_modified);
 }
コード例 #15
0
ファイル: uiConf.php プロジェクト: richhl/kalturaCE
 public function cloneToNew($new_ui_conf_obj, $new_name = null)
 {
     $cloned = new uiConf();
     $obj_wrapper = objectWrapperBase::getWrapperClass($cloned, 0);
     $all_fields = uiConfPeer::getFieldNames();
     $ignore_list = array("Id", "ConfFilePath");
     // clone from current
     baseObjectUtils::fillObjectFromObject($all_fields, $this, $cloned, baseObjectUtils::CLONE_POLICY_PREFER_NEW, $ignore_list, BasePeer::TYPE_PHPNAME);
     //		$cloned->setNew(true);
     // override with data from the $new_ui_conf_obj - the name can be chosen to override
     if ($new_ui_conf_obj) {
         baseObjectUtils::fillObjectFromObject($all_fields, $new_ui_conf_obj, $cloned, baseObjectUtils::CLONE_POLICY_PREFER_NEW, null, BasePeer::TYPE_PHPNAME);
     }
     if ($new_name) {
         $cloned->setName($new_name);
     }
     $cloned->setConfFile($this->getConfFile());
     $cloned->setConfFile2($this->getConfFile2());
     $cloned->save(null, true);
     return $cloned;
 }