@@ -0,0 +1,56 | |||||
|
1 | <style> | |||
|
2 | #div_addreport{ margin: 0 auto; width: 100%; padding-bottom: 10px} | |||
|
3 | #div_addreport .row_reg{margin-top: 2px; border: 0px solid #0070a3} | |||
|
4 | #div_addreport .row_reg label{float: left; width: 100px; text-align: right; padding-right: 5px; border: 0px solid #1cc; line-height: 25px} | |||
|
5 | #div_addreport .row_reg input{float: left; width: 400px; line-height: 25px} | |||
|
6 | </style> | |||
|
7 | <script type="text/javascript"> | |||
|
8 | $(function(){ | |||
|
9 | $('#btnSave').click(function(){ | |||
|
10 | $('#frm_addArea').submit(); | |||
|
11 | }); | |||
|
12 | }); | |||
|
13 | </script> | |||
|
14 | <?php include("../fckeditor/fckeditor.php"); ?> | |||
|
15 | <div class="toolbar_right"> | |||
|
16 | <ul> | |||
|
17 | <li><a>Cancel</a></li> | |||
|
18 | <li><a href="#" id="btnSave">Save</a></li> | |||
|
19 | </ul> | |||
|
20 | <div style="clear: both; overflow: hidden"></div> | |||
|
21 | </div> | |||
|
22 | <div style="margin: 0 auto; width: 100%;"> | |||
|
23 | <form name="frm_addArea" id="frm_addArea" method="post" action="index.php"> | |||
|
24 | <span style=""> | |||
|
25 | <label class="title_form" style="text-transform: uppercase; padding-left: 10px; margin-bottom: 10px; letter-spacing: 0.1em"> | |||
|
26 | <?php echo $frm_title; ?> | |||
|
27 | </label> | |||
|
28 | </span> | |||
|
29 | <div id="div_addreport"> | |||
|
30 | <div class="row_reg"> | |||
|
31 | <label for="lblTitle">Title:</label> | |||
|
32 | <input type="text" name="txtTitle" value="" class="form_input" /> | |||
|
33 | <div style="clear: both; overflow: hidden"></div> | |||
|
34 | </div> | |||
|
35 | <div class="row_reg_content"> | |||
|
36 | <label style="vertical-align: top;">Description:</label> | |||
|
37 | <span> | |||
|
38 | <?php | |||
|
39 | $oFCKeditor = new FCKeditor('description') ; | |||
|
40 | //$oFCKeditor->BasePath = $sBasePath ; | |||
|
41 | $oFCKeditor->BasePath = '../fckeditor/'; | |||
|
42 | $oFCKeditor->ToolbarSet = 'Basic'; | |||
|
43 | $oFCKeditor->Width = '100%'; | |||
|
44 | $oFCKeditor->Height = '200'; | |||
|
45 | $oFCKeditor->Create(); | |||
|
46 | ?> | |||
|
47 | </span> | |||
|
48 | <div style="clear: both; overflow: hidden"></div> | |||
|
49 | </div> | |||
|
50 | </div> | |||
|
51 | <input type="hidden" name="type" value="<?php echo $type; ?>" /> | |||
|
52 | <input type="hidden" name="option" value="com_areas" /> | |||
|
53 | <input type="hidden" name="controller" value="areas" /> | |||
|
54 | <input type="hidden" name="action" value="save" /> | |||
|
55 | </form> | |||
|
56 | </div> |
@@ -22,99 +22,33 | |||||
22 | } |
|
22 | } | |
23 |
|
23 | |||
24 | public function add(){ |
|
24 | public function add(){ | |
25 | $type = $_GET['ty']; |
|
|||
26 |
|
25 | |||
27 | require_once("components".DS."com_areas".DS."models".DS."areasModel.php"); |
|
26 | $data["frm_title"] = "AGREGAR AREA::::::::::"; | |
28 | $objAreas = new areasModel(); |
|
|||
29 | $lstAreas = $objAreas->dolist(); |
|
|||
30 |
|
||||
31 | $html_title = $this->setTitle($type); |
|
|||
32 |
|
||||
33 | $data["type"] = $type; |
|
|||
34 | $data["frm_title"] = $html_title; |
|
|||
35 | $data["lstAreas"] = $lstAreas; |
|
|||
36 | $data["content"] = "components".DS."com_areas".DS."views".DS."form.php"; |
|
27 | $data["content"] = "components".DS."com_areas".DS."views".DS."form.php"; | |
37 |
$data["title"] = "Add |
|
28 | $data["title"] = "Add Area:::::::::::::"; | |
38 |
|
29 | |||
39 | $this->view->show("template.php", $data); |
|
30 | $this->view->show("template.php", $data); | |
40 | } |
|
31 | } | |
41 |
|
32 | |||
42 | public function save(){ |
|
33 | public function save(){ | |
43 | $ty = $_POST['type']; |
|
|||
44 | $area = $_POST['lstArea']; |
|
|||
45 | $title = $_POST['txtTitle']; |
|
34 | $title = $_POST['txtTitle']; | |
46 | $desc = $_POST['description']; |
|
35 | $desc = $_POST['description']; | |
47 |
|
36 | |||
48 | $url = explode(DS, trim(SYS_ROOT)); |
|
37 | $message = "Area Added"; | |
49 | array_pop($url); |
|
38 | require("components".DS."com_areas".DS."models".DS."areasModel.php"); | |
50 | array_pop($url); |
|
39 | $area = new areasModel(); | |
51 | array_pop($url); |
|
|||
52 | $path = implode(DS, $url); |
|
|||
53 | $path = $path.DS."files".DS; |
|
|||
54 | $path_area = $path.DS.$area.DS; |
|
|||
55 |
|
||||
56 | if($_FILES['fpname']['tmp_name'] != ""){ |
|
|||
57 | if (is_uploaded_file($_FILES['fpname']['tmp_name'])){ |
|
|||
58 | $psize = $_FILES ['fpname']['size']; |
|
|||
59 | $pname = $_FILES ['fpname']['name']; |
|
|||
60 | $man_file = new filesManager($pname); |
|
|||
61 | $type = $man_file->getExtension(); |
|
|||
62 | $name_file = $man_file->getName(); |
|
|||
63 |
|
40 | |||
64 | if($man_file->isDoc()){ |
|
41 | $data_sql['name'] = $title; | |
65 | $url_user = $name_file.".".$type; |
|
42 | $data_sql['description'] = $desc; | |
66 |
|
|
43 | $data_sql['date_create'] = date("Y-m-d H:i:s"); | |
67 | $name_file_system = md5($name_file.$date_current); |
|
44 | $data_sql['state'] = 1; | |
68 | $path_final = $name_file_system.".".$type; |
|
45 | ||
69 | $flag_add = false; |
|
46 | list($query, $id, $message) = $area->addItem($data_sql); | |
70 | if(is_dir($path_area)){ |
|
|||
71 | if(is_writable($path)){ |
|
|||
72 | copy($_FILES['fpname']['tmp_name'], $path_area.$path_final); |
|
|||
73 | $flag_add = true; |
|
|||
74 | $tipo_msg = 1; |
|
|||
75 | }else{ $message = "No se puede escribir."; } |
|
|||
76 | }else{ |
|
|||
77 | mkdir($path_area,0777,true); |
|
|||
78 | copy($_FILES['fpname']['tmp_name'], $path_area.$path_final); |
|
|||
79 | $flag_add = true; |
|
|||
80 | } |
|
|||
81 | if($flag_add){ |
|
|||
82 | $message = "Added file"; |
|
|||
83 | require("components".DS."com_areas".DS."models".DS."areasModel.php"); |
|
|||
84 | $report = new areasModel(); |
|
|||
85 |
|
||||
86 | $data_sql['idarea'] = $area; |
|
|||
87 | $data_sql['title'] = $title; |
|
|||
88 | $data_sql['description'] = $desc; |
|
|||
89 | $data_sql['url_user'] = $pname; |
|
|||
90 | $data_sql['url_system'] = $path_final; |
|
|||
91 | $data_sql['type'] = $ty; |
|
|||
92 | $data_sql['date_create'] = date("Y-m-d H:i:s"); |
|
|||
93 | $data_sql['state'] = 1; |
|
|||
94 |
|
||||
95 | list($query, $id, $message) = $report->addItem($data_sql); |
|
|||
96 | } |
|
|||
97 | }else{ |
|
|||
98 | $message .= "Uploaded failed: No file allowed."; |
|
|||
99 | $flu_insertar = false; |
|
|||
100 | $tipo_msg = 2; |
|
|||
101 | } |
|
|||
102 | }else{ |
|
|||
103 | // error por tamanio |
|
|||
104 | $message .= "Uploaded failed: size exceeds the limit."; |
|
|||
105 | $flu_insertar = false; |
|
|||
106 | $tipo_msg = 3; |
|
|||
107 | } |
|
|||
108 | }else{ |
|
|||
109 | echo "Error: Uploaded failed."; |
|
|||
110 | $flu_insertar = false; |
|
|||
111 | $tipo_msg = 3; |
|
|||
112 | } |
|
|||
113 |
|
47 | |||
114 |
$url = "index.php?option=com_areas&controller=reports&action=dolist |
|
48 | $url = "index.php?option=com_areas&controller=reports&action=dolist"; | |
115 |
|
49 | |||
116 | header("location: ".$url); |
|
50 | header("location: ".$url); | |
117 |
exit |
|
51 | exit(); | |
118 | } |
|
52 | } | |
119 |
|
53 | |||
120 | public function setTitle($type){ |
|
54 | public function setTitle($type){ |
@@ -33,7 +33,21 | |||||
33 | <td style="text-align: center"><input type="checkbox" name="chkReport" value="" class="lstChkReport" /></td> |
|
33 | <td style="text-align: center"><input type="checkbox" name="chkReport" value="" class="lstChkReport" /></td> | |
34 | <td style="text-align: center"><?php echo $obj->name; ?></td> |
|
34 | <td style="text-align: center"><?php echo $obj->name; ?></td> | |
35 | <td style="text-align: center"><?php echo "0" ?></td> |
|
35 | <td style="text-align: center"><?php echo "0" ?></td> | |
36 |
<td style="text-align: center"> |
|
36 | <td style="text-align: center"> | |
|
37 | <?php | |||
|
38 | $src_image = ""; | |||
|
39 | $alt_image = ""; | |||
|
40 | switch ($obj->state){ | |||
|
41 | case 1: $src_image = "images/system/tick.png"; | |||
|
42 | $alt_image = "Active"; | |||
|
43 | break; | |||
|
44 | case 2: $src_image = "images/system/tick.png"; | |||
|
45 | $alt_image = "Disabled"; | |||
|
46 | break; | |||
|
47 | } | |||
|
48 | ?> | |||
|
49 | <img src="<?php echo $src_image; ?>" alt="<?php echo $alt_image; ?>" border="0" /> | |||
|
50 | </td> | |||
37 | </tr> |
|
51 | </tr> | |
38 | <?php |
|
52 | <?php | |
39 | } |
|
53 | } |
General Comments 0
You need to be logged in to leave comments.
Login now