当前位置: 首页>>代码示例>>PHP>>正文


PHP entryPeer::getCriteriaFilter方法代码示例

本文整理汇总了PHP中entryPeer::getCriteriaFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP entryPeer::getCriteriaFilter方法的具体用法?PHP entryPeer::getCriteriaFilter怎么用?PHP entryPeer::getCriteriaFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在entryPeer的用法示例。


在下文中一共展示了entryPeer::getCriteriaFilter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute()
 {
     // keywords & page
     // keywords
     //		$keywords = $this->request->getRequestParameter ( "keywords" , "" );
     // page
     //		$page = $this->request->getRequestParameter ( "page" , "1" );
     $partner_id = $this->getP("partner_id", null);
     if (false && $partner_id) {
         $criteria_filter = entryPeer::getCriteriaFilter();
         $criteria = $criteria_filter->getFilter();
         $criteria->addAnd(entryPeer::PARTNER_ID, "(" . entryPeer::PARTNER_ID . "<100 OR " . entryPeer::PARTNER_ID . "={$partner_id} )", Criteria::CUSTOM);
         entryPeer::enable();
     }
     $page_size = 20;
     $entry_filter = new entryFilter();
     $entry_pager = new mySmartPager($this, "entry", $page_size);
     $act = new AJAX_getEntriesAction();
     $act->setIdList(NULL);
     $act->setSortAlias("ids");
     $act->setPublicOnly(true);
     $act->skip_count = false;
     $this->entry_results = $act->fetchPage($this, $entry_filter, $entry_pager);
     $this->getResponse()->setHttpHeader("Content-Type", "text/xml; charset=utf-8");
     $this->number_of_results = $entry_pager->getNumberOfResults();
     $this->number_of_pages = $entry_pager->getNumberOfPages();
 }
开发者ID:DBezemer,项目名称:server,代码行数:27,代码来源:searchEntriesAction.class.php

示例2: executeImpl

 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $entry_id = $this->getP("entry_id");
     $kshow_id = $this->getP("kshow_id");
     $show_entry_id = $this->getP("show_entry_id");
     // Make sure the request is for a ready roughcut
     $c = entryPeer::getCriteriaFilter()->getFilter();
     $c->addAnd(entryPeer::STATUS, entryStatus::READY, Criteria::EQUAL);
     list($kshow, $show_entry, $error, $error_obj) = myKshowUtils::getKshowAndEntry($kshow_id, $show_entry_id);
     if ($error_obj) {
         $this->addError($error_obj);
         return;
     }
     $entry = entryPeer::retrieveByPK($entry_id);
     if (!$entry) {
         $this->addError(APIErrors::INVALID_ENTRY_ID, "entry", $entry_id);
         return;
     }
     $metadata = $kshow->getMetadata();
     $relevant_kshow_version = 1 + $kshow->getVersion();
     // the next metadata will be the first relevant version for this new entry
     $version_info = array();
     $version_info["KuserId"] = $puser_kuser->getKuserId();
     $version_info["PuserId"] = $puser_id;
     $version_info["ScreenName"] = $puser_kuser->getPuserName();
     $new_metadata = myMetadataUtils::addEntryToMetadata($metadata, $entry, $relevant_kshow_version, $version_info);
     $entry_modified = true;
     if ($new_metadata) {
         // TODO - add thumbnail only for entries that are worthy - check they are not moderated !
         $thumb_modified = myKshowUtils::updateThumbnail($kshow, $entry, false);
         if ($thumb_modified) {
             $new_metadata = myMetadataUtils::updateThumbUrlFromMetadata($new_metadata, $entry->getThumbnailUrl());
         }
         // it is very important to increment the version count because even if the entry is deferred
         // it will be added on the next version
         if (!$kshow->getHasRoughcut()) {
             // make sure the kshow now does have a roughcut
             $kshow->setHasRoughcut(true);
             $kshow->save();
         }
         $kshow->setMetadata($new_metadata, true);
     }
     $this->addMsg("entry", objectWrapperBase::getWrapperClass($entry, objectWrapperBase::DETAIL_LEVEL_REGULAR));
     $this->addMsg("kshow", objectWrapperBase::getWrapperClass($kshow, objectWrapperBase::DETAIL_LEVEL_REGULAR));
     $this->addMsg("metadata", $new_metadata);
 }
