Skip to content

Commit 9a36912

Browse files
committed
examen
1 parent de12682 commit 9a36912

File tree

67 files changed

+388
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+388
-5
lines changed

backend/log/general/Site_General_errors.log

+1
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@
2828
06/06/18 22:55:16 PM | error loadView general | basket | response 400
2929
06/06/18 22:55:26 PM | error loadView general | basket | response 400
3030
06/06/18 22:56:22 PM | error loadView general | basket | response 400
31+
11/06/18 16:22:16 PM | error loadView general | courses | response 400

backend/log/user/Site_User_errors.log

+1
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ error loadView general | 06.06.2018 22:55:12 | User: | Controller:basket | f
2828
error loadView general | 06.06.2018 22:55:16 | User: | Controller:basket | function:response 400
2929
error loadView general | 06.06.2018 22:55:26 | User: | Controller:basket | function:response 400
3030
error loadView general | 06.06.2018 22:56:22 | User: | Controller:basket | function:response 400
31+
error loadView general | 11.06.2018 16:22:17 | User: | Controller:courses | function:response 400

backend/media/courses/1710941570-v.jpeg

100644100755
File mode changed.

backend/media/courses/1933800640-user.png

100644100755
File mode changed.

backend/media/courses/2137181358-user.png

100644100755
File mode changed.

backend/media/courses/91825791-v.jpeg

100644100755
File mode changed.

backend/media/users/1OuSdTIEcxYQ1YR5e6JYcUl0yzq1.gif

100644100755
File mode changed.

backend/media/users/LyCaMofY0NQiiJmGHxjENsaqRFo2.jpeg

100644100755
File mode changed.

backend/media/users/YVKlN1Dz2ofnHH1UzGc54AKLfB12.gif

100644100755
File mode changed.

backend/media/users/giovani.png

100644100755
File mode changed.

backend/media/users/iando.gif

100644100755
File mode changed.

backend/media/users/pepon.jpeg

100644100755
File mode changed.

backend/media/users/prueba.jpg

100644100755
File mode changed.

backend/module/basket/controller/controller_basket.class.php

100644100755
File mode changed.

backend/module/basket/model/BLL/basket_bll.class.singleton.php

100644100755
File mode changed.

backend/module/basket/model/DAO/basket_dao.class.singleton.php

100644100755
File mode changed.

backend/module/basket/model/model/basket_model.class.singleton.php

100644100755
File mode changed.

backend/module/basket/resources/functions.xml

100644100755
File mode changed.

backend/module/courses/controller/controller_courses.class.php

+72
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,47 @@ function __construct() {
88
$_SESSION['module'] = "courses";
99
}
1010

11+
function puntos(){
12+
echo "string";exit;
13+
}
14+
15+
function puntuarCurso(){
16+
$res["success"]=false;
17+
$verificaToken=verificaToken($_POST["token"]);
18+
if ($verificaToken["success"]) {
19+
try{
20+
$usuario = loadModel(MODEL_PROFILE, "profile_model", "userByToken", $_POST);
21+
if (count($usuario)==1) {
22+
$res["success"]=true;
23+
$datos=array(
24+
"user"=>$usuario[0]["user_name"],
25+
"id_curso"=>$_POST["curso"],
26+
"puntos"=>$_POST["puntos"]);
27+
// echo json_encode($datos);exit;
28+
29+
30+
$verificaPuntos=loadModel(MODEL_COURSES, "courses_model", "verificaPuntos", $datos );
31+
if (count($verificaPuntos)==0) {
32+
$insertarPuntuacionComentario = loadModel(MODEL_COURSES, "courses_model", "insertarPuntuacion", $datos);
33+
$res["mensaje"]="Puntiacion exitosa";
34+
}else{
35+
$res["mensaje"]="Ya as puntuado este";
36+
}
37+
38+
}else{
39+
$res["mensaje"]="Error comprobacion de token";
40+
}
41+
} catch (Exception $e) {
42+
$res["mensaje"]="Error comprobacion de datos.";
43+
}
44+
echo json_encode($res);exit;
45+
}else{
46+
$res["mensaje"]="Error comprobacion de credenciales.";
47+
echo json_encode($res);exit;
48+
}
49+
// echo json_encode($_POST);exit;
50+
}
51+
1152

