protected function executeImpl(kshow $kshow)
 {
     $asset_type = $this->getRequestParameter("type", entry::ENTRY_MEDIA_TYPE_VIDEO);
     if ($asset_type > entry::ENTRY_MEDIA_TYPE_AUDIO || $asset_type < entry::ENTRY_MEDIA_TYPE_VIDEO) {
         // TODO -
         // trying to fetch invalid media type
     }
     $show_entry_id = $kshow->getShowEntryId();
     $intro_id = $kshow->getIntroId();
     $c = new Criteria();
     $c->add(entryPeer::KUSER_ID, kuser::KUSER_KALTURA);
     $c->add(entryPeer::TYPE, kuser::KUSER_KALTURA);
     $this->entry_list = entryPeer::doSelect($c);
     if ($this->entry_list == NULL) {
         $this->entry_list = array();
     }
 }
예제 #2
0
 protected function executeImpl(kshow $kshow, entry &$entry)
 {
     if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_SHOW) {
         $this->show_versions = array_reverse($entry->getAllversions());
     } else {
         $this->show_versions = array();
     }
     $this->producer = kuser::getKuserById($kshow->getProducerId());
     $this->editor = $entry->getKuser();
     $this->thumbnail = $entry ? $entry->getThumbnailPath() : "";
     // is the logged-in-user is an admin or the producer or the show can always be published...
     $likuser_id = $this->getLoggedInUserId();
     $viewer_type = myKshowUtils::getViewerType($kshow, $likuser_id);
     $this->entry = $entry ? $entry : new entry();
     // create a dummy entry for the GUI
     $this->can_publish = $viewer_type == KshowKuser::KSHOWKUSER_VIEWER_PRODUCER || $kshow->getCanPublish();
 }
예제 #3
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);
     }
 }
예제 #4
0
 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;
 }
 /**
  * Executes index action
  */
 protected function executeImpl(kshow $kshow)
 {
     $this->xml_content = "";
     $kshow_id = $this->kshow_id;
     if ($kshow_id == NULL || $kshow_id == 0) {
         return sfView::SUCCESS;
     }
     $metadata_creator = new myKshowMetadataCreator();
     $this->show_metadata = $metadata_creator->createMetadata($kshow_id);
     //		$kshow = kshowPeer:retrieveByPK( $kshow_id );
     $entry = entryPeer::retrieveByPK($kshow->getShowEntryId());
     // TODO - this should never happen
     if ($entry == NULL) {
         // there is no show entry for this show !
         $entry = $kshow->createEntry(entry::ENTRY_MEDIA_TYPE_SHOW, $kshow->getProducerId());
     }
     $content_path = myContentStorage::getFSContentRootPath();
     $file_path = $content_path . $entry->getDataPath();
     // check to see if the content of the file changed
     $current_metadata = kFile::getFileContent($file_path);
     $comp_result = strcmp($this->show_metadata, $current_metadata);
     if ($comp_result != 0) {
         $ext = pathinfo($file_path, PATHINFO_EXTENSION);
         if ($ext != "xml") {
             // this is for the first time - override the template path by setting the data to NULL
             $entry->setData(NULL);
             $file_path = pathinfo($file_path, PATHINFO_DIRNAME) . "/" . kFile::getFileNameNoExtension($file_path) . ".xml";
         }
         // this will increment the name if needed
         $entry->setData($file_path);
         $file_path = $content_path . $entry->getDataPath();
         $entry->save();
         kFile::fullMkdir($file_path);
         kFile::setFileContent($file_path, $this->show_metadata);
         $this->xml_content = $this->show_metadata;
     }
 }
예제 #6
0
 public static function incKshowUpdates(kshow $kshow, $delta = 1)
 {
     $v = $kshow->getNumberOfUpdates();
     if (self::shouldModify($kshow, kshowPeer::NUMBER_OF_UPDATES)) {
         self::inc($v, $delta);
         $kshow->setNumberOfUpdates($v);
     }
     return $v;
 }
예제 #7
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;
 }
예제 #9
0
파일: kshow.php 프로젝트: DBezemer/server
 public static function create($partner_id, $subp_id, $producer_id, $kshow_type)
 {
     $kshow = new kshow();
     $kshow->setPartnerId($partner_id);
     $kshow->setSubpId($subp_id);
     $kshow->setProducerId($producer_id);
     $kshow->setType($kshow_type);
     // will make sure the intro will have a good default
     $kshow->save();
     // to create a new kshow in the DB and use its ID for the entries creation
     $kshow->createEntry(entry::ENTRY_MEDIA_TYPE_SHOW, $producer_id);
     // roughcut
     $kshow->createEntry(entry::ENTRY_MEDIA_TYPE_VIDEO, $producer_id);
     // intro
     $kshow->save();
     // to finally save
     return $kshow;
 }
