Ejemplo n.º 1
0
 function content_change_with_level($id)
 {
     if (_is('Subject Coordinator')) {
         $curent_centre_subjects = $this->subject_Model->getSCSubjects($this->current_user->id, $this->selected_year_term_id, $this->current_centre_role->centre_id);
     } else {
         if (_is('Teacher')) {
             $curent_centre_subjects = $this->subject_Model->getTeacherSubjects($this->current_user->id, $this->selected_year_term_id, $this->current_centre_role->centre_id, $id);
         } else {
             if (_is('Master Admin') and MASTER_FREE) {
                 $curent_centre_subjects = $this->subject_Model->getCenterSubjects(NULL);
             } else {
                 $curent_centre_subjects = $this->subject_Model->getCenterSubjects($this->current_centre_role->centre_id);
             }
         }
     }
     $subject_ids = array(-1);
     foreach ($curent_centre_subjects as $subject) {
         $subject_ids[] = $subject->id;
     }
     $selected_level_slo = $this->Slo_model->getSloFromLevel($id, $this->selected_year_term_id, $subject_ids);
     $new_selected_level_slo = array();
     foreach ($curent_centre_subjects as $subject) {
         $new_selected_level_slo[$subject->id]['subject_id'] = $subject->id;
         $new_selected_level_slo[$subject->id]['subject_name'] = $subject->name;
         $new_selected_level_slo[$subject->id]['slo'] = array();
     }
     if (!empty($selected_level_slo) && count($selected_level_slo) > 0) {
         foreach ($selected_level_slo as $new) {
             $new_selected_level_slo[$new->subject_id]['slo'][] = $new;
         }
     }
     $this->data['selected_level_slos'] = $new_selected_level_slo;
     $this->data['selected_level'] = $this->input->post('level_id');
     $this->load->view('view_slo_print_part', $this->data);
 }
Ejemplo n.º 2
0
 public function index($perpage = 5, $offset = 0)
 {
     if ($this->input->is_ajax_request()) {
         $perpage = $this->get_per_page();
         $this->breadcrumb->append_crumb('Staff Work Profiles', site_url('leave/work_profile'));
         $this->data['centres'] = $this->centre_model->getCentreList();
         if (_is('Centre Admin')) {
             $this->data['centre_id'] = $centre_id = $this->current_user->centre_id;
         } elseif ($this->input->get('centre_id')) {
             $this->data['centre_id'] = $centre_id = $this->input->get('centre_id');
         } else {
             $this->data['centre_id'] = $centre_id = 0;
         }
         $where = $centre_id == 0 ? array('active' => 1, 'id !=' => 1, 'id !=' => $this->current_user->id) : array('centre_id' => $centre_id, 'active' => 1, 'id !=' => 1, 'id !=' => $this->current_user->id);
         $this->data['staffs'] = $this->user_model->select('id, first_name, last_name')->getWhere($where);
         if ($this->input->get('staff_id')) {
             $this->data['staff_id'] = $staff_id = $this->input->get('staff_id');
         } else {
             $this->data['staff_id'] = $staff_id = 0;
         }
         $this->data['from_date'] = $from_date = $this->input->get('from_date');
         $this->data['to_date'] = $to_date = $this->input->get('to_date');
         $total_work_profiles = $this->work_profile_model->get_filtered_work_profiles(NULL, NULL, TRUE);
         $work_profiles = $this->work_profile_model->get_filtered_work_profiles($perpage, $offset);
         $this->paginate($perpage, $total_work_profiles, "leave/work_profile/index/" . $perpage, 5);
         $this->data['work_profiles'] = $work_profiles;
         $this->load->view('work_profile/staff_work_profiles', $this->data);
     } else {
         $this->ims_template->build('parent_account/blank', $this->data);
     }
 }
Ejemplo n.º 3
0
 public function getAllUsers($type, $perpage, $page, $user_id, $name = '', $email = '', $rc_centers = '0', $role = '0')
 {
     $this->db->select('u.*,GROUP_CONCAT(DISTINCT rr.name) as role_name,GROUP_CONCAT(DISTINCT c.name) as center_name')->from('user as u')->join('user_role as ur', 'ur.user_id = u.id', "LEFT")->join('role as rr', 'rr.id = ur.role_id', "LEFT")->join('center as c', 'ur.center_id = c.id', "LEFT")->where('u.id !=', $user_id);
     if (_is("RC Admin")) {
         $this->db->where('ur.center_id', $this->session->userdata('origin_centre_id'));
     } else {
         if ($rc_centers != '0') {
             $this->db->where('ur.center_id', $rc_centers);
         }
     }
     if ($role != '0') {
         $this->db->where('ur.role_id', $role);
     }
     if ($email != '') {
         $this->db->like('u.email', $email);
     }
     if ($name != '') {
         $this->db->where('(u.first_name LIKE \'%' . $name . '%\' OR u.last_name LIKE \'%' . $name . '%\' )', NULL, FALSE);
     }
     $this->db->group_by('u.id');
     if ($perpage != 0 || $page != 0) {
         $this->db->limit($perpage, ($page - 1) * $perpage);
     }
     $users = $this->db->get();
     if ($type) {
         return $users->result();
     } else {
         return $users->num_rows();
     }
 }
Ejemplo n.º 4
0
 public function index($offset = 0)
 {
     if ($this->input->is_ajax_request()) {
         $perpage = $this->get_per_page();
         $module = 'subject';
         if ($this->input->get('_sorting_field')) {
             $sort = $this->sort_by($this->input->get('_sorting_field'), $module);
         } else {
             $sort = NULL;
         }
         if ($this->input->post('search_word') == '' || $this->input->post('search_word') || $this->input->post('search_word') == 0) {
             $search = array();
             $search_word = $this->input->post('search_word');
             $this->session->set_userdata($module . '_search_word', $search_word);
             $search['word'] = $search_word;
             $search['fields'] = array('name', 'short_name');
             $this->data['search'] = $search;
         } elseif ($this->session->userdata($module . '_search_word')) {
             $search = array();
             $search_word = $this->session->userdata($module . '_search_word');
             $search['word'] = $search_word;
             $search['fields'] = array('name', 'short_name');
         } else {
             $search = NULL;
         }
         $sc_id = _is('Subject Coordinator') ? $this->current_user->id : 0;
         $result = $this->Subject_model->getSubject($offset, $perpage, $sort, $search, $sc_id, $this->default_yearterm->id);
         $subjects = $result['subjects'];
         $subject_use_slos = $this->Subject_model->getSubjectInUseInslo();
         $new_subject_use_slo = array();
         foreach ($subject_use_slos as $subject_use_slo) {
             $new_subject_use_slo[] = $subject_use_slo->subject_id;
         }
         $subject_use_sows = $this->Subject_model->getSubjectInUseInsow();
         $new_subject_use_sow = array();
         foreach ($subject_use_sows as $subject_use_sow) {
             $new_subject_use_sow[] = $subject_use_sow->subject_id;
         }
         $subject_use_themes = $this->Subject_model->getSubjectInUseInTheme();
         $new_subject_use_theme = array();
         foreach ($subject_use_themes as $subject_use_theme) {
             $new_subject_use_theme[] = $subject_use_theme->subject_id;
         }
         $subject_use_areas = $this->Subject_model->getSubjectInUseInArea();
         $new_subject_use_area = array();
         foreach ($subject_use_areas as $subject_use_area) {
             $new_subject_use_area[] = $subject_use_area->subject_id;
         }
         $output = array_unique(array_merge($new_subject_use_sow, $new_subject_use_slo, $new_subject_use_theme, $new_subject_use_area));
         $this->paginate($perpage, $result['total'], "subject/index", 3);
         $this->data['subject_used'] = $output;
         $this->data['subjects'] = $subjects;
         $this->data['perpage'] = $perpage;
         $this->data['sort'] = $sort;
         $this->load->view('view_manage_subject', $this->data);
     } else {
         $this->ims_template->build('parent_account/blank', $this->data);
     }
 }
Ejemplo n.º 5
0
 public function getallEvents($user_id)
 {
     $this->db->select('*');
     if (!_is("GR Admin")) {
         $this->db->where('create_id', $user_id);
     }
     $result = $this->db->get('events');
     return $result;
 }
