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


PHP ET::groupModel方法代码示例

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


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

示例1: index

 /**
  * Show and process the settings form.
  *
  * @return void
  */
 public function index()
 {
     // Make an array of languages for the default forum language select.
     $languages = array();
     foreach (ET::getLanguages() as $v) {
         $languages[$v] = ET::$languageInfo[$v]["name"];
     }
     // Get a list of member groups.
     $groups = ET::groupModel()->getAll();
     // Set up the form.
     $form = ETFactory::make("form");
     $form->action = URL("admin/settings");
     // Set the default values for the forum inputs.
     $form->setValue("forumTitle", C("esoTalk.forumTitle"));
     $form->setValue("language", C("esoTalk.language"));
     $form->setValue("forumHeader", C("esoTalk.forumLogo") ? "image" : "title");
     $form->setValue("defaultRoute", C("esoTalk.defaultRoute"));
     $form->setValue("registrationOpen", C("esoTalk.registration.open"));
     $form->setValue("memberListVisibleToGuests", C("esoTalk.members.visibleToGuests"));
     $form->setValue("requireAdminApproval", C("esoTalk.registration.requireAdminApproval"));
     $form->setValue("requireEmailConfirmation", C("esoTalk.registration.requireEmailConfirmation"));
     // If the save button was clicked...
     if ($form->validPostBack("save")) {
         // Construct an array of config options to write.
         $config = array("esoTalk.forumTitle" => $form->getValue("forumTitle"), "esoTalk.language" => $form->getValue("language"), "esoTalk.forumLogo" => $form->getValue("forumHeader") == "image" ? $this->uploadHeaderImage($form) : false, "esoTalk.defaultRoute" => $form->getValue("defaultRoute"), "esoTalk.registration.open" => $form->getValue("registrationOpen"), "esoTalk.registration.requireEmailConfirmation" => $form->getValue("requireEmailConfirmation"), "esoTalk.members.visibleToGuests" => $form->getValue("memberListVisibleToGuests"));
         // Make sure a forum title is present.
         if (!strlen($config["esoTalk.forumTitle"])) {
             $form->error("forumTitle", T("message.empty"));
         }
         if (!$form->errorCount()) {
             ET::writeConfig($config);
             $this->message(T("message.changesSaved"), "success");
             $this->redirect(URL("admin/settings"));
         }
     }
     $this->data("form", $form);
     $this->data("languages", $languages);
     $this->data("groups", $groups);
     $this->title = T("Forum Settings");
     $this->render("admin/settings");
 }
开发者ID:nowaym,项目名称:esoTalk,代码行数:46,代码来源:ETSettingsAdminController.class.php

示例2: action_permissions

 /**
  * Show a sheet to edit a member's permissions by changing their account type and groups.
  *
  * @param int $memberId The member's ID.
  * @return void
  */
 public function action_permissions($memberId = "")
 {
     if (!($member = $this->getMember($memberId))) {
         return;
     }
     // If we don't have permission to change the member's permissions, throw an error.
     if (!ET::memberModel()->canChangePermissions($member)) {
         $this->renderMessage(T("Error"), T("message.noPermission"));
         return;
     }
     // Construct a form.
     $form = ETFactory::make("form");
     $form->action = URL("member/permissions/" . $member["memberId"]);
     // Get a list of all possible account types, groups, and permission types.
     $accounts = array(ACCOUNT_ADMINISTRATOR, ACCOUNT_MEMBER);
     $groups = ET::groupModel()->getAll();
     $permissions = array("view" => T("View"), "reply" => T("Reply"), "start" => T("Start"), "moderate" => T("Moderate"));
     // Set the value of the account field in the form to the member's current account.
     $form->setValue("account", $member["account"]);
     // Get the currently selected account from the form input.
     $currentAccount = $form->getValue("account", $member["account"]);
     if (!in_array($currentAccount, $accounts)) {
         $currentAccount = ACCOUNT_MEMBER;
     }
     // Get the currently selected groups from the form input, and a list of collective group IDs.
     $currentGroups = (array) $form->getValue("groups", array_keys($member["groups"]));
     $groupIds = ET::groupModel()->getGroupIds($currentAccount, $currentGroups);
     // Get a list of all channels and their permissions, which we can use to construct a permissions grid.
     $channels = ET::channelModel()->getAll();
     // Create a list of "extra" permissions (eg. being able to access the admin CP, or suspend members.)
     $extraPermissions = array();
     if ($currentAccount == ACCOUNT_ADMINISTRATOR) {
         $extraPermissions[] = T("Access the administrator control panel.");
     }
     // Work out if they will be able to suspend members by going through each group and checking its permissions.
     $canSuspend = false;
     if ($currentAccount == ACCOUNT_ADMINISTRATOR) {
         $canSuspend = true;
     } else {
         foreach ($currentGroups as $group) {
             if (!empty($groups[$group]["canSuspend"])) {
                 $canSuspend = true;
                 break;
             }
         }
     }
     if ($canSuspend) {
         $extraPermissions[] = T("Suspend members.");
     }
     // Handle a post back from the form.
     $redirectURL = URL(memberURL($member["memberId"], $member["username"]));
     if ($form->isPostBack("cancel")) {
         $this->redirect($redirectURL);
     }
     if ($form->validPostBack("save")) {
         // Save the new account and groups.
         ET::memberModel()->setGroups($member, $currentAccount, $currentGroups);
         // Show a message and redirect.
         $this->message(T("message.changesSaved"), "success autoDismiss");
         $this->redirect($redirectURL);
     }
     // Transport data to the view.
     $this->data("form", $form);
     $this->data("accounts", $accounts);
     $this->data("groups", $groups);
     $this->data("groupIds", $groupIds);
     $this->data("permissions", $permissions);
     $this->data("channels", $channels);
     $this->data("member", $member);
     $this->data("extraPermissions", $extraPermissions);
     // For an ajax request, show permission info.
     if ($this->responseType === RESPONSE_TYPE_AJAX) {
         $this->render("member/permissionInfo");
     } else {
         $this->render("member/permissions");
     }
 }
