public function RenderPage() { require_once "/Classes/databaseHandler.class.php"; $Database = new Database(); print ' <title>Run2Day - Bannerbeheer</title> <h1>Bannerbeheer</h1> <table class="table"> <tr> <th>Toegevoegd aan</th> <th>Bestandsnaam</th> <th>Banner tekst</th> <th>Verwijderen</th> </tr> '; $Database->query('SELECT ID, fileName, fk_wedstrijdID, text FROM afbeeldingen'); $result = $Database->resultset(); foreach ($result as $key) { $Database->query('SELECT name FROM wedstrijden WHERE wedstrijdID=?'); $Database->bind(1, $key['fk_wedstrijdID']); $wedstrijd = $Database->single(); print '<tr><td>' . $wedstrijd['name'] . ' </td>'; print '<td>' . $key['fileName'] . ' </td>'; print '<td>' . $key['text'] . ' </td>'; print ' <td><a class="fa fa-trash-o" href="?dashboard&deletebanner=' . $key['ID'] . '"</td></tr>'; } print ' </table> <div class="col-md-4"> <h3>Banner afbeelding toevoegen</h3> <form action="../Classes/submitWedstrijd.php" method="POST" enctype="multipart/form-data"> <label for="usr">Banner toevoegen aan:</label> <select class="form-control" name="wedstrijd" id="wedstrijd">'; $Database->query('SELECT name, wedstrijdID FROM wedstrijden'); $result = $Database->resultset(); foreach ($result as $key) { print ' <option> ' . $key['name'] . '</option>'; } print ' </select> <div class="form-group"> <label for="usr">Banner tekst:</label> <input type="text" class="form-control" id="name" name="name" required> </div> <div class="form-group"> <label for="usr">Afbeelding:</label> <input type="file" name="file" id="file"> </div> <input type="submit" value="Opslaan"> <br><br> </form> </div> </div> </div> '; }
public function mainP() { $sen = 0; $db = new Database(); foreach ($this->sentences as $sentence) { $highest = 0; $words = array(); $words = explode(" ", $sentence); foreach ($words as $word) { if (!in_array(strtolower($word), $this->stopwords)) { //Fetching the meaning definition of the senses From the WordNet $db->query("SELECT * from words where lemma like :word"); $db->bind("word", $word); $wordid = $db->single()->wordid; $db->query("SELECT * from senses where wordid like :wordid"); $db->bind("wordid", $wordid); $resulta2 = $db->resultset(); foreach ($resulta2 as $row) { $synsetid = $row->synsetid; $sample2[] = $synsetid; $title = $row->wordid . " " . $row->senseid; } $db->query("select * from synsets where synsetid like :sample"); $db->bind("sample", $sample2[0]); $resulta3 = $db->resultset(); unset($sample2[0]); for ($i = 0; $i < count($sample2) + 1; $i++) { ${result_A . $i} = $sample2[$i]; ${lexdomains_var . $i} = $lexdomains[$i]; $db->query("select * from synsets where synsetid like :sample"); $db->bind("sample", ${result_A . $i}); ${result . $i} = $db->resultset(); foreach (${result . $i} as $row) { ${pos . $i} = $row->pos; if (${pos . $i} == "s") { ${pos . $i} = "satellite adj"; } $def = $row->definition; $def = preg_replace('/[^a-zA-Z0-9_ -]/s', '', $def); $definition = array(); $definition = explode(" ", $def); $frequency = $this->frequency($definition); if ($frequency > $highest) { $highest = $frequency; } } } $sample2 = array(); } } $this->frequencies[] = $highest; $this->sentence_count[] = $sen; $sen++; } }
function userPostCount($user_id) { $db = new Database(); //topic count $db->query("SELECT * FROM topics\n\t\t\t\tWHERE user_id = :user_id\n\t\t\t\t"); $db->bind(":user_id", $user_id); $rows = $db->resultset(); $topic_count = $db->rowCount(); //reply count $db->query("SELECT * FROM replies\n\t\t\t\tWHERE user_id = :user_id\n\t\t\t\t"); $db->bind(":user_id", $user_id); $rows = $db->resultset(); $reply_count = $db->rowCount(); return $topic_count + $reply_count; }
function getByMuseum($museum_id, $today) { global $api_response; global $api_response_code; try { $database = new Database(); $database->query("SELECT * FROM exhibitions_info WHERE end_date >= :today AND museum_id = :museum_id ORDER BY start_date ASC"); $database->bind(':today', $today); $database->bind(':museum_id', $museum_id); $rows = array(); $rows = $database->resultset(); $database = null; if ($rows == null) { //not found any exhibitions return error $api_response = $api_response_code[5]; } else { $api_response = $api_response_code[1]; } return $rows; } catch (PDOException $e) { $database = null; $api_response = $api_response_code[0]; //die( "Query failed: " . $e->getMessage() ); return null; } }
public function fetchBySearch($search) { $dbh = new Database(); $data = $dbh->query('SELECT * FROM tiendas WHERE tienda_nombre LIKE "%' . $search . '%"'); $data = $dbh->resultset(); return $data; }
public function fetchAllByPortada() { $dbh = new Database(); $data = $dbh->query('SELECT * FROM noticias WHERE noticia_portada = 1 LIMIT 3'); $data = $dbh->resultset(); return $data; }
public function fetchAllNonPremieres() { $dbh = new Database(); $data = $dbh->query('SELECT * FROM cine WHERE cine_estreno = 0 AND cine_activado = 1'); $data = $dbh->resultset(); return $data; }
public function GetConfigProcess() { parent::query('SELECT * FROM dd_config'); parent::execute(); $dataset = parent::resultset(); return $dataset; }
public function ListDistrictProcess($param) { parent::query('SELECT * FROM dy_location_district WHERE ds_city_id = :city_id ORDER BY ds_id ASC'); parent::bind(':city_id', $param['city_id']); parent::execute(); return parent::resultset(); }
public function ListConfigProcess($group) { parent::query('SELECT * FROM dd_config WHERE cf_group = :group'); parent::bind(':group', $group); parent::execute(); $dataset = parent::resultset(); return $dataset; }
/** * Get Post Comments * * @param int $post_id * @return mixed */ public function getComments($post_id) { $this->db->query("SELECT comments.*, posts.id FROM comments\n\t INNER JOIN posts\n\t ON comments.post_id = posts.id\n\t WHERE comments.post_id = :post_id\n\t\t\tORDER BY time ASC"); $this->db->bind(':post_id', $post_id); //Assign Result Set $results = $this->db->resultset(); return $results; }
function commentsCount($post_id) { $db = new Database(); $db->query("SELECT * FROM comments WHERE post_id = :post_id"); $db->bind(':post_id', $post_id); $rows = $db->resultset(); return $db->rowCount(); }
public function printHTML() { require_once "/Classes/databaseHandler.class.php"; $Database = new Database(); $Database->query('SELECT wedstrijdID, name, date, location FROM wedstrijden'); $this->wedstrijden = $Database->resultset(); $this->RenderPage(); }
public function EditProductProcess($param) { parent::query('SELECT * FROM dd_product'); parent::execute(); parent::execute(); $dataset = parent::resultset(); return $dataset; }
public function PlaceToTagCheckingProcess($param) { parent::query('SELECT tg_id tag_id,tg_keyword tag_keyword,tg_text tag_text,tg_create_time tag_create_time,(SELECT pt_id FROM dy_place_to_tag WHERE pt_place_id = :place_id AND pt_tag_id = tg_id) tag_checking FROM dy_tag WHERE 1 ORDER BY tg_create_time DESC'); parent::bind(':place_id', $param['place_id']); parent::execute(); $dataset = parent::resultset(); return $dataset; }
public function ListSubPhotoProcess($param) { parent::query('SELECT * FROM dd_image WHERE im_product_id = :product_id AND im_type = "normal"'); parent::bind(':product_id', $param['product_id']); parent::execute(); $dataset = parent::resultset(); return $dataset; }
public function printHTML() { require_once "/Classes/databaseHandler.class.php"; $Database = new Database(); $this->ZoekTijd(); if ($this->Naam == "Naam") { echo "Startnummer of naam is niet gevonden."; header("Location: ?error&code=1"); } else { $Database->query('SELECT wedstrijdID FROM wedstrijden WHERE name=?'); $Database->bind(1, $_GET['wedstrijd']); $ID = $Database->single(); $Database->query('SELECT camName, videoID FROM cams WHERE fk_wedstrijdID=?'); $Database->bind(1, $ID['wedstrijdID']); $result = $Database->resultset(); foreach ($result as $key) { print ' <title>' . "Run2Day video - " . $this->Naam . " - " . $this->Wedstrijdnaam . '</title> <link href="css/bootstrap.css" rel="stylesheet"> <h1 class="text-center"> <i class="fa fa-video-camera"></i> '; echo $key['camName']; print '</h1> <div class="container"> <div class="col-md-8 col-md-offset-2"> <div class="embed-responsive embed-responsive-16by9"> <iframe class="embed-responsive-item" src="https://player.vimeo.com/video/'; echo $key['videoID']; print '?autoplay=true#t='; echo $this->VideoTijd; print '" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> </div> </div></div> '; } print ' <h1 class=text-center>' . $this->Startnummer . ' - ' . $this->Naam; if ($this->Geslacht == "M") { echo ' <i class="fa fa-male"></i>'; } if ($this->Geslacht == "V") { echo ' <i class="fa fa-female"></i>'; } print ' </h1> <p class=text-center>' . $this->Woonplaats . ' <br> ' . $this->Wedstrijdnaam . '</p> <div class="centered text-center"> <p><a class="btn btn-primary btn-lg" href="?search" role="button">Zoek een andere video</a></p> <div class="fb-share-button" data-href="http://hardlopen.wouterd.nl?player&wedstrijd=' . $_GET['wedstrijd'] . '&naam=' . $_GET['naam'] . '&startnummer=' . $_GET['startnummer'] . '" data-layout="box_count"></div> </div> <br> '; } }
function getChoicesByQuestion($question_id) { $db = new Database(); $db->query('SELECT * FROM choices WHERE question_id = :question_id'); $db->query(':question_id', $question_id); // Assign Rows $rows = $db->resultset(); return $rows; }
public function ListAmphurProcess($param) { echo 'province_id: ' . $param['province_id']; parent::query('SELECT * FROM th_amphur WHERE amphur_province_id = :province_id AND amphur_postcode != "00000"'); parent::bind(':province_id', $param['province_id']); parent::execute(); $dataset = parent::resultset(); return $dataset; }
public function ListCategoryProcess($param) { parent::query('SELECT ca_id category_id,ca_title category_name,ca_root,ca_parent_first,ca_parent_second,ca_create_time,ca_update_time,ca_type,ca_status,(SELECT COUNT(pl_id) FROM dy_place WHERE pl_category_id = ca_id AND (pl_status = "registered" OR pl_status = "approved")) total_place FROM dy_category WHERE 1'); parent::execute(); $dataset = parent::resultset(); return $dataset; }
public function ListBankProcess($param) { parent::query('SELECT * FROM dd_bank'); parent::execute(); $dataset = parent::resultset(); foreach ($dataset as $k => $var) { $dataset[$k]['bk_account_number_format'] = parent::BankNumberFormat($var['bk_account_number']); } return $dataset; }
public function ListKeywordProcess($param) { parent::query('SELECT * FROM dy_keyword WHERE kw_total > 0 ORDER BY kw_total DESC LIMIT 100'); parent::execute(); $dataset = parent::resultset(); foreach ($dataset as $k => $var) { $dataset[$k]['kw_create_time_facebook_format'] = parent::date_facebookformat($var['kw_create_time']); $dataset[$k]['kw_update_time_facebook_format'] = parent::date_facebookformat($var['kw_update_time']); } return $dataset; }
public function renderSearch() { require_once "/Classes/databaseHandler.class.php"; $Database = new Database(); $Database->query('SELECT fileName, name, date FROM wedstrijden'); $resultSet = $Database->single(); print ' </div > <div id = "clickTable" class="container" > <table id = "myTable" class="table" > <thead> <tr> <th> Startnr <i class="fa fa-sort" ></i></th> <th> Wedstrijd <i class="fa fa-sort" ></i></th> <th> Naam <i class="fa fa-sort" ></i></th> <th> Woonplaats <i class="fa fa-sort" ></i></th> <th> Geboortedatum <i class="fa fa-sort" ></i></th> <th> Geslacht</th > <th> Netto tijd <i class="fa fa-sort" ></i></th> <th> Onderdeel <i class="fa fa-sort" ></i> </th> <th> Beeld</th> </tr></thead ><tbody> '; $Database->query('SELECT * FROM tijden WHERE Naam LIKE ?'); if (!isset($_GET['show'])) { $Database->bind(1, "%" . $_POST['naam'] . "%"); $result = $Database->resultset(); if (empty($result)) { echo "Deelnemer niet gevonden."; } foreach ($result as $data) { $Database->query('SELECT fileName, name, date FROM wedstrijden WHERE wedstrijdID=?'); $Database->bind(1, $data['fk_wedstrijdID']); $resultSet = $Database->single(); print ' <tr><td> ' . $data['Startnummer'] . ' </td> '; print '<td> ' . $resultSet['name'] . ' </td> '; print '<td> ' . $data['Naam'] . ' </td> '; print '<td> ' . $data['Woonplaats'] . ' </td> '; print '<td> ' . $data['Geboortedatum'] . ' </td> '; echo "<td>"; if ($data['Geslacht'] == "V") { echo ' <i class="fa fa-female" ></i> '; } else { echo '<i class="fa fa-male" ></i> '; } echo "</td>"; print '<td> ' . $data['NettoTijd'] . ' </td> '; print '<td> ' . $data['Onderdeel'] . ' </td> '; print "<td><a class='fa fa-line-chart' href='?statistieken&startnummer=" . $data['Startnummer'] . "&eventid=" . $data['fk_wedstrijdID'] . "'></a>"; print " <a class='fa fa-video-camera' href='?newplayer&wedstrijd=" . $resultSet['name'] . "&naam=& startnummer=" . $data['Startnummer'] . "'></a>"; print " <a class='fa fa-camera' </a> "; print " <a class='fa fa-certificate' target='_blank' href='https://uitslagensoftware.nl/certificaat_3.php?event_id=2015083000294&S= " . $data['Startnummer'] . "'></a></td></tr>"; } } }
function userPostCount($user_id) { $db = new Database(); $db->query('SELECT * FROM topics WHERE user_id = :user_id '); $db->bind(':user_id', $user_id); //Assign Rows $rows = $db->resultset(); //Get Count $topic_count = $db->rowCount(); $db->query('SELECT * FROM replies WHERE user_id = :user_id '); $db->bind(':user_id', $user_id); //Assign Rows $rows = $db->resultset(); //Get Count $reply_count = $db->rowCount(); return $topic_count + $reply_count; }
function topicCount($category_id) { if ($category_id == null) { $topicCount = new Topic(); return $topicCount->getTotalTopics(); } else { $db = new Database(); $db->query("SELECT * FROM topics WHERE category_id = :category_id"); $db->bind(':category_id', $category_id); $row = $db->resultset(); $count = $db->rowCount(); return $count; } }
function getUsersId($user_id) { $database = new Database(); $sql = "SELECT * FROM mytable WHERE ID=:user_id"; $database->query($sql); $database->bind(':user_id', $user_id); if ($rows = $database->resultset()) { foreach ($rows as &$row) { echo '{"users": ' . json_encode($row) . '}'; } } else { echo json_encode(array("status" => false, "message" => "El usuario con ID {$user_id} no existe")); } }
public function ListItemsInOrderProcess($param) { parent::query('SELECT odt_id,odt_order_id order_id,odt_amount product_amount,product.pd_id product_id,product.pd_title product_title,product.pd_description product_description,product.pd_price product_price,product.pd_type product_type,p_image.im_id product_image_id,p_image.im_filename product_image_filename,parent.pd_id parent_id,parent.pd_title parent_title,parent.pd_description parent_description,parent_image.im_id parent_image_id,parent_image.im_filename parent_image_filename FROM dd_order_detail LEFT JOIN dd_product AS product ON odt_product_id = pd_id LEFT JOIN dd_product AS parent ON product.pd_parent = parent.pd_id LEFT JOIN dd_image AS p_image ON product.pd_id = p_image.im_product_id AND (im_type = "cover") LEFT JOIN dd_image AS parent_image ON parent.pd_id = parent_image.im_product_id WHERE odt_order_id = :order_id'); parent::bind(':order_id', $param['order_id']); parent::execute(); $dataset = parent::resultset(); return $dataset; }
/** * Research by subject, min. date, and optionnally category and contact name * Returns a list of documents */ public function searchDocuments($searchDocumentsParams) { $db = new Database(); // LEFT JOIN: the doc may not have been linked to a sender or addressee yet // COALESCE: if the category_id IS NULL replace it with an empty string $sql = "SELECT r.res_id, r.subject, r.doc_date, m.category_id as category, " . "m.exp_contact_id, m.dest_contact_id, m.exp_user_id, " . "m.dest_user_id " . "FROM res_letterbox as r " . "LEFT JOIN mlb_coll_ext as m ON r.res_id = m.res_id " . "WHERE UPPER(r.subject) LIKE UPPER(:subject) AND " . "r.doc_date >= to_date(:mindocdate, 'YYYY-MM-DD') " . "AND COALESCE(m.category_id, '') like :category " . "ORDER BY r.doc_date DESC;"; /********************* Note : in the version 1.5.1 the following lines must be adapted: the "query" method has been modified and the "bind" method has been deleted *********************/ $db->query($sql); // prepared request $db->bind(":subject", "%{$searchDocumentsParams->subject}%"); // the date is managed as a string $db->bind(':mindocdate', $searchDocumentsParams->min_doc_date); if (isset($searchDocumentsParams->category) && !is_null($searchDocumentsParams->category) && $searchDocumentsParams->category != "") { $db->bind(":category", $searchDocumentsParams->category); } else { // match all the categories (even NULL) $db->bind(":category", "%"); } $res = $db->resultset(); // array of objects OR null // add the information about the contact (sender or addressee) $final_res = array(); foreach ($res as $current) { if (!is_null($current['exp_contact_id']) || !is_null($current['dest_contact_id'])) { $this->get_external_contact($db, $current); } else { if (!is_null($current['exp_user_id']) || !is_null($current['dest_user_id'])) { $this->get_internal_contact($db, $current); } else { $current['contact'] = ''; } } // remove the unused data unset($current['exp_contact_id']); unset($current['dest_contact_id']); unset($current['exp_user_id']); unset($current['dest_user_id']); array_push($final_res, $current); } // if the user wants to search by contact name we filter the data return $this->filter_by_contact($final_res, $searchDocumentsParams->contact); }
public function ListNotificationProcess($param) { parent::query('SELECT ac_id activity_id,me_id activity_owner_id,me_fname activity_owner_fname,me_name activity_owner_name,ac_action activity_action,ac_create_time activity_create_time,ac_to_comment_id activity_comment_id,cm_message activity_comment_message,po_id activity_post_id,po_text activity_post_text,ac_status activity_status FROM dy_activity LEFT JOIN dy_post ON ac_to_post_id = po_id LEFT JOIN dy_member ON ac_member_id = me_id LEFT JOIN dy_comment ON ac_to_comment_id = cm_id WHERE (ac_action = "new_comment" OR ac_action = "thanks_post") AND (po_member_id = :member_id) AND (ac_member_id != :member_id) ORDER BY ac_create_time DESC'); parent::bind(':member_id', $param['member_id']); parent::execute(); $dataset = parent::resultset(); foreach ($dataset as $k => $var) { // $dataset[$k]['comment_message'] = htmlspecialchars($var['comment_message']); $dataset[$k]['activity_create_time_facebook_format'] = parent::date_facebookformat($var['activity_create_time']); $dataset[$k]['activity_update_time_facebook_format'] = parent::date_facebookformat($var['activity_update_time']); } return $dataset; }
public function ListPhotoProcess($param) { $q['select'] = 'SELECT * '; $q['from'] = 'FROM dy_image '; $q['where'] = 'WHERE 1 = 1 '; $q['order'] = 'ORDER BY im_create_time DESC '; $q['limit'] = 'LIMIT ' . $param['start'] . ',' . $param['total']; if (isset($param['member_id'])) { $q['where'] = 'WHERE (im_member_id = :member_id) '; } if (isset($param['place_id'])) { $q['where'] = 'WHERE (im_place_id = :place_id) '; } $queryProcess = $q['select'] . $q['from'] . $q['where'] . $q['order'] . $q['limit']; parent::query($queryProcess); if (isset($param['member_id'])) { parent::bind(':member_id', $param['member_id']); } if (isset($param['place_id'])) { parent::bind(':place_id', $param['place_id']); } parent::execute(); return parent::resultset(); }