trigger version dialog for all users
这个提交包含在:
父节点
8e486516e2
当前提交
c3ae9cb4a7
共有 3 个文件被更改,包括 108 次插入 和 43 次删除
|
|
@ -429,4 +429,20 @@ class Options extends CI_Controller {
|
|||
|
||||
}
|
||||
|
||||
function version_dialog_show_to_all() {
|
||||
$update_vd_confirmation_to_false = $this->user_options_model->set_option_at_all_users('version_dialog', 'confirmed', array('boolean' => 'false'));
|
||||
if($update_vd_confirmation_to_false == TRUE) {
|
||||
$this->session->set_flashdata('success_trigger', $this->lang->line('options_version_dialog_success_show_all'));
|
||||
}
|
||||
redirect('/options/version_dialog');
|
||||
}
|
||||
|
||||
function version_dialog_show_to_none() {
|
||||
$update_vd_confirmation_to_true = $this->user_options_model->set_option_at_all_users('version_dialog', 'confirmed', array('boolean' => 'true'));
|
||||
if($update_vd_confirmation_to_true == TRUE) {
|
||||
$this->session->set_flashdata('success_trigger', $this->lang->line('options_version_dialog_success_hide_all'));
|
||||
}
|
||||
redirect('/options/version_dialog');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,23 @@ class User_options_model extends CI_Model {
|
|||
}
|
||||
}
|
||||
|
||||
public function set_option_at_all_users($option_type, $option_name, $option_array) {
|
||||
$query = $this->db->select('user_id')->get('users');
|
||||
if ($query->num_rows() > 0) {
|
||||
foreach ($query->result() as $row) {
|
||||
$user_id = $row->user_id;
|
||||
$sql = 'INSERT INTO user_options (user_id, option_type, option_name, option_key, option_value) VALUES (?, ?, ?, ?, ?)
|
||||
ON DUPLICATE KEY UPDATE option_value = ?';
|
||||
foreach ($option_array as $option_key => $option_value) {
|
||||
$this->db->query($sql, array($user_id, $option_type, $option_name, $option_key, $option_value, $option_value));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log_message('error','set_option_at_all_users() failed because users table is empty');
|
||||
}
|
||||
}
|
||||
|
||||
public function get_options($option_type, $option_array=null) {
|
||||
$uid=$this->session->userdata('user_id');
|
||||
$sql_more = "";
|
||||
|
|
|
|||
|
|
@ -1,84 +1,116 @@
|
|||
<div class="container settings">
|
||||
|
||||
<div class="row">
|
||||
<!-- Nav Start -->
|
||||
<?php $this->load->view('options/sidebar') ?>
|
||||
<!-- Nav End -->
|
||||
<div class="row">
|
||||
<!-- Nav Start -->
|
||||
<?php $this->load->view('options/sidebar') ?>
|
||||
<!-- Nav End -->
|
||||
|
||||
<!-- Content -->
|
||||
<div class="col-md-9">
|
||||
<!-- Content -->
|
||||
<div class="col-md-9">
|
||||
<div class="card">
|
||||
<div class="card-header"><h2><?php echo $page_title; ?> - <?php echo $sub_heading; ?></h2></div>
|
||||
<div class="card-header">
|
||||
<h2><?php echo $page_title; ?> - <?php echo $sub_heading; ?></h2>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<?php if($this->session->flashdata('success0')) { ?>
|
||||
<?php if ($this->session->flashdata('success0')) { ?>
|
||||
<!-- Display Success Message -->
|
||||
<div class="alert alert-success">
|
||||
<?php echo $this->session->flashdata('success0'); ?>
|
||||
<?php echo $this->session->flashdata('success0'); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($this->session->flashdata('success1')) { ?>
|
||||
<?php if ($this->session->flashdata('success1')) { ?>
|
||||
<!-- Display Success Message -->
|
||||
<div class="alert alert-success">
|
||||
<?php echo $this->session->flashdata('success1'); ?>
|
||||
<?php echo $this->session->flashdata('success1'); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($this->session->flashdata('success2')) { ?>
|
||||
<?php if ($this->session->flashdata('success2')) { ?>
|
||||
<!-- Display Success Message -->
|
||||
<div class="alert alert-success">
|
||||
<?php echo $this->session->flashdata('success2'); ?>
|
||||
<?php echo $this->session->flashdata('success2'); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($this->session->flashdata('message')) { ?>
|
||||
<?php if ($this->session->flashdata('message')) { ?>
|
||||
<!-- Display Message -->
|
||||
<div class="alert-message error">
|
||||
<?php echo $this->session->flashdata('message'); ?>
|
||||
<?php echo $this->session->flashdata('message'); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php echo form_open('options/version_dialog_save'); ?>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="version_dialog_header"><?php echo lang('options_version_dialog_header'); ?></label>
|
||||
<input type="text" name="version_dialog_header" class="form-control" id="version_dialog_header" aria-describedby="version_dialog_header" value="<?php echo htmlspecialchars($this->optionslib->get_option('version_dialog_header') ?? ''); ?>">
|
||||
<small id="version_dialog_header_hint" class="form-text text-muted"><?php echo lang('options_version_dialog_header_hint'); ?></small>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="version_dialog_header"><?php echo lang('options_version_dialog_header'); ?></label>
|
||||
<input type="text" name="version_dialog_header" class="form-control" id="version_dialog_header" aria-describedby="version_dialog_header" value="<?php echo htmlspecialchars($this->optionslib->get_option('version_dialog_header') ?? ''); ?>">
|
||||
<small id="version_dialog_header_hint" class="form-text text-muted"><?php echo lang('options_version_dialog_header_hint'); ?></small>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="version_dialog_mode"><?php echo lang('options_version_dialog_mode'); ?></label>
|
||||
<select name="version_dialog_mode" class="form-select" id="version_dialog_mode">
|
||||
<option value="release_notes" <?php if($this->optionslib->get_option('version_dialog') == "release_notes") { echo "selected=\"selected\""; } ?>><?php echo lang('options_version_dialog_mode_release_notes'); ?></option>
|
||||
<option value="custom_text" <?php if($this->optionslib->get_option('version_dialog') == "custom_text") { echo "selected=\"selected\""; } ?>><?php echo lang('options_version_dialog_mode_custom_text'); ?></option>
|
||||
<option value="both" <?php if($this->optionslib->get_option('version_dialog') == "both") { echo "selected=\"selected\""; } ?>><?php echo lang('options_version_dialog_mode_both'); ?></option>
|
||||
<option value="disabled" <?php if($this->optionslib->get_option('version_dialog') == "disabled") { echo "selected=\"selected\""; } ?>><?php echo lang('options_version_dialog_mode_disabled'); ?></option>
|
||||
</select>
|
||||
<small id="version_dialog_mode_hint" class="form-text text-muted"><?php echo lang('options_version_dialog_mode_hint'); ?></small>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="version_dialog_mode"><?php echo lang('options_version_dialog_mode'); ?></label>
|
||||
<select name="version_dialog_mode" class="form-select" id="version_dialog_mode">
|
||||
<option value="release_notes" <?php if ($this->optionslib->get_option('version_dialog') == "release_notes") {
|
||||
echo "selected=\"selected\"";
|
||||
} ?>><?php echo lang('options_version_dialog_mode_release_notes'); ?></option>
|
||||
<option value="custom_text" <?php if ($this->optionslib->get_option('version_dialog') == "custom_text") {
|
||||
echo "selected=\"selected\"";
|
||||
} ?>><?php echo lang('options_version_dialog_mode_custom_text'); ?></option>
|
||||
<option value="both" <?php if ($this->optionslib->get_option('version_dialog') == "both") {
|
||||
echo "selected=\"selected\"";
|
||||
} ?>><?php echo lang('options_version_dialog_mode_both'); ?></option>
|
||||
<option value="disabled" <?php if ($this->optionslib->get_option('version_dialog') == "disabled") {
|
||||
echo "selected=\"selected\"";
|
||||
} ?>><?php echo lang('options_version_dialog_mode_disabled'); ?></option>
|
||||
</select>
|
||||
<small id="version_dialog_mode_hint" class="form-text text-muted"><?php echo lang('options_version_dialog_mode_hint'); ?></small>
|
||||
</div>
|
||||
|
||||
<div class="mb-3" id="version_dialog_custom_textarea" style="display: none" role="alert">
|
||||
<label for="version_dialog_custom_text"><?php echo lang('options_version_dialog_custom_text'); ?></label>
|
||||
<textarea type="text" rows="6" name="version_dialog_custom_text" class="form-control" id="version_dialog_custom_text" aria-describedby="version_dialog_custom_text"><?php echo htmlspecialchars($this->optionslib->get_option('version_dialog_text') ?? ''); ?></textarea>
|
||||
<small id="version_dialog_custom_text_hint" class="form-text text-muted"><?php echo lang('options_version_dialog_custom_text_hint'); ?></small>
|
||||
</div>
|
||||
<div class="mb-3" id="version_dialog_custom_textarea" style="display: none" role="alert">
|
||||
<label for="version_dialog_custom_text"><?php echo lang('options_version_dialog_custom_text'); ?></label>
|
||||
<textarea type="text" rows="6" name="version_dialog_custom_text" class="form-control" id="version_dialog_custom_text" aria-describedby="version_dialog_custom_text"><?php echo htmlspecialchars($this->optionslib->get_option('version_dialog_text') ?? ''); ?></textarea>
|
||||
<small id="version_dialog_custom_text_hint" class="form-text text-muted"><?php echo lang('options_version_dialog_custom_text_hint'); ?></small>
|
||||
</div>
|
||||
|
||||
<!-- Save the Form -->
|
||||
<input class="btn btn-primary" type="submit" value="<?php echo lang('options_save'); ?>" />
|
||||
<!-- Save the Form -->
|
||||
<input class="btn btn-primary" type="submit" value="<?php echo lang('options_save'); ?>" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card mt-4">
|
||||
<div class="card-header">
|
||||
<h5>Trigger Dialog for users</h5>
|
||||
<h5><?php echo lang('options_version_dialog_show_hide'); ?></h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<button class="btn btn-primary m-2">TEST 1</button>
|
||||
<button class="btn btn-primary m-2">TEST 2</button>
|
||||
<?php if ($this->session->flashdata('success_trigger')) { ?>
|
||||
<!-- Display Success Message -->
|
||||
<div class="alert alert-info">
|
||||
<?php echo $this->session->flashdata('success_trigger'); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 border-end d-flex flex-column align-items-center text-center">
|
||||
<?php echo form_open('options/version_dialog_show_to_all'); ?>
|
||||
<button class="btn btn-success m-2"><?php echo lang('options_version_dialog_show_all'); ?></button>
|
||||
</form>
|
||||
<small class="form-text text-muted"><?php echo lang('options_version_dialog_show_all_hint'); ?></small>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 d-flex flex-column align-items-center text-center">
|
||||
<?php echo form_open('options/version_dialog_show_to_none'); ?>
|
||||
<button class="btn btn-danger m-2"><?php echo lang('options_version_dialog_hide_all'); ?></button>
|
||||
</form>
|
||||
<small class="form-text text-muted"><?php echo lang('options_version_dialog_hide_all_hint'); ?></small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
正在加载…
在新工单中引用