Example #1
0
 public function init()
 {
     ET::define("gambit.bookmarked", "bookmarked");
     ET::define("label.bookmarked", "Bookmarked");
     ET::conversationModel();
     ETConversationModel::addLabel("bookmarked", "IF(s.bookmarked=1,1,0)", "icon-bookmark");
 }
Example #2
0
 public function init()
 {
     ET::conversationModel();
     ETConversationModel::addLabel("none", "IF(c.status = NULL,1,0)");
     ETConversationModel::addLabel("added", "IF(c.status = 1,1,0)", "icon-check");
     ETConversationModel::addLabel("considered", "IF(c.status = 2,1,0)", "icon-question-sign");
     ETConversationModel::addLabel("rejected", "IF(c.status = 3,1,0)", "icon-thumbs-down");
     ETConversationModel::addLabel("fixed", "IF(c.status = 4,1,0)", "icon-cogs");
     ETConversationModel::addLabel("inprogress", "IF(c.status = 5,1,0)", "icon-wrench");
     ETConversationModel::addLabel("nobug", "IF(c.status = 6,1,0)", "icon-thumbs-up");
     ETConversationModel::addLabel("highpriority", "IF(c.status = 7,1,0)", "icon-circle");
     ETConversationModel::addLabel("lowpriority", "IF(c.status = 8,1,0)", "icon-circle-blank");
     ET::define("label.none", "No Status");
     ET::define("label.added", "Added");
     ET::define("label.considered", "Considered");
     ET::define("label.rejected", "Rejected");
     ET::define("label.fixed", "Fixed");
     ET::define("label.inprogress", "In Progress");
     ET::define("label.nobug", "Not a Bug");
     ET::define("label.highpriority", "High Priority");
     ET::define("label.lowpriority", "Low Priority");
 }
    protected function privateAddNotification($conversation, $memberIds, $notifyAll = false)
    {
        $memberIds = (array) $memberIds;
        // Remove the currently logged in user from the list of member IDs.
        if (($k = array_search(ET::$session->userId, $memberIds)) !== false) {
            unset($memberIds[$k]);
        }
        if (!count($memberIds)) {
            return;
        }
        // Get the member details for this list of member IDs.
        $sql = ET::SQL()->from("member_conversation s", "s.conversationId=:conversationId AND s.type='member' AND s.id=m.memberId", "left")->bind(":conversationId", $conversation["conversationId"])->where("m.memberId IN (:memberIds)")->bind(":memberIds", $memberIds);
        // Only get members where the member_conversation row doesn't exist (implying that this is the first time
        // they've been added to the conversation.)
        if (!$notifyAll) {
            $sql->where("s.id IS NULL");
        }
        $members = ET::memberModel()->getWithSQL($sql);
        $data = array("conversationId" => $conversation["conversationId"], "title" => $conversation["title"]);
        foreach ($members as $member) {
            ET::activityModel()->create("privateAdd", $member, ET::$session->user, $data);
        }
    }
}
// Add default labels.
ETConversationModel::addLabel("sticky", "IF(c.sticky=1,1,0)");
ETConversationModel::addLabel("private", "IF(c.private=1,1,0)");
ETConversationModel::addLabel("locked", "IF(c.locked=1,1,0)");
ETConversationModel::addLabel("draft", "IF(s.draft IS NOT NULL,1,0)");
ETConversationModel::addLabel("muted", "IF(s.muted=1,1,0)");
        $sql = ET::SQL()->from("member_conversation s", "s.conversationId=:conversationId AND s.type='member' AND s.id=m.memberId", "left")->bind(":conversationId", $conversation["conversationId"])->where("m.memberId IN (:memberIds)")->bind(":memberIds", $memberIds);
        // Only get members where the member_conversation row doesn't exist (implying that this is the first time
        // they've been added to the conversation.)
        if (!$notifyAll) {
            $sql->where("s.id IS NULL");
        }
        $members = ET::memberModel()->getWithSQL($sql);
        $data = array("conversationId" => $conversation["conversationId"], "title" => $conversation["title"]);
        $emailData = array("content" => $content);
        // Create the "privateAdd" activity which will send out a notification and an email if appropriate.
        // Also get IDs of members who would like to automatically follow this conversation.
        $followIds = array();
        foreach ($members as $member) {
            ET::activityModel()->create("privateAdd", $member, ET::$session->user, $data, $emailData);
            if (!empty($member["preferences"]["starPrivate"])) {
                $followIds[] = $member["memberId"];
            }
        }
        // Follow the conversation for the appropriate members.
        if (!empty($followIds)) {
            $this->setStatus($conversation["conversationId"], $followIds, array("starred" => true));
        }
    }
}
// Add default labels.
ETConversationModel::addLabel("sticky", "IF(c.sticky=1,1,0)", "icon-pushpin");
ETConversationModel::addLabel("private", "IF(c.private=1,1,0)", "icon-envelope-alt");
ETConversationModel::addLabel("locked", "IF(c.locked=1,1,0)", "icon-lock");
ETConversationModel::addLabel("draft", "IF(s.draft IS NOT NULL,1,0)", "icon-pencil");
ETConversationModel::addLabel("ignored", "IF(s.ignored=1,1,0)", "icon-eye-close");
Example #5
0
 public function init()
 {
     ET::conversationModel();
     ETConversationModel::addLabel("answered", "IF(c.answered > 0,1,0)", "icon-ok-sign");
     ET::define("label.answered", "Answered");
 }