예제 #1
0
function send_delete_team_email(Team $team)
{
    $members = get_team_member_id_by_team_id($team->team_id);
    foreach ($members as $member) {
        $template = get_template('team_deleted');
        $mail = email_init();
        $member_id = $member["id"];
        $member_name = $member["name"];
        $member_email = get_team_member_email_by_id($member_id);
        $mail->addAddress($member_email);
        $mail->Subject = 'Team Deleted - Online Birthday Manager';
        $body = str_replace("{first_name}", $member_name, $template);
        $body = str_replace("{team_name}", get_team_name_by_team_id($team->team_id), $body);
        $body = str_replace("{team_admin}", get_team_member_name_by_team_member_id(get_team_admin_id_by_team_id($team->team_id)), $body);
        $mail->Body = $body;
        $GLOBALS['enable_email'] == true ? $mail->send() : "";
    }
}
예제 #2
0
function search_teams($search_term)
{
    $connection = connect();
    $sql = "SELECT team_id, team_name, team_admin_id FROM team WHERE deleted = 0 and team_name like '%" . $search_term . "%'";
    $result = $connection->query($sql);
    disconnect($connection);
    $team_detail_list = array();
    if ($result->num_rows > 0) {
        $team_detail = array();
        while ($row = $result->fetch_assoc()) {
            $team_detail[] = array('id' => $row["team_id"], 'name' => $row["team_name"], 'admin_id' => $row["team_admin_id"], 'admin_name' => get_team_member_name_by_team_member_id($row["team_admin_id"]), 'fund_balance' => get_team_fund_by_team_id($row["team_id"]), 'member_id' => get_team_member_id_by_team_id($row["team_id"]));
        }
        $team_detail_list = $team_detail;
    }
    return $team_detail_list;
}