本文整理汇总了PHP中RGFormsModel::duplicate_form方法的典型用法代码示例。如果您正苦于以下问题:PHP RGFormsModel::duplicate_form方法的具体用法?PHP RGFormsModel::duplicate_form怎么用?PHP RGFormsModel::duplicate_form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RGFormsModel
的用法示例。
在下文中一共展示了RGFormsModel::duplicate_form方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: form_list_page
public static function form_list_page()
{
global $wpdb;
if (!GFCommon::ensure_wp_version()) {
return;
}
echo GFCommon::get_remote_message();
$action = RGForms::post("action");
$bulk_action = RGForms::post("bulk_action");
$bulk_action = !empty($bulk_action) ? $bulk_action : RGForms::post("bulk_action2");
if ($action == "trash") {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post("action_argument");
RGFormsModel::trash_form($form_id);
$message = __('Form moved to the trash.', 'gravityforms');
} else {
if ($action == "restore") {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post("action_argument");
RGFormsModel::restore_form($form_id);
$message = __('Form restored.', 'gravityforms');
} else {
if ($action == "delete") {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post("action_argument");
if (GFCommon::current_user_can_any("gravityforms_delete_forms")) {
RGFormsModel::delete_form($form_id);
$message = __('Form deleted.', 'gravityforms');
} else {
$message = __("You don't have adequate permissions to delete forms.", 'gravityforms');
}
} else {
if ($action == "duplicate") {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post("action_argument");
RGFormsModel::duplicate_form($form_id);
$message = __('Form duplicated.', 'gravityforms');
}
}
}
}
if ($bulk_action) {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_ids = is_array(rgpost('form')) ? rgpost('form') : array();
$form_count = count($form_ids);
switch ($bulk_action) {
case 'trash':
GFFormsModel::trash_forms($form_ids);
$message = _n('%s form moved to the trash.', '%s forms moved to the trash.', $form_count, 'gravityforms');
break;
case 'restore':
GFFormsModel::restore_forms($form_ids);
$message = _n('%s form restored.', '%s forms restored.', $form_count, 'gravityforms');
break;
case 'delete':
if (GFCommon::current_user_can_any("gravityforms_delete_forms")) {
GFFormsModel::delete_forms($form_ids);
$message = _n('%s form deleted.', '%s forms deleted.', $form_count, 'gravityforms');
} else {
$message = __("You don't have adequate permissions to delete forms.", 'gravityforms');
}
break;
case 'reset_views':
foreach ($form_ids as $form_id) {
GFFormsModel::delete_views($form_id);
}
$message = _n('Views for %s form have been reset.', 'Views for %s forms have been reset.', $form_count, 'gravityforms');
break;
case 'delete_entries':
if (GFCommon::current_user_can_any("gravityforms_delete_entries")) {
foreach ($form_ids as $form_id) {
GFFormsModel::delete_leads_by_form($form_id);
}
$message = _n('Entries for %s form have been deleted.', 'Entries for %s forms have been deleted.', $form_count, 'gravityforms');
} else {
$message = __("You don't have adequate permissions to delete entries.", "gravityforms");
}
break;
case 'activate':
foreach ($form_ids as $form_id) {
GFFormsModel::update_form_active($form_id, 1);
}
$message = _n('%s form has been marked as active.', '%s forms have been marked as active.', $form_count, 'gravityforms');
break;
case 'deactivate':
foreach ($form_ids as $form_id) {
GFFormsModel::update_form_active($form_id, 0);
}
$message = _n('%s form has been marked as inactive.', '%s forms have been marked as inactive.', $form_count, 'gravityforms');
break;
}
if (isset($message)) {
$message = sprintf($message, $form_count);
}
}
$sort_column = empty($_GET["sort"]) ? "title" : $_GET["sort"];
$sort_direction = empty($_GET["dir"]) ? "ASC" : $_GET["dir"];
$active = RGForms::get("active") == "" ? null : RGForms::get("active");
$trash = RGForms::get("trash") == "" ? false : RGForms::get("trash");
$trash = esc_attr($trash);
//.........这里部分代码省略.........
示例2: form_list_page
public static function form_list_page()
{
global $wpdb;
if (!GFCommon::ensure_wp_version()) {
return;
}
echo GFCommon::get_remote_message();
$action = RGForms::post("action");
$bulk_action = RGForms::post("bulk_action");
$bulk_action = !empty($bulk_action) ? $bulk_action : RGForms::post("bulk_action2");
if ($action == "delete") {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post("action_argument");
RGFormsModel::delete_form($form_id);
} else {
if ($action == "duplicate") {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post("action_argument");
RGFormsModel::duplicate_form($form_id);
} else {
if ($bulk_action == "delete") {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_ids = RGForms::post("form");
RGFormsModel::delete_forms($form_ids);
} else {
if ($bulk_action == "reset_views") {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_ids = RGForms::post("form");
foreach ($form_ids as $form_id) {
RGFormsModel::delete_views($form_id);
}
} else {
if ($bulk_action == "delete_entries") {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_ids = RGForms::post("form");
foreach ($form_ids as $form_id) {
RGFormsModel::delete_leads_by_form($form_id);
}
}
}
}
}
}
$active = RGForms::get("active") == "" ? null : RGForms::get("active");
$forms = RGFormsModel::get_forms($active, "title");
$form_count = RGFormsModel::get_form_count();
?>
<script>
function DeleteForm(form_id){
jQuery("#action_argument").val(form_id);
jQuery("#action").val("delete");
jQuery("#forms_form")[0].submit();
}
function DuplicateForm(form_id){
jQuery("#action_argument").val(form_id);
jQuery("#action").val("duplicate");
jQuery("#forms_form")[0].submit();
}
function ToggleActive(img, form_id){
var is_active = img.src.indexOf("active1.png") >=0
if(is_active){
img.src = img.src.replace("active1.png", "active0.png");
jQuery(img).attr('title','<?php
_e("Inactive", "gravityforms");
?>
').attr('alt', '<?php
_e("Inactive", "gravityforms");
?>
');
}
else{
img.src = img.src.replace("active0.png", "active1.png");
jQuery(img).attr('title','<?php
_e("Active", "gravityforms");
?>
').attr('alt', '<?php
_e("Active", "gravityforms");
?>
');
}
UpdateCount("active_count", is_active ? -1 : 1);
UpdateCount("inactive_count", is_active ? 1 : -1);
var mysack = new sack("<?php
echo admin_url("admin-ajax.php");
?>
" );
mysack.execute = 1;
mysack.method = 'POST';
mysack.setVar( "action", "rg_update_form_active" );
mysack.setVar( "rg_update_form_active", "<?php
echo wp_create_nonce("rg_update_form_active");
?>
" );
mysack.setVar( "form_id", form_id);
mysack.setVar( "is_active", is_active ? 0 : 1);
mysack.encVar( "cookie", document.cookie, false );
//.........这里部分代码省略.........
示例3: form_list_page
public static function form_list_page()
{
global $wpdb;
if (!GFCommon::ensure_wp_version()) {
return;
}
echo GFCommon::get_remote_message();
$action = RGForms::post('action');
$bulk_action = RGForms::post('bulk_action');
$bulk_action = !empty($bulk_action) ? $bulk_action : RGForms::post('bulk_action2');
if ($action == 'trash') {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post('action_argument');
RGFormsModel::trash_form($form_id);
$message = __('Form moved to the trash.', 'gravityforms');
} else {
if ($action == 'restore') {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post('action_argument');
RGFormsModel::restore_form($form_id);
$message = __('Form restored.', 'gravityforms');
} else {
if ($action == 'delete') {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post('action_argument');
if (GFCommon::current_user_can_any('gravityforms_delete_forms')) {
RGFormsModel::delete_form($form_id);
$message = __('Form deleted.', 'gravityforms');
} else {
$message = __("You don't have adequate permission to delete forms.", 'gravityforms');
}
} else {
if ($action == 'duplicate') {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = RGForms::post('action_argument');
RGFormsModel::duplicate_form($form_id);
$message = __('Form duplicated.', 'gravityforms');
}
}
}
}
if ($bulk_action) {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_ids = is_array(rgpost('form')) ? rgpost('form') : array();
$form_count = count($form_ids);
switch ($bulk_action) {
case 'trash':
GFFormsModel::trash_forms($form_ids);
$message = _n('%s form moved to the trash.', '%s forms moved to the trash.', $form_count, 'gravityforms');
break;
case 'restore':
GFFormsModel::restore_forms($form_ids);
$message = _n('%s form restored.', '%s forms restored.', $form_count, 'gravityforms');
break;
case 'delete':
if (GFCommon::current_user_can_any('gravityforms_delete_forms')) {
GFFormsModel::delete_forms($form_ids);
$message = _n('%s form deleted.', '%s forms deleted.', $form_count, 'gravityforms');
} else {
$message = __("You don't have adequate permissions to delete forms.", 'gravityforms');
}
break;
case 'reset_views':
foreach ($form_ids as $form_id) {
GFFormsModel::delete_views($form_id);
}
$message = _n('Views for %s form have been reset.', 'Views for %s forms have been reset.', $form_count, 'gravityforms');
break;
case 'delete_entries':
if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
foreach ($form_ids as $form_id) {
GFFormsModel::delete_leads_by_form($form_id);
}
$message = _n('Entries for %s form have been deleted.', 'Entries for %s forms have been deleted.', $form_count, 'gravityforms');
} else {
$message = __("You don't have adequate permission to delete entries.", 'gravityforms');
}
break;
case 'activate':
foreach ($form_ids as $form_id) {
GFFormsModel::update_form_active($form_id, 1);
}
$message = _n('%s form has been marked as active.', '%s forms have been marked as active.', $form_count, 'gravityforms');
break;
case 'deactivate':
foreach ($form_ids as $form_id) {
GFFormsModel::update_form_active($form_id, 0);
}
$message = _n('%s form has been marked as inactive.', '%s forms have been marked as inactive.', $form_count, 'gravityforms');
break;
}
if (isset($message)) {
$message = sprintf($message, $form_count);
}
}
$sort_column = empty($_GET['sort']) ? 'title' : $_GET['sort'];
$db_columns = GFFormsModel::get_form_db_columns();
if (!in_array(strtolower($sort_column), $db_columns)) {
$sort_column = 'title';
}
//.........这里部分代码省略.........
示例4: process_action
function process_action()
{
$single_action = rgpost('single_action');
$remote_action = rgget('action');
//action initiated at other pages (i.e. trash command from form menu)
$bulk_action = $this->current_action();
if (!($single_action || $bulk_action || $remote_action)) {
return;
}
if ($single_action) {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_id = rgpost('single_action_argument');
switch ($single_action) {
case 'trash':
RGFormsModel::trash_form($form_id);
$message = __('Form moved to the trash.', 'gravityforms');
break;
case 'restore':
RGFormsModel::restore_form($form_id);
$message = __('Form restored.', 'gravityforms');
break;
case 'delete':
if (GFCommon::current_user_can_any('gravityforms_delete_forms')) {
RGFormsModel::delete_form($form_id);
$message = __('Form deleted.', 'gravityforms');
} else {
$message = __("You don't have adequate permission to delete forms.", 'gravityforms');
}
break;
case 'duplicate':
RGFormsModel::duplicate_form($form_id);
$message = __('Form duplicated.', 'gravityforms');
break;
}
} elseif ($remote_action) {
$form_id = rgget('arg');
switch ($remote_action) {
case 'trash':
check_admin_referer("gf_delete_form_{$form_id}");
RGFormsModel::trash_form($form_id);
$message = __('Form moved to the trash.', 'gravityforms');
break;
case 'duplicate':
check_ajax_referer("gf_duplicate_form_{$form_id}");
RGFormsModel::duplicate_form($form_id);
$message = __('Form duplicated.', 'gravityforms');
break;
}
} elseif ($bulk_action) {
check_admin_referer('gforms_update_forms', 'gforms_update_forms');
$form_ids = is_array(rgpost('form')) ? rgpost('form') : array();
$form_count = count($form_ids);
$message = '';
switch ($bulk_action) {
case 'trash':
GFFormsModel::trash_forms($form_ids);
$message = _n('%s form moved to the trash.', '%s forms moved to the trash.', $form_count, 'gravityforms');
break;
case 'restore':
GFFormsModel::restore_forms($form_ids);
$message = _n('%s form restored.', '%s forms restored.', $form_count, 'gravityforms');
break;
case 'delete':
if (GFCommon::current_user_can_any('gravityforms_delete_forms')) {
GFFormsModel::delete_forms($form_ids);
$message = _n('%s form deleted.', '%s forms deleted.', $form_count, 'gravityforms');
} else {
$message = __("You don't have adequate permissions to delete forms.", 'gravityforms');
}
break;
case 'reset_views':
foreach ($form_ids as $form_id) {
GFFormsModel::delete_views($form_id);
}
$message = _n('Views for %s form have been reset.', 'Views for %s forms have been reset.', $form_count, 'gravityforms');
break;
case 'delete_entries':
if (GFCommon::current_user_can_any('gravityforms_delete_entries')) {
foreach ($form_ids as $form_id) {
GFFormsModel::delete_leads_by_form($form_id);
}
$message = _n('Entries for %s form have been deleted.', 'Entries for %s forms have been deleted.', $form_count, 'gravityforms');
} else {
$message = __("You don't have adequate permission to delete entries.", 'gravityforms');
}
break;
case 'activate':
foreach ($form_ids as $form_id) {
GFFormsModel::update_form_active($form_id, 1);
}
$message = _n('%s form has been marked as active.', '%s forms have been marked as active.', $form_count, 'gravityforms');
break;
case 'deactivate':
foreach ($form_ids as $form_id) {
GFFormsModel::update_form_active($form_id, 0);
}
$message = _n('%s form has been marked as inactive.', '%s forms have been marked as inactive.', $form_count, 'gravityforms');
break;
}
if (!empty($message)) {
//.........这里部分代码省略.........