コード例 #1
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);
 }
コード例 #2
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);
 }
コード例 #3
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     // get the new properties for the ConversionProfile from the request
     $conv_profile = new ConversionProfile();
     $obj_wrapper = objectWrapperBase::getWrapperClass($conv_profile, 0);
     $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $conv_profile, "conversionProfile_", $obj_wrapper->getUpdateableFields(), BasePeer::TYPE_PHPNAME, true);
     // check that mandatory fields were set
     if (count($fields_modified) > 0) {
         // search if partner already has a conversionProfile similar to the one just added - if exists - use it
         // if not - create it and return it.
         $partner_conv_profile = ConversionProfilePeer::retrieveSimilar($partner_id, $conv_profile);
         if (!$partner_conv_profile) {
             $conv_profile->setPartnerId($partner_id);
             $conv_profile->setEnabled(1);
             $conv_profile->save();
             $partner_conv_profile = $conv_profile;
         }
         // TODO - remove - no need to playaround with the updatedAt for ordering (in the listconversionprofiles service
         //			$partner_conv_profile->setUpdatedAt( time() );
         //			$partner_conv_profile->save();
         $partner = $this->getPartner();
         $partner_current_conversion_profile = $partner->getCurrentConversionProfileType();
         if ($partner_conv_profile->getId() != $partner_current_conversion_profile) {
             $partner->setCurrentConversionProfileType($partner_conv_profile->getId());
             $partner->save();
         }
         $this->addMsg("conversionProfile", objectWrapperBase::getWrapperClass($partner_conv_profile, objectWrapperBase::DETAIL_LEVEL_DETAILED));
         $this->addDebug("added_fields", $fields_modified);
     } else {
         $this->addError(APIErrors::NO_FIELDS_SET_FOR_CONVERSION_PROFILE);
     }
 }
コード例 #4
0
 public static function createAssets($list, $list_name)
 {
     foreach ($list as $entry) {
         $is_ready = $entry->getStatus() == entryStatus::READY;
         $data = $entry->getDataPath();
         // this should not happen !
         $duration = $entry->getLengthInMsecs();
         if ($duration == NULL || $duration <= 0) {
             $duration = 10.0;
         } else {
             $duration = $duration / 1000;
         }
         $source_link = '';
         $credit = $entry->getCredit();
         if ($credit == null) {
             $credit = '';
         } else {
             $source_link = $entry->getSourceLink();
             if ($source_link == null) {
                 $source_link = '';
             }
         }
         echo "\t" . baseObjectUtils::objToXml($entry, array('id', 'name', 'media_type', 'kshow_id'), 'asset', true, array('url' => $data, 'ready' => $is_ready, 'thumbnail_path' => $entry->getThumbnailPath(), 'credit' => $credit, 'source_link' => $source_link, 'duration' => $duration, 'list_type' => $list_name, 'contributor_screen_name' => $entry->getKuser()->getScreenName()));
     }
 }
コード例 #5
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);
     }
 }
コード例 #6
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $this->applyPartnerFilterForClass(new uiConfPeer(), $partner_id);
     $detailed = $this->getDetailed();
     //$this->getP ( "detailed" , false );
     $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
     // get the new properties for the kuser from the request
     $ui_conf = new uiConf();
     $ui_conf->setPartnerId($partner_id);
     // set this once before filling the object and once after
     // this is called for the first time to set the type and media type for fillObjectFromMap
     $this->setObjType($ui_conf);
     $obj_wrapper = objectWrapperBase::getWrapperClass($ui_conf, 0);
     $field_level = $this->isAdmin() ? 2 : 1;
     $updateable_fields = $obj_wrapper->getUpdateableFields($field_level);
     // TODO - always use fillObjectFromMapOrderedByFields rather than fillObjectFromMap
     $fields_modified = baseObjectUtils::fillObjectFromMapOrderedByFields($this->getInputParams(), $ui_conf, $this->getObjectPrefix() . "_", $updateable_fields);
     // check that mandatory fields were set
     // TODO
     if (count($fields_modified) > 0) {
         $ui_conf->setPartnerId($partner_id);
         // this is now called for the second time to force the obj_type
         $this->setObjType($ui_conf);
         $ui_conf->save();
         $this->addMsg($this->getObjectPrefix(), objectWrapperBase::getWrapperClass($ui_conf, $level));
         $this->addDebug("added_fields", $fields_modified);
     } else {
         $this->addError(APIErrors::NO_FIELDS_SET_FOR_UI_CONF, $this->getObjectPrefix());
     }
 }
