-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclase-edit.php
More file actions
134 lines (125 loc) · 5.01 KB
/
clase-edit.php
File metadata and controls
134 lines (125 loc) · 5.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php
include 'layout/header.php';
if(!isset($_POST)){
header("Location:admin-cursos.php");
}else{
$id = $_GET['id'];
}
?>
<body>
<?php include 'layout/aside.php'; ?>
<section class="home-section">
<?php include 'layout/perfil.php';?>
<div class="home-content">
<div class="center ">
<div class="box-titles">
<h1 class="title">Editar CLase Maestra</h1>
<div class="box-botones">
<a class="btn" href="javascript:history.back()" title="Atras"><i class="fas fa-arrow-left"></i></a>
</div>
</div>
<?php if(isset($_SESSION['completado'])): ?>
<div class="alerta-exito">
<?=$_SESSION['completado']?>
</div>
<?php elseif(isset($_SESSION['fallo'])): ?>
<div class="alerta-error">
<?=$_SESSION['fallo']?>
</div>
<?php endif; ?>
<div class="container-wrap mg-auto w100">
<div class="inner-content mg-bt20 w70">
<?php
$datos = obtenerdatos($db, 'clases', $id);
if(!empty($datos) && mysqli_num_rows($datos) >= 1):
while($dato = mysqli_fetch_assoc($datos)):
?>
<form action="models/updates/upclase.php" class="box-formulario" enctype="multipart/form-data" method="post">
<div class="w100 container-wrap mg-bt10" >
<div class="box-input">
<label for="nombre">Nombre de la Fase: </label>
<input class="w100" type="hidden" name="id" value="<?php echo $dato['id']; ?>">
<!-- <input class="w100" type="text" name="nombre" value="<?php //echo $dato['nombre']; ?>"> -->
<input class="w100 inputnombre" type="text" name="nombre" maxlength="200" value="<?php echo $dato['nombre']; ?>">
<span class="counter counterNombre">200</span>
</div>
<div class="box-input">
<!-- <span class="counter-2 counterDescripcion">500</span> -->
<label for="descripcion">Descripcion: </label>
<textarea name="descripcion" class="textdescripcion" rows="5" maxlength="500"><?php echo $dato['descripcion']; ?></textarea>
</div>
<div class="box-input mg-tp20">
<?php if($dato['imagen']): ?>
<label for="">Cambiar Imagen:</label>
<?php else : ?>
<label for="">Añadir Imagen:</label>
<?php endif; ?>
<input class="w100" type="hidden" name="imagen_existente" value="<?php echo $dato['imagen']; ?>">
<img src="assets/clases/<?php echo $dato['carpeta'].'/'.$dato['imagen'] ?>" alt=""><hr class="w100 mg-bt10">
<input class="w100" type="file" name="imagen" >
</div>
<div class="box-input">
<label for="">Fase: </label>
<select class="w70" name="fase">
<?php
$fases = selectalldatos($db, 'fases');
if(!empty($fases) && mysqli_num_rows($fases) >= 1):
while($fase = mysqli_fetch_assoc($fases)):
?>
<option value="<?=$fase['id']?>" <?=($fase['id']) == $dato['fase_id'] ? 'selected="selected"': '' ?>>
<?=$fase['nombre']?>
</option>
<?php
endwhile;
endif;
?>
</select>
</div>
<div class="box-input">
<label for="">Cambiar Video:</label>
<input class="w100" type="hidden" name="video_existente" value="<?php echo $dato['video']; ?>">
<video class="w90" src="assets/videos/clases/<?php echo $dato['video']?>" controls muted></video>
<input type="file" name="video" class="" >
</div>
<div class="box-input">
<label for="">Ingresar URL del Video:</label>
<textarea name="linkurl" id="" cols="10" rows="5"><?php echo $dato['url']; ?></textarea>
</div>
<div class="box-input">
<label for="orden">Orden a Mostrar: </label>
<input class="w100" type="number" name="orden" value="<?php echo $dato['orden']; ?>" min="1">
</div>
<?php
endwhile;
endif;
?>
</div>
<input type="submit" value="Actualizar Datos" class="btn" name="editarfase" id="" >
</form>
</div>
</div>
</div>
<!-- center -->
<!-- <a class="btn" href="contenedor.php"> Inicio</a> -->
<!-- <a class="btn" href="javascript:history.back()">Atrás</a> -->
<?php borrarErrores(); ?>
</div>
</section>
<?php include 'layout/footer.php'; ?>
</div>
</main>
<script>
CKEDITOR.replace( 'descripcion' );
const input = document.querySelector("form .inputnombre"),
maxlength = input.getAttribute("maxlength"),
counter = document.querySelector("form .counterNombre"),
textarea = document.querySelector("form .textdescripcion"),
maxlengtharea = textarea.getAttribute("maxlength"),
counterarea = document.querySelector("form .counterDescripcion");
input.onkeyup = () =>{
counter.innerText = maxlength - input.value.length;
}
textarea.onkeyup = () =>{
counterarea.innerText = maxlengtharea - textarea.value.length;
}
</script>