function GenerateApps() { require_once 'src/db.php'; $dbconn = post_connect(DB::NICGIO); $query = "SELECT name, url FROM projects WHERE is_on_odua = TRUE AND visible = TRUE ORDER BY NAME ASC"; $raw_projects_titles = pg_query($query) or die('Query failed: ' . pg_last_error()); //Make <li> for each project while ($line = pg_fetch_array($raw_projects_titles, null, PGSQL_ASSOC)) { $p_name = $line["name"]; $p_url = $line["url"]; echo "<li><a href='{$p_url}'>{$p_name}</a></li>"; } //Free results and close DB pg_free_result($raw_projects_titles); pg_close($dbconn); }
<?php require_once 'db.php'; //connect to DB and pull data needed for tiles $dbconn = post_connect(); //Query database to pull in language data $query = 'SELECT name, nickname, title, about, color, accent FROM languages ORDER BY id ASC;'; $results = pg_query($query) or die('Query failed: ' . pg_last_error()); // for each lanaguage pull data and format a tile while ($line = pg_fetch_array($results, null, PGSQL_ASSOC)) { $l_name = $line["name"]; $l_nickname = $line["nickname"]; $l_title = LineSplitter($line["title"]); $l_about = LineSplitter($line["about"]); $l_color = $line["color"]; $l_accent = $line["accent"]; echo "<a href='projects.php#{$l_name}'><div class=\"language_div\" onmouseover=\"flippy('{$l_nickname}','_{$l_nickname}')\"\n onmouseout=\"flippy('_{$l_nickname}','{$l_nickname}')\">\n <svg id={$l_nickname} class=language >\n <g transform=\"translate(0,-942.36218)\">\n <path d=\"m 101.86914,1023.5507 c -2.678009,4.686 -41.440422,27.616 -46.835324,27.7393 -5.394909,0.1233 -44.207297,-22.5326 -46.9616221,-27.1522 -2.7543251,-4.6196 -2.5817995,-48.93224 0.00846,-53.64233 2.5902711,-4.71008 41.5694081,-27.03612 46.9400851,-27.06162 5.370678,-0.0255 44.055894,21.86228 46.856861,26.47448 2.80096,4.6122 2.66953,48.95627 -0.008,53.64237 z\"/>\n <text id=langauge_text x=\"54.880371\" y=\"1009.7621\" style=\"fill:{$l_color};\">{$l_nickname}</text>\n </g>\n </svg>\n <svg id=_{$l_nickname} class=\"language_back\">\n <g transform=\"translate(0,-942.36218)\">\n <g transform=\"matrix(0.58881981,0,0,0.61394787,-135.10468,773.13655)\">\n <path id=lb_mainfill d=\"m 268.61355,354.62999 c -3.73655,6.57992 -57.82062,38.77698 -65.34797,38.95013 -7.52736,0.17316 -61.68116,-31.6391 -65.52419,-38.12569 -3.84303,-6.4866 -3.60231,-68.70828 0.0118,-75.32195 3.61413,-6.61366 58.00059,-37.96277 65.49414,-37.99858 7.49355,-0.0358 61.46991,30.69793 65.37802,37.17415 3.9081,6.47621 3.72472,68.74202 -0.0118,75.32194 z\" transform=\"matrix(1.2189051,0,0,1.1649304,75.15324,-5.0623626)\" style=\"fill:{$l_color}; stroke:{$l_accent};\"/>\n <path id=lb_subfill d=\"m 401.1391,408.05689 c -4.5545,7.66515 -70.47785,45.17249 -79.65298,45.37419 0,-58.14565 -0.0222,-120.76756 -0.0222,-176.4243 9.13392,-0.0417 74.92598,35.76095 79.6896,43.3053 4.7636,7.54433 4.54008,80.07966 -0.0144,87.74481 z\" style=\"fill:{$l_accent};\"/>\n </g>"; //Check to see if 3 or 4 lines are needed then the apporiate one if (count($l_title) > 1) { echo "<text class=\"lb_text\" x=\"55.071991\" y=\"976.49506\">\n <tspan x=\"55\" y=\"976\">{$l_title['0']}</tspan>\n <tspan x=\"55\" y=\"993\">{$l_title['1']}</tspan>\n <tspan x=\"55\" y=\"1011\">{$l_about['0']} </tspan>\n <tspan x=\"55\" y=\"1028\">{$l_about['1']}</tspan>\n </text>"; } else { echo "<text class=\"lb_text\" x=\"55.071991\" y=\"976.49506\">\n <tspan x=\"55\" y=\"984.5\">{$l_title['0']}</tspan>\n <tspan x=\"55\" y=\"1002\">{$l_about['0']} </tspan>\n <tspan x=\"55\" y=\"1019.5\">{$l_about['1']}</tspan>\n </text>"; } echo "</g>\n </svg>\n </div></a>"; } // Free resultset and close DB pg_free_result($results); pg_close($dbconn); //need to break the title and about into two lines function LineSplitter($statement) {
<head> <?php include_once 'src/styles.php'; ?> <title>Apps by Odua</title> </head> <body> <?php require_once 'src/header.php'; GenerateHeader(PAGE::APPS); ?> <content id="apps_content"> <?php #GENERATE APPS LIST FROM PORTFOLIO DATABASE require_once 'src/db.php'; $dbconn = post_connect(DB::NICGIO); $query = "SELECT name, url, description, photo, is_on_android, is_on_web, is_on_ios FROM projects WHERE is_on_odua = TRUE AND visible = TRUE ORDER BY NAME ASC"; $raw_projects = pg_query($query) or die('Query failed: ' . pg_last_error()); //Make <li> for each project while ($line = pg_fetch_array($raw_projects, null, PGSQL_ASSOC)) { $p_name = $line["name"]; $p_url = $line["url"]; $p_desc = strlen($line["description"]) >= 171 ? substr($line["description"], 0, 167) . "..." : $line["description"]; $p_photo = PORTFOLIOIMAGELOCATION . $line["photo"]; $p_android = $line["is_on_android"] == 't' ? '<img src="img/android.png">' : ''; $p_web = $line["is_on_web"] == 't' ? '<img src="img/chrome.png">' : ''; $p_ios = $line["is_on_ios"] == 't' ? '<img src="img/ios.png">' : ''; echo "<a href='{$p_url}'><apptag>\n <name>{$p_name}</name>\n <img src='{$p_photo}'/>\n <disc>\n {$p_desc}\n </disc><br>\n <platforms>\n {$p_web}\n {$p_android}\n {$p_ios}\n </platforms>\n </apptag></a>"; } //Free results and close DB pg_free_result($raw_projects);
function pull_skills() { $dbconn = post_connect(); $query = "SELECT hire_skills FROM odua ORDER BY id DESC LIMIT 1;"; $raw_entery = pg_query($query) or die('Query failed: ' . pg_last_error()); $line = pg_fetch_array($raw_entery, null, PGSQL_ASSOC); $skills_array = json_decode($line['hire_skills'], true); pg_close($dbconn); pg_free_result($raw_entery); return $skills_array; }