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


PHP ET::getInstance方法代码示例

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


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

示例1: action_index

 public function action_index($orderBy = false, $start = 0)
 {
     if (!$this->allowed("esoTalk.members.visibleToGuests")) {
         return;
     }
     //If admin has disabled reputatoin points, break
     if (!C("plugin.Reputation.showReputationPublic")) {
         return;
     }
     $model = ET::getInstance("reputationModel");
     $members = $model->getReputationMembers();
     //Get rank of current member and get nearby members if rank is greater than 10
     $rank = $model->getRankOfCurrentMember(ET::$session->userId, $members);
     //Three parameters for getNearbyReputationMembers is number of members to be shown, offset, members array
     if ($rank > 10) {
         $nearbyMembers = $model->getNearbyReputationMembers(10, $rank - 5, $members);
     }
     //Get top 10 reputation members
     $topMembers = $model->getTopReputationMembers(10, $members);
     //Pass data to view
     $this->data("topMembers", $topMembers);
     $this->data("nearbyMembers", $nearbyMembers);
     $this->data("rank", $rank);
     $this->render("reputation");
 }
开发者ID:ZerGabriel,项目名称:Reputation,代码行数:25,代码来源:ReputationController.class.php

示例2: handler_init

 public function handler_init($sender)
 {
     ET::$controller->addCSSFile($this->resource("pages.css"), true);
     $model = ET::getInstance("pagesModel");
     $pages = $model->get();
     if ($pages) {
         foreach ($pages as $page) {
             if (ET::$session->userId) {
                 $sender->addToMenu($page['menu'], $page['slug'] . '-page', '<a href="' . URL("pages") . '/' . $page['pageId'] . '-' . $page['slug'] . '">' . $page['title'] . '</a>');
             } elseif ($page['hideFromGuests'] == 0) {
                 $sender->addToMenu($page['menu'], $page['slug'] . '-page', '<a href="' . URL("pages") . '/' . $page['pageId'] . '-' . $page['slug'] . '">' . $page['title'] . '</a>');
             }
         }
     }
 }
开发者ID:ZerGabriel,项目名称:Pages,代码行数:15,代码来源:plugin.php

示例3: handler_conversationModel_deleteBefore

 public function handler_conversationModel_deleteBefore($sender, $sql, $ids)
 {
     $model = ET::getInstance("attachmentModel");
     // Create a subquery to get all post IDs for these conversations.
     $postIds = ET::SQL()->select("postId")->from("post")->where("conversationId IN (:conversationIds)")->bind(":conversationIds", $ids)->get();
     // Get all attachments for all posts in these conversations, as well as all draft attachments for these conversations.
     $attachments = ET::SQL()->select("*")->from("attachment")->where("draftConversationId IN (:conversationIds) OR postId IN ({$postIds})")->bind(":conversationIds", $ids)->exec()->allRows("attachmentId");
     // Delete them from the database.
     if (!empty($attachments)) {
         ET::SQL()->delete()->from("attachment")->where("attachmentId IN (:attachmentIds)")->bind(":attachmentIds", array_keys($attachments))->exec();
         // Delete all of these attachments from the filesystem.
         foreach ($attachments as $attachment) {
             $model->removeFile($attachment);
         }
     }
 }
开发者ID:ky0ncheng,项目名称:esotalk-for-sae,代码行数:16,代码来源:plugin.php

示例4: handler_conversationModel_setDraftAfter

 public function handler_conversationModel_setDraftAfter($sender, $conversation, $memberId, $draft)
 {
     // If we're discarding the draft, delete all relevant attachments from the database.
     if ($draft === null) {
         ET::SQL()->delete()->from("attachment")->where("draftMemberId", ET::$session->userId)->where("draftConversationId", $conversation["conversationId"])->exec();
         // TODO: delete them from the filesystem as well.
     } else {
         $model = ET::getInstance("attachmentModel");
         $attachments = $model->extractFromSession(ET::$controller->controllerMethod == "start" ? "c0" : "c" . $conversation["conversationId"]);
         if (!empty($attachments)) {
             $model->insertAttachments($attachments, array("draftMemberId" => $memberId, "draftConversationId" => $conversation["conversationId"]));
         }
     }
 }
开发者ID:AlexandrST,项目名称:esoTalk,代码行数:14,代码来源:plugin.php

