Rev 19372 | Rev 20464 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<div class="container"><?php echo $this->Form->create('NotificationCampaign'); ?><div class="row"><div class="col-lg-12"><h3>Raw sql to fetch users</h3><?php echo $this->Form->input('sql',array('type'=>'textarea','id'=>'UserSql'));?></div></div><div class="mt20 row"><!--<div class="col-lg-10 updatesql">SELECT User.id,User.email,Brand.brand FROM users User LEFT JOIN brand_preferences Brand ON User.id = Brand.user_id WHERE (Brand.brand = 'Micromax' AND Brand.category_id = 3) OR Brand.brand IS NULL</div>--><ul class="list list-unstyled sqlrules"><li><div class="label label-info">Unique users with brand preferences set as Micromax or not set at all</div><div class="clearfix"></div><div class="col-lg-10 updatesql">SELECT User.id, User.email, Brand.brand FROM users User LEFT JOIN brand_preferences Brand ON User.id = Brand.user_id LEFT JOIN devices d ON d.user_id = User.id WHERE (Brand.brand = 'Micromax' AND Brand.category_id =3) OR Brand.brand IS NULL GROUP BY d.imeinumber order by User.id DESC</div><div class="col-lg-2"><button type="button" class="btn btn-primary sqlslecter">Use This</button></div></li><li><div class="label label-info">All unique Users</div><div class="clearfix"></div><div class="col-lg-10 updatesql">SELECT distinct User.id,User.email FROM users User LEFT JOIN devices d ON d.user_id = User.id GROUP BY d.imeinumber order by User.id DESC</div><div class="col-lg-2"><button type="button" class="btn btn-primary sqlslecter">Use This</button></div></li><li><div class="label label-info">Unique users with price preferences set in range of 5000 or not set at all</div><div class="clearfix"></div><div class="col-lg-10 updatesql">SELECT User.id, User.email, ifnull(P.min_price,0), ifnull(P.max_price,0) FROM users User LEFT JOIN price_preferences P ON User.id = P.user_id LEFT JOIN devices d ON d.user_id = User.id WHERE (P.min_price <= 5000 AND P.max_price >= 5000 AND P.category_id =3) OR P.min_price is NULL GROUP BY d.imeinumber order by User.id DESC</div><div class="col-lg-2"><button type="button" class="btn btn-primary sqlslecter">Use This</button></div></li><li><div class="label label-info">Unique users with Samsung in brand preferences or clicks or filters or search terms or orders</div><div class="clearfix"></div><div class="col-lg-10 updatesql">select User.id from users User LEFT JOIN devices d ON d.user_id = User.id where User.id in (select userids from pushnotificationusergroups where brand = 'Samsung') GROUP BY d.imeinumber order by User.id DESC</div><div class="col-lg-2"><button type="button" class="btn btn-primary sqlslecter">Use This</button></div></li><li><div class="label label-info">Unique users with Samsung in brand preferences or clicks or filters or search terms or orders and price preference in range of 5000</div><div class="clearfix"></div><div class="col-lg-10 updatesql">select User.id from users User LEFT JOIN devices d ON d.user_id = User.id where User.id in (select userids from pushnotificationusergroups where brand = 'Samsung' and category_id = 3 and min_price < 5000 and 5000 < max_price) GROUP BY d.imeinumber order by User.id DESC</div><div class="col-lg-2"><button type="button" class="btn btn-primary sqlslecter">Use This</button></div></li><li><div class="label label-info">Unique users with Samsung in brand preferences or clicks or filters or search terms or orders or product views</div><div class="clearfix"></div><div class="col-lg-10 updatesql">select User.id from users User LEFT JOIN devices d ON d.user_id = User.id where User.id in (select distinct user_id from newuserlinkssegmentation where brand = 'Samsung') GROUP BY d.imeinumber order by User.id DESC</div><div class="col-lg-2"><button type="button" class="btn btn-primary sqlslecter">Use This</button></div></li></ul></div><div class="row"><h3>Enter message</h3><?php //echo $this->Form->create('User',array('action'=>'push')); ?><?php echo $this->Form->input('name',array('label'=>'Campaign Name','required'=>true));?><?php echo $this->Form->input('title');?><?php echo $this->Form->input('message');?><?php echo $this->Form->input('notification_long_text',array('type'=>'textarea','id'=>'notification_long_text'));?><?php echo $this->Form->input('type',array('type'=>'select','options' => array('url'=>'Url','native'=>'Native','update'=>'Update')));?><?php echo $this->Form->input('url');?><?php echo $this->Form->input('expiresat',array('type'=>'datetime'));?><?php echo $this->Form->input('sendsms',array('type'=>'checkbox'));?><?php $notitype=array("GENERAL_NOTIFICATION"=>"GENERAL_NOTIFICATION","BATCH_CREDIT"=>"BATCH_CREDIT");echo $this->Form->input('notification_type', array('options'=>$notitype, 'selected'=>'GENERAL_NOTIFICATION'));?><?php echo $this->Form->input('messagetext', array('size'=>130,'maxlength'=>130,'placeholder'=>' Max Length 130 Character(s)'));?><button type="submit" class="btn btn-success btn-block notifyusers">Send</button></div><?php echo $this->Form->end();?></div>