for ($j = 0; $j < count($template_array); $j++) { if ($result == $template_array[$j]) { array_push($result_array, $i); } } $template_array_count = count($template_array); $result_array_count = count($result_array); } if ($template_array_count != $result_array_count) { $error_flag = 2; } for ($excel_index = 2; $excel_index <= $count; $excel_index++) { for ($templete_index = 0; $templete_index < count($result_array); $templete_index++) { $c_head = $data->val(1, $data->colindexes[$result_array[$templete_index]]); $result = $data->val($excel_index, $data->colindexes[$result_array[$templete_index]]); $excel_array = array_push_assoc($excel_array, $c_head, $result); print_r($excel_array); } $account_number = $excel_array['Account Number']; $task_number = $excel_array['TASK NO']; $icrm_upload_date_time = date('Y-m-d H:i:s'); echo $excel_array['Account Number']; if ($account_number != "") { if ($error_flag != 2) { echo $account_number . " " . $task_number; $update_sql = "UPDATE `base` SET `icrm_flag`='1',`task_no`='{$task_number}',`icrm_udt`='{$icrm_upload_date_time}' WHERE `account_number`='{$account_number}'"; mysql_query($update_sql) or die(mysql_error()); } } } function array_push_assoc($array, $key, $value)
function update_congregation_rows($KeyArray, $RawDataFile) { $UpdateResults['errors'] = 0; $UpdateResults['updates'] = 0; $UpdateResults['ignored'] = 0; $UpdateResults['deleted'] = 0; while (!feof($RawDataFile)) { $newRow = fgetcsv($RawDataFile); // loop through the arrays to create a new // associative array $newArray = array(); $LoopCount = count($KeyArray); for ($loop = 0; $loop < $LoopCount; $loop++) { $newArray = array_push_assoc($newArray, $KeyArray[$loop], $newRow[$loop]); } // create the congregation class $UpdateCongregation = new Congregation(); // check to see if we need to delete it first if (strtolower($newArray['updatecode']) == 'd') { // check to see if it even exists, otherwise, ignore it. if ($UpdateCongregation->get_congregation_by_PIN($newArray['pin'])) { // check to see if it has been flagged for no auto updates if ($UpdateCongregation->DoNotAutoUpdate) { // marked to not update - log it and stop. add_congregation_search_update_log('INFO', 'Congregation ' . $newArray['pin'] . ' is locked to not allow updates. Delete request ignored.'); $UpdateResults['ignored']++; } elseif (delete_congregation($newArray['pin'])) { add_congregation_search_update_log('DELETE', 'Congregation ' . $newArray['pin'] . ' was deleted.'); $UpdateResults['deleted']++; } else { add_congregation_search_update_log('ERROR', 'Congregation ' . $newArray['pin'] . ' could not be deleted.'); $UpdateResults['errors']++; } } } else { // first see if the congregation exists and make certain we d if (!$UpdateCongregation->get_congregation_by_PIN($newArray['pin'])) { // if false, this is a new congregation - lets create it $UpdateCongregation->PIN = $newArray['pin']; $UpdateCongregation->CongregationName = $newArray['congregationname']; $UpdateCongregation->EIN = $newArray['ein']; $UpdateCongregation->Address1 = $newArray['address1']; $UpdateCongregation->Address2 = $newArray['address2']; $UpdateCongregation->City = $newArray['city']; $UpdateCongregation->State = $newArray['state']; $UpdateCongregation->PostalCode = $newArray['postalcode']; $UpdateCongregation->Phone = $newArray['phone']; $UpdateCongregation->Email = $newArray['email']; $UpdateCongregation->Website = $newArray['website']; $UpdateCongregation->Region = $newArray['region']; if (array_key_exists('latitude', $newArray) && array_key_exists('longitude', $newArray)) { // if latitude and longitude were provided then add them $UpdateCongregation->Latitude = $newArray['latitude']; $UpdateCongregation->Longitude = $newArray['longitude']; } else { if ($UpdateCongregation->Address1 != '' && $UpdateCongregation->City != '' && $UpdateCongregation->State != '') { //geocode the address and add it to the record $newLatLong = get_congregation_city_state_latlong($UpdateCongregation->Address1 . ', ' . $UpdateCongregation->City . ', ' . $UpdateCongregation->State); if ($newLatLong != null) { $UpdateCongregation->Latitude = $newLatLong['location']['lat']; $UpdateCongregation->Longitude = $newLatLong['location']['long']; add_congregation_search_update_log('GEOCODE_SUCCESS', 'Congregation ' . $newArray['pin'] . ' was successfully geocoded.'); } else { add_congregation_search_update_log('GEOCODE_FAILURE', 'Congregation ' . $newArray['pin'] . ' could not be geocoded.'); } } } // save and log the result $SavedCongregationResults = $UpdateCongregation->save_new_congregation(); if ($SavedCongregationResults) { add_congregation_search_update_log('ADDED', 'Congregation ' . $newArray['pin'] . ' was added.'); $UpdateResults['updates']++; } else { add_congregation_search_update_log('ERROR', 'Congregation ' . $newArray['pin'] . ' could not be added: ' . $SavedCongregationResults); $UpdateResults['errors']++; } } else { // first checked to see if it's been flagged to not update, // then check to see if the updated data is more recent // than the current data in the database // We do this because update file contain updated for the last 7 days, // in case a previous update execution created an error that // precented some data from being updated. // check for no auto updates to this congregation if ($UpdateCongregation->DoNotAutoUpdate) { add_congregation_search_update_log('INFO', 'Congregation ' . $newArray['pin'] . ' is locked to not allow updated. Update request ignored.'); $UpdateResults['ignored']++; } elseif (strtotime($UpdateCongregation->DateUpdated) < strtotime($newArray['lastupdated'])) { $UpdateCongregation->CongregationName = $newArray['congregationname']; $UpdateCongregation->EIN = $newArray['ein']; $UpdateCongregation->Address1 = $newArray['address1']; $UpdateCongregation->Address2 = $newArray['address2']; $UpdateCongregation->City = $newArray['city']; $UpdateCongregation->State = $newArray['state']; $UpdateCongregation->PostalCode = $newArray['postalcode']; $UpdateCongregation->Phone = $newArray['phone']; $UpdateCongregation->Email = $newArray['email']; $UpdateCongregation->Website = $newArray['website']; $UpdateCongregation->Region = $newArray['region']; if (array_key_exists('latitude', $newArray) && array_key_exists('longitude', $newArray)) { // now check to see if they exist in the database. If not, don't overwrite the data // as site-side lat/long data might be overwritten if ($newArray['latitude'] != '' && $newArray['longitude'] != '') { $UpdateCongregation->Latitude = $newArray['latitude']; $UpdateCongregation->Longitude = $newArray['longitude']; } } else { if ($UpdateCongregation->Latitude == 0.0 || $UpdateCongregation->Longitude == 0.0) { //geocode the address and add it to the record $newLatLong = get_congregation_city_state_latlong($UpdateCongregation->Address1 . ', ' . $UpdateCongregation->City . ', ' . $UpdateCongregation->State); if ($newLatLong != null) { $UpdateCongregation->Latitude = $newLatLong['location']['lat']; $UpdateCongregation->Longitude = $newLatLong['location']['long']; add_congregation_search_update_log('GEOCODE_SUCCESS', 'Congregation ' . $newArray['pin'] . ' was successfully geocoded.'); } else { add_congregation_search_update_log('GEOCODE_FAILURE', 'Congregation ' . $newArray['pin'] . ' could not be geocoded.'); } } } $UpdateCongregationResults = $UpdateCongregation->save_current_congregation(); if ($UpdateCongregationResults) { add_congregation_search_update_log('UPDATED', 'Congregation ' . $newArray['pin'] . ' was updated.'); $UpdateResults['updates']++; } else { add_congregation_search_update_log('ERROR', 'Congregation ' . $newArray['pin'] . ' could not be updated:' . $UpdateCongregationResults); $UpdateResults['errors']++; } } } } } // end while // close the data file fclose($RawDataFile); return $UpdateResults; }
$result = $conn->query($sql); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $produto = new Produto($row["id"], $row["descricao"], $row["valor"], $row["img"], $row["link"]); array_push($produtos, $produto); } } //create query to get all ppp; $sql = "SELECT p.id as id_pessoa, p.nome, \n\t\t\td.id as id_pedido,\n\t\t\tr.id as id_produto,r.descricao as prod_descpessoa,r.valor, \n\t\t\tppp.id as ppp_id,ppp.qtde,ppp.val_total\n\t\t\tFROM pessoa p,\n\t\t\tproduto r,\n\t\t\tpedido d,\n\t\t\tpessoa_prod_pedido ppp\n\t\t\tWHERE d.pedido_atual = 1\n\t\t\tAND ppp.id_pedido = d.id\n\t\t\tAND ppp.id_pessoa = p.id\n\t\t\tAND ppp.id_produto = r.id\n\t\t\tORDER BY p.id, r.id;"; $result = $conn->query($sql); $id_pessoa_aux = 0; $pppSingle; if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { if ($id_pessoa_aux != $row["id_pessoa"]) { if ($id_pessoa_aux > 0) { array_push($ppp, $pppSingle); } $id_pessoa_aux = $row["id_pessoa"]; $prod = array(); $prod = array_push_assoc($prod, $row["id_produto"], $row["qtde"]); $pppSingle = new PPPSingle($row["id_pessoa"], $row["nome"], $row["id_pedido"], $prod, $row["val_total"]); } else { $prod = array_push_assoc($prod, $row["id_produto"], $row["qtde"]); $pppSingle->set_produtos($prod); $pppSingle->increment_val_total($row["val_total"]); } } array_push($ppp, $pppSingle); } $conn->close();
function CheckAuthenticMail($userName, $toUsers, $toCCUsers, $toBCCUsers, $grpName = 'false') { $toAssArray = array(); $toCCAssArray = array(); $toBCCAssArray = array(); $notUserArray = array(); $toUserArray = explode(",", $toUsers); foreach ($toUserArray as $toUser) { $to = trim($toUser); // $sub = DBQuery("SELECT up.profile FROM staff as s,user_profiles as up WHERE s.profile_id=up.id AND s.username='******'"); $sub = DBQuery("SELECT * FROM login_authentication,user_profiles WHERE login_authentication.profile_id=user_profiles.id AND username='******'"); $RET = DBGet($sub); if (Count($RET) == 0) { // $student=DBQuery("SELECT * FROM students where username='******'"); // $st=DBGet($student); // if(Count($st)!=0) // { // $toProfile="student"; // $toAssArray=array_push_assoc($toAssArray,$toUser,$toProfile); // } // else // { array_push($notUserArray, $to); // } } else { $toProfile = $RET[1]['PROFILE']; $toAssArray = array_push_assoc($toAssArray, $toUser, $toProfile); } } // print_r($toAssArray); $toUserArray = array_diff($toUserArray, $notUserArray); $toCCUserArray = explode(",", $toCCUsers); foreach ($toCCUserArray as $toCCUser) { $toCC = trim($toCCUser); // $sub = DBQuery("SELECT up.profile FROM staff as s,user_profiles as up WHERE s.profile_id=up.id AND s.username='******'"); $sub = DBQuery("SELECT * FROM login_authentication,user_profiles WHERE login_authentication.profile_id=user_profiles.id AND username='******'"); $RET = DBGet($sub); if (Count($RET) == 0) { // $student=DBQuery("SELECT * FROM students where username='******'"); // $st=DBGet($student); // if(Count($st)!=0) // { // $toCCProfile="student"; // $toCCAssArray=array_push_assoc($toCCAssArray,$toCCUser,$toCCProfile); // } // else // { array_push($notUserArray, $toCC); // } } else { $toCCProfile = $RET[1]['PROFILE']; $toCCAssArray = array_push_assoc($toCCAssArray, $toCCUser, $toCCProfile); } } //print_r($toCCAssArray); $toCCUserArray = array_diff($toCCUserArray, $notUserArray); $toBCCUserArray = explode(",", $toBCCUsers); foreach ($toBCCUserArray as $toBCCUser) { $toBCC = trim($toBCCUser); //$sub = DBQuery("SELECT up.profile FROM staff as s,user_profiles as up WHERE s.profile_id=up.id AND s.username='******'"); $sub = DBQuery("SELECT * FROM login_authentication,user_profiles WHERE login_authentication.profile_id=user_profiles.id AND username='******'"); $RET = DBGet($sub); if (Count($RET) == 0) { // $student=DBQuery("SELECT * FROM students where username='******'"); // $st=DBGet($student); // if(Count($st)!=0) // { // $toBCCProfile="student"; // $toBCCAssArray=array_push_assoc($toBCCAssArray,$toBCCUser,$toBCCProfile); // } // else // { array_push($notUserArray, $toBCC); // } } else { $toBCCProfile = $RET[1]['PROFILE']; $toBCCAssArray = array_push_assoc($toBCCAssArray, $toBCCUser, $toBCCProfile); } } //print_r($toBCCAssArray); $toBCCUserArray = array_diff($toBCCUserArray, $notUserArray); $subject = $_REQUEST['txtSubj']; // echo $date=date("d/m/y H:i:s", time()); //$date=date("y/m/d H:i:s", time()); if ($subject == '') { $subject = 'No Subject'; } $mailBody = $_POST['txtBody']; $uploaded_file_count = count($_FILES['f']['name']); //$images=implode(",",$_FILES['f']['name']); for ($i = 0; $i < $uploaded_file_count; $i++) { $name = $_FILES['f']['name'][$i]; if ($name) { $path = $userName . '_' . time() . rand(00, 99) . $name; $folder = "./assets/" . $path; $temp = $_FILES['f']['tmp_name'][$i]; move_uploaded_file($temp, $folder); $arr[$i] = $folder; } else { $attachment = ""; } } //$attachment=implode(',../../assets/',$arr); //$attachment='../../assets/'.$attachment; $attachment = implode(',', $arr); $multipleUser = ''; $toAllowArr = array(); foreach ($toAssArray as $userTo => $profileTo) { // echo "<br/>";echo "<br/>"; // echo "<br/>toProfile= ".$profileTo; // echo "<br/>current Profile= ".User('PROFILE'); // echo "<br/>";echo "<br/>"; // echo "to user ".$userTo; if ($profileTo == 'admin') { array_push($toAllowArr, "yes"); $toAssArray[$userTo] = $profileTo . ",yes"; if ($multipleUser == "") { $multipleUser = trim($userTo); } else { $multipleUser = $multipleUser . "," . trim($userTo); } } else { if (User('PROFILE') == 'admin') { if ($profileTo != '') { array_push($toAllowArr, "yes"); $toAssArray[$userTo] = $profileTo . ",yes"; if ($multipleUser == "") { $multipleUser = trim($userTo); } else { $multipleUser = $multipleUser . "," . trim($userTo); } } } if (User('PROFILE') == 'teacher') { $teacher_id = UserID(); // echo $teacher_id; $studentNameArray = array(); // $sql='Select username from students where username is not null and student_id IN(Select distinct student_id from course_periods INNER JOIN schedule using(course_period_id) where course_periods.teacher_id=\''.$teacher_id.'\')'; $sql = 'Select username from login_authentication INNER JOIN students on user_id=student_id where profile_id=3 and username IS NOT NULL and student_id IN(Select distinct student_id from course_periods INNER JOIN schedule using(course_period_id) where course_periods.teacher_id=\'' . $teacher_id . '\')'; $studentNameArray = DBGet(DBQuery($sql)); // echo "<br> scheduled student"; // print_r($studentNameArray); //$sql1='SELECT username FROM staff WHERE username IS NOT NULL AND staff_id IN (SELECT DISTINCT staff_id FROM students_join_users WHERE student_id IN (SELECT student_id FROM students WHERE username IS NOT NULL AND student_id IN (SELECT DISTINCT student_id FROM course_periods INNER JOIN schedule USING (course_period_id ) WHERE course_periods.teacher_id = \''.$teacher_id.'\')))'; //$sql1='SELECT username FROM staff WHERE username IS NOT NULL AND staff_id IN (SELECT DISTINCT staff_id FROM students_join_users WHERE student_id IN (SELECT student_id FROM students WHERE student_id IN (SELECT DISTINCT student_id FROM course_periods INNER JOIN schedule USING (course_period_id ) WHERE course_periods.teacher_id = \''.$teacher_id.'\')))'; $sql1 = 'SELECT username FROM login_authentication WHERE profile_id=4 and username IS NOT NULL AND user_id IN (SELECT DISTINCT person_id FROM students_join_people WHERE student_id IN (SELECT student_id FROM students WHERE student_id IN (SELECT DISTINCT student_id FROM course_periods INNER JOIN schedule USING (course_period_id ) WHERE course_periods.teacher_id = \'' . $teacher_id . '\')))'; $parentNameArray = DBGet(DBQuery($sql1)); // echo "<br> scheduled student s parent"; // print_r($parentNameArray); $toUser = trim($userTo); $flag = 0; if ($profileTo == 'student') { foreach ($studentNameArray as $studentNameArr) { foreach ($studentNameArr as $studentName) { if ($toUser == $studentName) { $flag = 1; if ($multipleUser == "") { $multipleUser = trim($toUser); } else { $multipleUser = $multipleUser . "," . trim($toUser); } } } } } if ($profileTo == 'parent') { foreach ($parentNameArray as $parentNameArr) { foreach ($parentNameArr as $parentName) { if ($toUser == $parentName) { $flag = 1; if ($multipleUser == "") { $multipleUser = trim($toUser); } else { $multipleUser = $multipleUser . "," . trim($toUser); } } } } } if ($flag == 1) { $toAssArray[$userTo] = $profileTo . ",yes"; } else { $toAssArray[$userTo] = $profileTo . ",no"; } } if (User('PROFILE') == 'parent') { $parent_id = UserID(); // echo $parent_id; $teacherNameArray = array(); //$sql='Select username from staff where staff_id IN(Select distinct student_id from students_join_users where staff_id=\''.$parent_id.'\'))'; $sql = 'Select username from login_authentication where username is not null and profile_id=2 and user_id IN(Select distinct teacher_id from course_periods INNER JOIN schedule using(course_period_id) where student_id in(Select student_id from students where student_id IN(select student_id from students_join_people where person_id=\'' . $parent_id . '\')))'; $teacherNameArray = DBGet(DBQuery($sql)); // $toUser = trim($userTo); $flag = 0; if ($profileTo == 'teacher') { foreach ($teacherNameArray as $teacherNameArr) { foreach ($teacherNameArr as $teacherName) { if ($toUser == $teacherName) { $flag = 1; if ($multipleUser == "") { $multipleUser = trim($toUser); } else { $multipleUser = $multipleUser . "," . trim($toUser); } } } } } if ($flag == 1) { $toAssArray[$userTo] = $profileTo . ",yes"; } else { $toAssArray[$userTo] = $profileTo . ",no"; } } if (User('PROFILE') == 'student') { $studentId = UserStudentID(); $teacherNameArray = array(); //$sql='Select username from staff where staff_id IN(Select distinct teacher_id from course_periods INNER JOIN schedule using(course_period_id) where schedule.student_id=\''.$studentId.'\')'; $sql = 'Select username from login_authentication where username is not null and profile_id=2 and user_id IN(Select distinct teacher_id from course_periods INNER JOIN schedule using(course_period_id) where schedule.student_id=\'' . $studentId . '\')'; //echo $sql; $teacherNameArray = DBGet(DBQuery($sql)); // print_r($teacherNameArray); $toUser = trim($userTo); $flag = 0; if ($profileTo == 'teacher') { foreach ($teacherNameArray as $teacherNameArr) { foreach ($teacherNameArr as $teacherName) { if ($toUser == $teacherName) { $flag = 1; if ($multipleUser == "") { $multipleUser = trim($toUser); } else { $multipleUser = $multipleUser . "," . trim($toUser); } } } } } if ($flag == 1) { $toAssArray[$userTo] = $profileTo . ",yes"; } else { $toAssArray[$userTo] = $profileTo . ",no"; } } } } //echo "hello ".$multipleUser; $multipleCCUser = ''; foreach ($toCCAssArray as $userCCTo => $profileCCTo) { // echo "<br/>";echo "<br/>"; // echo "<br/>toCCProfile= ".$profileCCTo; // echo "<br/>current Profile= ".User('PROFILE'); // echo "<br/>";echo "<br/>"; // echo "to user ".$userCCTo; if ($profileCCTo == 'admin') { array_push($toAllowArr, "yes"); $toCCAssArray[$userCCTo] = $profileCCTo . ",yes"; if ($multipleCCUser == "") { $multipleCCUser = trim($userCCTo); } else { $multipleCCUser = $multipleCCUser . "," . trim($userCCTo); } } else { if (User('PROFILE') == 'admin') { if ($profileCCTo != '') { array_push($toAllowArr, "yes"); $toCCAssArray[$userCCTo] = $profileCCTo . ",yes"; if ($multipleCCUser == "") { $multipleCCUser = trim($userCCTo); } else { $multipleCCUser = $multipleCCUser . "," . trim($userCCTo); } } } if (User('PROFILE') == 'teacher') { $teacher_id = UserID(); //echo "<br/><br/> testing".$teacher_id; $studentNameArray = array(); // $sql='Select username from students where username is not null and student_id IN(Select distinct student_id from course_periods INNER JOIN schedule using(course_period_id) where course_periods.teacher_id=\''.$teacher_id.'\')'; $sql = 'Select username from login_authentication INNER JOIN students on user_id=student_id where profile_id=3 and username IS NOT NULL and student_id IN(Select distinct student_id from course_periods INNER JOIN schedule using(course_period_id) where course_periods.teacher_id=\'' . $teacher_id . '\')'; $studentNameArray = DBGet(DBQuery($sql)); // echo "<br> scheduled student"; // print_r($studentNameArray); // $sql1='Select username from staff where username is not null and staff_id IN(Select distinct student_id from students_join_users where staff_id=\''.$teacher_id.'\')'; //$sql1='SELECT username FROM staff WHERE username IS NOT NULL AND staff_id IN (SELECT DISTINCT staff_id FROM students_join_users WHERE student_id IN (SELECT student_id FROM students WHERE student_id IN (SELECT DISTINCT student_id FROM course_periods INNER JOIN schedule USING (course_period_id ) WHERE course_periods.teacher_id = \''.$teacher_id.'\')))'; $sql1 = 'SELECT username FROM login_authentication WHERE profile_id=4 and username IS NOT NULL AND user_id IN (SELECT DISTINCT person_id FROM students_join_people WHERE student_id IN (SELECT student_id FROM students WHERE student_id IN (SELECT DISTINCT student_id FROM course_periods INNER JOIN schedule USING (course_period_id ) WHERE course_periods.teacher_id = \'' . $teacher_id . '\')))'; $parentNameArray = DBGet(DBQuery($sql1)); // echo "<br> scheduled student s parent"; // print_r($parentNameArray); // $toCCUser = trim($userCCTo); $flag = 0; if ($profileCCTo == 'student') { foreach ($studentNameArray as $studentNameArr) { foreach ($studentNameArr as $studentName) { if ($toCCUser == $studentName) { $flag = 1; if ($multipleCCUser == "") { $multipleCCUser = trim($toCCUser); } else { $multipleCCUser = $multipleCCUser . "," . trim($toCCUser); } } } } } if ($profileTo == 'parent') { // $flag=0; foreach ($parentNameArray as $parentNameArr) { foreach ($parentNameArr as $parentName) { if ($toCCUser == $parentName) { $flag = 1; if ($multipleCCUser == "") { $multipleCCUser = trim($toCCUser); } else { $multipleCCUser = $multipleCCUser . "," . trim($toCCUser); } } } } } if ($flag == 1) { $toCCAssArray[$userCCTo] = $profileCCTo . ",yes"; } else { $toCCAssArray[$userCCTo] = $profileCCTo . ",no"; } } if (User('PROFILE') == 'parent') { $parent_id = UserID(); // echo "<br/><br/> testing".$parent_id; $teacherNameArray = array(); $sql = 'Select username from staff where staff_id IN(Select distinct student_id from students_join_users where staff_id=\'' . $parent_id . '\'))'; $teacherNameArray = DBGet(DBQuery($sql)); // $toCCUser = trim($userCCTo); $flag = 0; if ($profileCCTo == 'teacher') { // $flag=0; foreach ($teacherNameArray as $teacherNameArr) { foreach ($teacherNameArr as $teacherName) { if ($toCCUser == $teacherName) { $flag = 1; if ($multipleCCUser == "") { $multipleCCUser = trim($toCCUser); } else { $multipleCCUser = $multipleCCUser . "," . trim($toCCUser); } } } } } if ($flag == 1) { $toCCAssArray[$userCCTo] = $profileCCTo . ",yes"; } else { $toCCAssArray[$userCCTo] = $profileCCTo . ",no"; } } if (User('PROFILE') == 'student') { $studentId = UserStudentID(); $teacherNameArray = array(); //$sql='Select username from staff where staff_id IN(Select distinct teacher_id from course_periods INNER JOIN schedule using(course_period_id) where schedule.student_id=\''.$studentId.'\')'; $sql = 'Select username from login_authentication where username is not null and profile_id=2 and user_id IN(Select distinct teacher_id from course_periods INNER JOIN schedule using(course_period_id) where schedule.student_id=\'' . $studentId . '\')'; //echo $sql; $teacherNameArray = DBGet(DBQuery($sql)); // print_r($teacherNameArray); $toCCUser = trim($userCCTo); $flag = 0; if ($profileCCTo == 'teacher') { foreach ($teacherNameArray as $teacherNameArr) { foreach ($teacherNameArr as $teacherName) { if ($toCCUser == $teacherName) { $flag = 1; if ($multipleCCUser == "") { $multipleCCUser = trim($toCCUser); } else { $multipleCCUser = $multipleCCUser . "," . trim($toCCUser); } } } } } if ($flag == 1) { $toCCAssArray[$userCCTo] = $profileCCTo . ",yes"; } else { $toCCAssArray[$userCCTo] = $profileCCTo . ",no"; } } } } //echo "<br/><br/>hello ".$multipleCCUser; $multipleBCCUser = ''; // print_r($BCCprofileArr); foreach ($toBCCAssArray as $userBCCTo => $profileBCCTo) { // echo "<br/>";echo "<br/>"; // echo "<br/>toCCProfile= ".$profileCCTo; // echo "<br/>current Profile= ".User('PROFILE'); // echo "<br/>";echo "<br/>"; // echo "to user ".$userCCTo; if ($profileBCCTo == 'admin') { array_push($toAllowArr, "yes"); $toBCCAssArray[$userBCCTo] = $profileBCCTo . ",yes"; if ($multipleBCCUser == "") { $multipleBCCUser = trim($userBCCTo); } else { $multipleBCCUser = $multipleBCCUser . "," . trim($userBCCTo); } } else { if (User('PROFILE') == 'admin') { if ($profileBCCTo != '') { array_push($toAllowArr, "yes"); $toBCCAssArray[$userBCCTo] = $profileBCCTo . ",yes"; if ($multipleBCCUser == "") { $multipleBCCUser = $userBCCTo; } else { $multipleBCCUser = $multipleBCCUser . "," . trim($userBCCTo); } } } if (User('PROFILE') == 'teacher') { $teacher_id = UserID(); //echo "<br/><br/> testing".$teacher_id; $studentNameArray = array(); //$sql='Select username from students where username is not null and student_id IN(Select distinct student_id from course_periods INNER JOIN schedule using(course_period_id) where course_periods.teacher_id=\''.$teacher_id.'\')'; $sql = 'Select username from login_authentication INNER JOIN students on user_id=student_id where profile_id=3 and username IS NOT NULL and student_id IN(Select distinct student_id from course_periods INNER JOIN schedule using(course_period_id) where course_periods.teacher_id=\'' . $teacher_id . '\')'; $studentNameArray = DBGet(DBQuery($sql)); // echo "<br> scheduled student"; // print_r($studentNameArray); //$sql1='Select username from staff where username is not null and staff_id IN(Select distinct student_id from students_join_users where staff_id=\''.$teacher_id.'\')'; //$sql1='SELECT username FROM staff WHERE username IS NOT NULL AND staff_id IN (SELECT DISTINCT staff_id FROM students_join_users WHERE student_id IN (SELECT student_id FROM students WHERE student_id IN (SELECT DISTINCT student_id FROM course_periods INNER JOIN schedule USING (course_period_id ) WHERE course_periods.teacher_id = \''.$teacher_id.'\')))'; $sql1 = 'SELECT username FROM login_authentication WHERE profile_id=4 and username IS NOT NULL AND user_id IN (SELECT DISTINCT person_id FROM students_join_people WHERE student_id IN (SELECT student_id FROM students WHERE student_id IN (SELECT DISTINCT student_id FROM course_periods INNER JOIN schedule USING (course_period_id ) WHERE course_periods.teacher_id = \'' . $teacher_id . '\')))'; $parentNameArray = DBGet(DBQuery($sql1)); // echo "<br> scheduled student s parent"; // print_r($parentNameArray); // $toBCCUser = trim($userBCCTo); $flag = 0; if ($profileBCCTo == 'student') { foreach ($studentNameArray as $studentNameArr) { foreach ($studentNameArr as $studentName) { if ($toBCCUser == $studentName) { $flag = 1; if ($multipleBCCUser == "") { $multipleBCCUser = $toBCCUser; } else { $multipleBCCUser = $multipleBCCUser . "," . $toBCCUser; } } } } } if ($profileTo == 'parent') { foreach ($parentNameArray as $parentNameArr) { foreach ($parentNameArr as $parentName) { if ($toBCCUser == $parentName) { $flag = 1; if ($multipleBCCUser == "") { $multipleBCCUser = $toBCCUser; } else { $multipleBCCUser = $multipleBCCUser . "," . $toBCCUser; } } } } } if ($flag == 1) { $toBCCAssArray[$userBCCTo] = $profileBCCTo . ",yes"; } else { $toBCCAssArray[$userBCCTo] = $profileBCCTo . ",no"; } } if (User('PROFILE') == 'parent') { $parent_id = UserID(); // echo "<br/><br/> testing".$parent_id; $teacherNameArray = array(); //$sql='Select username from staff where staff_id IN(Select distinct student_id from students_join_users where staff_id=\''.$parent_id.'\'))'; $sql = 'Select username from login_authentication where username is not null and profile_id=2 and user_id IN(Select distinct teacher_id from course_periods INNER JOIN schedule using(course_period_id) where student_id in(Select student_id from students where student_id IN(select student_id from students_join_people where person_id=\'' . $parent_id . '\')))'; $teacherNameArray = DBGet(DBQuery($sql)); // $toBCCUser = trim($userBCCTo); $flag = 0; if ($profileCCTo == 'teacher') { foreach ($teacherNameArray as $teacherNameArr) { foreach ($teacherNameArr as $teacherName) { if ($toBCCUser == $teacherName) { $flag = 1; if ($multipleBCCUser == "") { $multipleBCCUser = $toBCCUser; } else { $multipleBCCUser = $multipleBCCUser . "," . $toBCCUser; } } } } } if ($flag == 1) { $toBCCAssArray[$userBCCTo] = $profileBCCTo . ",yes"; } else { $toBCCAssArray[$userBCCTo] = $profileBCCTo . ",no"; } } if (User('PROFILE') == 'student') { $studentId = UserStudentID(); $teacherNameArray = array(); //$sql='Select username from staff where staff_id IN(Select distinct teacher_id from course_periods INNER JOIN schedule using(course_period_id) where schedule.student_id=\''.$studentId.'\')'; $sql = 'Select username from login_authentication where username is not null and profile_id=2 and user_id IN(Select distinct teacher_id from course_periods INNER JOIN schedule using(course_period_id) where schedule.student_id=\'' . $studentId . '\')'; $teacherNameArray = DBGet(DBQuery($sql)); // print_r($teacherNameArray); $toBCCUser = trim($userBCCTo); $flag = 0; if ($profileBCCTo == 'teacher') { foreach ($teacherNameArray as $teacherNameArr) { foreach ($teacherNameArr as $teacherName) { if ($toBCCUser == $teacherName) { $flag = 1; if ($multipleBCCUser == "") { $multipleBCCUser = $toBCCUser; } else { $multipleBCCUser = $multipleBCCUser . "," . $toBCCUser; } } } } } if ($flag == 1) { $toBCCAssArray[$userBCCTo] = $profileBCCTo . ",yes"; } else { $toBCCAssArray[$userBCCTo] = $profileBCCTo . ",no"; } } } } //echo "<br/>hello ".$multipleBCCUser; $notUserArray = array_filter($notUserArray); $multipleUserArr = explode(",", $multipleUser); $multipleUserArr = array_unique($multipleUserArr); $multipleUser = implode(",", $multipleUserArr); $multipleCCUserArr = explode(",", $multipleCCUser); $multipleCCUserArr = array_unique($multipleCCUserArr); $multipleCCUser = implode(",", $multipleCCUserArr); $multipleBCCUserArr = explode(",", $multipleBCCUser); $multipleBCCUserArr = array_unique($multipleBCCUserArr); $multipleBCCUser = implode(",", $multipleBCCUserArr); if ($multipleUser != "") { $toArr = explode(",", $multipleUser); $toCCArr = explode(",", $multipleCCUser); $toBCCArr = explode(",", $multipleBCCUser); foreach ($notUserArray as $notUser) { if (($key = array_search($notUser, $toArr)) !== false) { unset($toArr[$key]); } } foreach ($notUserArray as $notUser) { if (($key = array_search($notUser, $toCCArr)) !== false) { unset($toCCArr[$key]); } } foreach ($notUserArray as $notUser) { if (($key = array_search($notUser, $toBCCArr)) !== false) { unset($toBCCArr[$key]); } } $multipleUser = implode(",", $toArr); $multipleCCUser = implode(",", $toCCArr); $multipleBCCUser = implode(",", $toBCCArr); $mailBody = htmlspecialchars($mailBody); SendMail($multipleUser, $userName, $subject, $mailBody, $attachment, $multipleCCUser, $multipleBCCUser, $grpName); $notAllowArr = array(); foreach ($toAssArray as $userTo => $profileTo) { $chkallowUserArr = explode(",", $profileTo); // echo "<br/>"; // print_r($chkallowUserArr); foreach ($chkallowUserArr as $chk) { if ($chk == 'no') { array_push($notAllowArr, $userTo); } } } foreach ($toCCAssArray as $userCCTo => $profileCCTo) { $chkallowUserArr = explode(",", $profileCCTo); // echo "<br/>"; // print_r($chkallowUserArr); foreach ($chkallowUserArr as $chk) { if ($chk == 'no') { array_push($notAllowArr, $userCCTo); } } } foreach ($toBCCAssArray as $userBCCTo => $profileBCCTo) { $chkallowUserArr = explode(",", $profileBCCTo); // echo "<br/>"; // print_r($chkallowUserArr); foreach ($chkallowUserArr as $chk) { if ($chk == 'no') { array_push($notAllowArr, $userBCCTo); } } } // print_r($notAllowArr); $notAllowArr = array_filter($notAllowArr); $notAllowArr = array_unique($notAllowArr); if (count($notAllowArr) > 0) { echo "<br/><br/>Message was not sent to " . implode(",", $notAllowArr); } $notUserArray = array_filter($notUserArray); if (count($notUserArray) != 0) { $notUser = implode(",", $notUserArray); if ($notUser != "") { echo "<br/><br/>Message was not sent to " . $notUser . " as they not exist"; } } } else { $notUserArray = array_filter($notUserArray); $noUser = implode(",", $notUserArray); echo "Message was not sent to " . $noUser . " as they not exist"; // echo '<div style=text-align:centre><table cellpadding=5 cellspacing=5 class=alert_box ><tr><td class=alert></td><td class=alert_msg ><b>message not sent</b></td></tr><tr><td colspan=2 class=clear></td></tr></table></div>'; } }
$outerwidth = $parentInnerWidth * ($focNumerator / $focDenominator); return $outerwidth; } else { throw new Exception("Div without wid, add to output instead of input, to avoid a mistake in the css"); } //end else } catch (Exception $e) { echo 'Error: ', $e->getMessage(), "\n"; } } //end function $defaults = array(); for ($i = 0; $i <= $attrsLength; $i++) { //loop through the attribute => value pairs for each div in the array $valueOfAttr = $doc["span:eq(0)"]->attr("{$attrs[$i]}"); $defaults = array_push_assoc($defaults, $attrs[$i], $valueOfAttr); } //close defaults function cssEdges($divNum, $edgeType) { return edgeGetter($divNum, "t{$edgeType}") . "px " . edgeGetter($divNum, "r{$edgeType}") . "px " . edgeGetter($divNum, "b{$edgeType}") . "px " . edgeGetter($divNum, "l{$edgeType}") . "px;"; } function cssAdd($i, $attribute, $tag, $fallback) { //assign attribute to tag or use default global $i; global $divs; global $defaults; global $css; $css .= " {$attribute}:"; if ($divs[$i]["{$tag}"] != null) {