示例5: remove

 public function remove($attachmentId)
 {
     if (!$this->validateToken()) {
         return;
     }
     $session = (array) ET::$session->get("attachments");
     if (isset($session[$attachmentId])) {
         unset($session[$attachmentId]);
         ET::$session->store("attachments", $session);
     } else {
         $model = ET::getInstance("attachmentModel");
         $attachment = $model->getById($attachmentId);
         // Make sure the user has permission to edit this post.
         $permission = false;
         if (!empty($attachment["postId"])) {
             $post = ET::postModel()->getById($attachment["postId"]);
             $conversation = ET::conversationModel()->getById($post["conversationId"]);
             $permission = ET::postModel()->canEditPost($post, $conversation);
         } else {
             $permission = ET::$session->userId == $attachment["draftMemberId"];
         }
         if (!$permission) {
             $this->renderMessage(T("Error"), T("message.noPermission"));
             return false;
         }
         // Remove the attachment from the database and filesystem.
         $model->deleteById($attachmentId);
         @unlink($model->path() . $attachmentId . $attachment["secret"]);
     }
 }
开发者ID:AlexandrST,项目名称:esoTalk,代码行数:30,代码来源:AttachmentController.class.php

示例6: action_removeSession

 public function action_removeSession($postId)
 {
     if (!$this->validateToken()) {
         return;
     }
     $model = ET::getInstance("attachmentModel");
     $attachments = $model->extractFromSession("p" . $postId);
     foreach ($attachments as $attachment) {
         $model->removeFile($attachment);
     }
 }
开发者ID:ZerGabriel,项目名称:Attachments,代码行数:11,代码来源:AttachmentController.class.php

示例7: getAttachmentModel

 private function getAttachmentModel()
 {
     return ET::getInstance("attachmentModel");
 }
开发者ID:m-mori,项目名称:forum,代码行数:4,代码来源:AttachmentController.class.php

示例8: handler_membersController_parseTerms

 public function handler_membersController_parseTerms($sender, &$terms, $sql, &$conditions)
 {
     $model = ET::getInstance("profileFieldModel");
     $fields = $model->get(array("searchable" => 1));
     foreach ($terms as $k => $term) {
         $term = strtolower(trim($term));
         foreach ($fields as $field) {
             $prefix = strtolower($field["name"]) . ":";
             if (strpos($term, $prefix) === 0) {
                 // Find all member IDs that have field data matching this term.
                 $rows = ET::SQL()->select("DISTINCT memberId")->from("profile_data")->where("fieldId", $field["fieldId"])->where("data LIKE :value")->bind(":value", "%" . trim(substr($term, strlen($prefix))) . "%")->exec()->allRows("memberId");
                 $ids = array_keys($rows);
                 // Add these members to the results.
                 $conditions[] = "m.memberId IN (:field{$k})";
                 $sql->bind(":field{$k}", count($ids) ? $ids : 0);
                 unset($terms[$k]);
                 break;
             }
         }
     }
 }
开发者ID:ky0ncheng,项目名称:esotalk-for-sae,代码行数:21,代码来源:plugin.php

示例9: model

 protected function model()
 {
     return ET::getInstance("pagesModel");
 }
开发者ID:ZerGabriel,项目名称:Pages,代码行数:4,代码来源:PagesAdminController.class.php

示例10: addMainThumb

 /**
  * 一覧データにメイン画像サムネイル表示情報を追加する
  * @param type $results
  */
 private function addMainThumb($results)
 {
     if (!SWC_MAIN_THUMB_DISPLAY) {
         $results;
     }
     $atModel = ET::getInstance("attachmentModel");
     foreach ($results as &$r) {
         // XXX: 一覧メイン画像サムネイル表示処理
         // ※下書きには別アイコンが出るので表示しない
         if (!$r["draft"] && intval($r["countPosts"]) > 0) {
             // 下書きでない、投稿カウントありの場合
             // メイン画像ID取得
             $attachmentId = $atModel->getMainAttachmentId($r["conversationId"]);
             $menuImgUrl = "";
             if ($attachmentId) {
                 // 添付画像あり
                 $menuImgUrl = URL("attachment/menu/" . $attachmentId);
             } else {
                 // デフォルトイメージ画像url
                 $menuImgUrl = SwcUtils::getNoImageFileUrl();
             }
             $r["menuImgUrl"] = $menuImgUrl;
         }
     }
     unset($r);
     return $results;
 }
开发者ID:m-mori,项目名称:forum,代码行数:31,代码来源:ETConversationsController.class.php


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