Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.147.46.174
<?php
function PopulateUserSubjectList($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
session_start();
$user_type = $aobj_context->mobj_data["userType"];
$degree = $aobj_context->mobj_data["degree"];
$module = $aobj_context->mobj_data["module"];
$collegeCode = $_SESSION['collcode'];
if ($module == 'FSUBCODE')
$subid = "(IFNULL(s.FINTASS,'F') = 'T' or IFNULL(s.FSUBSIDARY,'F') = 'T')";
else
$subid = "IFNULL(s.FINTASS,'F') = 'F' and IFNULL(s.FTHEORY,'F') = 'F'";
$subj_query = "select distinct s.fdegree as fdegree,s.fexamno,d.fexamname,fcsubcode as fsubcode, fsubname,fssubname,fsmaxmarks
from subject s
inner join colldeg c on s.fdegree = c.fdegree and s.fdegree = '$degree'
inner join degree d on s.fdegree = d.fdegree and s.fexamno = d.fexamno
where c.fcollcode = '$collegeCode' and {$subid}
order by s.fexamno, s.fcsubcode,s.fsubname;";
$lobj_subj_query = $aobj_context->mobj_db->GetAll($subj_query);
$subj_selected_query = "select {$module} from usersub where Fuser ='{$user_type}' and Fcollegecode='{$collegeCode}' and FDEGREE='{$degree}'";
$lobj_subj_selected = $aobj_context->mobj_db->GetRow($subj_selected_query);
$lobj_subj = $lobj_subj_selected[$module];
$subjArry = array();
$subjArry = explode('*', $lobj_subj);
$module_data = "<table style='padding:3px 4px 3px 3px;' class='tr_ventor_row' id='user_rights_table_data' width='95%' border='0' cellspacing='0' cellpadding='0'>";
$module_data .= "<th align='left' colspan='6' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:24px;'>Subjects</th>";
$module_data .= "<tr class='ui-state-default ui-jqgrid-hdiv'>";
$module_data .= "<td align='center' style='width:20px; font-size:12px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Exam</td>";
$module_data .= "<td align='center' style='width:30px; font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Subject Code</td>";
$module_data .= "<td align='center' style='width:240px; font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Subject Name</td>";
$module_data .= "<td align='center' style='width:40px; font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Element</td>";
$module_data .= "<td align='center' style='width:40px; font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Max Marks</td>";
$module_data .= "<td align='center' style='width:20px; font-size:12px; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><input type=checkbox id=check_Allrow onclick='selectAllUserSubject();'/ ></td>";
$module_data .= "</tr>";
foreach ($lobj_subj_query as $key => $value) {
$is_subject_checked = '';
for ($j = 0; $j < count($subjArry); $j++) {
if ($value[fsubcode] == $subjArry[$j]) {
$is_subject_checked = "checked";
break;
}
}
$module_data .= "<tr class='ui-widget-content jqgrow'>";
$module_data .= "<td class='tbl_row_new' style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px; {$group_color} width:20px;text-align:center;' id=subjcode_{$value[fexamno]}>{$value[fexamname]}</td>";
$module_data .= "<td class='tbl_row_new' style='border-right:1px solid #C5DBEC; padding:2px; font-size:12px; {$group_color} width:30px;text-align:center;' id=subjcode_{$value[fsubcode]}>{$value[fsubcode]}</td>";
$module_data .= "<td class='tbl_row_new' style='border-right:1px solid #C5DBEC; padding:5px; font-size:12px; {$group_color} width:240px;' id=subjname_{$value[fsubname]}>{$value[fsubname]}</td>";
$module_data .= "<td class='tbl_row_new' style='border-right:1px solid #C5DBEC; padding:5px; font-size:12px; {$group_color} width:40px; text-align:center;' id=subjname_{$value[fssubname]}>{$value[fssubname]}</td>";
$module_data .= "<td class='tbl_row_new' style='border-right:1px solid #C5DBEC; padding:5px; font-size:12px; {$group_color} width:40px; text-align:center;' id=subjname_{$value[fsmaxmarks]}>{$value[fsmaxmarks]}</td>";
$module_data .= "<td class='tbl_row_new' style='border-right:1px solid #C5DBEC; padding:2px; font-size:12px; {$group_color} width:20px;text-align:center;' id=row_check_{$value[fsubcode]}><input type=checkbox id=check_row_{$value[fsubcode]} {$is_subject_checked} value={$value[fsubcode]} ></input></td>";
$module_data .= "</tr>";
}
$module_data .= "</table>";
$arr['module_id_details'] = $lobj_subj_query;
$arr['html_data'] = $module_data;
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
}
function saveUserSelectedSubjectList($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
session_start();
$user_type = $aobj_context->mobj_data["userType"];
$degree = $aobj_context->mobj_data["degree"];
$subjSelected = $aobj_context->mobj_data["subjSelected"];
$module = $aobj_context->mobj_data["module"];
$collegeCode = $_SESSION['collcode'];
$check_user = "select count(*) as userCnt from usersub where Fuser ='{$user_type}' and Fcollegecode='{$collegeCode}' and FDEGREE='{$degree}'";
$lobj_rs = $aobj_context->mobj_db->GetRow($check_user);
if (($lobj_rs[userCnt]) > 0) {
$subjUpdate_query = "UPDATE usersub set {$module}='{$subjSelected}' where Fuser ='{$user_type}' and Fcollegecode='{$collegeCode}' and FDEGREE='{$degree}'";
$lobj_subjInsert_query = $aobj_context->mobj_db->Execute($subjUpdate_query);
$sucess_blog = "Successfully Updated";
} else {
$subjInsert_query = "INSERT INTO usersub(FUSER,FDEGREE,{$module},FCOLLEGECODE)values('{$user_type}','{$degree}','{$subjSelected}','{$collegeCode}')";
$lobj_subjInsert_query = $aobj_context->mobj_db->Execute($subjInsert_query);
$sucess_blog = "Successfully Inserted";
}
$error_blog = "Error in Inserting Data";
if ($lobj_subjInsert_query)
echo $aobj_context->mobj_output->ToJSONEnvelope($sucess_blog, 0, "success");
else
echo $aobj_context->mobj_output->ToJSONEnvelope($error_blog, -1, "error");
}
|