function up()
 {
     $retirement_signatory_prepared = '';
     $retirement_signatory_prepared_position = '';
     $retirement_signatory_approved = '';
     $retirement_signatory_approved_position = '';
     $retirement_signatory_certified = '';
     $retirement_signatory_certified_position = '';
     $retirement_signatory_attested = '';
     $retirement_signatory_attested_position = '';
     $retirement_signatory_availability = '';
     $retirement_signatory_availability_position = '';
     $retirement_signatory_noted = '';
     $retirement_signatory_noted_position = '';
     // Do only if Province of Laguna
     $lgu_code = Setting::getField('lgu_code');
     if ($lgu_code == 'laguna_province') {
         $retirement_signatory_prepared = 'LEILANI M. SILAN';
         $retirement_signatory_prepared_position = 'Administrative Officer  V';
         $retirement_signatory_approved = 'JEORGE E.R. EJERCITO ESTREGAN';
         $retirement_signatory_approved_position = 'Governor';
         $retirement_signatory_certified = 'NIDA A. REBENQUE';
         $retirement_signatory_certified_position = "Asst. Prov'l HRMO";
         $retirement_signatory_attested = 'EUGENIA R. MAGANO';
         $retirement_signatory_attested_position = 'Provincial Human Resource Management Officer';
         $retirement_signatory_availability = 'MARIETA V. JARA';
         $retirement_signatory_availability_position = 'Provincial Budget Officer';
         $retirement_signatory_noted = 'EVELYN T. VILLANUEVA';
         $retirement_signatory_noted_position = 'Provincial Accountant';
     }
     $data = array(array('name' => 'retirement_signatory_prepared', 'setting_value' => $retirement_signatory_prepared, 'settings_group' => 'leave', 'description' => '.'), array('name' => 'retirement_signatory_prepared_position', 'setting_value' => $retirement_signatory_prepared_position, 'settings_group' => 'leave', 'description' => '.'), array('name' => 'retirement_signatory_approved', 'setting_value' => $retirement_signatory_approved, 'settings_group' => 'leave', 'description' => '.'), array('name' => 'retirement_signatory_approved_position', 'setting_value' => $retirement_signatory_approved_position, 'settings_group' => 'leave', 'description' => '.'), array('name' => 'retirement_signatory_certified', 'setting_value' => $retirement_signatory_certified, 'settings_group' => 'leave', 'description' => '.'), array('name' => 'retirement_signatory_certified_position', 'setting_value' => $retirement_signatory_certified_position, 'settings_group' => 'leave', 'description' => '.'), array('name' => 'retirement_signatory_attested', 'setting_value' => $retirement_signatory_attested, 'settings_group' => 'leave', 'description' => '.'), array('name' => 'retirement_signatory_attested_position', 'setting_value' => $retirement_signatory_attested_position, 'settings_group' => 'leave', 'description' => '.'), array('name' => 'retirement_signatory_availability', 'setting_value' => $retirement_signatory_availability, 'settings_group' => 'leave', 'description' => '.'), array('name' => 'retirement_signatory_availability_position', 'setting_value' => $retirement_signatory_availability_position, 'settings_group' => 'leave', 'description' => '.'), array('name' => 'retirement_signatory_noted', 'setting_value' => $retirement_signatory_noted, 'settings_group' => 'leave', 'description' => '.'), array('name' => 'retirement_signatory_noted_position', 'setting_value' => $retirement_signatory_noted_position, 'settings_group' => 'leave', 'description' => '.'));
     $this->db->insert_batch('settings', $data);
 }
 function up()
 {
     $lgu_code = Setting::getField('lgu_code');
     if ($lgu_code == '') {
         if ($this->db->table_exists('pds_profile')) {
             $this->db->order_by('id');
             $q = $this->db->get('pds_profile');
             if ($q->num_rows() > 0) {
                 foreach ($q->result_array() as $row) {
                     $p = new Employee_m();
                     $p->get_by_id($row['employee_id']);
                     $p->item_number = $row['item_number'];
                     $p->last_promotion = $row['last_promotion'];
                     $p->level = $row['level'];
                     $p->eligibility = $row['eligibility'];
                     $p->graduated = $row['graduated'];
                     $p->course = $row['course'];
                     $p->units = $row['units'];
                     $p->post_grad = $row['post_grad'];
                     $p->save();
                 }
             }
         }
     }
 }
 function up()
 {
     // Do only if Province of Laguna
     $lgu_code = Setting::getField('lgu_code');
     if ($lgu_code == 'laguna_province') {
         $o = new Office_m();
         $offices = $o->get();
         foreach ($offices as $office) {
             // Select all employees by office
             $e = new Employee_m();
             $employees = $e->get_by_office_id($office->office_id);
             $office_id = sprintf("%03d", $office->office_id);
             // Add leading zeros
             $i = 1;
             foreach ($employees as $employee) {
                 // Lets update the employee id
                 $employee_id = sprintf("%03d", $i);
                 // Add leading zeros
                 $update_employee = new Employee_m();
                 $update_employee->get_by_id($employee->id);
                 $update_employee->employee_id = $office_id . $employee_id;
                 $update_employee->save();
                 $i++;
             }
         }
     }
 }
 function up()
 {
     $agency = Setting::getField('system_name');
     if ($agency == 'Provincial Government of Quezon') {
         $data = array(array('id' => '1', 'name' => 'Super System Administrator', 'description' => ''), array('id' => '2', 'name' => 'System Administrator', 'description' => ''), array('id' => '3', 'name' => 'Timekeeper', 'description' => ''), array('id' => '4', 'name' => 'Official Business Encoder', 'description' => ''), array('id' => '5', 'name' => 'Leave Manager', 'description' => ''), array('id' => '6', 'name' => 'Leave Administrator', 'description' => ''), array('id' => '7', 'name' => 'Records Administrator', 'description' => ''), array('id' => '8', 'name' => 'View Attendance 10 Times Tardy', 'description' => ''), array('id' => '9', 'name' => 'View Attendance Only', 'description' => 'View Attendance Only'));
         $this->db->insert_batch('groups', $data);
     }
 }
 function up()
 {
     $agency = Setting::getField('system_name');
     if ($agency == 'Provincial Government of Quezon') {
         $ats_permissions = array(array('id' => '1', 'group_id' => '1', 'module' => 'users', 'roles' => '["index","save","delete","my_account"]'), array('id' => '2', 'group_id' => '1', 'module' => 'groups', 'roles' => '["save","delete"]'), array('id' => '3', 'group_id' => '1', 'module' => 'permissions', 'roles' => '["save","delete","group"]'), array('id' => '4', 'group_id' => '1', 'module' => 'employees', 'roles' => '["index","add_employee","edit_employee","delete_employee","add_cart","remove_cart","id_request"]'), array('id' => '5', 'group_id' => '1', 'module' => 'pds', 'roles' => '["personal_info","employee_profile","family","education","examination","work","voluntary_work","trainings","other_info","position_details","service_record","scanned_docs","reports","pds_print_preview","sr_print_preview","training_preview"]'), array('id' => '6', 'group_id' => '1', 'module' => 'personnel', 'roles' => '["assets","assets_spouse","assets_unmarried","assets_real_properties","assets_personals","assets_liabilities","assets_business_interests","assets_relatives","assets_other_info","personnel_schedule"]'), array('id' => '7', 'group_id' => '1', 'module' => 'training_manage', 'roles' => '["type","type_save","type_delete","course","course_save","course_delete","event","event_save","evenr_delete","attendance","attendance_save","attendance_delete","contact_type","contact_type_save","contact_type_delete","contact_info","contact_info_save","contact_info_delete"]'), array('id' => '8', 'group_id' => '1', 'module' => 'attendance', 'roles' => '["view_attendance","dtr","schedules","employee_schedule","jo","double_entries","view_absences","view_late","view_ob","view_tardiness","view_ten_tardiness"]'), array('id' => '9', 'group_id' => '1', 'module' => 'manual_manage', 'roles' => '["login","cto","cto_apps","cto_forward_balance","office_pass"]'), array('id' => '10', 'group_id' => '1', 'module' => 'office_manage', 'roles' => '["view_offices","add_office","edit_office","divisions"]'), array('id' => '11', 'group_id' => '1', 'module' => 'leave_manage', 'roles' => '["records","leave_card","cancel_leave","file_leave","encode_leave_card","leave_apps","forwarded","undertime","cancel_undertime","wop","stop_earnings","reports","perform_leave_earnings","settings"]'), array('id' => '12', 'group_id' => '1', 'module' => 'settings_manage', 'roles' => '["salary_grade","holiday","audit_trail","general_settings","backup","offline_update"]'), array('id' => '23', 'group_id' => '6', 'module' => 'leave_manage', 'roles' => '["records","leave_card","cancel_leave","file_leave","encode_leave_card","leave_apps","forwarded","undertime","cancel_undertime","wop","stop_earnings","perform_leave_earnings","settings"]'), array('id' => '32', 'group_id' => '3', 'module' => 'attendance', 'roles' => '["view_attendance","dtr","jo","double_entries","view_absences","view_late","view_ob","view_tardiness","view_ten_tardiness"]'), array('id' => '40', 'group_id' => '7', 'module' => 'employees', 'roles' => '["index","add_employee","edit_employee","delete_employee","add_cart","remove_cart","id_request"]'), array('id' => '41', 'group_id' => '7', 'module' => 'pds', 'roles' => '["personal_info","employee_profile","family","education","examination","work","voluntary_work","trainings","other_info","position_details","service_record","scanned_docs","reports","pds_print_preview","sr_print_preview","training_preview"]'), array('id' => '42', 'group_id' => '7', 'module' => 'personnel', 'roles' => '["assets","assets_spouse","assets_unmarried","assets_real_properties","assets_personals","assets_liabilities","assets_business_interests","assets_relatives","assets_other_info","personnel_schedule"]'), array('id' => '43', 'group_id' => '7', 'module' => 'training_manage', 'roles' => '["type","type_save","type_delete","course","course_save","course_delete","event","event_save","evenr_delete","attendance","attendance_save","attendance_delete","contact_type","contact_type_save","contact_type_delete","contact_info","contact_info_save","contact_info_delete"]'), array('id' => '52', 'group_id' => '2', 'module' => 'employees', 'roles' => '["index","add_employee","edit_employee","delete_employee","add_cart","remove_cart","id_request"]'), array('id' => '53', 'group_id' => '2', 'module' => 'pds', 'roles' => '["personal_info","employee_profile","family","education","examination","work","voluntary_work","trainings","other_info","position_details","service_record","scanned_docs","reports","pds_print_preview","sr_print_preview","training_preview"]'), array('id' => '54', 'group_id' => '2', 'module' => 'personnel', 'roles' => '["assets","assets_spouse","assets_unmarried","assets_real_properties","assets_personals","assets_liabilities","assets_business_interests","assets_relatives","assets_other_info","personnel_schedule"]'), array('id' => '55', 'group_id' => '2', 'module' => 'training_manage', 'roles' => '["type","type_save","type_delete","course","course_save","course_delete","event","event_save","evenr_delete","attendance","attendance_save","attendance_delete","contact_type","contact_type_save","contact_type_delete","contact_info","contact_info_save","contact_info_delete"]'), array('id' => '56', 'group_id' => '2', 'module' => 'attendance', 'roles' => '["dtr"]'), array('id' => '57', 'group_id' => '2', 'module' => 'manual_manage', 'roles' => '["office_pass"]'), array('id' => '58', 'group_id' => '2', 'module' => 'office_manage', 'roles' => '["view_offices","add_office","edit_office","divisions"]'), array('id' => '65', 'group_id' => '7', 'module' => 'manual_manage', 'roles' => '["login"]'), array('id' => '72', 'group_id' => '6', 'module' => 'employees', 'roles' => '["index","add_employee","edit_employee","delete_employee","add_cart","remove_cart","id_request"]'), array('id' => '73', 'group_id' => '6', 'module' => 'pds', 'roles' => '["personal_info","employee_profile","family","education","examination","work","voluntary_work","trainings","other_info","position_details","service_record","scanned_docs","reports","pds_print_preview","sr_print_preview","training_preview"]'), array('id' => '74', 'group_id' => '6', 'module' => 'personnel', 'roles' => '["assets","assets_spouse","assets_unmarried","assets_real_properties","assets_personals","assets_liabilities","assets_business_interests","assets_relatives","assets_other_info","personnel_schedule"]'), array('id' => '75', 'group_id' => '6', 'module' => 'training_manage', 'roles' => '["type","type_save","type_delete","course","course_save","course_delete","event","event_save","evenr_delete","attendance","attendance_save","attendance_delete","contact_type","contact_type_save","contact_type_delete","contact_info","contact_info_save","contact_info_delete"]'), array('id' => '76', 'group_id' => '6', 'module' => 'attendance', 'roles' => '["view_attendance","dtr","jo","double_entries","view_absences","view_late","view_ob","view_tardiness","view_ten_tardiness"]'), array('id' => '79', 'group_id' => '6', 'module' => 'settings_manage', 'roles' => '["salary_grade","holiday","schedules","employee_schedule","audit_trail","general_settings","backup","offline_update"]'), array('id' => '90', 'group_id' => '5', 'module' => 'leave_manage', 'roles' => '["records","leave_card","cancel_leave","file_leave","leave_apps","reports"]'), array('id' => '91', 'group_id' => '1', 'module' => 'appointment', 'roles' => '["issued"]'), array('id' => '100', 'group_id' => '9', 'module' => 'attendance', 'roles' => '["view_attendance","view_attendance_only","dtr","jo","double_entries","view_absences","view_late","view_ob","view_tardiness","view_ten_tardiness"]'), array('id' => '101', 'group_id' => '9', 'module' => 'manual_manage', 'roles' => '["login","cto","cto_apps","cto_forward_balance","office_pass"]'));
         $this->db->insert_batch('permissions', $ats_permissions);
     }
 }
 function up()
 {
     $agency = Setting::getField('system_name');
     if ($agency == 'Provincial Government of Quezon') {
         $this->db->where('group_id', 0);
         $this->db->update('users', array('group_id' => 1));
     }
 }
 function up()
 {
     // Do only if Puerto
     $lgu_code = Setting::getField('lgu_code');
     $allow = 'no';
     if ($lgu_code == '') {
         $allow = 'yes';
     }
     $data = array('name' => 'show_leave_credits_leave_apps', 'setting_value' => $allow, 'settings_group' => 'leave', 'description' => 'Show leave balance in leave application page.');
     $this->db->insert('settings', $data);
 }
 function up()
 {
     $setting_value = 'no';
     // Do only if Province of Laguna
     $lgu_code = Setting::getField('lgu_code');
     if ($lgu_code == 'quezon_province') {
         $setting_value = 'yes';
     }
     $data = array('name' => 'last_name_first_dtr', 'setting_value' => $setting_value, 'settings_group' => 'attendance');
     $this->db->insert('settings', $data);
 }
 function up()
 {
     // Do only if Province of Laguna
     $lgu_code = Setting::getField('lgu_code');
     $auto = 'no';
     if ($lgu_code == 'laguna_province') {
         $auto = 'yes';
     }
     $data = array('name' => 'auto_deduct_forced_leave', 'setting_value' => $auto, 'settings_group' => 'leave', 'description' => 'Set if auto deduct the forced leave every end of the year.');
     $this->db->insert('settings', $data);
 }
 function up()
 {
     // Do only if Puerto
     $lgu_code = Setting::getField('lgu_code');
     $allow = 'no';
     if ($lgu_code == '') {
         $allow = 'yes';
     }
     $data = array('name' => 'enable_add_earn_menu', 'setting_value' => 'no', 'settings_group' => 'leave', 'description' => 'Show add earn menu.');
     $this->db->insert('settings', $data);
 }
 function up()
 {
     // Do only if Province of Laguna
     $lgu_code = Setting::getField('lgu_code');
     $allow = 'no';
     if ($lgu_code == 'laguna_province') {
         $allow = 'yes';
     }
     $data = array('name' => 'show_calendar', 'setting_value' => $allow, 'settings_group' => 'leave', 'description' => 'Show the calendar in file leave');
     $this->db->insert('settings', $data);
 }
 function up()
 {
     // Do only if Province of Laguna
     $lgu_code = Setting::getField('lgu_code');
     $allow = 'no';
     if ($lgu_code == 'laguna_province') {
         $allow = 'yes';
     }
     $data = array('name' => 'auto_deduct_mc_vl', 'setting_value' => $allow, 'settings_group' => 'leave', 'description' => 'MC is 3 days only. Excess must be automatically deducted to VL/SL.');
     $this->db->insert('settings', $data);
 }
 function up()
 {
     // Do only if Puerto
     $lgu_code = Setting::getField('lgu_code');
     $seconds_user_idle = '7200';
     if ($lgu_code == '') {
         $seconds_user_idle = '72000';
     }
     $data = array('name' => 'seconds_user_idle', 'setting_value' => $seconds_user_idle, 'settings_group' => 'users', 'description' => 'Seconds before logout if user is idle');
     $this->db->insert('settings', $data);
 }
 function up()
 {
     $minutes_between_logs = '';
     // Do only if bataraza
     $lgu_code = Setting::getField('lgu_code');
     if ($lgu_code == 'bataraza') {
         $minutes_between_logs = '5';
     }
     $data = array('name' => 'minutes_between_logs', 'setting_value' => $minutes_between_logs, 'settings_group' => 'attendance', 'description' => 'minutes between every logs.');
     $this->db->insert('settings', $data);
 }
 function up()
 {
     // Do only if Puerto
     $lgu_code = Setting::getField('lgu_code');
     $download_images_server = 'no';
     if ($lgu_code == 'marinduque_province') {
         $download_images_server = 'yes';
     }
     $data = array('name' => 'download_images_server', 'setting_value' => $download_images_server, 'settings_group' => 'attendance', 'description' => 'whether to auto download images from server to client');
     $this->db->insert('settings', $data);
 }
 function up()
 {
     // Do only if Province of Laguna
     $lgu_code = Setting::getField('lgu_code');
     $allow = 'no';
     if ($lgu_code == 'laguna_province') {
         $allow = 'yes';
     }
     $data = array('name' => 'allow_encode_digit_undertime', 'setting_value' => $allow, 'settings_group' => 'leave', 'description' => 'Tell whether the system allow the encoding of undertime digits.');
     $this->db->insert('settings', $data);
 }
 function up()
 {
     $setting_value = 'no';
     // Do only if Province of Laguna
     $lgu_code = Setting::getField('lgu_code');
     if ($lgu_code == 'laguna_province') {
         $setting_value = 'yes';
     }
     $data = array('name' => 'auto_generate_employee_id', 'setting_value' => $setting_value, 'settings_group' => 'records');
     $this->db->insert('settings', $data);
 }
 function up()
 {
     // Do only if Province of Laguna
     $lgu_code = Setting::getField('lgu_code');
     $allow = 'no';
     if ($lgu_code == 'laguna_province') {
         $allow = 'yes';
     }
     $data = array('name' => 'allow_monetize_using_vl_sl', 'setting_value' => $allow, 'settings_group' => 'leave', 'description' => 'Allow Monetization deduction against both VL and SL.');
     $this->db->insert('settings', $data);
 }
 function up()
 {
     // Do only if Puerto
     $lgu_code = Setting::getField('lgu_code');
     $allow = 'no';
     if ($lgu_code == '') {
         $allow = 'yes';
     }
     $data = array('name' => 'enable_add_day_encode_tardy', 'setting_value' => 'no', 'settings_group' => 'leave', 'description' => 'Show the day textbox in adding of tardiness.');
     $this->db->insert('settings', $data);
 }
 function up()
 {
     $setting_value = 'Letter';
     // Do only if Province of Laguna
     $lgu_code = Setting::getField('lgu_code');
     if ($lgu_code == 'marinduque_province') {
         $setting_value = 'Legal';
     }
     $data = array('name' => 'service_record_paper_size', 'setting_value' => $setting_value, 'settings_group' => 'employees');
     $this->db->insert('settings', $data);
 }
 function up()
 {
     // Do only if Province of Laguna
     $lgu_code = Setting::getField('lgu_code');
     $allow = 'yes';
     if ($lgu_code == 'laguna_province') {
         $allow = 'no';
     }
     $data = array('name' => 'show_perform_leave_earnings_now', 'setting_value' => $allow, 'settings_group' => 'leave', 'description' => 'Tell whether the system display the perform leave earnings now link under nav menu.');
     $this->db->insert('settings', $data);
 }
 function up()
 {
     // Do only if Puerto
     $lgu_code = Setting::getField('lgu_code');
     $allow = 'no';
     if ($lgu_code == '') {
         $allow = 'yes';
     }
     $data = array('name' => 'show_incomplete_logs', 'setting_value' => $allow, 'settings_group' => 'attendance', 'description' => 'Show incomplete logs in view attendance.');
     $this->db->insert('settings', $data);
 }
 function up()
 {
     // Do only if Puerto
     $lgu_code = Setting::getField('lgu_code');
     $accept_late_ob = 'yes';
     if ($lgu_code == 'marinduque_province') {
         $accept_late_ob = 'no';
     }
     $data = array('name' => 'accept_late_ob', 'setting_value' => $accept_late_ob, 'settings_group' => 'attendance', 'description' => 'whether to accept late filing of ob or itinerary');
     $this->db->insert('settings', $data);
 }
 function up()
 {
     // Do only if Province of Laguna
     $lgu_code = Setting::getField('lgu_code');
     $allow = 'no';
     if ($lgu_code == 'laguna_province') {
         $allow = 'yes';
     }
     $data = array('name' => 'auto_sixty_days', 'setting_value' => $allow, 'settings_group' => 'leave', 'description' => 'Set 60 days if maternity leave.');
     $this->db->insert('settings', $data);
 }
 function up()
 {
     // Do only if Province of Laguna
     $lgu_code = Setting::getField('lgu_code');
     $order = 'DESC';
     if ($lgu_code == 'laguna_province') {
         $order = 'ASC';
     }
     $data = array('name' => 'encoded_leave_listing_order', 'setting_value' => $order, 'settings_group' => 'leave', 'description' => 'Display the encoded leave in file leave. ASC or DESC');
     $this->db->insert('settings', $data);
 }
 function up()
 {
     $lgu_code = Setting::getField('lgu_code');
     // Do only if bataraza
     if ($lgu_code == 'bataraza') {
         $data = array('done' => 1, 'done2' => 1);
         $this->db->where('year <=', 2012);
         $this->db->update('leave_earn_sched', $data);
     }
     $this->db->where('year <=', 2011);
     $this->db->delete('leave_earn_sched');
     return TRUE;
 }
 function up()
 {
     $am_out = '';
     $pm_in = '';
     // Do only if bataraza
     $lgu_code = Setting::getField('lgu_code');
     if ($lgu_code == 'bataraza') {
         $am_out = '12:20';
         $pm_in = '12:45';
     }
     $data = array('name' => 'end_am_out', 'setting_value' => $am_out, 'settings_group' => 'attendance', 'description' => 'End am out.');
     $this->db->insert('settings', $data);
     $data = array('name' => 'start_pm_in', 'setting_value' => $pm_in, 'settings_group' => 'attendance', 'description' => 'start pm in.');
     $this->db->insert('settings', $data);
 }
 function up()
 {
     $money_value_signatory_prepared = '';
     $money_value_signatory_prepared_position = '';
     $money_value_signatory_certified = '';
     $money_value_signatory_certified_position = '';
     // Do only if Province of Laguna
     $lgu_code = Setting::getField('lgu_code');
     if ($lgu_code == 'laguna_province') {
         $money_value_signatory_prepared = 'LEILANI M. SILAN';
         $money_value_signatory_prepared_position = 'HRMO III';
         $money_value_signatory_certified = 'NIDA A. REBENQUE';
         $money_value_signatory_certified_position = 'Asst. Provincial HRMO';
     }
     $data = array(array('name' => 'money_value_signatory_prepared', 'setting_value' => $money_value_signatory_prepared, 'settings_group' => 'leave', 'description' => '.'), array('name' => 'money_value_signatory_prepared_position', 'setting_value' => $money_value_signatory_prepared_position, 'settings_group' => 'leave', 'description' => '.'), array('name' => 'money_value_signatory_certified', 'setting_value' => $money_value_signatory_certified, 'settings_group' => 'leave', 'description' => '.'), array('name' => 'money_value_signatory_certified_position', 'setting_value' => $money_value_signatory_certified_position, 'settings_group' => 'leave', 'description' => '.'));
     $this->db->insert_batch('settings', $data);
 }
 function index($date1 = '', $date2 = '')
 {
     //mkdir('logs/office', 777);
     $this->load->library('xmlrpc');
     $this->xmlrpc->set_debug(TRUE);
     $this->load->helper('url');
     //$server_url = site_url('xmlrpc_server');
     //Change to real client(IP address)
     //$client = "localhost";
     $client = Setting::getField('client');
     $clients = explode(",", $client);
     foreach ($clients as $client) {
         $server_url = 'http://' . $client . '/' . $this->system_folder . '/' . $this->controller;
         //$server_url = 'http://www.mannysoft.com/ats_service/xmlrpc_server';
         $this->xmlrpc->server($server_url, 80);
         $this->xmlrpc->method('dtr');
         $today = date('Y-m-d') . '';
         //$request = $this->getDtr($date1, $date2);
         $request = $this->Dtr->get_dtr_range($today, $today, $web_service = TRUE);
         $first_day = date('Y-m') . '-01';
         $days = $this->Helps->get_days_in_between($first_day, $today);
         //echo '<pre>';
         //print_r($request);
         //echo '</pre>';
         //$this->xmlrpc->request($request);
         foreach ($days as $day) {
             $request = $this->Dtr->get_dtr_range($day, $day, $web_service == TRUE);
             $this->xmlrpc->request($request);
             if (!$this->xmlrpc->send_request()) {
                 echo $this->xmlrpc->display_error();
             } else {
                 echo '<pre>';
                 //print_r($this->xmlrpc->display_response());
                 $msg = $this->xmlrpc->display_response();
                 echo $msg['msg'];
                 echo '</pre>';
                 //Change localtime by the server time
                 exec("TIME " . $msg['server_time']);
                 exec("DATE " . $msg['server_date']);
             }
         }
     }
 }
