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