/** * index action */ public function index() { $this->load->model('entities/easol/Easol_Report'); $this->load->model('entities/easol/Easol_DashboardConfiguration'); $report = new Easol_Report(); if ($this->input->post('dashboardConf')) { //print_r($this->input->post('dashboardConf')); foreach ($this->input->post('dashboardConf') as $roleId => $conf) { $dashConf = (new Easol_DashboardConfiguration())->findOne(['RoleTypeId' => $roleId, 'EducationOrganizationId' => Easol_Authentication::userdata('SchoolId')]); if ($dashConf == null) { $dashConf = new Easol_DashboardConfiguration(); $dashConf->RoleTypeId = $roleId; $dashConf->EducationOrganizationId = Easol_Authentication::userdata('SchoolId'); } else { $dashConf = (new Easol_DashboardConfiguration())->hydrate($dashConf); } $dashConf->LeftChartReportId = $conf['left']; $dashConf->RightChartReportId = $conf['right']; $dashConf->BottomTableReportId = $conf['bottom']; $dashConf->save(); } $this->session->set_flashdata('message_dash_conf', 'Dashboard Configuration Saved'); return redirect(site_url("reports/index#dashConf")); } $this->render("index", ['reports' => $report->hydrate($report->findAll()->result())]); }
/** * index action * @param int $id */ public function index($id = 1) { $currentYear = Easol_SchoolConfiguration::getValue('CURRENT_SCHOOLYEAR'); $currentYear_default = Easol_SchoolConfiguration::setDefault('Year', $currentYear); $query = "SELECT Student.StudentUSI, Student.FirstName, Student.LastSurname, GradeLevelType.Description, StudentCohortAssociation.CohortIdentifier from edfi.StudentSchoolAssociation\nINNER JOIN edfi.Student ON\n StudentSchoolAssociation.StudentUSI = Student.StudentUSI\nINNER JOIN edfi.GradeLevelDescriptor ON\n StudentSchoolAssociation.EntryGradeLevelDescriptorId = GradeLevelDescriptor.GradeLevelDescriptorId\nINNER JOIN edfi.GradeLevelType ON\n GradeLevelDescriptor.GradeLevelTypeId = GradeLevelType.GradeLevelTypeId\nLEFT JOIN edfi.StudentCohortAssociation ON\n StudentCohortAssociation.EducationOrganizationId = StudentSchoolAssociation.SchoolId AND StudentCohortAssociation.StudentUSI = StudentSchoolAssociation.StudentUSI\nWHERE\n StudentSchoolAssociation.SchoolId = '" . Easol_Authentication::userdata('SchoolId') . "'\n\n "; $this->render("index", ['query' => $query, 'colOrderBy' => ['GradeLevelType.Description', 'Student.FirstName', 'Student.LastSurname', 'Student.StudentUSI', 'StudentCohortAssociation.CohortIdentifier'], 'filter' => ['dataBind' => true, 'bindIndex' => ['GradeLevel' => ['glue' => 'and'], 'Year' => ['glue' => 'and'], 'Cohort' => ['glue' => 'and']], 'bindSort' => ['Sort'], 'queryWhere' => false, 'fields' => ['Year' => ['range' => ['type' => 'dynamic', 'start' => $currentYear, 'end' => date('Y'), 'increament' => 1], 'searchColumn' => 'SchoolYear', 'searchColumnType' => 'int', 'queryBuilderColumn' => 'StudentSchoolAssociation.SchoolYear', 'default' => $this->input->get('filter[Year]') == null ? $currentYear_default : $this->input->get('filter[Year]'), 'label' => 'Year', 'type' => 'dropdown', 'bindDatabase' => true, 'prompt' => 'All Years'], 'GradeLevel' => ['query' => $this->db->query("SELECT * FROM edfi.GradeLevelType"), 'searchColumn' => 'GradeLevelTypeId', 'textColumn' => 'Description', 'indexColumn' => 'Description', 'queryBuilderColumn' => 'GradeLevelType.Description', 'label' => 'Grade Level', 'type' => 'dropdown', 'bindDatabase' => true, 'prompt' => 'All Grade Levels', 'default' => $this->input->get('filter[GradeLevel]') === false ? "" : $this->input->get('filter[GradeLevel]')], 'Cohort' => ['query' => $this->db->query("SELECT DISTINCT edfi.StudentCohortAssociation.CohortIdentifier FROM edfi.StudentCohortAssociation"), 'searchColumn' => 'CohortTypeId', 'textColumn' => 'CohortIdentifier', 'indexColumn' => 'CohortIdentifier', 'queryBuilderColumn' => 'StudentCohortAssociation.CohortIdentifier', 'label' => 'Cohort', 'type' => 'dropdown', 'bindDatabase' => false, 'prompt' => 'All Cohorts', 'default' => $this->input->get('filter[Cohort]')], 'Result' => ['range' => ['type' => 'set', 'set' => [10, 25, 50, 100, 200, 500]], 'default' => $this->input->get('filter[Result]') === false ? 3 : $this->input->get('filter[Result]'), 'label' => 'Results', 'type' => 'dropdown', 'bindDatabase' => false, 'fieldType' => 'pageSize'], 'Sort' => ['label' => 'Sort Column', 'type' => 'dataSort', 'bindDatabase' => true, 'fieldType' => 'dataSort', 'display' => 'false', 'columns' => ['FirstName' => 'Name', 'GradeLevelType.Description' => 'Grade Level', 'StudentCohortAssociation.CohortIdentifier' => 'Cohort'], 'defaultColumn' => $this->input->get('filter[Sort][column]'), 'sortTypes' => ['ASC' => 'Ascending', 'DESC' => 'Descending'], 'defaultSortType' => !$this->input->get('filter[Sort][type]') ? "ASC" : $this->input->get('filter[Sort][type]'), 'sortTypeLabel' => 'Sort Type']]], 'pagination' => ['pageSize' => EASOL_PAGINATION_PAGE_SIZE, 'currentPage' => $id, 'url' => 'student/index/@pageNo']]); }
/** * @param int $cohortIdentifier * @return null|string */ public function students($cohortIdentifier = 0, $id = 1) { $this->load->model("entities/edfi/Edfi_Cohort", 'Edfi_Cohort'); $cohort = $this->Edfi_Cohort->findOneBySql("select Cohort.CohortIdentifier, Cohort.CohortDescription from edfi.Cohort\nWHERE Cohort.CohortIdentifier = ? and Cohort.EducationOrganizationId = ? ", [$cohortIdentifier, Easol_Authentication::userdata('SchoolId')]); $query = "SELECT Student.FirstName, Student.LastSurname,Student.StudentUSI FROM edfi.StudentCohortAssociation\nINNER JOIN edfi.Student ON Student.StudentUSI = StudentCohortAssociation.StudentUSI\nWHERE StudentCohortAssociation.EducationOrganizationId = " . Easol_Authentication::userdata('SchoolId') . " and StudentCohortAssociation.CohortIdentifier = '" . $cohort->CohortIdentifier . "'\n\n "; //die($query); return $this->render("students", ['cohort' => $cohort, 'query' => $query, 'colOrderBy' => ['Student.FirstName', 'Student.LastSurname'], 'pagination' => ['pageSize' => EASOL_PAGINATION_PAGE_SIZE, 'currentPage' => $id, 'url' => 'cohorts/students/' . $cohort->CohortIdentifier . '/@pageNo']]); }
/** * index action */ public function index($pageNo = 1) { $this->load->model('entities/easol/Easol_DashboardConfiguration'); $dashboardConf = (new Easol_DashboardConfiguration())->findOne(['RoleTypeId' => Easol_Authentication::userdata('RoleId'), 'EducationOrganizationId' => Easol_Authentication::userdata('SchoolId')]); if ($dashboardConf != null) { $dashboardConf = (new Easol_DashboardConfiguration())->hydrate($dashboardConf); } $this->render("index", ['dashboardConf' => $dashboardConf, 'tablePageNo' => $pageNo]); }
/** * returns peice of query string for filtering out users and filter search object * @return array */ public static function userCanFilter() { $data['allowedUser'] = ''; $data['thefilter'] = ['Term' => ['glue' => 'and'], 'Year' => ['glue' => 'and'], 'Course' => ['glue' => 'and'], 'Educator' => ['glue' => 'and']]; if (!Easol_AuthorizationRoles::hasAccess(['System Administrator', 'Data Administrator'])) { $data['allowedUser'] = "******" . Easol_Authentication::userdata('StaffUSI'); $data['thefilter'] = ['Term' => ['glue' => 'and'], 'Year' => ['glue' => 'and'], 'Course' => ['glue' => 'and']]; } return $data; }
/** * @param array | string $allowedRoles * $allowedRoles * for grant all access, @ for all logged in users, [] for specific user * @return bool|void */ protected function authorize($allowedRoles = []) { if ($allowedRoles == '@' && !Easol_Authentication::isLoggedIn()) { return redirect('home'); } if (Easol_AuthorizationRoles::hasAccess($allowedRoles)) { if (!($this->router->fetch_class() == 'schools' && $this->router->fetch_method() == 'choose') && Easol_AuthorizationRoles::hasAccess(['System Administrator', 'Data Administrator']) && Easol_Authentication::userdata('SchoolId') == false) { return redirect('schools/choose'); } else { return true; } } return redirect('home/accessdenied'); }
public function index() { $data = array(); $data['filters'] = $_GET; $data['currentYear'] = Easol_SchoolConfiguration::getValue('CURRENT_SCHOOLYEAR'); $data['currentYear_default'] = isset($data['filters']['year']) ? $data['filters']['year'] : Easol_SchoolConfiguration::setDefault('Year', $data['currentYear']); $data['currentTerm'] = Easol_SchoolConfiguration::getValue('CURRENT_TERMID'); $data['currentTerm_default'] = isset($data['filters']['term']) ? $data['filters']['term'] : Easol_SchoolConfiguration::setDefault('Term', $data['currentTerm']); $data['userCanFilter'] = Easol_SchoolConfiguration::canFilterByEducator(); // define required filters $where = array(); $where['edfi.Grade.SchoolId'] = Easol_Authentication::userdata('SchoolId'); // define optional filters $lookFor = array('educator' => 'edfi.StaffSectionAssociation.StaffUSI'); // If it's educator who is logged in, we force change Where param if (!$data['userCanFilter']) { $where[$lookFor['educator']] = Easol_Authentication::userdata('StaffUSI'); } $this->db->select("Grade.LocalCourseCode, Course.CourseTitle, Section.UniqueSectionCode, Section.id, Grade.ClassPeriodName, \n Staff.FirstName, Staff.LastSurname, TermType.CodeValue, Grade.SchoolYear, \n sum(case when Grade.NumericGradeEarned >= 90 THEN 1 ELSE 0 END) as Numeric_A, \n sum(case when Grade.NumericGradeEarned >= 80 AND Grade.NumericGradeEarned < 90 THEN 1 ELSE 0 END) as Numeric_B,\n sum(case when Grade.NumericGradeEarned >= 70 AND Grade.NumericGradeEarned < 80 THEN 1 ELSE 0 END) as Numeric_C,\n sum(case when Grade.NumericGradeEarned >= 60 AND Grade.NumericGradeEarned < 70 THEN 1 ELSE 0 END) as Numeric_D,\n sum(case when Grade.NumericGradeEarned < 60 THEN 1 ELSE 0 END) as Numeric_F,\n sum(case when LEFT(Grade.LetterGradeEarned, 1) = 'A' THEN 1 ELSE 0 END) as Letter_A,\n sum(case when LEFT(Grade.LetterGradeEarned, 1) = 'B' THEN 1 ELSE 0 END) as Letter_B,\n sum(case when LEFT(Grade.LetterGradeEarned, 1) = 'C' THEN 1 ELSE 0 END) as Letter_C,\n sum(case when LEFT(Grade.LetterGradeEarned, 1) = 'D' THEN 1 ELSE 0 END) as Letter_D,\n sum(case when LEFT(Grade.LetterGradeEarned, 1) = 'F' THEN 1 ELSE 0 END) as Letter_F, \n count(*) as StudentCount"); $this->db->from('edfi.Grade'); $this->db->join('edfi.GradingPeriod', 'GradingPeriod.EducationOrganizationId = Grade.SchoolId AND GradingPeriod.BeginDate = Grade.BeginDate AND GradingPeriod.GradingPeriodDescriptorId = Grade.GradingPeriodDescriptorId', 'inner'); $this->db->join('edfi.StudentSectionAssociation', 'StudentSectionAssociation.StudentUSI = Grade.StudentUSI AND StudentSectionAssociation.SchoolId = Grade.SchoolId AND StudentSectionAssociation.LocalCourseCode = Grade.LocalCourseCode AND StudentSectionAssociation.TermTypeId = Grade.TermTypeId AND StudentSectionAssociation.SchoolYear = Grade.SchoolYear AND StudentSectionAssociation.TermTypeId = Grade.TermTypeId AND StudentSectionAssociation.ClassroomIdentificationCode = Grade.ClassroomIdentificationCode AND StudentSectionAssociation.ClassPeriodName = Grade.ClassPeriodName', 'inner'); $this->db->join('edfi.Section', 'Section.LocalCourseCode = StudentSectionAssociation.LocalCourseCode AND Section.SchoolYear = StudentSectionAssociation.SchoolYear AND Section.TermTypeId = StudentSectionAssociation.TermTypeId AND Section.SchoolId = StudentSectionAssociation.SchoolId AND Section.ClassPeriodName = StudentSectionAssociation.ClassPeriodName AND Section.ClassroomIdentificationCode = StudentSectionAssociation.ClassroomIdentificationCode', 'inner'); $this->db->join('edfi.StaffSectionAssociation', 'StaffSectionAssociation.SchoolId = Grade.SchoolId AND StaffSectionAssociation.LocalCourseCode = Grade.LocalCourseCode AND StaffSectionAssociation.TermTypeId = Grade.TermTypeId AND StaffSectionAssociation.SchoolYear = Grade.SchoolYear AND StaffSectionAssociation.TermTypeId = Grade.TermTypeId AND StaffSectionAssociation.ClassroomIdentificationCode = Grade.ClassroomIdentificationCode AND StaffSectionAssociation.ClassPeriodName = Grade.ClassPeriodName', 'inner'); $this->db->join('edfi.Staff', 'Staff.StaffUSI = StaffSectionAssociation.StaffUSI', 'inner'); $this->db->join('edfi.Course', 'edfi.Course.EducationOrganizationId = edfi.Grade.SchoolId AND edfi.Course.CourseCode = edfi.Grade.LocalCourseCode', 'inner'); $this->db->join('edfi.TermType', 'edfi.TermType.TermTypeId = edfi.Grade.TermTypeId', 'inner'); $this->db->group_by('Grade.LocalCourseCode,Course.CourseTitle, Section.UniqueSectionCode, Section.id,Grade.ClassPeriodName,TermType.CodeValue,Grade.SchoolYear,Staff.FirstName,Staff.LastSurname'); $this->db->order_by('Grade.LocalCourseCode , Grade.SchoolYear'); $data['results'] = $this->db->where($where)->get()->result(); // exit(print_r($this->db->last_query(), true)); foreach ($data['results'] as $k => $v) { list($pCode, $pName) = explode(' - ', $v->ClassPeriodName); $data['results'][$k]->Period = $pCode; $data['results'][$k]->Educator = $v->FirstName . ' ' . $v->LastSurname; } $sql = "SELECT TermTypeId, CodeValue FROM edfi.TermType"; $data['terms'] = $this->db->query($sql)->result(); $data['years'] = range($data['currentYear'], date('Y')); $sql = "SELECT CourseCode, CourseTitle FROM edfi.Course ORDER BY CourseTitle"; $data['courses'] = $this->db->query($sql)->result(); /* $sql = "SELECT * FROM edfi.GradeLevelType"; $data['gradelevels'] = $this->db->query($sql)->result();*/ $sql = "SELECT\n edfi.Staff.StaffUSI,\n CONCAT (edfi.Staff.FirstName,' ',\n edfi.Staff.LastSurname) as FullName\n FROM edfi.Staff\n LEFT JOIN edfi.StaffSchoolAssociation\n ON edfi.StaffSchoolAssociation.StaffUSI=edfi.Staff.StaffUSI\n ORDER By FirstName, LastSurname\n "; $data['educators'] = $this->db->query($sql)->result(); $this->render("index", ['data' => $data]); }
/** * index action */ public function index() { $data = array(); $data['currentYear'] = Easol_SchoolConfiguration::getValue('CURRENT_SCHOOLYEAR'); $query = "(SELECT Student.StudentUSI, Student.FirstName, Student.LastSurname, GradeLevelType.CodeValue +'' as GradeLevel,\n GradeLevelType.GradeLevelTypeId, AttendanceEventCategoryType.CodeValue, COUNT(*) as Days,\n StudentSchoolAttendanceEvent.SchoolYear \n FROM edfi.StudentSchoolAttendanceEvent \n INNER JOIN edfi.AttendanceEventCategoryDescriptor ON AttendanceEventCategoryDescriptor.AttendanceEventCategoryDescriptorId = StudentSchoolAttendanceEvent.AttendanceEventCategoryDescriptorId\n INNER JOIN edfi.AttendanceEventCategoryType ON AttendanceEventCategoryType.AttendanceEventCategoryTypeId = AttendanceEventCategoryDescriptor.AttendanceEventCategoryTypeId\n INNER JOIN edfi.Student ON Student.StudentUSI = StudentSchoolAttendanceEvent.StudentUSI\n INNER JOIN edfi.StudentSchoolAssociation ON StudentSchoolAssociation.StudentUSI = StudentSchoolAttendanceEvent.StudentUSI AND StudentSchoolAssociation.SchoolId = StudentSchoolAttendanceEvent.SchoolId AND StudentSchoolAssociation.SchoolYear = StudentSchoolAttendanceEvent.SchoolYear\n INNER JOIN edfi.GradeLevelDescriptor ON GradeLevelDescriptor.GradeLevelDescriptorId = StudentSchoolAssociation.EntryGradeLevelDescriptorId\n INNER JOIN edfi.GradeLevelType ON GradeLevelType.GradeLevelTypeId = GradeLevelDescriptor.GradeLevelTypeId \n WHERE (AttendanceEventCategoryType.CodeValue IN ('In Attendance', 'Excused Absence', 'Unexcused Absence')) AND StudentSchoolAttendanceEvent.SchoolId = " . Easol_Authentication::userdata('SchoolId') . " \n GROUP BY Student.StudentUSI, Student.FirstName, Student.LastSurname, AttendanceEventCategoryType.CodeValue, GradeLevelType.CodeValue, StudentSchoolAttendanceEvent.SchoolYear,GradeLevelType.GradeLevelTypeId)\n ORDER BY StudentUSI"; $data['results'] = $this->db->query($query)->result(); foreach ($data['results'] as $k => $v) { $data['results'][$v->StudentUSI][$v->SchoolYear]['StudentUSI'] = $v->StudentUSI; $data['results'][$v->StudentUSI][$v->SchoolYear]['Name'] = $v->FirstName . ' ' . $v->LastSurname; $data['results'][$v->StudentUSI][$v->SchoolYear]['GradeLevel'] = $v->GradeLevel; $data['results'][$v->StudentUSI][$v->SchoolYear][$v->CodeValue] = $v->Days; unset($data['results'][$k]); } $sql = "SELECT CodeValue FROM edfi.GradeLevelType"; $data['gradelevels'] = $this->db->query($sql)->result(); $data['years'] = range($data['currentYear'], date('Y')); $this->render("index", ['data' => $data]); }
public function choose() { $schools = $this->Edfi_School->getAllSchools(); if (isset($_POST['school'])) { foreach ($schools as $school) { if ($_POST['school'] == $school->EducationOrganizationId) { $userdata = Easol_Authentication::userdata(); $userdata['__ci_last_regenerate'] = time(); $userdata['SchoolId'] = $_POST['school']; $this->session->set_userdata($userdata); //$this->session->set_flashdata('message', 'School Selected as '. $school->NameOfInstitution); //$this->session->set_flashdata('type', 'success'); redirect('/dashboard'); } } } $this->render('choose', ['schools' => $schools]); }
/** * check the request is authorize * @param array $allowedRoles * $allowedRoles * for grant all access, @ for all logged in users, [] for specific user * @return bool */ public static function hasAccess($allowedRoles = []) { if (!is_array($allowedRoles)) { if ($allowedRoles == '*') { return true; } if ($allowedRoles == '@' && Easol_Authentication::isLoggedIn()) { return true; } } if (!Easol_Authentication::userdata('RoleId')) { return false; } foreach ($allowedRoles as $role) { if (array_key_exists($role, self::$roles) && self::$roles[$role] == Easol_Authentication::userdata('RoleId')) { return true; } } return false; }
public function beforeSave() { $this->SchoolId = Easol_Authentication::userdata("SchoolId"); parent::beforeSave(); }
public function student() { $section = $this->uri->segment(3, 0); $student = base64_decode($this->uri->segment(4, 0)); // decode the email hash that was base64 encoded so it could be passed in the url. $data = array(); $SchoolId = Easol_Authentication::userdata('SchoolId'); // This SQL call is to get details about the Section $this->db->select("Grade.LocalCourseCode, SEC.UniqueSectionCode, SEC.id, Grade.ClassPeriodName, Staff.FirstName, Staff.LastSurname, TermType.CodeValue"); $this->db->from('edfi.Grade'); $this->db->join('edfi.Section as SEC', 'edfi.Grade.SchoolId = SEC.SchoolId AND edfi.Grade.SchoolYear = SEC.SchoolYear AND edfi.Grade.ClassPeriodName = SEC.ClassPeriodName AND edfi.Grade.ClassroomIdentificationCode = SEC.ClassroomIdentificationCode AND edfi.Grade.LocalCourseCode = SEC.LocalCourseCode AND edfi.Grade.TermTypeId = SEC.TermTypeId', 'inner'); $this->db->join('edfi.StaffSectionAssociation', 'StaffSectionAssociation.SchoolId = Grade.SchoolId AND StaffSectionAssociation.LocalCourseCode = Grade.LocalCourseCode AND StaffSectionAssociation.TermTypeId = Grade.TermTypeId AND StaffSectionAssociation.SchoolYear = Grade.SchoolYear AND StaffSectionAssociation.TermTypeId = Grade.TermTypeId AND StaffSectionAssociation.ClassroomIdentificationCode = Grade.ClassroomIdentificationCode AND StaffSectionAssociation.ClassPeriodName = Grade.ClassPeriodName', 'inner'); $this->db->join('edfi.Staff', 'Staff.StaffUSI = StaffSectionAssociation.StaffUSI', 'inner'); $this->db->join('edfi.TermType', 'edfi.TermType.TermTypeId = edfi.Grade.TermTypeId', 'inner'); $this->db->where('SEC.id', $section); $data['section'] = $this->db->get()->row(); $data['section']->Educator = $data['section']->FirstName . ' ' . $data['section']->LastSurname; list($pCode, $pName) = explode(' - ', $data['section']->ClassPeriodName); $data['section']->Period = $pCode; // get the section datetime intervals $urldates = ''; $ClassPeriodName = $data['section']->ClassPeriodName; $this->db->select("BellSchedule.date, BellScheduleMeetingTime.starttime, BellScheduleMeetingTime.endtime"); $this->db->from("edfi.BellSchedule"); $this->db->join('edfi.BellScheduleMeetingTime', 'BellScheduleMeetingTime.date = BellSchedule.date'); $this->db->where("BellSchedule.SchoolId = '{$SchoolId}' AND BellScheduleMeetingTime.ClassPeriodName = '{$ClassPeriodName}'"); $intervals = $this->db->get()->result(); foreach ($intervals as $key => $value) { $urldates .= '&date_begin[]=' . $value->date . 'T' . $value->starttime . '&date_end[]=' . $value->date . 'T' . $value->endtime; } // Get the student record. $this->db->select("Student.FirstName, Student.MiddleName, Student.LastSurname, EmailLookup.HashedEmail, Section.UniqueSectionCode"); $this->db->from("edfi.Section"); $this->db->join("edfi.StudentSectionAssociation", "StudentSectionAssociation.SchoolId = Section.SchoolId AND \n StudentSectionAssociation.ClassPeriodName = Section.ClassPeriodName AND \n StudentSectionAssociation.ClassroomIdentificationCode = Section.ClassroomIdentificationCode AND \n StudentSectionAssociation.LocalCourseCode = Section.LocalCourseCode AND \n StudentSectionAssociation.SchoolYear = Section.SchoolYear"); $this->db->join("edfi.Student", "Student.StudentUSI = StudentSectionAssociation.StudentUSI"); $this->db->join("edfi.StudentElectronicMail", "StudentElectronicMail.StudentUSI = Student.StudentUSI"); $this->db->join('easol.EmailLookup', 'EmailLookup.email = StudentElectronicMail.ElectronicMailAddress'); $this->db->where("StudentElectronicMail.PrimaryEmailAddressIndicator", "1"); $this->db->where("Section.id", $section); $this->db->where("EmailLookup.HashedEmail", $student); // sort the, hashed, student emails by section. $data['student'] = $this->db->distinct()->get()->row(); if (isset($urldates) and !empty($urldates)) { // get the page api data for each student $query = http_build_query(array('org_api_key' => $this->api_key, 'org_secret_key' => $this->api_pass, 'type' => 'detail', 'usernames' => $student)); $site = $this->api_url . 'pages?' . $query . $urldates; $response = json_decode(file_get_contents($site, true)); // Since the api returns different data structures for pages and videos, but they are all the same to the view, they // are converted to a uniform structure before going to the view. foreach ($response->results as $r) { foreach ($r->page_visits as $v) { $date = new DateTime($v->date_visited); $date = $date->format('Y-m-d H:i:s'); $data['student']->records[] = array($date, $v->page_url, $v->total_time, $v->page_name); } } // get the video data for each student $query = http_build_query(array('org_api_key' => $this->api_key, 'org_secret_key' => $this->api_pass, 'usernames' => $student)); $site = $this->api_url . 'video-views?' . $query . $urldates; $response = json_decode(file_get_contents($site, true)); // Since the api does not return the timestamp for the video records, there is a random number as a placeholder. // todo: replace random number with timestamp from the api when it is included in the api response data. foreach ($response->results as $r) { $date = new DateTime(@$r->date_started); $date = $date->format('Y-m-d H:i:s'); $data['student']->records[] = array($date, $r->url, $r->time_viewed, $r->title); } } $this->render("student", ['data' => $data]); }
<div class="row choose-school"> <div class="col-md-12 col-sm-12"> <div class="panel panel-default"> <div class="panel-body"> <h3>Choose School:</h3> <form class="form form-inline" action="" method="post"> <div class="form-group"> <select name="school" class="form-control"> <?php foreach ($schools as $school) { ?> <option value="<?php echo $school->EducationOrganizationId; ?> " <?php echo Easol_Authentication::userdata("SchoolId") == $school->EducationOrganizationId ? "selected" : ""; ?> ><?php echo $school->NameOfInstitution; ?> </option> <?php } ?> </select> </div> <div class="form-group"> <button type="submit" class="btn btn-primary">Select</button> </div> </form> </div>
} else { $optionCharts .= '<option value="' . $report->ReportId . '">' . $report->ReportName . '</option>'; } } ?> <?php foreach ($roles as $role) { ?> <?php $leftOptions = ''; $rightOptions = ''; $bottomOptions = ''; /* @var $dashConf Easol_DashboardConfiguration */ $dashConf = (new Easol_DashboardConfiguration())->findOne(['RoleTypeId' => $role->RoleTypeId, 'EducationOrganizationId' => Easol_Authentication::userdata('SchoolId')]); ?> <?php foreach ($reports as $report) { ?> <?php //check if table // if($report->ReportDisplayId==1) // continue; $flagLeftOptions = false; $flagRightOptions = false; $flagBottomOptions = false; foreach ($report->getAccessTypes() as $access) { if ($role->RoleTypeId == 1 || $role->RoleTypeId == 2 || $access->RoleTypeId == $role->RoleTypeId) { ?>
echo Easol_Authentication::userdata("SchoolId") == $school->EducationOrganizationId ? "selected" : ""; ?> ><?php echo $school->NameOfInstitution; ?> </option> <?php } ?> </select> </form></li> <?php } elseif (Easol_Authentication::userdata('SchoolName')) { ?> <li><p class="navbar-text"><?php echo Easol_Authentication::userdata('SchoolName'); ?> </p></li> <?php } ?> <li class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false"> <i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i> </a> <ul class="dropdown-menu dropdown-user"> <?php if (Easol_AuthorizationRoles::hasAccess(['System Administrator', 'Data Administrator'])) { ?> <li <?php
public function beforeSave() { if ($this->isNewRecord) { if (array_key_exists('CreatedBy', $this->labels())) { $this->CreatedBy = Easol_Authentication::userdata("StaffUSI"); } if (array_key_exists('CreatedOn', $this->labels())) { $this->db->set('CreatedOn', 'GETDATE()', FALSE); } } if (array_key_exists('UpdatedBy', $this->labels())) { $this->UpdatedBy = Easol_Authentication::userdata("StaffUSI"); } if (array_key_exists('UpdatedOn', $this->labels())) { $this->db->set('UpdatedOn', 'GETDATE()', FALSE); } }