Beispiel #1
0
 function listall()
 {
     include_once "../../data-access/mysql-db.php";
     $obj = new DataAccessLayer();
     $this->assign("cont", $obj->select("tblclientuser"));
     $this->assign("type", $obj->select("tblusertype"));
 }
Beispiel #2
0
 function create($tablename, $param)
 {
     include_once "../data-access/mysql-db.php";
     $obj = new DataAccessLayer();
     $obj->insert($tablename, $param);
     echo '<script type="text/javascript">window.location="forum_record.php?page=page&action=display"</script>';
 }
Beispiel #3
0
 public function add($tablename, $param)
 {
     include_once "../../data-access/mysql-db.php";
     $obj = new DataAccessLayer();
     $obj->insert($tablename, $param);
     echo '<script type="text/javascript">window.location="forum_record.php?control=post&func=display&postid=' . $_GET["postid"] . '"</script>';
 }
Beispiel #4
0
 function listall()
 {
     include_once "../../data-access/mysql-db.php";
     $obj = new DataAccessLayer();
     $this->assign("cont", $obj->select("tblcompanyuser join tblusertype on userTypeID=typeID"));
     $this->assign("type", $obj->select("tblusertype"));
 }
Beispiel #5
0
 function display()
 {
     include_once "../data-access/mysql-db.php";
     $obj = new DataAccessLayer();
     $this->assign("forumcategory", $obj->select("tblforumcategory"));
     $this->assign("topic", $obj->select("tbltopic"));
     $this->assign("latest", $obj->select("tbltopic limit 8"));
 }
 public static function query_all_restaurants()
 {
     $sql = 'select * from restaurants';
     $query_tool = new DataAccessLayer();
     $results = $query_tool->query($sql);
     if ($results->num_rows > 0) {
         return $results;
     } else {
         throw new Exception("No registered restaurant found or database error!");
     }
 }
Beispiel #7
0
 function getImage($val, $level)
 {
     include_once "../../../data-access/mysql-db.php";
     $obj = new DataAccessLayer();
     if ($level == 1) {
         $result = $obj->selectColumnImage("userImage", "tblcompanyuser", "userID", $val);
     } else {
         $result = $obj->selectColumnImage("userImage", "tblclientuser", "userID", $val);
     }
     return $result;
 }
Beispiel #8
0
function RankDropdownList($criterion, $scholarship_id)
{
    global $user_id;
    $dal = new DataAccessLayer();
    $rank = $dal->GetPhase2RankingOfUser($user_id, $scholarship_id, $criterion);
    $ret = sprintf('<select id="%s" name="%s">', $criterion, $criterion);
    for ($i = 4; $i >= 0; $i--) {
        $ret .= sprintf('<option value="%d"%s>%d</option>', $i, $i == $rank ? ' selected="selected"' : '', $i);
    }
    $ret .= '</select>';
    return $ret;
}
 function listall()
 {
     include_once "../data-access/mysql-db.php";
     $obj = new DataAccessLayer();
     $this->assign("activities", $obj->select("tblactivity where activityStatus=1 order by datePosted desc "));
 }
Beispiel #10
0
 function subquery($name, $catid)
 {
     include_once "../../data-access/mysql-db.php";
     $obj = new DataAccessLayer();
     $this->assign("topic", $obj->selectColumnWhere("tbltopic", "forumCatID", 1));
 }
Beispiel #11
0
<?php

require_once 'init.php';
if (isset($_POST['username']) && isset($_POST['password'])) {
    $user = new DataAccessLayer();
    $res = $user->GetUser($_POST['username']);
    if (md5($_POST['password']) == $res['password']) {
        session_start();
        $_SESSION['user_id'] = $res['id'];
        print $res['id'];
        header('location: ' . $BASEURL . 'review/grid');
        print 'login';
        exit;
    } else {
        $error = "Invalid credentials.";
    }
}
include "{$BASEDIR}/templates/header_review.php";
?>
	<form method="post" action="<?php 
echo $BASEURL;
?>
user/login" >
	<h1>Log in</h1>
	<?php 
if (isset($error)) {
    print "<p>" . $error . "</p>\n";
}
?>
	<fieldset>
	<p>Username: <input type="text" id="username" name="username" /></p>
