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


PHP AdminHelper::formFailure方法代码示例

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


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

示例1: strtotime

if (isset($_POST['doeventedit'])) {
    // do the actual list add stuffs...
    $event_id = $request_parameters[0];
    $eventispublished = 0;
    $eventiscancelled = 0;
    if (isset($_POST['event_ispublished'])) {
        $eventispublished = 1;
    }
    if (isset($_POST['event_iscancelled'])) {
        $eventiscancelled = 1;
    }
    $edit_response = $cash_admin->requestAndStore(array('cash_request_type' => 'calendar', 'cash_action' => 'editevent', 'date' => strtotime($_POST['event_date']), 'venue_id' => $_POST['event_venue'], 'comment' => $_POST['event_comment'], 'purchase_url' => $_POST['event_purchase_url'], 'published' => $eventispublished, 'cancelled' => $eventiscancelled, 'event_id' => $event_id));
    if ($edit_response['status_uid'] == 'calendar_editevent_200') {
        AdminHelper::formSuccess('Success. Edited.');
    } else {
        AdminHelper::formFailure('Error. There was a problem editing.');
    }
}
$event_response = $cash_admin->requestAndStore(array('cash_request_type' => 'calendar', 'cash_action' => 'getevent', 'event_id' => $request_parameters[0]));
$current_event = $event_response['payload'];
if (is_array($current_event)) {
    $cash_admin->page_data = array_merge($cash_admin->page_data, $current_event);
    $venue_response = $cash_admin->requestAndStore(array('cash_request_type' => 'calendar', 'cash_action' => 'getvenue', 'venue_id' => $current_event['venue_id']));
    $venue_details = $venue_response['payload'];
    if ($venue_details) {
        $display_string = $venue_details['name'];
        if (strtolower($venue_details['country']) == 'usa' || strtolower($venue_details['country']) == 'canada') {
            $display_string .= ' / ' . $venue_details['city'] . ', ' . $venue_details['region'];
        } else {
            $display_string .= ' / ' . $venue_details['city'] . ', ' . $venue_details['country'];
        }
开发者ID:JamesLinus,项目名称:platform,代码行数:31,代码来源:calendar_events_edit.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

示例3: array

<?php

// first handle add
if (isset($_POST['dotemplateset'])) {
    // form was submitted. set the template
    $effective_user = $cash_admin->effective_user_id;
    if (!isset($_POST['template_id'])) {
        $template_id = false;
    } else {
        $template_id = $_POST['template_id'];
    }
    $template_response = $cash_admin->requestAndStore(array('cash_request_type' => 'system', 'cash_action' => 'settemplate', 'template' => $_POST['template'], 'template_id' => $template_id, 'user_id' => $effective_user));
    if ($template_response['payload']) {
        AdminHelper::formSuccess('Success.', '/elements/templates/' . $template_response['payload']);
    } else {
        AdminHelper::formFailure('Error. Something just didn\'t work right.', '/elements/templates/');
    }
}
// get all the templates
$template_response = $cash_admin->requestAndStore(array('cash_request_type' => 'system', 'cash_action' => 'gettemplatesforuser', 'user_id' => $cash_admin->effective_user_id));
if (is_array($template_response['payload'])) {
    $page_templates = array();
    $embed_templates = array();
    foreach ($template_response['payload'] as $template) {
        if ($template['type'] == 'page') {
            $page_templates[] = $template;
        } elseif ($template['type'] == 'embed') {
            $embed_templates[] = $template;
        }
    }
    if (count($page_templates)) {
开发者ID:JamesLinus,项目名称:platform,代码行数:31,代码来源:elements_templates.php

示例4: str_replace

        $html_content = str_replace('{{subject}}', strip_tags($_POST['mail_subject']), $html_content);
    } else {
        if ($_POST['template_id'] == 'none') {
            $html_content = $_POST['html_content'];
        } else {
            $html_content = Markdown($_POST['html_content']);
        }
    }
    // make sure we include an unsubscribe link
    if (!stripos($html_content, '{{{unsubscribe_link}}}')) {
        if (stripos($html_content, '</body>')) {
            $html_content = str_ireplace('</body>', '<br /><br />{{{unsubscribe_link}}}</body>', $html_content);
        } else {
            $html_content = $html_content . '<br /><br />{{{unsubscribe_link}}}';
        }
    }
    $mailing_response = $cash_admin->requestAndStore(array('cash_request_type' => 'people', 'cash_action' => 'addmailing', 'user_id' => $cash_admin->effective_user_id, 'list_id' => $_POST['email_list_id'], 'connection_id' => $_POST['connection_id'], 'subject' => $_POST['mail_subject'], 'from_name' => $_POST['mail_from'], 'html_content' => $html_content));
    $mailing_result = $cash_admin->requestAndStore(array('cash_request_type' => 'people', 'cash_action' => 'sendmailing', 'mailing_id' => $mailing_response['payload']));
    if ($mailing_result) {
        AdminHelper::formSuccess('Success. The mail is sent, just kick back and watch.', '/people/mailings/');
    } else {
        AdminHelper::formFailure('Error. Something just didn\'t work right.', '/people/mailings/');
    }
}
$settings_test_object = new CASHConnection(AdminHelper::getPersistentData('cash_effective_user'));
$settings_test_array = $settings_test_object->getConnectionsByScope('mass_email');
if ($settings_test_array) {
    $cash_admin->page_data['options_people_lists'] = AdminHelper::echoFormOptions('people_lists', 0, false, true);
    $cash_admin->page_data['connection_options'] = AdminHelper::echoConnectionsOptions('mass_email', 0, true);
}
$cash_admin->setPageContentTemplate('people_mailings');
开发者ID:JamesLinus,项目名称:platform,代码行数:31,代码来源:people_mailings.php

示例5:

                            $cash_admin->runAtLogin();
                            AdminHelper::formSuccess('Welcome!', '/');
                        } else {
                            AdminHelper::formFailure('Please try again.', '/');
                        }
                    } else {
                        AdminHelper::formFailure('Please try again.', '/');
                    }
                }
            }
        }
        // and this for the actual password reset after return folks submit the reset form:
        if (isset($_POST['finalizepasswordreset'])) {
            $valid_key = $cash_admin->requestAndStore(array('cash_request_type' => 'system', 'cash_action' => 'validateresetflag', 'address' => $_POST['address'], 'key' => $_POST['key']));
            if ($valid_key) {
                $id_response = $cash_admin->requestAndStore(array('cash_request_type' => 'people', 'cash_action' => 'getuseridforaddress', 'address' => $_POST['address']));
                if ($id_response['payload']) {
                    $change_response = $cash_admin->requestAndStore(array('cash_request_type' => 'system', 'cash_action' => 'setlogincredentials', 'user_id' => $id_response['payload'], 'address' => $_POST['address'], 'password' => $_POST['new_password'], 'is_admin' => 1));
                    if ($change_response['payload'] !== false) {
                        AdminHelper::formSuccess('Successfully changed the password. Go ahead and log in.', '/');
                    } else {
                        AdminHelper::formFailure('There was an error setting your password. Please try again.', '/');
                    }
                } else {
                    AdminHelper::formFailure('There was an error setting the password. Please try again.', '/');
                }
            }
        }
        $cash_admin->setPageContentTemplate('login');
    }
}
开发者ID:JamesLinus,项目名称:platform,代码行数:31,代码来源:login.php

