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; } }
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); } }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(ConversionParamsPeer::DATABASE_NAME); $criteria->add(ConversionParamsPeer::ID, $pks, Criteria::IN); $objs = ConversionParamsPeer::doSelect($criteria, $con); } return $objs; }
public function getConversionParams(&$fallback_mode = null) { $fallback_mode = ""; return ConversionParamsPeer::retrieveByConversionProfile($this, $fallback_mode); }
/** * Populates the object using an array. * * This is particularly useful when populating an object from one of the * request arrays (e.g. $_POST). This method goes through the column * names, checking to see whether a matching key exists in populated * array. If so the setByName() method is called for that column. * * You can specify the key type of the array by additionally passing one * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. * The default key type is the column's phpname (e.g. 'AuthorId') * * @param array $arr An array to populate the object from. * @param string $keyType The type of keys the array uses. * @return void */ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = ConversionParamsPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setPartnerId($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setEnabled($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setName($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setProfileType($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setProfileTypeIndex($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setWidth($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setHeight($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setAspectRatio($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setGopSize($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setBitrate($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setQscale($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { $this->setFileSuffix($arr[$keys[12]]); } if (array_key_exists($keys[13], $arr)) { $this->setCustomData($arr[$keys[13]]); } if (array_key_exists($keys[14], $arr)) { $this->setCreatedAt($arr[$keys[14]]); } if (array_key_exists($keys[15], $arr)) { $this->setUpdatedAt($arr[$keys[15]]); } }