コード例 #7
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $kshow_id = $this->getP("kshow_id", kshow::KSHOW_ID_USE_DEFAULT);
     $entry = null;
     if ($kshow_id == kshow::KSHOW_ID_USE_DEFAULT) {
         // see if the partner has some default kshow to add to
         $kshow = myPartnerUtils::getDefaultKshow($partner_id, $subp_id, $puser_kuser);
         if ($kshow) {
             $kshow_id = $kshow->getId();
         }
     } elseif ($kshow_id == kshow::KSHOW_ID_CREATE_NEW) {
         // if the partner allows - create a new kshow
         $kshow = myPartnerUtils::getDefaultKshow($partner_id, $subp_id, $puser_kuser, null, true);
         if ($kshow) {
             $kshow_id = $kshow->getId();
             $entry = $kshow->getShowEntry();
             // use the newly created kshow's roughcut
         }
     } else {
         $kshow = kshowPeer::retrieveByPK($kshow_id);
     }
     if (!$kshow) {
         // the partner is attempting to add an entry to some invalid or non-existing kwho
         $this->addError(APIErrors::INVALID_KSHOW_ID, $kshow_id);
         return;
     }
     if (!$entry) {
         $entry = $kshow->createEntry(entry::ENTRY_MEDIA_TYPE_SHOW, $kshow->getProducerId(), "&auto_edit.jpg", "");
     }
     $obj_wrapper = objectWrapperBase::getWrapperClass($entry, 0);
     $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $entry, $this->getObjectPrefix() . "_", array("name", "tags", "groupId", "partnerData", "permissions", "screenName", "description", "indexedCustomData1"));
     $entry->save();
     $this->addMsg($this->getObjectPrefix(), objectWrapperBase::getWrapperClass($entry, objectWrapperBase::DETAIL_LEVEL_REGULAR));
     $this->addDebug("added_fields", $fields_modified);
 }
コード例 #8
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;
     }
 }
コード例 #9
0
ファイル: UiConfService.php プロジェクト: richhl/kalturaCE
 /**
  * Update an existing UIConf
  * 
  * @action update
  * @param int $id 
  * @param KalturaUiConf $uiConf
  * @return KalturaUiConf
  *
  * @throws APIErrors::INVALID_UI_CONF_ID
  */
 function updateAction($id, KalturaUiConf $uiConf)
 {
     $dbUiConf = uiConfPeer::retrieveByPK($id);
     if (!$dbUiConf) {
         throw new KalturaAPIException(APIErrors::INVALID_UI_CONF_ID, $id);
     }
     $uiConfUpdate = $uiConf->toUiConf();
     $allowEmpty = true;
     // TODO - what is the policy  ?
     baseObjectUtils::autoFillObjectFromObject($uiConfUpdate, $dbUiConf, $allowEmpty);
     $dbUiConf->save();
     $uiConf->fromUiConf($dbUiConf);
     return $uiConf;
 }
コード例 #10
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);
 }
