/** * handles the adding of a channel to a layout * * @param $channel \b id of channel to add * @param $target \b id of tab to add channel to */ public function add($channel, $target = null) { $default_layout = false; ignore_user_abort(); if ($_SESSION['generic_user_type'] == 'portalord') { $default_layout = true; } MyPortal::force_clone($this->portal); $channel_id = str_replace('channel-', '', $channel); $target = str_replace('tab-', '', $target); // // if portal was just cloned, channel ids must be updated. // they referred to the default layout in the ui, but we will actually update // the custom user layout. // // @todo account for admins updating the default layout (GET param?) // //if we just cloned the layout, set the target as the child tab if ($this->portal->cloned) { $target = MyUserTab::get_child_id($this->portal->person, $target); } if (!$this->portal->tabs($target)) { $default_portal = new MyPortal(0); $default_tab_slug = $default_portal->tabs($target)->slug; $target = $this->portal->tabs($default_tab_slug)->id; $default_channel = $default_portal->tabs($default_tab_slug)->channels($channel_id); $sql = "SELECT id FROM userchannels WHERE channel_id = ? AND usertab_id = ? AND col_num = ? AND sort_order = ?"; $channel_id = PSU::db('portal')->GetOne($sql, array($channel_id, $this->portal->tabs($default_tab_slug)->id, $default_channel->col_num, $default_channel->sort_order)); } //end if //if we're spoofing the portalord role, edit the default layout rather than the cloned one if ($default_layout) { if (!$default_portal) { $default_portal = new MyPortal(0); } $target = $default_portal->tabs($target)->base->id; } $sql = "SELECT MAX(sort_order) FROM userchannels WHERE usertab_id = ? AND col_num = 2"; $sort_order = psu::db('portal')->GetOne($sql, $target); $channel = new MyUserChannel(array('channel_id' => $channel_id)); $channel->col_num = 2; $channel->sort_order = $sort_order + 1; $channel->usertab_id = $target ? $target : 1; $channel->save(); echo $this->portal->is_default_layout() ? 'default' : 'user'; }
/** * executes student query and returns a result set for looping */ public static function query($args = array(), $return_results = true, $debug = false) { if (!is_array($args)) { $args = array('term_code' => $args); } //end if $valid_args = array('term_code', 'last_name', 'first_name', 'gender', 'veteran', 'advisor_first_name', 'advisor_last_name', 'continuing_ed', 'class1', 'class2', 'class3', 'class4', 'confirmed_status', 'pt_ft', 'age_low', 'age_high', 'gpa_low', 'gpa_high', 'credit_low', 'credit_high', 'state_code', 'degree', 'department', 'major', 'option', 'minor', 'degs', 'sport', 'teacher_cert', 'c_age', 'c_commute', 'c_sex', 'c_dean', 'c_styp', 'c_advr', 'c_conf', 'c_ma', 'c_pt_cred', 'c_t_cred', 'c_birth', 'c_cred', 'c_majr', 'c_pt_gpa', 'c_t_gpa', 'c_ca', 'c_gpa', 'c_min', 'c_sport', 'c_vet', 'c_ca_ph', 'c_degr', 'c_opt', 'c_sport_comments', 'c_webreg', 'c_citz', 'c_dept', 'c_pa', 'c_sport_eligibility', 'c_class', 'c_email', 'c_load', 'c_stat', 'c_degs', 'c_cat'); $validated_args = array(); foreach ($args as $key => $value) { if (in_array($key, $valid_args)) { $validated_args['ps_' . $key] = $value; } //end if } //end foreach if (!$validated_args['ps_term_code']) { $validated_args['ps_term_code'] = self::getCurrentTerm('UG'); } //end if $sql = "BEGIN pkg_student_utility.p_query(pb_load_address => TRUE"; foreach ($validated_args as $key => $value) { $sql .= ", " . $key . " => :" . $key; } //end foreach $sql .= "); END;"; $stmt = \PSU::db('banner')->PrepareSP($sql); foreach ($validated_args as $key => $value) { \PSU::db('banner')->InParameter($stmt, $value, $key); } //end foreach \PSU::db('banner')->Execute($stmt); if ($debug) { psu::dbug(psu::db('banner')->GetOne("SELECT pkg_student_utility.f_get_unexclude() FROM dual")); } //end if $sql = "SELECT * FROM gt_student_query WHERE exclude IS NULL"; if ($return_results) { return \PSU::db('banner')->Execute($sql); } else { return $sql; } //end if }
/** * Return the channel in a specified format * * @param string $type Type of output (callback or write) * @param mixed $params Parameters to be appended to the JS callback */ public function text($type = 'write', $params = false) { $text = ob_get_contents(); ob_end_clean(); $non_js_types = array('html', 'raw'); if (!in_array($type, $non_js_types)) { header('Content-type: text/javascript'); } $params = PSU::params($params); $params['callback'] = $params['callback'] ? $params['callback'] : '$.my.channelLoad'; $params['channel_id'] = $params['channel_id'] ? $params['channel_id'] : $_GET['channel_id']; if ($_SERVER['HTTPS'] == 'on') { $text = str_replace('src="http://www.plymouth', 'src="https://www.plymouth', $text); } //end if if ($type == 'callback') { $text = self::callback(psu::closeOpenTags($text), $params['callback'], $params); } elseif ($type == 'html') { $text = self::html($text, $params); } elseif ($type == 'raw') { // do not modify $text! } else { $text = self::write($text); } //end else return $text; }
/** * removeRecord * * Removes HR data a person/group of people. PZBLOAD must be fully populated * prior to group removal * * @since version 1.0.0 * @param int $pidm Person identifier * @return boolean * @access public */ function removeRecords($pidm = false) { if ($this->_ADOdb->GetOne("SELECT count(*) FROM pzbload WHERE pzbload_pidm IS NOT NULL") <= 0) { throw new HRException(HRException::HR_VIEW); } //end if $sql = "SELECT a.pidm,l.id\n\t\t\t\t\t\tFROM psu_identity.person_attribute a,\n\t\t\t\t\t\t\t\t psu_identity.attribute_meta m,\n\t\t\t\t\t\t\t\t psu_identity.attribute_type at,\n\t\t\t\t\t\t\t\t psu_identity.person_attribute_log l\n\t\t\t\t\t WHERE a.type_id = at.id\n\t\t\t\t\t\t AND at.name = 'role'\n\t\t\t\t\t\t AND NOT EXISTS(SELECT 1 FROM pzbload WHERE pzbload_pidm=a.pidm)\n\t\t\t\t\t\t AND m.type_id = a.type_id \n\t\t\t\t\t\t AND m.attribute = a.attribute \n\t\t\t\t\t\t AND m.meta = 'classification'\n\t\t\t\t\t\t AND a.pidm = l.pidm\n\t\t\t\t\t\t AND l.source = 'hr'\n\t\t\t\t\t\t AND l.origin_id IS NULL\n\t\t\t\t\t\t " . ($pidm ? "AND a.pidm = " . $pidm : "") . "\n\t\t\t\t\t ORDER BY a.pidm,l.id"; if ($results = $this->_ADOdb->Execute($sql)) { $pidm = 0; while ($row = $results->FetchRow()) { $row = psu::cleanKeys('', '', $row); if ($pidm != $row['pidm']) { //pidm is switching to a new person $active_faculty = $this->idm->db->GetOne("SELECT 1 FROM v_faculty WHERE pidm = :pidm", array('pidm' => $row['pidm'])); //inactivate the person's ID Card if needed if ($pidm) { $this->inactivateIDCardIfNeeded($pidm); } //switch to the new person $pidm = $row['pidm']; } //end if if (!$active_faculty) { $this->idm->removeAttribute($row['pidm'], $row['id']); } } //end while //inactivate the ID Card of the last person we checked if ($pidm) { $this->inactivateIDCardIfNeeded($pidm); } } //end if return true; }
/** * _load_phone * * loads phone info for the person * * @access protected */ public function _load_phone() { $phone_data = array(); $sql = "BEGIN :c_cursor := gb_telephone.f_query_all(:pidm); END;"; if ($results = PSU::get('banner')->ExecuteCursor($sql, 'c_cursor', array('pidm' => $this->person->pidm))) { foreach ($results as $phone) { $phone = psu::cleanKeys('sprtele_', '', $phone); if ($phone['status_ind'] != 'I') { $phone_data[$phone['tele_code']][] = new PSUPhone($phone); } //end if } //end foreach } //end if $this->person->phone = $phone_data; }
protected function _get_calls($type = 'open', $page = 1, $start = 0) { $sql = "SELECT c.call_id,\n\t\t\t\t\t\t\t\t\t h.id history_id,\n\t\t\t\t\t\t\t\t\t h.call_status status,\n\t\t\t\t\t\t\t\t\t h.tlc_assigned_to,\n\t\t\t\t\t\t\t\t\t h.updated_by,\n\t\t\t\t\t\t\t\t\t h.comments,\n\t\t\t\t\t\t\t\t\t CONCAT(c.call_date, ' ', c.call_time) call_date,\n\t\t\t\t\t\t\t\t\t CONCAT(h.date_assigned, ' ', h.time_assigned) update_date,\n\t\t\t\t\t\t\t\t\t h2.updated_by original_submitter,\n\t\t\t\t\t\t\t\t\t h2.tlc_assigned_to first_assigned_to,\n\t\t\t\t\t\t\t\t\t h2.comments original_comment\n\t\t\t\t\t\t\tFROM call_log c\n\t\t\t\t\t\t\t\t\t INNER JOIN call_history h\n\t\t\t\t\t\t\t\t\t\tON h.call_id = c.call_id\n\t\t\t\t\t\t\t\t\t\tAND h.current = 1\n\t\t\t\t\t\t\t\t\t\tAND h.call_status = ?\n\t\t\t\t\t\t\t\t\t INNER JOIN call_history h2\n\t\t\t\t\t\t\t\t\t\tON h2.call_id = c.call_id\n\t\t\t\t\t\t WHERE (c.caller_username = ? OR c.wp_id = ?)\n\t\t\t\t\t\t\t AND h2.id = (\n\t\t\t\t\t\t\t\t\t\tSELECT min(h3.id)\n\t\t\t\t\t\t\t\t\t\t\tFROM call_history h3\n\t\t\t\t\t\t\t\t\t\t WHERE h3.call_id = h2.call_id\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t ORDER BY h.date_assigned DESC,\n\t\t\t\t\t\t \t\t\t h.time_assigned DESC\n\t\t\t\t\t\t\t\t\t {$limit}"; $args = array('status' => $type, 'username' => $this->myuser->username, 'wp_id' => $this->myuser->wp_id); $results = psu::db('calllog')->PageExecute($sql, 10, $page, $args); $data = array(); foreach ($results as $row) { $data[] = $row; } //end foreach return psu::paginationResults(psu::paginationInfo($_GET, $results), $data); }
/** * generatePopulations * * creates populations that the account process references for accounts * during execution * * @since version 1.0.0 * @return boolean */ function generatePopulations() { echo $this->line . ":: Retrieving Employees and Non Employees from Banner" . $this->line; //grab employees $sql = "SELECT distinct pidm\n\t\t FROM psu_identity.person_attribute\n\t\t WHERE attribute in('staff', 'faculty', 'lecturer')\n\t\t AND type_id = 2\n\t\t AND not exists(SELECT 1 FROM spbpers WHERE spbpers_pidm = pidm AND spbpers_dead_ind = 'Y')"; $this->emps = $this->idm->db->GetAll($sql); //grab non employees $this->non_emps = $this->idm->db->GetAll("SELECT * FROM v_psu_friend"); $this->emeritus = psu::db('banner')->GetAll("SELECT distinct pidm FROM v_alumni_emeritus UNION SELECT distinct pidm FROM v_alumni_campus"); //check counts if ($this->verifyCounts()) { //all good...continue return true; } else { //oh noes! death to us return false; } //end else }
/** * insert custom fields into Banner */ public function insertSARRQST() { // @insert sarrqst data $sql = "INSERT INTO sarrqst(\n\t\t\t\t\t\tsarrqst_aidm,\n\t\t\t\t\t\tsarrqst_appl_seqno,\n\t\t\t\t\t\tsarrqst_seqno,\n\t\t\t\t\t\tsarrqst_load_ind,\n\t\t\t\t\t\tsarrqst_activity_date,\n\t\t\t\t\t\tsarrqst_qstn_desc,\n\t\t\t\t\t\tsarrqst_qstn_cde,\n\t\t\t\t\t\tsarrqst_ansr_desc,\n\t\t\t\t\t\tsarrqst_wudq_no,\n\t\t\t\t\t\tsarrqst_resp_flag\n\t\t\t\t\t)VALUES(\n\t\t\t\t\t\t:aidm,\n\t\t\t\t\t\t:appl_seqno,\n\t\t\t\t\t\t:seqno,\n\t\t\t\t\t\t'N',\n\t\t\t\t\t\tsysdate,\n\t\t\t\t\t\t:qstn_desc,\n\t\t\t\t\t\t:qstn_cde,\n\t\t\t\t\t\t:ansr_desc,\n\t\t\t\t\t\t:wudq_no,\n\t\t\t\t\t\t:resp_flag\n\t\t\t\t\t)"; $aidm = $this->getSABNSTUAidm($this->commonapplicantclientid); $appl_seqno = $this->getSARHEADApplSeqno($aidm); $prms = "SELECT decode(max(sarrqst_seqno)+1,null,1,max(sarrqst_seqno)+1)\n\t\t\t\t\t\tFROM sarrqst\n\t\t\t\t\t WHERE sarrqst_aidm=:aidm\n\t\t\t\t\t\t AND sarrqst_appl_seqno=:appl_seqno"; $row['aidm'] = $aidm; $row['appl_seqno'] = $appl_seqno; if ($this->fulltimestudent) { $row['seqno'] = PSU::db('banner')->GetOne($prms, compact('aidm', 'appl_seqno')); if ($this->fulltimestudent == 'Y') { $row['qstn_desc'] = "Are you applying as a full-time student?"; $row['qstn_cde'] = ""; $row['ansr_desc'] = "Yes"; $row['resp_flag'] = ""; $row['wudq_no'] = "13"; } if ($this->fulltimestudent == 'N') { $row['qstn_desc'] = "Are you applying as a full-time student?"; $row['qstn_cde'] = ""; $row['ansr_desc'] = "No"; $row['resp_flag'] = ""; $row['wudq_no'] = "13"; } $rs = PSU::db('banner')->Execute($sql, $row); if ($rs) { $successfully_moved_to_banner = true; } else { $successfully_moved_to_banner = false; psu::puke($client_id . " Failed trying to insert FULL TIME STUDENT INFO into Banner table SARRQST."); } } // end if if ($this->cellareacode && $this->cellphone) { $row['seqno'] = PSU::db('banner')->GetOne($prms, compact('aidm', 'appl_seqno')); $row['qstn_desc'] = "Your cell phone number (with area code):"; $row['qstn_cde'] = ""; $phone = preg_replace("/[^a-z \\d]/i", "", $this->cellphone); $row['ansr_desc'] = $this->cellareacode . $phone; $row['wudq_no'] = "25"; $row['resp_flag'] = ""; $rs = PSU::db('banner')->Execute($sql, $row); if ($rs) { $successfully_moved_to_banner = true; } else { $successfully_moved_to_banner = false; psu::puke($client_id . " Failed trying to insert CELL PHONE into Banner table SARRQST."); } } // end if $row['seqno'] = PSU::db('banner')->GetOne($prms, compact('aidm', 'appl_seqno')); $row['qstn_cde'] = "RS"; $row['qstn_desc'] = ""; $row['ansr_desc'] = ""; $row['wudq_no'] = ""; $row['resp_flag'] = $this->resident; $rs = PSU::db('banner')->Execute($sql, $row); if ($rs) { $successfully_moved_to_banner = true; } else { $successfully_moved_to_banner = false; psu::puke($client_id . " Failed trying to insert RESIDENT INFO into Banner table SARRQST."); } if ($this->parent1degree || $this->parent1graddegree || $this->parent1othergraddegree) { $row['seqno'] = PSU::db('banner')->GetOne($prms, compact('aidm', 'appl_seqno')); $row['qstn_cde'] = ""; if ($this->parent1type == "Father") { $row['qstn_desc'] = "What is the highest level of education your father completed?:<br>Enter ONLY the ONE LETTER CODE.<br>H = High School or GED<br>A = Associate Degree<br>B = Bachelors Degree<br>G = Graduate Degree"; $row['resp_flag'] = ""; $row['wudq_no'] = "16"; } elseif ($this->parent1type == "Mother") { $row['qstn_desc'] = "What is the highest level of education your mother completed?:<br>Enter ONLY the ONE LETTER CODE.<br>H = High School or GED<br>A = Associate Degree<br>B = Bachelors Degree<br>G = Graduate Degree"; $row['resp_flag'] = ""; $row['wudq_no'] = "17"; } if ($this->parent1degree == 1) { $deg1ans = ""; $row['ansr_desc'] = ""; } elseif ($this->parent1degree == "2" || $this->parent1degree == "3") { $deg1ans = "S"; $row['ansr_desc'] = "S"; } elseif ($this->parent1degree == "4" || $this->parent1degree == "5" || $this->parent1degree == "6") { $deg1ans = "H"; $row['ansr_desc'] = "H"; } elseif ($this->parent1degree == "7") { $deg1ans = "A"; $row['ansr_desc'] = "A"; } elseif ($this->parent1degree == "8") { $deg1ans = "B"; $row['ansr_desc'] = "B"; } if ($this->parent1graddegree == "1" || $this->parent1othergraddegree == "1") { $row['ansr_desc'] = $deg1ans; } elseif ($this->parent1graddegree == "2" || $this->parent1graddegree == "3" || $this->parent1graddegree == "4" || $this->parent1othergraddegree == "2" || $this->parent1othergraddegree == "3" || $this->parent1othergraddegree == "4") { $row['ansr_desc'] = "M"; } elseif ($this->parent1graddegree == "5" || $this->parent1graddegree == "6" || $this->parent1graddegree == "7" || $this->parent1othergraddegree == "5" || $this->parent1othergraddegree == "6" || $this->parent1othergraddegree == "7") { $row['ansr_desc'] = "G"; } $rs = PSU::db('banner')->Execute($sql, $row); if ($rs) { $successfully_moved_to_banner = true; } else { $successfully_moved_to_banner = false; psu::puke($client_id . " Failed trying to insert PARENT 1 DEGREE into Banner table SARRQST."); } } if ($this->parent2degree || $this->parent2graddegree || $this->parent2othergraddegree) { $row['seqno'] = PSU::db('banner')->GetOne($prms, compact('aidm', 'appl_seqno')); $row['qstn_cde'] = ""; if ($this->parent2type == "Father") { $row['qstn_desc'] = "What is the highest level of education your father completed?:<br>Enter ONLY the ONE LETTER CODE.<br>H = High School or GED<br>A = Associate Degree<br>B = Bachelors Degree<br>G = Graduate Degree"; $row['resp_flag'] = ""; $row['wudq_no'] = "16"; } elseif ($this->parent2type == "Mother") { $row['qstn_desc'] = "What is the highest level of education your mother completed?:<br>Enter ONLY the ONE LETTER CODE.<br>H = High School or GED<br>A = Associate Degree<br>B = Bachelors Degree<br>G = Graduate Degree"; $row['resp_flag'] = ""; $row['wudq_no'] = "17"; } if ($this->parent2degree == 1) { $deg1ans = ""; $row['ansr_desc'] = ""; } elseif ($this->parent2degree == "2" || $this->parent2degree == "3") { $deg1ans = "S"; $row['ansr_desc'] = "S"; } elseif ($this->parent2degree == "4" || $this->parent2degree == "5" || $this->parent2degree == "6") { $deg1ans = "H"; $row['ansr_desc'] = "H"; } elseif ($this->parent2degree == "7") { $deg1ans = "A"; $row['ansr_desc'] = "A"; } elseif ($this->parent2degree == "8") { $deg1ans = "B"; $row['ansr_desc'] = "B"; } if ($this->parent2graddegree == "1" || $this->parent2othergraddegree == "1") { $row['ansr_desc'] = $deg1ans; } elseif ($this->parent2graddegree == "2" || $this->parent2graddegree == "3" || $this->parent2graddegree == "4" || $this->parent2othergraddegree == "2" || $this->parent2othergraddegree == "3" || $this->parent2othergraddegree == "4") { $row['ansr_desc'] = "M"; } elseif ($this->parent2graddegree == "5" || $this->parent2graddegree == "6" || $this->parent2graddegree == "7" || $this->parent2othergraddegree == "5" || $this->parent2othergraddegree == "6" || $this->parent2othergraddegree == "7") { $row['ansr_desc'] = "G"; } $rs = PSU::db('banner')->Execute($sql, $row); if ($rs) { $successfully_moved_to_banner = true; } else { $successfully_moved_to_banner = false; psu::puke($client_id . " Failed trying to insert PARENT 2 DEGREE into Banner table SARHEAD."); } } return $successfully_moved_to_banner; }