开发者ID:DBezemer,项目名称:server,代码行数:46,代码来源:appendentrytoroughcutAction.class.php

示例3: executeImpl

 public function executeImpl($partner_id, $subp_id, $puser_id, $partner_prefix, $puser_kuser)
 {
     $entry_id = $this->getP("entry_id");
     $kshow_id = $this->getP("kshow_id");
     // Make sure the request is for a ready roughcut
     $c = entryPeer::getCriteriaFilter()->getFilter();
     $c->addAnd(entryPeer::STATUS, entryStatus::READY, Criteria::EQUAL);
     list($kshow, $entry, $error, $error_obj) = myKshowUtils::getKshowAndEntry($kshow_id, $entry_id);
     if ($error_obj) {
         $this->addError($error_obj);
         return;
     }
     $version = $this->getP("version");
     // it's a path on the disk
     if (kString::beginsWith($version, ".")) {
         // someone is trying to hack in the system
         return sfView::ERROR;
     } elseif ($version == "-1") {
         $version = null;
     }
     // in case we're making a roughcut out of a regular invite, we start from scratch
     $entry_data_path = kFileSyncUtils::getLocalFilePathForKey($entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA, $version));
     //replaced__getDataPath
     if ($entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_SHOW || $entry_data_path === null) {
         $this->xml_content = "<xml></xml>";
         return;
     }
     $sync_key = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA, $version);
     $file_name = kFileSyncUtils::getReadyLocalFilePathForKey($sync_key, false);
     // fetch content of file from disk - it should hold the XML
     if (kString::endsWith($file_name, "xml")) {
         $xml_content = kFileSyncUtils::file_get_contents($sync_key, false, false);
         if (!$xml_content) {
             $xml_content = "<xml></xml>";
         }
         myMetadataUtils::updateEntryForPending($entry, $version, $xml_content);
         $this->addMsg("metadata", $xml_content);
     } else {
         $this->addError(APIErrors::INVALID_FILE_NAME, $file_name);
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:41,代码来源:getmetadataAction.class.php

示例4: getEntryMrssDoc

 public function getEntryMrssDoc(EntryDistribution $entryDistribution)
 {
     $entry = entryPeer::retrieveByPK($entryDistribution->getEntryId());
     // set the default criteria to use the current entry distribution partner id (it is restored later)
     // this is needed for related entries under kMetadataMrssManager which is using retrieveByPK without the correct partner id filter
     $oldEntryCriteria = entryPeer::getCriteriaFilter()->getFilter();
     entryPeer::setDefaultCriteriaFilter();
     entryPeer::addPartnerToCriteria($this->getPartnerId(), true);
     try {
         $mrss = null;
         $mrssParams = new kMrssParameters();
         if ($this->getItemXpathsToExtend()) {
             $mrssParams->setItemXpathsToExtend($this->getItemXpathsToExtend());
         }
         $mrss = kMrssManager::getEntryMrssXml($entry, $mrss, $mrssParams);
         $mrssStr = $mrss->asXML();
     } catch (Exception $e) {
         // restore the original criteria so it will not get stuck due to the exception
         entryPeer::getCriteriaFilter()->setFilter($oldEntryCriteria);
         throw $e;
     }
     // restore the original criteria
     entryPeer::getCriteriaFilter()->setFilter($oldEntryCriteria);
     $mrssObj = new DOMDocument();
     if (!$mrssObj->loadXML($mrssStr)) {
         throw new Exception('Entry mrss xml is not valid');
     }
     return $mrssObj;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:29,代码来源:FtpDistributionProfile.php

示例5: getDefaultCriteriaFilter

 public static function getDefaultCriteriaFilter()
 {
     return entryPeer::getCriteriaFilter();
 }
开发者ID:DBezemer,项目名称:server,代码行数:4,代码来源:entryIndex.php

示例6: array

 /**
 	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);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:91,代码来源:myKalturaKshowServices.class.php

示例7: copyData

 public static function copyData($source_entry_id, entry $target)
 {
     // the source_entry can be from any partner - not only of the current context
     entryPeer::getCriteriaFilter()->disable();
     // TODO - should not be switched of - it sohuld work ok with the new ks/kn mechanism and only public entries should be copied
     $source_entry = entryPeer::retrieveByPK($source_entry_id);
     if (!$source_entry) {
         return false;
     }
     $exclude_fields = array("id", "comments", "total_rank", "views", "votes", "favorites", "conversion_profile_id", "access_control_id", "categories", "categories_ids", "start_date", "end_date");
     baseObjectUtils::fillObjectFromObject(entryPeer::getFieldNames(BasePeer::TYPE_FIELDNAME), $source_entry, $target, baseObjectUtils::CLONE_POLICY_PREFER_EXISTING, $exclude_fields);
     $wrapper = objectWrapperBase::getWrapperClass($target, objectWrapperBase::DETAIL_LEVEL_REGULAR);
     $target->setDimensions($source_entry->getWidth(), $source_entry->getHeight());
     $target->getCustomDataObj();
     //		$target->setLengthInMsecs( $source_entry->getLengthInMsecs() );
     //		$target->setMediaType( $source_entry->getMediaType() );
     //		$target->setTags ( $source_entry->getTags () );
     $sourceThumbKey = $source_entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
     //replaced__getThumbnailPat
     $sourceDataKey = $source_entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
     //replaced__getDataPath
     $sourceDataEditKey = $source_entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA_EDIT);
     //replaced__getDataPathEdit
     //		$target->setThumbnail ( $source_thumbnail_path );
     //		$target->setData ( $source_data_path );
     $targetThumbKey = $target->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
     //replaced__getThumbnailPath
     $targetDataKey = $target->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
     //replaced__getDataPath
     $targetDataEditKey = $target->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA_EDIT);
     //replaced__getDataPathEdit
     $content = myContentStorage::getFSContentRootPath();
     //		echo "[$content] [$source_thumbnail_path]->[$target_thumbnail_path] [$source_data_path]->[$target_data_path]";
     if (kFileSyncUtils::file_exists($sourceDataKey, true)) {
         kFileSyncUtils::softCopy($sourceDataKey, $targetDataKey);
     }
     if (kFileSyncUtils::file_exists($sourceThumbKey, true)) {
         kFileSyncUtils::softCopy($sourceThumbKey, $targetThumbKey);
     }
     if (kFileSyncUtils::file_exists($sourceDataEditKey, true)) {
         kFileSyncUtils::softCopy($sourceDataEditKey, $targetDataEditKey);
     }
     // added by Tan-Tan 12/01/2010 to support falvors copy
     $sourceFlavorAssets = flavorAssetPeer::retrieveByEntryId($source_entry_id);
     foreach ($sourceFlavorAssets as $sourceFlavorAsset) {
         $sourceFlavorAsset->copyToEntry($target->getId(), $target->getPartnerId());
     }
     return true;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:49,代码来源:myEntryUtils.class.php

示例8: getPathValue

 /**
  * @return string path value
  * @param entry $entry
  * @param string $xslStr
  */
 protected function getPathValue(entry $entry, $xslStr)
 {
     // set the default criteria to use the current entry distribution partner id (it is restored later)
     // this is needed for related entries under kMetadataMrssManager which is using retrieveByPK without the correct partner id filter
     $oldEntryCriteria = entryPeer::getCriteriaFilter()->getFilter();
     myPartnerUtils::resetPartnerFilter('entry');
     myPartnerUtils::addPartnerToCriteria('entry', $entry->getPartnerId(), true);
     $mrss = null;
     $mrssParams = new kMrssParameters();
     $mrssParams->setStatuses(array(flavorAsset::ASSET_STATUS_READY, flavorAsset::ASSET_STATUS_EXPORTING));
     $mrss = kMrssManager::getEntryMrssXml($entry, $mrss, $mrssParams);
     $mrssStr = $mrss->asXML();
     // restore the original criteria
     entryPeer::getCriteriaFilter()->setFilter($oldEntryCriteria);
     if (!$mrssStr) {
         KalturaLog::err('No MRSS returned for entry [' . $entry->getId() . ']');
         return null;
     }
     $mrssObj = new DOMDocument();
     if (!$mrssObj->loadXML($mrssStr)) {
         KalturaLog::err('Error loading MRSS XML object for entry [' . $entry->getId() . ']');
         return null;
     }
     $xslObj = new DOMDocument();
     $xslStr = trim($xslStr);
     if (!$xslObj->loadXML($xslStr)) {
         KalturaLog::err('Error loading XSL');
         return null;
     }
     $proc = new XSLTProcessor();
     $proc->registerPHPFunctions(kXml::getXslEnabledPhpFunctions());
     $proc->importStyleSheet($xslObj);
     $resultXmlObj = $proc->transformToDoc($mrssObj);
     if (!$resultXmlObj) {
         KalturaLog::err('Error transforming XML for entry id [' . $entry->getId() . ']');
         return null;
     }
     /* DEBUG logs
     		KalturaLog::log('entry mrss = '.$mrssStr);
     		KalturaLog::log('profile xslt = '.$xslStr);
     		*/
     KalturaLog::debug('Result XML: ' . $resultXmlObj->saveXML());
     $xpath = new DOMXPath($resultXmlObj);
     $fieldElement = $xpath->query("//path_value")->item(0);
     if (!$fieldElement) {
         KalturaLog::err('Cannot find element <path_value> in XML');
         return null;
     }
     $fieldValue = $fieldElement->nodeValue;
     return $fieldValue;
 }
开发者ID:DBezemer,项目名称:server,代码行数:56,代码来源:kXslPathManager.php

示例9: applyFilterFields

 protected function applyFilterFields(baseObjectFilter $filter)
 {
     /* @var $filter entryFilter */
     if ($filter->is_set('_eq_redirect_from_entry_id')) {
         $partnerGroup = array(kCurrentContext::getCurrentPartnerId(), PartnerPeer::GLOBAL_PARTNER);
         $criteriaFilter = entryPeer::getCriteriaFilter();
         $defaultCriteria = $criteriaFilter->getFilter();
         $defaultCriteria->remove(entryPeer::PARTNER_ID);
         $defaultCriteria->add(entryPeer::PARTNER_ID, $partnerGroup, Criteria::IN);
         $origEntryId = $filter->get('_eq_redirect_from_entry_id');
         $origEntry = entryPeer::retrieveByPK($origEntryId);
         if (!empty($origEntry)) {
             if ($origEntry->getType() == entryType::LIVE_STREAM) {
                 // Set a relatively short expiry value in order to reduce the wait-time
                 // until the cache is refreshed and a redirection kicks-in.
                 kApiCache::setExpiry(kApiCache::REDIRECT_ENTRY_CACHE_EXPIRY);
             }
             // Get the id of the entry id that is being redirected from the original entry
             $redirectEntryId = $origEntry->getRedirectEntryId();
             if (is_null($redirectEntryId)) {
                 $filter->set('_eq_id', $origEntryId);
                 // Continue with original entry id
             } else {
                 // Get the redirected entry and check if it exists and is ready
                 $redirectedEntry = entryPeer::retrieveByPK($redirectEntryId);
                 if (!empty($redirectedEntry) && $redirectedEntry->getStatus() == entryStatus::READY) {
                     // Redirected entry is ready.
                     // Set it as the replacement of the original one
                     $filter->set('_eq_id', $redirectEntryId);
                 } else {
                     // Can't redirect? --> Fallback to the original entry
                     $filter->set('_eq_id', $origEntryId);
                 }
             }
         } else {
             throw new kCoreException("Invalid entry id [\"{$origEntryId}\"]", kCoreException::INVALID_ENTRY_ID, $origEntryId);
         }
         $filter->unsetByName('_eq_redirect_from_entry_id');
     }
     $categoriesAncestorParsed = null;
     $categories = $filter->get("_in_category_ancestor_id");
     if ($categories !== null) {
         //if the category exist or the category name is an empty string
         $categoriesAncestorParsed = $filter->categoryIdsToAllSubCategoriesIdsParsed($categories);
         if (!($categoriesAncestorParsed !== '' || $categories == '')) {
             $categoriesAncestorParsed = category::CATEGORY_ID_THAT_DOES_NOT_EXIST;
         }
     }
     $filter->unsetByName('_in_category_ancestor_id');
     $categories = $filter->get("_matchor_categories_ids");
     if ($categories !== null) {
         //if the category exist or the category name is an empty string
         if (is_null($categoriesAncestorParsed)) {
             $categoriesParsed = $filter->categoryIdsToIdsParsed($categories);
         } else {
             $categoriesParsed = $categoriesAncestorParsed;
         }
         if ($categoriesParsed !== '' || $categories == '') {
             $filter->set("_matchor_categories_ids", $categoriesParsed);
         } else {
             $filter->set("_matchor_categories_ids", category::CATEGORY_ID_THAT_DOES_NOT_EXIST);
         }
     } else {
         $filter->set("_matchor_categories_ids", $categoriesAncestorParsed);
     }
     $categories = $filter->get("_matchand_categories_ids");
     if ($categories !== null) {
         //if the category exist or the category name is an empty string
         $categoriesParsed = $filter->categoryIdsToIdsParsed($categories);
         if ($categoriesParsed !== '' || $categories == '') {
             $filter->set("_matchand_categories_ids", $categoriesParsed);
         } else {
             $filter->set("_matchand_categories_ids", category::CATEGORY_ID_THAT_DOES_NOT_EXIST);
         }
     }
     $categoriesIds = $filter->get("_notcontains_categories_ids");
     if ($categoriesIds !== null) {
         $categoriesParsed = $filter->categoryIdsToAllSubCategoriesIdsParsed($categoriesIds, CategoryEntryStatus::ACTIVE . ',' . CategoryEntryStatus::PENDING . ',' . CategoryEntryStatus::REJECTED);
         if ($categoriesParsed !== '' || $categoriesIds == '') {
             $filter->set("_notcontains_categories_ids", $categoriesParsed);
         } else {
             $filter->set("_notcontains_categories_ids", category::CATEGORY_ID_THAT_DOES_NOT_EXIST);
         }
     }
     $matchAndCats = $filter->get("_matchand_categories");
     if ($matchAndCats !== null) {
         //if the category exist or the category name is an empty string
         $categoriesParsed = $filter->categoryFullNamesToIdsParsed($matchAndCats, CategoryEntryStatus::ACTIVE);
         if ($categoriesParsed !== '' || $matchAndCats == '') {
             $filter->set("_matchand_categories_ids", $categoriesParsed);
         } else {
             $filter->set("_matchand_categories_ids", category::CATEGORY_ID_THAT_DOES_NOT_EXIST);
         }
         $filter->unsetByName('_matchand_categories');
     }
     $matchOrCats = $filter->get("_matchor_categories");
     if ($matchOrCats !== null) {
         //if the category exist or the category name is an empty string
         $categoriesParsed = $filter->categoryFullNamesToIdsParsed($matchOrCats, CategoryEntryStatus::ACTIVE);
         if ($categoriesParsed !== '' || $matchOrCats == '') {
//.........这里部分代码省略.........
开发者ID:AdiTal,项目名称:server,代码行数:101,代码来源:SphinxEntryCriteria.php

示例10: attachCriteriaFilter

 /**
  * the filterCriteria will filter out all the doSelect methods - ONLY if the filter is turned on.
  * IMPORTANT - the filter is turend on by default and when switched off - should be turned on again manually .
  * 
  * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
  */
 protected static function attachCriteriaFilter(Criteria $criteria)
 {
     entryPeer::getCriteriaFilter()->applyFilter($criteria);
 }
开发者ID:DBezemer,项目名称:server,代码行数:10,代码来源:BaseentryPeer.php

示例11: blockDeletedInCriteriaFilter

 public static function blockDeletedInCriteriaFilter()
 {
     $ecf = entryPeer::getCriteriaFilter();
     $ecf->getFilter()->addAnd(entryPeer::STATUS, entryStatus::DELETED, Criteria::NOT_EQUAL);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:5,代码来源:entryPeer.php

示例12: getFieldValuesXml

 protected function getFieldValuesXml(EntryDistribution $entryDistribution, $fieldName = null)
 {
     $entry = entryPeer::retrieveByPKNoFilter($entryDistribution->getEntryId());
     if (!$entry) {
         KalturaLog::err('Entry not found with ID [' . $entryDistribution->getEntryId() . ']');
         return null;
     }
     // set the default criteria to use the current entry distribution partner id (it is restored later)
     // this is needed for related entries under kMetadataMrssManager which is using retrieveByPK without the correct partner id filter
     $oldEntryCriteria = entryPeer::getCriteriaFilter()->getFilter();
     myPartnerUtils::resetPartnerFilter('entry');
     myPartnerUtils::addPartnerToCriteria('entry', $entryDistribution->getPartnerId(), true);
     try {
         $mrss = null;
         $mrssParams = new kMrssParameters();
         if ($this->getItemXpathsToExtend()) {
             $mrssParams->setItemXpathsToExtend($this->getItemXpathsToExtend());
         }
         $mrss = kMrssManager::getEntryMrssXml($entry, $mrss, $mrssParams);
         $mrssStr = $mrss->asXML();
     } catch (Exception $e) {
         // restore the original criteria so it will not get stuck due to the exception
         entryPeer::getCriteriaFilter()->setFilter($oldEntryCriteria);
         throw $e;
     }
     // restore the original criteria
     entryPeer::getCriteriaFilter()->setFilter($oldEntryCriteria);
     if (!$mrssStr) {
         KalturaLog::err('No MRSS returned for entry [' . $entry->getId() . ']');
         return null;
     }
     $mrssObj = new DOMDocument();
     if (!$mrssObj->loadXML($mrssStr)) {
         KalturaLog::err('Error loading MRSS XML object for entry [' . $entry->getId() . ']');
         return null;
     }
     $xslObj = new DOMDocument();
     $xslStr = $this->getFieldValuesXslt($entryDistribution, $fieldName);
     $xslStr = trim($xslStr);
     if (!$xslObj->loadXML($xslStr)) {
         KalturaLog::err('Error loading distribution profile XSLT for profile ID [' . $this->getId() . ']');
         return null;
     }
     $proc = new XSLTProcessor();
     $proc->registerPHPFunctions(kXml::getXslEnabledPhpFunctions());
     $proc->importStyleSheet($xslObj);
     $resultXml = $proc->transformToXml($mrssObj);
     //in order to keep the UTF-8 encoding we transformToXml http://www.php.net/manual/en/xsltprocessor.transformtodoc.php#69305
     $resultXmlObj = new DOMDocument();
     $resultXmlObj->loadXML($resultXml);
     if (!$resultXmlObj) {
         KalturaLog::err('Error transforming XML for distribution profile [' . $this->getId() . '] and entry id [' . $entry->getId() . ']');
         return null;
     }
     /* DEBUG logs
     		KalturaLog::log('entry mrss = '.$mrssStr);
     		KalturaLog::log('profile xslt = '.$xslStr);
     		*/
     KalturaLog::debug('Result XML: ' . $resultXmlObj->saveXML());
     return $resultXmlObj;
 }
开发者ID:kubrickfr,项目名称:server,代码行数:61,代码来源:ConfigurableDistributionProfile.php

示例13: getDefaultCriteriaFilter

 /**
  * @return criteriaFilter
  */
 protected function getDefaultCriteriaFilter()
 {
     return entryPeer::getCriteriaFilter();
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:7,代码来源:SphinxEntryCriteria.php

示例14: array

 /**
 	return array('status' => $status, 'message' => $message, 'objects' => $objects);
 		objects - array of
 				'thumb' 
 				'title'  
 				'description' 
 				'id' - unique id to be passed to getMediaInfo 
 */
 public function searchMedia($media_type, $searchText, $page, $pageSize, $authData = null, $extraData = null)
 {
     $page_size = $pageSize > self::MAX_PAGE_SIZE ? self::MAX_PAGE_SIZE : $pageSize;
     $status = "ok";
     $message = '';
     // this is a silly hack until we change the interface to work with an input container rather than the request
     // TODO - replace !
     $_REQUEST["keywords"] = $searchText;
     // TODO  - remove  -see the comment above the __construct() funciton
     $clzz = self::$s_clazz;
     //get_class ();
     $service = new $clzz();
     $entry_filter = $service->getEntryFilter($extraData);
     $map = array("page" => $page, "keywords" => $searchText);
     // this container will
     $generic_container = new myGenericContainer($map);
     $entry_pager = new mySmartPager($generic_container, "entry", $page_size);
     // this bellow will bypass the partner filter - at the end of the code the filter will return to be as was before
     // don't filter by partner
     $criteria = entryPeer::getCriteriaFilter()->getFilter();
     $original_partner_to_filter = $criteria->get(entryPeer::PARTNER_ID);
     $criteria->remove(entryPeer::PARTNER_ID);
     // filter: allow only entries of status READY !
     $criteria->addAnd(entryPeer::STATUS, entryStatus::READY);
     $act = new AJAX_getEntriesAction();
     $act->setIdList(NULL);
     $act->setSortAlias("ids");
     $act->skip_count = true;
     //		$kaltura_media_type = self::getKalturaMediaType ( $media_type );
     $act->setMediaType($media_type);
     $fetch = true;
     if ($authData != null) {
         list($kuser_id, $hash) = explode("I", $authData);
         $fetch = false;
         $hash_res = kString::verifyExpiryHash($kuser_id, self::AUTH_SALT, $hash, self::AUTH_INTERVAL);
         if (0 < $hash_res) {
             $fetch = true;
             $act->setOnlyForKuser($kuser_id);
         }
         if (!$fetch) {
             $status = "error";
             $message = "invalid authentication data";
         }
     } else {
         $act->setPublicOnly(true);
     }
     if ($fetch) {
         $entry_results = $act->fetchPage($generic_container, $entry_filter, $entry_pager);
     } else {
         $entry_results = array();
     }
     // after the query - return the filter to what it was before
     $criteria->addAnd(entryPeer::PARTNER_ID, $original_partner_to_filter);
     $number_of_results = $entry_pager->getNumberOfResults();
     $number_of_pages = $entry_pager->getNumberOfPages();
     $objects = array();
     // add thumbs when not image or video
     $should_add_thumbs = $media_type != entry::ENTRY_MEDIA_TYPE_AUDIO;
     foreach ($entry_results as $entry) {
         /* @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->getDescription(), "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);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:77,代码来源:myKalturaServices.class.php

示例15: applyFilters

 public function applyFilters()
 {
     $this->criteriasLeft = 0;
     KalturaLog::debug("Applies " . count($this->filters) . " filters");
     foreach ($this->filters as $index => $filter) {
         KalturaLog::debug("Applies filter {$index}");
         $this->applyFilter($filter);
     }
     // attach all default criteria from peer
     entryPeer::getCriteriaFilter()->applyFilter($this);
     // go over all criterions and try to move them to the solr
     foreach ($this->getMap() as $field => $criterion) {
         if (!$criterion instanceof SolrEntryCriterion) {
             KalturaLog::debug("Criterion [" . $criterion->getColumn() . "] is not solr criteria");
             $this->criteriasLeft++;
             continue;
         }
         if ($criterion->apply($this->whereClause)) {
             KalturaLog::debug("Criterion [" . $criterion->getColumn() . "] attached");
             $this->keyToRemove[] = $field;
         } else {
             KalturaLog::debug("Criterion [" . $criterion->getColumn() . "] failed");
             $this->criteriasLeft++;
         }
     }
     KalturaLog::debug("Applied " . count($this->whereClause) . " matches, " . count($this->whereClause) . " clauses, " . count($this->keyToRemove) . " keys removed, {$this->criteriasLeft} keys left");
     $wheres = '';
     if (count($this->whereClause)) {
         $wheres = "";
         foreach ($this->whereClause as $where) {
             $c = @$where[0];
             $wheres .= ($c == "-" || $c == "+" ? " " : " +") . $where;
         }
     }
     $orderBy = '';
     $orderByColumns = $this->getOrderByColumns();
     $orderByColumns = array_unique($orderByColumns);
     $setLimit = true;
     if (count($orderByColumns)) {
         $replace = self::$solrOrderFields;
         $search = array_keys($replace);
         $orders = array();
         foreach ($orderByColumns as $orderByColumn) {
             $arr = explode(' ', $orderByColumn);
             $orderField = $arr[0];
             if (isset($replace[$orderField])) {
                 KalturaLog::debug("Add sort field[{$orderField}] copy from [{$orderByColumn}]");
                 $orders[] = str_replace($search, $replace, $orderByColumn);
             } else {
                 KalturaLog::debug("Skip sort field[{$orderField}] from [{$orderByColumn}] limit won't be used in solr query");
                 $setLimit = false;
             }
         }
         if (count($orders)) {
             $orderBy = 'sort=' . implode(',', $orders);
         }
     }
     $limit = self::SOLR_MAX_RECORDS;
     if ($this->criteriasLeft) {
         $setLimit = false;
     }
     $offset = 0;
     if ($setLimit && $this->getLimit()) {
         $limit = $this->getLimit();
         if ($this->getOffset()) {
             $offset = $this->getOffset();
         }
     }
     $query = "{$wheres} {$orderBy}";
     echo $query . "\n";
     die;
     $solr = kSolrSearchManager::createSolrService();
     $response = $solr->search($query, $offset, $limit);
     if (!$response) {
         KalturaLog::err("Invalid solr query [{$sql}]");
         return;
     }
     $response = json_decode($response);
     $response = $response['response'];
     $docs = $response['docs'];
     $ids = $array();
     foreach ($docs as $doc) {
         $ids[] = $doc["id"];
     }
     KalturaLog::debug("Found " . count($ids) . " ids");
     foreach ($this->keyToRemove as $key) {
         KalturaLog::debug("Removing key [{$key}] from criteria");
         $this->remove($key);
     }
     $this->addAnd(entryPeer::ID, $ids, Criteria::IN);
     $this->recordsCount = 0;
     if ($setLimit) {
         $this->recordsCount = $response['numFound'];
     } else {
         $c = clone $this;
         $c->setLimit(null);
         $c->setOffset(null);
         $this->recordsCount = entryPeer::doCount($c);
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:100,代码来源:SolrEntryCriteria.php


注:本文中的entryPeer::getCriteriaFilter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。