Ejemplo n.º 1
0
 public function ajax_group_edit()
 {
     $group_id = intval($_POST['id']);
     $this->check_ajax_referer('red-edit_' . $group_id);
     $group = Red_Group::get($group_id);
     if ($group) {
         $json['html'] = $this->capture('group_edit', array('group' => $group, 'modules' => Red_Module::get_for_select()));
     } else {
         $json['error'] = __('Unable to perform action') . ' - could not find group';
     }
     $this->output_ajax_response($json);
 }
?>
:</th>
		<td><input style="width: 95%" type="text" name="name" value="<?php 
echo esc_attr($group->get_name());
?>
"/></td>
	</tr>
	<tr>
		<th width="70"><?php 
_e('Module', 'redirection');
?>
</th>
		<td>
			<select name="module_id">
				<?php 
foreach (Red_Module::get_for_select() as $module) {
    ?>
					<option value="<?php 
    echo esc_attr($module->get_id());
    ?>
"<?php 
    selected($module->get_id(), $group->get_module_id());
    ?>
><?php 
    echo esc_html($module->get_name());
    ?>
</option>
				<?php 
}
?>
			</select>
Ejemplo n.º 3
0
 function red_group_edit()
 {
     $id = intval($_GET['id']);
     if (check_ajax_referer('redirection-group_' . $id)) {
         $group = Red_Group::get($id);
         if ($group) {
             $this->render_admin('group_edit', array('group' => $group, 'modules' => Red_Module::get_for_select()));
         }
         die;
     }
 }
Ejemplo n.º 4
0
	
		<div id="pager" class="tablenav">
			<div class="alignleft actions">
				<select name="action2" id="action2_select">
					<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
					<option value="delete"><?php _e('Delete'); ?></option>
				</select>
				
				<input type="submit" value="<?php _e('Apply'); ?>" name="doaction2" id="actionator" class="button-secondary action" />

				<?php $pager->per_page ('redirection'); ?>

				<?php if (isset ($_GET['module'])) : ?>
					<?php _e ('Module', 'redirection'); ?>:
					<select name="module">
						<?php echo $this->select (Red_Module::get_for_select (), intval ($_GET['module']))?>
					</select>
				<?php elseif (isset ($_GET['group'])) : ?>
					<?php _e ('Group', 'redirection'); ?>:
					<select name="group">
						<?php echo $this->select (Red_Group::get_for_select (), intval ($_GET['group']))?>
					</select>
				<?php endif; ?>

				<input type="submit" value="<?php _e('Filter'); ?>" class="button-secondary" />

				<br class="clear" />
			</div>
		
			<div class="tablenav-pages">
				<?php echo $pager->page_links (); ?>
Ejemplo n.º 5
0
 function admin_groups($module)
 {
     include dirname(__FILE__) . '/models/pager.php';
     if (isset($_POST['add']) && check_admin_referer('redirection-add_group')) {
         if (Red_Group::create(stripslashes_deep($_POST))) {
             $this->render_message(__('Your group was added successfully', 'redirection'));
             Red_Module::flush($module);
         } else {
             $this->render_error(__('Please specify a group name', 'redirection'));
         }
     }
     if ($module == 0) {
         $module = Red_Module::get_first_id();
     }
     $pager = new RE_Pager($_GET, $_SERVER['REQUEST_URI'], 'position', 'ASC');
     $items = Red_Group::get_all($module, $pager);
     $this->render_admin('group_list', array('groups' => $items, 'pager' => $pager, 'modules' => Red_Module::get_for_select(), 'module' => Red_Module::get($module)));
 }
Ejemplo n.º 6
0
 function prepare_items($type = '', $id = 0)
 {
     global $wpdb;
     $options = red_get_options();
     $columns = $this->get_columns();
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, array(), $sortable);
     $this->items = Red_Module::get_for_select();
     $this->total_items = count($this->items);
     $this->set_pagination_args(array('total_items' => $this->total_items, 'per_page' => 100, 'total_pages' => ceil($this->total_items / 100)));
 }