当前位置: 首页>>代码示例>>PHP>>正文


PHP ET::searchModel方法代码示例

本文整理汇总了PHP中ET::searchModel方法的典型用法代码示例。如果您正苦于以下问题:PHP ET::searchModel方法的具体用法?PHP ET::searchModel怎么用?PHP ET::searchModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ET的用法示例。


在下文中一共展示了ET::searchModel方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handler_conversationsController_init

 public function handler_conversationsController_init($sender)
 {
     ET::searchModel();
     // Load the search model so we can add this gambit.
     ETSearchModel::addGambit('return $term == strtolower(T("gambit.order by views"));', array($this, "gambitOrderByViews"));
 }
开发者ID:ZerGabriel,项目名称:Views,代码行数:6,代码来源:plugin.php

示例2: setChannel

 /**
  * Set the channel of a conversation.
  *
  * @param array $conversation The conversation to set the channel for. The conversation array's channelId
  * 		attribute will be updated.
  * @param int $channelId Whether or not the conversation is locked.
  * @return bool Returns true on success, or false if there is an error.
  */
 public function setChannel(&$conversation, $channelId)
 {
     if (!ET::channelModel()->hasPermission($channelId, "start")) {
         $this->error("channelId", T("message.noPermission"));
     }
     if ($this->errorCount()) {
         return false;
     }
     // Decrease the conversation/post count of the old channel.
     ET::SQL()->update("channel")->set("countConversations", "countConversations - 1", false)->set("countPosts", "countPosts - :posts", false)->bind(":posts", $conversation["countPosts"])->where("channelId=:channelId")->bind(":channelId", $conversation["channelId"])->exec();
     $this->updateById($conversation["conversationId"], array("channelId" => $channelId));
     // Increase the conversation/post count of the new channel.
     ET::SQL()->update("channel")->set("countConversations", "countConversations + 1", false)->set("countPosts", "countPosts + :posts", false)->bind(":posts", $conversation["countPosts"])->where("channelId=:channelId")->bind(":channelId", $channelId)->exec();
     $conversation["channelId"] = $channelId;
     //Flush conversition cache
     $sm = ET::searchModel();
     ET::$cache->store($sm::CACHE_NS_KEY, time());
     return true;
 }
开发者ID:ky0ncheng,项目名称:esotalk-for-sae,代码行数:27,代码来源:ETConversationModel.class.php

示例3: action_update

 /**
  * Return updated HTML for each row in the conversations table, and indicate if there are new results for the
  * specified channel and search query.
  *
  * @param string $channelSlug The channel slug.
  * @param string $query The search query.
  * @return void
  */
 public function action_update($channelSlug = "", $query = "")
 {
     // This must be done as an AJAX request.
     $this->responseType = RESPONSE_TYPE_AJAX;
     list($channelInfo, $currentChannels, $channelIds, $includeDescendants) = $this->getSelectedChannels($channelSlug);
     $search = ET::searchModel();
     // Work out which conversations we need to get updated details for (according to the input value.)
     $conversationIds = explode(",", R("conversationIds"));
     // Make sure they are all integers.
     foreach ($conversationIds as $k => $v) {
         if (!($conversationIds[$k] = (int) $v)) {
             unset($conversationIds[$k]);
         }
     }
     if (!count($conversationIds)) {
         return;
     }
     $conversationIds = array_slice((array) $conversationIds, 0, 20);
     // Work out if there are any new results for this channel/search query.
     // If the "random" gambit is in the search string, then don't go any further (because the results will
     // obviously differ!)
     $random = false;
     $terms = $query ? explode("+", strtolower(str_replace("-", "+!", trim($query, " +-")))) : array();
     foreach ($terms as $v) {
         if (trim($v) == T("gambit.random")) {
             $random = true;
         }
     }
     if (!$random) {
         // TODO: set a #limit gambit for 20 results, because we only check for differences in the first 20
         // Get a list of conversation IDs for the channel/query.
         $newConversationIds = $search->getConversationIDs($channelIds, $query, count($currentChannels) or !ET::$session->userId);
         $newConversationIds = array_slice((array) $newConversationIds, 0, 20);
         // Get the difference of the two sets of conversationId's.
         $diff = array_diff((array) $newConversationIds, (array) $conversationIds);
         if (count($diff)) {
             $this->message(sprintf(T("message.newSearchResults"), "javascript:ETSearch.showNewActivity();void(0)"), array("id" => "newSearchResults"));
         }
     }
     // Add fulltext keywords to be highlighted. Make sure we keep ones "in quotes" together.
     $this->highlight($search->fulltext);
     $fulltextString = implode(" ", $search->fulltext);
     // Get the full result data for these conversations, and construct an array of rendered conversation rows.
     $results = $search->getResults($conversationIds, true);
     $rows = array();
     foreach ($results as $conversation) {
         $rows[$conversation["conversationId"]] = $this->getViewContents("conversations/conversation", array("conversation" => $conversation, "channelInfo" => $channelInfo, "fulltextString" => $fulltextString));
     }
     // Add that to the response.
     $this->json("conversations", $rows);
     $this->render();
 }
开发者ID:davchezt,项目名称:fireside,代码行数:60,代码来源:ETConversationsController.class.php