コード例 #11
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     // get the new properties for the kuser from the request
     $dvd_entry = new entry();
     $this->getTypeAndMediaType($dvd_entry);
     // important to set type before the auto-fill so the setDataContent will work properly
     $dvd_entry->setLengthInMsecs(0);
     $obj_wrapper = objectWrapperBase::getWrapperClass($dvd_entry, 0);
     $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $dvd_entry, $this->getObjectPrefix() . "_", $obj_wrapper->getUpdateableFields());
     // check that mandatory fields were set
     // TODO
     $new_widget = null;
     if (count($fields_modified) > 0) {
         $kshow_id = $this->getP("kshow_id", kshow::KSHOW_ID_USE_DEFAULT);
         if ($kshow_id == kshow::KSHOW_ID_USE_DEFAULT) {
             // see if the partner has some default kshow to add to
             $kshow = myPartnerUtils::getDefaultKshow($partner_id, $subp_id, $puser_kuser);
             if ($kshow) {
                 $kshow_id = $kshow->getId();
             }
         } elseif ($kshow_id == kshow::KSHOW_ID_CREATE_NEW) {
             // if the partner allows - create a new kshow
             $kshow = myPartnerUtils::getDefaultKshow($partner_id, $subp_id, $puser_kuser, null, true);
             if ($kshow) {
                 $kshow_id = $kshow->getId();
             }
         } else {
             $kshow = kshowPeer::retrieveByPK($kshow_id);
         }
         if (!$kshow) {
             // the partner is attempting to add an entry to some invalid or non-existing kwho
             $this->addError(APIErrors::INVALID_KSHOW_ID, $kshow_id);
             return;
         }
         // force the type and media type
         // TODO - set the kshow to some default kshow of the partner - maybe extract it from the custom_data of this specific partner
         $dvd_entry->setKshowId($kshow_id);
         $dvd_entry->setStatus(entryStatus::READY);
         $dvd_entry->setPartnerId($partner_id);
         $dvd_entry->setSubpId($subp_id);
         $dvd_entry->setKuserId($puser_kuser->getKuserId());
         $dvd_entry->setCreatorKuserId($puser_kuser->getKuserId());
         $dvd_entry->save();
         $this->addMsg($this->getObjectPrefix(), objectWrapperBase::getWrapperClass($dvd_entry, objectWrapperBase::DETAIL_LEVEL_DETAILED));
         $this->addDebug("added_fields", $fields_modified);
     } else {
         $this->addError(APIErrors::NO_FIELDS_SET_FOR_GENERIC_ENTRY, $this->getObjectPrefix());
     }
 }
コード例 #12
0
ファイル: WidgetService.php プロジェクト: richhl/kalturaCE
 /**
  * Update exisiting widget
  * 
  * @action update
  * @param string $id 
  * @param KalturaWidget $widget
  * @return KalturaWidget
  */
 function updateAction($id, KalturaWidget $widget)
 {
     $dbWidget = widgetPeer::retrieveByPK($id);
     if (!$dbWidget) {
         throw new KalturaAPIException(APIErrors::INVALID_WIDGET_ID, $id);
     }
     $widgetUpdate = $widget->toWidget();
     $allow_empty = true;
     // TODO - what is the policy  ?
     baseObjectUtils::autoFillObjectFromObject($widgetUpdate, $dbWidget, $allow_empty);
     $dbWidget->save();
     // TODO: widget in cache, should drop from cache
     $widget->fromWidget($dbWidget);
     return $widget;
 }
