@@ -0,0 +1,34 | |||
|
1 | <?php | |
|
2 | class staffModel extends ModelBase{ | |
|
3 | public $tableName = 'sis_staff'; | |
|
4 | public $id = array('key'=>'idstaff','value'=>''); | |
|
5 | ||
|
6 | public function addItem($datos){ | |
|
7 | $this->setFieldArray($datos); | |
|
8 | list($resultado,$id,$mensaje) = $this->insert(); | |
|
9 | return array ($resultado,$id,$mensaje); | |
|
10 | } | |
|
11 | ||
|
12 | public function DeleteItem(){ | |
|
13 | list($resultado,$mensaje) = $this->delete(); | |
|
14 | return array ($resultado,$mensaje); | |
|
15 | } | |
|
16 | ||
|
17 | public function UpdateItem($datos){ | |
|
18 | $this->setFieldArray($datos); | |
|
19 | list($resultado,$mensaje) = $this->update(); | |
|
20 | return array ($resultado,$mensaje); | |
|
21 | } | |
|
22 | ||
|
23 | public function dolist(){ | |
|
24 | $str_query = " SELECT stf.*, CONCAT(su.lastname, ', ', su.firstname) AS usuario, sa.name" | |
|
25 | ." FROM ".$this->tableName." AS stf" | |
|
26 | ." INNER JOIN sis_user AS su ON stf.iduser = su.iduser" | |
|
27 | ." INNER JOIN sis_areas AS sa ON stf.idarea = sa.idarea" | |
|
28 | ." ORDER BY stf.date_create"; | |
|
29 | $this->setQuery($str_query); | |
|
30 | $list_subjects = $this->getObjectList(); | |
|
31 | return $list_subjects; | |
|
32 | } | |
|
33 | } | |
|
34 | ?> No newline at end of file |
@@ -0,0 +1,81 | |||
|
1 | <?php | |
|
2 | class staffController extends ControllerBase{ | |
|
3 | public function dolist(){ | |
|
4 | ||
|
5 | require("components".DS."com_staff".DS."models".DS."staffModel.php"); | |
|
6 | $obj = new staffModel(); | |
|
7 | ||
|
8 | $lstObj = $obj->dolist(); | |
|
9 | ||
|
10 | if(count($lstObj) == 0){ | |
|
11 | $url = "index.php?option=com_staff&controller=staff&action=add"; | |
|
12 | header("location: ".$url); | |
|
13 | exit(0); | |
|
14 | } | |
|
15 | ||
|
16 | $data["lstObj"] = $lstObj; | |
|
17 | $data["lsTitle"] = "STAFF::::::::::::::"; | |
|
18 | $data["content"] = "components".DS."com_staff".DS."views".DS."dolist.php"; | |
|
19 | $data["title"] = "STAFF::::::::::::::"; | |
|
20 | ||
|
21 | $this->view->show("template.php", $data); | |
|
22 | } | |
|
23 | ||
|
24 | public function add(){ | |
|
25 | ||
|
26 | require_once("components".DS."com_areas".DS."models".DS."areasModel.php"); | |
|
27 | $objAreas = new areasModel(); | |
|
28 | $lstAreas = $objAreas->dolist(); | |
|
29 | ||
|
30 | require_once("components".DS."com_users".DS."models".DS."usersModel.php"); | |
|
31 | $objUsers = new usersModel(); | |
|
32 | $lstUsers = $objUsers->getAllUsers(); | |
|
33 | ||
|
34 | $data["lstAreas"] = $lstAreas; | |
|
35 | $data["lstUsers"] = $lstUsers; | |
|
36 | $data["frm_title"] = "AGREGAR STAFF::::::::::"; | |
|
37 | $data["content"] = "components".DS."com_staff".DS."views".DS."form.php"; | |
|
38 | $data["title"] = "Agregar Staff:::::::::::::"; | |
|
39 | ||
|
40 | $this->view->show("template.php", $data); | |
|
41 | } | |
|
42 | ||
|
43 | public function save(){ | |
|
44 | $area = $_POST['lstArea']; | |
|
45 | $user = $_POST['lstUser']; | |
|
46 | $desc = $_POST['description']; | |
|
47 | ||
|
48 | $message = ""; | |
|
49 | require("components".DS."com_staff".DS."models".DS."staffModel.php"); | |
|
50 | $obj = new staffModel(); | |
|
51 | ||
|
52 | $data_sql['idarea'] = $area; | |
|
53 | $data_sql['iduser'] = $user; | |
|
54 | $data_sql['description'] = $desc; | |
|
55 | $data_sql['date_create'] = date("Y-m-d H:i:s"); | |
|
56 | $data_sql['state'] = 1; | |
|
57 | ||
|
58 | list($query, $id, $message) = $obj->addItem($data_sql); | |
|
59 | ||
|
60 | $url = "index.php?option=com_staff&controller=staff&action=dolist"; | |
|
61 | ||
|
62 | header("location: ".$url); | |
|
63 | exit(); | |
|
64 | } | |
|
65 | ||
|
66 | public function setTitle($type){ | |
|
67 | $html_title = ""; | |
|
68 | ||
|
69 | switch ($type){ | |
|
70 | case 1: $html_title = "Lista de Informes"; | |
|
71 | break; | |
|
72 | case 2: $html_title = "Lista de Reportes"; | |
|
73 | break; | |
|
74 | default: $html_title = "Lista de Reportes"; | |
|
75 | break; | |
|
76 | } | |
|
77 | ||
|
78 | return $html_title; | |
|
79 | } | |
|
80 | } | |
|
81 | ?> No newline at end of file |
@@ -0,0 +1,61 | |||
|
1 | <div class="toolbar_right"> | |
|
2 | <ul> | |
|
3 | <li><a href="index.php?option=com_staff&controller=staff&action=add">Add</a></li> | |
|
4 | </ul> | |
|
5 | <div style="clear: both; overflow: hidden"></div> | |
|
6 | </div> | |
|
7 | <span> | |
|
8 | <label class="title_form" style="text-transform: uppercase; padding-left: 10px; margin-bottom: 10px; letter-spacing: 0.1em"> | |
|
9 | <?php echo $lsTitle; ?> | |
|
10 | </label> | |
|
11 | </span> | |
|
12 | <?php | |
|
13 | $num = count($lstObj); | |
|
14 | ?> | |
|
15 | <table style="width: 100%"> | |
|
16 | <thead> | |
|
17 | <tr> | |
|
18 | <th style="width: 10px;text-align: center;border: 1px solid #066">Num</th> | |
|
19 | <th style="width: 10px;text-align: center;border: 1px solid #066"><input type="checkbox" name="lstCheck" /></th> | |
|
20 | <th style="width: 400px;text-align: center;border: 1px solid #066">Usuario</th> | |
|
21 | <th style="width: 200px;text-align: center;border: 1px solid #066">Area</th> | |
|
22 | <th style="width: 60px;text-align: center;border: 1px solid #066">Estado</th> | |
|
23 | </tr> | |
|
24 | </thead> | |
|
25 | <tbody> | |
|
26 | <?php | |
|
27 | if($num > 0){ | |
|
28 | for($i=0; $i<$num; $i++){ | |
|
29 | $obj = $lstObj[$i]; | |
|
30 | ?> | |
|
31 | <tr> | |
|
32 | <td style="text-align: center"><?php echo ($i+1); ?></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->usuario; ?></td> | |
|
35 | <td style="text-align: center"><?php echo $obj->name; ?></td> | |
|
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> | |
|
51 | </tr> | |
|
52 | <?php | |
|
53 | } | |
|
54 | }else{ | |
|
55 | ?> | |
|
56 | <tr><td colspan="4" style="text-align: center">No Areas</td></tr> | |
|
57 | <?php | |
|
58 | } | |
|
59 | ?> | |
|
60 | </tbody> | |
|
61 | </table> No newline at end of file |
@@ -0,0 +1,84 | |||
|
1 | <?php | |
|
2 | $html_areas = ""; | |
|
3 | $html_users = ""; | |
|
4 | if($lstAreas){ | |
|
5 | $html_areas = '<select name="lstArea" class="form_select">'; | |
|
6 | $html_areas .= '<option value="-1">Seleccione...</option>'; | |
|
7 | $countA = count($lstAreas); | |
|
8 | for($i=0; $i<$countA; $i++){ | |
|
9 | $_obj = $lstAreas[$i]; | |
|
10 | $html_areas .= '<option value="'.$_obj->idarea.'">'.$_obj->name."</option>"; | |
|
11 | } | |
|
12 | $html_areas .= '</select>'; | |
|
13 | } | |
|
14 | if($lstUsers){ | |
|
15 | $html_users = '<select name="lstUser" class="form_select">'; | |
|
16 | $html_users .= '<option value="-1">Seleccione...</option>'; | |
|
17 | $countU = count($lstUsers); | |
|
18 | for($i=0; $i<$countU; $i++){ | |
|
19 | $_obj = $lstUsers[$i]; | |
|
20 | $html_users .= '<option value="'.$_obj->iduser.'">'.$_obj->lastname.', '.$_obj->firstname."</option>"; | |
|
21 | } | |
|
22 | $html_users .= '</select>'; | |
|
23 | } | |
|
24 | ?> | |
|
25 | <style> | |
|
26 | #div_addform{ margin: 0 auto; width: 100%; padding-bottom: 10px} | |
|
27 | #div_addform .row_reg{margin-top: 2px; border: 0px solid #0070a3} | |
|
28 | #div_addform .row_reg label{float: left; width: 100px; text-align: right; padding-right: 5px; border: 0px solid #1cc; line-height: 25px} | |
|
29 | #div_addform .row_reg input{float: left; width: 400px; line-height: 25px} | |
|
30 | </style> | |
|
31 | <script type="text/javascript"> | |
|
32 | $(function(){ | |
|
33 | $('#btnSave').click(function(){ | |
|
34 | $('#frm_addStaff').submit(); | |
|
35 | }); | |
|
36 | }); | |
|
37 | </script> | |
|
38 | <?php include("../fckeditor/fckeditor.php"); ?> | |
|
39 | <div class="toolbar_right"> | |
|
40 | <ul> | |
|
41 | <li><a>Cancel</a></li> | |
|
42 | <li><a href="#" id="btnSave">Save</a></li> | |
|
43 | </ul> | |
|
44 | <div style="clear: both; overflow: hidden"></div> | |
|
45 | </div> | |
|
46 | <div style="margin: 0 auto; width: 100%;"> | |
|
47 | <form name="frm_addStaff" id="frm_addStaff" method="post" action="index.php"> | |
|
48 | <span style=""> | |
|
49 | <label class="title_form" style="text-transform: uppercase; padding-left: 10px; margin-bottom: 10px; letter-spacing: 0.1em"> | |
|
50 | <?php echo $frm_title; ?> | |
|
51 | </label> | |
|
52 | </span> | |
|
53 | <div id="div_addform"> | |
|
54 | <div class="row_reg"> | |
|
55 | <label for="lblArea">Area:</label> | |
|
56 | <?php echo $html_areas; ?> | |
|
57 | <div style="clear: both; overflow: hidden"></div> | |
|
58 | </div> | |
|
59 | <div class="row_reg"> | |
|
60 | <label for="lblUser">Usuario:</label> | |
|
61 | <?php echo $html_users; ?> | |
|
62 | <div style="clear: both; overflow: hidden"></div> | |
|
63 | </div> | |
|
64 | <div class="row_reg_content"> | |
|
65 | <label style="vertical-align: top;">Description:</label> | |
|
66 | <span> | |
|
67 | <?php | |
|
68 | $oFCKeditor = new FCKeditor('description') ; | |
|
69 | //$oFCKeditor->BasePath = $sBasePath ; | |
|
70 | $oFCKeditor->BasePath = '../fckeditor/'; | |
|
71 | $oFCKeditor->ToolbarSet = 'Basic'; | |
|
72 | $oFCKeditor->Width = '100%'; | |
|
73 | $oFCKeditor->Height = '200'; | |
|
74 | $oFCKeditor->Create(); | |
|
75 | ?> | |
|
76 | </span> | |
|
77 | <div style="clear: both; overflow: hidden"></div> | |
|
78 | </div> | |
|
79 | </div> | |
|
80 | <input type="hidden" name="option" value="com_staff" /> | |
|
81 | <input type="hidden" name="controller" value="staff" /> | |
|
82 | <input type="hidden" name="action" value="save" /> | |
|
83 | </form> | |
|
84 | </div> |
General Comments 0
You need to be logged in to leave comments.
Login now