Beispiel #1
0
 function TalksByMemberID($memberID)
 {
     $SpeakerList = new ArrayList();
     // Pull any talks that belong to this Summit and are owned by member
     $talksMemberOwns = $this->Talks("`OwnerID` = " . $memberID . " AND `SummitID` = " . $this->ID);
     $SpeakerList->merge($talksMemberOwns);
     // Now pull any talks that belong to this Summit and the member is listed as a speaker
     $speaker = Speaker::get()->filter('memberID', $memberID)->first();
     if ($speaker) {
         $talksMemberIsASpeaker = $speaker->TalksBySummitID($this->ID);
         // Now merge and de-dupe the lists
         $SpeakerList->merge($talksMemberIsASpeaker);
         $SpeakerList->removeDuplicates('ID');
     }
     return $SpeakerList;
 }
Beispiel #2
0
<?php

include '../../src/speaker.php';
class SystemLoad extends SpeakerEvents
{
    function update()
    {
        return '一分前: ' . sys_getloadavg()[0] . ', 五分前: ' . sys_getloadavg()[1] . ', 十五分前: ' . sys_getloadavg()[2];
    }
    function check()
    {
        return true;
    }
}
$speaker = new Speaker();
$speaker->sleepTime = 2;
$speaker->addListener('', new SystemLoad());
$speaker->start();
Beispiel #3
0
<?php

include '../src/speaker.php';
class Test extends SpeakerEvents
{
    function update()
    {
        return 'ok';
    }
    function check()
    {
        return true;
    }
}
$speaker = new Speaker();
$speaker->addListener('', new Test());
$speaker->start();
Beispiel #4
0
        array_push($chat, $_GET['content']);
    } else {
        $chat = [$_GET['content']];
    }
    file_put_contents('chat.json', json_encode($chat));
} else {
    class Chatroom extends SpeakerEvents
    {
        private $chat = '';
        function __construct()
        {
            $this->chat = file_get_contents('chat.json');
        }
        function update()
        {
            return end(json_decode($this->chat));
        }
        function check()
        {
            $newestChat = file_get_contents('chat.json');
            if ($newestChat == $this->chat) {
                return false;
            }
            $this->chat = $newestChat;
            return true;
        }
    }
    $speaker = new Speaker();
    $speaker->addListener('', new Chatroom());
    $speaker->start();
}