%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php error_reporting(E_ALL); define('DB_SERVER','shardauniversity.cluster-c8m5zlhotfbm.ap-south-1.rds.amazonaws.com'); define('DB_USERNAME','campus_user'); define('DB_PASSWORD' ,"sPV@bM2hhR6&"); define('DB_DATABASE', 'sharda_campus_db'); define('COMPANY', "ShardaTech pvt ltd."); /* Connect to MySQL and select the database. */ $conn = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE); if (!$conn) { mysqli_connect_error(); } mysqli_set_charset($conn, "utf8"); try { $recordArray = getTeachingScheme($conn); echo $ctotalnumrow = count($recordArray); // die; $cpmArray = getcoursePpapersetterModerator($conn); $coursetypeArray = getCoursetype($conn); $employeeArray = getEmployeeMaster($conn); //Get COs List $cosArray = getCos($conn); $courseArray = getCourse($conn); // Marks $marksArray = getMarks($conn); // BTL $btlArray = getBTL($conn); $unitArray = getUnit($conn); $creditArray = getQtemplate($conn); $ccr=0; $cr=0; foreach($recordArray as $row) { if($row['cpm_id']>0) { //echo $row['course_id']; die; $courseRow = @$courseArray[$row['course_id']]; if(!empty($courseRow)) { $course_id = $row['course_id']; $cpm_id = $row['cpm_id']; $pcmNewRow = $cpmArray[$cpm_id]; $paper_setter = explode(',',$pcmNewRow['paper_setter']); // Question Bank Template for TEMPLATE FOR QUESTION BANK (FOR ≥ 3 CREDIT COURSES) $units_acad_prog = $courseRow['units_acad_prog']; $setterArray = array(); //print_r($row); die; $ex = 0; foreach($paper_setter as $val) { $user_id = $val; $qcount = 0; // Get total question count $nrecords = getTotalQBankRecords($conn, $user_id, $course_id); $qcount = count($nrecords); if($qcount==0){ foreach($creditArray as $crow) { $cos_id = $crow['cos_id']; $marks_id = $crow['marks_id']; $btl_id = $crow['btl_id']; $params = array( 'user_id'=>$user_id, 'course_id'=>$course_id, 'cos_id'=>$cos_id, 'mark_id'=>$marks_id, 'btl_id'=>$btl_id, 'status'=>'1', 'created_on'=>date('Y-m-d H:i:s'), 'display_order'=>'1' ); // Validate the question $existingArray = getQBankRecords($conn, $user_id, $cos_id, $marks_id, $btl_id, $course_id); // Update the record if(count($existingArray)>0) { //$id = $existingArray['id']; //$resp = $this->Questionbank_Model->updateinfo('tbl_questionbank',$params,'id',$id); $cr++; } else { // Save the records $quesCount = $crow['total_question']; if($quesCount>1){ for($k=1;$k<=$quesCount; $k++){ if($user_id>0){ $sqlQ2 = "INSERT INTO tbl_questionbank SET user_id='".$user_id."',`course_id`='".$course_id."',`cos_id`='".$cos_id."',`mark_id`='".$marks_id."',`btl_id`='".$btl_id."',`status`='1',`created_on`='".date('Y-m-d H:i:s')."',`display_order`='1', qb_academic_year_id='2'"; mysqli_query($conn,$sqlQ2); $ccr++; } } } else { if($user_id>0){ $sql = "INSERT INTO tbl_questionbank SET user_id='".$user_id."',`course_id`='".$course_id."',`cos_id`='".$cos_id."',`mark_id`='".$marks_id."',`btl_id`='".$btl_id."',`status`='1',`created_on`='".date('Y-m-d H:i:s')."',`display_order`='1', qb_academic_year_id='2'"; mysqli_query($conn,$sql); $ccr++; } } } } } else { $ex++; } } } } } } //catch exception catch(Exception $e) { echo 'Message: ' .$e->getMessage(); } echo ' Thanks!!! Three or More Credit Cronjobs executed successfully. <br/><br/> We have Total <strong>'.$ctotalnumrow.'</strong> records in our system. <strong>'.$ccr.'</strong> records Added and <strong>'.$cr.'</strong> records updated successfully AND duplicate '.$ex; echo '<br/><br/><a href="https://ezone.sharda.ac.in/questionbank/admin/dashboard">Back to home</a>'; exit(); /* * Function : getcoursePpapersetterModerator */ function getcoursePpapersetterModerator($conn) { $sql = "select * from tbl_course_papersetter_moderator where `is_deleted` = '0' AND `status` = '1' AND academic_year_id='2'"; $result = mysqli_query($conn, $sql); $responseArray = array(); while($row = mysqli_fetch_array($result)) { $responseArray[$row['id']] = $row; } return $responseArray; } /* * Function : getQtemplate */ function getQtemplate($conn) { $sql = "select * from tbl_qtemplate where `is_deleted` = '0' AND `status` = '1' AND credit ='3'"; $result = mysqli_query($conn, $sql); $responseArray = array(); while($row = mysqli_fetch_array($result)) { $responseArray[$row['id']] = $row; } return $responseArray; } /* * Function : getTotalQBankRecords */ function getTotalQBankRecords($conn, $user_id, $course_id) { $sql = "select id,user_id from tbl_questionbank where user_id='".$user_id."' AND course_id='".$course_id."' AND status='1' AND qb_academic_year_id='2'"; $result = mysqli_query($conn, $sql); $responseArray = array(); while($row = mysqli_fetch_array($result)) { $responseArray[] = $row; } return $responseArray; } /* * Function : getQBankRecords */ function getQBankRecords($conn, $user_id, $cos_id, $marks_id, $btl_id, $course_id) { $sql = "select id,user_id from tbl_questionbank where user_id='".$user_id."' AND cos_id='".$cos_id."' AND mark_id='".$marks_id."' AND btl_id='".$btl_id."' AND course_id='".$course_id."' AND status='1' AND qb_academic_year_id='2'"; $result = mysqli_query($conn, $sql); $responseArray = array(); while($row = mysqli_fetch_array($result)) { $responseArray[] = $row; } return $responseArray; } /* * Function : coursetypeArray */ function getCourse($conn) { $sql = "select * from tbl_course where `is_deleted` = '0' AND `status` = '1' AND units_acad_prog>='3'"; $result = mysqli_query($conn, $sql); $responseArray = array(); while($row = mysqli_fetch_array($result)) { $responseArray[$row['id']] = $row; } return $responseArray; } /* * Function : coursetypeArray */ function getCoursetype($conn) { $sql = "select id,title,description from tbl_coursetype where `is_deleted` = '0' AND `status` = '1'"; $result = mysqli_query($conn, $sql); $responseArray = array(); while($row = mysqli_fetch_array($result)) { $responseArray[$row['id']] = $row; } return $responseArray; } /* * Function : getTeachingScheme */ function getTeachingScheme($conn) { $sql = "select * from tbl_teaching_scheme where `is_deleted` = '0' AND `status` = '1' AND total_ques='0' AND academic_year_id='2'"; $result = mysqli_query($conn, $sql); $responseArray = array(); while($row = mysqli_fetch_array($result)) { $responseArray[$row['id']] = $row; } return $responseArray; } /* * Function : getEmployeeMaster */ function getEmployeeMaster ($conn) { $sql = "select * from tbl_employee_master where `is_deleted` = '0' AND `status` = '1' AND 'hr_status'='A'"; $result = mysqli_query($conn, $sql); $responseArray = array(); while($row = mysqli_fetch_array($result)) { $responseArray[$row['id']] = $row; } return $responseArray; } /* * Function : getCos */ function getCos($conn) { $sql = "select id,title from tbl_cos where `is_deleted` = '0' AND `status` = '1'"; $result = mysqli_query($conn, $sql); $responseArray = array(); while($row = mysqli_fetch_array($result)) { $responseArray[$row['id']] = $row; } return $responseArray; } /* * Function : getMarks */ function getMarks($conn) { $sql = "select id,title from tbl_marks where `is_deleted` = '0' AND `status` = '1'"; $result = mysqli_query($conn, $sql); $responseArray = array(); while($row = mysqli_fetch_array($result)) { $responseArray[$row['id']] = $row; } return $responseArray; } /* * Function : getBTL */ function getBTL($conn) { $sql = "select id,title from tbl_btl where `is_deleted` = '0' AND `status` = '1'"; $result = mysqli_query($conn, $sql); $responseArray = array(); while($row = mysqli_fetch_array($result)) { $responseArray[$row['id']] = $row; } return $responseArray; } /* * Function : getUnit */ function getUnit($conn) { $sql = "select id,title from tbl_unit where `is_deleted` = '0' AND `status` = '1'"; $result = mysqli_query($conn, $sql); $responseArray = array(); while($row = mysqli_fetch_array($result)) { $responseArray[$row['id']] = $row; } return $responseArray; } ?>