本文整理汇总了PHP中SearchHelper::saveSavedSearch方法的典型用法代码示例。如果您正苦于以下问题:PHP SearchHelper::saveSavedSearch方法的具体用法?PHP SearchHelper::saveSavedSearch怎么用?PHP SearchHelper::saveSavedSearch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchHelper
的用法示例。
在下文中一共展示了SearchHelper::saveSavedSearch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveQuery
/**
* This method uses ajax to save the users query
*
* @author KnowledgeTree TEam
* @access public
* @static
* @param string $txtName The name of the saved search query
* @param string $txtQuery The search query
* @param string $userID The id of the user saving the query
* @return void
*/
public static function saveQuery($txtName, $txtQuery, $userID)
{
/* $lookup = sanitizeForSQL($txtName);
$sql = "select 1 from search_saved where name='$lookup'";
$result = DBUtil::getResultArray($sql);
*/
$result = SearchHelper::checkForSavedSearch($txtName);
if (PEAR::isError($result)) {
AjaxSearchHelper::createResponse(AjaxSearchHelper::STATUS_INTERNAL);
}
if (count($result) > 0) {
AjaxSearchHelper::createResponse(AjaxSearchHelper::STATUS_SAVED_SEARCH_EXISTS, _kt('Search with this name already exists'));
}
/* // autoInsert does escaping...
$values = array(
'name'=>$txtName,
'expression'=>$txtQuery,
'type'=>'S',
'shared'=>0,
'user_id' => $userID
);
$result = DBUtil::autoInsert('search_saved', $values);
*/
$result = SearchHelper::saveSavedSearch($txtName, $txtQuery, $userID);
if (PEAR::isError($result)) {
AjaxSearchHelper::createResponse(AjaxSearchHelper::STATUS_INTERNAL);
}
AjaxSearchHelper::createResponse(AjaxSearchHelper::STATUS_SUCCESS);
}
示例2: create
/**
* This method creates the saved search
*
* @author KnowledgeTree Team
* @access public
* @param string $name The name of the search
* @param string $query The query string to be saved
* @return string|object $result SUCCESS - The id of the saved search | FAILURE - an error object
*/
public function create($name, $query)
{
$user = $this->ktapi->get_user();
if (is_null($user) || PEAR::isError($user)) {
$result = new PEAR_Error(KTAPI_ERROR_USER_INVALID);
return $result;
}
$userID = $user->getId();
$result = SearchHelper::saveSavedSearch($name, $query, $userID);
return $result;
}