예제 #10
0
 protected function createDummyKShow()
 {
     $kshow = new kshow();
     $kshow->setName(kshow::DUMMY_KSHOW_NAME);
     $kshow->setProducerId($this->getKuser()->getId());
     $kshow->setPartnerId($this->getPartnerId());
     $kshow->setSubpId($this->getPartnerId() * 100);
     $kshow->setViewPermissions(kshow::KSHOW_PERMISSION_EVERYONE);
     $kshow->setPermissions(kshow::PERMISSIONS_PUBLIC);
     $kshow->setAllowQuickEdit(true);
     $kshow->save();
     return $kshow;
 }
 /**
 	return array('status' => $status, 'message' => $message, 'objects' => $objects);
 		objects - array of
 				'thumb' 
 				'title'  
 				'description' 
 				'id' - unique id to be passed to getMediaInfo 
 
 	this service will first return the relevant kshows, then find the relevant roughcuts and finally fetch the entries
 */
 public function searchMedia($media_type, $searchText, $page, $pageSize, $authData = null, $extraData = null)
 {
     myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2;
     // this bellow will bypass the partner filter - at the end of the code the filter will return to be as was before
     $kshow_criteria = kshowPeer::getCriteriaFilter()->getFilter();
     $original_kshow_partner_to_filter = $kshow_criteria->get(kshowPeer::PARTNER_ID);
     $kshow_criteria->remove(kshowPeer::PARTNER_ID);
     $entry_criteria = entryPeer::getCriteriaFilter()->getFilter();
     $original_entry_partner_to_filter = $entry_criteria->get(entryPeer::PARTNER_ID);
     $entry_criteria->remove(entryPeer::PARTNER_ID);
     $page_size = $pageSize > self::MAX_PAGE_SIZE ? self::MAX_PAGE_SIZE : $pageSize;
     $status = "ok";
     $message = '';
     $kshow_filter = $this->getKshowFilter($extraData);
     $limit = $pageSize;
     $offset = $pageSize * ($page - 1);
     // $page starts from 1
     //		$keywords_array = mySearchUtils::getKeywordsFromStr ( $searchText );
     // TODO_ change mechanism !
     //$search_mechanism = self::KALTURA_SERVICE_CRITERIA_FROM_KSHOW;
     $search_mechanism = self::KALTURA_SERVICE_CRITERIA_FROM_ROUGHCUT;
     // TODO - optimize the first part of the entry_id search
     // cache once we know the kshow_ids / roughcuts - this will make paginating much faster
     $kshow_crit = new Criteria();
     $kshow_crit->clearSelectColumns()->clearOrderByColumns();
     $kshow_crit->addSelectColumn(kshowPeer::ID);
     $kshow_crit->addSelectColumn(kshowPeer::SHOW_ENTRY_ID);
     $kshow_crit->setLimit(self::$s_default_count_limit);
     $kshow_filter->addSearchMatchToCriteria($kshow_crit, $searchText, kshow::getSearchableColumnName());
     if ($search_mechanism == self::KALTURA_SERVICE_CRITERIA_FROM_KSHOW) {
         $kshow_crit->add(kshowPeer::ENTRIES, 1, criteria::GREATER_EQUAL);
     }
     $rs = kshowPeer::doSelectStmt($kshow_crit);
     $kshow_arr = array();
     $roughcut_arr = array();
     $res = $rs->fetchAll();
     foreach ($res as $record) {
         $kshow_arr[] = $record[0];
         $roughcut_arr[] = $record[1];
     }
     //		// old code from doSelectRs
     //		while($rs->next())
     //		{
     //			$kshow_arr[] = $rs->getString(1);
     //			$roughcut_arr[] = $rs->getString(2);
     //		}
     $crit = new Criteria();
     $crit->setOffset($offset);
     $crit->setLimit($limit);
     $crit->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
     $crit->add(entryPeer::MEDIA_TYPE, $media_type);
     if ($search_mechanism == self::KALTURA_SERVICE_CRITERIA_FROM_KSHOW) {
         $crit->add(entryPeer::KSHOW_ID, $kshow_arr, Criteria::IN);
         $entry_results = entryPeer::doSelect($crit);
     } elseif ($search_mechanism == self::KALTURA_SERVICE_CRITERIA_FROM_ROUGHCUT) {
         //			$entry_results  = roughcutEntryPeer::retrievByRoughcutIds ( $crit , $roughcut_arr , true );
         $entry_results = roughcutEntryPeer::retrievEntriesByRoughcutIds($crit, $roughcut_arr);
     }
     // after the query - return the filter to what it was before
     $entry_criteria->addAnd(entryPeer::PARTNER_ID, $original_entry_partner_to_filter);
     $kshow_criteria->addAnd(kshowPeer::PARTNER_ID, $original_kshow_partner_to_filter);
     $objects = array();
     // add thumbs when not image or video
     $should_add_thumbs = $media_type != entry::ENTRY_MEDIA_TYPE_AUDIO;
     foreach ($entry_results as $obj) {
         if ($search_mechanism == self::KALTURA_SERVICE_CRITERIA_FROM_KSHOW) {
             $entry = $obj;
         } else {
             //$entry = $obj->getEntry();
             $entry = $obj;
         }
         /* @var $entry entry */
         // use the id as the url - it will help using this entry id in addentry
         $object = array("id" => $entry->getId(), "url" => $entry->getDataUrl(), "tags" => $entry->getTags(), "title" => $entry->getName(), "description" => $entry->getTags(), "flash_playback_type" => $entry->getMediaTypeName());
         if ($should_add_thumbs) {
             $object["thumb"] = $entry->getThumbnailUrl();
         }
         $objects[] = $object;
     }
     return array('status' => $status, 'message' => $message, 'objects' => $objects, "needMediaInfo" => self::$NEED_MEDIA_INFO);
 }
