当前位置: 首页>>代码示例>>PHP>>正文


PHP send_notification函数代码示例

本文整理汇总了PHP中send_notification函数的典型用法代码示例。如果您正苦于以下问题:PHP send_notification函数的具体用法?PHP send_notification怎么用?PHP send_notification使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了send_notification函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: invite

 /**
  * As a participant, invite another user to an event
  * params :
  *    idEvent : id of the event to invite someone to
  *    idGuest : id of the user to invite to the event
  */
 function invite($idEvent, $idGuest)
 {
     if ($this->session->userdata('logged_in')) {
         $event = $this->event->get_event($idEvent);
         if ($this->event->is_participation($idGuest, $idEvent) == 0) {
             //inviting the user
             if ($event->organizer == $this->session->userdata('logged_in')['id']) {
                 $this->event->send_invitation($idGuest, $idEvent);
                 $aResult['result'] = 'success';
                 send_notification("Invitation : " . $event->name, 'Tu as reçu une invitation à ' . $event->name . '<a class="list_contact" href="' . base_url('details_event/index/' . $idEvent) . '">Voir l\'évènement</a>', $this->session->userdata('logged_in')['id'], $idGuest, true);
                 //sending a proposition of invitation to the organizer
             } else {
                 if ($event->invitation_suggestion_allowed == 1 && $this->event->is_participation($this->session->userdata('logged_in')['id'], $idEvent) == 1) {
                     $this->load->model('user', '', TRUE);
                     $guest = $this->user->get_user($idGuest);
                     $aResult['result'] = 'success';
                     send_notification("Suggestion d'invitation : " . $guest->firstname . ' ' . $guest->surname, $this->session->userdata('logged_in')['firstname'] . ' ' . $this->session->userdata('logged_in')['surname'] . ' te propose d\'inviter ' . $guest->firstname . ' ' . $guest->surname . ' à ton évènement.</br><a href="' . base_url('details_event/invite/' . $idEvent . '/' . $idGuest) . '">Inviter ' . $guest->firstname . ' ' . $guest->surname . '</a><a class="list_contact" href="' . base_url('details_event/index/' . $idEvent) . '">Voir l\'évènement</a>', $this->session->userdata('logged_in')['id'], $event->organizer, true);
                 } else {
                     $aResult['error'] = 'pas autorisé';
                 }
             }
         } else {
             $aResult['error'] = 'pas autorisé';
         }
     } else {
         $aResult['error'] = 'pas connecté';
     }
     echo json_encode($aResult);
 }
开发者ID:sarrab,项目名称:CrazEvent,代码行数:35,代码来源:details_event.php

示例2: event_desk_author_user

 function event_desk_author_user($desk_id)
 {
     // Автор действия не должен получать уведомления о каких-то изменениях;
     if (get_desk_author_user($desk_id) != $_SESSION['user_id'] && get_desk_author_user($desk_id) != '') {
         send_notification(get_desk_author_user($desk_id), 'В заявке №' . $desk_id . ' произошли новые события<br>Нажмите для перехода в список заявок.', 'service_desk', '', '1', $desk_id);
     }
 }
开发者ID:uvaron,项目名称:BDparser,代码行数:7,代码来源:service_desk_old.php

示例3: send_message

function send_message($message)
{
    if ($message != 'Device Armed' && $message != 'Device Disarmed' && $message != 'Device Unlocked' && $message != 'Device Locked') {
        $message .= ' just opened the door';
    }
    $devices = get_all_device();
    foreach ($devices as $row) {
        $reg_id = $row->gcm_regid;
        $registration_ids = array($reg_id);
        $msg = array('notif' => $message);
        $result = send_notification($registration_ids, $msg);
        echo $result;
    }
}
开发者ID:AlvaCorp,项目名称:sistem-kendali-pintu,代码行数:14,代码来源:send_notification.php

