sqlsafe('1'); switch ($act) { case 'addForm': if(!isset($_POST['depID'])){ $getDepartments = $db->select('select * from emp_departments order by fatherId ASC'); $countDep = count($getDepartments); for($i=0;$i<$countDep;$i++){ $getEmps = $db->CQuery('select count(id) from emp_personal_info where dep_id ='.$db->sqlsafe($getDepartments[$i]['id']).''); if($getEmps > 0){ $departments['Departments'][$getDepartments[$i]['id']]=getPath('emp_departments', $getDepartments[$i]['id'], $getDepartments[$i]['fatherId']); } } if(!is_array($departments)){ $skin = new skin(); $skin->assign('errorMSG','Sorry , There is no departments with valid number of employee, you may have departments but with no employee inside.'); $skin->assign('config',$config); $skin->assign('showMenu','1'); $skin->assign('incFile','site/error.tpl'); $skin->display('site/index.tpl'); }else{ $skin = new skin(); $skin->assign('config',$config); $skin->assign('showMenu','1'); $skin->assign('act','addForm'); $skin->assign('departments',$departments); $skin->assign('incFile','site/emp/dayOff_first.tpl'); $skin->display('site/index.tpl'); } }else{ $depId = $db->sqlsafe($_POST['depID']); $getAllEmployees = $db->select('select id , name from emp_personal_info where active='.$active.' and dep_id ='.$depId.' '); if(is_array($getAllEmployees)){ $countEmp = count($getAllEmployees); for($i=0;$i<$countEmp ; $i++){ $employees['Employees'][$getAllEmployees[$i]['id']]=$getAllEmployees[$i]['name']; } $skin = new skin(); $skin->assign('config',$config); $skin->assign('employee',$employees); $skin->assign('act','add'); $skin->display('site/emp/dayOff_second.tpl'); }else{ echo '