Exemple #30
0
 function show_login()
 {
     $data = array();
     $data['system_message'] = '';
     if (Input::get('op')) {
         $username = Input::get('username');
         $password = Input::get('password');
         if ($username == "" || $password == "") {
             $data['system_message'] = 'Please complete the fields!';
         } else {
             // Encript password
             $password = do_hash($password, 'md5');
             $u = new User_m();
             $u->where('username', $username);
             $u->where('password', $password);
             $u->where('stat', 'Active');
             $u->get();
             // Check if the user exists
             if ($u->exists()) {
                 // Lets check if the idle function is enable
                 // Seconds before logout if user is idle
                 $seconds_user_idle = Setting::getField('seconds_user_idle');
                 if ($seconds_user_idle != '') {
                     unset($this->session->sess_expiration);
                     $this->session->sess_expiration = $seconds_user_idle;
                     $this->load->library('session');
                 }
                 $session_data = array('user_id' => $u->id, 'username' => $u->username, 'lname' => $u->lname, 'office_id' => $u->office_id, 'group_id' => $u->group_id, 'user_type' => $u->user_type);
                 Session::put($session_data);
                 redirect('home/home_page', 'refresh');
             } else {
                 $data['system_message'] = 'Invalid username or password!';
             }
         }
     }
     return View::make('login', $data);
 }