示例4: decline

 function decline($id = FALSE)
 {
     $this->load->helper('notification');
     $data["core_settings"] = Setting::first();
     if ($_POST) {
         $this->view_data['estimate'] = Invoice::find_by_id($_POST['invoice_id']);
         $this->view_data['estimate']->estimate_status = "Declined";
         $this->view_data['estimate']->save();
         send_notification($data["core_settings"]->email, $data["core_settings"]->estimate_prefix . $this->view_data['estimate']->reference . ' - ' . $this->lang->line('application_Declined'), $_POST['reason']);
         redirect('cestimates/view/' . $_POST['invoice_id']);
     } else {
         $this->view_data['estimate'] = Invoice::find($id);
         $this->theme_view = 'modal';
         $this->view_data['title'] = $this->lang->line('application_Declined');
         $this->view_data['form_action'] = 'cestimates/decline';
         $this->content_view = 'estimates/client_views/_decline';
     }
 }
开发者ID:imranweb7,项目名称:msitc-erp,代码行数:18,代码来源:cestimates.php

示例5: send_post

 function send_post()
 {
     $error = '';
     if ($this->post('title') == '') {
         $error = 'Please enter notification title';
     } elseif ($this->post('message') == '') {
         $error = 'Please enter notification message';
     } elseif ($this->post('registeration_ids') == '') {
         $error = 'Please enter atleast one registeration id';
     } elseif ($this->post('device_token') == '') {
         $error = 'Please enter notification device token';
     } elseif ($this->post('device_type') == '') {
         $error = 'Please send 0 for Android and 1 for IOS';
     }
     if ($error) {
         $this->response(array('status' => 0, 'message' => $error), 200);
     } else {
         $registeration_ids = json_decode($this->post('registeration_ids'));
         send_notification($this->post('device_type'), $registeration_ids, $this->post('title') . "\n" . $this->post('message'));
         $this->response(array('status' => 1, 'message' => 'Sent', 'result' => ''), 201);
     }
 }
开发者ID:rizwan-devbatch,项目名称:SampleCode,代码行数:22,代码来源:notifications.php

示例6: array

			'topic_poster'			=> $row['topic_poster'],
			'topic_first_post_id'	=> $row['topic_first_post_id'],
			'topic_last_post_id'	=> $row['topic_last_post_id'],
			'post_approved'			=> 0,
		);
		$poll = false;
		
		submit_post('edit', $row['mod_hu_title'], $row['topic_first_poster_name'], POST_NORMAL, $poll, $data);
		
		send_notification(array($row['topic_poster']), 'mod_update_error', array(
			'MOD_HU_TITLE'		=> $row['mod_hu_title'],
			'MOD_EN_TITLE'		=> $row['mod_en_title'],
			'MOD_OLD_VERSION'	=> isset($row['mod_old_version']) ? $row['mod_old_version'] : $row['mod_version'],
			'MOD_NEW_VERSION'	=> isset($row['mod_old_version']) ? $row['mod_version'] : $user->lang['VERSION_UNKNOWN'],
			'MOD_DESC'			=> $row['mod_desc'],
			'MOD_AUTHOR'		=> $row['mod_author_name'],
			'ERRORS'			=> implode("\n", $e->getErrors()),
			'U_MOD_AUTHOR'		=> 'http://www.phpbb.com/community/memberlist.php?mode=viewprofile&amp;u=' . $row['mod_author_id'],
			'U_MOD_COM_DB'		=> 'http://www.phpbb.com/mods/db/index.php?i=misc&mode=display&contrib_id=' . $row['mod_db_id'],
			'U_LOC_PACK'		=> generate_board_url() . '/' . $config['mods_loc_store_path'] . $row['mod_filename'] . '.zip',
			'U_MOD_PACK'		=> generate_board_url() . '/' . $config['downloads_path'] . '/mods/' . $row['mod_filename'] . '.zip',
			'U_MOD'				=> generate_board_url() . '/' . $url_rewriter->rewrite("{$phpbb_root_path}mods.{$phpEx}", "mode=mod&id={$row['mod_id']}"),
		));
	}
	
	// Do cleanup
	$mod->cleanup();
	
	// MOD updated
	$sql = 'UPDATE ' . MODS_TABLE . ' SET mod_last_checked = ' . time() . ' WHERE mod_id = ' . $row['mod_id'];
	$db->sql_query($sql);
}
开发者ID:BackupTheBerlios,项目名称:phpbb-hu-svn,代码行数:32,代码来源:mod_db_update.php

示例7: array



