Pommo_Subscribers::getSubscribersHits PHP Method

getSubscribersHits() public method

Returns all the subscribers in the database and if they have opened the passed mailing id
public getSubscribersHits ( $mailing ) : array
return array $subscribers.- Subscribers and if they have opened mailing
    public function getSubscribersHits($mailing)
    {
        $mailing = (int) $mailing;
        $dbo = Pommo::$_dbo;
        $query = 'SELECT
                s.email,
                s.status,
                h.hit_date
            FROM
                ' . $dbo->table['subscribers'] . ' s
            LEFT JOIN
                ' . $dbo->table['mailings_hits'] . ' h
            ON
                (s.subscriber_id = h.subscriber_id
                && h.mailing_id = ' . $mailing . ')
            ORDER BY
                s.email';
        $subscribers = array();
        $subscribers = $dbo->getAll($query);
        return $subscribers;
    }

Usage Example

コード例 #1
0
ファイル: export_hits.php プロジェクト: soonick/poMMo
 *  poMMo is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Pommo.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  This fork is from https://github.com/soonick/poMMo
 *  Please see docs/contribs for Contributors
 *
 * @author Adrian Ancona<*****@*****.**>
 */
/**********************************
    INITIALIZATION METHODS
*********************************/
require 'bootstrap.php';
Pommo::init();
require_once Pommo::$_baseDir . 'classes/Pommo_Subscribers.php';
$subscribers = new Pommo_Subscribers();
$hits = $subscribers->getSubscribersHits($_GET['mailing']);
/**********************************
    SETUP TEMPLATE, PAGE
 *********************************/
require_once Pommo::$_baseDir . 'classes/Pommo_Template.php';
$view = new Pommo_Template();
/**********************************
    DISPLAY METHODS
*********************************/
$view->assign('hits', $hits);
$view->display('admin/mailings/export_hits');