public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser) { $prefix = $this->getObjectPrefix(); $entry_id = $this->getPM("{$prefix}_id"); $detailed = $this->getP("detailed", false); $version = $this->getP("version", false); $c = $this->getCriteria(); if ($c == null) { $c = new Criteria(); $c->add(entryPeer::ID, $entry_id); $c->add(entryPeer::MODERATION_STATUS, entry::ENTRY_MODERATION_STATUS_REJECTED, Criteria::NOT_EQUAL); $entry = entryPeer::doSelectOne($c); } else { $c->add(entryPeer::ID, $entry_id); $c->add(entryPeer::MODERATION_STATUS, entry::ENTRY_MODERATION_STATUS_REJECTED, Criteria::NOT_EQUAL); $entry = entryPeer::doSelectOne($c); } if (!$entry) { $this->addError(APIErrors::INVALID_ENTRY_ID, $prefix, $entry_id); } else { if ($entry->getStatus() == entryStatus::IMPORT || $entry->getStatus() == entryStatus::PRECONVERT) { defPartnerservices2baseAction::disableCache(); } if ($version) { $entry->setDesiredVersion($version); } $extra_fields = $this->getExtraFields(); $level = $detailed ? objectWrapperBase::DETAIL_LEVEL_DETAILED : objectWrapperBase::DETAIL_LEVEL_REGULAR; if ($entry->getType() == entryType::MIX) { $extra_fields = array("allVersionsFormatted"); } if ($extra_fields) { $this->addMsg("{$prefix}", objectWrapperBase::getWrapperClass($entry, $level, -3, 0, $extra_fields)); } else { $this->addMsg("{$prefix}", objectWrapperBase::getWrapperClass($entry, $level)); } $this->addData($entry); } }
public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser) { $prefix = $this->getObjectPrefix(); $entry_id_to_delete = $this->getPM("{$prefix}_id"); $kshow_id_for_entry_id_to_delete = $this->getP("kshow_id"); $c = $this->getCriteria(); if ($c == null) { $entry_to_delete = entryPeer::retrieveByPK($entry_id_to_delete); } else { $entry_to_delete = entryPeer::doSelectOne($c); } if (!$entry_to_delete) { $this->addError(APIErrors::INVALID_ENTRY_ID, $prefix, $entry_id_to_delete); return; } if ($kshow_id_for_entry_id_to_delete != null) { // match the kshow_id if ($kshow_id_for_entry_id_to_delete != $entry_to_delete->getKshowId()) { $this->addError(APIErrors::CANNOT_DELETE_ENTRY, $entry_id_to_delete, $kshow_id_for_entry_id_to_delete); return; } } myEntryUtils::deleteEntry($entry_to_delete); /* All move into myEntryUtils::deleteEntry $entry_to_delete->setStatus ( entryStatus::DELETED ); // make sure the moderation_status is set to moderation::MODERATION_STATUS_DELETE $entry_to_delete->setModerationStatus ( moderation::MODERATION_STATUS_DELETE ); $entry_to_delete->setModifiedAt( time() ) ; $entry_to_delete->save(); myNotificationMgr::createNotification( kNotificationJobData::NOTIFICATION_TYPE_ENTRY_DELETE , $entry_to_delete ); */ $this->addMsg("deleted_" . $prefix, objectWrapperBase::getWrapperClass($entry_to_delete, objectWrapperBase::DETAIL_LEVEL_REGULAR)); }
public static function getFriendsMakover($subp_id, $puser_id) { $c = new Criteria(); $c->add(PuserRolePeer::SUBP_ID, $subp_id); $c->add(PuserRolePeer::PUSER_ID, $puser_id); $c->add(PuserRolePeer::ROLE, PuserRole::PUSER_ROLE_RECIPIENT); $puserRoles = PuserRolePeer::doSelectJoinkshow($c); if (!$puserRoles) { return array(0, null); } $kshow = $puserRoles[0]->getkshow(); $kshow_id = $kshow->getId(); // fetch the roughcut which is not the default roughcut $c = new Criteria(); $c->add(entryPeer::KSHOW_ID, $kshow_id); $c->add(entryPeer::TYPE, entryType::MIX); $c->add(entryPeer::ID, $kshow->getShowEntryId(), Criteria::NOT_EQUAL); $roughcut_entry = entryPeer::doSelectOne($c); return array($kshow_id, $roughcut_entry); }
/** * Get web playable Flavor Assets for Entry * * @action getWebPlayableByEntryId * @param string $entryId * @return KalturaFlavorAssetArray */ public function getWebPlayableByEntryIdAction($entryId) { // entry could be "display_in_search = 2" - in that case we want to pull it although KN is off in services.ct for this action $c = new Criteria(); $c->addAnd(entryPeer::ID, $entryId); $criterionPartnerOrKn = $c->getNewCriterion(entryPeer::PARTNER_ID, $this->getPartnerId()); $criterionPartnerOrKn->addOr($c->getNewCriterion(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK)); $c->addAnd($criterionPartnerOrKn); // there could only be one entry because the query is by primary key. // so using doSelectOne is safe. $dbEntry = entryPeer::doSelectOne($c); if (!$dbEntry) { throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId); } // if the entry does not belong to the partner but "display_in_search = 2" // we want to turn off the criteria over the flavorAssetPeer if ($dbEntry->getPartnerId() != $this->getPartnerId() && $dbEntry->getDisplayInSearch() == mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK) { flavorAssetPeer::setDefaultCriteriaFilter(null); } $flavorAssetsDb = flavorAssetPeer::retrieveReadyWebByEntryId($entryId); if (count($flavorAssetsDb) == 0) { throw new KalturaAPIException(KalturaErrors::NO_FLAVORS_FOUND); } // re-set default criteria to avoid fetching "private" flavors in laetr queries. // this should be also set in baseService, but we better do it anyway. flavorAssetPeer::setDefaultCriteriaFilter(); $flavorAssets = KalturaFlavorAssetArray::fromDbArray($flavorAssetsDb); return $flavorAssets; }
/** * Get web playable Flavor Assets for Entry * * @action getWebPlayableByEntryId * @param string $entryId * @return KalturaFlavorAssetArray * * @deprecated use baseEntry.getContextData instead */ public function getWebPlayableByEntryIdAction($entryId) { // entry could be "display_in_search = 2" - in that case we want to pull it although KN is off in services.ct for this action $c = KalturaCriteria::create(entryPeer::OM_CLASS); $c->addAnd(entryPeer::ID, $entryId); $criterionPartnerOrKn = $c->getNewCriterion(entryPeer::PARTNER_ID, $this->getPartnerId()); $criterionPartnerOrKn->addOr($c->getNewCriterion(entryPeer::DISPLAY_IN_SEARCH, mySearchUtils::DISPLAY_IN_SEARCH_KALTURA_NETWORK)); $c->addAnd($criterionPartnerOrKn); // there could only be one entry because the query is by primary key. // so using doSelectOne is safe. $dbEntry = entryPeer::doSelectOne($c); if (!$dbEntry) { throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId); } $flavorAssetsDb = assetPeer::retrieveReadyWebByEntryId($entryId); if (count($flavorAssetsDb) == 0) { throw new KalturaAPIException(KalturaErrors::NO_FLAVORS_FOUND); } $flavorAssets = KalturaFlavorAssetArray::fromDbArray($flavorAssetsDb, $this->getResponseProfile()); return $flavorAssets; }