コード例 #13
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     // get the new properties for the kuser from the request
     $widget = new widget();
     $obj_wrapper = objectWrapperBase::getWrapperClass($widget, 0);
     $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $widget, "widget_", $obj_wrapper->getUpdateableFields());
     // check that mandatory fields were set
     // TODO
     $new_widget = null;
     if (count($fields_modified) > 0) {
         // see if to create a widget from a widget or from a kshow
         if ($widget->getSourceWidgetId()) {
             $widget_from_db = widgetPeer::retrieveByPK($widget->getSourceWidgetId());
             $new_widget = widget::createWidgetFromWidget($widget_from_db, $widget->getKshowId(), $widget->getEntryId(), $widget->getUiConfId(), $widget->getCustomData(), $widget->getPartnerData(), $widget->getSecurityType());
             if (!$new_widget) {
                 $this->addError(APIErrors::INVALID_KSHOW_AND_ENTRY_PAIR, $widget->getKshowId(), $widget->getEntryId());
                 return;
             }
         } else {
             $kshow_id = $widget->getKshowId();
             if ($kshow_id) {
                 $kshow = kshowPeer::retrieveByPK($kshow_id);
                 if (!$kshow) {
                     $this->addError(APIErrors::KSHOW_DOES_NOT_EXISTS);
                     // This field in unique. Please change ");
                     return;
                 }
             } else {
                 $kshow = new kshow();
                 $kshow->setId(0);
                 $kshow->setPartnerId($partner_id);
                 $kshow->setSubpId($subp_id);
             }
             $new_widget = widget::createWidget($kshow, $widget->getEntryId(), null, $widget->getUiConfId(), $widget->getCustomData(), $widget->getPartnerData(), $widget->getSecurityType());
         }
         $this->addMsg("widget", objectWrapperBase::getWrapperClass($new_widget, objectWrapperBase::DETAIL_LEVEL_DETAILED));
         $this->addDebug("added_fields", $fields_modified);
     } else {
         $this->addError(APIErrors::NO_FIELDS_SET_FOR_WIDGET);
     }
 }
コード例 #14
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $detailed = $this->getDetailed();
     //$this->getP ( "detailed" , false );
     $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
     // get the new properties for the kuser from the request
     $entry = new entry();
     // this is called for the first time to set the type and media type for fillObjectFromMap
     $this->setTypeAndMediaType($entry);
     // important to set type before the auto-fill so the setDataContent will work properly
     $entry->setLengthInMsecs(0);
     $obj_wrapper = objectWrapperBase::getWrapperClass($entry, 0);
     $field_level = $this->isAdmin() ? 2 : 1;
     $updateable_fields = $obj_wrapper->getUpdateableFields($field_level);
     $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $entry, $this->getObjectPrefix() . "_", $updateable_fields);
     // check that mandatory fields were set
     // TODO
     if (count($fields_modified) > 0) {
         $kshow_id = $this->getP("kshow_id", kshow::KSHOW_ID_USE_DEFAULT);
         $kshow = $this->getKshow($partner_id, $subp_id, $puser_kuser, $kshow_id, $entry);
         // force the type and media type
         // TODO - set the kshow to some default kshow of the partner - maybe extract it from the custom_data of this specific partner
         $entry->setKshowId($kshow_id);
         $entry->setStatus(entryStatus::READY);
         $entry->setPartnerId($partner_id);
         $entry->setSubpId($subp_id);
         $entry->setKuserId($puser_kuser->getKuserId());
         $entry->setCreatorKuserId($puser_kuser->getKuserId());
         // this is now called for the second time to force the type and media type
         $this->setTypeAndMediaType($entry);
         $this->validateEntry($entry);
         $entry->save();
         $this->addMsg($this->getObjectPrefix(), objectWrapperBase::getWrapperClass($entry, $level));
         $this->addDebug("added_fields", $fields_modified);
     } else {
         $this->addError(APIErrors::NO_FIELDS_SET_FOR_GENERIC_ENTRY, $this->getObjectPrefix());
     }
 }
コード例 #15
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);
     }
 }