<?php 
// API access key from Google API's Console
//define( 'API_ACCESS_KEY', 'AIzaSyC7enqxiX-zG5RHH2z9m59nz-zCRGVqMLk' );
include 'functions.php';
$registrationIds = array("etTOytTrHFI:APA91bFbeVnRNAc5Om0phyqIMWcF7OeRFTXkYHfoY77phHn-bipKMRZrYtt_b0B978SGNTBZ_kDk9CX3Z0E1xHLyhgvVYQ4mSffQDXRjDQkTPHrPVK6V8nnQ4FAsHxEsM4XgzBLq30VB");
$message = "Sample message";
send_notification($registrationIds, $message);
return;
// prep the bundle
$msg = array('message' => 'This is a sample message');
$fields = array('registration_ids' => $registrationIds, 'data' => $msg);
$headers = array('Authorization: key=' . API_ACCESS_KEY, 'Content-Type: application/json');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://android.googleapis.com/gcm/send');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
curl_close($ch);
echo $result;
开发者ID:bharadwajanup,项目名称:MomsCircle-server,代码行数:22,代码来源:gcm_test.php

示例8: join_event

 function join_event($id_event, $private)
 {
     $id_user = $session_data = $this->session->userdata('logged_in')['id'];
     $aResult = array();
     if (!isset($aResult['error'])) {
         if ($this->event->can_participate($id_user, $id_event) == 1) {
             if ($private == 1) {
                 $result = $this->event->join_private_event($id_user, $id_event);
             } else {
                 $result = $this->event->join_public_event($id_user, $id_event);
             }
             //sending a notification to the organizer
             if ($this->event->is_participation($id_user, $id_event) == 1) {
                 $event = $this->event->get_event($id_event);
                 send_notification("Inscription d'un participant : " . $event->name, $this->session->userdata('logged_in')['firstname'] . ' ' . $this->session->userdata('logged_in')['surname'] . ' s\'est inscrit à ton événement!<a class="list_contact" href="' . base_url('details_event/index/' . $id_event) . '">Voir l\'évènement</a>', $id_user, $event->organizer, false);
             }
             $aResult['result'] = get_participation_link($id_user, $id_event, $private);
         } else {
             $aResult['error'] = 'Inscription non-autorisée';
         }
     }
     echo json_encode($aResult);
 }
开发者ID:sarrab,项目名称:CrazEvent,代码行数:23,代码来源:manage_user.php

