Welcome Guest, Not a member yet? Register   Sign In
Need help on query string
#7

[eluser]nandish[/eluser]
[size=1]<?php
/* Created By Nandish on 13th June 2008 */
Class Csubscript extends Controller{

function Csubscript(){
parent::Controller();
$this->load->model('Msubscript');
$this->load->library('SEHelper');
}
//-----------------------------------------------------------------------------------------------------------------
function index(){
if(!$this->sehelper->checkSession()) return;
$roleid = $this->sehelper->getUserRole();
$schname = $this->sehelper->getUserShortSchoolName();
$year = date('Y'); //initially assigning year , state and school when the page loads
$state = '';
$schName = '';
$this->showData($state,$schName,$year);
}
//-------------------------------------------------------------------------------------------------------------------
// get the schools dropdown according to the particular value of state
function schoolDdown(){
if(!$this->sehelper->checkSession()) return;
$state = $this->uri->segment(3);
$result = $this->Msubscript->getschool($state);
echo "School:<select id='lschl' name='lschl'>";
if(count($result)>0){
echo "<option value='Select a School'>Select a School</option>";
foreach($result as $item){
echo "<option value='".$item['s_school_name']."'>".$item['s_school_name']."</option>";
}
"</select>";
}else {
echo "There is No SCHOOLS to display";
}
}
//-------------------------------------------------------------------------------------------------------------------
// get the year dropdown according to the particular value of school
function yearDdown(){
if(!$this->sehelper->checkSession()) return;
$school = $this->uri->segment(3);
if($school == 'ALL'){ //if the user select All (school name)
$school = '%';
}
$result = $this->Msubscript->getyear($school);
if(count($result)>0){
echo "Year:<select name='lyear' id='lyear'>";
foreach($result as $item){
echo "<option value='".$item['s_year']."'>".$item['s_year']."</option>";
}
echo "</select>";
}else {
echo "There is No YEAR to display";
}
}
//-------------------------------------------------------------------------------------------------------------------
function showData($state,$schName,$year){
if(!$this->sehelper->checkSession()) return;

// Checking User Role Privilage
$privId = "WEBUSER_SUBSCRIPTION";
$userRole = $this->sehelper->getUserRole();
if ($this->SEModel->checkRolePrivileges($privId, $userRole) == "0"){
redirect('');
}
$data['sres'] = $this->Msubscript->getAllstate(); //initially loading all states in state dropdown
$allSchools = $this->Msubscript->getAllschools(); //initially loading all schools in school dropdown
$data['yres'] = $this->Msubscript->getAllyear(); //initially loading all year in year dropdown
$data['Aroles'] = $this->Msubscript->getAllroles();
$data['Aplans'] = $this->Msubscript->getAllplans();

// Check if State has valid value
if ($state == '') {
$state = 'MI';
}

// Check if School Name is passed in or not.
// If so, pick the first school in the array.
if ($schName == '') {
foreach ($allSchools as $rec) {
$schName = $rec['s_school_name'];
break;
}
}

// For safety, just initialize to Troy Athens High
if ($schName == ''){
$schName = 'Troy Athens High';
}
$data['schres'] = $allSchools; //storing all schools in an array
$data['res'] = $this->Msubscript->getAlldata($state,$schName,$year); //get user information
$data['gstate'] = $state;
$data['schname'] = $schName;
$data['Year'] = $year;
$this->load->view('vsubscript',$data);
}
//--------------------------------------------------------------------------------------------------------------------
function usreload(){ //reloading the user subscription page with different values;
if(!$this->sehelper->checkSession()) return;
error_reporting(0);
if(isset($_REQUEST['ustate'])){
$ustate = $_REQUEST['ustate'];
}
if(isset($_REQUEST['lschl'])){
$uschl = $_REQUEST['lschl'];
if($uschl == 'ALL'){
$uschl = '%';
}
}
if(isset($_REQUEST['lyear'])){
$uyear = $_REQUEST['lyear'];
}
$this->showData($ustate,$uschl,$uyear);
}
[/size]


Messages In This Thread
Need help on query string - by El Forum - 07-31-2008, 12:21 AM
Need help on query string - by El Forum - 07-31-2008, 01:05 AM
Need help on query string - by El Forum - 07-31-2008, 01:14 AM
Need help on query string - by El Forum - 07-31-2008, 03:11 AM
Need help on query string - by El Forum - 07-31-2008, 04:32 AM
Need help on query string - by El Forum - 07-31-2008, 05:08 AM
Need help on query string - by El Forum - 08-02-2008, 05:51 AM
Need help on query string - by El Forum - 08-02-2008, 05:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB