function getAverage($testObj, $no) { $list = array(); $list = getAllMarksOfTestArranged($testObj, 'DESC'); if ($no >= count($list) || $no == 0 || $no == NULL || $no == '') { $no = count($list) / 4; } $no = round($no, 0); if ($no == 0) { $no++; } $avg = 0; for ($i = 0; $i < $no; $i++) { $avg += $list[$i][1]->getDisplayMark1(); } $temp = $avg / $no; $temp = round($temp, 2); return $temp; //echo $temp; }
if (isset($_POST['smsID'])) { $smsID = trim($_POST['smsID']); } else { echo "No Sms Selected"; die; } $testObj = getTest($testID); $temparray = array(); for ($i = 0; $i < 3; $i++) { if (isset($_POST['to' . $i]) && $_POST['to' . $i] == 1) { array_push($temparray, $i); } } $list = array(); $studentarray = array(); $list = getAllMarksOfTestArranged($testObj, 'DESC'); //echo count($list)."<br />"; for ($i = 0; $i < count($list); $i++) { if (isset($_POST['id' . $list[$i][0]->getID()]) && $_POST['id' . $list[$i][0]->getID()] == 1) { //$ID = $list[$i][0]->getID(); //$tempStudent=getStudent($ID,0); $number = getStudentSmsNumber($list[$i][0], $temparray); $sms = getSmsTemplate($smsID); $test = prepSms($list[$i][0], $list[$i][1], $testObj, $sms, $custom); //echo $test."<br />"; $request = getSmsSendInfo($number, $test); //echo $request." ".$list[$i][0]->getID()."<br />"; $sent = count($temparray); if ($sent == 0) { $sent = 1; }