1253
function verComentarios(){
1354
$id=$_GET['param'];
@@ -54,6 +95,37 @@ function getAllCourses(){
5495
);
5596
try {
5697
$courses=loadModel(MODEL_COURSES, "courses_model", "getAllCourses");
98+
$cursosPuntuados=loadModel(MODEL_COURSES, "courses_model", "cursosPuntuados");
99+
// $a=array(
100+
// );
101+
// $verificaPuntos=loadModel(MODEL_COURSES, "courses_model", "verificaPuntos" );
102+
103+
$cursosPuntos=loadModel(MODEL_COURSES, "courses_model", "cursosPuntos");
104+
// $cursosMedia=loadModel(MODEL_COURSES, "courses_model", "cursosMedia");
105+
// SELECT Avg(p.puntuacion) AS Promedio FROM puntuaciones as p GROUP BY p.id_curso
106+
107+
for ($j=0; $j <count($courses) ; $j++) {
108+
// $courses[$j]["cantPuntuaciones"]="0";
109+
$courses[$j]["media"]="0";
110+
for ($i=0; $i <count($cursosPuntuados) ; $i++) {
111+
if ($courses[$j]["id"]===$cursosPuntuados[$i]["id_curso"]) {
112+
// $courses[$j]["cantPuntuaciones"]=$cursosPuntuados[$i]["cantidad"];
113+
$courses[$j]["media"]=$cursosPuntuados[$i]["promedio"];
114+
}
115+
}
116+
}
117+
118+
for ($j=0; $j <count($courses) ; $j++) {
119+
$courses[$j]["cantPuntuaciones"]="0";
120+
// $courses[$j]["media"]="0";
121+
for ($i=0; $i <count($cursosPuntuados) ; $i++) {
122+
if ($courses[$j]["id"]===$cursosPuntos[$i]["id_curso"]) {
123+
$courses[$j]["cantPuntuaciones"]=$cursosPuntos[$i]["cantidad"];
124+
// $courses[$j]["media"]=$cursosPuntuados[$i]["promedio"];
125+
}
126+
}
127+
}
128+
57129
$res["success"]=true;
58130
$res["category"]=$_GET['param'];
59131
$res["datos"]=$courses;

backend/module/courses/model/BLL/courses_bll.class.singleton.php

+12
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,16 @@ public function verComentarios_BLL($arrArgument){
5555
public function insertarComentario_BLL($arrArgument){
5656
return $this->dao->insertarComentario_DAO($this->db,$arrArgument);
5757
}
58+
public function insertarPuntuacion_BLL($arrArgument){
59+
return $this->dao->insertarPuntuacion_DAO($this->db,$arrArgument);
60+
}
61+
public function cursosPuntuados_BLL($arrArgument){
62+
return $this->dao->cursosPuntuados_DAO($this->db,$arrArgument);
63+
}
64+
public function cursosPuntos_BLL($arrArgument){
65+
return $this->dao->cursosPuntos_DAO($this->db,$arrArgument);
66+
}
67+
public function verificaPuntos_BLL($arrArgument){
68+
return $this->dao->verificaPuntos_DAO($this->db,$arrArgument);
69+
}
5870
}

backend/module/courses/model/DAO/courses_dao.class.singleton.php

+26
Original file line numberDiff line numberDiff line change
@@ -144,5 +144,31 @@ public function insertarComentario_DAO($db, $arrArgument) {
144144
// echo json_encode($sql);exit;
145145
return $db->ejecutar($sql);
146146
}
147+
public function insertarPuntuacion_DAO($db, $arrArgument) {
148+
$curso=$arrArgument["id_curso"];
149+
$user=$arrArgument["user"];
150+
$puntos=$arrArgument["puntos"];
151+
152+
$sql = "INSERT INTO puntuaciones (id_curso, user, puntuacion) VALUES ('$curso', '$user', '$puntos' )";
153+
return $db->ejecutar($sql);
154+
}
155+
public function cursosPuntos_DAO($db, $arrArgument) {
156+
$sql = "SELECT COUNT(DISTINCT p.user) as cantidad, p.id_curso FROM puntuaciones as p GROUP BY p.id_curso";
157+
return $db->listar($db->ejecutar($sql));
158+
}
159+
160+
public function cursosPuntuados_DAO($db, $arrArgument) {
161+
$sql = "SELECT Avg(p.puntuacion) AS promedio, COUNT(DISTINCT p.user) as cantidad, p.id_curso FROM puntuaciones as p GROUP BY p.id_curso";
162+
// $sql = "SELECT COUNT(DISTINCT p.user) as cantidad, p.id_curso FROM puntuaciones as p GROUP BY p.id_curso";
163+
return $db->listar($db->ejecutar($sql));
164+
}
165+
public function verificaPuntos_DAO($db, $arrArgument) {
166+
$curso=$arrArgument["id_curso"];
167+
$user=$arrArgument["user"];
168+
169+
$sql = "SELECT * FROM puntuaciones where user='$user' and id_curso='$curso'";
170+
// $sql = "SELECT COUNT(DISTINCT p.user) as cantidad, p.id_curso FROM puntuaciones as p GROUP BY p.id_curso";
171+
return $db->listar($db->ejecutar($sql));
172+
}
147173

148174
}//End productDAO

backend/module/courses/model/model/courses_model.class.singleton.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,16 @@ public function create_course($arrArgument) {
5151
public Function insertarComentario($arrArgument){
5252
return $this->bll->insertarComentario_BLL($arrArgument);
5353
}
54-
54+
public Function insertarPuntuacion($arrArgument){
55+
return $this->bll->insertarPuntuacion_BLL($arrArgument);
56+
}
57+
public Function cursosPuntuados($arrArgument){
58+
return $this->bll->cursosPuntuados_BLL($arrArgument);
59+
}
60+
public Function cursosPuntos($arrArgument){
61+
return $this->bll->cursosPuntos_BLL($arrArgument);
62+
}
63+
public Function verificaPuntos($arrArgument){
64+
return $this->bll->verificaPuntos_BLL($arrArgument);
65+
}
5566
}

backend/module/courses/resources/functions.xml

+12
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,18 @@
8888
<name>comentarCurso</name>
8989
<uri>comentarCurso</uri>
9090
</function>
91+
<function>
92+
<name>puntuarCurso</name>
93+
<uri>puntuarCurso</uri>
94+
</function>
95+
<function>
96+
<name>puntos</name>
97+
<uri>puntos</uri>
98+
</function>
99+
<function>
100+
<name>cursosPuntuados</name>
101+
<uri>cursosPuntuados</uri>
102+
</function>
91103

92104

93105
</functions>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
@session_start();
3+
4+
class controller_examen {
5+
6+
function __construct() {
7+
$_SESSION['module'] = "examen";
8+
}
9+
10+
11+
function a(){
12+
// echo ($_GET["param"]);exit;
13+
// echo (MODEL_EXAMEN);exit;
14+
$cursos = loadModel(MODEL_EXAMEN, "examen_model", "nombre", $_GET["param"]);
15+
echo json_encode($cursos);exit;
16+
}
17+
18+
19+
}/*end class*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
class examen_bll{
4+
5+
private $dao;
6+
private $db;
7+
static $_instance;
8+
9+
private function __construct() {
10+
$this->dao = examen_dao::getInstance();
11+
$this->db = db::getInstance();
12+
}
13+
14+
public static function getInstance() {
15+
if (!(self::$_instance instanceof self)){
16+
self::$_instance = new self();
17+
}
18+
return self::$_instance;
19+
}
20+
21+
public function nombre_BLL($arrArgument){
22+
return $this->dao->nombre_DAO($this->db, $arrArgument);
23+
}
24+
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
class examen_dao {
4+
static $_instance;
5+
6+
private function __construct() {
7+
8+
}
9+
10+
public static function getInstance() {
11+
if(!(self::$_instance instanceof self)){
12+
self::$_instance = new self();
13+
}
14+
return self::$_instance;
15+
}
16+
17+
18+
19+
public function nombre_DAO($db, $arr) {
20+
/*$sql = "SELECT * FROM courses WHERE id='".$id."'";*/
21+
// echo ($arr);exit;
22+
$sql = "SELECT * FROM users";
23+
return $db->listar($db->ejecutar($sql));
24+
25+
}
26+
27+
28+
29+
}//End productDAO
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
class examen_model {
4+
private $bll;
5+
static $_instance;
6+
7+
private function __construct() {
8+
$this->bll = examen_bll::getInstance();
9+
}
10+
11+
public static function getInstance() {
12+
if (!(self::$_instance instanceof self)){
13+
self::$_instance = new self();
14+
}
15+
return self::$_instance;
16+
}
17+
18+
public function nombre($arrArgument) {
19+
return $this->bll->nombre_BLL($arrArgument);
20+
}
21+
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<functions>
3+
<function>
4+
<name>a</name>
5+
<uri>a</uri>
6+
</function>
7+
8+
</functions>

backend/module/profile/controller/controller_profile.class.php

+3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ function datosPerfil(){
3535
$cursosConLike = loadModel(MODEL_PROFILE, "profile_model", "traerCursosConLike", $usuario);
3636
$cursosComentados = loadModel(MODEL_PROFILE, "profile_model", "traercursosComentados", $usuario);
3737

38+
$cursosPuntuados = loadModel(MODEL_PROFILE, "profile_model", "traercursosPuntuados", $usuario[0]["user_name"]);
39+
3840
/*TRABAJANDO CON CURSOS COMENTADOS*/
3941
$cad="";
4042
$id="";
@@ -65,6 +67,7 @@ function datosPerfil(){
6567
}
6668

6769
$res["cursosComentados"]= $cursosComentadosInfo;
70+
$res["cursosPuntuados"]= $cursosPuntuados;
6871
$res["cursosConLike"]= $cursosConLike;
6972
$res["compras"]= $compras;
7073
$res["user"]= $usuario[0];

backend/module/profile/model/BLL/profile_bll.class.singleton.php

+3
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,7 @@ public function traercursosComentados_BLL($arrArgument){
107107
public function traerInfoCursosComentados_BLL($arrArgument){
108108
return $this->dao->traerInfoCursosComentados_DAO($this->db,$arrArgument);
109109
}
110+
public function traercursosPuntuados_BLL($arrArgument){
111+
return $this->dao->traercursosPuntuados_DAO($this->db,$arrArgument);
112+
}
110113
}

backend/module/profile/model/DAO/profile_dao.class.singleton.php

+5
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ public function traerInfoCursosComentados_DAO($db, $arrArgument) {
255255
// echo $sql;exit;
256256
return $db->listar($db->ejecutar($sql));
257257
}
258+
public function traercursosPuntuados_DAO($db, $arrArgument) {
259+
$sql = "SELECT * FROM courses c INNER JOIN puntuaciones p ON c.id=p.id_curso WHERE p.user='".$arrArgument."' ";
260+
// echo $sql;exit;
261+
return $db->listar($db->ejecutar($sql));
262+
}
258263

259264

260265
}//End productDAO

backend/module/profile/model/model/profile_model.class.singleton.php

+3
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ public function traercursosComentados($arrArgument) {
9898
public function traerInfoCursosComentados($arrArgument) {
9999
return $this->bll->traerInfoCursosComentados_BLL($arrArgument);
100100
}
101+
public function traercursosPuntuados($arrArgument) {
102+
return $this->bll->traercursosPuntuados_BLL($arrArgument);
103+
}
101104

102105

103106
}

backend/paths.php

+3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@
5656
/*module carrito*/
5757
define('MODEL_BASKET', SITE_ROOT . 'module/basket/model/model/');
5858

59+
/*module examen*/
60+
define('MODEL_EXAMEN', SITE_ROOT . 'module/examen/model/model/');
61+
5962

6063
/*module homepage*/
6164
define('UTILS_HOMEPAGE', SITE_ROOT . 'module/homepage/utils/');

backend/resources/modules.xml

+4
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,9 @@
2020
<name>basket</name>
2121
<uri>basket</uri>
2222
</module>
23+
<module>
24+
<name>examen</name>
25+
<uri>examen</uri>
26+
</module>
2327

2428
</modules>

frontend/app.js

+3
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@
108108
resolve: {
109109
coursesCategory: function (services, $route) {
110110
return services.get('courses', 'getAllCourses', $route.current.params.id);
111+
},
112+
puntos: function (services, $route) {
113+
return services.get('courses', 'puntos');
111114
}
112115
}
113116
})