예제 #12
0
			<span class="btn next" id="prod_nextStyle">Next Style <span class="xaquo">&raquo;</span></span>
			<span class="btn pre" id="prod_prevStyle"><span class="xaquo">&laquo;</span> Previous Style</span>
		</div><!-- end centred-->
	</div>
</div>

<div class="cont2 customize1 color_scheme" id="_prodWizPageColorScheme" noNextButton="true">
	<div class="top2_hint">
		<div class="top2 customize1 color_scheme">
			<h1>Select a color scheme</h1>
		</div>
	</div>
	<div class="container">
		<ul class="choose_scheme clearfix">
			<?php 
$colorSchemes = kshow::getColorSchemes();
foreach ($colorSchemes as $colorScheme) {
    echo '<li><div style="background-color:' . $colorScheme[0] . '"><div style="background-color:' . $colorScheme[2] . '; color:' . $colorScheme[1] . ';">a</div></div></li>';
}
?>
		</ul><!-- end chose_scheme-->
		<button class="btn2" id="prod_colorSchemePreview">Preview</button>
	</div>
</div>

<div class="cont2 customize1 set_bg" id="_prodWizPagePositionBG" noNextButton="true">
	<div class="top2_hint">
		<div class="top2 customize1 set_bg">
			<h1>Select where to position the background image</h1>
		</div>
	</div>
 public function getSearchableColumnName()
 {
     return kshow::getSearchableColumnName();
 }
 /**
  * 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";
     }
 }
예제 #15
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;
     }
 }
예제 #17
0
 protected function executeImpl(kshow $kshow, entry &$entry)
 {
     $list_type = $this->getP("list_type", self::LIST_TYPE_ALL);
     $kshow_entry_list = array();
     $kuser_entry_list = array();
     if ($list_type & self::LIST_TYPE_KSHOW) {
         $c = new Criteria();
         $c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
         $c->add(entryPeer::MEDIA_TYPE, entry::ENTRY_MEDIA_TYPE_SHOW, Criteria::NOT_EQUAL);
         $c->add(entryPeer::KSHOW_ID, $this->kshow_id);
         $kshow_entry_list = entryPeer::doSelectJoinkuser($c);
     }
     if ($list_type & self::LIST_TYPE_KUSER) {
         $c = new Criteria();
         $c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
         $c->add(entryPeer::MEDIA_TYPE, entry::ENTRY_MEDIA_TYPE_SHOW, Criteria::NOT_EQUAL);
         $c->add(entryPeer::KUSER_ID, $this->getLoggedInUserIds(), Criteria::IN);
         $kuser_entry_list = entryPeer::doSelectJoinkuser($c);
     }
     if ($list_type & self::LIST_TYPE_EPISODE) {
         if ($kshow->getEpisodeId()) {
             // episode_id will point to the "parent" kshow
             // fetch the entries of the parent kshow
             $c = new Criteria();
             $c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
             $c->add(entryPeer::MEDIA_TYPE, entry::ENTRY_MEDIA_TYPE_SHOW, Criteria::NOT_EQUAL);
             $c->add(entryPeer::KSHOW_ID, $kshow->getEpisodeId());
             $parent_kshow_entries = entryPeer::doSelectJoinkuser($c);
             if (count($parent_kshow_entries)) {
                 $kshow_entry_list = kArray::append($kshow_entry_list, $parent_kshow_entries);
             }
         }
     }
     // fetch all entries that were used in the roughcut - those of other kusers
     // - appeared under kuser_entry_list when someone else logged in
     if ($list_type & self::LIST_TYPE_ROUGHCUT) {
         if ($kshow->getHasRoughcut()) {
             $roughcut_file_name = $entry->getDataPath();
             $entry_ids_from_roughcut = myFlvStreamer::getAllAssetsIds($roughcut_file_name);
             $final_id_list = array();
             foreach ($entry_ids_from_roughcut as $id) {
                 $found = false;
                 foreach ($kshow_entry_list as $entry) {
                     if ($entry->getId() == $id) {
                         $found = true;
                         break;
                     }
                 }
                 if (!$found) {
                     $final_id_list[] = $id;
                 }
             }
             $c = new Criteria();
             $c->add(entryPeer::ID, $final_id_list, Criteria::IN);
             $extra_entries = entryPeer::doSelectJoinkuser($c);
             // merge the 2 lists into 1:
             $kshow_entry_list = kArray::append($kshow_entry_list, $extra_entries);
         }
     }
     $this->kshow_entry_list = $kshow_entry_list;
     $this->kuser_entry_list = $kuser_entry_list;
 }