本文整理汇总了PHP中AF::get方法的典型用法代码示例。如果您正苦于以下问题:PHP AF::get方法的具体用法?PHP AF::get怎么用?PHP AF::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AF
的用法示例。
在下文中一共展示了AF::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteAction
function deleteAction()
{
$id = AF::get($_POST, 'id', 0);
$modelsID = explode(',', $id);
$errors = FALSE;
foreach ($modelsID as $id) {
$model = new Address();
$model->model_uset_id = $this->user->user_id;
if ($model->findByPk($id)) {
$model->delete($id);
} else {
$errors = TRUE;
}
if ($model->getErrors()) {
$errors = TRUE;
}
unset($model);
}
if (isset($_POST['ajax'])) {
AF::setJsonHeaders('json');
if ($errors) {
Message::echoJsonError(__('address_not_deleted'));
} else {
Message::echoJsonSuccess(__('address_deleted'));
}
}
$this->redirect();
}
示例2: ordersAction
public function ordersAction()
{
$from = AF::get($this->params, 'from', false);
$clearArray = array();
$this->filter($clearArray);
if (!isset($this->params['r_dates'])) {
$today = date("d.m.Y");
$this->params['r_dates'] = $today . '-' . $today;
}
$pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true));
$models = AFActiveDataProvider::models('Attempt', $this->params, $pagination);
$dataProvider = $models->getDeclineOrdersReport();
$filterFields = Attempt::$FilterFields = $models->getoutFilterFields($clearArray, array('r_dates'));
$fields = array('order_formatted', 'type_formatted', 'status_note', 'created_formatted');
$gateways = $models->getDSearchGateways();
$reasons = $models->getDSearchReasons();
// set ajax table
if (AF::isAjaxRequestModels()) {
$this->view->includeFile('_orders_table', array('application', 'views', 'declinedreports'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields, 'fields' => $fields, 'gateways' => $gateways, 'reasons' => $reasons));
die;
}
Assets::css('jquery-ui');
Assets::js('//code.jquery.com/ui/1.10.3/jquery-ui.js');
Assets::js('dateRange/jquery.daterange');
Assets::js('ajax_table');
$this->render('orders', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields, 'fields' => $fields, 'gateways' => $gateways, 'reasons' => $reasons, 'from' => $from));
}
示例3: resetAction
function resetAction()
{
$userID = AF::get($this->params, 'idUser');
$activKey = AF::get($this->params, 'activkey');
$reset = AF::get($this->params, 'reset');
if (!$userID || !$activKey || !$reset) {
throw new AFHttpException(0, 'bad_request', 404);
}
$userModel = User::model()->findByPk($userID);
if (!$userModel || $userModel->activkey != $activKey || $reset != 'true') {
throw new AFHttpException(0, 'bad_request', 404);
}
if (isset($_POST['reset_password']) && isset($_POST['ajax'])) {
$password = trim(AF::get($_POST, 'password'));
if (strlen($password) < 4) {
Message::echoJsonError(__('small_password'));
}
$userModel->password = $password;
$userModel->activkey = '';
if ($userModel->save()) {
Message::echoJsonSuccess(__('your_password_changed'));
} else {
Message::echoJsonError(__('your_password_not_changed'));
}
}
$this->addToPageTitle(__('reset_your_password'));
Assets::cleanJs();
Assets::js('jquery.min');
Assets::js('jquery.form');
$this->render('reset', array());
}
示例4: __construct
function __construct()
{
$this->params = func_get_args();
$this->createUrl();
$this->pageCount = ceil($this->params[1] / $this->itemsPerPage);
$this->currentPage = AF::get($this->params[0], 'page', 1);
}
示例5: generalAction
function generalAction()
{
if (isset($_POST['model']) && ($_POST['model'] = 'User')) {
$this->user->name = AF::get($_POST, 'name');
$this->user->password = AF::get($_POST, 'password');
$this->user->settings;
if ($this->user->save(false)) {
Message::echoJsonSuccess(__('user_settings_updated'));
} else {
Message::echoJsonError(__('user_settings_not_updated'));
}
}
$this->addToPageTitle(__('general') . ' ' . __('settings'));
Assets::js('jquery.form');
$this->render('general', array());
}
示例6: openAction
/**
* Show the customers orders with address for each order in case they use different addresses.
*/
function openAction()
{
$customer_id = AF::get($this->params, 'customer_id', false);
// Get the $_GET['customer_id']
if (!$customer_id) {
throw new AFHttpException(0, 'no_customer_id');
}
// uses en.php to get string
$this->filter();
$pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params));
$models = AFActiveDataProvider::models('Customer', $this->params, $pagination);
$dataProvider = $models->getOrdersByCustomerId($customer_id);
$orderModel = new Order();
$labels = $orderModel->attributeLabels();
$this->addToPageTitle('View Client');
$this->render('open', array('lables' => $labels, 'pagination' => $pagination, 'dataProvider' => $dataProvider, 'countOrders' => count($dataProvider), 'email' => $dataProvider[0]->email));
}
示例7: getCustomersAction
function getCustomersAction()
{
$this->checkLogin();
$searchText = AF::get($_POST, 'search_text', false);
$customerID = AF::get($_POST, 'customer_id', false);
if ($searchText) {
$customers = $searchText ? Customers::searchByEmail($searchText) : array();
Message::echoJsonSuccess(array('data' => $customers));
} elseif ($customerID) {
$customerModel = Customer::model()->findByPk($customerID);
$addressModel = Address::model()->findByCustomerId($customerModel);
}
die;
}
示例8: removeAction
function removeAction()
{
$id = AF::get($_POST, 'id', 0);
$modelsID = explode(',', $id);
$errors = FALSE;
foreach ($modelsID as $id) {
$model = new Event();
$t = explode('-', $id);
if (isset($t[0]) && isset($t[1])) {
$model->removeEventProduct($t[0], $t[1]);
} else {
$errors = TRUE;
}
unset($model);
}
if (isset($_POST['ajax'])) {
AF::setJsonHeaders('json');
if ($errors) {
Message::echoJsonError(__('events_not_deleted'));
} else {
Message::echoJsonSuccess(__('events_deleted'));
}
}
$this->redirect();
}
示例9: upsellAction
function upsellAction()
{
$model = new Upsell();
// Uncomment the following line if AJAX validation is needed
$this->performAjaxValidation($model);
if (isset($_POST['model']) && $_POST['model'] == 'upsells' && isset($_POST['ajax'])) {
$upsellID = AF::get($_POST, 'upsell_id');
$parent_upsell_id = AF::get($_POST, 'parent_upsell_id');
$answer = AF::get($_POST, 'answer');
$productID = AF::get($_POST, 'product_id');
$shippingID = AF::get($_POST, 'shipping_id');
$campaign_id = AF::get($_POST, "campaign_id");
$main_parent_product_id = AF::get($_POST, "main_parent_product_id");
$product_replace = AF::get($_POST, "product_replace") ? AF::get($_POST, "product_replace") : 0;
$url = AF::get($_POST, 'url');
if (!$answer) {
Message::echoJsonError(__('upsell_not_upsell_answer'));
}
//if(!$shippingID)
//Message::echoJsonError(__('upsell_select_shipping'));
if (!$parent_upsell_id) {
if ($upsellID) {
$model->findByPk($upsellID);
if ($productID) {
$model->product_id = $productID;
$model->shipping_id = $shippingID;
$model->product_replace = $product_replace;
$model->url = $url;
if ($model->save()) {
Message::echoJsonSuccess(array('reload' => '1', 'message' => __('upsell_updated')));
} else {
Message::echoJsonError(__('upsell_not_updated'));
}
} else {
$campProdModel = new CampaignProduct();
$campProdModel->findByPk($answer);
$campProdModel->upsell_id = null;
if ($campProdModel->save()) {
$model->delete();
Message::echoJsonSuccess(array('reload' => '1', 'message' => __('upsell_updated')));
} else {
Message::echoJsonError(__('upsell_not_updated'));
}
}
} else {
if (!$productID) {
Message::echoJsonError(__('upsell_select_product'));
}
$model->product_id = $productID;
$model->shipping_id = $shippingID;
$model->product_replace = $product_replace;
$model->url = $url;
if ($model->save()) {
$campProdModel = new CampaignProduct();
$campProdModel->findByPk($answer);
$campProdModel->upsell_id = $model->upsell_id;
if ($campProdModel->save()) {
Message::echoJsonSuccess(array('reload' => '1', 'message' => __('upsell_created')));
} else {
Message::echoJsonError(__('upsell_not_updated'));
}
} else {
Message::echoJsonError(__('upsell_not_updated'));
}
}
} elseif ($upsellID) {
$model->findByPk($upsellID);
if (!$productID) {
if ($model->delete()) {
$parentUpsellModel = new Upsell();
$parentUpsellModel->findByPk($parent_upsell_id);
$parentUpsellModel->setAnswer($answer, null);
$parentUpsellModel->save();
Message::echoJsonSuccess(__('upsell_not_deleted'));
} else {
Message::echoJsonError(__('upsell_not_updated'));
}
} else {
$model->product_id = $productID;
$model->shipping_id = $shippingID;
$model->product_replace = $product_replace;
$model->url = $url;
if ($model->save()) {
Message::echoJsonSuccess(array('reload' => '1', 'message' => __('upsell_updated')));
} else {
Message::echoJsonError(__('upsell_not_updated'));
}
}
} else {
// parent_upsell_id = 119, upsell_id = 0
if (!$productID) {
Message::echoJsonError(__('upsell_select_product'));
}
$model->fillFromArray($_POST);
if ($model->save()) {
$upsellModel = new Upsell();
$upsellModel->findByPk($parent_upsell_id);
$upsellModel->setAnswer($answer, $model->upsell_id);
if ($upsellModel->save()) {
Message::echoJsonSuccess(array('reload' => '1', 'message' => __('upsell_created')));
//.........这里部分代码省略.........
示例10: updateRecurringData
public function updateRecurringData()
{
$db = self::$_msql;
$this->whereAndLimit();
$whichOrders = AF::get($_POST, 'which_orders');
$whichDate = AF::get($_POST, 'which_date');
$gatewayID = AF::get($_POST, 'gateway_id');
$ordersID = AF::get($_POST, 'orders_id');
$set = '';
$andWhere = '';
if ($gatewayID) {
$set = $db->parse('o.`gateway_id`=?i', (int) $gatewayID);
} elseif ($whichDate) {
if ($whichDate == Order::RECURRING_ORDERS_DATE) {
$newRecurringDate = AF::get($_POST, 'new_r_date');
$nRDA = array_reverse(explode('.', $newRecurringDate));
$set = $db->parse('op.`recurring_next`=?s', implode('-', $nRDA));
} elseif ($whichDate == Order::RECURRING_ORDERS_DAY) {
$day = AF::get($_POST, 'different_days');
$dateMinTemp = AF::get($_POST, 'new_r_date_from');
$dateMaxTemp = AF::get($_POST, 'new_r_date_to');
if ($dateMinTemp) {
$dateMinA = array_reverse(explode('.', $dateMinTemp));
$dateMin = implode('-', $dateMinA);
} else {
$dateMin = '2000-01-01';
}
if ($dateMaxTemp) {
$dateMaxA = array_reverse(explode('.', $dateMaxTemp));
$dateMax = implode('-', $dateMaxA);
} else {
$dateMax = '2100-01-01';
}
$set = $db->parse('op.`recurring_next`= if(DATE_ADD(op.`recurring_next`, INTERVAL ?i DAY)>?s,?s, if(DATE_ADD(op.`recurring_next`, INTERVAL ?i DAY)<?s, ?s, DATE_ADD(op.`recurring_next`, INTERVAL ?i DAY)))', $day, $dateMax, $dateMax, $day, $dateMin, $dateMin, $day);
}
}
if ($whichOrders == Order::RECURRING_ORDERS_SELECTED) {
$changeOrdersArray = explode(',', $ordersID);
$andWhere = $db->parse(' AND o.`order_id` IN(?a)', $changeOrdersArray);
}
$sql = "UPDATE `orders` as o\n\t\tJOIN `campaigns` as c USING (`campaign_id`)\n\t\tJOIN `customers` as cu USING (`customer_id`)\n\t\tJOIN `orders_products` as op USING (`order_id`)\n\t\tJOIN `products` as pr USING(`product_id`)\n\t\tLEFT JOIN `products` AS p2 on p2.`product_id` = pr.`product_next_id`\n\t\tLEFT JOIN `shipping` as sh ON sh.shipping_id = o.shipping_id\n\t\tLEFT JOIN `gateways` as g USING (`gateway_id`)\n\t\tLEFT JOIN `addresses` as ad USING (`address_id`)\n\t\tLEFT JOIN `systems` as s USING (`system_code`)\n\t\tLEFT JOIN `payments` as p USING (`payment_id`)\n\t\tLEFT JOIN `methods` as m USING (`method_id`)\n\t\t?p\n\t\tSET {$set}\n WHERE ?p {$andWhere}";
$db->query($sql, $this->join, $this->where);
}
示例11: removeemailAction
function removeemailAction()
{
$id = AF::get($_POST, 'id', 0);
$modelsID = explode(',', $id);
$errors = false;
foreach ($modelsID as $id) {
$idsArray = explode('-', $id);
if (count($idsArray) != 3) {
$errors = true;
}
$model = new CampaignEmail();
if ($model->findByPk(array('campaign_id' => $idsArray[0], 'day' => $idsArray[1], 'template_id' => $idsArray[2]))) {
$model->model_uset_id = $this->user->user_id;
$model->delete();
} else {
$errors = true;
}
if ($model->getErrors()) {
$errors = true;
}
unset($model);
}
if (isset($_POST['ajax'])) {
AF::setJsonHeaders('json');
if ($errors) {
Message::echoJsonError(__('campaign_email_no_deleted'));
} else {
Message::echoJsonSuccess(__('campaign_email_deleted'));
}
}
$this->redirect();
}
示例12: getOrderID
<?php
include_once '../settings/autoload.php';
$msql = SafeMySQL::getInstance();
$orderID = AF::get($_GET, 'order_id');
$status = AF::get($_GET, 'status', 'inprogress');
// inprogress, submitted, unknown, new
if ($orderID) {
Order::finalizeOrder($orderID);
die;
}
while ($orderID = getOrderID()) {
Order::finalizeOrder($orderID);
}
function getOrderID()
{
global $msql, $status;
try {
// Open transaction
$msql->query("START TRANSACTION");
// Select attempt
$sql = "SELECT `attempt_id`, `order_id`, `status`\n FROM `attempts`\n WHERE `status`=?s\n AND `attempt_type` = 'debit'\n AND `updated` < DATE_SUB(NOW(), INTERVAL 10 MINUTE)\n LIMIT 1";
$result = $msql->getRow($sql, $status);
$attemptID = isset($result['attempt_id']) && $result['attempt_id'] ? $result['attempt_id'] : null;
$orderID = isset($result['order_id']) && $result['order_id'] ? $result['order_id'] : null;
// Update selected attempt
if ($attemptID) {
$sql = "UPDATE `attempts` SET `updated`=NOW() WHERE `attempt_id`=?i";
$msql->query($sql, $attemptID);
}
// Close transaction
示例13: exit
<?php
@(include_once '../settings/autoload.php');
$campaignID = AF::get($_GET, 'campaign_id');
if (!$campaignID) {
exit('Incorrect Campaign ID');
}
SiteApi::updateSites($campaignID);
echo 'done...';
示例14: cloneAction
function cloneAction()
{
if (isset($_POST['clone'])) {
$model = AFActiveDataProvider::models('Campaign');
$campaigns = $model->getCampaigns();
$campaigns = AF::userAccess()->array2RestrictionArray('campaign_id', $campaigns);
AF::setJsonHeaders('json');
echo json_encode(array('campaigns' => $campaigns));
die;
}
if (isset($_POST['ajax'])) {
AF::setJsonHeaders('json');
$campaign_id = AF::get($_POST, 'campaign_id', 0);
$pixel_ids = AF::get($_POST, 'pixel_id', 0);
if (AF::userAccess()->hasRestrictions('campaign_id')) {
$rf = AF::userAccess()->getRestrictionSearchFields('campaign_id', array());
if (!in_array($campaign_id, $rf)) {
Message::echoJsonError(__('pixel_not_cloned'));
}
}
if (!$pixel_ids && !$campaign_id) {
Message::echoJsonError(__('campaign_id_not_found'));
}
$pixels = explode(',', $pixel_ids);
$message = array();
$newIDs = array();
$isMany = count($pixels) > 1 ? true : false;
$isThisCampaign = true;
foreach ($pixels as $pixel_id) {
$model = new Pixel();
if (!$model->fillFromDbPk($pixel_id)) {
if ($isMany) {
continue;
}
Message::echoJsonError(__('pixel_not_found'));
}
if ($model->campaign_id != $campaign_id) {
$model->campaign_id = $campaign_id;
$isThisCampaign = false;
}
if (!$model->cloneModel()) {
if ($isMany) {
continue;
}
Message::echoJsonError(__('pixel_not_found'));
}
$newID = $newIDs[] = $model->getPkValue();
$message[] = __('pixel_cloned') . ' <a href="' . $this->controller . '/update/id=' . $newID . '">' . __('edit') . ' (ID: ' . $newID . ')</a><br>';
unset($model);
}
if (!$message) {
Message::echoJsonError(__('pixel_not_cloned'));
}
$message = implode($message);
$newIDs = implode(',', $newIDs);
$v = array('message' => $message);
if ($isThisCampaign) {
$v['newid'] = $newIDs;
}
Message::echoJsonSuccess($v);
}
}
示例15: addeventAction
function addeventAction()
{
if (isset($_POST['ajax'])) {
AF::setJsonHeaders('json');
$eventType = (int) AF::get($_POST, 'event_type', 0);
$eventID = (int) AF::get($_POST, 'event_id', 0);
$productID = (int) AF::get($_POST, 'product_id', 0);
if (isset($_POST['model']) && $_POST['model'] == 'Product') {
$errors = array();
if (!$eventID) {
$errors['event_id'] = 'Required';
}
if (!$eventType) {
$errors['event_type'] = 'Required';
}
if (!$productID) {
$errors['product_id'] = 'Required';
}
if ($errors) {
$answer['errors'] = $errors;
Message::echoJson('error', $answer);
}
$eventModel = new Event();
$eventModel->addProductByID($eventID, $productID);
$link = AF::link(array('products' => 'update'), array('id' => $productID));
Message::echoJson('success', array('redirect' => $link));
}
if ($eventType) {
//Events type list
$eventModel = new Event();
$eventsTypes = $eventModel->getEventsByTypeID($eventType);
if ($eventsTypes) {
Message::echoJsonSuccess(array('message' => $eventsTypes));
} else {
Message::echoJsonError(__('unknown_error'));
}
die;
}
}
$this->redirect();
}