Source for file model_students.php
Documentation is available at model_students.php
* <b>Class Description</b>: quick and dirty class to provide database access *
* @author Jan van der Breggen
$this->database = 'rigregversiontwo';
* Tables name and table alias
$this->table['students'] = 'st';
$this->table['retreatReg'] = 'reg';
$this->table['retreat'] = 'rt';
$this->table['stud_grp_join']= 'sgj';
$this->table['sanghas']= 's';
* Mapping of table "students"
$this->map['id'] = array('students', 'id');
$this->map['local_key'] = array('students', 'local_key');
$this->map['first_name'] = array('students', 'first');
$this->map['last_name'] = array('students', 'last');
$this->map['address_1'] = array('students', 'addr1');
$this->map['address_2'] = array('students', 'addr2');
$this->map['town'] = array('students', 'city');
$this->map['postcode'] = array('students', 'zip');
$this->map['state'] = array('students', 'province');
$this->map['country'] = array('students', 'country');
$this->map['phone'] = array('students', 'dayphone');
$this->map['email_address'] = array('students', 'email');
$this->map['gender'] = array('students', 'sex');
$this->map['password'] = array('students', 'password');
//$this->map['sangha'] = array('students', 'sangha');
$this->map['sangha_name'] = array(
'LEFT JOIN sanghas AS s ON st.sangha = s.ID'
ID, retreatUID, studentID, regDate, regModifDate, headset, checkIn, checkOut,
checkedInOut, chairInTemple, disability, translationTo, norota, rotaUID, firstChoice,
secondChoice, thirdChoice, rotaText, statusQuo, statusQuoText, activity, retreatTotal,
rigpaDonation, donationPurposeUID, retFundAmount, transactionTrace, paymentStatus,
cancel, cancelDate, PaymentMode, LogIn, LogOut, amountStillDue, paymentComment,
comment_payment, comment_accomodation, comment_overview, DayRateFee, IDinOTHER
ID, retName, retOptionName, retStart, retEnd, rankDisplay, headSetFee, retFee1, retFee1closeDate, retFee2, retFee2closeDate, retFee3, retFee3closeDate, status, special, family, child, useRotaFrom, fullPeriodDiscount, displayRetreatOnline, retreatPhoto, displayName, retreatWarning, chooseMeals, maxLunch, bookFullPeriod, minDays, bookPersonalTent, maxPersonalTents, sponsorsBookOnline, rotaChoices, childrenPossible, transportPossible
$this->map['retId'] = array('retreat', 'ID');
$this->map['retName'] = array('retreat', 'retName');
$this->map['retOptionName'] = array('retreat', 'retOptionName');
$this->map['rtStatus'] = array('retreat', 'status');
$this->map['regId'] = array('retreatReg', 'ID');
$this->map['retreatUID'] = array('retreatReg', 'retreatUID');
$this->map['student_first'] = array(
'LEFT JOIN students AS st ON reg.studentID = st.local_key'
$this->map['student_last'] = array(
'LEFT JOIN students AS st ON reg.studentID = st.local_key'
$this->map['retreat_status'] = array(
'LEFT JOIN retreat AS rt ON reg.retreatUID = rt.ID'
$this->map['retreat_name'] = array(
'retreat','retName','concat(retName," ", retOptionName)',
'LEFT JOIN retreat AS rt ON reg.retreatUID = rt.ID'
concat(rt.retName," ", rt.retOptionName) AS retreat_name,
st.first AS student_first,
LEFT JOIN retreat AS rt ON rt.ID = reg.retreatUID
LEFT JOIN students AS st ON st.local_key = reg.studentID
order by rt.status desc , retreat_name, student_last
$this->select('regId', 'retreat_name', 'student_first', 'student_last', 'retreat_status');
$this->order_by ('retreat_status','DESC');
$this->order_by ('retreat_name');
$this->order_by ('student_last');
return $this->rows_array();
$this->select('local_key', 'first_name', 'last_name');
$this->where('email_address', "=", $Email);
$this->where('password', "=", md5($PassWord));
return $this->row_array();
$this->query = "select sj.group_uid, u.cat_name
from user_group u, stud_grp_join sj
where sj.student_uid = $id
and sj.group_uid = u.cat_id";
return $this->rows_array();
$this->query = "select ui_element_id, parent, user_group, access_type
from ui_elements, ui_access
where ui_element_id = ui_element
and controller = '$controller'";
return $this->rows_array();
$this->order_by('last_name');
return $this->rows_array();
$this->query = ("select sj.ID, sj.student_uid, s.first, s.last, u.cat_name
from user_group u,students s, stud_grp_join sj
where s.local_key = sj.student_uid
and sj.group_uid = u.cat_id
return $this->rows_array();
$this->query = ("select code, stdName, iso3 from country ");
return $this->rows_array();
$this->query('delete from students');
$sql = 'ALTER TABLE students AUTO_INCREMENT = 0';
$this->query('delete from stud_grp_join');
$sql = 'ALTER TABLE stud_grp_join AUTO_INCREMENT = 0';
$this->query('delete from user_group');
$sql = 'ALTER TABLE user_group AUTO_INCREMENT = 0';
$this->query('delete from country');
$sql = 'ALTER TABLE country AUTO_INCREMENT = 0';
$this->query('delete from sanghas');
$sql = 'ALTER TABLE country AUTO_INCREMENT = 0';
|