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


PHP AdminHelper::elementFormSubmitted方法代码示例

本文整理汇总了PHP中AdminHelper::elementFormSubmitted方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminHelper::elementFormSubmitted方法的具体用法?PHP AdminHelper::elementFormSubmitted怎么用?PHP AdminHelper::elementFormSubmitted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AdminHelper的用法示例。


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

示例1: array

<?php

// Identify the workflow state:
if (AdminHelper::elementFormSubmitted($_POST)) {
    if (isset($_POST['do_not_verify'])) {
        $do_not_verify = 1;
    } else {
        $do_not_verify = 0;
    }
    AdminHelper::handleElementFormPOST($_POST, $cash_admin, array('message_invalid_email' => $_POST['message_invalid_email'], 'message_instructions' => $_POST['message_instructions'], 'image_url' => $_POST['image_url'], 'email_subject' => $_POST['email_subject'], 'email_message' => $_POST['email_message'], 'email_html_message' => $_POST['email_html_message'], 'message_success' => $_POST['message_success'], 'email_list_id' => $_POST['email_list_id'], 'asset_id' => $_POST['asset_id'], 'do_not_verify' => $do_not_verify));
}
// Page data needed for a blank 'add' form:
$cash_admin->page_data['options_people_lists'] = AdminHelper::echoFormOptions('items', 0, false, true);
$cash_admin->page_data['options_assets'] = AdminHelper::echoFormOptions('items', 0, false, true);
$current_element = $cash_admin->getCurrentElement();
if ($current_element) {
    // Current element found, so fill in the 'edit' form, basics first:
    AdminHelper::setBasicElementFormData($cash_admin);
    // Now any element-specific options:
    $cash_admin->page_data['options_message_invalid_email'] = $current_element['options']['message_invalid_email'];
    $cash_admin->page_data['options_message_instructions'] = $current_element['options']['message_instructions'];
    $cash_admin->page_data['options_message_success'] = $current_element['options']['message_success'];
    $cash_admin->page_data['options_message_privacy'] = $current_element['options']['message_privacy'];
    $cash_admin->page_data['options_image_url'] = $current_element['options']['image_url'];
    $cash_admin->page_data['options_email_subject'] = $current_element['options']['email_subject'];
    $cash_admin->page_data['options_email_message'] = $current_element['options']['email_message'];
    $cash_admin->page_data['options_email_html_message'] = $current_element['options']['email_html_message'];
    $cash_admin->page_data['options_do_not_verify'] = $current_element['options']['do_not_verify'];
    $cash_admin->page_data['options_people_lists'] = AdminHelper::echoFormOptions('people_lists', $current_element['options']['email_list_id'], false, true);
    $cash_admin->page_data['options_assets'] = AdminHelper::echoFormOptions('assets', $current_element['options']['asset_id'], false, true);
}
开发者ID:blacktire,项目名称:DIY,代码行数:31,代码来源:admin.php

示例2: handleElementFormPOST

 public static function handleElementFormPOST($post_data, &$cash_admin)
 {
     global $admin_primary_cash_request;
     if (AdminHelper::elementFormSubmitted($post_data)) {
         // first create the options array
         $options_array = array();
         // now populate it from the POST data, fixing booleans
         $app_json = AdminHelper::getElementAppJSON($post_data['element_type']);
         if ($app_json) {
             foreach ($app_json['options'] as $section_name => $details) {
                 foreach ($details['data'] as $data => $values) {
                     if ($values['type'] == 'boolean') {
                         if (isset($post_data[$data])) {
                             $options_array[$data] = 1;
                         } else {
                             $options_array[$data] = 0;
                         }
                     } elseif ($values['type'] == 'options') {
                         if (is_array($values['values'])) {
                             foreach ($values['values'] as $subname => $subvalues) {
                                 $options_array[$data][$subname] = $post_data[$data . '-' . $subname];
                             }
                         }
                     } else {
                         if ($values['type'] != 'scalar') {
                             $options_array[$data] = $post_data[$data];
                         }
                     }
                 }
             }
             $scalars = AdminHelper::processScalarData($post_data, $app_json);
             $options_array = array_merge($options_array, $scalars);
         }
         if (isset($post_data['doelementadd'])) {
             // Adding a new element:
             $cash_admin->setCurrentElementState('add');
             $admin_primary_cash_request->processRequest(array('cash_request_type' => 'element', 'cash_action' => 'addelement', 'name' => $post_data['element_name'], 'type' => $post_data['element_type'], 'options_data' => $options_array, 'user_id' => AdminHelper::getPersistentData('cash_effective_user')));
             if ($admin_primary_cash_request->response['status_uid'] == 'element_addelement_200') {
                 $current_campaign = false;
                 if ($post_data['in_campaign']) {
                     $current_campaign = $post_data['in_campaign'];
                 } else {
                     $current_campaign = AdminHelper::getPersistentData('current_campaign');
                 }
                 if ($current_campaign) {
                     $cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'addelementtocampaign', 'campaign_id' => $current_campaign, 'element_id' => $admin_primary_cash_request->response['payload']));
                     // handle differently for AJAX and non-AJAX
                     if ($cash_admin->page_data['data_only']) {
                         AdminHelper::formSuccess('Success. New element added.', '/');
                     } else {
                         $cash_admin->setCurrentElement($admin_primary_cash_request->response['payload']);
                     }
                 } else {
                     // handle differently for AJAX and non-AJAX
                     if ($cash_admin->page_data['data_only']) {
                         AdminHelper::formSuccess('Success. New element added.', '/elements/edit/' . $admin_primary_cash_request->response['payload']);
                     } else {
                         $cash_admin->setCurrentElement($admin_primary_cash_request->response['payload']);
                     }
                 }
             } else {
                 // handle differently for AJAX and non-AJAX
                 if ($cash_admin->page_data['data_only']) {
                     AdminHelper::formFailure('Error. Something just didn\'t work right.', '/elements/add/' . $post_data['element_type']);
                 } else {
                     $cash_admin->setErrorState('element_add_failure');
                 }
             }
         } elseif (isset($post_data['doelementedit'])) {
             // Editing an existing element:
             $cash_admin->setCurrentElementState('edit');
             $admin_primary_cash_request->processRequest(array('cash_request_type' => 'element', 'cash_action' => 'editelement', 'id' => $post_data['element_id'], 'name' => $post_data['element_name'], 'options_data' => $options_array));
             if ($admin_primary_cash_request->response['status_uid'] == 'element_editelement_200') {
                 // handle differently for AJAX and non-AJAX
                 if ($cash_admin->page_data['data_only']) {
                     // AJAX
                     AdminHelper::formSuccess('Success. Edited.', '/elements/edit/' . $post_data['element_id']);
                 } else {
                     // non-AJAX
                     $cash_admin->setCurrentElement($post_data['element_id']);
                 }
             } else {
                 // handle differently for AJAX and non-AJAX
                 if ($cash_admin->page_data['data_only']) {
                     // AJAX
                     AdminHelper::formFailure('Error. Something just didn\'t work right.', '/elements/edit/' . $post_data['element_id']);
                 } else {
                     // non-AJAX
                     $cash_admin->setErrorState('element_edit_failure');
                 }
             }
         }
         AdminHelper::setBasicElementFormData($cash_admin);
     }
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:95,代码来源:AdminHelper.php


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