Beispiel #12
0
session_start();
if (!isset($_SESSION['user_id'])) {
    header('location: ' . $BASEURL . 'user/login');
    exit;
}
$user_id = $_SESSION['user_id'];
if ($_GET['id']) {
    $id = $_GET['id'];
} else {
    if ($_POST['id']) {
        $id = $_POST['id'];
    } else {
        $id = 'new';
    }
}
$dal = new DataAccessLayer();
$username = $dal->GetUsername($_SESSION['user_id']);
if (isset($_POST['save'])) {
    $fieldnames = array("username", "password", "email", "reviewer", "isvalid", "isadmin");
    foreach ($fieldnames as $i) {
        $answers[$i] = mysql_real_escape_string($_POST[$i]);
    }
    if ($_POST['formstate'] == 'new') {
        $answers['password'] = md5($_POST['password']);
        $id = $dal->NewUserCreate($answers);
    } else {
        $dal->UpdateUserInfo($answers, $_POST['id']);
    }
}
if ($id != "new") {
    $user = $dal->GetUserInfo($id);
Beispiel #13
0
 public function updateinfo($clientarr, $column, $id)
 {
     include_once "../../data-access/mysql-db.php";
     $obj = new DataAccessLayer();
     $obj->updateWhere("tblpost", $clientarr, $column, $id);
 }
 public function create($activityarr)
 {
     include_once "../../data-access/mysql-db.php";
     $obj = new DataAccessLayer();
     $obj->insert("tblactivity", $activityarr);
 }
 public function __CONSTRUCT()
 {
     parent::__CONSTRUCT();
     $this->jq = new jqGridHelper();
     $this->rh = new ResponseHelper();
 }
Beispiel #16
0
 function listall()
 {
     include_once "../data-access/mysql-db.php";
     $obj = new DataAccessLayer();
     $this->assign("cont", $obj->select("tblnews order by datePosted desc"));
 }
Beispiel #17
0
<?php

require_once 'init.php';
session_start();
if (!isset($_SESSION['user_id'])) {
    header('location: ' . $BASEURL . 'user/login');
    exit;
}
$partial = $_GET['partial'] ? $_GET['partial'] : 0;
$dal = new DataAccessLayer();
$schols = $dal->GetFinalScoring($partial);
$rowstyleeven = 0;
$ctr = 1;
include "{$BASEDIR}/templates/header_review.php";
?>
<form method="post" action="<?php 
echo $BASEURL;
?>
grid">
<h1>Applications</h1>
<?php 
include "{$BASEDIR}/templates/admin_nav.php";
?>
<table style="width: 100%">
	<tr>
		<th>counter</th>
		<th>id</th>
		<th>name</th>
		<th>email</th>
		<th>residence</th>
		<th>sex</th>
Beispiel #18
0
<?php

require_once 'init.php';
session_start();
if (!isset($_SESSION['user_id'])) {
    header('location: ' . $BASEURL . 'user/login');
    exit;
}
$order = isset($_GET['order']) ? $_GET['order'] : '';
$dal = new DataAccessLayer();
$users = $dal->GetListofCountries($order);
$rowstyleeven = 0;
include "{$BASEDIR}/templates/header_review.php";
?>
<form method="post" action="grid.php">
<h1>Applications</h1>
<?php 
include "{$BASEDIR}/templates/admin_nav.php";
?>
<table id="country-grid" style="width: 100%">
	<tr>
		<th>id</th>
		<th>country name</th>
		<th>rank</th>
		<th>scholarship count</th>
	</tr>
	<?php 
foreach ($users as $row) {
    ?>
	<tr class="<?php 
    echo $rowstyleeven == 1 ? "evenrow" : "oddrow";
Beispiel #19
0
<?php

require_once 'init.php';
session_start();
if (!isset($_SESSION['user_id'])) {
    header('location: ' . $BASEURL . 'user/login');
    exit;
}
$dal = new DataAccessLayer();
$schols = $dal->GetFinalScoring(0);
foreach ($schols as $row) {
    print implode("\t", $row) . "\n";
}
 function listall()
 {
     include_once "../data-access/mysql-db.php";
     $obj = new DataAccessLayer();
     $this->assign("activities", $obj->select("tblactivity "));
 }
Beispiel #21
0
session_start();
if (!isset($_SESSION['user_id'])) {
    header('location: ' . $BASEURL . '/user/login');
    exit;
}
$user_id = $_SESSION['user_id'];
if ($_GET['id']) {
    $id = $_GET['id'];
} else {
    if ($_POST['id']) {
        $id = $_POST['id'];
    } else {
        die("No ID supplied!");
    }
}
$dal = new DataAccessLayer();
$username = $dal->GetUsername($_SESSION['user_id']);
if (isset($_POST['up'])) {
    $dal->InsertOrUpdateRanking($user_id, $_POST['last_id'], 'valid', 1);
} else {
    if (isset($_POST['down'])) {
        $dal->InsertOrUpdateRanking($user_id, $_POST['last_id'], 'valid', -1);
    } else {
        if (isset($_POST['skip'])) {
            $dal->InsertOrUpdateRanking($user_id, $_POST['last_id'], 'valid', 0);
        } else {
            if (isset($_POST['save'])) {
                $dal->UpdateField('notes', $_POST['last_id'], $_POST['notes']);
                $dal->UpdateField('residence', $_POST['last_id'], $_POST['residence']);
                $dal->UpdateField('nationality', $_POST['last_id'], $_POST['nationality']);
                $dal->UpdateField('exclude', $_POST['last_id'], $_POST['exclude']);
Beispiel #22
0
// The id of one of your Posterous sites ...
define('IMPORT_SITE_EMAIL', '*****@*****.**');
// The email address assigned to your Posterous account ...
define('IMPORT_SITE_PASSWORD', 'PASSWORD');
// The password assigned to your Posterous account ...
define('DB_NAME', 'Database Name');
define('DB_URL', 'Database URL or IP Address');
define('DB_USER', 'Database username');
define('DB_PASSWORD', 'Database password');
$batchSize = 100;
$totalRecsProcessed = 0;
$currentRecord = 0;
// SHOW ITEM BY DEFAULT on Posterous Website
$private_item = 1;
echo "Welcome. This process will attempt to move your items from SweetCron to Posterous<br/><br/>";
$db = new DataAccessLayer(DB_URL, DB_USER, DB_PASSWORD, DB_NAME);
$db->debug = false;
$totalRows = $db->nonQuery("select * FROM items where item_status = 'publish' limit 0,10");
while ($totalRows > 0) {
    $currentRecord = 0;
    if ($totalRecsProcessed > 100) {
        break;
    }
    echo "<h1>Processing " . $totalRecordsProcessed . " through " . $totalRecordsProcessed + $batchSize . "</h1>";
    $sql = "SELECT f.feed_title, f.feed_url, f.feed_domain, f.feed_icon, f.feed_data, i.* FROM items i " . " inner join feeds f on f.feed_id = i.item_feed_id " . " where i.item_status = 'publish' " . " limit 0," . $batchSize;
    $items = $db->query($sql);
    while ($obj = $items->fetch_object()) {
        $dmp = unserialize($obj->item_data);
        // load up the serialized item_data
        echo "<h3>Importing " . $obj->ID . " - " . $obj->item_title . "</h3>";
        echo "Original Date: " . $obj->item_date . "<br/>";
 public function create($clientarr)
 {
     include_once "../../data-access/mysql-db.php";
     $obj = new DataAccessLayer();
     $obj->insert("tblcompanyuser", $clientarr);
 }
 public function create($typearr)
 {
     include_once "../../data-access/mysql-db.php";
     $obj = new DataAccessLayer();
     $obj->insert("tblusertype", $typearr);
 }
Beispiel #25
0
<?php

require_once 'init.php';
session_start();
if (!isset($_SESSION['user_id'])) {
    header('location: ' . $BASEURL . 'user/login');
    exit;
}
$state = isset($_GET['state']) ? $_GET['state'] : 'all';
$dal = new DataAccessLayer();
$users = $dal->GetListofUsers($state);
$rowstyleeven = 0;
include "{$BASEDIR}/templates/header_review.php";
?>
	<form method="post" action="<?php 
echo $BASEURL;
?>
review/grid">
	<h1>Applications</h1>
<?php 
include "{$BASEDIR}/templates/admin_nav.php";
?>
	<table style="width: 100%">
		<tr>
			<th>id</th>
			<th>username</th>
			<th>email</th>
			<?php 
if ($state == "reviewer") {
    ?>
<th>remaining</th><?php 
 function __destruct()
 {
     parent::__destruct();
 }
/**
 * [newest_restaurants description]
 * @param  [type] $number [description]
 */
function newest_restaurants($number = null)
{
    if ($number) {
        $query_tool = new DataAccessLayer();
        $sql = 'select restaurant_id, name, cuisine_type, rating from restaurants where approved = 1 order by restaurant_id DESC limit 0, ' . $number;
        $newest_three_restaurant = $query_tool->query($sql);
        if ($newest_three_restaurant->num_rows > 0) {
            while ($row = $newest_three_restaurant->fetch_row()) {
                render_newest_restaurant($row);
            }
            echo '<div class="clearfix"></div>';
        }
    }
}
Beispiel #28
0
 function listall()
 {
     include_once "../../data-access/mysql-db.php";
     $obj = new DataAccessLayer();
     $this->assign("forumcategory", $obj->select("tblforumcategory"));
 }
 public static function find_by_restaurant_id($restaurant_id)
 {
     if ($restaurant_id) {
         $sql = 'select * from reservations where restaurant_id = ' . $restaurant_id;
         $query_tool = new DataAccessLayer();
         $results = $query_tool->query($sql);
         if ($results->num_rows > 0) {
             return $results;
         } else {
             return null;
         }
     }
 }
     }
     echo json_encode($return_result);
 } else {
     if ($_POST['operation'] == 'make_reservation') {
         // var_dump($_POST);
         $time_to_slots_hash = array('05:00PM - 06:00PM' => 'slot_5_6', '06:00PM - 07:00PM' => 'slot_6_7', '07:00PM - 08:00PM' => 'slot_7_8', '08:00PM - 09:00PM' => 'slot_8_9', '09:00PM - 10:00PM' => 'slot_9_10');
         $time_to_24_hours = array('05:00PM - 06:00PM' => 17, '06:00PM - 07:00PM' => 18, '07:00PM - 08:00PM' => 19, '08:00PM - 09:00PM' => 20, '09:00PM - 10:00PM' => 21);
         $user_email = $_POST['user_email'];
         $user_phone = $_POST['user_phone'];
         if (isset($_POST['guest_reservation']) && $_POST['guest_reservation'] == 'true') {
             $fields = array('restaurant_id' => $_POST['restaurant_id'], 'people_size' => $_POST['people_size'], 'date_of_reservation' => $_POST['date'], 'time_of_reservation' => $time_to_24_hours[$_POST['time']], 'effective' => 1, 'guest_info' => $_POST['guest_info']);
         } else {
             $fields = array('user_id' => $_POST['user_id'], 'restaurant_id' => $_POST['restaurant_id'], 'people_size' => $_POST['people_size'], 'date_of_reservation' => $_POST['date'], 'time_of_reservation' => $time_to_24_hours[$_POST['time']], 'effective' => 1);
         }
         try {
             $query_tool = new DataAccessLayer();
             $sql = 'select ' . $time_to_slots_hash[$_POST['time']] . ', date, restaurant_id from time_slots_capacity where date = "' . $fields['date_of_reservation'] . '" and restaurant_id = "' . $fields['restaurant_id'] . '"';
             $results = $query_tool->query($sql);
             if ($results->num_rows > 0) {
                 $row = $results->fetch_row();
                 $previous_capacity = $row[0];
                 if ($previous_capacity >= $fields['people_size']) {
                     $new_reservation = new Reservation();
                     $new_reservation->create($fields);
                     $next_capacity = $previous_capacity - $fields['people_size'];
                     $sql = 'update time_slots_capacity set ' . $time_to_slots_hash[$_POST['time']] . ' = ' . $next_capacity . ' where date = "' . $fields['date_of_reservation'] . '" and restaurant_id = "' . $fields['restaurant_id'] . '"';
                     if ($query_tool->query($sql)) {
                         // send email to user to confirm reservation
                         $restaurant = new Restaurant();
                         $restaurant->find($fields['restaurant_id']);
                         $mail = Mail::getInstance();