/** * Get HTML representation of the given object. * @param Feed $object object to be converted to HMTL. * @return string HTML representation of the object */ public static function getHTML($object, $shine = '') { // Format username $username = FeedV::_getUsername($object->user_id); $username_displayed = ucwords($username); $feed_meta_simple = ''; // Format simple meta feed $feedMetaSimpleMapper = new Mapper('Feed'); $feedMetaSimpleMapper->ljoin('Meta', 'meta.target_id = feed.id')->filter('meta.target_type=(?)', 'feed')->filter('meta.name=(?)', 'sharer_id')->filter('meta.target_id=(?)', $object->id)->filter('meta.type=(?)', 'simple'); $feedMetaSimpleResults = $feedMetaSimpleMapper->get(); $shared_feed = false; if (count($feedMetaSimpleResults['Meta']) >= 1) { $username_displayed = 'Shared by ' . ucwords(FeedV::_getUsername($feedMetaSimpleResults['Meta'][0]->value)); $shared_feed = true; } // Format advanced meta feed $root_id = 0; $root_id = FeedV::findFirstRootID($object->id); $feed_meta_advanced = $feed_meta_simple; $feed_status = 'feed_success'; $feed_folder = joinPaths(CHRIS_USERS, $username, $object->plugin, $object->name . '-' . $object->id); if ($handle = opendir($feed_folder)) { while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != "..") { $match = glob($feed_folder . '/' . $entry . '/_chrisRun_/ERR*'); if (count($match)) { $feed_status = 'feed_failure'; break; } if ($feed_status == 'feed_failure') { break; } } } } // create the status text $status_text = '<span style="background-color: #009DE9;color: #fff;padding: 1px 2px;">Running<i class="icon-refresh rotating_class"></i></span>'; // ('.$object->status.'%) if ($feed_status == 'feed_failure') { $status_text = '<span style="background-color: #E90000;color: #fff;padding: 1px 2px;">Errors</span>'; $feed_status = 'feed_success'; } else { if ($object->status == 100) { $status_text = '<span style="background-color: #41E900;color: #fff;padding: 1px 2px;">Success</span>'; } else { if ($object->status == 101) { $status_text = '<span style="background-color: #E95D00;color: #fff;padding: 1px 2px;">Canceled</span>'; } } } $view_icon = 'icon-eye-open'; $share_icon = 'icon-share-alt'; $tag_icon = 'icon-tag'; $archive_icon = 'icon-remove'; $archive_text = 'Archive'; if ($object->archive == '1') { $archive_icon = 'icon-plus'; $archive_text = 'Restore'; } $favorite_icon = 'icon-star-empty'; $favorite_text = 'Favorite'; if ($object->favorite == '1') { $favorite_icon = 'icon-star'; $favorite_text = '<b>Favorited</b>'; } $edit_icon = ''; $cancel = ''; $view = "display:none"; if ($object->status >= 100 || $shared_feed) { $edit_icon = "<img class='feed_edit_icon show_me focus' src='view/gfx/jigsoar-icons/dark/16_edit_page2.png'>"; // if the job is not queued or running, don't display the cancel icon // also if the feed was shared $cancel = "display:none"; $view = ""; } $t = new Template('feed.html'); $t->replace('ID', $object->id); $t->replace('ROOT_ID', $root_id); $feed_gfx64 = 'plugins/' . $object->plugin . '/feed.png'; $feed_gfx64_checked = 'view/gfx/feed_checked.png'; if (!is_file(joinPaths(CHRIS_WWWROOT, $feed_gfx64))) { $feed_gfx64 = 'http://placehold.it/48x48'; } $t->replace('IMAGE_SRC', $feed_gfx64); $t->replace('IMAGE_CHECKED', $feed_gfx64_checked); $t->replace('USERNAME', $username_displayed); $t->replace('FEED_STATUS', $feed_status); $t->replace('FEED_NAME', $object->name); $t->replace('FEED_META_CONTENT', $feed_meta_advanced); $t->replace('TIME_FORMATED', $object->time); $t->replace('PLUGIN', ucwords(str_replace('_', ' ', $object->plugin))); $t->replace('STATUS', $object->status); $t->replace('STATUS_TEXT', $status_text); $t->replace('VIEW_ICON', $view_icon); $t->replace('SHARE_ICON', $share_icon); $t->replace('TAG_ICON', $tag_icon); $t->replace('ARCHIVE_ICON', $archive_icon); $t->replace('ARCHIVE_TEXT', $archive_text); $t->replace('FAVORITE_ICON', $favorite_icon); $t->replace('FAVORITE_TEXT', $favorite_text); $t->replace('VIEW', $view); $t->replace('CANCEL', $cancel); $t->replace('EDIT_ICON', $edit_icon); $t->replace('FEED_SHINE', $shine); // set data browser $d = new Template('feed_data_browser.html'); $feed_folder = joinPaths($username, $object->plugin, $object->name . '-' . $object->id); if (file_exists($feed_folder)) { $feed_subfolders = scandir(CHRIS_USERS . '/' . $feed_folder); natcasesort($feed_subfolders); // get rid of eventual notes.html or index.html files // find notes.html $notes = array_search('notes.html', $feed_subfolders); if ($notes) { // remove this entry - we don't want to touch it unset($feed_subfolders[$notes]); } // find index.html $index = array_search('index.html', $feed_subfolders); if ($index) { // remove this entry - we don't want to touch it unset($feed_subfolders[$index]); } } $d->replace('FOLDER', $feed_folder); $d->replace('PATIENT_ID', 'fake_patient_id'); $d->replace('DATA_ID', 'fake_data_id'); $t->replace('DATA_BROWSER', $d); // set tags $feedtagMapper = new Mapper('Feed_Tag'); $feedtagMapper->join('Tag', 'feed_tag.tag_id = tag.id')->filter('feed_tag.feed_id=(?)', $object->id); $feedtagResults = $feedtagMapper->get(); $feedtags = ''; if (count($feedtagResults['Feed_Tag']) >= 1) { foreach ($feedtagResults['Tag'] as $key => $value) { $n = new Template('feed_tag.html'); $n->replace('USER_ID', $object->user_id); $n->replace('TAG_ID', $value->id); $n->replace('TAG_NAME', $value->name); $n->replace('TAG_COLOR', $value->color); $n->replace('TEXT_COLOR', invertColor($value->color)); $n->replace('LOCATION', 'infeed'); $feedtags .= $n; } } $t->replace('TAGS', $feedtags); // notes $n = new Template('feed_notes.html'); $n->replace('PATH', joinPaths($username, $object->plugin, $object->name . '-' . $object->id, 'notes.html')); $t->replace('NOTES', $n); // set html viewer if "index.html" exists in username/plugin/feed-id/ if (is_file(joinPaths(CHRIS_USERS, $username, $object->plugin, $object->name . '-' . $object->id, 'index.html'))) { $t->replace('FEED_HTML', 'feed_html.html'); $t->replace('HTML_VIEWER', joinPaths('api.php?action=get&what=file¶meters=', $username, $object->plugin, $object->name . '-' . $object->id, 'index.html')); } else { $t->replace('FEED_HTML', ''); } return $t; }
echo "document.getElementById('Pl_Res_Hp').innerHTML=parseInt(document.getElementById('Pl_Res_Hp').innerHTML) - Pl_Dif_Hp;"; echo "document.getElementById('Op_Res_Hp').innerHTML=parseInt(document.getElementById('Op_Res_Hp').innerHTML) - Op_Dif_Hp;"; echo "if (parseInt(document.getElementById('Pl_Res_Hp').innerHTML) <= " . $Resulting_HP['Pl'] . "){document.getElementById('Pl_Res_Hp').innerHTML='" . $Resulting_HP['Pl'] . "';flaga=1;}"; echo "if (parseInt(document.getElementById('Op_Res_Hp').innerHTML) <= " . $Resulting_HP['Op'] . "){document.getElementById('Op_Res_Hp').innerHTML='" . $Resulting_HP['Op'] . "';flagb=1;}"; echo "clearTimeout(timeID);"; echo "if (!flaga || !flagb){timeID = setTimeout(\"HEcount()\",1);}"; echo "}"; echo "</script>"; if (isset($Tickets)) { echo "<div style=\"height: 32;position: absolute;top: 50;width: 100%;\" align=center>"; echo "<table align=center border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse;\" bordercolor=\"#FFFFFF\">"; echo "<tr height=32>"; echo "<td id=ticket_td_pl width=120 align=right style=\"padding-top: 10;width: 120;background-image: url({$Base_Image_Dir}/ticketbar_l_u.gif);background-color: {$Pl_Org['color']};\">"; echo "<font id=ticket_pl style=\"padding-right: 45;font-weight: bold;font-size: 12pt;color: " . invertColor($Pl_Org['color']) . ";\">" . number_format($Tickets['Pl']) . "</font></td>"; echo "<td id=ticket_td_op width=120 align=left style=\"padding-top: 10;width: 120;background-image: url({$Base_Image_Dir}/ticketbar_r_u.gif);background-color: {$Op_Org['color']};\">"; echo "<font id=ticket_op style=\"padding-left: 45;font-weight: bold;font-size: 12pt;color: " . invertColor($Op_Org['color']) . ";\">" . number_format($Tickets['Op']) . "</font></td>"; echo "</tr></table>"; echo "</div>"; } if ($Game_Scrn_Type == 0) { echo "<script language=\"JavaScript\">"; echo "TheNewDate = new Date();"; echo "parent.r_h = parent.r_e = parent.r_s = 0;"; echo "parent.m_time = parent.mh_time = parent.me_time = parent.ms_time = TheNewDate.getTime();"; echo "parent.document.getElementById('current_hp').innerHTML = parent.i_h = parent.h = " . $Resulting_HP['Pl'] . ";"; echo "parent.document.getElementById('current_en').innerHTML = parent.i_e = parent.e = " . $Resulting_EN['Pl'] . ";"; echo "parent.document.getElementById('current_sp').innerHTML = parent.i_s = parent.s = " . $Resulting_SP['Pl'] . ";"; if ($Pl->Player['status'] == '1') { echo "parent.document.getElementById('status_now').innerHTML = '修理進行中';parent.document.getElementById('status_now').style.color='#FF2200';"; } echo "parent.document.getElementById('pl_cash').innerHTML = '" . number_format($Pl->Player['cash']) . "';";
context.fillStyle = "rgba(0,255,0,0.5)"; context.fill(); '; } function invertColor($color) { $col = explode(",", $color); $col = array(255 - $col[0], 255 - $col[1], 255 - $col[2]); return $col[0] . "," . $col[1] . "," . $col[2]; } for ($i = 0; $i < getValue("playercount"); $i++) { $posX = convertCoord(explode(" ", tableStringToArray(getValue("playerpositions"), TRUE)[$i])[1]) + convertCoord($mapInfoJSON[getValue("map")][1]); $posY = convertCoord(explode(" ", tableStringToArray(getValue("playerpositions"), TRUE)[$i])[0]) + convertCoord($mapInfoJSON[getValue("map")][2]); $name = tableStringToArray(getValue("playernames"), FALSE)[$i]; $color = str_ireplace(" ", ",", tableStringToArray(getValue("playercolors"), TRUE)[$i]); $colorInverted = invertColor($color); $alive = tableStringToArray(getValue("playeralive"), TRUE)[$i]; echo ' var addX = 0; // Amount to add to converted X coordinate before drawing. var addY = 0; // Amount to add to converted Y coordinate before drawing. context.font = "bold 8pt Arial"; // Set font for name tag. context.textAlign = "center"; if(' . $posX . ' + (context.measureText(' . $name . ').width / 2) >= 600) // If name is off of the right edge of the screen... { addX = -(' . $posX . ' + (context.measureText(' . $name . ').width / 2) - 600); // Subtract distance off of edge. } if(' . $posX . ' - (context.measureText(' . $name . ').width / 2) <= 0) // If name is off the left edge of the screen... {
public static function getTagsList() { $n = new Template('tags_list.html'); $tagMapper = new Mapper('Tag'); $tagMapper->filter('user_id=(?)', $_SESSION['userid']); $tagresults = $tagMapper->get(); $tags = ''; foreach ($tagresults['Tag'] as $key => $value) { $tags .= '<option value="' . $value->name . '" data-backgroundcolor="' . $value->color . '" data-color="' . invertColor($value->color) . '">' . $value->name . '</option>'; } $n->replace('TAGS_LIST', $tags); return $n; }