コード例 #16
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     defPartnerservices2baseAction::disableCache();
     $partner = new Partner();
     $obj_wrapper = objectWrapperBase::getWrapperClass($partner, 0);
     $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $partner, "partner_", $obj_wrapper->getUpdateableFields());
     $c = new Criteria();
     $c->addAnd(UserLoginDataPeer::LOGIN_EMAIL, $partner->getAdminEmail(), Criteria::EQUAL);
     $c->setLimit(1);
     $existingUser = UserLoginDataPeer::doCount($c) > 0;
     // check that mandatory fields were set
     // TODO
     if (count($fields_modified) > 0) {
         try {
             $cms_password = $this->getP("cms_password");
             $partner_registration = new myPartnerRegistration();
             list($pid, $subpid, $pass, $hashKey) = $partner_registration->initNewPartner($partner->getName(), $partner->getAdminName(), $partner->getAdminEmail(), $partner->getCommercialUse(), "yes", $partner->getDescription(), $partner->getUrl1(), $cms_password, $partner);
             $partner_from_db = PartnerPeer::retrieveByPK($pid);
             $partner_registration->sendRegistrationInformationForPartner($partner_from_db, false, $existingUser);
         } catch (SignupException $se) {
             $this->addError(APIErrors::PARTNER_REGISTRATION_ERROR, $se->getMessage());
             return;
         } catch (Exception $ex) {
             // this assumes the partner name is unique - TODO - remove key from DB !
             $this->addError(APIErrors::SERVERL_ERROR, "Partner with name already exists");
             $this->addError(APIErrors::SERVERL_ERROR, $ex->getMessage());
             return;
         }
         $this->addMsg("partner", objectWrapperBase::getWrapperClass($partner_from_db, objectWrapperBase::DETAIL_LEVEL_DETAILED));
         $this->addMsg("subp_id", $subpid);
         $this->addMsg("cms_password", $pass);
         $this->addDebug("added_fields", $fields_modified);
     } else {
         $this->addError(APIErrors::NO_FIELDS_SET_FOR_PARTNER);
     }
 }
コード例 #17
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);
 }
コード例 #18
0
 public static function encodeObject(BaseObject $obj, array $field_names)
 {
     return json_encode(baseObjectUtils::getParamListFromObjectAsArray($obj, $field_names));
 }
コード例 #19
0
<?php

// create xml for each entry is entry_list
if ($debug) {
    echo "Result<br><textarea cols=100 rows=50>";
}
?>

<assets>
<?php 
foreach ($entry_list as $entry) {
    $is_ready = $entry->getStatus() == entryStatus::READY;
    $data = $entry->getDataPath();
    echo "\t" . baseObjectUtils::objToXml($entry, array('id', 'name', 'type' => 'media_type'), 'asset', true, array('url' => $data, 'ready' => $is_ready, 'thumbnail_path' => $entry->getThumbnailPath()));
}
?>
</assets>

<?php 
if ($debug) {
    echo "</textarea>";
}
コード例 #20
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);
 }
