本文整理汇总了PHP中kshowPeer::retrieveByPK方法的典型用法代码示例。如果您正苦于以下问题:PHP kshowPeer::retrieveByPK方法的具体用法?PHP kshowPeer::retrieveByPK怎么用?PHP kshowPeer::retrieveByPK使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kshowPeer
的用法示例。
在下文中一共展示了kshowPeer::retrieveByPK方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getObject
public function getObject()
{
if ($this->m_object) {
return $this->m_object;
}
$object_id = $this->object_id;
if ($object_id == null) {
return null;
}
switch ($this->getObjectType()) {
case self::MODERATION_OBJECT_TYPE_KSHOW:
$this->m_object = kshowPeer::retrieveByPK($object_id);
break;
case self::MODERATION_OBJECT_TYPE_ENTRY:
// be able to fetch entries that are deleted
entryPeer::allowDeletedInCriteriaFilter();
$this->m_object = entryPeer::retrieveByPK($object_id);
entryPeer::blockDeletedInCriteriaFilter();
break;
case self::MODERATION_OBJECT_TYPE_USER:
// $object_id is the puser_id
$puser_kuser = PuserKuserPeer::retrieveByPartnerAndUid($this->getPartnerId(), NULL, $object_id, true);
if ($puser_kuser && $puser_kuser->getKuser()) {
$this->m_object = $puser_kuser->getKuser();
}
// $this->m_object = kuserPeer::retrieveByPK( $object_id );
break;
}
return $this->m_object;
}
示例2: executeImpl
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);
}
示例3: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
$kshow_id = $this->getPM("kshow_id");
$detailed = $this->getP("detailed", false);
$kshow_indexedCustomData3 = $this->getP("indexedCustomData3");
$kshow = null;
if ($kshow_id) {
$kshow = kshowPeer::retrieveByPK($kshow_id);
} elseif ($kshow_indexedCustomData3) {
$kshow = kshowPeer::retrieveByIndexedCustomData3($kshow_indexedCustomData3);
}
if (!$kshow) {
$this->addError(APIErrors::INVALID_KSHOW_ID, $kshow_id);
} else {
$newKshow = myKshowUtils::shalowCloneById($kshow_id, $puser_kuser->getKuserId());
if (!$newKshow) {
$this->addError(APIErrors::KSHOW_CLONE_FAILED, $kshow_id);
} else {
$level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
$wrapper = objectWrapperBase::getWrapperClass($newKshow, $level);
// TODO - remove this code when cache works properly when saving objects (in their save method)
$wrapper->removeFromCache("kshow", $newKshow->getId());
$this->addMsg("kshow", $wrapper);
}
}
}
示例4: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
$this->response_type = kalturaWebserviceRenderer::RESPONSE_TYPE_HTML;
//
$widget_id = $this->getP("widget_id");
$kshow_id = $this->getP("kshow_id");
$entry_id = $this->getP("entry_id");
$widget_type = $this->getP("widget_type", 1);
// TODO -decide on a good default;
if ($widget_id) {
$this->addMsg("<b>", $this->createGenericWidgetHtml2($partner_id, $subp_id, $puser_id));
return;
}
if (in_array($partner_id, array(321, 449))) {
$widget_type = 60;
}
list($kshow, $entry, $error, $error_obj) = myKshowUtils::getKshowAndEntry($kshow_id, $entry_id);
if ($error_obj) {
$this->addError($error_obj);
return;
}
$kshow = kshowPeer::retrieveByPK($kshow_id);
if (!$kshow) {
$this->addMsg("<b>", "Error: no such {$kshow_id}");
return;
}
$this->addMsg("<b>", $this->createGenericWidgetHtml($partner_id, $subp_id, $kshow_id, $puser_id, $widget_type));
}
示例5: executeImpl
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;
}
$kshow_id = $this->getPM("kshow_id");
$kshow = kshowPeer::retrieveByPK($kshow_id);
// even in case of an error - return the kshow object
if (!$kshow) {
$this->addError(APIErrors::INVALID_KSHOW_ID, $kshow_id);
return;
} else {
$desired_version = $this->getPM("kshow_version");
$result = $kshow->rollbackVersion($desired_version);
if (!$result) {
$this->addError(APIErrors::ERROR_KSHOW_ROLLBACK, $kshow_id, $desired_version);
return;
}
}
// after calling this method - most probably the state of the kshow has changed in the cache
$wrapper = objectWrapperBase::getWrapperClass($kshow, objectWrapperBase::DETAIL_LEVEL_REGULAR);
$wrapper->removeFromCache("kshow", $kshow_id);
$this->addMsg("kshow", $wrapper);
}
示例6: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
$obj_type = $this->getPM("obj_type");
$obj_id = $this->getPM("obj_id");
$command = $this->getPM("command");
$value = $this->getP("value");
$extra_info = $this->getP("extra_info");
if ($obj_type == "entry") {
$entry = entryPeer::retrieveByPK($obj_id);
if ($command == "view") {
PartnerActivity::incrementActivity($partner_id, PartnerActivity::PARTNER_ACTIVITY_KDP, PartnerActivity::PARTNER_SUB_ACTIVITY_KDP_VIEWS);
myStatisticsMgr::incEntryViews($entry);
} elseif ($command == "play") {
PartnerActivity::incrementActivity($partner_id, PartnerActivity::PARTNER_ACTIVITY_KDP, PartnerActivity::PARTNER_SUB_ACTIVITY_KDP_PLAYS);
myStatisticsMgr::incEntryPlays($entry);
}
} elseif ($obj_type == "kshow") {
$kshow = kshowPeer::retrieveByPK($obj_id);
if ($command == "view") {
PartnerActivity::incrementActivity($partner_id, PartnerActivity::PARTNER_ACTIVITY_KDP, PartnerActivity::PARTNER_SUB_ACTIVITY_KDP_VIEWS);
myStatisticsMgr::incKshowViews($kshow);
} elseif ($command == "play") {
PartnerActivity::incrementActivity($partner_id, PartnerActivity::PARTNER_ACTIVITY_KDP, PartnerActivity::PARTNER_SUB_ACTIVITY_KDP_PLAYS);
myStatisticsMgr::incKshowPlays($kshow);
}
}
$this->addMsg("collectedStats", "{$obj_type}, {$obj_id}, {$command}, {$value}, {$extra_info}");
}
示例7: createWidgetFromWidget
/**
* If
*/
public static function createWidgetFromWidget($parent_widget_obj_or_id, $kshow_id, $entry_id = null, $ui_conf_id = null, $custom_data = null, $partner_data = null, $security_type = null)
{
if ($parent_widget_obj_or_id == null) {
throw new Exception("Cannot createWidget from empty object");
}
if ($parent_widget_obj_or_id instanceof widget) {
$source_widget = $parent_widget_obj_or_id;
} else {
// assume its an id
$source_widget = widgetPeer::retrieveByPK($parent_widget_obj_or_id);
if (!$source_widget) {
throw new Exception("Cannot createWidget from a none-existing widget [{$parent_widget_obj_or_id}]");
}
}
$kshow = null;
$widget_kshow_id = $source_widget->getKshowId();
if (!$widget_kshow_id) {
// fetch the kshow/entry according to the kshow_id/entry_id rules
list($kshow, $entry, $error, $error_obj) = myKshowUtils::getKshowAndEntry($kshow_id, $entry_id);
$widget_kshow_id = $kshow_id;
if ($source_widget->getEntryId()) {
$entry_id = $source_widget->getEntryId();
}
}
if (!$kshow) {
$kshow = kshowPeer::retrieveByPK($widget_kshow_id);
if (!$kshow) {
return null;
}
}
return self::createWidget($kshow, $entry_id, $source_widget, $ui_conf_id, $custom_data, $partner_data, $security_type);
}
示例8: execute
public function execute()
{
$this->getResponse()->setHttpHeader("Content-Type", "application/x-javascript");
$kshow_id = $this->getRequestParameter('kshow_id', 0);
$uid = kuser::ANONYMOUS_PUSER_ID;
$kshow = kshowPeer::retrieveByPK($kshow_id);
if (!$kshow) {
return sfView::ERROR;
}
// kshow_id might be a string (something like "15483str") but it will be returned using retriveByPK anyways
// lets make sure we pass just the id to the contribution wizard
$kshow_id = $kshow->getId();
$partner_id = $kshow->getPartnerId();
$partner = PartnerPeer::retrieveByPK($partner_id);
$subp_id = $kshow->getSubpId();
$partner_secret = $partner->getSecret();
$partner_name = $partner->getPartnerName();
$kaltura_services = new startsessionAction();
$kaltura_services->setInputParams(array("format" => kalturaWebserviceRenderer::RESPONSE_TYPE_PHP_ARRAY, "partner_id" => $partner_id, "subp_id" => $subp_id, "uid" => $uid, "secret" => $partner_secret));
$result = $kaltura_services->internalExecute();
$this->ks = @$result["result"]["ks"];
$this->widget_host = requestUtils::getHost();
$this->kshow_id = $kshow_id;
$this->uid = $uid;
$this->partner_id = $partner_id;
$this->subp_id = $subp_id;
$this->partner_name = $partner_name;
return sfView::SUCCESS;
}
示例9: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
$kshow_id = $this->getPM("kshow_id");
$detailed = $this->getP("detailed", false);
$kshow_indexedCustomData3 = $this->getP("indexedCustomData3");
$kshow = 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 = kshowPeer::retrieveByPK($kshow_id);
} elseif ($kshow_indexedCustomData3) {
$kshow = kshowPeer::retrieveByIndexedCustomData3($kshow_indexedCustomData3);
}
if (!$kshow) {
$this->addError(APIErrors::INVALID_KSHOW_ID, $kshow_id);
} else {
$level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
$wrapper = objectWrapperBase::getWrapperClass($kshow, $level);
// TODO - remove this code when cache works properly when saving objects (in their save method)
$wrapper->removeFromCache("kshow", $kshow_id);
$this->addMsg("kshow", $wrapper);
}
}
示例10: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
$kshow_id = $this->getP("kshow_id");
$detailed = $this->getP("detailed", false);
$level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR;
$widget_size = $this->getP("size");
$kshow_from_db = null;
if ($kshow_id) {
$kshow_from_db = kshowPeer::retrieveByPK($kshow_id);
}
if ($kshow_from_db) {
$this->addMsg("kshow", objectWrapperBase::getWrapperClass($kshow_from_db, $level));
$this->addMsg("already_exists_objects", 1);
$this->addDebug("already_exists_objects", 1);
} else {
// no kshow to be found - creae a new one
parent::executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser);
}
// create widget code for the new kshow
$kshow = $this->getMsg("kshow");
$kshow_id = $kshow->id;
list($genericWidget, $myspaceWidget) = myKshowUtils::getEmbedPlayerUrl($kshow_id, null, false, "");
$code = array("generic_code" => $genericWidget, "myspace_code" => $myspaceWidget);
$this->addMsg("widget_code", $code);
}
示例11: execute
public function execute()
{
$this->forceSystemAuthentication();
$kshow_id = @$_REQUEST["kshow_id"];
$this->kshow_id = $kshow_id;
$this->kshow = NULL;
$entry_id = @$_REQUEST["entry_id"];
$this->entry_id = $entry_id;
$this->entry = NULL;
$this->message = "";
if (!empty($kshow_id)) {
$this->kshow = kshowPeer::retrieveByPK($kshow_id);
if (!$this->kshow) {
$this->message = "Cannot find kshow [{$kshow_id}]";
} else {
$this->entry = $this->kshow->getShowEntry();
}
} elseif (!empty($kshow_id)) {
$this->entry = entryPeer::retrieveByPK($entry_id);
if (!$this->entry) {
$this->message = "Cannot find entry [{$entry_id}]";
} else {
$this->kshow = $this->{$this}->entry->getKshow();
}
}
if ($this->kshow) {
$this->metadata = $this->kshow->getMetadata();
} else {
$this->metadata = "";
}
$pending_str = $this->getP("pending");
$remove_pending = $this->getP("remove_pending");
if ($this->metadata && ($remove_pending || $pending_str)) {
if ($remove_pending) {
$pending_str = "";
}
$xml_doc = new DOMDocument();
$xml_doc->loadXML($this->metadata);
$metadata = kXml::getFirstElement($xml_doc, "MetaData");
$should_save = kXml::setChildElement($xml_doc, $metadata, "Pending", $pending_str, true);
if ($remove_pending) {
$should_save = kXml::setChildElement($xml_doc, $metadata, "LastPendingTimeStamp", "", true);
}
if ($should_save) {
$fixed_content = $xml_doc->saveXML();
$content_dir = myContentStorage::getFSContentRootPath();
$file_name = realpath($content_dir . $this->entry->getDataPath());
$res = file_put_contents($file_name, $fixed_content);
// sync - NOTOK
$this->metadata = $fixed_content;
}
}
$this->pending = $pending_str;
$this->kshow_id = $kshow_id;
$this->entry_id = $entry_id;
}
示例12: getKshowEntryId
public static function getKshowEntryId($kshow_id, $entry_id)
{
if ($entry_id == -1) {
$kshow = kshowPeer::retrieveByPK($kshow_id);
if ($kshow) {
$entry_id = $kshow->getShowEntryId();
}
}
return $entry_id;
}
示例13: executeImpl
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
{
$kshow_id_to_delete = $this->getPM("kshow_id");
$kshow_to_delete = kshowPeer::retrieveByPK($kshow_id_to_delete);
if (!$kshow_to_delete) {
$this->addError(APIErrors::INVALID_KSHOW_ID, $kshow_id_to_delete);
return;
}
$kshow_to_delete->delete();
myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_KSHOW_DELETE, $kshow_to_delete);
$this->addMsg("deleted_kshow", objectWrapperBase::getWrapperClass($kshow_to_delete, objectWrapperBase::DETAIL_LEVEL_REGULAR));
}
示例14: executeImpl
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());
}
}
示例15: execute
/**
* Will forward to the the thumbnail of the kshows using the widget id
*/
public function execute()
{
$widget_id = $this->getRequestParameter("wid");
$widget = widgetPeer::retrieveByPK($widget_id);
if (!$widget) {
die;
}
// because of the routing rule - the entry_id & kmedia_type WILL exist. be sure to ignore them if smaller than 0
$kshow_id = $widget->getKshowId();
if ($kshow_id) {
$kshow = kshowPeer::retrieveByPK($kshow_id);
if ($kshow->getShowEntry()) {
$this->redirect($kshow->getShowEntry()->getBigThumbnailUrl());
}
}
}