frontend/assets/css/libreriaHoover/hover-min.css

100644100755
File mode changed.

frontend/assets/css/libreriaHoover/hover.css

100644100755
File mode changed.

frontend/assets/inc/menu.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@
113113
</div>
114114
</a>
115115
</li><br>
116-
<li>
116+
<!-- <li>
117117
<a href="#/user/myProfile/" style="color:white;">Mi perfil</a>
118118
</li>
119119
<li>
120120
<a href="#/courseForm">Add course</a>
121-
</li>
121+
</li> -->
122122
<li>
123123
<a href="#/panelAdministracion">Mi panel de control</a>
124124
</li>

frontend/module/basket/controller/basket.controller.js

100644100755
File mode changed.

frontend/module/basket/services/basket.servicies.js

100644100755
File mode changed.

frontend/module/basket/view/basket.html

100644100755
File mode changed.

frontend/module/basket/view/img/carritoVacio.jpg

100644100755
File mode changed.

frontend/module/chat/controller/adminChat.controller.js

100644100755
File mode changed.

frontend/module/chat/controller/chat.controller.js

100644100755
File mode changed.

frontend/module/chat/view/adminChat.html

100644100755
File mode changed.

frontend/module/chat/view/chat.html

100644100755
File mode changed.

0 commit comments

Comments
 (0)