예제 #1
0
 private function menu_user()
 {
     if (!is_user_logged_in()) {
         return;
     }
     global $current_user;
     $name_rol = get_role_name($this->role);
     echo $name_rol ? '<div class="role">' . $name_rol[0] . '</div>' : '';
     echo '<div class="menu_u_ad">';
     echo '<strong>' . $current_user->display_name . '</strong>';
     echo $current_user->user_email;
     echo '</div>';
     echo '<a href="' . wp_logout_url(get_home_url()) . '">Logout</a>';
 }
예제 #2
0
<div class="alert alert-danger alert-success fade in">     
	<h2><?php 
lang('No Access');
?>
</h2> 
    <p></p>
    <p><?php 
lang('You are not authorized to access this page.');
?>
</p>
    <p><?php 
lang('Minimum access');
?>
: <strong><?php 
echo get_role_name($role);
?>
</strong></p>           
</div>
예제 #3
0
function control_page()
{
    $ci =& get_instance();
    $page_name = $ci->uri->segment(1) . '/' . $ci->uri->segment(2);
    $data['/'] = '';
    $data['user/logout'] = '';
    $data['user/profile'] = '1';
    $data['user/new_message'] = '';
    $data['user/inbox'] = '';
    $data['user/outbox'] = '';
    $data['user/new_task'] = '';
    $data['user/task'] = '';
    $data['user/outbound_tasks'] = '';
    $data['general/about'] = '';
    if (isset($data[$page_name])) {
        ?>
        <?php 
        if (get_the_current_user('role') <= 2) {
            ?>
		<small class="pull-right"><?php 
            echo get_lang('access privileges for this page is fixed.');
            ?>
</small>
        <?php 
        }
        ?>
		<?php 
    } else {
        $role = get_option(array('option_group' => 'page_access', 'option_key' => $page_name));
        ?>
          <!-- Modal -->
          <div class="modal fade" id="modal_pageAccess" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
              <div class="modal-content">
                <div class="modal-header">
                  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                  <h4 class="modal-title"><?php 
        lang('Page Access');
        ?>
</h4>
                </div>
                <div class="modal-body">
                 <form name="form_page_access" id="form_page_access" action="" method="POST">
                    <label for="role" class="control-label ff-1 fs-16"><?php 
        lang('Role');
        ?>
</label>
                    <select name="role" id="role" class="form-control input-lg">
                      <option value="5" <?php 
        if ($role['option_value'] == 5) {
            echo 'selected';
        }
        ?>
>Personel</option>
                      <option value="4" <?php 
        if ($role['option_value'] == 4) {
            echo 'selected';
        }
        ?>
>Yetikili Personel</option>
                      <option value="3" <?php 
        if ($role['option_value'] == 3) {
            echo 'selected';
        }
        ?>
>Birim Amiri</option>
                      <option value="2" <?php 
        if ($role['option_value'] == 2) {
            echo 'selected';
        }
        ?>
>Yönetici</option>
                      <option value="1" <?php 
        if ($role['option_value'] == 1) {
            echo 'selected';
        }
        ?>
>Süper Yönetici</option>
                    </select>
                    <input type="hidden" name="page_name" id="page_name" value="<?php 
        echo $page_name;
        ?>
" />
                    <input type="hidden" name="page_access_change" id="page_access_change" />
                 </form>
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-default" data-dismiss="modal"><?php 
        lang('Close');
        ?>
</button>
                  <button type="button" class="btn btn-primary" onclick="document.getElementById('form_page_access').submit();"><?php 
        lang('Save');
        ?>
</button>
                </div>
              </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
          </div><!-- /.modal -->
     
        <!-- Button trigger modal -->

              
        <?php 
        if ($role) {
            if ($role['option_value'] < get_the_current_user('role')) {
                redirect(site_url('user/no_access/' . $role['option_value']));
            }
            ?>
            
            <?php 
            if (get_the_current_user('role') <= 2) {
                ?>
            <small class="pull-right">
                <?php 
                lang('this page');
                ?>
 <strong><?php 
                echo get_role_name($role['option_value']);
                ?>
</strong> <?php 
                lang('and greater access to users.');
                ?>
 
                [<a data-toggle="modal" href="#modal_pageAccess">değiştir</a>]
            </small>
            <?php 
            }
            ?>
            <?php 
        } else {
            ?>
            <?php 
            if (get_the_current_user('role') <= 2) {
                ?>
            <small class="pull-right">
                <?php 
                lang('anyone can access this page.');
                ?>
 [<a data-toggle="modal" href="#modal_pageAccess">değiştir</a>]
            </small>
            <?php 
            }
            ?>
            <?php 
        }
    }
}
예제 #4
0
function get_user_list($data = '')
{
    $ci =& get_instance();
    $ci->db->where('status', 1);
    $query = $ci->db->get('users')->result_array();
    ?>
    <table cellpadding="0" cellspacing="0" border="0" class="table table-hover table-bordered table-condensed dataTable_noExcel_noLength_noInformation">
    	<thead>
        	<tr>
            	<th class="hide"></th>
            	<th width="1"></th>
                <th><?php 
    lang('Display Name');
    ?>
</th>
                <th><?php 
    lang('Role');
    ?>
</th>
            </tr>
        </thead>
        <tbody>
    <?php 
    foreach ($query as $user) {
        ?>
    	<tr>
        	<td class="hide"></td>
        	<td width="1">
            	<a href="javascript:;" class="btn btn-xs btn-default btnSelected" 
            		data-user_id='<?php 
        echo $user['id'];
        ?>
' 
                	data-display_name='<?php 
        echo $user['name'] . ' ' . $user['surname'];
        ?>
'>
				<?php 
        lang('Choose');
        ?>
</a>
            </td>
            <td><?php 
        echo $user['name'];
        ?>
 <?php 
        echo $user['surname'];
        ?>
</td>
            <td><?php 
        echo get_role_name($user['role']);
        ?>
</td>
        </tr>
    <?php 
    }
    ?>
    	</tbody>
    </table>
    
    <script>
        $('.btnSelected').click(function() {
			<?php 
    if (isset($data['user_id'])) {
        ?>
$('#<?php 
        echo $data['user_id'];
        ?>
').val($(this).attr('data-user_id'));<?php 
    }
    ?>
			<?php 
    if (isset($data['display_name'])) {
        ?>
$('#<?php 
        echo $data['display_name'];
        ?>
').val($(this).attr('data-display_name'));<?php 
    }
    ?>
			$('.close').click();
		});
	</script>
    <?php 
}
function remove_role_on_plugin_deactivation()
{
    remove_role(get_role_name());
}
예제 #6
0
                    <td><a href="<?php 
    echo site_url('user/profile/' . $user['id']);
    ?>
"><?php 
    echo $user['email'];
    ?>
</a></td>
                    <td><?php 
    echo $user['name'];
    ?>
</td>
                    <td><?php 
    echo $user['surname'];
    ?>
</td>
                    <td><?php 
    echo get_role_name($user['role']);
    ?>
</td>
                </tr>
            <?php 
}
?>
            </tbody>
        </table>
        </div> <!-- /.tavle-responsive -->
	</div>
    <div class="col-md-4">
    	
    </div> <!-- /.col-md-4 -->
</div> <!-- /.row -->
$html .= '<h2>INFORMACIÓN</h2>';
$html .= '</div>';
$inputs_user = array('user_data_nombre' => array('type' => 'text', 'value' => $display_name, 'placeholder' => 'Nombre completo', 'class' => 'third_input', 'name' => 'wp_user[display_name]'), 'user_data_direccion' => array('type' => 'mail', 'value' => isset($usuario->user_email) ? $usuario->user_email : '', 'placeholder' => 'Mail', 'class' => 'third_input', 'name' => 'wp_user[user_email]'), 'user_data_birth' => array('type' => 'date', 'value' => isset($meta['user_nacimiento']) ? reset($meta['user_nacimiento']) : '', 'placeholder' => 'Fecha de Nacimiento DD-MM-AA', 'class' => 'third_input', 'name' => 'wp_user[user_nacimiento]'), 'user_data_pass' => array('type' => 'password', 'value' => '', 'placeholder' => 'Cambiar Contraseña', 'class' => 'third_input user_data_pass', 'name' => 'wp_user[pass_user]'), 'user_data_confirm_pass' => array('type' => 'password', 'value' => '', 'placeholder' => 'Confirma tu contraseña', 'class' => 'third_input user_data_confirm_pass'));
$html .= print_inputs($inputs_user, false);
$html .= '<div class="upcoming_reservations user_billing_data">';
$html .= '<h2>Datos de facturación</h2>';
$html .= '</div>';
$facturacion = get_user_meta($user_id, '_facturacion', true);
$inputs_user = array('nombre_facturacion' => array('type' => 'text', 'value' => isset($facturacion['nombre']) ? $facturacion['nombre'] : '', 'placeholder' => 'Nombre', 'maxlength' => 50, 'class' => 'third_input', 'name' => 'facturacion[nombre]'), 'apellidos_facturacion' => array('type' => 'text', 'value' => isset($facturacion['apellidos']) ? $facturacion['apellidos'] : '', 'placeholder' => 'Apellidos', 'maxlength' => 50, 'class' => 'third_input', 'name' => 'facturacion[apellidos]'), 'email_facturacion' => array('type' => 'email', 'value' => isset($facturacion['email']) ? $facturacion['email'] : '', 'placeholder' => 'Email', 'class' => 'third_input', 'name' => 'facturacion[email]'), 'user_data_address' => array('type' => 'text', 'value' => isset($facturacion['calleyNumero']) ? $facturacion['calleyNumero'] : '', 'placeholder' => 'Dirección', 'name' => 'facturacion[calleyNumero]'), 'user_data_city' => array('type' => 'text', 'value' => isset($facturacion['ciudad']) ? $facturacion['ciudad'] : '', 'placeholder' => 'Ciudad', 'class' => 'third_input', 'name' => 'facturacion[ciudad]'), 'user_data_colonia' => array('type' => 'text', 'value' => isset($facturacion['colonia']) ? $facturacion['colonia'] : '', 'placeholder' => 'Colonia', 'class' => 'third_input', 'name' => 'facturacion[colonia]'), 'user_data_addressuser_data_town' => array('type' => 'text', 'value' => isset($facturacion['estado']) ? $facturacion['estado'] : '', 'placeholder' => 'Estado', 'class' => 'half_input', 'name' => 'facturacion[estado]'), 'user_data_cp' => array('type' => 'number', 'value' => isset($facturacion['cp']) ? $facturacion['cp'] : '', 'placeholder' => 'C.P.', 'class' => 'half_input', 'name' => 'facturacion[cp]'), 'user_data_phone' => array('type' => 'tel', 'value' => isset($facturacion['telefono']) ? $facturacion['telefono'] : '', 'placeholder' => 'Teléfono', 'class' => 'half_input', 'name' => 'facturacion[telefono]'));
$html .= print_inputs($inputs_user, false);
/*ROLES--------------------------------*/
if ($admin->permisos('Gafa')) {
    $html .= '<div class="upcoming_reservations user_billing_data">';
    $html .= '<h2>Rol de usuario</h2>';
    $html .= '</div>';
    $rol_usuario = (int) get_user_meta($user_id, 'rol', true);
    $html .= '<div class="rolSelect user_data_role" data-name="rol" data-value="' . $rol_usuario . '">';
    $html .= '<span class="rol_text">Rol ' . get_role_name($rol_usuario) . '</span>';
    $html .= '<div class="rol_options">';
    foreach ($roles as $k => $rol) {
        $html .= '<p data-value="' . $k . '">Rol ' . $rol . '</p>';
    }
    $html .= '</div>';
    $html .= '</div>';
}
if ($admin->permisos('FrontDesk')) {
    $html .= '<div class="upcoming_reservations user_billing_data"><h2>Clases del usuario</h2></div>';
    $html .= expiracion_clases($user_id, true);
}
$html .= '</div>';
$html .= '</div>';