Hello all.. I have a problem...
I have functionality called 'attendance for user'. When user login after logged in there is MarkIn and MarkOut button. when he clicks on MarkIn button, new entry will be placed in 'attendances' table for current date. My attendances table has a fileds given below: id user_id date timein timeout is_present And now when He clicked on MarkOut button, that entry will be updated.. I want functionality that initially when user haven't markin, the markout button will be disabled. and once user markin, the markin button will become disabled and markout will become enabled. And if marked out then both button will become disable for today for that user. I have made element for attendance, so that buttons appear on all other pages. I have done that functionality using simple function given below. But this works for only on attendnace page on other page it will not work because that element will not get values for Attendancescontroller.. I have tried component but still problem remains as it does not find Attendancescontroller... My coding in AttendancesController: function markInOut() { $mark = $this->Attendance->find('all',array( 'conditions'=>(array( 'Attendance.date'=>date("Y-m-d"), 'Attendance.user_id'=>$this->Session->read('Auth.User.id') ) ), 'fields'=>(array( 'Attendance.id','Attendance.date','Attendance.timein','Attendance.timeout','Attendance.is_present','Attendance.user_id') ) ) ); if(count($mark) == 0) { return 'start'; } $mark = $this->Attendance->find('all',array( 'conditions'=>(array( 'Attendance.date'=>date("Y-m-d"), 'Attendance.user_id'=>$this->Session->read('Auth.User.id'), 'Attendance.is_present'=>'1', ) ), 'fields'=>(array( 'Attendance.id','Attendance.date','Attendance.timein','Attendance.timeout','Attendance.is_present','Attendance.user_id') ) ) ); if(count($mark) > 0) { return 'end'; } else { return 'process'; } } SO help me out. If need more clearification on the problem then also reply... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---