示例9: server_callback

 /**
  * Handler for PayPal IPN queries
  * @author korotkov@ud
  * Full callback URL: http://domain/wp-admin/admin-ajax.php?action=wpi_gateway_server_callback&type=wpi_paypal
  */
 static function server_callback()
 {
     if (empty($_POST)) {
         die(__('Direct access not allowed', WPI));
     }
     $invoice = new WPI_Invoice();
     $invoice->load_invoice("id={$_POST['invoice']}");
     /** Verify callback request */
     if (self::_ipn_verified($invoice)) {
         switch ($_POST['txn_type']) {
             /** New PayPal Subscription */
             case 'subscr_signup':
                 /** PayPal Subscription created */
                 WPI_Functions::log_event(wpi_invoice_id_to_post_id($_POST['invoice']), 'invoice', 'update', '', __('PayPal Subscription created', WPI));
                 wp_invoice_mark_as_pending($_POST['invoice']);
                 do_action('wpi_paypal_subscr_signup_ipn', $_POST);
                 break;
             case 'subscr_cancel':
                 /** PayPal Subscription cancelled */
                 WPI_Functions::log_event(wpi_invoice_id_to_post_id($_POST['invoice']), 'invoice', 'update', '', __('PayPal Subscription cancelled', WPI));
                 do_action('wpi_paypal_subscr_cancel_ipn', $_POST);
                 break;
             case 'subscr_failed':
                 /** PayPal Subscription failed */
                 WPI_Functions::log_event(wpi_invoice_id_to_post_id($_POST['invoice']), 'invoice', 'update', '', __('PayPal Subscription payment failed', WPI));
                 do_action('wpi_paypal_subscr_failed_ipn', $_POST);
                 break;
             case 'subscr_payment':
                 /** Payment of Subscription */
                 switch ($_POST['payment_status']) {
                     case 'Completed':
                         /** Add payment amount */
                         $event_note = sprintf(__('%1s paid for subscription %2s', WPI), WPI_Functions::currency_format(abs($_POST['mc_gross']), $_POST['invoice']), $_POST['subscr_id']);
                         $event_amount = (double) $_POST['mc_gross'];
                         $event_type = 'add_payment';
                         /** Log balance changes */
                         $invoice->add_entry("attribute=balance&note={$event_note}&amount={$event_amount}&type={$event_type}");
                         $invoice->save_invoice();
                         send_notification($invoice->data);
                         break;
                     default:
                         break;
                 }
                 do_action('wpi_paypal_subscr_payment_ipn', $_POST);
                 break;
             case 'subscr_eot':
                 /** PayPal Subscription end of term */
                 WPI_Functions::log_event(wpi_invoice_id_to_post_id($_POST['invoice']), 'invoice', 'update', '', __('PayPal Subscription term is finished', WPI));
                 wp_invoice_mark_as_paid($_POST['invoice'], $check = false);
                 do_action('wpi_paypal_subscr_eot_ipn', $_POST);
                 break;
             case 'subscr_modify':
                 /** PayPal Subscription modified */
                 WPI_Functions::log_event(wpi_invoice_id_to_post_id($_POST['invoice']), 'invoice', 'update', '', __('PayPal Subscription modified', WPI));
                 do_action('wpi_paypal_subscr_modify_ipn', $_POST);
                 break;
             case 'web_accept':
                 /** PayPal simple button */
                 switch ($_POST['payment_status']) {
                     case 'Pending':
                         /** Mark invoice as Pending */
                         wp_invoice_mark_as_pending($_POST['invoice']);
                         do_action('wpi_paypal_pending_ipn', $_POST);
                         break;
                     case 'Completed':
                         /** Add payment amount */
                         $event_note = sprintf(__('%s paid via PayPal', WPI), WPI_Functions::currency_format(abs($_POST['mc_gross']), $_POST['invoice']));
                         $event_amount = (double) $_POST['mc_gross'];
                         $event_type = 'add_payment';
                         /** Log balance changes */
                         $invoice->add_entry("attribute=balance&note={$event_note}&amount={$event_amount}&type={$event_type}");
                         /** Log payer email */
                         $payer_email = sprintf(__("PayPal Payer email: %s", WPI), $_POST['payer_email']);
                         $invoice->add_entry("attribute=invoice&note={$payer_email}&type=update");
                         $invoice->save_invoice();
                         /** ... and mark invoice as paid */
                         wp_invoice_mark_as_paid($_POST['invoice'], $check = true);
                         send_notification($invoice->data);
                         do_action('wpi_paypal_complete_ipn', $_POST);
                         break;
                     default:
                         break;
                 }
                 break;
             case 'cart':
                 /** PayPal Cart. Used for SPC */
                 switch ($_POST['payment_status']) {
                     case 'Pending':
                         /** Mark invoice as Pending */
                         wp_invoice_mark_as_pending($_POST['invoice']);
                         do_action('wpi_paypal_pending_ipn', $_POST);
                         break;
                     case 'Completed':
                         /** Add payment amount */
                         $event_note = sprintf(__('%s paid via PayPal', WPI), WPI_Functions::currency_format(abs($_POST['mc_gross']), $_POST['invoice']));
//.........这里部分代码省略.........
开发者ID:JSpier,项目名称:smacamp,代码行数:101,代码来源:class_wpi_paypal.php

示例10: foreach

            $users_ids = $db_rs->all($sql);
            // Оправляем всем уведомления о том, что есть касса без оператора;
            foreach ($users_ids as $user) {
                // Перед отправкой надо проверить, быть может этому пользователю мы уже отправляли уведомление сегодня по этому поводу;
                $sql = "SELECT * FROM `notifications` WHERE `user_id` = '" . $user['id'] . "' AND date(`date`) = date(NOW()) AND `parent_id` = '19' AND `status` = '1' AND `type` = '2';";
                $exist_noti = $db_rs->all($sql);
                if (count($exist_noti) == 0) {
                    // Перед отправкой надо проверить, быть может этому пользователю мы уже отправляли уведомление сегодня по этому поводу;
                    send_notification($user['id'], 'Внимание! В вашем офисе есть кассы с не закрытым вовремя операционным днем!!!<br>Нажмите для перехода в раздел управления кассами.', 'cash_operator', '', 2);
                }
            }
            // Перед отправкой надо проверить, быть может этому пользователю мы уже отправляли уведомление сегодня по этому поводу;
            $sql = "SELECT * FROM `notifications` WHERE `user_id` = '" . $_SESSION['user_id'] . "' AND date(`date`) = date(NOW()) AND `parent_id` = '19' AND `status` = '1' AND `type` = '2';";
            $exist_noti = $db_rs->all($sql);
            if (count($exist_noti) == 0) {
                send_notification($_SESSION['user_id'], 'Внимание! В вашем офисе есть кассы с не закрытым вовремя операционным днем!!!<br>Нажмите для перехода в раздел управления кассами.', 'cash_operator', '', 2);
            }
        } else {
            //$already_exist_operator = 1;
        }
    }
} else {
    write_log('ЁБАНЫЙ В РОТ!', 'kassa_alert');
}
write_log('Строим меню');
if ($_SESSION['company'] == 'air') {
    $company_name = 'AIR Сервис';
} else {
    $company_name = 'Ремонтофф';
}
$office_info_html = '';
开发者ID:uvaron,项目名称:BDparser,代码行数:31,代码来源:main.php

示例11: sendPush

 public function sendPush($id)
 {
     $post = Post::find($id);
     if ($post) {
         $response_array = array('success' => true, 'description' => $post->meta_des, 'image' => $post->image);
         send_notification($post->title, $response_array);
         return Redirect::back()->with('flash_success', "push notification delivered");
     } else {
         return Redirect::back()->with('flash_error', "Push notification failed, Try again");
     }
 }
开发者ID:niranjanbala,项目名称:SH_Dashboard_Code,代码行数:11,代码来源:AdminController.php

示例12: index

 function index()
 {
     $core_settings = Setting::first();
     if ($core_settings->registration != 1) {
         redirect('login');
     }
     if ($_POST) {
         $this->load->library('parser');
         $this->load->helper('file');
         $this->load->helper('notification');
         $client = Client::find_by_email($_POST['email']);
         if ($client->inactive == 1) {
             $client = FALSE;
         }
         $check_company = Company::find_by_name($_POST['name']);
         if (!$client && !$check_company && $_POST['name'] != "" && $_POST['email'] != "" && $_POST['password'] != "" && $_POST['firstname'] != "" && $_POST['lastname'] != "" && $_POST['confirmcaptcha'] != "") {
             $client_attr = array();
             $company_attr['name'] = $_POST['name'];
             $company_attr['website'] = $_POST['website'];
             $company_attr['phone'] = $_POST['phone'];
             $company_attr['mobile'] = $_POST['mobile'];
             $company_attr['address'] = $_POST['address'];
             $company_attr['zipcode'] = $_POST['zipcode'];
             $company_attr['city'] = $_POST['city'];
             $company_attr['country'] = $_POST['country'];
             $company_attr['province'] = $_POST['province'];
             $company_attr['vat'] = $_POST['vat'];
             $company_attr['reference'] = $core_settings->company_reference;
             $core_settings->company_reference = $core_settings->company_reference + 1;
             $core_settings->save();
             $company = Company::create($company_attr);
             if (!$company) {
                 $this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_registration_error'));
                 redirect('register');
             }
             $lastclient = Client::last();
             $client_attr = array();
             $client_attr['email'] = $_POST['email'];
             $client_attr['firstname'] = $_POST['firstname'];
             $client_attr['lastname'] = $_POST['lastname'];
             $client_attr['phone'] = $_POST['phone'];
             $client_attr['mobile'] = $_POST['mobile'];
             $client_attr['address'] = $_POST['address'];
             $client_attr['zipcode'] = $_POST['zipcode'];
             $client_attr['city'] = $_POST['city'];
             $modules = Module::find('all', array('order' => 'sort asc', 'conditions' => array('type = ?', 'client')));
             $client_attr['access'] = "";
             foreach ($modules as $value) {
                 if ($value->name == "Projects" || $value->name == "Messages" || $value->name == "Tickets" || $value->name == "Invoices") {
                     $client_attr['access'] .= $value->id . ",";
                 }
             }
             $client_attr['company_id'] = $company->id;
             $client = Client::create($client_attr);
             if ($client) {
                 $client->password = $client->set_password($_POST['password']);
                 $client->save();
                 $company->client_id = $client->id;
                 $company->save();
                 $this->email->from($core_settings->email, $core_settings->company);
                 $this->email->to($client_attr['email']);
                 $this->email->subject($this->lang->line('application_your_account_has_been_created'));
                 $parse_data = array('link' => base_url() . 'login/', 'company' => $core_settings->company, 'company_reference' => $company->reference, 'logo' => '<img src="' . base_url() . '' . $core_settings->logo . '" alt="' . $core_settings->company . '"/>', 'invoice_logo' => '<img src="' . base_url() . '' . $core_settings->invoice_logo . '" alt="' . $core_settings->company . '"/>');
                 $email = read_file('./application/views/' . $core_settings->template . '/templates/email_create_account.html');
                 $message = $this->parser->parse_string($email, $parse_data);
                 $this->email->message($message);
                 $this->email->send();
                 send_notification($core_settings->email, $this->lang->line('application_new_client_has_registered'), $this->lang->line('application_new_client_has_registered') . ': <br><strong>' . $company_attr['name'] . '</strong><br>' . $client_attr['firstname'] . ' ' . $client_attr['lastname'] . '<br>' . $client_attr['email']);
                 $this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_registration_success'));
                 redirect('login');
             } else {
                 $this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_registration_error'));
                 redirect('login');
             }
         } else {
             $this->view_data['error'] = $this->lang->line('messages_email_already_taken');
             $this->theme_view = 'login';
             $this->content_view = 'auth/register';
             $this->view_data['form_action'] = 'register';
             $this->view_data['registerdata'] = $_POST;
         }
     } else {
         $this->view_data['error'] = 'false';
         $this->theme_view = 'login';
         $this->content_view = 'auth/register';
         $this->view_data['form_action'] = 'register';
     }
 }
开发者ID:imranweb7,项目名称:msitc-erp,代码行数:88,代码来源:register.php

示例13: quick_add

 /**
  * Handle quick add submit
  */
 function quick_add()
 {
     if (array_var($_GET, 'current') == 'overview-panel') {
         ajx_current("reload");
     } else {
         ajx_current("empty");
     }
     //---------- REQUEST PARAMS --------------
     //		$_POST = Array (
     //			[member] => Array (
     //				[name] => pepe 333
     //				[dimension_id] => 1
     //				[parent_member_id] => 0
     //				[dimension_id] => 19
     //			)
     //			[contact] => Array (
     //				[email] => slkdjflksjdflksdf@kldsjflkdf.com
     //				[user] => Array (
     //					[create-user]=>on
     //					[type] => 25
     //					[first_name] =>
     // 					[surname] =>
     //		)
     //----------------------------------------
     // Init variables
     $max_users = config_option('max_users');
     if ($max_users && Contacts::count() >= $max_users) {
         flash_error(lang('maximum number of users reached error'));
         ajx_current("empty");
         return;
     }
     if (!can_manage_security(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $email = trim(array_var(array_var($_POST, 'contact'), 'email'));
     $member = array_var($_POST, 'member');
     $name = array_var($member, 'name');
     $nameArray = explode(" ", $name);
     $firstName = $nameArray[0];
     unset($nameArray[0]);
     $surname = implode(" ", $nameArray);
     $parentMemberId = array_var($member, 'parent_member_id');
     $objectType = ObjectTypes::findById(array_var($member, 'object_type_id'))->getName();
     // 'person', 'company'
     $dimensionId = array_var($member, 'dimension_id');
     $company = array_var(array_var(array_var($_POST, 'contact'), 'user'), 'company_id');
     // Create new instance of Contact and set the basic fields
     $contact = new Contact();
     $contact->setObjectName($name);
     if ($firstName) {
         $contact->setFirstName($firstName);
     } else {
         $contact->setFirstName($name);
     }
     if ($surname) {
         $contact->setSurname($surname);
     }
     $contact->setCompanyId($company);
     $contact->setIsCompany($objectType == "company");
     if ($parentMemberId) {
         if ($companyId = Members::findById($parentMemberId)->getObjectId()) {
             $contact->setCompanyId($companyId);
         }
     }
     // Save Contact
     try {
         DB::beginWork();
         $contact->save();
         if ($email && is_valid_email($email)) {
             if (!Contacts::validateUniqueEmail($email, null, $objectType)) {
                 DB::rollback();
                 flash_error(lang("email address must be unique"));
                 return false;
             } else {
                 if (!array_var(array_var(array_var($_POST, 'contact'), 'user'), 'create-user')) {
                     $contact->addEmail($email, 'personal', true);
                 }
                 flash_success(lang("success add contact", $contact->getObjectName()));
             }
         }
         // User settings
         $user = array_var(array_var($_POST, 'contact'), 'user');
         $user['username'] = str_replace(" ", "", strtolower($name));
         $user_data = $this->createUserFromContactForm($user, $contact->getId(), $email);
         // Reload contact again due to 'createUserFromContactForm' changes
         Hook::fire("after_contact_quick_add", Contacts::instance()->findById($contact->getId()), $ret);
         DB::commit();
         // Send notification
         send_notification($user_data, $contact->getId());
     } catch (Exception $e) {
         DB::rollback();
         flash_error($e->getMessage());
     }
     // Reload
     evt_add("reload dimension tree", array('dim_id' => $dimensionId));
//.........这里部分代码省略.........
开发者ID:abhinay100,项目名称:feng_app,代码行数:101,代码来源:ContactController.class.php

示例14: foreach

         // Уведомляем исполнителя по telgram;
         $systems->send_telegram($item['user_id'], 'У вас есть новое РКО №' . $rko_code . ' для согласования.');
     }
     // Теперь поучим родителя ношего основания, что бы отправить уведомления остальным;
     try_again:
     $sql = "SELECT `parent_id` FROM `rko_templates` WHERE `id` = '" . $rko_template . "' AND `status` != '0';";
     $temp_id = $db_rs->one($sql);
     if ($temp_id != '') {
         $rko_template = $temp_id;
         goto try_again;
     }
     // Получаем тех, у кого такой родитель стоит для уведомлени;
     $sql = "SELECT * FROM `rko_accepts` WHERE `rko_template_id` = '" . $rko_template . "' AND `status` != '0';";
     $receivers = $db_rs->all($sql);
     foreach ($receivers as $receiver) {
         send_notification($receiver['user_id'], 'У вас есть новое РКО №' . $rko_code . ' для согласования.<br>Нажмите для перехода в раздел РКО.', 'rko', '', 4, $rko_code);
         $systems->send_telegram($receiver['user_id'], 'У вас есть новое РКО №' . $rko_code . ' для согласования.');
     }
     echo 'OK';
 }
 function get_full_rko_template_text($last_id)
 {
     global $db_rs;
     $template_text = '';
     again:
     $sql = "SELECT `parent_id`, `template_text` FROM `rko_templates` WHERE `id` = '" . $last_id . "' AND `status` != '0';";
     //file_put_contents($_SERVER['DOCUMENT_ROOT'].'/123.txt', $sql."\r\n", FILE_APPEND);
     $template_text_temp = $db_rs->row($sql);
     $template_text = str_replace("\r\n", '', $template_text_temp['template_text'] . ' ' . $template_text);
     // Если есть родитель, цепляем его текст тоже;
     if ($template_text_temp['parent_id'] != '') {
开发者ID:uvaron,项目名称:BDparser,代码行数:31,代码来源:rko.php

示例15: qid

 function qid($id = FALSE)
 {
     if ($_POST) {
         unset($_POST['send']);
         $_POST = array_map('htmlspecialchars', $_POST);
         $tfields = explode("||", $_POST["tfields"]);
         unset($_POST['tfields']);
         unset($tfields["section_break"]);
         $counter = 0;
         $form = "";
         foreach ($_POST as $key => $value) {
             if ($key != "captcha" && $key != "confirmcaptcha" && $key != "section_break" && !strpos($key, '_')) {
                 $form .= '<div class="question">' . $tfields[$counter] . '</div>';
                 $form .= '<div class="answer">' . $value . '</div>';
                 $counter = $counter + 1;
             } elseif (strpos($key, '_')) {
                 $checkbox_explode = explode("_", $key);
                 if (isset($check)) {
                     if ($check != $checkbox_explode[0]) {
                         $form .= '<div class="question">' . $tfields[$counter] . '</div>';
                         $check = $checkbox_explode[0];
                         $counter = $counter + 1;
                     }
                 } else {
                     $form .= '<div class="question">' . $tfields[$counter] . '</div>';
                     $check = $checkbox_explode[0];
                     $counter = $counter + 1;
                 }
                 $form .= '<div class="answer"><i class="fa fa-check"></i> ' . $value . '</div>';
             } elseif ($key == "section_break") {
                 $counter = $counter + 1;
                 $form .= "<hr>";
             }
         }
         $attributes = array('form' => $form, 'status' => 'New', 'custom_quotation_id' => $id, 'date' => date("Y-m-d H:i", time()));
         $item = Quoterequest::create($attributes);
         if (!$item) {
             $this->session->set_flashdata('message', 'error:' . $this->lang->line('quotation_create_error'));
         } else {
             $this->load->helper('notification');
             $this->session->set_flashdata('message', 'success:' . $this->lang->line('quotation_create_success'));
             $admins = User::find('all', array('conditions' => array('admin = ? AND status = ?', '1', 'active')));
             foreach ($admins as &$value) {
                 send_notification($value->email, $this->lang->line('application_notification_quotation_subject'), $this->lang->line('application_notification_quotation'));
             }
         }
         redirect('quotation/qid/' . $id);
     } else {
         $this->theme_view = 'fullpage';
         $this->view_data['quotation'] = Customquote::find_by_id($id);
         $this->view_data['form_action'] = 'quotation/qid/' . $id;
         $json_output = json_decode($this->view_data['quotation']->formcontent);
         $html_fields = "";
         $i = 0;
         foreach ($json_output->fields as $field) {
             $i = $i++;
             $required = '';
             switch ($field->field_type) {
                 case 'text':
                     if ($field->required == true) {
                         $required = 'required';
                     }
                     $html_fields .= '<div class="form-group">';
                     $html_fields .= '<label class="control-label">' . $field->label . '</label>';
                     $html_fields .= '<input type="text" name="' . $field->cid . '" class="form-control ' . $required . '"' . $required . '/>';
                     if (isset($field->field_options->description)) {
                         $html_fields .= '<p class="subline">' . $field->field_options->description . '</p>';
                     }
                     $html_fields .= '</div>';
                     break;
                 case 'email':
                     if ($field->required == true) {
                         $required = 'required';
                     }
                     $html_fields .= '<div class="form-group">';
                     $html_fields .= '<label class="control-label">' . $field->label . '</label>';
                     $html_fields .= '<input type="email" name="' . $field->cid . '" class="form-control email ' . $required . '" ' . $required . '/>';
                     if (isset($field->field_options->description)) {
                         $html_fields .= '<p class="subline">' . $field->field_options->description . '</p>';
                     }
                     $html_fields .= '</div>';
                     break;
                 case 'paragraph':
                     if ($field->required == true) {
                         $required = 'required';
                     }
                     $html_fields .= '<div class="form-group">';
                     $html_fields .= '<label class="control-label">' . $field->label . '</label>';
                     $html_fields .= '<textarea name="' . $field->cid . '" class="form-control ' . $required . '" ' . $required . '></textarea>';
                     if (isset($field->field_options->description)) {
                         $html_fields .= '<p class="subline">' . $field->field_options->description . '</p>';
                     }
                     $html_fields .= '</div>';
                     break;
                 case 'section_break':
                     $html_fields .= '<div class="form-group">';
                     $html_fields .= '<hr>';
                     $html_fields .= '</div>';
                     break;
                 case 'radio':
//.........这里部分代码省略.........
开发者ID:pratikbgit,项目名称:freelancerKit,代码行数:101,代码来源:quotation.php


注:本文中的send_notification函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。