Tarea #1117 -> Poder dar de baja un agente (mandar correo para informarle)
git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_PROFIND_Web/trunk@54 3fe1ab16-cfe0-e34b-8c9f-7d8c168d430d
This commit is contained in:
parent
6e67065f14
commit
fe8283a90f
@ -69,8 +69,9 @@ class EquipoController extends Controller {
|
||||
}
|
||||
|
||||
public function actionDelete($id) {
|
||||
$agente = Usuario::model()->equipo()->findByPk($id);
|
||||
|
||||
$agente = $this->loadModel($id);
|
||||
if ($agente) $agente->delete();
|
||||
|
||||
// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
|
||||
if(!isset($_GET['ajax']))
|
||||
$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index'));
|
||||
@ -107,7 +108,7 @@ class EquipoController extends Controller {
|
||||
* @param integer the ID of the model to be loaded
|
||||
*/
|
||||
public function loadModel($id) {
|
||||
$model = Usuario::model()->findByPk($id);
|
||||
$model = Usuario::model()->equipo()->findByPk($id);
|
||||
if ($model === null)
|
||||
throw new CHttpException(404, Yii::t('profind', 'La página solicitada no existe.'));
|
||||
return $model;
|
||||
|
||||
@ -65,12 +65,17 @@ class Usuario extends CActiveRecord {
|
||||
// will receive user inputs.
|
||||
return array(
|
||||
array('email, password', 'required'),
|
||||
array('email, nombre, apellidos, password, tipo, titulo, localidad, telefono', 'length', 'max' => 255),
|
||||
|
||||
array('estado', 'length', 'max' => 1),
|
||||
|
||||
array('email', 'email'),
|
||||
array('email', 'unique'),
|
||||
|
||||
array('descripcion', 'safe'),
|
||||
|
||||
array('tipo', 'default', 'value' => self::TIPO_USUARIO_COORDINADOR),
|
||||
array('email, nombre, apellidos, password, tipo, titulo, localidad, telefono', 'length', 'max' => 255),
|
||||
|
||||
array('ficheroFotografia', 'file',
|
||||
'types' => 'jpg',
|
||||
'maxSize' => 1024 * 1024 * 1, // 1MB como máximo
|
||||
@ -78,6 +83,7 @@ class Usuario extends CActiveRecord {
|
||||
'wrongType' => Yii::t('profind', 'Sólo se permiten imágenes en formato JPG.'),
|
||||
'allowEmpty' => 'true',
|
||||
),
|
||||
|
||||
array('id, id_empresa, estado, email, nombre, apellidos, tipo, titulo, localidad, telefono, descripcion', 'safe', 'on' => 'search'),
|
||||
);
|
||||
}
|
||||
|
||||
@ -13,7 +13,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-box-content cnt_a">
|
||||
|
||||
<?php
|
||||
$form = $this->beginWidget('CActiveForm', array(
|
||||
'id' => 'invitacion-agente-form',
|
||||
|
||||
@ -1,50 +1,20 @@
|
||||
<?php $this->pageTitle = Yii::t('profind', 'Lista de agentes'); ?>
|
||||
|
||||
<?php /*Yii::app()->clientScript->registerScript('ajax-link-handler', "
|
||||
$('a.delete').live('click', function(event){
|
||||
$.ajax({
|
||||
'type':'get',
|
||||
'url':$(this).attr('href') + '&ajax',
|
||||
'dataType': 'html',
|
||||
'success':function(data){
|
||||
$('#display').html(data);
|
||||
}
|
||||
});
|
||||
event.preventDefault();
|
||||
});
|
||||
");*/
|
||||
<?php Yii::app()->clientScript->registerScript('delete-link-handler', "
|
||||
$('.user_list a.delete').click(function(e) {
|
||||
e.preventDefault();
|
||||
var id = $(this).data('id');
|
||||
var boton = $('#msg_confirm_delete a.btn-danger');
|
||||
var href = boton.attr('href');
|
||||
boton.attr('href', href.replace(/&id=\d*/, '&id=' + id));
|
||||
$('#msg_confirm_delete').modal('show');
|
||||
});
|
||||
", CClientScript::POS_END);
|
||||
?>
|
||||
|
||||
|
||||
<div class="row-fluid">
|
||||
<div id="lista-agentes" class="span8">
|
||||
<h3 class="heading"><?php echo Yii::t('profind', 'Lista de agentes'); ?></h3>
|
||||
<!--
|
||||
<div class="row-fluid">
|
||||
<div class="input-prepend">
|
||||
<span class="add-on ad-on-icon"><i class="icon-user"></i></span>
|
||||
<input type="text" placeholder="<?php echo Yii::t('profind', 'Buscar agente'); ?>" class="lista-agentes-search search">
|
||||
</div>
|
||||
<ul class="nav nav-pills line_sep">
|
||||
<li class="dropdown">
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle"><?php echo Yii::t('profind', 'Ordenar por'); ?> <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu sort-by">
|
||||
<li><a data-sort="sl_name" class="sort" href="javascript:void(0)"><?php echo Yii::t('profind', 'por nombre'); ?></a></li>
|
||||
<li><a data-sort="sl_status" class="sort" href="javascript:void(0)"><?php echo Yii::t('profind', 'por estado'); ?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle"><?php echo Yii::t('profind', 'Mostrar'); ?> <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu filter">
|
||||
<li class="active"><a id="filter-none" href="javascript:void(0)"><?php echo Yii::t('profind', 'Todos'); ?></a></li>
|
||||
<li><a id="filter-online" href="javascript:void(0)"><?php echo Yii::t('profind', 'Activos'); ?></a></li>
|
||||
<li><a id="filter-offline" href="javascript:void(0)"><?php echo Yii::t('profind', 'No activos'); ?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>-->
|
||||
|
||||
|
||||
<ul class="list user_list">
|
||||
<?php if (!count($agentes)) : ?>
|
||||
<li>
|
||||
@ -73,22 +43,20 @@
|
||||
<?php endif; ?>
|
||||
<small class="s_color sl_email"><?php echo CHtml::link($agente->email, $agente->email); ?></small><br>
|
||||
|
||||
<?php echo CHtml::link(
|
||||
//CHtml::tag('i', array('class' => 'icon-trash')),
|
||||
'holaaaaa',
|
||||
array('delete', 'id' => $agente->id),
|
||||
array('class' => 'close pull-right delete')
|
||||
);
|
||||
<?php echo CHtml::link(CHtml::tag('span', array('class' => 'icon-trash')),
|
||||
'#', array(
|
||||
'data-id' => $agente->id,
|
||||
'class' => 'close pull-right delete',
|
||||
));
|
||||
?>
|
||||
<!-- a class="close pull-right delete" href="#"><i class="icon-trash"></i></a> -->
|
||||
<div class="clearfix"> </div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="span4">
|
||||
<?php if ($invitacion) : ?>
|
||||
<?php echo $this->renderPartial('_invitacion_form', array('invitacion' => $invitacion), false, true); ?>
|
||||
<?php echo $this->renderPartial('_invitacion_form', array('invitacion' => $invitacion)); ?>
|
||||
<?php else: ?>
|
||||
<h3 class="heading">Añadir un nuevo agente</h3>
|
||||
<div id="w_sort01" class="w-box">
|
||||
@ -117,3 +85,20 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="msg_confirm_delete" class="modal hide fade">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3><?php echo Yii::t('profind', 'Eliminar agente'); ?></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p><?php echo Yii::t('profind', '¿Desea eliminar el agente?'); ?></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" class="btn" data-dismiss="modal" aria-hidden="true"><?php echo Yii::t('profind', 'Volver'); ?></a>
|
||||
<?php echo CHtml::link(
|
||||
Yii::t('profind', 'Eliminar el agente'),
|
||||
$this->createUrl('delete', array('id' => 0)),
|
||||
array('class' => 'btn btn-danger')
|
||||
);?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user