public function getCustomerPassTemplates($userId = 0) { $current_role = Helper::getRole(); $apiUrl = PASSBUILDER_PASSLIST_URL . '/' . $userId; $client = new ClientApi($apiUrl); $client->crudAction('read'); $getResponse = $client->getResponse(); unset($client); //echo $getResponse; $dataArray = json_decode($getResponse, true); return $dataArray; }
private function publishPassAction() { $PASS_ID = $_GET['id']; $STATUS = $_GET['status']; $client = new ClientApi(PASSBUILDER_PUBLISHPASS_URL . '/' . $STATUS); $client->setData(array('coupon_id' => $PASS_ID)); $client->crudAction('update'); $updateResponse = $client->getResponse(); unset($client); wp_redirect('?pass-builder=templates'); exit; }
<?php $couponId = $_GET['id']; $commonAttr = array('class' => 'form-control'); $current_userid = get_current_user_id(); $current_user = wp_get_current_user(); $companyName = get_user_meta($current_userid, '_companyname', true); //$companyName = 'dd'; $client = new ClientApi(PASSBUILDER_PASSLIST_BYID_URL . '/' . $couponId); $client->crudAction('read'); $getResponse = $client->getResponse(); $incumingData = json_decode($getResponse, true); $generalArray = array_key_exists('general', $incumingData) ? $incumingData['general'] : array(); $appearanceArray = array_key_exists('appearance', $incumingData) ? $incumingData['appearance'] : array(); $datasettingArray = array_key_exists('datasetting', $incumingData) ? $incumingData['datasetting'] : array(); $headerArray = array_key_exists('header', $incumingData) ? $incumingData['header'] : array(); $primaryArray = array_key_exists('primary', $incumingData) ? $incumingData['primary'] : array(); $secondaryArray = array_key_exists('secondary', $incumingData) ? $incumingData['secondary'] : array(); $auxiliaryArray = array_key_exists('auxiliary', $incumingData) ? $incumingData['auxiliary'] : array(); $backfieldsArray = array_key_exists('backfields', $incumingData) ? $incumingData['backfields'] : array(); $relevanceArray = array_key_exists('relevance', $incumingData) ? $incumingData['relevance'] : array(); $distributionArray = array_key_exists('distribution', $incumingData) ? $incumingData['distribution'] : array(); $passKey = $generalArray['passKey']; $userName = $current_user->user_login; $userEmail = $current_user->user_email; //Debug::showArray($generalArray); //echo $getResponse; //PASSBUILDER_PASSLIST_BYID_URL //Debug::showArray($relevanceArray); ?>
private function removePassAction() { $request = new Request(); $submitedValues = $request->all(); if (array_key_exists('del', $submitedValues)) { $delPassArray = $submitedValues['del']; $client = new ClientApi(PASSBUILDER_REMOVEPASS_URL); $client->setData(array('del_ids' => $delPassArray)); $client->crudAction(); $removeResponse = $client->getResponse(); unset($client); wp_redirect('?pass-builder=templates'); exit; } else { wp_redirect('?pass-builder=templates'); exit; } }