Index: trunk/administrator/components/com_staff/models/index.html =================================================================== diff --git a/trunk/administrator/components/com_staff/models/index.html b/trunk/administrator/components/com_staff/models/index.html new file mode 10644 --- /dev/null (revision 0) +++ b/trunk/administrator/components/com_staff/models/index.html (revision 3) @@ -0,0 +1,4 @@ + + + + \ No newline at end of file Index: trunk/administrator/components/com_staff/models/staffModel.php =================================================================== diff --git a/trunk/administrator/components/com_staff/models/staffModel.php b/trunk/administrator/components/com_staff/models/staffModel.php new file mode 10644 --- /dev/null (revision 0) +++ b/trunk/administrator/components/com_staff/models/staffModel.php (revision 3) @@ -0,0 +1,34 @@ +'idstaff','value'=>''); + + public function addItem($datos){ + $this->setFieldArray($datos); + list($resultado,$id,$mensaje) = $this->insert(); + return array ($resultado,$id,$mensaje); + } + + public function DeleteItem(){ + list($resultado,$mensaje) = $this->delete(); + return array ($resultado,$mensaje); + } + + public function UpdateItem($datos){ + $this->setFieldArray($datos); + list($resultado,$mensaje) = $this->update(); + return array ($resultado,$mensaje); + } + + public function dolist(){ + $str_query = " SELECT stf.*, CONCAT(su.lastname, ', ', su.firstname) AS usuario, sa.name" + ." FROM ".$this->tableName." AS stf" + ." INNER JOIN sis_user AS su ON stf.iduser = su.iduser" + ." INNER JOIN sis_areas AS sa ON stf.idarea = sa.idarea" + ." ORDER BY stf.date_create"; + $this->setQuery($str_query); + $list_subjects = $this->getObjectList(); + return $list_subjects; + } +} +?> \ No newline at end of file Index: trunk/administrator/components/com_staff/staffController.php =================================================================== diff --git a/trunk/administrator/components/com_staff/staffController.php b/trunk/administrator/components/com_staff/staffController.php new file mode 10644 --- /dev/null (revision 0) +++ b/trunk/administrator/components/com_staff/staffController.php (revision 3) @@ -0,0 +1,81 @@ +dolist(); + + if(count($lstObj) == 0){ + $url = "index.php?option=com_staff&controller=staff&action=add"; + header("location: ".$url); + exit(0); + } + + $data["lstObj"] = $lstObj; + $data["lsTitle"] = "STAFF::::::::::::::"; + $data["content"] = "components".DS."com_staff".DS."views".DS."dolist.php"; + $data["title"] = "STAFF::::::::::::::"; + + $this->view->show("template.php", $data); + } + + public function add(){ + + require_once("components".DS."com_areas".DS."models".DS."areasModel.php"); + $objAreas = new areasModel(); + $lstAreas = $objAreas->dolist(); + + require_once("components".DS."com_users".DS."models".DS."usersModel.php"); + $objUsers = new usersModel(); + $lstUsers = $objUsers->getAllUsers(); + + $data["lstAreas"] = $lstAreas; + $data["lstUsers"] = $lstUsers; + $data["frm_title"] = "AGREGAR STAFF::::::::::"; + $data["content"] = "components".DS."com_staff".DS."views".DS."form.php"; + $data["title"] = "Agregar Staff:::::::::::::"; + + $this->view->show("template.php", $data); + } + + public function save(){ + $area = $_POST['lstArea']; + $user = $_POST['lstUser']; + $desc = $_POST['description']; + + $message = ""; + require("components".DS."com_staff".DS."models".DS."staffModel.php"); + $obj = new staffModel(); + + $data_sql['idarea'] = $area; + $data_sql['iduser'] = $user; + $data_sql['description'] = $desc; + $data_sql['date_create'] = date("Y-m-d H:i:s"); + $data_sql['state'] = 1; + + list($query, $id, $message) = $obj->addItem($data_sql); + + $url = "index.php?option=com_staff&controller=staff&action=dolist"; + + header("location: ".$url); + exit(); + } + + public function setTitle($type){ + $html_title = ""; + + switch ($type){ + case 1: $html_title = "Lista de Informes"; + break; + case 2: $html_title = "Lista de Reportes"; + break; + default: $html_title = "Lista de Reportes"; + break; + } + + return $html_title; + } +} +?> \ No newline at end of file Index: trunk/administrator/components/com_staff/views/dolist.php =================================================================== diff --git a/trunk/administrator/components/com_staff/views/dolist.php b/trunk/administrator/components/com_staff/views/dolist.php new file mode 10644 --- /dev/null (revision 0) +++ b/trunk/administrator/components/com_staff/views/dolist.php (revision 3) @@ -0,0 +1,61 @@ +
+ +
+
+ + + + + + + + + + + + + + + + 0){ + for($i=0; $i<$num; $i++){ + $obj = $lstObj[$i]; +?> + + + + + + + + + + + +
NumUsuarioAreaEstado
usuario; ?>name; ?> + state){ + case 1: $src_image = "images/system/tick.png"; + $alt_image = "Active"; + break; + case 2: $src_image = "images/system/tick.png"; + $alt_image = "Disabled"; + break; + } + ?> + <?php echo $alt_image; ?> +
No Areas
\ No newline at end of file Index: trunk/administrator/components/com_staff/views/form.php =================================================================== diff --git a/trunk/administrator/components/com_staff/views/form.php b/trunk/administrator/components/com_staff/views/form.php new file mode 10644 --- /dev/null (revision 0) +++ b/trunk/administrator/components/com_staff/views/form.php (revision 3) @@ -0,0 +1,84 @@ +'; + $html_areas .= ''; + $countA = count($lstAreas); + for($i=0; $i<$countA; $i++){ + $_obj = $lstAreas[$i]; + $html_areas .= '"; + } + $html_areas .= ''; + } + if($lstUsers){ + $html_users = ''; + } +?> + + + +
+ +
+
+
+
+ + + +
+
+ + +
+
+
+ + +
+
+
+ + + BasePath = $sBasePath ; + $oFCKeditor->BasePath = '../fckeditor/'; + $oFCKeditor->ToolbarSet = 'Basic'; + $oFCKeditor->Width = '100%'; + $oFCKeditor->Height = '200'; + $oFCKeditor->Create(); + ?> + +
+
+
+ + + +
+
Index: trunk/administrator/components/com_staff/views/index.html =================================================================== diff --git a/trunk/administrator/components/com_staff/views/index.html b/trunk/administrator/components/com_staff/views/index.html new file mode 10644 --- /dev/null (revision 0) +++ b/trunk/administrator/components/com_staff/views/index.html (revision 3) @@ -0,0 +1,4 @@ + + + + \ No newline at end of file