Example #1
0
 public function index()
 {
     if ($this->input->is_ajax_request()) {
         $year_term = year_term($this->selected_year_term_id);
         if (_is('Teacher')) {
             $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')) {
                 $levels = $this->levels_model->getLCLevel($this->current_user->id, $this->selected_year_term_id);
             } else {
                 $levels = $this->Slo_model->order_by('sequence', 'asc')->getWhere(array('archive' => 0), IMS_DB_PREFIX . 'level');
             }
         }
         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);
             } 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;
         }
         if (isset($levels[0])) {
             $level_id = $levels[0]->id;
             $selected_level_slo = $this->Slo_model->getSloFromLevel($level_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();
             }
             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['year'] = $year_term['year'];
         $this->data['term'] = $year_term['term'];
         $this->data['levels'] = $levels;
         $this->data['current_centre_subjects'] = $curent_centre_subjects;
         $this->load->view('view_slo', $this->data);
     } else {
         $this->ims_template->build('parent_account/blank', $this->data);
     }
 }
Example #2
0
 public function period_check($str)
 {
     $year_term = year_term($this->selected_year_term_id);
     $subject_id = $this->input->post('subject_id');
     $level_id = $this->input->post('level_id');
     $data = $this->Sow_model->checkPeriodAvalibility($str, $year_term['year'], $year_term['term'], $subject_id, $level_id);
     if (count($data) > 0) {
         $this->form_validation->set_message('period_check', 'This Period already Exists!');
         return false;
     } else {
         return true;
     }
 }
 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();
 }
 public function index($offset = 0)
 {
     if (!_can('Curriculum Planning') and !_can('Curriculum View')) {
         $this->_set_flashdata(lang('assessment_permission_denied'), 'error');
         redirect(site_url('dashboard'));
     } else {
         if (!_can('Curriculum Planning') and !in_array($this->data['current_controller_method'], array('index'))) {
             $this->_set_flashdata(lang('assessment_permission_denied'), 'error');
             redirect(site_url('dashboard'));
         }
     }
     if ($this->input->is_ajax_request()) {
         $_year_term = $this->selected_year_term_id;
         $this->data['_year_term'] = $_year_term;
         $this->data['selected_assessment_year_term'] = year_term($_year_term);
         $levels = $this->levels_model->getLevels();
         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);
                 }
             }
         }
         /* echo  $this->db->last_query(); 
             print_r(  $this->data['subjects'] );
            */
         $selected_subject = $this->input->post('subjects_dropdown');
         if (empty($selected_subject)) {
             $selected_subject = $this->session->userdata('selected_subject');
         } else {
             $this->session->set_userdata('selected_subject', $selected_subject);
         }
         if ($selected_subject) {
             $this->data['subject_id'] = $subject_id = $selected_subject;
         } else {
             if ($this->data['subjects'] and isset($this->data['subjects'][0])) {
                 $this->data['subject_id'] = $subject_id = $this->data['subjects'][0]->id;
             } else {
                 $this->data['subject_id'] = $subject_id = 0;
             }
         }
         $this->data['selected_subject'] = $this->subject_model->getSubjectById($subject_id);
         //            debug($this->data['subject']->subject_name);
         $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');
         $assessment_category = $this->input->post('assess_categories_dropdown');
         if (!empty($assessment_category)) {
             $this->session->set_userdata('assess_category', $assessment_category);
         } else {
             if ($this->session->userdata('assess_category')) {
                 $assessment_category = $this->session->userdata('assess_category');
             } else {
                 $assessment_category = -1;
             }
         }
         if ($assessment_category != -1) {
             if ($assessment_category) {
                 $this->data['assessment_category_id'] = $assessment_category_id = $assessment_category;
             } else {
                 if ($this->data['assessment_categories'] and isset($this->data['assessment_categories'][0])) {
                     $this->data['assessment_category_id'] = $assessment_category_id = -2;
                 } else {
                     $this->data['assessment_category_id'] = $assessment_category_id = 0;
                 }
             }
         } else {
             $this->data['assessment_category_id'] = $assessment_category_id = -1;
         }
         $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 level data
         $consolidate_assessments = $this->data['assessments'];
         $consolidate_assessment_levels = $this->data['assessments_levels'];
         $consolidate_assessment_rubric = $this->data['assessments_rubrics'];
         $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'];
         // data end
         $this->load->view('view_assessment', $this->data);
     } else {
         $this->session->unset_userdata('selected_subject');
         $this->ims_template->build('parent_account/blank', $this->data);
     }
 }
            ?>
