public function executeImpl(kshow $kshow, entry &$entry)
 {
     $genericWidget = "";
     $myspaceWidget = "";
     $kshow_id = $kshow->getId();
     $entry_id = $entry->getId();
     if (!$kshow->getPartnerId() && !$this->forceViewPermissions($kshow, $kshow_id, false, false)) {
         die;
     }
     $this->kshow_category = $kshow->getTypeText();
     $this->kshow_description = $kshow->getDescription();
     $this->kshow_name = $kshow->getName();
     $this->kshow_tags = $kshow->getTags();
     $kdata = @$_REQUEST["kdata"];
     if ($kdata == "null") {
         $kdata = "";
     }
     $this->widget_type = @$_REQUEST["widget_type"];
     list($genericWidget, $myspaceWidget) = myKshowUtils::getEmbedPlayerUrl($kshow_id, $entry_id, false, $kdata);
     if ($entry_id == 1002) {
         $this->share_url = requestUtils::getHost() . "/index.php/corp/kalturaPromo";
     } else {
         if ($kdata) {
             $this->share_url = myKshowUtils::getWidgetCmdUrl($kdata, "share");
         } else {
             $this->share_url = myKshowUtils::getUrl($kshow_id) . "&entry_id={$entry_id}";
         }
     }
     //list($status, $kmediaType, $kmediaData) = myContentRender::createPlayerMedia($entry); // myContentRender class removed, old code
     $status = $entry->getStatus();
     $kmediaType = $entry->getMediaType();
     $kmediaData = "";
     $this->message = $kmediaType == entry::ENTRY_MEDIA_TYPE_TEXT ? $kmediaData : "";
     $this->generic_embed_code = $genericWidget;
     $this->myspace_embed_code = $myspaceWidget;
     $this->thumbnail = $entry ? $entry->getBigThumbnailPath(true) : "";
     $this->kuser = $entry->getKuser();
     $this->entry = $entry;
 }