示例4: update

 /**
  * Return updated HTML for each row in the conversations table, and indicate if there are new results for the
  * specified channel and search query.
  *
  * @param string $channelSlug The channel slug.
  * @param string $query The search query.
  * @return void
  */
 public function update($channelSlug = "", $query = "")
 {
     // This must be done as an AJAX request.
     $this->responseType = RESPONSE_TYPE_AJAX;
     list($channelInfo, $currentChannels, $channelIds, $includeDescendants) = $this->getSelectedChannels($channelSlug);
     // Work out which conversations we need to get details for (according to the input value.)
     $conversationIds = explode(",", R("conversationIds"));
     // Make sure they are all integers.
     foreach ($conversationIds as $k => $v) {
         if (!($conversationIds[$k] = (int) $v)) {
             unset($conversationIds[$k]);
         }
     }
     if (!count($conversationIds)) {
         return;
     }
     // Get the full result data for these conversations, and construct an array of rendered conversation rows.
     $results = ET::searchModel()->getResults($conversationIds, true);
     $rows = array();
     foreach ($results as $conversation) {
         $rows[$conversation["conversationId"]] = $this->getViewContents("conversations/conversation", array("conversation" => $conversation, "channelInfo" => $channelInfo));
     }
     // Add that to the response.
     $this->json("conversations", $rows);
     // Now we need to work out if there are any new results for this channel/search query.
     // If the "random" gambit is in the search string, then don't go any further (because the results will
     // obviously differ!)
     $terms = $query ? explode("+", strtolower(str_replace("-", "+!", trim($query, " +-")))) : array();
     foreach ($terms as $v) {
         if (trim($v) == T("gambit.random")) {
             return;
         }
     }
     // Get a list of conversation IDs for the channel/query.
     $newConversationIds = ET::searchModel()->getConversationIDs($channelIds, $query, count($currentChannels));
     $newConversationIds = array_slice((array) $newConversationIds, 0, 20);
     // Get the difference of the two sets of conversationId's.
     $diff = array_diff((array) $newConversationIds, (array) $conversationIds);
     if (count($diff)) {
         $this->message(T("message.newSearchResults"));
     }
     $this->render();
 }
开发者ID:revskill,项目名称:esoTalk,代码行数:51,代码来源:ETConversationsController.class.php

示例5: handler_conversationsController_init

 public function handler_conversationsController_init($sender)
 {
     if (!ET::$session->user) {
         return;
     }
     ET::searchModel();
     // Load the search model so we can add this gambit.
     ETSearchModel::addGambit('return $term == strtolower(T("gambit.bookmarked"));', array($this, "gambitBookmarked"));
 }
开发者ID:ZerGabriel,项目名称:Bookmarks,代码行数:9,代码来源:plugin.php

示例6: foreach

 *
 * @package esoTalk
 */
?>
<ul class='list conversationList'>

<?php 
// Loop through the conversations and output a table row for each one.
foreach ($data["results"] as $conversation) {
    $this->renderView("conversations/conversation", $data + array("conversation" => $conversation));
}
?>

<?php 
if ($data["showViewMoreLink"]) {
    ?>
<li class='viewMore'>
<a href='<?php 
    $searchWithoutLimit = ET::searchModel()->removeGambit($data["searchString"], 'return strpos($term, strtolower(T("gambit.limit:"))) === 0;');
    echo URL("conversations/" . $data["channelSlug"] . "?search=" . urlencode($searchWithoutLimit . ($searchWithoutLimit ? " + " : "") . "#" . T("gambit.limit:") . ($data["limit"] + C("esoTalk.search.limitIncrement"))));
    ?>
'><?php 
    echo T("View more");
    ?>
</a>
</li>
<?php 
}
?>

</ul>
开发者ID:19eighties,项目名称:esoTalk,代码行数:31,代码来源:list.php

示例7: restorePost

 /**
  * Unmark a post as deleted.
  *
  * @param array $post The post to unmark as deleted.
  * @return bool true on success, false on error.
  */
 public function restorePost(&$post)
 {
     // Update the post.
     $time = time();
     $this->updateById($post["postId"], array("deleteMemberId" => null, "deleteTime" => null));
     $post["deleteMemberId"] = null;
     $post["deleteMemberName"] = null;
     $post["deleteTime"] = null;
     //更新缓存
     $am = ET::activityModel();
     ET::$cache->store($am::CACHE_KEY . '_' . $post['memberId'] . '_' . $am::CACHE_NS_KEY, time());
     $sm = ET::searchModel();
     ET::$cache->store($sm::CACHE_NS_KEY, time());
     return true;
 }
开发者ID:ky0ncheng,项目名称:esotalk-for-sae,代码行数:21,代码来源:ETPostModel.class.php

示例8: toggle

 /**
  * Toggle a flag on a conversation.
  *
  * @param int $conversationId The ID of the conversation.
  * @param string $type The name of the flag to toggle.
  * @return void
  */
 public function toggle($conversationId, $type)
 {
     if (!$this->validateToken()) {
         return;
     }
     if (!($conversation = $this->getConversation($conversationId))) {
         return;
     }
     // Do we have permission to do this?
     if (!$conversation["canModerate"]) {
         $this->renderMessage(T("Error"), T("message.noPermission"));
         return;
     }
     $function = "set" . ucfirst($type);
     ET::conversationModel()->{$function}($conversation, !$conversation[$type]);
     //Flush conversition cache
     $sm = ET::searchModel();
     ET::$cache->store($sm::CACHE_NS_KEY, time());
     // For the default response type, redirect back to the conversation.
     if ($this->responseType === RESPONSE_TYPE_DEFAULT) {
         $this->redirect(URL(R("return", conversationURL($conversation["id"], $conversation["title"]))));
     } else {
         $this->json($type, !$conversation[$type]);
         if ($this->responseType === RESPONSE_TYPE_AJAX) {
             $this->json("labels", $this->getViewContents("conversation/labels", array("labels" => $conversation["labels"])));
         }
         $this->render();
     }
 }
开发者ID:ky0ncheng,项目名称:esotalk-for-sae,代码行数:36,代码来源:ETConversationController.class.php


注:本文中的ET::searchModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。