</option>
                                    <?php 
        }
        ?>
                                    <?php 
    }
    ?>
                            </select>
                        </div>
                    </div>
                    <table class="da-table dataTable" id="da-ex-datatable-numberpaging" aria-describedby="da-ex-datatable-numberpaging_info">
                        <tr>
                            <td style="padding: 10px;font-size: 14px;">
                                <strong>Year-Term</strong> : <?php 
    echo implode(' - ', year_term($this->selected_year_term_id));
    ?>
<br />
                                <strong>Subject</strong> &nbsp;&nbsp;&nbsp;: 
                                <?php 
    echo $selected_subject->subject_name . " (" . $selected_subject->short_name . ")";
    ?>
                            </td>
                        </tr>
                        <?php 
    foreach ($printable as $lc => $print) {
        ?>

                            <tr>
                                <td style="padding: 0px;" class="rubrics">
                                    <div class="level_class_box">
Example #6
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);
     }
 }
 public function getCurrentYearTerm()
 {
     return year_term($this->db->select('max(id) as current_year_term_id')->from(IMS_DB_PREFIX . 'year_term')->get()->row()->current_year_term_id);
 }
Example #8
0
 function add_edit_teacher_class()
 {
     $this->load->model('teacher_class_model');
     $year_term = year_term($this->selected_year_term_id);
     if ($this->input->post()) {
         $subject_classes = $this->input->post('class_subject');
         $teacher_id = $this->input->post('teacher_id');
         $centre_id = $this->input->post('centre_id');
         $class_id = $this->input->post('class_id');
         $this->teacher_class_model->deleteClassReln($teacher_id, $year_term['year'], $year_term['term'], $centre_id);
         if (!empty($subject_classes)) {
             foreach ($subject_classes as $class => $subjects) {
                 foreach ($subjects as $subject => $param) {
                     $tosubmit[] = array('class_id' => $class, 'subject_id' => $subject, 'teacher_id' => $teacher_id, 'year' => $year_term['year'], 'term' => $year_term['term']);
                 }
             }
             $this->db->insert_batch(IMS_DB_PREFIX . 'teacher_class', $tosubmit);
         }
         $this->teacher_class_model->deleteFormClassReln($teacher_id, $year_term['year'], $year_term['term'], $centre_id);
         if (!empty($class_id)) {
             foreach ($class_id as $k => $v) {
                 $tosubmit_attendance_per[] = array('teacher_id' => $teacher_id, 'class_id' => $v, 'centre_id' => $centre_id, 'year' => $year_term['year'], 'term' => $year_term['term']);
             }
             $this->db->insert_batch(IMS_DB_PREFIX . 'form_teacher', $tosubmit_attendance_per);
         }
         echo json_encode(array('status' => 'true'));
     }
 }
 public function __construct()
 {
     parent::__construct();
     $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->language = "english";
         $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->load->library('syraz_auth', IMS_DB_PREFIX . 'parent');
     /**-------------------------------------------
      *          set login mode to parent.         |
      **-------------------------------------------
      *
      * Use login 'system' to set it to system login.
      * By default it will use 'system' login
      *
      */
     $this->syraz_auth->set_login_mode('parent');
     /*
      * while loggin in with social api CI Session data disappearing on new request
      * (@session not persisting), So used native session to check login status on parent account whether there is a login.
      *
      */
     session_start();
     if (isset($_SESSION['user_id']) && $_SESSION['user_id']) {
         $this->session->set_userdata(array('parent_user_id' => $_SESSION['user_id'], 'login_hash_parent' => md5(IMS_DB_PREFIX . 'parent')));
         $this->syraz_auth->set_session($_SESSION['user_id']);
         unset($_SESSION['user_id']);
     }
     if (!$this->syraz_auth->logged_in()) {
         if ($this->input->is_ajax_request()) {
             echo "<script type='text/javascript'>\$(function(){window.location='" . site_url('home') . "';});</script>";
             exit;
         } else {
             redirect(site_url('home'));
         }
     }
     $this->load->model(array('admin_common_model', 'parent_account/parent_account_model', 'api/api_model'));
     // $this->output->enable_profiler(TRUE);
     $this->data['current_parent'] = $this->current_parent = $this->parent_account_model->getFromId($this->syraz_auth->parent_user_id());
     $this->data['childrens'] = $this->parent_account_model->getChildList($this->current_parent->id);
     if (!$this->session->userdata('selected_child_id')) {
         $this->session->set_userdata('selected_child_id', !empty($this->data['childrens']) ? $this->data['childrens'][0]->id : 0);
     }
     $child_ids = pluck($this->data['childrens'], 'id');
     $this->data['selected_child_id'] = $this->selected_child_id = $this->session->userdata('selected_child_id');
     if ($this->input->get('child') and in_array($this->input->get('child'), $child_ids)) {
         $this->data['selected_child_id'] = $this->selected_child_id = $this->input->get('child');
         $this->session->set_userdata('selected_child_id', $this->selected_child_id);
     }
     $this->data['subscriber_details'] = $this->parent_account_model->getParentById($this->session->userdata('parent_user_id'));
     //        debug($this->data['subscriber_details']);
     $year_terms = $this->parent_account_model->getChildYearTerms($this->data['selected_child_id']);
     $this->data['year_terms'] = array();
     $default_year_term = $default_year_term_for_parents_curriculum = $default_year_term_for_parents_progress_report = 0;
     foreach ($year_terms as $year_term) {
         $this->data['year_terms'][$year_term->year][] = $year_term;
         if ($year_term->default == '1') {
             $default_year_term = $year_term->id;
         }
         if ($year_term->default_year_term_for_parents_curriculum == '1') {
             $default_year_term_for_parents_curriculum = $year_term->id;
         }
         if ($year_term->default_year_term_for_parents_progress_report == '1') {
             $default_year_term_for_parents_progress_report = $year_term->id;
         }
     }
     $this->default_yearterm_id = $default_year_term;
     $this->default_year_term_for_parents_curriculum = $default_year_term_for_parents_curriculum;
     $this->default_year_term_for_parents_progress_report = $default_year_term_for_parents_progress_report;
     if (!$this->session->userdata('parent_selected_year_term_id')) {
         $this->session->set_userdata('parent_selected_year_term_id', $default_year_term == 0 ? isset($year_terms[0]) ? $year_terms[0]->id : 0 : $default_year_term);
     }
     if (!$this->session->userdata('selected_year_term_id_for_progress_report')) {
         $this->session->set_userdata('selected_year_term_id_for_progress_report', $default_year_term_for_parents_progress_report == 0 ? isset($year_terms[0]) ? $year_terms[0]->id : 0 : $default_year_term_for_parents_progress_report);
     }
     if (!$this->session->userdata('selected_year_term_id_for_curriculum')) {
         $this->session->set_userdata('selected_year_term_id_for_curriculum', $default_year_term_for_parents_curriculum == 0 ? isset($year_terms[0]) ? $year_terms[0]->id : 0 : $default_year_term_for_parents_curriculum);
     }
     $this->data['selected_year_term_id'] = $this->selected_year_term_id = $this->session->userdata('parent_selected_year_term_id');
     $this->data['selected_year_term'] = $this->selected_year_term = year_term($this->selected_year_term_id);
     $this->data['selected_year_term_id_for_curriculum'] = $this->selected_year_term_id_for_curriculum = $this->session->userdata('selected_year_term_id_for_curriculum');
     $this->data['selected_year_term_for_curriculum'] = $this->selected_year_term_for_curriculum = year_term($this->selected_year_term_id_for_curriculum);
     $this->data['selected_year_term_id_for_progress_report'] = $this->selected_year_term_id_for_progress_report = $this->session->userdata('selected_year_term_id_for_progress_report');
     $this->data['selected_year_term_for_progress_report'] = $this->selected_year_term_for_progress_report = year_term($this->selected_year_term_id_for_progress_report);
     $segment = $this->uri->segment(2);
     switch ($segment) {
         case 'progress_report':
             $this->data['selected_year_term_id'] = $this->selected_year_term_id = $this->selected_year_term_id_for_progress_report;
             $this->data['selected_year_term'] = $this->selected_year_term = year_term($this->selected_year_term_id_for_progress_report);
             break;
         case 'curriculum':
             $this->data['selected_year_term_id'] = $this->selected_year_term_id = $this->selected_year_term_id_for_curriculum;
             $this->data['selected_year_term'] = $this->selected_year_term = year_term($this->selected_year_term_id_for_curriculum);
             break;
         default:
             $this->data['selected_year_term_id'] = $this->selected_year_term_id = $this->session->userdata('parent_selected_year_term_id');
             $this->data['selected_year_term'] = $this->selected_year_term = year_term($this->selected_year_term_id);
     }
     if ($this->selected_child_id != 0 and $this->selected_year_term_id != 0) {
         $this->data['selected_child'] = $this->parent_account_model->getChildDetails($this->selected_child_id, $this->selected_year_term_id);
         $access = true;
     } else {
         if ($this->selected_child_id != 0) {
             $this->data['selected_child'] = $this->parent_account_model->select('*,child_image as latest_child_image')->getFromId($this->selected_child_id, 'id', IMS_DB_PREFIX . 'child');
         }
     }
     /**
      * Do not show year-term in following controllers
      */
     $hidden_year_term = array('gallery', 'settings', 'parent_account');
     $current_controller = isset($segment) && $segment ? $segment : $this->uri->segment(1);
     $this->data['is_hidden_yt'] = in_array($current_controller, $hidden_year_term);
     if (!isset($access) and ($this->router->fetch_class() != 'parent_account' or !in_array($this->router->fetch_method(), array('settings', 'add_parent_child_relation', 'change_children', 'delete_child_relation', 'change_parent_password', 'change_email_notification_status')))) {
         redirect(site_url('parent_account/settings'));
     }
     $parent_portal_setting = $this->options_model->getOption('parent_portal_setting');
     if (!empty($parent_portal_setting)) {
         $this->data['parent_portal_setting'] = $parent_portal_setting;
     } else {
         $this->data['parent_portal_setting'] = array();
     }
     $this->data['unread_activity_feeds'] = $this->parent_account_model->getUnReadActivitiesFeed($this->current_parent->id);
     $this->ims_template->enable_parser(FALSE)->set_theme('parent')->set_layout('default')->title('Parents\' Portal')->set_partial('head')->set_partial('header')->set_partial('sidebar')->set_partial('footer');
     $this->data['theme_path'] = 'themes/parent/';
     $this->breadcrumb->append_crumb(lang('dashboard'), site_url('parent_account'));
     $this->load->model(array('admin_common_model'));
     $this->progress_report_year_term = $this->admin_common_model->getProgressReportYearTerm();
     $this->curriculum_year_term = $this->admin_common_model->getCurriculumYearTerm();
 }
