本文整理汇总了PHP中myPartnerUtils::shouldDisplayInSearch方法的典型用法代码示例。如果您正苦于以下问题:PHP myPartnerUtils::shouldDisplayInSearch方法的具体用法?PHP myPartnerUtils::shouldDisplayInSearch怎么用?PHP myPartnerUtils::shouldDisplayInSearch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myPartnerUtils
的用法示例。
在下文中一共展示了myPartnerUtils::shouldDisplayInSearch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDisplayInSearch
/**
Will set the 'display_in_search' field according to business-logic per object type
// kuser | kshow | entry
// for objects that are search worthy - search_text will hold text from relevant columns depending on the object type
*/
public static function setDisplayInSearch(BaseObject $obj, $parent_obj = null)
{
if ($obj == null) {
return;
}
// update the displayInSearch with the logic above only when the object is new or null
if ($obj->isNew() || $obj->getDisplayInSearch() === null) {
$res = myPartnerUtils::shouldDisplayInSearch($obj->getPartnerId());
$obj_id = $obj->getId();
if ($obj_id && is_numeric($obj_id)) {
self::setRes($res, $obj_id > entry::MINIMUM_ID_TO_DISPLAY);
}
if ($res) {
if ($obj instanceof kuser) {
// if the status is not
self::setRes($res, $obj->getStatus() == KuserStatus::ACTIVE);
} elseif ($obj instanceof kshow) {
self::setRes($res, $obj->getViewPermissions() == kshow::KSHOW_PERMISSION_EVERYONE || $obj->getViewPermissions() == null);
// if the viewPermission changed from kshow::KSHOW_PERMISSION_EVERYONE to something else
// update all entries
if ($res && $obj->isColumnModified(kshowPeer::VIEW_PERMISSIONS)) {
$entries = $obj->getentrys();
foreach ($entries as $entry) {
// run this code for each entry
self::setDisplayInSearch($entry, $obj);
}
}
} elseif ($obj instanceof entry) {
// status=READY , type=MEDIACLIP, view permissions of kshow
self::setRes($res, true);
} else {
throw new Exception("mySearchUtils::setDisplayInSearch - cannot handle objects of type " . get_class($obj));
}
}
$obj->setDisplayInSearch($res);
} else {
// if not new - use the value from the object
$res = $obj->getDisplayInSearch();
}
// echo __METHOD__ . " (" . get_class ( $obj ) . ") res [$res]\n";
$words = "";
$fields_to_use = $obj->getColumnNames();
foreach ($fields_to_use as $field) {
$field_str = $obj->getByName($field, BasePeer::TYPE_FIELDNAME);
// call_user_func ( array ( $obj , $func_name ) );
$words .= " " . $field_str;
}
$extra_invisible_data = null;
if ($obj instanceof kshow) {
$type = $obj->getType();
if (empty($type)) {
$type = kshow::KSHOW_TYPE_OTHER;
}
// add the category to the search
$words .= " _CAT_" . $type;
} elseif ($obj instanceof entry) {
$extra_invisible_data = "_MEDIA_TYPE_" . $obj->getMediaType();
$type = $obj->getType();
// add the SEARCH_ENTRY_TYPE_RC to the words
if ($type == entryType::MIX) {
$extra_invisible_data .= " " . self::SEARCH_ENTRY_TYPE_RC;
}
}
$prepared_text = self::prepareSearchText($words);
$partner_id = $obj->getPartnerId();
// if res == 1 - only for partner , if == 2 - also for kaltura network
$obj->setSearchText(self::addPartner($partner_id, $prepared_text, $res, $extra_invisible_data));
}
示例2: setDisplayInSearch
/**
Will set the 'display_in_search' field according to business-logic per object type
// kuser | kshow | entry
// for objects that are search worthy - search_text will hold text from relevant columns depending on the object type
*/
public static function setDisplayInSearch(BaseObject $obj, $parent_obj = null)
{
if ($obj == null) {
return;
}
// update the displayInSearch with the logic above only when the object is new or null
if ($obj->isNew() || $obj->getDisplayInSearch() === null) {
$res = myPartnerUtils::shouldDisplayInSearch($obj->getPartnerId());
$obj_id = $obj->getId();
if ($obj_id && is_numeric($obj_id)) {
self::setRes($res, $obj_id > entry::MINIMUM_ID_TO_DISPLAY);
}
if ($res) {
if ($obj instanceof kuser) {
// if the status is not
self::setRes($res, $obj->getStatus() == KuserStatus::ACTIVE);
} elseif ($obj instanceof kshow) {
self::setRes($res, $obj->getViewPermissions() == kshow::KSHOW_PERMISSION_EVERYONE || $obj->getViewPermissions() == null);
// if the viewPermission changed from kshow::KSHOW_PERMISSION_EVERYONE to something else
// update all entries
if ($res && $obj->isColumnModified(kshowPeer::VIEW_PERMISSIONS)) {
$entries = $obj->getentrys();
foreach ($entries as $entry) {
// run this code for each entry
self::setDisplayInSearch($entry, $obj);
}
}
} elseif ($obj instanceof entry) {
// status=READY , type=MEDIACLIP, view permissions of kshow
self::setRes($res, true);
} else {
throw new Exception("mySearchUtils::setDisplayInSearch - cannot handle objects of type " . get_class($obj));
}
}
$obj->setDisplayInSearch($res);
}
}