开发者ID:davchezt,项目名称:fireside,代码行数:83,代码来源:ETMemberController.class.php

示例3: index

 /**
  * Show the member list page.
  *
  * @param string $orderBy What to sort the members by.
  * @param mixed $start Where to start the results from. This can be:
  * 		- An integer, in which case it will be used as a numerical offset.
  * 		- pX, where X is the "page" number.
  * 		- A letter to start from, if $orderBy is "name".
  * @return void
  */
 public function index($orderBy = false, $start = 0)
 {
     // Check if we have permission to view the member list.
     if (!C("esoTalk.members.visibleToGuests") and !ET::$session->user) {
         $this->render404(T("message.pageNotFound"));
         return false;
     }
     // Begin constructing a query to fetch results.
     $sql = ET::SQL()->from("member m");
     // If we've limited results by a search string...
     if ($searchString = R("search")) {
         // Get an array of all groups which we can possibly filter by.
         $groups = ET::groupModel()->getAll();
         $groups[GROUP_ID_ADMINISTRATOR] = array("name" => ACCOUNT_ADMINISTRATOR);
         $groups[GROUP_ID_MEMBER] = array("name" => ACCOUNT_MEMBER);
         $groups[GROUP_ID_GUEST] = array("name" => ACCOUNT_SUSPENDED);
         // If the search string matches any group names, then we'll filter members by their account/group.
         $restrictGroup = false;
         $search = strtolower($searchString);
         foreach ($groups as $id => $group) {
             $name = $group["name"];
             if (strtolower(T("group.{$name}", $name)) == $search or strtolower(T("group.{$name}.plural", $name)) == $search) {
                 $restrictGroup = $id;
                 break;
             }
         }
         // Did we find any matching groups just before? If so, add a WHERE condition to the query to filter by group.
         if ($restrictGroup < 0) {
             $sql->where("account", $groups[$restrictGroup]["name"]);
         } elseif (!$groups[$restrictGroup]["private"] or ET::groupModel()->groupIdsAllowedInGroupIds(ET::$session->getGroupIds(), $restrictGroup, true)) {
             $sql->from("member_group mg", "mg.memberId=m.memberId", "left")->where("mg.groupId", $restrictGroup);
         } else {
             $sql->where("username LIKE :search")->bind(":search", $searchString . "%");
         }
     }
     // Create a query to get the total number of results. Clone the results one to retain the same WHERE conditions.
     $count = clone $sql;
     $count = $count->select("COUNT(m.memberId)")->exec()->result();
     // Make an array of possible orders for the list.
     $orders = array("name" => array(T("Name"), "username ASC"), "posts" => array(T("Posts"), "countPosts DESC"), "activity" => array(T("Last active"), "lastActionTime DESC"));
     // If an invalid orderBy key was provided, just use the first one.
     if (!isset($orders[$orderBy])) {
         $orderBy = reset(array_keys($orders));
     }
     // Work out where to start the results from.
     $page = 0;
     if ($start) {
         // If we're ordering by name and the start argument is a single letter...
         if ($orderBy == "name" and strlen($start) == 1 and ctype_alpha($start)) {
             // Run a query to get the position of the first member starting with this letter.
             $start = ET::SQL()->select("COUNT(memberId)", "position")->from("member")->where("STRCMP(username, :username) = -1")->bind(":username", $start)->exec()->result();
             $start = min($count - C("esoTalk.members.membersPerPage"), $start);
         } elseif ($start[0] == "p") {
             $page = ltrim($start, "p");
             $start = C("esoTalk.members.membersPerPage") * ($page - 1);
         } else {
             $start = (int) $start;
             $page = round($start / C("esoTalk.members.membersPerPage"));
         }
         // Apply the offset to the query.
         $start = max(0, $start);
         $sql->offset($start);
     }
     // Finish constructing the query. We want to get a list of member IDs to show as the results.
     $ids = $sql->select("m.memberId")->limit(C("esoTalk.members.membersPerPage"))->orderBy($orders[$orderBy][1])->exec()->allRows();
     foreach ($ids as &$id) {
         $id = $id["memberId"];
     }
     // Finally, fetch the member data for the members with these IDs.
     if ($ids) {
         $members = ET::memberModel()->getByIds($ids);
     } else {
         $members = array();
     }
     // If we're ordering by last active, filter out members who have opted out of being displayed on the online list.
     if ($orderBy == "activity") {
         foreach ($members as $k => $member) {
             if (!empty($member["preferences"]["hideOnline"])) {
                 unset($members[$k]);
             }
         }
     }
     // If we're doing a normal page load...
     if ($this->responseType === RESPONSE_TYPE_DEFAULT) {
         // Set the title and make sure this page isn't indexed.
         $this->title = T("Member List");
         $this->addToHead("<meta name='robots' content='noindex, noarchive'/>");
         // Work out the canonical URL for this page.
         $url = "members/{$orderBy}/p{$page}";
         $this->canonicalURL = URL($url, true);
//.........这里部分代码省略.........
开发者ID:AlexandrST,项目名称:esoTalk,代码行数:101,代码来源:ETMembersController.class.php

示例4: action_addMember

 /**
  * Add a member to the allowed list of a conversation.
  *
  * @param int $conversationId The ID of the conversation.
  * @return void
  */
 public function action_addMember($conversationId = false)
 {
     if (!$this->validateToken()) {
         return;
     }
     // Get the conversation.
     $model = ET::conversationModel();
     if (!$conversationId) {
         $conversation = $model->getEmptyConversation();
     } elseif (!($conversation = $this->getConversation($conversationId))) {
         return;
     }
     // Do we have permission to do this?
     if (!$conversation["canEditMembersAllowed"]) {
         $this->renderMessage(T("Error"), T("message.noPermission"));
         return;
     }
     if ($name = str_replace(" ", " ", R("member"))) {
         // Get an entity's details by parsing the member name.
         if (!($member = $model->getMemberFromName($name))) {
             $this->message(T("message.memberNotFound"), array("className" => "warning autoDismiss", "id" => "memberNotFound"));
         } elseif (!ET::groupModel()->groupIdsAllowedInGroupIds($member["type"] == "group" ? $member["id"] : $member["groups"], array_keys($conversation["channelPermissionView"]))) {
             $this->message(T("message.memberNoPermissionView"), "warning");
         } else {
             $model->addMember($conversation, $member);
         }
     }
     // Fetch the new list of members allowed in the conversation.
     $conversation["membersAllowed"] = $model->getMembersAllowed($conversation);
     $conversation["membersAllowedSummary"] = $model->getMembersAllowedSummary($conversation, $conversation["membersAllowed"]);
     // If it's an AJAX request, return the contents of a few views.
     if ($this->responseType === RESPONSE_TYPE_AJAX) {
         $this->json("allowedSummary", $this->getViewContents("conversation/membersAllowedSummary", array("conversation" => $conversation)));
         $this->json("allowedList", $this->getViewContents("conversation/membersAllowedList", array("conversation" => $conversation, "editable" => true)));
         $this->json("labels", $this->getViewContents("conversation/labels", array("labels" => $conversation["labels"])));
         $this->render();
     } else {
         $this->redirect(URL(R("return", $conversation["conversationId"] ? "conversation/edit/" . $conversation["conversationId"] : "conversation/start")));
     }
 }
开发者ID:xiaolvmu,项目名称:Techllage,代码行数:46,代码来源:ETConversationController.class.php

示例5: setGroups

 /**
  * Set a member's account and groups.
  *
  * @param array $member The details of the member to set the account/groups for.
  * @param string $account The new account.
  * @param array $groups The new group IDs.
  * @return bool true on success, false on error.
  */
 public function setGroups($member, $account, $groups = array())
 {
     // Make sure the account is valid.
     if (!in_array($account, array(ACCOUNT_MEMBER, ACCOUNT_ADMINISTRATOR, ACCOUNT_SUSPENDED, ACCOUNT_PENDING))) {
         $this->error("account", "invalidAccount");
     }
     if ($this->errorCount()) {
         return false;
     }
     // Set the member's new account.
     $this->updateById($member["memberId"], array("account" => $account));
     // Delete all of the member's existing group associations.
     ET::SQL()->delete()->from("member_group")->where("memberId", $member["memberId"])->exec();
     // Insert new member-group associations.
     $inserts = array();
     foreach ($groups as $id) {
         $inserts[] = array($member["memberId"], $id);
     }
     if (count($inserts)) {
         ET::SQL()->insert("member_group")->setMultiple(array("memberId", "groupId"), $inserts)->exec();
     }
     // Now we need to create a new activity item, and to do that we need the names of the member's groups.
     $groupData = ET::groupModel()->getAll();
     $groupNames = array();
     foreach ($groups as $id) {
         $groupNames[$id] = $groupData[$id]["name"];
     }
     ET::activityModel()->create("groupChange", $member, ET::$session->user, array("account" => $account, "groups" => $groupNames));
     return true;
 }
开发者ID:revskill,项目名称:esoTalk,代码行数:38,代码来源:ETMemberModel.class.php

示例6: action_create

 /**
  * Create a channel.
  *
  * @return void
  */
 public function action_create()
 {
     // Get the channels!
     $channels = ET::channelModel()->getAll();
     // Set up a form!
     $form = ETFactory::make("form");
     $form->action = URL("admin/channels/create");
     // Get a list of groups!
     $groups = ET::groupModel()->getAll();
     // Make a list of the types of permissions!
     $permissions = array("view" => "View", "reply" => "Reply", "start" => "Start", "moderate" => "Moderate");
     // Set which permission checkboxes should be checked on the form!
     $form->setValue("permissions[" . GROUP_ID_GUEST . "][view]", 1);
     $form->setValue("permissions[" . GROUP_ID_MEMBER . "][view]", 1);
     $form->setValue("permissions[" . GROUP_ID_MEMBER . "][reply]", 1);
     $form->setValue("permissions[" . GROUP_ID_MEMBER . "][start]", 1);
     // If the form was submitted...
     if ($form->validPostBack("save")) {
         // Save the channel's information.
         $model = ET::channelModel();
         $channelId = $model->create(array("title" => $form->getValue("title"), "slug" => $form->getValue("slug"), "description" => $form->getValue("description"), "attributes" => array("defaultUnsubscribed" => $form->getValue("defaultUnsubscribed"))));
         // If there were errors, pass them on to the form.
         if ($model->errorCount()) {
             $form->errors($model->errors());
         } else {
             // Set the channel's permissions.
             $model->setPermissions($channelId, $form->getValue("permissions"));
             $this->message(T("message.changesSaved"), "success autoDismiss");
             $this->redirect(URL("admin/channels"));
         }
     }
     // Overuse of exclamation marks!
     $this->data("channels", $channels);
     $this->data("channel", false);
     $this->data("groups", $groups);
     $this->data("permissions", $permissions);
     $this->data("form", $form);
     $this->render("admin/editChannel");
 }
开发者ID:19eighties,项目名称:esoTalk,代码行数:44,代码来源:ETChannelsAdminController.class.php

示例7: addPermissionPredicate

 /**
  * Add a WHERE predicate to an SQL query which makes sure only rows for which the user has the specified
  * permission are returned.
  *
  * @param ETSQLQuery $sql The SQL query to add the predicate to.
  * @param string $field The name of the permission to check for.
  * @param array $member The member to filter out channels for. If not specified, the currently
  * 		logged-in user will be used.
  * @param string $table The channel table alias used in the SQL query.
  * @return void
  */
 public function addPermissionPredicate(&$sql, $field = "view", $member = false, $table = "c")
 {
     // If no member was specified, use the current user.
     if (!$member) {
         $member = ET::$session->user;
     }
     // Get an array of group IDs for this member.
     $groups = ET::groupModel()->getGroupIds($member["account"], array_keys((array) $member["groups"]));
     // If the user is an administrator, don't add any SQL, as admins can do anything!
     if (in_array(GROUP_ID_ADMINISTRATOR, $groups)) {
         return;
     }
     // Construct a query that will fetch all channelIds for which this member has the specified permission.
     $query = ET::SQL()->select("channelId")->from("channel_group")->where("groupId IN (:groups)")->where("{$field}=1")->get();
     // Add this as a where clause to the SQL query.
     $sql->where("{$table}.channelId IN ({$query})")->bind(":groups", $groups, PDO::PARAM_INT);
 }
开发者ID:nowaym,项目名称:esoTalk,代码行数:28,代码来源:ETChannelModel.class.php

示例8: getMemberFromName

 /**
  * Given a name (intended to be the input of the "add members allowed" form), this function finds a matching
  * group or member and returns an array of its details to be used in addMember().
  *
  * @param string $name The input.
  * @return bool|array Returns an array of the entity's details (in the same format as getMembersAllowed()),
  * 		or false if no entity was found.
  */
 public function getMemberFromName($name)
 {
     $memberId = $memberName = false;
     // Get a list of all member groups, and add administrators + members to it.
     $groups = ET::groupModel()->getAll();
     $groups[GROUP_ID_ADMINISTRATOR] = array("name" => ACCOUNT_ADMINISTRATOR);
     $groups[GROUP_ID_MEMBER] = array("name" => ACCOUNT_MEMBER);
     // Go through each of the groups and see if one of them matches the name. If so, return its details.
     $lowerName = strtolower($name);
     foreach ($groups as $id => $group) {
         $group = $group["name"];
         if ($lowerName == strtolower(T("group.{$group}.plural", $group)) or $lowerName == strtolower($group)) {
             return array("type" => "group", "id" => $id, "name" => $group);
         }
     }
     // Otherwise, search for a member in the database with a matching name.
     $name = str_replace("%", "", $name);
     $result = ET::SQL()->select("m.memberId")->select("m.username")->select("m.avatarFormat")->select("m.account")->select("GROUP_CONCAT(g.groupId)", "groups")->from("member m")->from("member_group g", "m.memberId=g.memberId", "left")->where("m.username=:name OR m.username LIKE :nameLike")->bind(":name", $name)->bind(":nameLike", $name . "%")->groupBy("m.memberId")->orderBy("m.username=:nameOrder DESC")->bind(":nameOrder", $name)->limit(1)->exec();
     if (!$result->numRows()) {
         return false;
     }
     // Get the result and return it as an array.
     $row = $result->firstRow();
     $row["groups"] = ET::groupModel()->getGroupIds($row["account"], explode(",", $row["groups"]));
     return array("type" => "member", "id" => $row["memberId"], "name" => $row["username"], "avatarFormat" => $row["avatarFormat"], "groups" => $row["groups"]);
 }
开发者ID:nowaym,项目名称:esoTalk,代码行数:34,代码来源:ETConversationModel.class.php

示例9: foreach

</tr></thead>
<tbody>
<?php 
foreach ($data["channels"] as $channel) {
    ?>
<tr>
<th><span class='depth<?php 
    echo $channel["depth"];
    ?>
'><?php 
    echo $channel["title"];
    ?>
</span></th>
<?php 
    foreach ($data["permissions"] as $k => $v) {
        $allowed = ET::groupModel()->groupIdsAllowedInGroupIds($data["groupIds"], $channel["permissions"][$k], true);
        ?>
<td class='<?php 
        echo $allowed ? "yes" : "no";
        ?>
'><?php 
        echo $allowed ? T("Yes") : T("No");
        ?>
</td><?php 
    }
    ?>
</tr>
<?php 
}
?>
</tbody>
开发者ID:jackpothecary,项目名称:PolycodeSite,代码行数:31,代码来源:permissionInfo.php

示例10: action_index

 /**
  * Show and process the settings form.
  *
  * @return void
  */
 public function action_index()
 {
     // Make an array of languages for the default forum language select.
     $languages = array();
     foreach (ET::getLanguages() as $v) {
         $languages[$v] = ET::$languageInfo[$v]["name"];
     }
     // Get a list of member groups.
     $groups = ET::groupModel()->getAll();
     // Set up the form.
     $form = ETFactory::make("form");
     $form->action = URL("admin/settings");
     // Set the default values for the forum inputs.
     $form->setValue("forumTitle", C("esoTalk.forumTitle"));
     $form->setValue("language", C("esoTalk.language"));
     $form->setValue("forumHeader", C("esoTalk.forumLogo") ? "image" : "title");
     $form->setValue("defaultRoute", C("esoTalk.defaultRoute"));
     $form->setValue("forumVisibleToGuests", C("esoTalk.visibleToGuests"));
     $form->setValue("memberListVisibleToGuests", C("esoTalk.members.visibleToGuests"));
     $form->setValue("registrationOpen", C("esoTalk.registration.open"));
     $form->setValue("requireConfirmation", C("esoTalk.registration.requireConfirmation"));
     $c = C("esoTalk.conversation.editPostTimeLimit");
     if ($c === -1) {
         $form->setValue("editPostMode", "forever");
     } elseif ($c === "reply") {
         $form->setValue("editPostMode", "reply");
     } else {
         $form->setValue("editPostMode", "custom");
         $form->setValue("editPostTimeLimit", $c);
     }
     // If the save button was clicked...
     if ($form->validPostBack("save")) {
         // Construct an array of config options to write.
         $config = array("esoTalk.forumTitle" => $form->getValue("forumTitle"), "esoTalk.language" => $form->getValue("language"), "esoTalk.forumLogo" => $form->getValue("forumHeader") == "image" ? $this->uploadHeaderImage($form) : false, "esoTalk.defaultRoute" => $form->getValue("defaultRoute"), "esoTalk.visibleToGuests" => $form->getValue("forumVisibleToGuests"), "esoTalk.members.visibleToGuests" => $form->getValue("forumVisibleToGuests") and $form->getValue("memberListVisibleToGuests"), "esoTalk.registration.open" => $form->getValue("registrationOpen"), "esoTalk.registration.requireConfirmation" => in_array($v = $form->getValue("requireConfirmation"), array(false, "email", "approval")) ? $v : false);
         switch ($form->getValue("editPostMode")) {
             case "forever":
                 $config["esoTalk.conversation.editPostTimeLimit"] = -1;
                 break;
             case "reply":
                 $config["esoTalk.conversation.editPostTimeLimit"] = "reply";
                 break;
             case "custom":
                 $config["esoTalk.conversation.editPostTimeLimit"] = (int) $form->getValue("editPostTimeLimit");
                 break;
         }
         // Make sure a forum title is present.
         if (!strlen($config["esoTalk.forumTitle"])) {
             $form->error("forumTitle", T("message.empty"));
         }
         if (!$form->errorCount()) {
             ET::writeConfig($config);
             $this->message(T("message.changesSaved"), "success autoDismiss");
             $this->redirect(URL("admin/settings"));
         }
     }
     $this->data("form", $form);
     $this->data("languages", $languages);
     $this->data("groups", $groups);
     $this->title = T("Forum Settings");
     $this->render("admin/settings");
 }
开发者ID:19eighties,项目名称:esoTalk,代码行数:66,代码来源:ETSettingsAdminController.class.php

示例11: getGroupIds

 /**
  * Get a list of group IDs which the current user is in.
  *
  * @return array
  */
 public function getGroupIds()
 {
     if ($this->user) {
         return ET::groupModel()->getGroupIds($this->user["account"], array_keys($this->user["groups"]));
     } else {
         return ET::groupModel()->getGroupIds(false, false);
     }
 }
开发者ID:AlexandrST,项目名称:esoTalk,代码行数:13,代码来源:ETSession.class.php

示例12: action_index

 /**
  * Show the member list page.
  *
  * @param string $orderBy What to sort the members by.
  * @param mixed $start Where to start the results from. This can be:
  * 		- An integer, in which case it will be used as a numerical offset.
  * 		- pX, where X is the "page" number.
  * 		- A letter to start from, if $orderBy is "name".
  * @return void
  */
 public function action_index($orderBy = false, $start = 0)
 {
     if (!$this->allowed("esoTalk.members.visibleToGuests")) {
         return;
     }
     // Begin constructing a query to fetch results.
     $sql = ET::SQL()->from("member m");
     // If we've limited results by a search string...
     if ($searchString = R("search")) {
         // Explode separate terms by the plus character.
         $terms = explode("+", $searchString);
         // Get an array of all groups which we can possibly filter by.
         $groups = ET::groupModel()->getAll();
         $groups[GROUP_ID_ADMINISTRATOR] = array("name" => ACCOUNT_ADMINISTRATOR);
         $groups[GROUP_ID_MEMBER] = array("name" => ACCOUNT_MEMBER);
         $groups[GROUP_ID_GUEST] = array("name" => ACCOUNT_SUSPENDED);
         $conditions = array();
         $this->trigger("parseTerms", array(&$terms, $sql, &$conditions));
         foreach ($terms as $k => $term) {
             $term = mb_strtolower(trim($term), "UTF-8");
             if (!$term) {
                 continue;
             }
             $thisCondition = array();
             // If the search string matches the start of any group names, then we'll filter members by their account/group.
             $group = false;
             foreach ($groups as $id => $g) {
                 $name = $g["name"];
                 if (strpos(mb_strtolower(T("group.{$name}", $name), "UTF-8"), $term) === 0 or strpos(mb_strtolower(T("group.{$name}.plural", $name), "UTF-8"), $term) === 0) {
                     $group = $id;
                     break;
                 }
             }
             // Did we find any matching groups just before? If so, add a WHERE condition to the query to filter by group.
             if ($group !== false) {
                 if ($group < 0) {
                     $thisCondition[] = "account=:account{$k}";
                     $sql->bind(":account{$k}", $groups[$group]["name"]);
                 } elseif (!$groups[$group]["private"] or ET::groupModel()->groupIdsAllowedInGroupIds(ET::$session->getGroupIds(), $group, true)) {
                     $sql->from("member_group mg", "mg.memberId=m.memberId", "left");
                     $thisCondition[] = "mg.groupId=:group{$k}";
                     $sql->bind(":group{$k}", $group);
                 }
             }
             // Also perform a normal LIKE search.
             $thisCondition[] = "username LIKE :search{$k}";
             $sql->bind(":search{$k}", "%" . $term . "%");
             $conditions[] = "(" . implode(" OR ", $thisCondition) . ")";
         }
         $sql->where(implode(" AND ", $conditions));
     }
     // Create a query to get the total number of results. Clone the results one to retain the same WHERE conditions.
     $count = clone $sql;
     $count = $count->select("COUNT(m.memberId)")->exec()->result();
     // Make an array of possible orders for the list.
     $orders = array("name" => array(T("Name"), "username ASC"), "posts" => array(T("Posts"), "countPosts DESC"), "activity" => array(T("Last active"), "lastActionTime DESC"));
     // If an invalid orderBy key was provided, just use the first one.
     if (!isset($orders[$orderBy])) {
         $orderBy = reset(array_keys($orders));
     }
     // Work out where to start the results from.
     $page = 0;
     if ($start) {
         // If we're ordering by name and the start argument is a single letter...
         if ($orderBy == "name" and strlen($start) == 1 and ctype_alpha($start)) {
             // Run a query to get the position of the first member starting with this letter.
             $start = ET::SQL()->select("COUNT(memberId)", "position")->from("member")->where("STRCMP(username, :username) = -1")->bind(":username", $start)->exec()->result();
             $start = min($count - C("esoTalk.members.membersPerPage"), $start);
         } elseif ($start[0] == "p") {
             $page = ltrim($start, "p");
             $start = C("esoTalk.members.membersPerPage") * ($page - 1);
         } else {
             $start = (int) $start;
             $page = round($start / C("esoTalk.members.membersPerPage"));
         }
         // Apply the offset to the query.
         $start = max(0, $start);
         $sql->offset($start);
     }
     // Finish constructing the query. We want to get a list of member IDs to show as the results.
     $ids = $sql->select("m.memberId")->limit(C("esoTalk.members.membersPerPage"))->orderBy($orders[$orderBy][1])->exec()->allRows();
     foreach ($ids as &$id) {
         $id = $id["memberId"];
     }
     // Finally, fetch the member data for the members with these IDs.
     if ($ids) {
         $members = ET::memberModel()->getByIds($ids);
     } else {
         $members = array();
     }
//.........这里部分代码省略.........
开发者ID:davchezt,项目名称:fireside,代码行数:101,代码来源:ETMembersController.class.php

示例13: install

 /**
  * Perform a fresh installation of the esoTalk database. Create the table structure and insert default data.
  *
  * @param array $info An array of information gathered from the installation form.
  * @return void
  */
 public function install($info)
 {
     // Create the table structure.
     $this->structure(true);
     // 2016/02 インストール時処理 修正
     // admin ユーザ登録は不要
     //	// Create the administrator member.
     //	$member = array(
     //		"username" => $info["adminUser"],
     //		"email" => $info["adminEmail"],
     //		"password" => $info["adminPass"],
     //		"account" => "Administrator",
     //		"confirmed" => true
     //	);
     //	ET::memberModel()->create($member);
     //
     //	// Set the session's userId and user information variables to the administrator, so that all entities
     //	// created below will be created by the administrator user.
     //	ET::$session->userId = 1;
     //	ET::$session->user = ET::memberModel()->getById(1);
     // Create the moderator group.
     ET::groupModel()->create(array("name" => "Moderator", "canSuspend" => true));
     // Create the General Discussion channel.
     $id = ET::channelModel()->create(array("title" => "全般", "slug" => slug("General Discussion")));
     ET::channelModel()->setPermissions($id, array(GROUP_ID_GUEST => array("view" => true), GROUP_ID_MEMBER => array("view" => true, "reply" => true, "start" => true), 1 => array("view" => true, "reply" => true, "start" => true, "moderate" => true)));
     // Create the Staff Only channel.
     $id = ET::channelModel()->create(array("title" => "Staff Only", "slug" => slug("Staff Only")));
     ET::channelModel()->setPermissions($id, array(1 => array("view" => true, "reply" => true, "start" => true, "moderate" => true)));
     // Set the flood control config setting to zero so that we can create two conversations in a row.
     ET::$config["esoTalk.conversation.timeBetweenPosts"] = 0;
     // Create a welcome conversation.
     ET::conversationModel()->create(array("title" => "Welcome to " . $info["forumTitle"] . "!", "content" => "[b]Welcome to " . $info["forumTitle"] . "![/b]\n\n" . $info["forumTitle"] . " is powered by [url=http://esotalk.org]esoTalk[/url], the simple, fast, free web-forum.\n\nFeel free to edit or delete this conversation. Otherwise, it's time to get posting!\n\nAnyway, good luck, and we hope you enjoy using esoTalk.", "channelId" => 1));
     // Create a helpful private conversation with the administrator.
     ET::conversationModel()->create(array("title" => "Pssst! Want a few tips?", "content" => "Hey {$info["adminUser"]}, congrats on getting esoTalk installed!\n\nCool! Your forum is now good-to-go, but you might want to customize it with your own logo, design, and settings—so here's how.\n\n[h]Changing the Logo[/h]\n\n1. Go to the [url=" . C("esoTalk.baseURL") . "admin/settings]Forum Settings[/url] section of your administration panel.\n2. Select 'Show an image in the header' for the 'Forum header' setting.\n3. Find and select the image file you wish to use.\n4. Click 'Save Changes'. The logo will automatically be resized so it fits nicely in the header.\n\n[h]Changing the Appearance[/h]\n\n1. Go to the [url=" . C("esoTalk.baseURL") . "admin/appearance]Appearance[/url] section of your administration panel.\n2. Choose colors for the header, page background, or select a background image. (More skins will be available soon.)\n3. Click 'Save Changes', and your forum's appearance will be updated!\n\n[h]Managing Channels[/h]\n\n'Channels' are a way to categorize conversations in your forum. You can create as many or as few channels as you like, nest them, and give them custom permissions.\n\n1. Go to the [url=" . C("esoTalk.baseURL") . "admin/channels]Channels[/url] section of your administration panel.\n2. Click 'Create Channel' and fill out a title, description, and select permissions to add a new channel.\n3. Drag and drop channels to rearrange and nest them.\n\n[h]Getting Help[/h]\n\nIf you need help, come and give us a yell at the [url=http://esotalk.org/forum]esoTalk Support Forum[/url]. Don't worry—we don't bite!", "channelId" => 1), array(array("type" => "member", "id" => 1)));
     // All done!
 }
开发者ID:m-mori,项目名称:forum,代码行数:42,代码来源:ETUpgradeModel.class.php

示例14: action_delete

 /**
  * Delete a group.
  *
  * @param int $groupId The ID of the group to delete.
  * @return void
  */
 public function action_delete($groupId = "")
 {
     if (!$this->validateToken()) {
         return;
     }
     // Get this group's details. If it doesn't exist, show an error.
     if (!($group = ET::groupModel()->getById((int) $groupId))) {
         $this->render404();
         return;
     }
     ET::groupModel()->deleteById($group["groupId"]);
     $this->redirect(URL("admin/groups"));
 }
开发者ID:19eighties,项目名称:esoTalk,代码行数:19,代码来源:ETGroupsAdminController.class.php


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