public static function json() { $progress = new progress(); $data = $progress->fetch_raid($_GET['raid']); header('Content-Type: application/json'); return json_encode($data, JSON_PRETTY_PRINT); }
function _crawl_recursive($uri) { if (++$this->_iteration_counter > WEB_SPIDER_ITERATION_LIMIT) { return; } progress::write_notice("{$uri}"); $content = ''; if ($fd = fopen($uri, 'r')) { while ($line = fgets($fd, 2000)) { $content .= $line; } fclose($fd); } if ($content) { $this->_uri_contents[$uri] =& $content; $uris = $this->_get_content_hrefs(&$content); foreach ($uris as $uri) { if (!($uri = $this->_normalize_uri($uri))) { continue; } if (isset($this->_uri_contents[$uri])) { continue; } $this->_crawl_recursive($uri); } } }
public static function results_as_columns($results) { $header[] = get_string('choiceoptions', 'choice'); $votes[] = get_string('numberofuser', 'choice'); $percent[] = get_string('numberofuserinpercentage', 'choice'); $graph[] = get_string('responsesresultgraphheader', 'choice'); foreach ($results as $result) { $header[] = $result['text']; $votes[] = $result['votes']; $percent[] = format_float($result['percent'], 1) . '%'; $graph[] = progress::level($result['percent']); } return array('header' => $header, 'rows' => array($votes, $percent, $graph)); }
function cleanup() { $this =& progress::instance(); $this->db->sql_delete('sys_progress', "session_id='{$this->session_id}' OR (" . time() . "-time) > " . PROGRESS_MAX_MESSAGE_LIFETIME); }
<?php /********************************************************************************** * Copyright 2004 BIT, Ltd. http://www.0x00.ru, mailto: bit@0x00.ru * * Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html) *********************************************************************************** * * $Id: progress.php 401 2004-02-04 15:40:14Z server $ * ***********************************************************************************/ ob_start(); require_once 'setup.php'; require_once LIMB_DIR . '/core/lib/util/progress.class.php'; if (!isset($_GET['last_message_id'])) { $last_message_id = -1; } else { $last_message_id = (int) $_GET['last_message_id']; } $js = ''; if ($messages = progress::get_messages_since($last_message_id)) { foreach ($messages as $message) { $time_formatted = date('H:i:s', $message['time']); $js .= "top.add_message('{$time_formatted}', '{$message['id']}', '{$message['name']}', '{$message['message']}', '{$message['status']}');\n"; } $last_message_id = $message['id']; $js .= "top.set_last_message_id({$last_message_id});\n"; } $js .= "setTimeout('top.retrieve_messages()', 1000);\n"; echo "<html>\r\n<script language='javascript'>\r\n{$js}\r\n</script>\r\n<html>"; ob_end_flush();
public function test_empty_progress_bar() { $expected = '<div class=progress><div class=bar style="width:0%"></div></div>'; $actual = progress::bar(0); $this->assertSame($expected, $actual); }
function raidOverview() { $userRank = user::rank(); // Call DB Connector $callDB = new PGSdb(); $callDB->connDB(); $raidFetch = $_GET['raid']; $validRaids = array("Firelands" => "FL", "Dragon Soul" => "DS", "Mogu'shan Vaults" => "MSV", "Heart of Fear" => "HoF", "Terrace of Endless Spring" => "ToES", "Throne of Thunder" => "ToT", "Siege of Orgrimmar" => "SoO", "Highmaul" => "HM", "Blackrock Foundry" => "BRF"); if (array_search($raidFetch, $validRaids, true)) { $raidFullName = array_search($raidFetch, $validRaids, true); //For ease of use $progress = new progress(); $data = $progress->fetch_raid($raidFetch); //Fetch media for the specific raid //Prepare $raidMediaPrep = $callDB->db->prepare("SELECT * FROM guildmedia WHERE mediaRaid = :raidShort AND Status='1'"); $raidMediaPrep->execute(array('raidShort' => $raidFetch)); //Result $raidMedia = $raidMediaPrep->fetchAll(PDO::FETCH_ASSOC); //Prepare $raidSpecificsPrep = $callDB->db->prepare("SELECT * FROM raid_archive WHERE short = :raidShort"); $raidSpecificsPrep->execute(array('raidShort' => $raidFetch)); //Result $raidSpecifics = $raidSpecificsPrep->fetch(PDO::FETCH_ASSOC); $raidMediaArr = json_decode($raidSpecifics['media'], true); //Split boss names apart $bossSeperator = '/,\\s*/'; $bossNames = preg_split($bossSeperator, $raidSpecifics['bossNames']); echo ' <div id="content-header-wrapper"> <div id="content-header-content"><div id="content-header-content-expand">▼</div> <div class="navLocBar-noWrap"><a href="' . site_url . 'progress">Raid</a> > ' . $raidFullName . '</div> <div id="content-header-btns-right">'; if ($userRank >= 1) { echo '<button type="button" class="btn btn-green" onclick="wbox.show(\'addMediaDiv\');"><span class="ion-plus"></span> Add Media</button>'; } echo ' </div> </div> </div> <div id="content-content"> <div class="progressionBarFull ' . $raidFetch . '">'; if ($userRank >= "4") { echo ' <div id="raidProgressionSettingsBtn" class="aniObj" onclick="wbox.show(\'editProgression\');editProgression();"> <span class="ion-gear-b"></span> </div>'; } if (@$data->info['bossCount']['M'] != null) { echo '<div id="raidProgressionNumbers"><span id="regRaidProgression">' . $data->progress['N'] . '</span>/' . $data->info['bossCount']['N'] . 'R | <span id="hRaidProgression">' . $data->progress['H'] . '</span>/' . $data->info['bossCount']['H'] . 'H | <span id="mRaidProgression">' . $data->progress['M'] . '</span>/' . $data->info['bossCount']['M'] . 'M</div>'; } else { echo '<div id="raidProgressionNumbers"><span id="regRaidProgression">' . $data->progress['N'] . '</span>/' . $data->info['bossCount']['N'] . 'R | <span id="hRaidProgression">' . $data->progress['H'] . '</span>/' . $data->info['bossCount']['H'] . 'H</div>'; } foreach ($data->modes as $mode) { echo '<div class="progressBarFrame"><div id="' . $mode . 'Progressbar"><div class="raidDifcProgressBarText"></div></div></div>'; } echo ' <br/> </div> <script>'; foreach ($data->modes as $mode) { echo 'window.setTimeout(function(){progress.raidBar(\'' . $mode . 'Progressbar\',\'' . $data->progress[$mode] / $data->info['bossCount'][$mode] * 100 . '\');}, 500);'; } echo ' </script> <div class="progressTopicContents"> <div id="mediaGallery">'; $curBoss = 0; foreach ($bossNames as $boss) { $mediaIDItem = 0; echo '<div class="media-boss"> <div class="media-boss-name"><strong>' . $boss . '</strong></div>'; // echo var_dump($raidMediaArr[$curBoss]['screenshots'][0]); if (@$raidMediaArr[$curBoss] != null) { foreach ($raidMediaArr[$curBoss]['screenshots'] as $mediaItems) { echo '<div class="progressMediaFullItem b-lazy-loading"><img class="b-lazy" src="/img/1080placeholder.png" data-src="' . $mediaItems['url'] . '" />'; if ($userRank >= "4") { echo '<div class="editMediaWrapper"><div class="editMedia" onclick="wbox.show(\'editMedia\');progress.media.info(\'' . $raidFetch . '\', ' . $curBoss . ', \'screenshots\',' . $mediaIDItem . ');"><span class="ion-edit"></span></div></div>'; } echo '</div>'; $mediaIDItem = $mediaIDItem + 1; } } echo '</div>'; $curBoss = $curBoss + 1; } echo '</div>'; // Closing for #content-content // foreach (($raidMedia) as $row){ // if ($row['mediaType'] === 'screenshot'){ // echo ' // <div class="progressMedia"> // <div class="mediaPreview"> // <div class="progressMediaImg">'; // if ($userRank >= "4") // { // echo'<div class="editMediaWrapper"><div class="editMedia" onclick="wbox.show(\'editMedia\');fetchMediaInfo('.$row['id'].');"><span class="ui-icon ui-icon-pencil"></span></div></div>'; // } // echo ' // <img src="'.$row['mediaLink'].'" onclick="WBoxmedia(\'img\',\''.$row['mediaLink'].'\');"> // </div> // </div> // <div class="progressmediaLink"> // [Img] '.$row['mediaTitle'].'</a><br/> // </div> // </div>'; // } // elseif ($row['mediaType'] === 'video'){ // echo ' // <div class="progressMedia"> // <div class="mediaPreview"> // <div class="progressMediaImg">'; // if ($userRank >= "4"){ // echo'<div class="editMediaWrapper"><div class="editMedia" onclick="wbox.show(\'editMedia\');fetchMediaInfo('.$row['id'].');"><span class="ui-icon ui-icon-pencil"></span></div></div>'; // } // echo ' // <img src="http://img.youtube.com/vi/'.$row['mediaLink'].'/1.jpg" onclick="WBoxmedia(\'vid\',\''.$row['mediaLink'].'\');" /> // </div> // </div> // <div class="progressmediaLink"> // [Vid] '.$row['mediaTitle'].'</a><br/> // </div> // </div> // '; // } // else // {} // } if ($userRank >= "4") { ?> <script> function editProgression(){ <?php foreach ($data->modes as $mode) { ?> $(function(){ // Progress Sliders $('#slider<?php echo $mode; ?> ', '#WBox').slider({ value:<?php echo $data->progress[$mode]; ?> , min:0, max:<?php echo $data->info['bossCount'][$mode]; ?> , step:1, slide:function(event,ui){ $('#<?php echo $mode; ?> ProgressionEditor', '#WBox').val(ui.value); } }); $('#<?php echo $mode; ?> ProgressionEditor', '#WBox').val($('#slider<?php echo $mode; ?> ', '#WBox').slider('value')); }); <?php } ?> } </script> <div id="editMedia" class="wbox" data-height="215px" data-width="335px" data-max-width="100%"> <div class="wbox-title">Edit media</div> <div class="wbox-content"> <input type="text" id="mediaTitleEdit" class="lot" placeholder="Media Title" disabled="disabled"> <input type="text" id="mediaLinkEdit" class="lot" placeholder="Media Link" disabled="disabled"><br/><br/> <select id="mediaTypeEdit" class="TmpstLoT" placeholder="Media Type" disabled="disabled"> <option value="screenshot">Screenshot (Image)</option> <option value="video">Video (YouTube)</option> </select> <select id="raidBossSelUpdate" class="lot aniObject"> <option value="Blank">-- Select instance encounter --</option> </select><br/><br/> </div> <div class="WBoxBtns"> <input type="button" id="mediaUpdateBtn" class="WBox-btn btn-green aniObject" value="Save" onclick="progress.media.update('<?php echo $raidFetch; ?> ');" disabled="disabled" /> </div> </div> <div id="editProgression" class="wbox" data-height="300px" data-width="345px" data-max-width="100%"> <div class="wbox-title">Edit media</div> <div class="wbox-content"> <div id="<?php echo $raidFetch; ?> " class="progressionEditorTop <?php echo $raidFetch; ?> "> <div class="progressionEditorRaid"><?php echo $raidFullName; ?> </div> <div class="progressionEditorVals"><input id="NProgressionEditor" maxlength="2" readonly="readonly" style="width:20px; font-size:18px; color:white; background:transparent; border:0px; text-align:right;" value="<?php echo $data->progress['N']; ?> " />/<?php echo $data->info['bossCount']['N']; ?> R | <input id="HProgressionEditor" maxlength="2" readonly="readonly" style="width:20px; font-size:18px; color:white; background:transparent; border:0px; text-align:right;" value="<?php echo $data->progress['H']; ?> " />/<?php echo $data->info['bossCount']['H']; ?> H | <input id="MProgressionEditor" maxlength="2" readonly="readonly" style="width:20px; font-size:18px; color:white; background:transparent; border:0px; text-align:right;" value="<?php echo $data->progress['M']; ?> " />/<?php echo @$data->info['bossCount']['M']; ?> M</div> </div><br/> <?php foreach ($data->modes as $mode) { echo ' <div class="progressionMiniSliderDIV"> <span class="progressionEditorDiff">' . $mode . ' ' . $raidFetch . ' Progression:</span> <div id="slider' . $mode . '"></div> </div>'; } ?> </div> <div class="WBoxBtns"> <input type="button" onclick="progress.update('<?php echo $raidFetch; ?> ');" class="WBox-btn btn-green aniObj" value="Save" /> </div> </div> <?php } if ($userRank >= 1) { ?> <div id="addMediaDiv" class="wbox" data-height="195px" data-width="335px" data-max-width="100%"> <div class="wbox-title">Add guild media</div> <div class="wbox-content"> <select id="mediaType" class="lot aniObject"> <option value="Blank">-- Select media type --</option> <option value="screenshot">Screenshot (Image)</option> <option value="video">Video (YouTube)</option> </select> <select id="raidBossSel" class="lot aniObject"> <option value="Blank">-- Select instance encounter --</option> </select> <input type="text" id="mediaTitle" class="lot aniObject" name="mediaTitle" placeholder="Media Title"> <input type="text" id="mediaLink" class="lot aniObject" name="mediaLink" placeholder="Img ID or Video ID"> </div> <div class="WBoxBtns"> <input type="button" id="addMediaBtn" class="WBox-btn btn-green aniObject" onclick="progress.media.submit('<?php echo $raidFetch; ?> ');" value="Submit"> </div> </div> <script> window.setTimeout(function(){ progress.media.getRaidDetails('<?php echo $raidFetch; ?> '); }, 500); </script> <?php } echo '</div></div> <div class="progressClearSpace"></div> <script> var bLazy = new Blazy({ success: function(element){ setTimeout(function(){ var parent = element.parentNode; parent.className = parent.className.replace(/\\bloading\\b/,""); }, 200); } }); </script> '; } else { echo 'Invalid Raid'; } }
$numOfQu = $topics->getNumOfQu(); $percentage = $topics->getRawToPass(); $myQuiz->setTopicID($topic); $myQuiz->setQuestionLimit($numOfQu); $myQuiz->setRawToPass($percentage); $myQuiz->evaluateQuiz(); } else { // kein Test bearbeitet } break; case "requestCert": $topic = 0; if (isset($_REQUEST["t_id"])) { $topic = abs(intval($_REQUEST["t_id"])); } $progress = new progress(); $progress->setTopic($topic); $progress->getProgress(); $topics->setTopicID($topic); $percentage = $topics->getRawToPass(); $haspassed = false; foreach ($progress->progress as $entry) { if ($entry['number'] > 0) { $currentperc = 100 * $entry['correct'] / (1.0 * $entry['number']); if ($currentperc >= $percentage) { $haspassed = true; } } } if ($haspassed) { // A paper/PDF certificate for passing the test has been requested.