Ejemplo n.º 6
0
 function index()
 {
     if (_is("RC Admin")) {
         $center = $this->session->userdata('current_centre_role')->center_id;
         $this->data['center_name'] = $this->dashboard_model->get_centername($center);
         $this->gr_template->build('rc_dashboard', $this->data);
     } else {
         // if (_is('GR Admin')) {
         $this->gr_template->build('dashboard', $this->data);
     }
     // }
 }
Ejemplo n.º 7
0
 function usermodule()
 {
     $roles = $this->relation_model->loadAllRoles();
     if (_is("GR Admin")) {
         $this->data['centers'] = $this->relation_model->loadAllCenters();
         $this->data['center_id'] = $this->data['centers'][0]->id;
     } else {
         $currentcenter_role = $this->session->userdata('current_centre_role');
         $this->data['center_id'] = $currentcenter_role->center_id;
         $this->data['users'] = $this->relation_model->loadAllUsers($this->current_user->id, $this->data['center_id']);
     }
     $this->data['alertify_error'] = "";
     $this->data['alertify_success'] = "";
     $this->data['allusers'] = $this->relation_model->loadtotalUsers($this->current_user->id, $this->data['center_id']);
     if ($this->input->post('center_id')) {
         if ($this->input->post('userid')) {
             if ($this->input->post('role_id')) {
                 $role_id = $this->input->post('role_id');
                 $this->data['alertify_success'] = "Role Added";
             } else {
                 $role_id = NULL;
                 $this->data['alertify_success'] = "User Added";
             }
             if ($this->relation_model->adduserToRole($this->input->post('userid'), $role_id, $this->input->post('center_id'))) {
             } else {
                 $this->data['alertify_success'] = '';
                 $this->data['alertify_error'] = "Failed to add";
             }
         } else {
             $this->data['center_id'] = $this->input->post('center_id');
             $this->data['allusers'] = $this->relation_model->loadtotalUsers($this->current_user->id, $this->data['center_id']);
             $this->data['users'] = $this->relation_model->loadAllUsers($this->current_user->id, $this->input->post('center_id'));
             $this->data['alertify_error'] = "Select User and Role to add";
         }
         $this->data['center_id'] = $this->input->post('center_id');
         $this->data['allusers'] = $this->relation_model->loadtotalUsers($this->current_user->id, $this->data['center_id']);
         $this->data['users'] = $this->relation_model->loadAllUsers($this->current_user->id, $this->input->post('center_id'));
     } else {
         $this->data['users'] = $this->relation_model->loadAllUsers($this->current_user->id, $this->data['center_id']);
     }
     //        debug($this->data['users']);
     $arrayrole = array();
     foreach ($roles as $row) {
         $aasignedusers = $this->relation_model->loadassignedUsers($row->id, $this->data['center_id']);
         $role = array('role_name' => $row->name, 'id' => $row->id, 'assignedusers' => $aasignedusers);
         array_push($arrayrole, $role);
     }
     $this->data['my_id'] = $this->current_user->id;
     $this->data['roles'] = $arrayrole;
     $this->gr_template->build('user_role', $this->data);
 }
Ejemplo n.º 8
0
 public function loadsingleblog($userid, $blog_id)
 {
     $data = null;
     if (_is("GR Admin")) {
         $this->db->select('*');
         $data = $this->db->where('id', $blog_id)->get('blog')->row();
     } else {
         if (_can("Blog")) {
             $this->db->select('*');
             $data = $this->db->where('user_id', $userid)->where('id', $blog_id)->get('blog')->row();
         }
     }
     return $data;
 }
 public function __construct()
 {
     parent::__construct();
     /**
      * Check for admin privilages
      */
     if (!_is('Master Admin')) {
         $this->_set_flashdata(lang('permission_denied'), 'error');
         redirect(site_url('dashboard'));
     }
     /**
      * Load inspect models
      */
     $this->load->model(array('parent_activity_feed_inspect_model', 'parent_account/parent_account_model'));
 }
Ejemplo n.º 10
0
Archivo: conf.php Proyecto: nopuls/dzcp
function _i($file, $var = "0")
{
    global $b;
    if ($var == 1) {
        $what = "Dir: ";
    } else {
        $what = "File:";
    }
    $_file = preg_replace("#\\.\\.#Uis", "", $file);
    if (_is($file)) {
        $c .= _true . "<font color='green'><b>" . $what . "</b>&nbsp;&nbsp;&nbsp; " . $_file . "</font>" . $b;
    } else {
        $c .= _false . "<font color='red'><b>" . $what . "</b>&nbsp;&nbsp;&nbsp; " . $_file . "</font>" . $b;
    }
    return $c;
}
Ejemplo n.º 11
0
 function index($offset = 0)
 {
     if ($this->input->is_ajax_request()) {
         $perpage = $this->get_per_page();
         $module = 'Parent';
         //for sorting
         if ($this->input->get('_sorting_field')) {
             $sort = $this->sort_by($this->input->get('_sorting_field'), $module);
         } else {
             $sort = NULL;
         }
         //for searching
         if ($this->input->post('search_word') == '' || $this->input->post('search_word') || $this->input->post('search_word') == 0) {
             $search = array();
             $search_word = trim($this->input->post('search_word'));
             $search['word'] = $search_word;
             $this->session->set_userdata($module . '_search_word', $search_word);
             $search['words'] = explode(' ', $search_word);
             $search['fields'] = array('first_name', 'last_name', 'username', 'email');
         } elseif ($this->session->userdata($module . '_search_word')) {
             $search = array();
             $search_word = $this->session->userdata($module . '_search_word');
             $search['word'] = $search_word;
             $search['fields'] = array('first_name', 'last_name', 'username', 'email');
         } else {
             $search = NULL;
         }
         if (_is('Centre Admin')) {
             $result = $this->parents_model->getparentForCentreAdmin($offset, $perpage, $sort, $search, $this->current_user->centre_id);
         } else {
             $result = $this->parents_model->getparent($offset, $perpage, $sort, $search);
         }
         $parents = $result['parents'];
         $this->paginate($perpage, $result['total'], "parents/index", 3);
         $this->data['total'] = $result['total'];
         $this->data['parents'] = $parents;
         $this->data['perpage'] = $perpage;
         $this->data['search'] = $search;
         $this->data['sort'] = $sort;
         $this->load->view('view_parents', $this->data);
     } else {
         $this->ims_template->build('parent_account/blank', $this->data);
     }
 }
Ejemplo n.º 12
0
 public function getBookingsEvents($filters, $center = NULL)
 {
     if (_is("RC Admin")) {
         $this->db->where('e.center_id', $center);
     }
     $this->db->select('e.*,c.name AS center_name, SUM(eo.attend) AS booked')->from('event_orders AS eo')->join('events AS e', 'e.id=eo.event_id', "RIGHT");
     if (!$filters) {
         $this->db->limit(10);
     } else {
         if ($filters['key'] != '') {
             $this->db->like('e.name', $filters['key']);
             $this->db->or_like('c.name', $filters['key']);
             //                $this->db->or_having('SUM(eo.attend)', $filters['key']);
         }
         if ($filters['center_id'] != '') {
             $this->db->where('e.center_id', $filters['center_id']);
         }
     }
     //
     $this->db->join('center AS c', 'c.id=e.center_id');
     $data = $this->db->order_by('e.added_date', "DESC")->group_by('e.id')->get()->result();
     //        debug($this->db->last_query());
     return $data;
 }