Example #10
0
 public function index()
 {
     if ($this->input->is_ajax_request()) {
         $this->breadcrumb->append_crumb(lang('view_print_sow'));
         $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');
             }
         }
         if ($this->input->post('class_dropdown')) {
             $this->data['level_id'] = $level_id = $this->input->post('class_dropdown');
         } 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;
             }
         }
         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);
                 }
             }
         }
         $subject_ids = pluck($curent_centre_subjects, 'id');
         if ($this->input->post('subjects_dropdown') and in_array($this->input->post('subjects_dropdown'), $subject_ids)) {
             $this->data['subject_id'] = $subject_id = $this->input->post('subjects_dropdown');
         } 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;
             }
         }
         $themes = $this->subject_Model->get_all_themes($subject_id);
         $areas = $this->subject_Model->get_sub_areas($subject_id);
         $periods = $this->Sow_model->getPeriods($year_term['year'], $year_term['term'], $subject_id, $level_id);
         $sows_list = ($subject_id and $level_id) ? $this->Sow_model->getSows($subject_id, $level_id, $this->selected_year_term_id) : array();
         $sow_ids = array();
         $sows = array();
         foreach ($sows_list as $sow) {
             $sow_ids[] = $sow->id;
             $sows[$sow->id] = $sow;
         }
         $tasks = empty($sow_ids) ? array() : $this->Print_sow_model->getTasksInSows($sow_ids);
         foreach ($tasks as $task) {
             if (isset($sows[$task->sow_id])) {
                 $sows[$task->sow_id]->tasks[] = $task;
             }
         }
         if (!empty($sows)) {
             foreach ($sows as $sow) {
                 $groupedsow[$sow->year_term_interval_id][$sow->id] = $sow;
             }
         } else {
             $groupedsow = array();
         }
         $slos = $this->Sow_model->getAllAssocSlo($this->selected_year_term_id, $level_id, $subject_id);
         $assesment_rubrics = $this->Sow_model->getAssesRubric($subject_id, $level_id, $this->selected_year_term_id);
         $new_periods_with_sows = array();
         foreach ($assesment_rubrics as $assesment_rubric) {
             $new_assessment[$assesment_rubric->asses_id][] = $assesment_rubric;
         }
         if (empty($new_assessment)) {
             $new_assessment = array();
         }
         $this->data['areas'] = $areas;
         $this->data['themes'] = $themes;
         $this->data['assessment_rubrics'] = $new_assessment;
         $this->data['AssocSlos'] = $slos;
         $this->data['periods'] = $periods;
         $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->load->view('view_print_sow', $this->data);
     } else {
         $this->ims_template->build('parent_account/blank', $this->data);
     }
 }
 function student_progress()
 {
     if ($this->module_in_array('progress_report') == FALSE) {
         redirect(site_url('home'));
     } else {
         $this->append_stylesheet('/modules/admin/roadmap/css/arrow.css');
         $this->append_stylesheet('/modules/admin/roadmap/css/roadmap_style.css');
         $this->load->model(array('roadmap/roadmap_model', 'child/child_model', 'subject/subject_model', 'progress_report/progress_report_model', 'assessment/assessment_model'));
         $this->data['student'] = $student = $this->child_model->getChildInfoList2($this->selected_child_id, $this->selected_year_term_id);
         if (!$student) {
             show_error('Student not found or not linked in selected year term.');
         }
         $this->data['subjects'] = $this->subject_model->getWhere(array('is_archive' => 0));
         if ($this->input->post('subjects_dropdown')) {
             $this->data['subject_id'] = $subject_id = $this->input->post('subjects_dropdown');
         } else {
             if ($this->data['subjects'] and isset($this->data['subjects'][0])) {
                 $this->data['subject_id'] = $subject_id = $this->data['subjects'][0]->id;
             } else {
                 $this->data['subject_id'] = $subject_id = 0;
             }
         }
         $year_term = year_term($this->selected_year_term_id);
         $this->data['roadmap'] = $this->roadmap_model->getCurrentRoadmap(array('year' => $year_term['year'], 'term' => $year_term['term'], 'subject_id' => $subject_id));
         $this->data['achieved_rubric'] = array();
         $this->data['achieved_assessment'] = array();
         $progress_report_assessments = $this->progress_report_model->getAllProgressAssessments($this->selected_child_id, $subject_id);
         if ($progress_report_assessments) {
             $rubrics = $this->assessment_model->getRubricAssessment($subject_id);
             $achieved_rubric_index = array();
             foreach ($progress_report_assessments as $progress_report_assessment) {
                 $achieved_rubric_index[$progress_report_assessment->assessment_id] = $progress_report_assessment->rubric_passed;
             }
             $grouped_rubrics = array();
             foreach ($rubrics as $rubric) {
                 $grouped_rubrics[$rubric->assessment_id][] = $rubric;
             }
             foreach ($achieved_rubric_index as $assessment_id => $index) {
                 if (isset($grouped_rubrics[$assessment_id][$index - 1])) {
                     $this->data['achieved_rubric'][] = $grouped_rubrics[$assessment_id][$index - 1]->rubric_id;
                     $this->data['achieved_assessment'][$grouped_rubrics[$assessment_id][$index - 1]->rubric_id][] = $assessment_id;
                 }
             }
         }
         if ($this->input->is_ajax_request()) {
             $this->load->view('student_progress', $this->data);
         } else {
             $this->ims_template->build('parent_account/blank', $this->data);
         }
     }
 }
