/** * Convert the categories to categories ids - not includes the category itself (only sub categories) * * @param string $cats Categories full names * @param string $statuses comma seperated * @return string Comma seperated fullIds */ public static function categoryIdsToAllSubCategoriesIdsParsed($cats) { if ($cats === "") { $cats = array(); } else { $cats = explode(",", $cats); } kArray::trim($cats); $categoryFullIdsToIds = array(); foreach ($cats as $cat) { $category = categoryPeer::retrieveByPK($cat); //all sub categories and not the category itself if (!$category) { continue; } $categoryFullIdsToIds[] = $category->getFullIds() . '>'; } return implode(",", $categoryFullIdsToIds); }
/** * Convert the duration types to indexed duration type strings * * @param string $durationTypeIds * @return string */ public function durationTypesToIndexedStrings($durationTypeIds) { if (is_null($durationTypeIds) || $durationTypeIds === "") { // string "0" is valid here $durationTypeIds = array(); } else { $durationTypeIds = explode(",", $durationTypeIds); } kArray::trim($durationTypeIds); $durationTypesStrings = array(); foreach ($durationTypeIds as $durationTypeId) { $durationTypesStrings[mySearchUtils::ENTRY_DURATION_TYPE_PREFIX . $durationTypeId] = null; } return implode(",", array_keys($durationTypesStrings)); }