/** * Retrieve etsis_Course instance. * * @global app $app eduTrac SIS application array. * * @param int $course_id * Course ID. * @return etsis_Course|false Course array, false otherwise. */ public static function get_instance($course_id) { global $app; //$course_id = (int) $course_id; if (!$course_id) { return false; } $q = $app->db->course()->where('courseID = ?', $course_id); $course = etsis_cache_get($course_id, 'crse'); if (empty($course)) { $course = $q->find(function ($data) { $array = []; foreach ($data as $d) { $array[] = $d; } return $array; }); etsis_cache_add($course_id, $course, 'crse'); } $a = []; foreach ($course as $_course) { $a[] = $_course; } if (!$_course) { return false; } return $_course; }
<!-- Website Traffic Chart --> <div class="widget widget-body-white" data-toggle="collapse-widget"> <div class="widget-head"> <h4 class="heading glyphicons imac"><i></i><?php echo _t('Latest eduTrac SIS Updates'); ?> </h4> </div> <div class="widget-body"> <!-- Simple Chart --> <div class="widget-chart bg-lightseagreen"> <?php $rss1 = new \DOMDocument(); $rss1->load('http://feeds.feedburner.com/eduTracSIS'); $feed = etsis_cache_get('rss', 'rss'); if (empty($feed)) { $feed = []; foreach ($rss1->getElementsByTagName('item') as $node) { $item = ['title' => $node->getElementsByTagName('title')->item(0)->nodeValue, 'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue, 'link' => $node->getElementsByTagName('link')->item(0)->nodeValue, 'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue]; array_push($feed, $item); } etsis_cache_add('rss', $feed, 'rss'); } $limit = 3; for ($x = 0; $x < $limit; $x++) { $title = str_replace(' & ', ' & ', $feed[$x]['title']); $link = $feed[$x]['link']; $description = $feed[$x]['desc']; $date = date('l F d, Y', strtotime($feed[$x]['date'])); echo '<p><strong><a href="' . $link . '" title="' . $title . '">' . $title . '</a></strong><br />';
$gs = $app->db->grade_scale(); foreach ($_POST as $k => $v) { $gs->{$k} = $v; } $gs->where('ID = ?', $id); if ($gs->update()) { etsis_cache_flush_namespace('grsc'); $app->flash('success_message', $flashNow->notice(200)); etsis_logger_activity_log_write('Update Record', 'Grade Scale', _filter_input_string(INPUT_POST, 'grade'), get_persondata('uname')); } else { $app->flash('error_message', $flashNow->notice(409)); } redirect($app->req->server['HTTP_REFERER']); } $gs = $app->db->grade_scale()->where('ID = ?', $id); $q = etsis_cache_get($id, 'grsc'); if (empty($q)) { $q = $gs->find(function ($data) { $array = []; foreach ($data as $d) { $array[] = $d; } return $array; }); etsis_cache_add($id, $q, 'grsc'); } /** * If the database table doesn't exist, then it * is false and a 404 should be sent. */ if ($q == false) {
/** * Retrieve etsis_Course_Sec instance. * * @global app $app eduTrac SIS application array. * * @param int $sect_id Course Section ID. * @return etsis_Course_Sec|false Course section array, false otherwise. */ public static function get_instance($sect_id) { global $app; //$sect_id = (int) $sect_id; if (!$sect_id) { return false; } $q = $app->db->course_sec()->where('courseSecID = ?', $sect_id); $sect = etsis_cache_get($sect_id, 'sect'); if (empty($sect)) { $sect = $q->find(function ($data) { $array = []; foreach ($data as $d) { $array[] = $d; } return $array; }); etsis_cache_add($sect_id, $sect, 'sect'); } $a = []; foreach ($sect as $_sect) { $a[] = $_sect; } if (!$_sect) { return false; } return $_sect; }
/** * Read an option from options_meta. * Return value or $default if not found */ public function get_option($meta_key, $default = false) { $meta_key = trim($meta_key); if (empty($meta_key)) { return false; } /** * Filter the value of an existing option before it is retrieved. * * The dynamic portion of the hook name, `$meta_key`, refers to the meta_key name. * * Passing a truthy value to the filter will short-circuit retrieving * the option value, returning the passed value instead. * * @since 1.0.0 * * @param bool|mixed $pre_option * Value to return instead of the option value. * Default false to skip it. * @param string $meta_key * Meta key name. */ $pre = $this->apply_filter('pre_option_' . $meta_key, false); if (false !== $pre) { return $pre; } if (!isset($this->_app->db->option[$meta_key])) { $meta = $this->_app->db->options_meta(); $q = $meta->select('meta_value')->where('meta_key = ?', $meta_key); $results = etsis_cache_get($meta_key, 'option'); if (empty($results)) { $results = $q->find(function ($data) { foreach ($data as $d) { return $d['meta_value']; } }); etsis_cache_add($meta_key, $results, 'option'); } if (is_object($q)) { $value = $results; return $value; } else { // option does not exist, so we must cache its non-existence $value = $default; return $value; } $this->_app->db->option[$meta_key] = $this->maybe_unserialize($value); } /** * Filter the value of an existing option. * * The dynamic portion of the hook name, `$meta_key`, refers to the option name. * * @since 1.0.0 As 'get_option_' . $setting * * @param mixed $value * Value of the option. If stored serialized, it will be * unserialized prior to being returned. * @param string $this->_app->db->option[$meta_key] * Option name. */ return $this->apply_filter('get_option_' . $meta_key, $this->_app->db->option[$meta_key]); }
/** * Retrieve etsis_Student instance. * * @global app $app eduTrac SIS application object. * * @param int $stu_id * Student ID. * @return etsis_Student|false Student array, false otherwise. */ public static function get_instance($stu_id) { global $app; // $stu_id = (int) $stu_id; if (!$stu_id) { return false; } $q = $app->db->student()->setTableAlias('stu')->select('stu.ID,stu.stuID,stu.status AS stuStatus,stu.addDate AS stuAddDate')->select('person.altID,person.uname,person.prefix,person.fname')->select('person.lname,person.mname,person.email,person.personType')->select('person.ssn,person.dob,person.veteran,person.ethnicity')->select('person.gender,person.emergency_contact,person.emergency_contact_phone')->select('person.photo,person.status AS naeStatus,person.approvedDate')->select('person.approvedBy,person.LastLogin,person.LastUpdate')->select('address.*')->_join('person', 'stu.stuID = person.personID')->_join('address', 'stu.stuID = address.personID')->where('stu.stuID = ?', $stu_id)->_and_()->where('address.addressStatus = "C"')->_and_()->where('(address.endDate = "" OR address.endDate = "0000-00-00")'); $stu = etsis_cache_get($stu_id, 'stu'); if (empty($stu)) { $stu = $q->find(function ($data) { $array = []; foreach ($data as $d) { $array[] = $d; } return $array; }); etsis_cache_add($stu_id, $stu, 'stu'); } $a = []; foreach ($stu as $_stu) { $a[] = $_stu; } if (!$_stu) { return false; } return $_stu; }
/** * Retrieve etsis_Person instance. * * @global app $app eduTrac SIS application object. * * @param int $person_id * Person ID. * @return etsis_Person|false Person array, false otherwise. */ public static function get_instance($person_id) { global $app; //$person_id = (int) $person_id; if (!$person_id) { return false; } $q = $app->db->person()->where('personID = ?', $person_id); $person = etsis_cache_get($person_id, 'person'); if (empty($person)) { $person = $q->find(function ($data) { $array = []; foreach ($data as $d) { $array[] = $d; } return $array; }); etsis_cache_add($person_id, $person, 'person'); } $a = []; foreach ($person as $_person) { $a[] = $_person; } if (!$_person) { return false; } return $_person; }
/** * Retrieve etsis_Acad_Program instance. * * @global app $app eduTrac SIS application object. * * @param int $acad_prog_id * Academic Program ID. * @return etsis_Acad_Program|false Academic program array, false otherwise. */ public static function get_instance($acad_prog_id) { global $app; // $acad_prog_id = (int) $acad_prog_id; if (!$acad_prog_id) { return false; } $q = $app->db->acad_program()->where('acadProgID = ?', $acad_prog_id); $acad_prog = etsis_cache_get($acad_prog_id, 'prog'); if (empty($acad_prog)) { $acad_prog = $q->find(function ($data) { $array = []; foreach ($data as $d) { $array[] = $d; } return $array; }); etsis_cache_add($acad_prog_id, $acad_prog, 'prog'); } $a = []; foreach ($acad_prog as $_acad_prog) { $a[] = $_acad_prog; } if (!$_acad_prog) { return false; } return $_acad_prog; }