Ejemplo n.º 13
0
 public function __construct()
 {
     parent::__construct();
     $this->load->library('syraz_auth', IMS_DB_PREFIX . 'user');
     /**-------------------------------------------
      *          set login mode to System.         |
      **-------------------------------------------
      *
      * Use login 'system' to set it to system login.
      * By default it will use 'system' login
      *
      */
     $this->syraz_auth->set_login_mode('system');
     if (!$this->syraz_auth->logged_in()) {
         if ($this->input->is_ajax_request()) {
             echo "<script type='text/javascript'>\$(function(){window.location='" . site_url('system') . "';});</script>";
             exit;
         } else {
             redirect(site_url('system'));
         }
     }
     $this->load->library('form_validation');
     $this->load->model(array('admin_common_model'));
     $this->data['current_user'] = $this->current_user = $this->admin_common_model->getCurrentUser($this->syraz_auth->user_id());
     $current_roles = $this->admin_common_model->getUserRoles($this->current_user->id);
     $user_key_roles = $this->admin_common_model->getKeyRoles($this->current_user->id);
     $this->data['current_user_roles'] = $this->current_user->roles = array_merge($user_key_roles, $current_roles);
     $this->data['key_roles'] = array(1, 4, 5);
     /**/
     $parent_portal_setting = $this->options_model->getOption('parent_portal_setting');
     if (in_array('use_centre_logo_by_user_role', $parent_portal_setting)) {
         $logo = isset($this->session->userdata('current_centre_role')->logo) && $this->session->userdata('current_centre_role')->logo && file_exists('./uploads/centre/' . $this->session->userdata('current_centre_role')->logo) ? base_url() . 'uploads/centre/' . $this->session->userdata('current_centre_role')->logo : base_url() . 'uploads/logo/' . $this->options_model->getOption('admin_logo');
     } else {
         $logo = base_url() . 'uploads/logo/' . $this->options_model->getOption('admin_logo');
     }
     $this->data['system_logo'] = $logo;
     /**/
     $user_language = $this->data['current_user']->language;
     if (isset($user_language) && !empty($user_language)) {
         $this->language = $user_language;
         $this->lang->load(strtolower(get_class($this)), $this->language);
         $this->lang->load($this->language, 'common/' . $this->language);
     } else {
         $this->load->model('options_model');
         $language_setting = $this->options_model->getOption('language_setting');
         if (isset($language_setting) && !empty($language_setting)) {
             $this->language = $language_setting['language'];
             $this->lang->load(strtolower(get_class($this)), $this->language);
             $this->lang->load($this->language, 'common/' . $this->language);
         } else {
             $this->lang->load(strtolower(get_class($this)), $this->language);
             $this->lang->load($this->language, 'common/' . $this->language);
         }
     }
     global $current_language;
     $current_language = $this->language;
     $this->ims_template->enable_parser(FALSE)->set_theme('backend')->set_layout('default')->title("Staff's Portal")->set_partial('head')->set_partial('header_scroll')->set_partial('header')->set_partial('sidebar')->set_partial('footer');
     $this->data['theme_path'] = 'themes/backend/';
     // $this->output->enable_profiler(TRUE);
     $this->form_validation->set_error_delimiters('<label generated="true" class="error">', '</label>');
     $this->breadcrumb->append_crumb(lang('dashboard'), site_url('dashboard'), false);
     if (!$this->session->userdata('current_centre_role')) {
         $keyRoles = $this->admin_common_model->getKeyRoles($this->current_user->id);
         $this->session->set_userdata('current_centre_role', $keyRoles[0]);
         if (!empty($keyRoles)) {
         } else {
             $this->session->set_userdata('current_centre_role', $this->admin_common_model->getDefaultRole($this->current_user->id, $this->current_user->centre_id));
         }
     }
     global $_current_centre_role;
     $_current_centre_role = $this->current_centre_role = $this->session->userdata('current_centre_role');
     if (!$this->current_centre_role) {
         show_error('No roles defined for this user. Please contact system admin.');
     }
     $this->data['is_master_admin'] = $this->is_master_admin = $this->_is_master_admin();
     global $_permissions;
     $_permissions = $this->_permissions = $this->admin_common_model->getUserPermissions($this->current_centre_role->role_id);
     $this->data['year_term_related_module'] = array('album', 'app_assignment', 'assessment', 'assessment_view', 'events', 'lesson_record', 'print_sow', 'progress_report', 'relations', 'slo', 'sow');
     if ($this->_is('Teacher')) {
         $role = 'Teacher';
         $this->data['year_terms'] = $this->admin_common_model->getYearTerms($role);
         $this->_check_year_term($this->data['year_terms']);
         $default_id = $this->admin_common_model->get_default_id($role);
         if ($this->_isProgressReport() || $this->_isAlbum()) {
             $default_id = $this->admin_common_model->get_default_progress_id($role);
         }
         if (!empty($default_id)) {
             $id = $default_id->id;
         } else {
             $de_id = $this->admin_common_model->get_default_id($role = '');
             if ($this->_isProgressReport() || $this->_isAlbum()) {
                 $default_id = $this->admin_common_model->get_default_progress_id($role = '');
             }
             if (!empty($de_id)) {
                 $id = $de_id->id;
             } else {
                 $d_id = $this->admin_common_model->get_max_id();
                 $id = $d_id->id;
             }
         }
         if (!$this->session->userdata('selected_year_term_id_teacher')) {
             $this->session->set_userdata('selected_year_term_id_teacher', $id);
         }
         if ($this->_isProgressReport() || $this->_isAlbum()) {
             if (!$this->session->userdata('selected_progress_report_id_teacher')) {
                 $this->session->set_userdata('selected_progress_report_id_teacher', $id);
             }
         }
     } else {
         if (_is('Subject Coordinator')) {
             $role = 'Subject Coordinator';
             $this->data['year_terms'] = $this->admin_common_model->getYearTerms($role);
             $this->_check_year_term($this->data['year_terms']);
             $default_id = $this->admin_common_model->get_default_id($role);
             if (!empty($default_id)) {
                 $id = $default_id->id;
             } else {
                 $de_id = $this->admin_common_model->get_default_id($role = '');
                 if (!empty($de_id)) {
                     $id = $de_id->id;
                 } else {
                     $d_id = $this->admin_common_model->get_max_id();
                     $id = $d_id->id;
                 }
             }
             if (!$this->session->userdata('selected_year_term_id_sub_cor')) {
                 $this->session->set_userdata('selected_year_term_id_sub_cor', $id);
             }
         } else {
             if (_is('Supervisor')) {
                 $this->data['year_terms'] = $this->admin_common_model->getYearTerms($role = '');
                 $this->_check_year_term($this->data['year_terms']);
                 $default_id = $this->admin_common_model->get_default_id($role = '');
                 $role = 'Supervisor';
                 if ($this->_isProgressReport() || $this->_isAlbum()) {
                     $default_id = $this->admin_common_model->get_default_progress_id($role);
                 }
                 if (!empty($default_id)) {
                     $id = $default_id->id;
                 } else {
                     $de_id = $this->admin_common_model->get_default_id($role = '');
                     if ($this->_isProgressReport() || $this->_isAlbum()) {
                         $default_id = $this->admin_common_model->get_default_progress_id($role = '');
                     }
                     if (!empty($de_id)) {
                         $id = $de_id->id;
                     } else {
                         $d_id = $this->admin_common_model->get_max_id();
                         $id = $d_id->id;
                     }
                 }
                 if (!$this->session->userdata('selected_year_term_id')) {
                     $this->session->set_userdata('selected_year_term_id', $id);
                 }
                 if ($this->_isProgressReport() || $this->_isAlbum()) {
                     if (!$this->session->userdata('selected_progress_report_id_supervisor')) {
                         $this->session->set_userdata('selected_progress_report_id_supervisor', $id);
                     }
                 }
             } else {
                 $this->data['year_terms'] = $this->admin_common_model->getYearTerms($role = '');
                 $this->_check_year_term($this->data['year_terms']);
                 $default_id = $this->admin_common_model->get_default_id($role = '');
                 if (!empty($default_id)) {
                     $id = $default_id->id;
                 } else {
                     $d_id = $this->admin_common_model->get_max_id();
                     $id = $d_id->id;
                 }
                 if (!$this->session->userdata('selected_year_term_id')) {
                     $this->session->set_userdata('selected_year_term_id', $id);
                 }
             }
         }
     }
     if ($this->_is('Teacher')) {
         $this->data['selected_year_term_id'] = $this->selected_year_term_id = $this->session->userdata('selected_year_term_id_teacher');
         if ($this->_isProgressReport() || $this->_isAlbum()) {
             $this->data['selected_year_term_id'] = $this->selected_year_term_id = $this->session->userdata('selected_progress_report_id_teacher');
         }
     } else {
         if (_is('Subject Coordinator')) {
             $this->data['selected_year_term_id'] = $this->selected_year_term_id = $this->session->userdata('selected_year_term_id_sub_cor');
         } else {
             if ($this->_is('Supervisor')) {
                 $this->data['selected_year_term_id'] = $this->selected_year_term_id = $this->session->userdata('selected_year_term_id');
                 if ($this->_isProgressReport() || $this->_isAlbum()) {
                     $this->data['selected_year_term_id'] = $this->selected_year_term_id = $this->session->userdata('selected_progress_report_id_supervisor');
                 }
             } else {
                 $this->data['selected_year_term_id'] = $this->selected_year_term_id = $this->session->userdata('selected_year_term_id');
             }
         }
     }
     $this->data['selected_year_term'] = $this->selected_year_term = year_term($this->selected_year_term_id);
     $this->data['current_controller'] = $this->router->fetch_class();
     $this->data['current_controller_method'] = $this->router->fetch_method();
     $this->data['report_menu_items'] = array('childreen_attribute_report' => 'Children Attribute Report', 'attendance_summary' => 'Attendance Summary', 'course_expiry_reports' => 'Course Expiry Reports', 'inventory_report' => 'Inventory Report', 'service_fees_report' => 'Service Fees Report');
     $this->default_yearterm = $this->admin_common_model->select('id,year,term,start_date,end_date')->getOneWhere(array('default' => 1), IMS_DB_PREFIX . 'year_term');
     $this->default_yearterm = !empty($this->default_yearterm) ? $this->default_yearterm : $this->admin_common_model->getLatestYearTerm();
 }