示例6: handleRedirectReturn

 public static function handleRedirectReturn($data = false)
 {
     if (isset($data['error'])) {
         return 'There was an error. (general) Please try again.';
     } else {
         $connections = CASHSystem::getSystemSettings('system_connections');
         require_once CASH_PLATFORM_ROOT . '/lib/twitter/OAuth.php';
         require_once CASH_PLATFORM_ROOT . '/lib/twitter/twitteroauth.php';
         $temporary_credentials = AdminHelper::getPersistentData('twitter_temporary_credentials');
         $twitter = new TwitterOAuth($connections['com.twitter']['client_id'], $connections['com.teitter']['client_secret'], $temporary_credentials['oauth_token'], $temporary_credentials['oauth_token_secret']);
         $access_token = $twitter->getAccessToken($_REQUEST['oauth_verifier']);
         if ($twitter->http_code == 200) {
             // we can safely assume (AdminHelper::getPersistentData('cash_effective_user') as the OAuth
             // calls would only happen in the admin. If this changes we can fuck around with it later.
             $new_connection = new CASHConnection(AdminHelper::getPersistentData('cash_effective_user'));
             $result = $new_connection->setSettings('@' . $access_token['screen_name'] . ' (Twitter)', 'com.twitter', array('token' => $access_token));
             if ($result) {
                 AdminHelper::formSuccess('Success. Connection added. You\'ll see it in your list of connections.', '/settings/connections/');
             } else {
                 AdminHelper::formFailure('Error. Could not save connection.', '/settings/connections/');
             }
         } else {
             AdminHelper::formFailure('Error. Problem communicating with Twitter', '/settings/connections/');
         }
     }
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:26,代码来源:TwitterSeed.php

示例7: handleRedirectReturn

 public static function handleRedirectReturn($data = false)
 {
     $connections = CASHSystem::getSystemSettings('system_connections');
     if (isset($connections['com.amazon'])) {
         $s3_default_email = $connections['com.amazon']['email'];
     } else {
         $s3_default_email = false;
     }
     $success = S3Seed::connectAndAuthorize($data['key'], $data['secret'], $data['bucket'], $s3_default_email);
     if ($success) {
         // we can safely assume (AdminHelper::getPersistentData('cash_effective_user') as the OAuth
         // calls would only happen in the admin. If this changes we can fuck around with it later.
         $new_connection = new CASHConnection(AdminHelper::getPersistentData('cash_effective_user'));
         $connection_name = $data['bucket'] . ' (Amazon S3)';
         if (substr($connection_name, 0, 10) == 'cashmusic.') {
             $connection_name = 'Amazon S3 (created ' . date("M j, Y") . ')';
         }
         $result = $new_connection->setSettings($connection_name, 'com.amazon', array('bucket' => $data['bucket']));
         if ($result) {
             AdminHelper::formSuccess('Success. Connection added. You\'ll see it in your list of connections.', '/settings/connections/');
         } else {
             AdminHelper::formFailure('Error. Something just didn\'t work right.');
         }
     } else {
         //$return_markup = '<h4>Error</h4>'
         //			   . '<p>We couldn\'t connect with your S3 account. Please check the key and secret.</p>';
         AdminHelper::formFailure('We couldn\'t connect your S3 account. Please check the key and secret.');
     }
     return $return_markup;
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:30,代码来源:S3Seed.php

示例8: array

<?php

$cash_admin->page_data['country_codes'] = AdminHelper::drawCountryCodeUL();
$effective_user = $cash_admin->effective_user_id;
if (isset($_POST['docontactadd'])) {
    $add_response = $cash_admin->requestAndStore(array('cash_request_type' => 'people', 'cash_action' => 'addcontact', 'user_id' => $effective_user, 'email_address' => $_POST['email_address'], 'first_name' => $_POST['first_name'], 'last_name' => $_POST['last_name'], 'organization' => $_POST['organization'], 'address_line1' => $_POST['address1'], 'address_city' => $_POST['address_city'], 'address_region' => $_POST['address_region'], 'address_postalcode' => $_POST['address_postalcode'], 'address_country' => $_POST['address_country'], 'phone' => $_POST['phone']));
    if ($add_response['payload']) {
        AdminHelper::formSuccess('Success. Contact added.');
    } else {
        AdminHelper::formFailure('Error. Something just didn\'t work right.');
    }
}
$initials_response = $cash_admin->requestAndStore(array('cash_request_type' => 'people', 'cash_action' => 'getcontactinitials', 'user_id' => $effective_user));
if ($initials_response['payload']) {
    $alphabet = array('A' => array('letter' => 'A', 'contact' => false), 'B' => array('letter' => 'B', 'contact' => false), 'C' => array('letter' => 'C', 'contact' => false), 'D' => array('letter' => 'D', 'contact' => false), 'E' => array('letter' => 'E', 'contact' => false), 'F' => array('letter' => 'F', 'contact' => false), 'G' => array('letter' => 'G', 'contact' => false), 'H' => array('letter' => 'H', 'contact' => false), 'I' => array('letter' => 'I', 'contact' => false), 'J' => array('letter' => 'J', 'contact' => false), 'K' => array('letter' => 'K', 'contact' => false), 'L' => array('letter' => 'L', 'contact' => false), 'M' => array('letter' => 'M', 'contact' => false), 'N' => array('letter' => 'N', 'contact' => false), 'O' => array('letter' => 'O', 'contact' => false), 'P' => array('letter' => 'P', 'contact' => false), 'Q' => array('letter' => 'Q', 'contact' => false), 'R' => array('letter' => 'R', 'contact' => false), 'S' => array('letter' => 'S', 'contact' => false), 'T' => array('letter' => 'T', 'contact' => false), 'U' => array('letter' => 'U', 'contact' => false), 'V' => array('letter' => 'V', 'contact' => false), 'W' => array('letter' => 'W', 'contact' => false), 'X' => array('letter' => 'X', 'contact' => false), 'Y' => array('letter' => 'Y', 'contact' => false), 'Z' => array('letter' => 'Z', 'contact' => false));
    if (is_array($initials_response['payload'])) {
        foreach ($initials_response['payload'] as $value) {
            if (array_key_exists($value['initial'], $alphabet)) {
                $alphabet[$value['initial']]['contact'] = true;
            }
        }
        $cash_admin->page_data['alphabet'] = new ArrayIterator($alphabet);
    }
}
if (isset($request_parameters[1])) {
    if ($request_parameters[0] == 'bylastname') {
        $contacts_response = $cash_admin->requestAndStore(array('cash_request_type' => 'people', 'cash_action' => 'getcontactsbyinitials', 'user_id' => $effective_user, 'initial' => $request_parameters[1]));
        if ($contacts_response['payload']) {
            $cash_admin->page_data['contact_list'] = new ArrayIterator($contacts_response['payload']);
        }
    }
开发者ID:JamesLinus,项目名称:platform,代码行数:31,代码来源:people_contacts.php

示例9: handleRedirectReturn

 public static function handleRedirectReturn($data = false)
 {
     if (isset($data['code'])) {
         $connections = CASHSystem::getSystemSettings('system_connections');
         if (isset($connections['com.google.drive'])) {
             $credentials = GoogleDriveSeed::exchangeCode($data['code'], $connections['com.google.drive']['client_id'], $connections['com.google.drive']['client_secret'], $connections['com.google.drive']['redirect_uri']);
             $user_info = GoogleDriveSeed::getUserInfo($credentials, $connections['com.google.drive']['client_id'], $connections['com.google.drive']['client_secret']);
             if ($user_info) {
                 $email_address = $user_info['email'];
                 $user_id = $user_info['id'];
             } else {
                 $email_address = false;
                 $user_id = false;
             }
             $credentials_array = json_decode($credentials, true);
             if (isset($credentials_array['refresh_token'])) {
                 // we can safely assume (AdminHelper::getPersistentData('cash_effective_user') as the OAuth
                 // calls would only happen in the admin. If this changes we can fuck around with it later.
                 $new_connection = new CASHConnection(AdminHelper::getPersistentData('cash_effective_user'));
                 $result = $new_connection->setSettings($email_address . ' (Google Drive)', 'com.google.drive', array('user_id' => $user_id, 'email_address' => $email_address, 'access_token' => $credentials, 'access_expires' => $credentials_array['created'] + $credentials_array['expires_in'], 'refresh_token' => $credentials_array['refresh_token']));
                 if (!$result) {
                     $settings_for_user = $new_connection->getAllConnectionsforUser();
                     if (is_array($settings_for_user)) {
                         foreach ($settings_for_user as $key => $connection_data) {
                             if ($connection_data['name'] == $email_address . ' (Google Drive)') {
                                 $result = $connection_data['id'];
                                 break;
                             }
                         }
                     }
                 }
                 if (isset($data['return_result_directly'])) {
                     return $result;
                 } else {
                     if ($result) {
                         AdminHelper::formSuccess('Success. Connection added. You\'ll see it in your list of connections.', '/settings/connections/');
                     } else {
                         AdminHelper::formFailure('Error. Something just didn\'t work right.', '/settings/connections/');
                     }
                 }
             } else {
                 return 'Could not find a refresh token from google';
             }
         } else {
             return 'Please add default google drive app credentials.';
         }
     } else {
         return 'There was an error. (session) Please try again.';
     }
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:50,代码来源:GoogleDriveSeed.php

示例10: array

<?php

$misc_message = false;
if (isset($_POST['domisc'])) {
    CASHSystem::setSystemSetting('timezone', $_POST['timezone']);
    CASHSystem::setSystemSetting('systememail', $_POST['systememail']);
    AdminHelper::formSuccess('Success. All changed.');
}
$migrate_message = false;
if (isset($_POST['domigrate'])) {
    $new_settings = array('hostname' => $_POST['hostname'], 'username' => $_POST['adminuser'], 'password' => $_POST['adminpassword'], 'database' => $_POST['databasename']);
    $migrate_response = $cash_admin->requestAndStore(array('cash_request_type' => 'system', 'cash_action' => 'migratedb', 'todriver' => $_POST['driver'], 'tosettings' => $new_settings));
    if ($migrate_response['payload']) {
        AdminHelper::formSuccess('Success. Database upgraded. Enjoy!');
    } else {
        AdminHelper::formFailure('Error. There was a problem migrating your data.');
    }
}
$platform_settings = CASHSystem::getSystemSettings();
$cash_admin->page_data['system_email'] = $platform_settings['systememail'];
$cash_admin->page_data['timezone_options'] = AdminHelper::drawTimeZones($platform_settings['timezone']);
$db_types = array('mysql' => 'MySQL', 'sqlite' => 'SQLite');
$db_type = 'unknown';
if (array_key_exists($platform_settings['driver'], $db_types)) {
    $cash_admin->page_data['db_type'] = $db_types[$platform_settings['driver']];
}
if ($cash_admin->page_data['db_type'] == 'MySQL') {
    $cash_admin->page_data['migrate_from_mysql'] = true;
} elseif ($cash_admin->page_data['db_type'] == 'SQLite') {
    $cash_admin->page_data['migrate_from_sqlite'] = true;
}
开发者ID:JamesLinus,项目名称:platform,代码行数:31,代码来源:settings.php

示例11: array_map

    }
}
if (isset($_POST['dobatchcontactsadd'])) {
    if (!empty($_POST['element_content'])) {
        $email_array = array_map('trim', explode(",", str_replace(PHP_EOL, ',', $_POST['element_content'])));
        if (count($email_array) > 0) {
            $total_added = 0;
            foreach ($email_array as $address) {
                $add_response = $cash_admin->requestAndStore(array('cash_request_type' => 'people', 'cash_action' => 'addaddresstolist', 'do_not_verify' => 1, 'address' => $address, 'list_id' => $request_parameters[0]));
                if ($add_response['payload']) {
                    $total_added++;
                }
            }
            AdminHelper::formSuccess('Success. Added ' . $total_added . ' new people.', '/people/lists/view/' . $request_parameters[0]);
        } else {
            AdminHelper::formFailure('Error. There was a problem adding new people.', '/people/lists/view/' . $request_parameters[0]);
        }
    } else {
        $cash_admin->page_data['error_message'] = 'Error. Please try again.';
    }
}
$current_response = $cash_admin->requestAndStore(array('cash_request_type' => 'people', 'cash_action' => 'getlist', 'list_id' => $request_parameters[0]));
$cash_admin->page_data['ui_title'] = '' . $current_response['payload']['name'] . '';
$current_list = $current_response['payload'];
$cash_admin->page_data['no_selected_connection'] = true;
if (is_array($current_list)) {
    $cash_admin->page_data = array_merge($cash_admin->page_data, $current_list);
    if ($current_list['connection_id'] != 0) {
        $cash_admin->page_data['no_selected_connection'] = false;
    }
}
开发者ID:JamesLinus,项目名称:platform,代码行数:31,代码来源:people_lists_batch_edit.php

示例12: foreach

                $result = $page_data_object->setSettings($_POST['settings_name'], $_POST['settings_type'], $settings_data_array, $_POST['connection_id']);
                if ($result) {
                    $cash_admin->page_data['action_message'] = '<strong>Success.</strong> All changed. See connection below.';
                } else {
                    $cash_admin->page_data['action_message'] = '<strong>Error.</strong> Something went wrong.';
                }
            }
            break;
        case 'delete':
            $connection_id = $request_parameters[1];
            $result = $page_data_object->deleteSettings($connection_id);
            if ($result) {
                AdminHelper::formSuccess('Success. Deleted. Sad.', '/');
                //$cash_admin->page_data['action_message'] = '<strong>Success.</strong> All gone. Sad.';
            } else {
                AdminHelper::formFailure('Something went wrong.', '/');
                //$cash_admin->page_data['action_message'] = '<strong>Error.</strong> Something went wrong.';
            }
            break;
    }
}
if (!$settings_action || isset($_POST['dosettingsadd']) || isset($_POST['dosettingsedit']) || $settings_action == 'delete') {
    $cash_admin->page_data['state_markup'] = '<h4>Current connections:</h4>' . '<p>Here are the settings that have already been added:</p>';
    $settings_for_user = $page_data_object->getAllConnectionsforUser();
    if (is_array($settings_for_user)) {
        foreach ($settings_for_user as $key => $data) {
            $cash_admin->page_data['state_markup'] .= '<div class="callout">' . '<h6>' . $data['name'] . '</h6>';
            if (array_key_exists($data['type'], $settings_types_data)) {
                $cash_admin->page_data['state_markup'] .= '<p><strong>' . $settings_types_data[$data['type']]['name'] . '</strong>';
            }
            $cash_admin->page_data['state_markup'] .= '&nbsp; <span class="fadedtext nobr">Created: ' . date('M jS, Y', $data['creation_date']) . '</p>';
开发者ID:JamesLinus,项目名称:platform,代码行数:31,代码来源:settings_connections.php

示例13:

    $addvenue_address1 = '';
    $addvenue_address2 = '';
    $addvenue_postalcode = '';
    $addvenue_url = '';
    $addvenue_phone = '';
    if (isset($_POST['venue_address1'])) {
        $addvenue_address1 = $_POST['venue_address1'];
    }
    if (isset($_POST['venue_address2'])) {
        $addvenue_address2 = $_POST['venue_address2'];
    }
    if (isset($_POST['venue_postalcode'])) {
        $addvenue_postalcode = $_POST['venue_postalcode'];
    }
    if (isset($_POST['venue_url'])) {
        $addvenue_url = $_POST['venue_url'];
    }
    if (isset($_POST['venue_phone'])) {
        $addvenue_phone = $_POST['venue_phone'];
    }
    $add_response = $cash_admin->requestAndStore(array('cash_request_type' => 'calendar', 'cash_action' => 'addvenue', 'name' => $_POST['venue_name'], 'city' => $_POST['venue_city'], 'region' => $_POST['venue_region'], 'country' => $_POST['venue_country'], 'address1' => $addvenue_address1, 'address2' => $addvenue_address2, 'postalcode' => $addvenue_postalcode, 'url' => $addvenue_url, 'phone' => $addvenue_phone));
    if ($add_response['payload']) {
        AdminHelper::formSuccess('Success. Venue added.', '/calendar/venues/edit/' . $add_response['payload']);
    } else {
        AdminHelper::formFailure('Error. Something just didn\'t work right.', '/calendar/venues/add/');
    }
}
$cash_admin->page_data['form_state_action'] = 'dovenueadd';
$cash_admin->page_data['venue_button_text'] = 'Add the venue';
$cash_admin->page_data['country_options'] = AdminHelper::drawCountryCodeUL();
$cash_admin->setPageContentTemplate('calendar_venues_details');
开发者ID:JamesLinus,项目名称:platform,代码行数:31,代码来源:calendar_venues_add.php

示例14: handleRedirectReturn

 public static function handleRedirectReturn($data = false)
 {
     if (!isset($data['state'])) {
         return "Please start the Dropbox authentication flow from the beginning.";
     }
     $connections = CASHSystem::getSystemSettings('system_connections');
     if (!isset($connections['com.dropbox'])) {
         return 'Please add default Dropbox credentials.';
     }
     $auth_client = DropboxSeed::getWebAuthClient($connections['com.dropbox']['redirect_uri']);
     try {
         list($token, $user_id) = $auth_client->finish($data);
     } catch (Exception $e) {
         $token = false;
     }
     if (!$token) {
         return "The Dropbox authentication flow failed - please try again.";
     }
     $new_connection = new CASHConnection(AdminHelper::getPersistentData('cash_effective_user'));
     $result = $new_connection->setSettings($user_id . ' (Dropbox)', 'com.dropbox', array('access_token' => $token, 'user_id' => $user_id));
     if (!$result) {
         $settings_for_user = $new_connection->getAllConnectionsforUser();
         if (is_array($settings_for_user)) {
             foreach ($settings_for_user as $key => $connection_data) {
                 if ($connection_data['name'] == $user_id . ' (Dropbox)') {
                     $result = $connection_data['id'];
                     break;
                 }
             }
         }
     }
     if (isset($data['return_result_directly'])) {
         return $result;
     } else {
         if ($result) {
             AdminHelper::formSuccess('Success. Connection added. You\'ll see it in your list of connections.', '/settings/connections/');
         } else {
             AdminHelper::formFailure('Error. Something just didn\'t work right.', '/settings/connections/');
         }
     }
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:41,代码来源:DropboxSeed.php

示例15: array

                } else {
                    if ($_POST['metadata_command'] == 'addtometadata') {
                        if (!isset($new_metadata[$_POST['metadata_name']])) {
                            $new_metadata[$_POST['metadata_name']] = array();
                        }
                        $new_metadata[$_POST['metadata_name']][] = $add_response['payload'];
                    }
                }
                // now make the actual edits
                $effective_user = $cash_admin->effective_user_id;
                $edit_response = $cash_admin->requestAndStore(array('cash_request_type' => 'asset', 'cash_action' => 'editasset', 'id' => $_POST['parent_id'], 'user_id' => $effective_user, 'metadata' => $new_metadata));
            }
        }
        AdminHelper::formSuccess('Success. Asset added. Feel free to start adding details.', '/assets/edit/' . $add_response['payload']);
    } else {
        AdminHelper::formFailure('Error. Something just didn\'t work right.', '/assets/add/');
    }
}
$cash_admin->page_data['form_state_action'] = 'doassetadd';
$cash_admin->page_data['asset_button_text'] = 'Save changes';
// create type options with current selected:
if (isset($request_parameters[0])) {
    $add_type = $request_parameters[0];
    $cash_admin->page_data['type'] = $add_type;
    $cash_admin->page_data['ui_title'] = 'Assets: Add a ' . $add_type;
    if ($add_type == 'file') {
        // connection options markup:
        $cash_admin->page_data['connection_options'] = '<option value="0" selected="selected">None (Normal http:// link)</option>';
        $cash_admin->page_data['connection_options'] .= AdminHelper::echoConnectionsOptions('assets', 0, true);
        $cash_admin->page_data['show_location'] = true;
    }
开发者ID:JamesLinus,项目名称:platform,代码行数:31,代码来源:assets_add.php


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