本文整理汇总了PHP中Subscription::saveSubscription方法的典型用法代码示例。如果您正苦于以下问题:PHP Subscription::saveSubscription方法的具体用法?PHP Subscription::saveSubscription怎么用?PHP Subscription::saveSubscription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subscription
的用法示例。
在下文中一共展示了Subscription::saveSubscription方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Subscriber
<?php
include_once "Subscriber.php";
include_once "Subscription.php";
if (isset($_POST['email']) && !empty($_POST['email'])) {
$subscriber = new Subscriber();
$subscriber->setEmail($_POST['email']);
$subscriber->saveSubscriber();
$subscription = new Subscription();
$subscription->setSubscriber($subscriber);
$response = array('success' => false, 'subscriber' => array());
if ($subscription->saveSubscription()) {
$response['success'] = true;
$response['subscriber'] = $subscriber->getSubscriber($subscriber->getId());
}
echo json_encode($response);
}
示例2: addsubscriberAction
function addsubscriberAction()
{
global $mySession;
$db = new Db();
$subscriber_id = $this->_getParam("subscriberId");
$myform = new Form_Subscriber($subscriber_id);
$this->view->pageHeading = !empty($subscriber_id) ? "Add Subscriber" : "Edit Subscriber";
if ($this->getRequest()->isPost()) {
// echo "<pre>"; print_r(get_class_methods($myform)); die;
if ($myform->isValid($this->getRequest()->getPost())) {
$dataForm = $myform->getValues();
//address work
$dataForm['subscriber_address'][] = $dataForm['subscriber_address_box1'];
$dataForm['subscriber_address'][] = $dataForm['subscriber_address_box2'];
$dataForm['subscriber_address'][] = $dataForm['subscriber_address_box3'];
$dataForm['subscriber_address'][] = $dataForm['subscriber_address_box4'];
$dataForm['subscriber_address'][] = $dataForm['subscriber_address_box5'];
$dataForm['subscriber_address'] = implode(',', array_filter($dataForm['subscriber_address'], 'trim'));
unset($dataForm['subscriber_address_box1'], $dataForm['subscriber_address_box2'], $dataForm['subscriber_address_box3'], $dataForm['subscriber_address_box4'], $dataForm['subscriber_address_box5']);
//contact names
$dataForm['contact_person'][] = $dataForm['contact_name'];
$dataForm['contact_person'][] = $dataForm['contact_name1'];
$dataForm['contact_person'] = implode(',', array_filter($dataForm['contact_person'], 'trim'));
unset($dataForm['contact_name'], $dataForm['contact_name1']);
//email address
$dataForm['subscriber_email'][] = $dataForm['email_address'];
$dataForm['subscriber_email'][] = $dataForm['email_address1'];
$dataForm['subscriber_email'] = implode(',', array_filter($dataForm['subscriber_email'], 'trim'));
unset($dataForm['email_address'], $dataForm['email_address1']);
//telephone
$dataForm['subscriber_telephone'] = $dataForm['telephone'];
unset($dataForm['telephone']);
//website
$dataForm['subscriber_website'] = $dataForm['website'];
unset($dataForm['website']);
//customer support
$dataForm['subscriber_customer_support'][] = $dataForm['customer_support'];
$dataForm['subscriber_customer_support'][] = $dataForm['customer_support1'];
$dataForm['subscriber_customer_support'][] = $dataForm['customer_support2'];
$dataForm['subscriber_customer_support'][] = $dataForm['customer_support3'];
$dataForm['subscriber_customer_support'][] = $dataForm['customer_support4'];
$dataForm['subscriber_customer_support'] = implode(',', array_filter($dataForm['subscriber_customer_support'], 'trim'));
unset($dataForm['customer_support'], $dataForm['customer_support1'], $dataForm['customer_support2'], $dataForm['customer_support3'], $dataForm['customer_support4']);
//additional info
$dataForm['subscriber_additional_info'] = $dataForm['additional_info'];
unset($dataForm['additional_info']);
//dealatrip web page
$dataForm['subscriber_dealatrip_webpage'] = $dataForm['dealatrip_page'];
unset($dataForm['dealatrip_page']);
//lat lng
$dataForm['subscriber_lat_lng'][] = $dataForm['latitude'];
$dataForm['subscriber_lat_lng'][] = $dataForm['longitude'];
$dataForm['subscriber_lat_lng'] = implode(',', $dataForm['subscriber_lat_lng']);
unset($dataForm['latitude'], $dataForm['longitude']);
$myObj = new Subscription();
$result = $myObj->saveSubscription($dataForm, $subscriber_id);
if ($result == 1) {
$mySession->sucessMsg = "New Subscriber added successfully.";
$this->_redirect('library/subscriber');
} else {
$mySession->sucessMsg = "Subscriber updated successfully.";
$this->_redirect('library/subscriber');
}
}
} else {
}
$this->view->myform = $myform;
}