Ejemplo n.º 14
0
        ?>
                                        <?php 
        if (_is('Master Admin')) {
            ?>
                                            <a title="Login as <?php 
            echo $user->first_name;
            ?>
" class="temp_user_login" user_id="<?php 
            echo $user->id;
            ?>
" href="javascript:void(0);"><img src="<?php 
            echo base_url($theme_path . '/images/icons/color/login.png');
            ?>
"/></a>
                                        <?php 
        } elseif (_is('Centre Admin')) {
            ?>
                                            <a <?php 
            echo $user->original_centre_id == $selected_centre_id ? 'class="temp_user_login" title="Login as ' . $user->first_name . '"' : ' style="opacity:0.6" title="You can\'t login to another centre\'s user"';
            ?>
 user_id="<?php 
            echo $user->id;
            ?>
" href="javascript:void(0);"><img src="<?php 
            echo base_url($theme_path . '/images/icons/color/login.png');
            ?>
"/></a>
                                        <?php 
        }
        ?>
                                    </td>
Ejemplo n.º 15
0
 public function print_consolidated_assessment()
 {
     if (empty($_GET)) {
         $this->_set_flashdata(lang('print_assessment_no_param'), 'error');
         redirect(site_url('assessment_view'));
     }
     $subject_id = $this->input->get('subject_id', true);
     $assessment_category_id = $this->input->get('assessment_category_id', true);
     $_year_term = $this->selected_year_term_id;
     $levels = $this->levels_model->getLevels();
     if (empty($subject_id) && empty($assessment_category_id) && empty($_year_term)) {
         $this->_set_flashdata(lang('print_assessment_invalid_param'), 'error');
         redirect(site_url('assessment_view'));
     }
     $this->data['subject'] = $this->subject_model->getSubjectById($subject_id);
     if (_is('Teacher')) {
         $this->data['levels'] = $levels = $this->levels_model->getTeacherLevels($this->current_user->id, $_year_term, $this->current_centre_role->centre_id);
         $in_level = pluck($levels, 'id');
     } else {
         if (_is('Level Coordinator')) {
             $this->data['levels'] = $levels = $this->levels_model->getLCLevel($this->current_user->id, $_year_term);
             $in_level = pluck($levels, 'id');
         } else {
             $this->data['levels'] = $levels = $this->assessment_view_model->order_by('sequence')->getWhere(array('archive' => 0), IMS_DB_PREFIX . 'level');
             $in_level = NULL;
         }
     }
     if (_is('Subject Coordinator')) {
         $this->data['subjects'] = $this->subject_model->getSCSubjects($this->current_user->id, $_year_term, $this->current_centre_role->centre_id);
     } else {
         if (_is('Teacher')) {
             $this->data['subjects'] = $this->subject_model->getTeacherSubjects($this->current_user->id, $_year_term, $this->current_centre_role->centre_id, 0);
         } else {
             if (_is('Master Admin') and MASTER_FREE) {
                 $this->data['subjects'] = $this->subject_model->getCenterSubjects(NULL);
             } else {
                 $this->data['subjects'] = $this->subject_model->getCenterSubjects($this->current_centre_role->centre_id);
             }
         }
     }
     $this->data['rubric_groups'] = $this->assessment_view_model->order_by('sequence')->getWhere(array('subject_id' => $subject_id), IMS_DB_PREFIX . 'rubric_group');
     $rubrics = $this->assessment_view_model->order_by('sequence')->getRubrics($subject_id);
     $this->data['rubrics'] = array();
     foreach ($rubrics as $rubric) {
         $this->data['rubrics'][$rubric->rubric_group_id][] = $rubric;
     }
     $this->data['assessment_categories'] = $this->assessment_view_model->order_by('sequence')->getWhere(array('subject_id' => $subject_id), IMS_DB_PREFIX . 'assessment_category');
     $this->data['assessments'] = $this->assessment_view_model->getAssessmentConLevel($subject_id, $assessment_category_id, $_year_term, $in_level);
     $assessments_rubrics = $this->assessment_view_model->getRubricAssessment($subject_id);
     $this->data['assessments_rubrics'] = array();
     foreach ($assessments_rubrics as $assessments_rubric) {
         $this->data['assessments_rubrics'][$assessments_rubric->assessment_id][] = $assessments_rubric;
     }
     $assessments_levels = $this->assessment_view_model->getLevelAssessment($subject_id);
     $this->data['assessments_levels'] = array();
     foreach ($assessments_levels as $assessments_level) {
         $this->data['assessments_levels'][$assessments_level->assessment_id][] = $assessments_level;
     }
     $consolidate_assessment_rubric = $this->data['assessments_rubrics'];
     $consolidate_assessment_levels = $this->data['assessments_levels'];
     $consolidate_assessments = $this->data['assessments'];
     $b = array();
     if (isset($consolidate_assessments) && $consolidate_assessments) {
         foreach ($consolidate_assessments as $assessment) {
             if (isset($consolidate_assessment_levels[$assessment->id]) and count($consolidate_assessment_levels[$assessment->id]) > 0) {
                 foreach ($consolidate_assessment_levels[$assessment->id] as $assessments_level) {
                     $a = array();
                     $a[$assessments_level->name] = array();
                     $a[$assessments_level->name]['id'] = $assessment->id;
                     $a[$assessments_level->name]['name'] = $assessment->name;
                     $a[$assessments_level->name]['rubric'] = array();
                     if (isset($consolidate_assessment_rubric[$assessment->id]) and count($consolidate_assessment_rubric[$assessment->id]) > 0) {
                         $i = 0;
                         foreach ($consolidate_assessment_rubric[$assessment->id] as $assessments_rubric) {
                             $a[$assessments_level->name]['rubric'][$i] = $assessments_rubric->name . "<br>";
                             $i++;
                         }
                     }
                     if (array_key_exists($assessments_level->name, $b)) {
                         array_push($b[$assessments_level->name], $a);
                     } else {
                         $b[] = $a;
                     }
                 }
             }
         }
     }
     $printable = array();
     foreach ($levels as $level) {
         $printable[$level->name] = null;
     }
     if (!empty($b)) {
         foreach ($b as $k => $v) {
             $key = key($v);
             $printable[$key][] = $v[$key];
         }
     }
     $this->data['printable'] = array_filter($printable);
     $this->data['all_year_term'] = $this->data['year_terms'];
     $this->load->view('template/assessment_view_download', $this->data);
     //        $file_name = "assessment_view_" . $subject_id . '_' . $_year_term . ".pdf";
     //        $html = $this->load->view('template/assessment_view_download', $this->data, true);
     //        $this->load->library('pdf');
     //        $pdf = $this->pdf->load();
     //
     //        $pdf->WriteHTML($html); // write the HTML into the PDF
     //        $pdf->Output($file_name, 'D');
 }