コード例 #21
0
 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $kshows_from_db = null;
     // works in one of 2 ways:
     // 1. get no requested name - will create a new kshow and return its details
     // 2. get some name - tries to fetch by name. if already exists - return it
     // get the new properties for the kuser from the request
     $kshow = new kshow();
     $allow_duplicate_names = $this->getP("allow_duplicate_names", true, true);
     if ($allow_duplicate_names === "false" || $allow_duplicate_names === 0) {
         $allow_duplicate_names = false;
     }
     $return_metadata = $this->getP("metadata", false);
     $detailed = $this->getP("detailed", false);
     $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
     $obj_wrapper = objectWrapperBase::getWrapperClass($kshow, 0);
     $fields_modified = baseObjectUtils::fillObjectFromMap($this->getInputParams(), $kshow, "kshow_", $obj_wrapper->getUpdateableFields());
     // check that mandatory fields were set
     // TODO
     $kshow->setName(trim($kshow->getName()));
     // ASSUME - the name is UNIQUE per partner_id !
     if ($kshow->getName()) {
         if (myPartnerUtils::shouldForceUniqueKshow($partner_id, $allow_duplicate_names)) {
             // in this case willsearch for an existing kshow with this name and return with an error if found
             $kshows_from_db = kshowPeer::getKshowsByName(trim($kshow->getName()));
             if ($kshows_from_db) {
                 $kshow_from_db = $kshows_from_db[0];
                 $this->addDebug("already_exists_objects", count($kshows_from_db));
                 $this->addError(APIErrors::DUPLICATE_KSHOW_BY_NAME, $kshow->getName());
                 // This field in unique. Please change ");
                 if (myPartnerUtils::returnDuplicateKshow($partner_id)) {
                     $this->addMsg("kshow", objectWrapperBase::getWrapperClass($kshow_from_db, $level));
                 }
                 return;
             }
         }
     }
     // the first kuser to create this kshow will be it's producer
     $producer_id = $puser_kuser->getKuserId();
     $kshow->setProducerId($producer_id);
     // moved to the update - where there is
     $kshow->setPartnerId($partner_id);
     $kshow->setSubpId($subp_id);
     $kshow->setViewPermissions(kshow::KSHOW_PERMISSION_EVERYONE);
     // by default the permissions should be public
     if ($kshow->getPermissions() === null) {
         $kshow->setPermissions(myPrivilegesMgr::PERMISSIONS_PUBLIC);
     }
     // have to save the kshow before creating the default entries
     $kshow->save();
     $show_entry = $kshow->createEntry(entry::ENTRY_MEDIA_TYPE_SHOW, $producer_id, "&auto_edit.jpg", $kshow->getName());
     // roughcut
     $kshow->createEntry(entry::ENTRY_MEDIA_TYPE_VIDEO, $producer_id);
     // intro
     /*
     		$sample_text = $kshow->getName();
     		$host = requestUtils::getHost();
     */
     $sample_text = "";
     myEntryUtils::modifyEntryMetadataWithText($show_entry, $sample_text, "");
     // set the roughcut to false so the update iwll override with better data
     $kshow->setHasRoughcut(false);
     $kshow->initFromTemplate($producer_id, $sample_text);
     $kshow->save();
     myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_KSHOW_ADD, $kshow);
     $this->addMsg("kshow", objectWrapperBase::getWrapperClass($kshow, $level));
     if ($return_metadata) {
         $this->addMsg("metadata", $kshow->getMetadata());
     }
     $this->addDebug("added_fields", $fields_modified);
     if ($kshows_from_db) {
         $this->addDebug("already_exists_objects", count($kshows_from_db));
     }
 }
コード例 #22
0
ファイル: PlaylistService.php プロジェクト: wzur/server
 /**
  * Update existing playlist
  * Note - you cannot change playlist type. updated playlist must be of the same type.
  *
  * @action update
  * @param string $id
  * @param KalturaPlaylist $playlist
  * @param bool $updateStats
  * @return KalturaPlaylist
  *
  * @throws APIErrors::INVALID_ENTRY_ID
  * @throws APIErrors::INVALID_PLAYLIST_TYPE
  * @validateUser entry id edit
  *
  * @disableRelativeTime $playlist
  */
 function updateAction($id, KalturaPlaylist $playlist, $updateStats = false)
 {
     $dbPlaylist = entryPeer::retrieveByPK($id);
     if (!$dbPlaylist) {
         throw new KalturaAPIException(APIErrors::INVALID_ENTRY_ID, "Playlist", $id);
     }
     if ($dbPlaylist->getType() != entryType::PLAYLIST) {
         throw new KalturaAPIException(APIErrors::INVALID_PLAYLIST_TYPE);
     }
     $playlist->playlistType = $dbPlaylist->getMediaType();
     // Added the following 2 lines in order to make the permission verifications in toUpdatableObject work on the actual db object
     // TODO: the following use of autoFillObjectFromObject should be replaced by a normal toUpdatableObject
     $playlistUpdate = clone $dbPlaylist;
     $playlistUpdate = $playlist->toUpdatableObject($playlistUpdate);
     $this->checkAndSetValidUserUpdate($playlist, $dbPlaylist);
     $this->checkAdminOnlyUpdateProperties($playlist);
     $this->validateAccessControlId($playlist);
     $this->validateEntryScheduleDates($playlist, $dbPlaylist);
     $allowEmpty = true;
     // TODO - what is the policy  ?
     if ($playlistUpdate->getMediaType() && $playlistUpdate->getMediaType() != $dbPlaylist->getMediaType()) {
         throw new KalturaAPIException(APIErrors::INVALID_PLAYLIST_TYPE);
     } else {
         $playlistUpdate->setMediaType($dbPlaylist->getMediaType());
         // incase  $playlistUpdate->getMediaType() was empty
     }
     // copy properties from the playlistUpdate to the $dbPlaylist
     baseObjectUtils::autoFillObjectFromObject($playlistUpdate, $dbPlaylist, $allowEmpty);
     // after filling the $dbPlaylist from  $playlist - make sure the data content is set properly
     if (!is_null($playlistUpdate->getDataContent(true)) && $playlistUpdate->getDataContent(true) != $dbPlaylist->getDataContent()) {
         $dbPlaylist->setDataContent($playlistUpdate->getDataContent(true));
         myPlaylistUtils::validatePlaylist($dbPlaylist);
     }
     if ($updateStats) {
         myPlaylistUtils::updatePlaylistStatistics($this->getPartnerId(), $dbPlaylist);
     }
     //, $extra_filters , $detailed );
     $dbPlaylist->save();
     $playlist->fromObject($dbPlaylist, $this->getResponseProfile());
     return $playlist;
 }
