本文整理汇总了PHP中SearchResult::RateTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP SearchResult::RateTitle方法的具体用法?PHP SearchResult::RateTitle怎么用?PHP SearchResult::RateTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchResult
的用法示例。
在下文中一共展示了SearchResult::RateTitle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getForQuery
static function getForQuery($search_query, $project = NULL)
{
$count_overall = 0;
$results = array();
global $PH;
require_once confGet('DIR_STREBER') . "db/class_company.inc.php";
$args = array('order_str' => NULL, 'has_id' => NULL, 'search' => $search_query);
foreach ($companies = Company::getAll($args) as $company) {
$rate = RATE_TYPE_COMPANY;
$rate *= SearchResult::RateItem($company);
$rate *= SearchResult::RateTitle($company, $search_query);
$results[] = new SearchResult(array('name' => $company->name, 'rating' => $rate, 'type' => __('Company'), 'jump_id' => 'companyView', 'jump_params' => array('company' => $company->id, 'q' => $search_query), 'item' => $company));
}
require_once confGet('DIR_STREBER') . "db/class_person.inc.php";
foreach ($people = Person::getPeople(array('search' => $search_query)) as $person) {
$rate = RATE_TYPE_PERSON;
$rate *= SearchResult::RateItem($person);
$rate *= SearchResult::RateTitle($person, $search_query);
$results[] = new SearchResult(array('name' => $person->name, 'rating' => $rate, 'type' => __('Person'), 'jump_id' => 'personView', 'jump_params' => array('person' => $person->id, 'q' => $search_query), 'item' => $person));
}
require_once confGet('DIR_STREBER') . "db/class_project.inc.php";
$projects = Project::getAll(array('status_min' => 0, 'status_max' => 10, 'search' => $search_query));
if ($projects) {
foreach ($projects as $project) {
$rate = RATE_TYPE_PROJECT;
if ($project->status == STATUS_TEMPLATE) {
$rate *= RATE_PROJECT_IS_TEMPLATE;
} else {
if ($project->status < STATUS_COMPLETED) {
$rate *= RATE_PROJECT_IS_OPEN;
} else {
$rate *= RATE_PROJECT_IS_CLOSED;
}
}
if ($diz = SearchResult::getExtract($project, $search_query)) {
$rate *= RATE_IN_DETAILS;
}
### status ###
global $g_status_names;
$status = isset($g_status_names[$project->status]) ? $g_status_names[$project->status] : '';
if ($project->status > STATUS_COMPLETED) {
$rate *= RATE_TASK_STATUS_CLOSED;
} else {
if ($project->status >= STATUS_COMPLETED) {
$rate *= RATE_TASK_STATUS_COMPLETED;
}
}
### for company ###
$html_location = '';
if ($company = Company::getVisibleById($project->company)) {
$html_location = __('for') . ' ' . $company->getLink();
}
$rate *= SearchResult::RateItem($project);
$rate *= SearchResult::RateTitle($project, $search_query);
$results[] = new SearchResult(array('name' => $project->name, 'rating' => $rate, 'item' => $project, 'type' => __('Project'), 'jump_id' => 'projView', 'jump_params' => array('prj' => $project->id, 'q' => $search_query), 'extract' => $diz, 'status' => $status, 'html_location' => $html_location));
}
}
require_once confGet('DIR_STREBER') . "db/class_task.inc.php";
$order_str = get('sort_' . $PH->cur_page->id . "_tasks");
$tasks = Task::getAll(array('order_by' => $order_str, 'search' => $search_query, 'status_min' => STATUS_UPCOMING, 'status_max' => STATUS_CLOSED));
if ($tasks) {
foreach ($tasks as $task) {
$rate = RATE_TYPE_TASK;
$rate *= SearchResult::RateItem($task);
$rate *= SearchResult::RateTitle($task, $search_query);
if ($task->category == TCATEGORY_FOLDER) {
$rate *= RATE_TASK_IS_FOLDER;
}
if ($diz = SearchResult::getExtract($task, $search_query)) {
$rate *= RATE_IN_DETAILS;
}
global $g_status_names;
$status = isset($g_status_names[$task->status]) ? $g_status_names[$task->status] : '';
if ($task->status > STATUS_COMPLETED) {
$rate *= RATE_TASK_STATUS_CLOSED;
} else {
if ($task->status >= STATUS_COMPLETED) {
$rate *= RATE_TASK_STATUS_COMPLETED;
}
}
if ($project = Project::getVisibleById($task->project)) {
$prj = $project->getLink();
} else {
$prj = '';
}
$html_location = __('in') . " <b>{$prj}</b> > " . $task->getFolderLinks();
$is_done = $task->status < STATUS_COMPLETED ? false : true;
$results[] = new SearchResult(array('name' => $task->name, 'rating' => $rate, 'extract' => $diz, 'item' => $task, 'type' => $task->getLabel(), 'status' => $status, 'html_location' => $html_location, 'is_done' => $is_done, 'jump_id' => 'taskView', 'jump_params' => array('tsk' => $task->id, 'q' => $search_query)));
}
}
require_once confGet('DIR_STREBER') . "db/class_comment.inc.php";
$comments = Comment::getAll(array('search' => $search_query));
if ($comments) {
foreach ($comments as $comment) {
$rate = RATE_TYPE_COMMENT;
$rate *= SearchResult::RateItem($comment);
$rate *= SearchResult::RateTitle($comment, $search_query);
if ($diz = SearchResult::getExtract($comment, $search_query)) {
$rate *= RATE_IN_DETAILS;
}
//.........这里部分代码省略.........