Wow..... That's cool... Happy to help you.. Let me know what type of app and help you need from my side....
Dear KK,
I tried the mentioned way and could successfully send notifications to mobile device on page save.
Thank you so much.
This is how I tried:
I added a radio button in news.php
- Code: Select all
<cms:editable name="push_noti" label="Push Notification Settings" opt_values='Ignore Notification=0 | Notify Users=1' type='radio' opt_selected = '1' />
Then in kfunctions.php,
- Code: Select all
$FUNCS->add_event_listener( 'page_saved', 'my_page_save_handler');
$FUNCS->add_event_listener( 'page_presave', 'my_pre_save_handler', 10 );
$CTX->global_noti_val = 0;
function my_pre_save_handler( &$page ){
global $CTX;
if( $page->tpl_name == 'news.php' ){
if($page->_fields['push_noti']->get_data() == '1') {
$CTX->global_noti_val = 1;
$page->_fields['push_noti']->store_posted_changes( '0' );
}
}
}
function my_page_save_handler( &$page, &$error_count){
global $CTX;
if( $page->tpl_name=='news.php' ){
if((!$error_count) && ($CTX->global_noti_val == 1)){
$CTX->global_noti_val = 0;
//$name_en = $page->_fields['name_en']->get_data();
// Send Notifcation block
// sendNotification($name_en);
}
}
}
But, now again I need your help here.
I am saving the notification tokens in a cloned page named 'notification_tokens.php'.
I need to iterate through 'notification_tokens.php' page in 'my_page_save_handler' or 'sendNotification' functions to get the notification tokens.
I tried few things in my way, but didn't work out.
Thanks in advance.
--Asha