</td>
                </tr>
              </table>
              <strong><?php 
    echo $lesson_record->sv_approve == 1 ? lang('check_and_approved_on') : lang('check_on');
    ?>
: <?php 
    echo dateTimeFormat($lesson_record->sv_date);
    ?>
</strong>
              <?php 
}
?>
</div>
            <div style="float:right;width:310px;margin:0px 10px;font-size:10px;"><?php 
if (_is('Subject Coordinator') and $lesson_record->status == 'Pending Approval' and $lesson_record->sc_approve == 0) {
    ?>
              <strong><?php 
    echo lang('check_by_subject_coordinator');
    ?>
 (<?php 
    echo $lesson_record->sc_name;
    ?>
)</strong>
              <div class="da-panel-widget" style="margin-left:5px !important;margin-right:5px !important; font-size:10px;text-indent: 10px !important;margin-bottom:5px;"><?php 
    echo $lesson_record->sc_comment;
    ?>
</div>
              <strong><?php 
    echo lang('check_on');
    ?>
Ejemplo n.º 17
0
function get_stylesheet_color_scheme_link()
{
    return get_base_uri('style-' . _is($_SESSION['color_scheme_session'], 0) . '.css', 'css');
}
Ejemplo n.º 18
0
 function preacher_add()
 {
     $this->data['typealert'] = "";
     $this->data['userpostedarray'] = array('fname' => $this->input->post('fname'), 'language' => $this->input->post('language') ? implode(',', $this->input->post('language')) : '', 'status' => $this->input->post('preacher_status'), 'areas_of_expertise' => $this->input->post('expertise') ? implode(',', $this->input->post('expertise')) : '', 'address' => $this->input->post('address'), 'description' => $this->input->post('description'));
     if ($this->input->post()) {
         $this->form_validation->set_rules('fname', 'Name', 'trim|required');
         $this->form_validation->set_rules('language', 'Language', 'required');
         $this->form_validation->set_rules('preacher_status', 'Preacher Status', 'trim|required');
         $this->form_validation->set_rules('description', 'Description', 'required');
         $this->form_validation->set_rules('address', 'Address', 'required');
         $this->form_validation->set_rules('expertise', 'Area of expertise', 'required');
         if ($this->form_validation->run() == true) {
             //                if ($_FILES['avatar']['name'] == '') {
             //                    $avatar = 'https://s.gravatar.com/avatar/' . md5($this->input->post('email')) . '?s=200';
             //                } else if ($_FILES['avatar']['error'] == 0) {
             //                    //upload and update the file
             //                    $config['upload_path'] = './uploads/image/profile/';
             //                    $config['allowed_types'] = 'gif|jpg|png';
             //                    $config['overwrite'] = false;
             //                    $config['remove_spaces'] = true;
             //                    //$config['max_size']	= '100';// in KB
             //                    if (!file_exists('./uploads/image/profile')) {
             //                        if (!mkdir('./uploads/image/profile/', 0755, TRUE)) {
             //                            //echo 'false';
             //                        }
             //                    }
             //                    $this->load->library('upload', $config);
             //
             //                    if (!$this->upload->do_upload('avatar')) {
             //                        $avatar = '';
             //                    } else {
             //                        //Image Resizing
             //                        $config['source_image'] = $this->upload->upload_path . $this->upload->file_name;
             //                        $config['maintain_ratio'] = FALSE;
             //                        $config['width'] = 300;
             //                        $config['height'] = 300;
             //                        $this->load->library('image_lib', $config);
             //
             //                        if (!$this->image_lib->resize()) {
             //                            $avatar = '';
             //                        } else {
             //                            $avatar = 'uploads/image/profile/' . $this->upload->file_name;
             //                        }
             //                    }
             ////                    $avatar = '';
             //                }
             if ($_POST['uploadImage'] == '') {
                 $avatar = '';
             } else {
                 //upload and update the file
                 $config['upload_path'] = './uploads/image/homeslider/';
                 $avatar = '';
                 $image = $this->input->post('uploadImage');
                 if ($image != '') {
                     $imageContent = file_get_contents($image);
                     $file = $config['upload_path'] . uniqid() . '.png';
                     $success = file_put_contents($file, $imageContent);
                     $avatar = $success ? $file : '';
                 }
                 //                    $avatar = '';
             }
             $preacharray = array('name' => htmlspecialchars($this->input->post('fname')) . " " . htmlspecialchars($this->input->post('lname')), 'description' => htmlspecialchars($this->input->post('description')), 'address' => htmlspecialchars($this->input->post('address')), 'language' => $this->input->post('language') ? implode(',', $this->input->post('language')) : '', 'status' => htmlspecialchars($this->input->post('preacher_status')), 'areas_of_expertise' => $this->input->post('expertise') ? implode(',', $this->input->post('expertise')) : '', 'timestamp' => date(DATE_FORMAT), 'image' => $avatar);
             $user_id = $this->event_model->addNewPreacher($preacharray);
             if (_is("RC Admin") || _is("Event Admin")) {
                 $center_id = $this->session->userdata('current_centre_role')->center_id;
                 $array = array('center_id' => $center_id, 'preacher_id' => $user_id);
                 $this->event_model->insertRow($array, 'center_preachers');
             }
             $this->data['typealert'] = "success";
             $this->data['userpostedarray'] = array('fname' => '', 'description' => '', 'address' => '', 'language' => '', 'status' => '', 'area_of_expertise' => '');
             $this->data['message'] = '';
             //                redirect(site_url('event/preachers'));
         } else {
             $this->data['message'] = '';
         }
     } else {
         $this->data['message'] = '';
     }
     $this->data['languages'] = $this->event_model->getAll('languages');
     $this->data['status'] = $this->event_model->getAll('preachers_status');
     $this->data['expertise'] = $this->event_model->getAll('area_of_expertise');
     $this->breadcrumb->append_crumb(lang('GoretreatUser'), site_url('event'));
     $this->gr_template->build('preachers_add', $this->data);
 }
Ejemplo n.º 19
0
 public function print_class_list()
 {
     $this->load->model('classes/Classes_model');
     $this->load->model('child/child_model');
     if ($this->input->is_ajax_request()) {
         $current_selected_year = $this->session->userdata('selected_year');
         $current_selected_month = $this->session->userdata('selected_month');
         if ($this->input->post('year')) {
             $this->data['year'] = $year1 = $this->input->post('year');
             $this->session->set_userdata('selected_year', $year1);
         } else {
             if ($current_selected_year) {
                 $this->data['year'] = $year1 = $current_selected_year;
             } else {
                 $this->data['year'] = $year1 = date('Y');
             }
         }
         if ($this->input->post('month')) {
             $this->data['month'] = $month1 = $this->input->post('month');
             $this->session->set_userdata('selected_month', $month1);
         } else {
             if ($current_selected_month) {
                 $this->data['month'] = $month1 = $current_selected_month;
             } else {
                 $this->data['month'] = $month1 = date('m');
             }
         }
         $this->data['current_centre'] = $centre = $this->current_centre_role->centre;
         $this->data['classId'] = $classId = $this->input->post('classId') === false ? 0 : $this->input->post('classId');
         if ($classId != 0) {
             $this->data['classInfo'] = $this->Classes_model->getClass($classId);
         }
         if (_is('Teacher')) {
             $this->data['ClassLevel'] = $this->attendance_model->getAttendancePermission($this->current_user->id, $this->current_centre_role->centre_id, $this->default_yearterm->id);
         } else {
             $this->data['ClassLevel'] = $this->Classes_model->getClassLevel($this->current_centre_role->centre_id);
         }
         /* Check if child exist */
         $year = date('Y');
         $month = date('m');
         $year_term = $this->default_yearterm->id;
         $centre_id = $this->current_centre_role->centre_id;
         if (!empty($this->data['ClassLevel'])) {
             foreach ($this->data['ClassLevel'] as $key => $value) {
                 // $attendance = $this->attendance_model->getAttendanceListByMonth($year, $month, $value->id);
                 $child_count = $this->child_model->getClassListByMonth($value->id, $year, $month);
                 $this->data['ClassLevel'][$key]->childCount = count($child_count);
             }
         }
         /* Check if child exist */
         $this->data['classDetails'] = $this->child_model->getClassListByMonth($classId, $year1, $month1);
         $classStudentDetails = $this->child_model->getClassListByMonthDetail($classId, $year1, $month1);
         $this->data['classStudentDetails'] = '';
         $this->data['relations'] = array();
         if (!empty($classStudentDetails)) {
             $classStudentDetails_arr = array();
             foreach ($classStudentDetails as $key => $classStudentDetail) {
                 if (!isset($classStudentDetails_arr[$classStudentDetail->id])) {
                     $classStudentDetails_arr[$classStudentDetail->id] = (array) $classStudentDetail;
                 }
                 if (!empty($classStudentDetail->kin_name)) {
                     $classStudentDetails_arr[$classStudentDetail->id]['kin_relations'][$classStudentDetail->kin_name] = array('name' => $classStudentDetail->kin_fullname, 'kin' => $classStudentDetail->kin_name, 'contact' => $classStudentDetail->kin_contact);
                 } else {
                     if (!isset($classStudentDetails_arr[$classStudentDetail->id]['kin_relations'])) {
                         $classStudentDetails_arr[$classStudentDetail->id]['kin_relations'] = array();
                     }
                 }
                 if (!in_array($classStudentDetail->kin_name, $this->data['relations'])) {
                     $this->data['relations'][] = $classStudentDetail->kin_name;
                 }
             }
             $this->data['classStudentDetails'] = $classStudentDetails_arr;
         }
         //get month name
         $monthName = date("F", mktime(0, 0, 0, $month1, 10));
         $this->data['month_name'] = $monthName;
         //get number of days in month
         $number_of_days = cal_days_in_month(CAL_GREGORIAN, $month1, $year1);
         for ($d = 1; $d <= $number_of_days; $d++) {
             $time = mktime(12, 0, 0, $month1, $d, $year1);
             $list[] = array('week' => date('w', $time), 'date' => date('d', $time), 'day_letter' => substr(date('D', $time), 0, 1));
         }
         $this->data['days'] = $list;
         $this->load->view('print_class_list', $this->data);
     } else {
         $this->session->unset_userdata(array('selected_year' => '', 'selected_month' => ''));
         $this->ims_template->build('parent_account/blank', $this->data);
     }
 }
Ejemplo n.º 20
0
">
                        <div class="box-header">
                            <h3 class="box-title">Search</h3>
                        </div><!-- /.box-header -->
                        <div class="box-body">
                            <div class="row" style="padding-bottom: 20px;">

                                <div class="col-md-5">
                                    <label class="h5">Name</label>
                                    <input type="text" name="key" placeholder="Search key like Name of event, Name of center etc.." class="form-control" value="<?php 
echo isset($filters['key']) ? $filters['key'] : "";
?>
">
                                </div>
                                <?php 
if (!_is("RC Admin")) {
    ?>
                                <div class="col-md-5">
                                    <label class="h5">Center</label>
                                    <select placeholder="Select Center" class="center_id form-control" name="center_id">
                                        <option value="">All</option>
                                        <?php 
    foreach ($centers as $value) {
        ?>
                                            <option value="<?php 
        echo $value->id;
        ?>
" <?php 
        echo isset($filters['center_id']) && $filters['center_id'] == $value->id ? "selected" : "";
        ?>
><?php 
Ejemplo n.º 21
0
                            </select>
                        </div>
                        <label ><?php 
echo lang('name');
?>
</label>
                        <textarea name="detail" id="album_detail"></textarea>
                    </div>
                </div>
            </div>
        </div> 
    </form>  

</div>
<?php 
if (_is('Teacher')) {
    ?>
<select id="temp_album_subject_id" style="display: none;">
    <?php 
    foreach ($subjects as $subject) {
        ?>
        <option value="<?php 
        echo $subject->id;
        ?>
" class_id="<?php 
        echo $subject->class_id;
        ?>
"><?php 
        echo $subject->name;
        ?>
</option>
Ejemplo n.º 22
0
 public function index($perpage = 25, $offset = 0)
 {
     if ($this->input->is_ajax_request()) {
         $return = $this->session->userdata('sow');
         $this->data['return_sow'] = $return;
         if (!empty($return)) {
             $this->session->set_userdata('return', true);
         }
         $this->session->unset_userdata('sow');
         $this->data['return'] = false;
         $returned = $this->session->userdata('return');
         if (!empty($returned)) {
             $this->data['return'] = true;
             $this->data['open_sow_id'] = $this->session->userdata('sow_id');
             $data = $this->session->userdata('restore');
         }
         $year_term = year_term($this->selected_year_term_id);
         $perpage = $this->get_per_page();
         if (_is('Teacher')) {
             $all_levels = $level_ids = $this->levels_model->getTeacherLevels($this->current_user->id, $this->selected_year_term_id, $this->current_centre_role->centre_id);
         } else {
             if (_is('Level Coordinator')) {
                 $all_levels = $level_ids = $levels = $this->levels_model->getLCLevel($this->current_user->id, $this->selected_year_term_id);
             } else {
                 $all_levels = $level_ids = $this->sow_model->order_by('sequence')->getWhere(array('archive' => 0), IMS_DB_PREFIX . 'level');
             }
         }
         $take_lid = $this->session->userdata('level_id');
         if (empty($take_lid)) {
             $this->session->set_userdata('level_id', -1);
         }
         $levelid = $this->input->get('level_id') ? $this->input->get('level_id') : $this->session->userdata('level_id');
         if ($levelid && $levelid != -1) {
             $this->data['level_id'] = $level_ids = $current_level = $levelid;
         } else {
             $this->data['level_id'] = '';
             $current_level = ($all_levels and isset($all_levels[0])) ? $all_levels[0]->id : 0;
         }
         if (!empty($levelid)) {
             $this->session->set_userdata('level_id', $levelid);
         } else {
             $this->data['level_id'] = $level_ids = $current_level = $this->session->userdata('level_id');
         }
         if (_is('Subject Coordinator')) {
             $curent_centre_subjects = $subject_ids = $this->subject_model->getSCSubjects($this->current_user->id, $this->selected_year_term_id, $this->current_centre_role->centre_id);
         } else {
             if (_is('Teacher')) {
                 $curent_centre_subjects = $subject_ids = $this->subject_model->getTeacherSubjects($this->current_user->id, $this->selected_year_term_id, $this->current_centre_role->centre_id, $current_level);
             } else {
                 if (_is('Master Admin') and MASTER_FREE) {
                     $curent_centre_subjects = $subject_ids = $this->subject_model->getCenterSubjects();
                 } else {
                     $curent_centre_subjects = $subject_ids = $this->subject_model->getCenterSubjects($this->current_centre_role->centre_id);
                 }
             }
         }
         $take_sid = $this->session->userdata('subject_id');
         if (empty($take_sid)) {
             $this->session->set_userdata('subject_id', -1);
         }
         $subjectid = $this->input->get('subject_id') ? $this->input->get('subject_id') : $this->session->userdata('subject_id');
         if ($subjectid && $subjectid != -1) {
             $this->data['subject_id'] = $subject_ids = $subjectid;
         } else {
             $this->data['subject_id'] = '';
         }
         if (!empty($subjectid)) {
             $this->session->set_userdata('subject_id', $subjectid);
         } else {
             $this->data['subject_id'] = $this->session->userdata('subject_id');
         }
         $this->data['sort'] = $this->sort_by_for_task($this->input->get('_sorting_field'), 'task', 'id', 'desc');
         $tasks = $this->task_model->getFilteredTask($perpage, $offset, $level_ids, $subject_ids, $this->input->get('search_key'), $this->data['sort']);
         unset($_GET['_sorting_field']);
         foreach ($tasks as $key => $task) {
             $task->file_paths = count_serialize($task->file_paths);
             $task->urls = count_serialize($task->urls);
         }
         $total_tasks = $this->task_model->getFilteredTask(NULL, NULL, $level_ids, $subject_ids, $this->input->get('search_key'));
         $this->paginate($perpage, count($total_tasks), "sow/task/index/" . $perpage, 5);
         $this->data['all_levels'] = $all_levels;
         $this->data['current_centre_subjects'] = $curent_centre_subjects;
         $this->data['tasks'] = $tasks;
         $this->load->view('task', $this->data);
     } else {
         $this->ims_template->build('parent_account/blank', $this->data);
     }
 }
Ejemplo n.º 23
0
    echo date(FORMAT_DATE, strtotime($value->end_date));
    ?>
</td>
                                        <td><?php 
    echo closetags(substr($value->address, 0, 45));
    echo strlen($value->address) > 45 ? "..." : '';
    ?>
</td>
                                        <td>
                                            <?php 
    echo closetags(substr($value->description, 0, 45));
    echo strlen($value->description) > 45 ? "..." : '';
    ?>
                                        </td>
                                        <?php 
    if (_is("GR Admin")) {
        ?>
                                            <td><?php 
        echo $value->count;
        ?>
</td>

                                            <?php 
    }
    ?>
                                        <td>
                                            <a href="<?php 
    echo site_url('event/testimonial_view/' . $value->id);
    ?>
" class="btn btn-sm btn-primary" title="view">
                                                <i class="fa fa-eye"></i>
Ejemplo n.º 24
0
 public function leave_details()
 {
     $where = array('is_deleted' => 0, 'id !=' => 1);
     $this->data['leave_types'] = $this->leave_model->order_by('order')->getWhere($where, IMS_DB_PREFIX . 'leave_types');
     if (_is('Master Admin')) {
         $staffs = $this->leave_model->getStaff(0, 0, $this->current_user->id);
     } else {
         if (_is('Centre Admin')) {
             $staffs = $this->leave_model->getStaff($this->current_user->centre_id, 0, $this->current_user->id);
         } else {
             if (_is('Supervisor')) {
                 $staffs = $this->leave_model->getStaff($this->current_user->centre_id, $this->current_user->id);
             } else {
                 $staffs = array();
                 $staffs[] = $this->current_user;
             }
         }
     }
     $this->data['staffs'] = $staffs;
     $this->data['selected_staff_id'] = $selected_staff_id = $this->input->get('selected_staff') ? $this->input->get('selected_staff') : (!empty($staffs) ? current($staffs)->id : 0);
     $work_profile = $this->leave_model->select('*')->getOneWhere(array('user_id' => $selected_staff_id), IMS_DB_PREFIX . 'work_profile');
     $this->data['awh'] = @$work_profile->average_working_hours ? $work_profile->average_working_hours : 9;
     $this->data['years'] = array();
     $default_year = 0;
     foreach ($this->data['year_terms'] as $year_term) {
         $this->data['years'][$year_term->year] = $year_term->year;
         if ($year_term->default == '1') {
             $default_year = $year_term->year;
         }
     }
     $this->data['selected_year'] = $selected_year = $this->input->get('selected_year') ? $this->input->get('selected_year') : $default_year;
     $this->data['entitled_leaves'] = $this->leave_model->getEntitledLeave($selected_staff_id, $selected_year);
     $this->data['off_leaves'] = $this->leave_model->getWhere(array('user_id' => $selected_staff_id, 'year' => $selected_year), IMS_DB_PREFIX . 'off_leave');
     $this->data['leaves'] = $this->leave_model->getLeaveRequests($selected_staff_id, $selected_year);
     $my_leave_request = $this->leave_model->get_total_leave_taken($selected_staff_id, $selected_year);
     $my_leave_remaining = $this->leave_model->get_total_leave_accumulated($selected_staff_id, $selected_year);
     $this->data['total_leave_claimed'] = $this->leave_model->getTotalLeaveTaken($selected_staff_id, $selected_year, 1, 'not');
     $this->data['total_leave_off_claimed'] = $this->leave_model->getTotalLeaveTaken($selected_staff_id, $selected_year, 1);
     $this->data['total_leave_accumulated'] = $this->leave_model->getTotalLeaveAccumulated($selected_staff_id, $selected_year, 1, 'not');
     $this->data['total_leave_off_accumulated'] = $this->leave_model->getTotalLeaveAccumulated($selected_staff_id, $selected_year, 1);
     $this->data['staff_leave_types'] = $this->leave_model->getLeaveTypeOfStaff($selected_staff_id, $selected_year);
     $total_leave_claimed = $this->data['total_leave_claimed'] + $this->data['total_leave_off_claimed'];
     $total_leave_accumulated = $this->data['total_leave_accumulated'] + $this->data['total_leave_off_accumulated'];
     $this->data['leave_left'] = $total_leave_accumulated - $total_leave_claimed < 0 ? 0 : $total_leave_accumulated - $total_leave_claimed;
     $this->breadcrumb->append_crumb(lang('leave_details'), site_url('leave/details'));
     if ($this->input->is_ajax_request()) {
         $this->load->view('leave_details', $this->data);
     } else {
         $this->ims_template->build('parent_account/blank', $this->data);
     }
 }
Ejemplo n.º 25
0
    echo lang('payment_services');
    ?>
</a></li>

                                <li <?php 
    echo $this->uri->segment(3) != 'country' ? '' : 'class="selection_side"';
    ?>
><a href="<?php 
    echo site_url('variables/index/country');
    ?>
"><?php 
    echo lang('country');
    ?>
</a></li>
                                <?php 
    if (_is('Subject Coordinator')) {
        ?>
                                    <li <?php 
        echo $current_controller == 'tag' ? 'class="selection_side"' : '';
        ?>
><a href="<?php 
        echo site_url('tag');
        ?>
">Tag</a></li>
                                    <li <?php 
        echo $current_controller == 'tag_item' ? 'class="selection_side"' : '';
        ?>
><a href="<?php 
        echo site_url('tag_item');
        ?>
">Tag Item</a></li>
Ejemplo n.º 26
0
 function change_subject()
 {
     $level_id = $this->input->post('level_id');
     $centre_id = !$this->input->post('center_id') ? $this->current_centre_role->centre_id : $this->input->post('center_id');
     if (_is('Subject Coordinator')) {
         $subjects = $this->subject_model->getSCSubjects($this->current_user->id, $this->selected_year_term_id, $centre_id);
     } else {
         if (_is('Teacher')) {
             $subjects = $this->subject_model->getTeacherSubjects($this->current_user->id, $this->selected_year_term_id, $centre_id, $level_id);
         } else {
             if (_is('Master Admin') and MASTER_FREE) {
                 $subjects = $this->subject_model->getCenterSubjects(NULL);
             } else {
                 $subjects = $this->subject_model->getCenterSubjects($centre_id);
             }
         }
     }
     die(json_encode(array('status' => 'True', 'subjects' => $subjects)));
 }
Ejemplo n.º 27
0
 public function index()
 {
     if ($this->input->is_ajax_request()) {
         $year_term = year_term($this->selected_year_term_id);
         if (_is('Teacher')) {
             $all_levels = $this->levels_model->getTeacherLevels($this->current_user->id, $this->selected_year_term_id, $this->current_centre_role->centre_id);
         } else {
             if (_is('Level Coordinator')) {
                 $all_levels = $levels = $this->levels_model->getLCLevel($this->current_user->id, $this->selected_year_term_id);
             } else {
                 $all_levels = $this->Sow_model->order_by('sequence')->getWhere(array('archive' => 0), IMS_DB_PREFIX . 'level');
             }
         }
         $this->data['return'] = false;
         $returned = $this->session->userdata('return');
         if (!empty($returned)) {
             $this->data['return'] = true;
             $this->data['open_sow_id'] = $this->session->userdata('sow_id');
             $data = $this->session->userdata('restore');
         }
         $classdd = $this->input->post('class_dropdown');
         if ($classdd) {
             $this->data['level_id'] = $level_id = $classdd;
         } else {
             if ($all_levels and isset($all_levels[0])) {
                 $this->data['level_id'] = $level_id = $all_levels[0]->id;
             } else {
                 $this->data['level_id'] = $level_id = 0;
             }
         }
         //            Class dropdrow persist
         if (!empty($classdd)) {
             $this->session->set_userdata('class_dropdown', $classdd);
         } else {
             $this->data['level_id'] = $level_id = $this->session->userdata('class_dropdown');
         }
         if (!empty($returned)) {
             $this->data['level_id'] = $level_id = $data['class_dropdown'];
         }
         if (_is('Subject Coordinator')) {
             $curent_centre_subjects = $this->subject_model->getSCSubjects($this->current_user->id, $this->selected_year_term_id, $this->current_centre_role->centre_id);
         } else {
             if (_is('Teacher')) {
                 $curent_centre_subjects = $this->subject_model->getTeacherSubjects($this->current_user->id, $this->selected_year_term_id, $this->current_centre_role->centre_id, $level_id);
             } else {
                 if (_is('Master Admin') and MASTER_FREE) {
                     $curent_centre_subjects = $this->subject_model->getCenterSubjects(NULL);
                 } else {
                     $curent_centre_subjects = $this->subject_model->getCenterSubjects($this->current_centre_role->centre_id);
                 }
             }
         }
         $subjectdd = $this->input->post('subjects_dropdown');
         if ($subjectdd) {
             $this->data['subject_id'] = $subject_id = $subjectdd;
         } else {
             if ($curent_centre_subjects and isset($curent_centre_subjects[0])) {
                 $this->data['subject_id'] = $subject_id = $curent_centre_subjects[0]->id;
             } else {
                 $this->data['subject_id'] = $subject_id = 0;
             }
         }
         if (!empty($subjectdd)) {
             $this->session->set_userdata('subjects_dropdown', $subjectdd);
         } else {
             $this->data['subject_id'] = $subject_id = $this->session->userdata('subjects_dropdown');
         }
         if (!empty($returned)) {
             $this->data['subject_id'] = $subject_id = $data['subjects_dropdown'];
         }
         $this->session->unset_userdata('return');
         $restore_data = array('class_dropdown' => $this->input->post('class_dropdown'), 'subjects_dropdown' => $this->input->post('subjects_dropdown'));
         $this->session->set_userdata('sow', true);
         $this->session->set_userdata('restore', $restore_data);
         $themes = $this->subject_model->get_all_themes($subject_id);
         $areas = $this->subject_model->get_all_areas($subject_id);
         $periods = $this->Sow_model->getPeriods($year_term['year'], $year_term['term'], $subject_id, $level_id);
         $sows = ($subject_id and $level_id) ? $this->Sow_model->getSows($subject_id, $level_id, $this->selected_year_term_id) : array();
         $no_assessment = array();
         $no_slo = array();
         if (!empty($sows)) {
             foreach ($sows as $sow) {
                 if ($sow->assessment_id == 0) {
                     $msows = $this->Sow_model->select('sow_id')->getWhere(array('msow_id' => $sow->id), IMS_DB_PREFIX . 'msow_sow_relation');
                     if ($msows) {
                         foreach ($msows as $msow) {
                             $sow_id[] = $msow->sow_id;
                         }
                         $msow_assessments = $this->Sow_model->getSowsofMsow($sow_id);
                     } else {
                         $no_assessment[$sow->year_term_interval_id] = 1;
                     }
                 }
                 $str = $sow->slo_id;
                 $slo_ids_array = @unserialize($str);
                 if ($slo_ids_array !== false) {
                     if (!empty($slo_ids_array) && count($slo_ids_array) > 0 && !empty($slo_ids_array[0])) {
                         $sow->is_slo = 1;
                     } else {
                         $no_slo[$sow->year_term_interval_id] = 1;
                     }
                 }
                 $groupedsow[$sow->year_term_interval_id][] = $sow;
             }
         } else {
             $groupedsow = array();
         }
         $this->data['no_slo'] = $no_slo;
         $this->data['no_assessment'] = $no_assessment;
         $slos = $this->Sow_model->getAllAssocSlo($this->selected_year_term_id, $level_id, $subject_id);
         $tasks = $this->Sow_model->select('id,task,task_caption')->getWhere(array('level_id' => $level_id, 'subject_id' => $subject_id), IMS_DB_PREFIX . 'task');
         $assesment_rubrics = $this->Sow_model->getAssesRubric($subject_id, $level_id, $this->selected_year_term_id);
         $new_periods_with_sows = array();
         $new_assessment = array();
         foreach ($assesment_rubrics as $assesment_rubric) {
             if (empty($assesment_rubric->rubric_id)) {
                 continue;
             }
             $new_assessment[$assesment_rubric->asses_id][] = $assesment_rubric;
         }
         foreach ($new_assessment as $key => $value) {
             if (count($value) < 2) {
                 unset($new_assessment[$key]);
             }
         }
         $this->data['areas'] = $areas;
         $this->data['themes'] = $themes;
         $this->data['tags'] = $this->tag_model->getTag();
         $this->data['assessment_rubrics'] = $new_assessment;
         $this->data['AssocSlos'] = $slos;
         $this->data['tasks'] = $tasks;
         $this->data['periods'] = ($subject_id and $level_id) ? $periods : array();
         $this->data['sows'] = $groupedsow;
         $this->data['year'] = $year_term['year'];
         $this->data['term'] = $year_term['term'];
         $this->data['all_levels'] = $all_levels;
         $this->data['current_centre_subjects'] = $curent_centre_subjects;
         $this->data['mode'] = 'add';
         // debug_continue($this->session->all_userdata());
         $this->load->view('view_sow', $this->data);
     } else {
         $this->ims_template->build('parent_account/blank', $this->data);
     }
 }
Ejemplo n.º 28
0
                        data : {
                            type : 'monthly',
                            centre_id :centre_id
                        },
                        type : 'post',
                        dataType : 'HTML',
                        async: false,
                        success : function(data){
                            $("#"+centre_id).html(data);
                        }
            });
    });


<?php 
if (_is('Master Admin')) {
    foreach ($final_arrays as $key => $value) {
        if (!empty($value)) {
            $div_id = 'gchart_active_students' . $key;
            ?>
              drawChart( <?php 
            echo json_encode($value);
            ?>
, ' ', '', 'No. of Child Attended', 'line', '<?php 
            echo $div_id;
            ?>
');
  <?php 
        }
    }
}
Ejemplo n.º 29
0
 function _else_part_for_monthly($all_classes, $active_students_by_centre)
 {
     $interval = 2592000;
     $start_time = strtotime('-12 months');
     $end_time = strtotime(date('Y-m-d'));
     $interval_start = $start_time;
     if (_is('Teacher')) {
         for ($i = $start_time + $interval; $i <= $end_time; $i += $interval) {
             $interval_end = $i;
             $interval_index = date('M j', $interval_start) . '-' . date('M j', $interval_end);
             foreach ($all_classes as $class) {
                 $new[$interval_index][$class->class_id] = 0;
             }
             $interval_start = $i;
         }
     } else {
         for ($i = $start_time + $interval; $i <= $end_time; $i += $interval) {
             $interval_end = $i;
             $interval_index = date('M j', $interval_start) . '-' . date('M j', $interval_end);
             foreach ($all_classes as $class) {
                 $new[$interval_index][$class->id] = 0;
             }
             $interval_start = $i;
         }
     }
     foreach ($new as $key => $value) {
         $final_array[$key] = array($key);
         foreach ($value as $key2 => $value) {
             $final_array[$key][] = $value;
         }
     }
     foreach ($final_array as $key => $value) {
         $final[] = $value;
     }
     return $final;
 }
Ejemplo n.º 30
0
 private function _validate_user_update($id)
 {
     //        $this->form_validation->set_rules('image_hash', 'image hash', 'image_hash');
     //        $this->form_validation->set_rules('avatar', 'First Name', 'trim');
     $this->form_validation->set_rules('password', 'Password', 'trim|min_length[4]');
     $this->form_validation->set_rules('confirm_password', 'Confirm Password', 'trim|matches[password]');
     if (!_is('Centre Admin') && !_is('Supervisor')) {
         $this->form_validation->set_rules('first_name', 'First Name', 'trim|required');
         $this->form_validation->set_rules('last_name', 'Last Name', 'trim|required');
         $this->form_validation->set_rules('username', 'Username', 'trim|required|alpha_numeric|min_length[4]|unique[' . IMS_DB_PREFIX . 'user.username.id.' . $id . ']');
         $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email|unique[' . IMS_DB_PREFIX . 'user.email.id.' . $id . ']');
     }
     $this->form_validation->set_rules('contact_number', 'Number', 'trim|required|exact_length[8]');
     $this->form_validation->set_rules('centre', 'Centre', 'trim|required');
     return $this->form_validation->run() == TRUE;
 }