當前位置: 首頁>>代碼示例>>PHP>>正文


PHP entryFilter::addSearchMatchToCriteria方法代碼示例

本文整理匯總了PHP中entryFilter::addSearchMatchToCriteria方法的典型用法代碼示例。如果您正苦於以下問題:PHP entryFilter::addSearchMatchToCriteria方法的具體用法?PHP entryFilter::addSearchMatchToCriteria怎麽用?PHP entryFilter::addSearchMatchToCriteria使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在entryFilter的用法示例。


在下文中一共展示了entryFilter::addSearchMatchToCriteria方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: searchMedia

 /**
 	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 > 20 ? 20 : $pageSize;
     $page--;
     if ($page < 0) {
         $page = 0;
     }
     $status = "ok";
     $message = '';
     $objects = array();
     $should_serach = true;
     if (defined("KALTURA_API_V3")) {
         $kuser = kuserPeer::getKuserByPartnerAndUid(self::$partner_id, self::$puser_id);
         $should_serach = true;
         $kuser_id = $kuser->getId();
     } else {
         $puser_kuser = PuserKuserPeer::retrieveByPartnerAndUid(self::$partner_id, self::$subp_id, self::$puser_id, true);
         if (!$puser_kuser) {
             // very bad - does not exist in system
             $should_serach = false;
         } else {
             $kuser = $puser_kuser->getKuser();
             if (!$kuser) {
                 $should_serach = false;
             } else {
                 $kuser_id = $kuser->getId();
             }
         }
     }
     //		echo "[" . self::$partner_id . "],[".  self::$subp_id . "],[" . self::$puser_id . "],[$kuser_id]";
     if ($should_serach) {
         $c = KalturaCriteria::create(entryPeer::OM_CLASS);
         $c->add(entryPeer::KUSER_ID, $kuser_id);
         $c->add(entryPeer::MEDIA_TYPE, $media_type);
         $c->add(entryPeer::TYPE, entryType::MEDIA_CLIP);
         //			$keywords_array = mySearchUtils::getKeywordsFromStr ( $searchText );
         $filter = new entryFilter();
         $filter->setPartnerSearchScope(self::$partner_id);
         $filter->addSearchMatchToCriteria($c, $searchText, entry::getSearchableColumnName());
         $c->setLimit($pageSize);
         $c->setOffset($page * $pageSize);
         $entry_results = entryPeer::doSelect($c);
         //JoinAll( $c );
         $number_of_results = $c->getRecordsCount();
         $number_of_pages = (int) ($number_of_results / $pageSize);
         if ($number_of_results % $pageSize != 0) {
             $number_of_pages += 1;
         }
         // if there are some left-overs - there must be a nother page
         // add thumbs when not image or video
         $should_add_thumbs = $media_type != entry::ENTRY_MEDIA_TYPE_AUDIO;
         foreach ($entry_results as $entry) {
             // send the id as the url
             $object = array("id" => $entry->getId(), "url" => $entry->getDataUrl(), "tags" => $entry->getTags(), "title" => $entry->getName(), "description" => $entry->getDescription());
             if ($should_add_thumbs) {
                 $object["thumb"] = $entry->getThumbnailUrl();
             }
             $objects[] = $object;
         }
     }
     return array('status' => $status, 'message' => $message, 'objects' => $objects, "needMediaInfo" => self::$NEED_MEDIA_INFO);
 }
開發者ID:richhl,項目名稱:kalturaCE,代碼行數:70,代碼來源:myKalturaUserClipsServices.class.php


注:本文中的entryFilter::addSearchMatchToCriteria方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。