示例#2
0
 /**
  * Declares an association between this object and a kshow object.
  *
  * @param      kshow $v
  * @return     KshowKuser The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setkshow(kshow $v = null)
 {
     if ($v === null) {
         $this->setKshowId(NULL);
     } else {
         $this->setKshowId($v->getId());
     }
     $this->akshow = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the kshow object, it will not be re-added.
     if ($v !== null) {
         $v->addKshowKuser($this);
     }
     return $this;
 }
 public static function shalowClone(kshow $source_kshow, $new_prodcuer_id)
 {
     $target_kshow = $source_kshow->copy();
     $target_kshow->setProducerId($new_prodcuer_id);
     $target_kshow->save();
     self::resetKshowStats($target_kshow, true);
     if (!$source_kshow->getEpisodeId()) {
         $target_kshow->setEpisodeId($source_kshow->getId());
     }
     //$target_kshow->setHasRoughcut($source_kshow->getHasRoughcut());
     $target_show_entry = $target_kshow->createEntry(entry::ENTRY_MEDIA_TYPE_SHOW, $new_prodcuer_id);
     $content = myContentStorage::getFSContentRootPath();
     $source_thumbnail_path = $source_kshow->getThumbnailPath();
     $target_kshow->setThumbnail(null);
     $target_kshow->setThumbnail($source_kshow->getThumbnail());
     $target_thumbnail_path = $target_kshow->getThumbnailPath();
     //		myContentStorage::moveFile( $content . $source_thumbnail_path , $content . $target_thumbnail_path , false , true );
     $target_kshow->save();
     // copy the show_entry file content
     $source_show_entry = entryPeer::retrieveByPK($source_kshow->getShowEntryId());
     $source_show_entry_data_key = $source_show_entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
     $target_show_entry->setData(null);
     $target_show_entry->setData($source_show_entry->getData());
     $target_show_entry_data_key = $target_show_entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
     $target_show_entry->setName($source_show_entry->getName());
     $target_show_entry->setLengthInMsecs($source_show_entry->getLengthInMsecs());
     kFileSyncUtils::softCopy($source_show_entry_data_key, $target_show_entry_data_key);
     //myContentStorage::moveFile( $content . $source_show_entry_path , $content . $target_show_entry_path , false , true );
     myEntryUtils::createThumbnail($target_show_entry, $source_show_entry, true);
     //		$target_kshow->setHasRoughcut(true);
     //		$target_kshow->save();
     $target_show_entry->save();
     return $target_kshow;
 }
示例#4
0
 public static function incKshowPlays(kshow $kshow, $delta = 1)
 {
     $v = $kshow->getPlays();
     KalturaLog::log(__METHOD__ . ": " . $kshow->getId() . " plays: {$v}");
     if (self::shouldModify($kshow, kshowPeer::PLAYS)) {
     }
     self::inc($v, $delta);
     $kshow->setPlays($v);
     KalturaLog::log(__METHOD__ . ": " . $kshow->getId() . " plays: {$v}");
     return $v;
 }
示例#5
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      kshow $value A kshow object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(kshow $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         if (isset(self::$instances[$key]) || count(self::$instances) < kConf::get('max_num_instances_in_pool')) {
             self::$instances[$key] = $obj;
             kMemoryManager::registerPeer('kshowPeer');
         }
     }
 }
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      kshow $value A kshow object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(kshow $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
 /**
  * Executes addComment action, which returns a form enabling the insertion of a comment
  * The request may include 1 fields: entry id.
  */
 protected function executeImpl(kshow $kshow, entry &$entry)
 {
     $kshow_id = $kshow->getId();
     if ($this->partner_id != null) {
         // this part overhere should be in a more generic place - part of the services
         $multiple_roghcuts = Partner::allowMultipleRoughcuts($this->partner_id);
         $likuser_id = $this->getLoggedInUserId();
     } else {
         // 	is the logged-in-user is not an admin or the producer - check if show can be published
         $likuser_id = $this->getLoggedInUserId();
         $multiple_roghcuts = true;
     }
     if (!$likuser_id) {
         return $this->securityViolation($kshow->getId());
     }
     $isIntro = $kshow->getIntroId() == $entry->getId();
     if ($multiple_roghcuts) {
         // create a new entry in two cases:
         // 1. the user saving the roughcut isnt the owner of the entry
         // 2. the entry is an intro and the current entry is not show (probably an image or video)
         if ($entry->getKuserId() != $likuser_id || $isIntro && $entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_SHOW) {
             // TODO: add security check to whether multiple roughcuts are allowed
             // create a new roughcut entry by cloning the original entry
             $entry = myEntryUtils::deepClone($entry, $kshow_id, false);
             $entry->setKuserId($likuser_id);
             $entry->setCreatorKuserId($likuser_id);
             $entry->setCreatedAt(time());
             $entry->setMediaType(entry::ENTRY_MEDIA_TYPE_SHOW);
             $entry->save();
         }
     }
     /*
     		$viewer_type = myKshowUtils::getViewerType($kshow, $likuser_id);
     		if ( $viewer_type != KshowKuser::KSHOWKUSER_VIEWER_PRODUCER && ( ! $kshow->getCanPublish() ) ) 
     		{
     			// ERROR - attempting to publish a non-publishable show
     			return $this->securityViolation( $kshow->getId() );
     		}
     */
     $this->xml_content = "<xml><EntryID>" . $entry->getId() . "</EntryID></xml>";
     if ($isIntro) {
         $kshow->setIntroId($entry->getId());
     } else {
         $kshow->setShowEntryId($entry->getId());
         $has_roughcut = @$_REQUEST["HasRoughCut"];
         if ($has_roughcut === "0") {
             $kshow->setHasRoughcut(false);
             $kshow->save();
             return;
         }
     }
     $content = @$_REQUEST["xml"];
     $update_kshow = false;
     if ($content != NULL) {
         list($xml_content, $this->comments, $update_kshow) = myMetadataUtils::setMetadata($content, $kshow, $entry);
         // Send an email alert to producer
         if ($kshow->getProducerId() != $likuser_id) {
             // don't send producer alerts when the producer is the editor
             alertPeer::sendEmailIfNeeded($kshow->getProducerId(), alert::KALTURAS_PRODUCED_ALERT_TYPE_ROUGHCUT_CREATED, array('screenname' => $this->getUser()->getAttribute('screenname'), 'kshow_name' => $kshow->getName(), 'kshow_id' => $kshow->getId()));
         }
         // TODO:  efficiency: see if there is a wa to search for contributors based on some other method than full entry table scan
         // Send email alerts to contributors
         $c = new Criteria();
         $c->add(entryPeer::KSHOW_ID, $kshow_id);
         $c->add(entryPeer::KUSER_ID, $likuser_id, Criteria::NOT_EQUAL);
         // the current user knows they just edited
         $c->addAnd(entryPeer::KUSER_ID, $kshow->getProducerId(), Criteria::NOT_EQUAL);
         // the producer knows they just edited
         $c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
         $c->addGroupByColumn(entryPeer::KUSER_ID);
         $entries = entryPeer::doSelect($c);
         $already_received_alert_array = array();
         foreach ($entries as $entry) {
             alertPeer::sendEmailIfNeeded($entry->getKuserId(), alert::KALTURAS_PARTOF_ALERT_TYPE_ROUGHCUT_CREATED, array('screenname' => $this->getUser()->getAttribute('screenname'), 'kshow_name' => $kshow->getName(), 'kshow_id' => $kshow->getId()));
             $already_received_alert_array[$entry->getKuserId()] = true;
         }
         // send email alert to subscribers
         $c = new Criteria();
         $c->add(KshowKuserPeer::KSHOW_ID, $kshow_id);
         //only subsribers of this show
         $c->add(KshowKuserPeer::KUSER_ID, $likuser_id, Criteria::NOT_EQUAL);
         // the current user knows they just edited
         $c->add(KshowKuserPeer::SUBSCRIPTION_TYPE, KshowKuser::KSHOW_SUBSCRIPTION_NORMAL);
         // this table stores other relations too
         $subscriptions = KshowKuserPeer::doSelect($c);
         foreach ($subscriptions as $subscription) {
             if (!isset($already_received_alert_array[$subscription->getKuserId()])) {
                 // don't send emails to subscribed users who are also contributors
                 alertPeer::sendEmailIfNeeded($subscription->getKuserId(), alert::KALTURAS_SUBSCRIBEDTO_ALERT_TYPE_ROUGHCUT_CREATED, array('screenname' => $this->getUser()->getAttribute('screenname'), 'kshow_name' => $kshow->getName(), 'kshow_id' => $kshow->getId()));
             }
         }
         if ($this->debug) {
             return "text/html; charset=utf-8";
         }
     } else {
         $this->comments = "";
         // if there is no xml - receive it from the user
         $this->debug = true;
         $file_name = myContentStorage::getFSContentRootPath() . "/" . $entry->getDataPath();
         //$this->xml_content = kFile::getFileContent( $file_name );
         return "text/html; charset=utf-8";
     }
 }