- Revisión del código en general

- Revisión de la pantalla de productos


git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_PROFIND_Web/trunk@61 3fe1ab16-cfe0-e34b-8c9f-7d8c168d430d
This commit is contained in:
David Arranz 2012-10-12 19:22:31 +00:00
parent ee0f80dc4d
commit d6455db3ed
119 changed files with 468 additions and 182 deletions

View File

@ -47,10 +47,8 @@ class UsuarioWeb extends CWebUser {
*/
public function getTieneEquipo() {
$subscripcion = $this->loadSubscripcion();
Yii::log(CVarDumper::dumpAsString($subscripcion), CLogger::LEVEL_ERROR);
if ($subscripcion)
return ($subscripcion->producto->n_agentes > 0);
return ($subscripcion->producto->max_agentes > 0);
else
return false;
}
@ -74,6 +72,15 @@ class UsuarioWeb extends CWebUser {
return ($usuario && $usuario->nombre) ? $usuario->nombreCompleto : parent::getName();
}
/**
* @brief Devuelve el email del usuario que está en sesión.
* @return string
*/
public function getEmail() {
$usuario = $this->loadUser();
return $usuario->email;
}
/**
* @brief Devuelve el usuario que ha hecho sesión.
* @return Usuario

View File

@ -87,14 +87,14 @@ $configSpecific = array(
// Save log messages on file
array(
'class' => 'CFileLogRoute',
'levels' => 'error, warning, trace, info',
//'categories' => '*',
'levels' => 'error, trace',
'categories' => 'application.*',
),
// Show log messages on web pages
array(
'class' => 'CWebLogRoute',
'levels' => 'error, warning, trace',
//'categories' => 'application.*',
'levels' => 'error, trace',
'categories' => 'application.*',
'showInFireBug' => true,
),
),

View File

@ -39,7 +39,7 @@ class EmpresaController extends Controller {
*/
public function actionModificar($id, $provider = '') {
if ($id != Yii::app()->user->id_empresa)
throw new CHttpException(404, Yii::t('profind', 'La página solicitada no existe.'));
throw new CHttpException(401, Yii::t('profind', 'Acceso no autorizado.'));
if (($provider != '') && (!isset($_POST['Empresa']))) {
switch ($provider) {
@ -62,10 +62,6 @@ class EmpresaController extends Controller {
$empresa->attributes = $_POST['Empresa'];
$ficheroLogotipo = CUploadedFile::getInstance($empresa, 'ficheroLogotipo');
Yii::log(CVarDumper::dumpAsString($_POST['Empresa']), CLogger::LEVEL_ERROR);
Yii::log(CVarDumper::dumpAsString($empresa->attributes), CLogger::LEVEL_ERROR);
Yii::log(CVarDumper::dumpAsString($ficheroLogotipo), CLogger::LEVEL_ERROR);
$quitarLogotipo = Yii::app()->request->getParam('quitar_logotipo', '0');
if ($empresa->save()) {

View File

@ -61,7 +61,7 @@ class EquipoController extends Controller {
$agentes = Usuario::model()->equipo()->findAll();
if (count($agentes) >= Yii::app()->user->subscripcion->producto->n_agentes)
if (count($agentes) >= Yii::app()->user->subscripcion->producto->max_agentes)
$invitacion = NULL;
$this->render('index', array(

View File

@ -1,7 +1,9 @@
<?php
class SubscripcionController extends Controller
{
class SubscripcionController extends Controller {
public $defaultAction = 'modificar';
/**
* @return array action filters
*/
@ -29,26 +31,31 @@ class SubscripcionController extends Controller
);
}
public function actionModificar($id)
{
$model = $this->loadModel($id);
public function actionModificar($id) {
Yii::trace('Ver/modificar la subscripción del usuario', 'application.controllers.SubscripcionController');
if ($id != Yii::app()->user->subscripcion->id)
throw new CHttpException(401, Yii::t('profind', 'Acceso no autorizado.'));
$subscripcion = $this->loadModel($id);
$criterial = new CDbCriteria();
$criterial->order = 'tipo DESC, id';
$productos = Producto::model()->findAll($criterial);
if (isset($_POST['Subscripcion'])) {
$model->attributes = $_POST['Subscripcion'];
$subscripcion->attributes = $_POST['Subscripcion'];
if ($model->id_producto < 10)
$model->id_producto = 1;
else
$model->id_producto = 2;
if ($model->save()) {
Yii::app()->user->setFlash('success', Yii::t('profind', 'Se ha actualizado de producto'));
$this->redirect(array('modificar', 'id' => $model->id));
if ($subscripcion->save()) {
Yii::trace('Se ha modificado la subscripción del usuario', 'application.controllers.UsuarioController');
EMail::enviarNotificacionCambioProducto(Yii::app()->user->email, $subscripcion->producto->id);
Yii::app()->user->setFlash('success', Yii::t('profind', 'Se ha actualizado su producto'));
$this->redirect(array('modificar', 'id' => $id));
}
}
$this->render('modificar', array(
'model' => $model,
$this->render('index', array(
'subscripcion' => $subscripcion,
'productos' => $productos,
));
}

View File

@ -126,7 +126,7 @@ class UsuarioController extends Controller {
Yii::trace('Cambiar la password del usuario', 'application.controllers.UsuarioController');
if ($id != Yii::app()->user->id)
throw new CHttpException(404, Yii::t('profind', 'La página solicitada no existe.'));
throw new CHttpException(401, Yii::t('profind', 'Acceso no autorizado.'));
$formulario = new FormularioCambiarPassword;
$this->performAjaxValidation($formulario, 'cambiar-password-form');
@ -456,7 +456,7 @@ class UsuarioController extends Controller {
*/
public function actionModificar($id, $provider = '') {
if ($id != Yii::app()->user->id)
throw new CHttpException(404, Yii::t('profind', 'La página solicitada no existe.'));
throw new CHttpException(401, Yii::t('profind', 'Acceso no autorizado.'));
if (($provider != '') && (!isset($_POST['Usuario']))) {
switch ($provider) {
@ -504,7 +504,7 @@ class UsuarioController extends Controller {
*/
public function actionDelete($id) {
if ($id != Yii::app()->user->id)
throw new CHttpException(404, Yii::t('profind', 'La página solicitada no existe.'));
throw new CHttpException(401, Yii::t('profind', 'Acceso no autorizado.'));
if (Yii::app()->request->isAjaxRequest) {
$resultado = array();

View File

@ -1,47 +1,3 @@
-- phpMyAdmin SQL Dump
-- version 3.4.5
-- http://www.phpmyadmin.net
--
-- Servidor: localhost
-- Tiempo de generación: 28-09-2012 a las 15:29:17
-- Versión del servidor: 5.5.16
-- Versión de PHP: 5.3.8
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Base de datos: `usuarios_dev`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `tbl_productos`
--
CREATE TABLE IF NOT EXISTS `tbl_productos` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`titulo` varchar(255) DEFAULT NULL,
`n_agentes` int(11) DEFAULT NULL,
`n_publicaciones` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Volcado de datos para la tabla `tbl_productos`
--
INSERT INTO `tbl_productos` (`id`, `titulo`, `n_agentes`, `n_publicaciones`) VALUES
(1, '1 Publicación - Gratis', NULL, 1),
(2, 'Hasta 5 Agentes - 500 euros/mes', 5, NULL);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

View File

@ -143,7 +143,7 @@ class YiiSocialConnect extends CApplicationComponent {
}
if ($this->errorCode)
Yii::log($this->getErrorMessage(), CLogger::LEVEL_ERROR);
Yii::log($this->getErrorMessage(), CLogger::LEVEL_TRACE);
return !$this->errorCode;
}

View File

@ -137,5 +137,24 @@ class EMail {
'solicitud_cancelacion_usuario',
array('email' => $destino, 'url' => $url_cancelacion));
}
/**
* @brief Envía un correo confirmando el cambio de producto.
* @param string $destino dirección de destino
* @param string $id_producto identificación del producto
* @return boolean
*/
public static function enviarNotificacionCambioProducto($destino, $id_producto) {
Yii::trace('Enviando correo confirmando el cambio de producto', 'application.helpers.EMail');
$producto = Producto::model()->findByPk($id_producto);
return self::_enviar($destino,
Yii::t('profind', 'Se ha modificado su producto en PROFIND'),
'notificacion_cambio_producto', array(
'email' => $destino,
'producto' => $producto->titulo,
'importe' => $producto->coste_mensual,
));
}
}
?>

View File

@ -0,0 +1,25 @@
<?php
class m121010_091340_tbl_productos extends CDbMigration {
public function safeUp() {
$this->dropColumn('tbl_productos', 'n_agentes');
$this->dropColumn('tbl_productos', 'n_publicaciones');
$this->addColumn('tbl_productos', 'tipo', 'string');
$this->addColumn('tbl_productos', 'coste_mensual', 'decimal(10,2)');
$this->addColumn('tbl_productos', 'max_agentes', 'decimal(2,0)');
$this->addColumn('tbl_productos', 'max_publicaciones', 'decimal(4,0)');
$this->addColumn('tbl_productos', 'predeterminado', 'boolean'); // tinyint(1)
}
public function safeDown() {
$this->dropColumn('tbl_productos', 'tipo');
$this->dropColumn('tbl_productos', 'coste_mensual');
$this->dropColumn('tbl_productos', 'max_agentes');
$this->dropColumn('tbl_productos', 'max_publicaciones');
$this->dropColumn('tbl_productos', 'predeterminado');
$this->addColumn('tbl_productos', 'n_agentes', 'integer');
$this->addColumn('tbl_productos', 'n_publicaciones', 'integer');
}
}

View File

@ -6,8 +6,12 @@
* The followings are the available columns in table 'tbl_productos':
* @property integer $id
* @property string $titulo
* @property integer $n_agentes
* @property integer $n_publicaciones
* @property string $max_agentes
* @property string $max_publicaciones
* @property integer $predeterminado
*
* The followings are the available model relations:
* @property TblSubscripciones[] $tblSubscripciones
*/
class Producto extends CActiveRecord
{
@ -37,22 +41,24 @@ class Producto extends CActiveRecord
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('n_agentes, n_publicaciones', 'numerical', 'integerOnly'=>true),
array('predeterminado', 'boolean', 'allowEmpty'=>false),
array('titulo', 'length', 'max'=>255),
array('max_agentes', 'length', 'max'=>2),
array('max_publicaciones', 'length', 'max'=>4),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id, titulo, n_agentes, n_publicaciones', 'safe', 'on'=>'search'),
array('id, titulo, max_agentes, max_publicaciones, predeterminado', 'safe', 'on'=>'search'),
);
}
public function scopes() {
return array(
'productoInicial' => array(
'condition' => 'id = 1',
'condition' => 'predeterminado = 1',
'limit' => 1,
),
);
}
}
/**
* @return array relational rules.
@ -62,7 +68,7 @@ class Producto extends CActiveRecord
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'subscripciones' => array(self::HAS_MANY, 'Subscripcion', 'id_producto'),
'subscripciones' => array(self::HAS_MANY, 'Subscripcion', 'id_producto'),
);
}
@ -74,8 +80,9 @@ class Producto extends CActiveRecord
return array(
'id' => 'ID',
'titulo' => 'Titulo',
'n_agentes' => 'N Agentes',
'n_publicaciones' => 'N Publicaciones',
'max_agentes' => 'Max Agentes',
'max_publicaciones' => 'Max Publicaciones',
'predeterminado' => 'Predeterminado',
);
}
@ -92,8 +99,9 @@ class Producto extends CActiveRecord
$criteria->compare('id',$this->id);
$criteria->compare('titulo',$this->titulo,true);
$criteria->compare('n_agentes',$this->n_agentes);
$criteria->compare('n_publicaciones',$this->n_publicaciones);
$criteria->compare('max_agentes',$this->max_agentes,true);
$criteria->compare('max_publicaciones',$this->max_publicaciones,true);
$criteria->compare('predeterminado',$this->predeterminado);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,

View File

@ -0,0 +1,21 @@
<html>
<head>
<title>Se ha modificado su producto en PROFIND</title>
</head>
<body>
<h3>Se ha modificado su producto en PROFIND</h3>
<p>Ha recibido este correo como confirmación de su cambio de producto en <a href="http://www.profindtic.com/">http://www.profindtic.com</a>.</p>
<p>Su nuevo producto es: <strong><?php echo $producto; ?></strong></p>
<p>Datos para realizar el pago:<br>
Forma de pago: <strong>Transferencia bancaria</strong><br>
Código de cuenta: <strong>XXXX-XXXX-XX-XXXXXXXXX</strong><br>
Importe: <strong><?php echo Yii::app()->numberFormatter->formatCurrency($importe, 'EUR'); ?></strong>
</p>
<p>
Este correo se ha enviado desde <a href="http://www.profindtic.com/">http://www.profindtic.com</a>.<br>
No responda a este correo ya que ha sido generado automáticamente para su información.
</p>
<p>El equipo de <a href="http://www.profindtic.com/">PROFIND</a></p>
</body>
</html>

View File

@ -0,0 +1,64 @@
.table-comparison {
text-align: center;
}
.table-comparison th {
background-color: #D1D1D1;
background-image: -moz-linear-gradient(center top , #D1D1D1, #ABABAB);
background-repeat: repeat-x;
border-color: #ABABAB #ABABAB #A1A1A1;
text-shadow: 0 -1px 0 #D1D1D1;
}
.table-comparison th.equipo {
background-color: #0088CC;
background-image: -moz-linear-gradient(center top , #0088CC, #0044CC);
background-repeat: repeat-x;
border-color: #ABABAB;
color: #FFFFFF;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.table-comparison th.personal {
background-color: #FAA732;
background-image: -moz-linear-gradient(center top , #FBB450, #F89406);
background-repeat: repeat-x;
border-color: #eee;
color: #FFFFFF;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.table-comparison, .table-comparison td, .table-comparison th {
border-color: #ABABAB;
}
.table-comparison tr th {
padding: 15px;
width: 145px;
}
.table-comparison tr td {
font-size: 1.1em;
}
.table-comparison tr td:first-child {
font-size: 1em;
padding: 15px;
text-align: left;
}
.table-comparison .icon-ok, .table-comparison .icon-ok-circle {
color: #51A351;
}
.table-comparison .icon-remove, .table-comparison .icon-remove-circle {
color: #BD362F;
}
.table-comparison .icon-star {
color: #F89406;
}
.table-comparison .icon-star-half {
color: #FBB450;
}
.table-comparison .icon-star-empty {
color: #ABABAB;
}
.table-comparison td a {
margin-bottom: 5px;
}

View File

@ -158,7 +158,7 @@ form .row-fluid + .row-fluid {
margin-top: 10px !important
}
.main_content .row-fluid + .row-fluid {
margin-top: 10px
margin-top: 30px
}
.nav-pills + .nav-pills {
margin-left: 20px;

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 800 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 737 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 935 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 922 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 883 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 919 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 735 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 937 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 966 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 868 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 808 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1009 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1000 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 989 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 994 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 985 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 655 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 773 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 970 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 906 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 813 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 917 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1019 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 767 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 742 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 845 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 834 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 919 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 700 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 996 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 926 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 732 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 986 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

Some files were not shown because too many files have changed in this diff Show More