This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getHoverElement: function(autoBox) { //should look through the autocomplete box and find which one is hovering and return {prev: previousElement, hover: elementWithHover, next: nextElement} | |
//if there are no hovers the return should be {prev: firstElement, hover: null, lastElement}, if there are no elements in the box the return should be null | |
var items = autoBox.getElementsByTagName("li"), | |
m = items.length - 1, | |
returnValues = { | |
prev: null, | |
hover: null, | |
next: items[m] | |
}; | |
if (m > -1) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function attachEvent(el, action, callback){ | |
if (el.addEventListener) { | |
el.addEventListener(action, callback, false); | |
} else if (el.attachEvent) { | |
el.attachEvent('on' + action, (function (ele) { return callback; })(el) ); | |
} | |
} | |
inputKeyup: function (courseType){//event that's triggered on the input keyups | |
var currentRequest; | |
return function (e){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var uiElement = { | |
compiledTemplate: undefined, | |
template: undefined, | |
toHTML: function(newTemplate) { | |
if (typeof this.compiledTemplate !== 'function' || newTemplate) { | |
this.compileTemplate(newTemplate || this.template); | |
} | |
return this.compiledTemplate(this.toObjectLiteral); | |
}, | |
compileTemplate: function(newTemplate) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('Content-Type: text/event-stream'); | |
header('Cache-Control: no-cache'); // recommended to prevent caching of event data. | |
/** | |
* Constructs the SSE data format and flushes that data to the client. | |
* | |
* @param string $id Timestamp/id of this connection. | |
* @param string $msg Line of text that should be transmitted. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
if (!!window.EventSource) { | |
var source = new EventSource('serverSentEvent.php'); | |
} else { | |
// Result to xhr polling :( | |
} | |
source.addEventListener('message', function(e) { | |
console.log(e.data); | |
}, false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function markMessagesRead($mysqli, $replyValue){ | |
$allMessages = $this->getAllMessages($mysqli); | |
$replyCheck = function ($message){ | |
return $message.getAttribute($mysqli, "reply", "Reply") == $replyValue; | |
}; | |
foreach(array_filter($allMessages, $replyCheck) as $messageItem){ | |
$messageItem->setFirstViewDate($mysqli); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$stmt = $mysqli->prepare("INSERT INTO `Quizes` (`Name`, `Course ID`, `Session ID`, `User ID`) VALUES (?,?,?,?)"); | |
error_log($stmt->error); | |
$stmt->bind_param('ssss',$quizOptions['name'], $quizOptions['classID'], $quizOptions['sessionID'], $_SESSION['user_ID']); | |
$stmt->execute(); | |
$returnID = $mysqli->insert_id; | |
$stmt->close(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class objectCourse { | |
public $id; | |
public $subjectID; | |
public function loadSubjectID($mysqli) { | |
$stmt = $mysqli->prepare("SELECT `Subject ID` FROM `Courses` WHERE `ID` = ?"); | |
$stmt->bind_param('s',$this->id); | |
$stmt->execute(); | |
$stmt->bind_result($subjectID); | |
$found = false; | |
while($stmt->fetch()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var udemObj = { | |
set: function (options){ | |
for(option in options){ | |
if (this[option] !== undefined){ | |
this[option] = options[option]; | |
} | |
} | |
return this; | |
}, | |
toObjectLiteral: function (){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function getCurrentAttempt($mysqli){ | |
include_once('global/objects/objectQuizAttempt.php'); | |
//error_log("QUIZ INSTANCE ID: " . $this->getID()); | |
$stmt = $mysqli->prepare("SELECT `ID` FROM `Quiz Attempts` WHERE `Quiz Instance ID` = ? ORDER BY `ID` DESC LIMIT 1"); | |
$stmt->bind_param('s',$this->getID()); | |
$stmt->execute(); | |
$stmt->bind_result($attemptID); | |
$stmt->fetch(); | |
$stmt->close(); | |
error_log("QUIZ INSTANCE ID " . $this->getID() . " ATTEMPT ID: " . $attemptID); |
OlderNewer