コード例 #23
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;
 }
コード例 #24
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;
 }
コード例 #25
0
<?php

if (!$kuser) {
    die;
}
$user_name = $kuser->getScreenName();
$show_klogo = 1;
if ($entry) {
    $user_name = $entry->getSubpId() == 10003 ? "Facelift" : $kuser->getScreenName();
    $show_klogo = $widget_type == 3 && $entry->getPartnerId() == 18 ? 0 : 1;
    // dont show the kaltura logo while playing on wikieducator
}
?>
<xml>
	<?php 
echo baseObjectUtils::objToXml($entry, array('id', 'name', 'kshow_id', 'tags', 'media_type', 'length_in_msecs', 'status'), 'entry', true, array("thumbnail_path" => $thumbnail, "user_name" => $user_name, "message" => $message, "server_time" => time(), "kshow_category" => $kshow_category, "kshow_name" => $kshow_name, "kshow_description" => $kshow_description, "kshow_tags" => $kshow_tags, "generic_embed_code" => $generic_embed_code, "myspace_embed_code" => $myspace_embed_code, "share_url" => $share_url, "show_klogo" => $show_klogo));
?>
</xml>
コード例 #26
0
ファイル: QuizPlugin.php プロジェクト: wzur/server
 protected function getKuserIds($objectIds)
 {
     $userIds = baseObjectUtils::getObjectIdsAsArray($objectIds);
     $kuserIds = array();
     foreach ($userIds as $userId) {
         $kuser = kuserPeer::getKuserByPartnerAndUid(kCurrentContext::$ks_partner_id, $userId);
         if ($kuser) {
             $kuserIds[] = $kuser->getKuserId();
         }
     }
     return $kuserIds;
 }
コード例 #27
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()
 {
     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;
 }
 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);
     }
 }
コード例 #30
0
<?php

// create xml for each entry is entry_list
if ($debug) {
    echo "Result<br><textarea cols=100 rows=50>";
}
?>
<xml>
	<?php 
echo baseObjectUtils::objToXml($kshow, array('id', 'name', "show_entry_id"), 'kshow', true, array("entry_name" => $entry->getName(), "thumbnail_path" => $thumbnail, "can_publish" => $can_publish));
?>
	<?php 
echo baseObjectUtils::objToXml($producer, array('id', 'screen_name'), 'producer', true);
?>
	<?php 
echo baseObjectUtils::objToXml($editor, array('id', 'screen_name'), 'editor', true);
?>
	
	<?php 
echo "<versions>";
foreach ($show_versions as $version_info) {
    echo "<version_info version=\"" . $version_info[3] . "\" date=\"" . strftime("%d/%m/%y %H:%M:%S", $version_info[2]) . "\"/>\n";
}
echo "</versions>";
?>
</xml>

<?php 
if ($debug) {
    echo "</textarea>";
}