Example #12
0
 function migrate_teacher_class_data()
 {
     if ($this->_validate_migration_year_term()) {
         ini_set('memory_limit', '1024M');
         ini_set('max_execution_time', '1800');
         $this->Year_term_model->delete_teacher_class_data($this->input->post('to'));
         $source_year_term = year_term($this->input->post('from'));
         $target_year_term = year_term($this->input->post('to'));
         $this->_duplicate_record(IMS_DB_PREFIX . 'teacher_class', $source_year_term, $target_year_term);
         $this->_duplicate_record(IMS_DB_PREFIX . 'form_teacher', $source_year_term, $target_year_term);
         echo json_encode(array('status' => 'true', 'msg' => 'Teacher class relationships migration completed successfully'));
     } else {
         echo json_encode(array('status' => 'validation_error', 'error' => array('from' => form_error('from'), 'to' => form_error('to'))));
     }
 }
 public function student_progress($student_id = 0)
 {
     $this->load->model(array('roadmap/roadmap_model', 'child/child_model'));
     $this->data['student'] = $student = $this->child_model->getChildInfoList2($student_id, $this->selected_year_term_id);
     if (!$student) {
         show_error('Student not found or not linked in selected year term.');
     }
     if (_is('Teacher')) {
         $this->data['subjects'] = $this->subject_model->getTeacherSubjects($this->current_user->id, $this->selected_year_term_id, $this->current_centre_role->centre_id, 0, $student->current_class_id);
     } else {
         if (_is('Subject Coordinator')) {
             $this->data['subjects'] = $this->subject_model->getSCSubjects($this->current_user->id, $this->selected_year_term_id, $this->current_centre_role->centre_id);
         } else {
             if (_is('Master Admin') and MASTER_FREE) {
                 $this->data['subjects'] = $this->subject_model->getCenterSubjects();
             } else {
                 $this->data['subjects'] = $this->subject_model->getCenterSubjects($this->current_centre_role->centre_id);
             }
         }
     }
     if ($this->input->post('subjects_dropdown')) {
         $this->data['subject_id'] = $subject_id = $this->input->post('subjects_dropdown');
     } else {
         if ($this->data['subjects'] and isset($this->data['subjects'][0])) {
             $this->data['subject_id'] = $subject_id = $this->data['subjects'][0]->id;
         } else {
             $this->data['subject_id'] = $subject_id = 0;
         }
     }
     $year_term = year_term($this->selected_year_term_id);
     $this->data['roadmap'] = $this->roadmap_model->getCurrentRoadmap(array('year' => $year_term['year'], 'term' => $year_term['term'], 'subject_id' => $subject_id));
     // For achieced rubric list
     $this->data['achieved_rubric'] = array();
     $this->data['achieved_assessment'] = array();
     $progress_report_assessments = $this->progress_report_model->getAllProgressAssessments($student_id, $subject_id);
     if ($progress_report_assessments) {
         $rubrics = $this->assessment_model->getRubricAssessment($subject_id);
         $achieved_rubric_index = array();
         foreach ($progress_report_assessments as $progress_report_assessment) {
             $achieved_rubric_index[$progress_report_assessment->assessment_id] = $progress_report_assessment->rubric_passed;
         }
         $grouped_rubrics = array();
         foreach ($rubrics as $rubric) {
             $grouped_rubrics[$rubric->assessment_id][] = $rubric;
         }
         foreach ($achieved_rubric_index as $assessment_id => $index) {
             if (isset($grouped_rubrics[$assessment_id][$index - 1])) {
                 $this->data['achieved_rubric'][] = $grouped_rubrics[$assessment_id][$index - 1]->rubric_id;
                 $this->data['achieved_assessment'][$grouped_rubrics[$assessment_id][$index - 1]->rubric_id][] = $assessment_id;
             }
         }
     }
     if ($this->input->is_ajax_request()) {
         $this->load->view('student_progress', $this->data);
     } else {
         $this->ims_template->build('parent_account/blank', $this->data);
     }
 }
Example #14
0
 function album_type($id)
 {
     $this->load->model('year_term/year_term_model');
     $year_term = year_term($this->selected_year_term_id);
     $year_term_selected = $year_term['year'] . $year_term['term'];
     $this->breadcrumb->append_crumb(lang('manage'));
     $this->data['album'] = $this->album_model->getAlbumDetail($id);
     if (!$this->data['album']) {
         show_error(lang('album_not_found'));
     }
     // debug($this->data['album']);
     if ($this->input->post('submit_album') and $this->data['album']->status == NEW_ALBUM) {
         //for subitting new albums by teacher
         $this->album_model->updateWhere(array('id' => $this->data['album']->id), array('status' => NOT_PUBLISH_YET), IMS_DB_PREFIX . 'album');
         redirect(site_url('album'));
     }
     if ($this->input->post('reject_album') and $this->data['album']->status == NOT_PUBLISH_YET) {
         // for rejecting albums by supervisor/centre admin
         $this->album_model->updateWhere(array('id' => $this->data['album']->id), array('status' => NEW_ALBUM), IMS_DB_PREFIX . 'album');
         redirect(site_url('album'));
     }
     $album_yearm_term = $this->data['album']->year . $this->data['album']->term;
     if ($year_term_selected != $album_yearm_term) {
         redirect(site_url('album'));
     }
     if ($this->data['album']->type == 'event') {
         $all_students = $this->album_model->getEventUsers($this->data['album']->event_id);
         $event_detail = $this->album_model->getOneWhere(array('id' => $this->data['album']->event_id), IMS_DB_PREFIX . 'events');
         $this->data['event_detail'] = $event_detail;
     } else {
         $all_students = $this->album_model->getAllChilds($this->data['album']->level_class, $album_yearm_term);
         $class_level_name = $this->album_model->getClassLevel($this->data['album']->level_class);
         $level_id = isset($class_level_name->level_id) ? $class_level_name->level_id : '';
         $this->load->model('sow/sow_model');
         $sows = $this->album_model->getSowsWithLevelAndSubject($level_id, $this->data['album']->subject_id, $album_yearm_term);
         if (!empty($sows)) {
             foreach ($sows as &$temp_sow) {
                 $temp = $this->album_model->getSowTasks($temp_sow->id);
                 $tasks[] = $temp;
                 $temp_sow->selected_tasks = $temp;
                 $temp_sow->tag = @unserialize($temp_sow->tag) ? $this->album_model->where_in('id', unserialize($temp_sow->tag))->getAll(IMS_DB_PREFIX . 'tag') : $this->album_model->getWhere(array('id' => $temp_sow->tag), IMS_DB_PREFIX . 'tag');
                 $temp_sow->tag = implode(', ', pluck($temp_sow->tag, 'name'));
             }
             $this->data['tasks'] = $tasks;
         }
         // debug_continue($sows);
         $current_sows = $this->album_model->getCurrentSows($this->data['album']->id, $album_yearm_term);
         $this->data['primary_sow'] = $this->album_model->getPrimarySow($this->data['album']->primary_sow, $album_yearm_term);
         // debug_continue($this->data['primary_sow']);
         $currenttasks = array();
         if (!empty($this->data['primary_sow'])) {
             // $currenttasks[] = $this->album_model->getSowTasks($this->data['primary_sow']->id);
             $this->data['primary_sow']->selected_tasks = $this->album_model->getSowTasks($this->data['primary_sow']->id);
         }
         // debug_continue($this->data['primary_sow']);
         $this->data['current_sows'] = $current_sows;
         $current_sows_ids = array();
         foreach ($current_sows as $current_sow) {
             $current_sows_ids[] = $current_sow->id;
         }
         $this->data['current_sows_ids'] = $current_sows_ids;
         $this->data['level_class_name'] = $class_level_name;
         $this->data['sows'] = $sows;
         if (!empty($current_sows)) {
             foreach ($this->data['current_sows'] as &$sow) {
                 // $currenttasks[] = $this->album_model->getSowTasks($sow->id);
                 $sow->selected_tasks = $this->album_model->getSowTasks($sow->id);
             }
             // debug_continue($this->data['current_sows']);
             // $this->data['currenttasks'] = $currenttasks;
         }
     }
     $items = $this->album_model->getItems($this->data['album']->id);
     $students = $this->album_model->getAssocChilds($this->data['album']->id, $this->data['album']->level_class);
     $new_student_array = array();
     foreach ($students as $student) {
         $new_student_array[$student->album_item_id][] = $student;
     }
     if ($this->input->post('item_id')) {
         if (isset($new_student_array[$this->input->post('item_id')]) && count($new_student_array[$this->input->post('item_id')] > 0)) {
             $new_item_assoc_child_ids = array();
             foreach ($new_student_array[$this->input->post('item_id')] as $item_assoc_child) {
                 $new_item_assoc_child_ids[] = $item_assoc_child->child_id;
             }
             $new_all_childs_ids = array();
             foreach ($all_students as $all_student) {
                 $new_all_childs_ids[] = $all_student->child_id;
             }
             $remaining_childs_ids = array_diff($new_all_childs_ids, $new_item_assoc_child_ids);
             $remaining_childs = !empty($remaining_childs_ids) ? $this->album_model->getAllRemainingChilds($remaining_childs_ids) : array();
             echo json_encode(array('remaining_childs' => $remaining_childs));
             exit;
         } else {
             echo json_encode(array('remaining_childs' => $all_students));
             exit;
         }
     }
     $this->data['items'] = $items;
     $this->data['all_students'] = $all_students;
     $count_students = $this->album_model->getChildsCount($this->data['album']->id);
     $new_counted_student = array();
     foreach ($count_students as $count_student) {
         $new_counted_student[$count_student->student_id] = $count_student->count;
     }
     $this->data['students_count'] = $new_counted_student;
     $this->data['students'] = $new_student_array;
     // if ($this->input->is_ajax_request()) {
     //     $this->load->view('album_detail', $this->data);
     // } else {
     //     $this->ims_template->build('parent_account/blank', $this->data);
     // }
     if ($this->input->is_ajax_request()) {
         if (_is('Teacher') and $this->data['album']->status == NEW_ALBUM or !_is('Teacher') and $this->data['album']->status != PUBLISHED) {
             $this->load->view('album_detail', $this->data);
         } else {
             $this->load->view('view_album_detail', $this->data);
         }
     } else {
         if (_is('Teacher') and $this->data['album']->status == NEW_ALBUM or !_is('Teacher') and $this->data['album']->status != PUBLISHED) {
             $this->ims_template->build('album_detail', $this->data);
         } else {
             $this->ims_template->build('view_album_detail', $this->data);
         }
     }
 }