Adding changes from production server. Pls, stop making changes live. Hrmpf.

This commit is contained in:
thomas committed 2010-09-13 21:15:05 +02:00
1 parent 243008cff5
commit ca1fcc8173
104 files changed
+9231 -4853

No files matched your search

+548 -114
View File
@@ -1,137 +1,571 @@
table
{
width: 100%;
border-collapse: collapse;
background-color: white;
color: black;
font: 10pt verdana, arial;
margin-bottom: 25%; /* %, px, em, ex ? */
}
@import 'css/reset.css';
@import 'css/rebuild.css';
@import 'css/wp-css';
tr.subhead
{
background-color: #cccccc;
}
th
{
padding: 0 3%;
}
/**
* Structure
*/
th.alt
{
background-color: black;
color: white;
padding: 3% 3% 2%;
}
/* Layout */
/*#wrapper */
#header .site-title,
#header #menu ul ul,
#main {
width:1000px;
margin:auto;
position:relative;
}
#main {
margin-top:-20px;
}
#content {
float:left;
margin:50px 0;
width:1000px;
background: #ffffff;
position:relative;
}
td
{
padding: 0 3%;
}
.page-medlemmer .column,
.home .column {
width:400px;
margin:0;
padding:50px;
float:left;
}
tr.alt
{
background-color: #eeeeee;
}
.hentry,
#program {
margin:0;
width: 518px;
overflow:hidden;
background:#ffffff;
margin-bottom: 30px;
}
h1
{
font: 24pt verdana, arial;
margin: 0;
}
.single .hentry {
float:left;
width: 500px;
margin:50px;
}
h2
{
font: 18pt verdana, arial;
margin: 0;
}
.page-medlemmer .hentry {
width:1000px;
margin:0;
}
h3
{
font: 12pt verdana, arial;
margin: 0;
}
.page-medlemmer .hentry h1 {
margin:40px 50px 0;
}
th a
{
color: #00008b;
font: 8pt verdana, arial;
}
#primary.sidebar,#secondary.sidebar {
width:300px;
float:left;
padding:30px 50px;
}
* html #primary {
left: 20px;
position: relative;
}
.program-teaser {
width:1000px;
margin:auto;
}
/* end layout */
a
{
color: #00008b;
text-decoration: none;
}
/* Header */
body.dns {
background:#efefef;
}
/*body.dns */
#header {
background:#191919 url('img/header-210x.png') repeat-x bottom;
}
#header {
height:155px;
margin-bottom:10px;
overflow:hidden;
position:relative;
}
.site-title {
z-index:999
}
.site-title a {
background: url('img/bannerindex-400.png') no-repeat -20px 0;
display:block;
height:63px;
margin-top:20px;
text-indent:-9999px;
width:400px;
}
#menu {
position:absolute;
bottom:35px;
width:100%;
/* padding-left:23%;*/
}
#menu > ul {
width:960px;
margin:auto;
}
#menu ul,#menu li {
list-style-type:none;
}
#menu li{
float:left;
margin-right:10px;
}
#menu li a{
display:block;
height:22px;
padding:5px 13px 3px;
text-decoration:none;
color: #f5f5f5;
}
#menu ul div {
bottom:-25px;
left:0;
position:absolute;
margin:0;
width:100%;
border-top:none;
}
#menu ul ul li a {
padding-top:1px;
color:#222222;
}
a:hover
{
color: #00008b;
text-decoration: underline;
}
#menu > ul > li {
-moz-border-radius-topleft:8px;
-moz-border-radius-topright:8px;
-webkit-border-top-left-radius:8px;
}
div.outer
{
width: 90%;
margin: 15%;
}
#menu li div {
display:none;
height:25px;
}
#menu li.current div {
display:block;
}
#menu li:hover div {
display:block;
background:url('img/gradient-200x.png') repeat-x 0 -204px;
z-index:9;
}
table.viewmenu td
{
background-color: #006699;
color: white;
padding: 0 5%;
}
#menu li#forside-meny,
#menu li#forside-meny div {
background:yellow;
}
table.viewmenu td.end
{
padding: 0;
}
#menu li#program-meny,
#menu li#program-meny div {
background:#945FB9;
}
#menu li#informasjon-meny,
#menu li#informasjon-meny div {
background:#D83E00;
}
#menu li#medlem-meny,
#menu li#medlem-meny div {
background:#094f71;
}
#menu li#forum-meny,
#menu li#forum-meny div {
background:#187105;
}
#menu li#inside-meny,
#menu li#inside-meny div {
background: #9D2F2F;
}
#menu li#kontakt-meny,
#menu li#kontakt-meny div {
background: #444444;
}
table.viewmenu a
{
color: white;
font: 8pt verdana, arial;
}
#header .aapningstider {
font-size:12px;
left:50%;
margin-left:366px;
overflow:hidden;
position:absolute;
top:10px;
width:134px;
}
table.viewmenu a:hover
{
color: white;
font: 8pt verdana, arial;
}
/* Header slutt */
a.tinylink
{
color: #00008b;
font: 8pt verdana, arial;
text-decoration: underline;
}
/* Hoveddel */
a.link
{
color: #00008b;
text-decoration: underline;
}
.join a {
background:transparent url(img/sirkel.png) repeat scroll -30px -24px;
color:#2D6372;
display:block;
font-family:Georgia,serif;
font-size:34px;
font-style:italic;
height:129px;
left:-40px;
line-height:1;
padding-left:30px;
padding-top:50px;
position:absolute;
top:-40px;
width:148px;
}
div.buffer
{
padding-top: 7%;
padding-bottom: 17%;
}
.home .hentry {
width:100%;
padding:0;
margin:0 0 40px;
border:none;
}
.small
{
font: 8pt verdana, arial;
}
.info h3 {
margin:0 0 -3px 0;
}
table td
{
padding-right: 20%;
}
.info ul {
background:#B8E2ED none repeat scroll 0 0;
list-style-type:none;
margin:0 0 3em;
padding-bottom:10px;
}
.info ul li {
padding:10px;
}
.info ul li.alt {
background:transparent url(img/transparent-list-bottom.png) repeat scroll center bottom;
left:-10px;
padding:10px 20px 12px;
position:relative;
width:380px;
}
.single .info ul li.alt {
width:280px;
}
.info ul .term {
float:left;
font-weight:bold;
}
.home .info ul .term {
width:50px;
}
.home .info ul .definition {
padding-left:50px;
}
.single .info ul .term {
width:60px;
}
.single .info ul .definition {
padding-left:60px;
}
table td.nopad
{
padding-right: 5%;
}
.home #nyheter img {
width:93px;
height:133px;
float:left;
margin-right:20px;
}
.hentry, .sidebar,#program {
margin-top:15px;
}
.entry-meta {
margin: -12px 0 12px;
}
.vedlegg {
float:right;
margin:0 0 3px 10px;
max-width:300px;
}
.caption {
color:#333333;
font-size:14px;
line-height:1;
margin-bottom:2em;
text-align:center;
}
#vedlegg-2 .caption {
margin-bottom:0.5em;
}
#campaign1, #campaign2 {
width:400px;
height:160px;
background:black;
margin: 40px 0;
}
#internal-ad-single-bottom {
width:500px;
height:150px;
background:black;
margin-bottom:30px;
}
#external-ad-single-bottom {
width:500px;
height:300px;
background:black;
}
/* Hoveddel slutt */
/* Sidebar */
.sidebar ul {
list-style-type:none;
margin-left:0;
}
.sidebar .widget {
margin-bottom:30px;
}
.events.widget li.event {
margin:0 0 40px;
}
/* Sidebar slutt */
/* Footer */
#footer {
background-color:black;
clear:both;
padding-top:20px;
overflow:auto;
}
.program {
margin:auto;
overflow:auto;
width:1000px;
}
.program-teaser .hentry {
float:left;
height:207px;
margin:10px;
padding:16px;
position:relative;
width:150px;
}
.program-teaser .hentry.program-1,
.program-teaser .hentry.program-6 {
margin-left:0;
}
.program-teaser .hentry.program-5,
.program-teaser .hentry.program-10 {
margin-right:0;
}
.program-teaser .entry-title {
font-size:22px;
}
.program-teaser .hentry img {
display:block;
margin:auto;
width:150px;
height:150px;
position:absolute;
bottom:16px;
}
#footer .credits {
clear:both;
float:right;
margin-right:10px;
font-size:14px;
}
/* Footer slutt */
/**
* Typography
*/
body, input, textarea {
font: 14px Helvetica,Arial,sans-serif;
line-height:1.5em;
color:#333333;
}
th,#menu,.entry-meta,.sidebar {
font-family:"Helvetica neue",Helvetica,Tahoma,Verdana,Arial,sans-serif;
}
.info ul {
font-family:"Century Gothic","Avant Garde","Avant Garde Gothic",sans-serif;
}
p, ul, ol, dd, pre {
margin-bottom:1.5em;
}
pre, code {
font:14px Monaco, monospace;
line-height:1.3;
}
a,a:visited {
text-decoration:none;
color: #888;
}
a:hover {
text-decoration:underline;
}
abbr {
border-bottom: 1px dotted;
}
h1 {
font-family: Helvetica,Arial,sans-serif;
font-style:normal;
color: black;
color: black !important;
}
h2,h3,h4,h5,h6 {
font-family: Georgia, serif;
font-style: italic;
}
h1,h2,h3,h4,h5,h6,
.entry-title a {
clear:none;
/*color:#b8e2ed;*/
color:#9dcbdb;
margin-bottom:0.5em;
text-decoration:none;
line-height:1;
}
.entry-title {
font-size: 34px;
}
.entry-title a:hover {
border-bottom: 1px solid #888;
}
h1 {
font-size:34px;
}
h2 {
font-size:25px;
}
h3 {
font-size:23px;
}
h4 {
font-size:20px;
}
h5 {
font-size:18px;
}
h6 {
font-size:16px;
}
.home h3 {
font-size:28px;
}
.home .entry-title,
.home .entry-title a {
font-size:18px;
color:#d83e00;
}
.entry-meta {
font-size:12px;
}
#nyheter {
font-size:15px;
}
/*.sidebar h3 {
margin-bottom:0.1em;
font-size:14px;
}*/
.sidebar {
font-size:12px;
}
/* Lists */
.entry-content ul,
.entry-content ol {
padding:0;
}
.entry-content ul ul,
.entry-content ol ol,
.entry-content ul ol,
.entry-content ol ul {
padding-left:20px;
}
.entry-content ul {
list-style: circle inside;
}
.entry-content ul ul {
list-style: disc inside;
}
.entry-content ul ul ul {
list-style: square inside;
}
.entry-content ul ul ul ul {
list-style: circle inside;
}
.entry-content ul ul ul ul ul {
list-style: disc inside;
}
.entry-content ul ul ul ul ul ul {
list-style: square inside;
}
.entry-content ol {
list-style: decimal inside;
}
.entry-content ol ol {
list-style: upper-roman inside;
}
.entry-content ol ol ol {
list-style: lower-roman inside;
}
.entry-content ol ol ol ol {
list-style: decimal inside;
}
.entry-content ol ol ol ol ol {
list-style: upper-roman inside;
}
.entry-content ol ol ol ol ol ol {
list-style: lower-roman inside;
}
/* Quotes */
.entry-content blockquote {
margin: 1em 2em;
font-style:italic;
background:#eeeeee;
margin:1em 2em;
padding:1px 19px;
}
.entry-content blockquote blockquote {
border:1px solid #000000;
}
.entry-content cite {
font-style:italic;
}
/* Images */
img {
max-width:100%;
}
.entry-content img {
margin: 0 0 10px;
}
.entry-content img.alignright {
margin: 0 0 10px 10px;
}
.entry-content img.alignleft {
margin: 0 10px 10px 0;
}
/******************************
* Styles for inividual pages *
*****************************/
h2.jobb {
background:#eeeeee;
margin-top:0.5em;
padding:10px 10px 5px;
}
+1 -1
View File
@@ -1296,4 +1296,4 @@ class ActionParser {
}
}
?>
?>
+34 -34
View File
@@ -1,35 +1,35 @@
<?php
define("ARTIST", "1");
define("SHOW", "2");
class Categories {
var $categories;
var $conn;
function Categories(){
Categories::__construct();
}
function __construct(){
$conn =& DB::connect(getDSN());
if (DB::isError($conn)){
error("Categories: " . $conn->toString());
exit();
}else {
$this->conn = $conn;
}
$sql = "SELECT id, title FROM tf_article_category";
$result = $this->conn->query($sql);
if (DB::isError($result) != true){
$this->categories = $result;
}
}
public function getCategories(){
return $this->categories;
}
}
<?php
define("ARTIST", "1");
define("SHOW", "2");
class Categories {
var $categories;
var $conn;
function Categories(){
Categories::__construct();
}
function __construct(){
$conn =& DB::connect(getDSN());
if (DB::isError($conn)){
error("Categories: " . $conn->toString());
exit();
}else {
$this->conn = $conn;
}
$sql = "SELECT id, title FROM tf_article_category";
$result = $this->conn->query($sql);
if (DB::isError($result) != true){
$this->categories = $result;
}
}
public function getCategories(){
return $this->categories;
}
}
?>
+219
View File
@@ -0,0 +1,219 @@
<?php
class MemberCard {
protected static $PDO;
const DATETIME_FORMAT = "Y-m-d H:i:s";
private $id;
private $userId;
private $ordered;
private $produced;
private $delivered;
private $active;
private $new;
private $updated;
private $delete;
function __construct() {
// connect to DB
if (!isset(self::$PDO)) {
$dsn = getDSN("PDO");
if (is_null($dsn)) {
throw new Exception("No DSN");
}
try {
self::$PDO = new PDO($dsn["dsn"], $dsn["username"], $dsn["password"]);
self::$PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (Exception $e) {
throw new Exception("Database connection error: ". getDSN());
}
}
$this->selectStmt = self::$PDO->prepare(
"SELECT * FROM din_membercard WHERE id=?");
$this->findByUserIdStmt = self::$PDO->prepare(
"SELECT * FROM din_membercard WHERE userId=?");
$this->insertStmt = self::$PDO->prepare(
"INSERT INTO din_membercard (userId, ordered, produced, delivered, active) VALUES (?, ?, ?, ?, ?)");
$this->updateStmt = self::$PDO->prepare(
"UPDATE din_membercard SET
userId=?,
ordered=?,
produced=?,
delivered=?,
active=?
WHERE id=?");
$this->deleteStmt = self::$PDO->prepare(
"DELETE FROM din_membercard WHERE id=?");
$this->active = 0;
$this->new = true;
$this->updated = false;
$this->delete = false;
}
function findByUserId($userId) {
$this->findByUserIdStmt->execute(array($userId));
$array = $this->findByUserIdStmt->fetch();
$this->findByUserIdStmt->closeCursor();
if (!is_array($array)) {
return false;
}
if (!isset($array['id'])) {
return false;
}
$this->setId($array['id']);
$this->setUserId($array['userId']);
if (!is_null($array['ordered'])) {
$this->setOrdered(new DateTime($array['ordered']));
}
if (!is_null($array['produced'])) {
$this->setProduced(new DateTime($array['produced']));
}
if (!is_null($array['delivered'])) {
$this->setDelivered(new DateTime($array['delivered']));
}
$this->setActive($array['active']);
$this->updated = false;
$this->new = false;
return true;
}
private function doInsert() {
$this->insertStmt->bindValue(1, $this->getUserId());
if (!is_null($this->getOrdered())) {
$this->insertStmt->bindValue(2, $this->getOrdered()->format(self::DATETIME_FORMAT));
} else {
$this->insertStmt->bindValue(2, null);
}
if (!is_null($this->getProduced())) {
$this->insertStmt->bindValue(3, $this->getProduced()->format(self::DATETIME_FORMAT));
} else {
$this->insertStmt->bindValue(3, null);
}
if (!is_null($this->getDelivered())) {
$this->insertStmt->bindValue(4, $this->getDelivered()->format(self::DATETIME_FORMAT));
} else {
$this->insertStmt->bindValue(4, null);
}
$this->insertStmt->bindValue(5, $this->getActive());
$this->insertStmt->execute();
$id = self::$PDO->lastInsertId();
$this->setId($id);
$this->updated = false;
$this->new = false;
}
private function doUpdate() {
$this->updateStmt->bindValue(1, $this->getUserId());
if (!is_null($this->getOrdered())) {
$this->updateStmt->bindValue(2, $this->getOrdered()->format(self::DATETIME_FORMAT));
} else {
$this->updateStmt->bindValue(2, null);
}
if (!is_null($this->getProduced())) {
$this->updateStmt->bindValue(3, $this->getProduced()->format(self::DATETIME_FORMAT));
} else {
$this->updateStmt->bindValue(3, null);
}
if (!is_null($this->getDelivered())) {
$this->updateStmt->bindValue(4, $this->getDelivered()->format(self::DATETIME_FORMAT));
} else {
$this->updateStmt->bindValue(4, null);
}
$this->updateStmt->bindValue(5, $this->getActive());
$this->updateStmt->bindValue(6, $this->getId());
$this->updateStmt->execute();
$this->updated = false;
$this->new = false;
}
private function doDelete() {
$values = array($this->getId());
$this->deleteStmt->execute($values);
}
function store() {
if ($this->delete) {
$this->doDelete();
} elseif ($this->new && $this->updated) {
$this->doInsert();
} elseif ($this->updated) {
$this->doUpdate();
}
}
function getId() {
return $this->id;
}
function setId($id) {
$this->id = $id;
$this->updated = true;
}
function getUserId() {
return $this->userId;
}
function setUserId($userId) {
$this->userId = $userId;
$this->updated = true;
}
function getOrdered() {
return $this->ordered;
}
function setOrdered(DateTime $ordered) {
$this->ordered = $ordered;
$this->updated = true;
}
function getProduced() {
return $this->produced;
}
function setProduced(DateTime $produced) {
$this->produced = $produced;
$this->updated = true;
}
function getDelivered() {
return $this->delivered;
}
function setDelivered(DateTime $delivered) {
$this->delivered = $delivered;
$this->updated = true;
}
function getActive() {
return $this->active;
}
function setActive($active) {
$this->active = $active;
$this->updated = true;
}
}
?>
+186
View File
@@ -0,0 +1,186 @@
<?php
class MembershipActivationCode {
protected static $PDO;
const DATETIME_FORMAT = "Y-m-d H:i:s";
private $id;
private $userId;
private $code;
private $ordered;
private $used;
private $new;
private $updated;
private $delete;
function __construct() {
// connect to DB
if (!isset(self::$PDO)) {
$dsn = getDSN("PDO");
if (is_null($dsn)) {
throw new Exception("No DSN");
}
try {
self::$PDO = new PDO($dsn["dsn"], $dsn["username"], $dsn["password"]);
self::$PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (Exception $e) {
throw new Exception("Database connection error: ". getDSN());
}
}
$this->selectStmt = self::$PDO->prepare(
"SELECT * FROM din_membership_activationcode WHERE id=?");
$this->insertStmt = self::$PDO->prepare(
"INSERT INTO din_membership_activationcode (userId, ordered, used) VALUES (?, ?, ?)");
$this->updateStmt = self::$PDO->prepare(
"UPDATE din_membership_activationcode SET
userId=?,
ordered=?,
used=?
WHERE id=?");
$this->deleteStmt = self::$PDO->prepare(
"DELETE FROM din_membership_activationcode WHERE id=?");
$this->new = true;
$this->updated = false;
$this->delete = false;
}
function findById($id) {
$this->selectStmt->execute(array($id));
$array = $this->findByIdStmt->fetch();
$this->findByIdStmt->closeCursor();
if (!is_array($array)) {
return false;
}
if (!isset($array['id'])) {
return false;
}
$this->setId($array['id']);
$this->setUserId($array['userId']);
if (!is_null($array['ordered'])) {
$this->setOrdered(new DateTime($array['ordered']));
}
if (!is_null($array['used'])) {
$this->setUsed(new DateTime($array['used']));
}
// generate code from id
$this->setCode(substr(crypt(trim($this->getId()), 1813), 2, 6));
$this->updated = false;
$this->new = false;
return true;
}
private function doInsert() {
$this->insertStmt->bindValue(1, $this->getUserId());
if (!is_null($this->getOrdered())) {
$this->insertStmt->bindValue(2, $this->getOrdered()->format(self::DATETIME_FORMAT));
} else {
$this->insertStmt->bindValue(2, null);
}
if (!is_null($this->getUsed())) {
$this->insertStmt->bindValue(3, $this->getUsed()->format(self::DATETIME_FORMAT));
} else {
$this->insertStmt->bindValue(3, null);
}
$this->insertStmt->execute();
$id = self::$PDO->lastInsertId();
$this->setId($id);
$this->updated = false;
$this->new = false;
}
private function doUpdate() {
$this->updateStmt->bindValue(1, $this->getUserId());
if (!is_null($this->getOrdered())) {
$this->updateStmt->bindValue(2, $this->getOrdered()->format(self::DATETIME_FORMAT));
} else {
$this->updateStmt->bindValue(2, null);
}
if (!is_null($this->getUsed())) {
$this->updateStmt->bindValue(3, $this->getUsed()->format(self::DATETIME_FORMAT));
} else {
$this->updateStmt->bindValue(3, null);
}
$this->updateStmt->bindValue(6, $this->getId());
$this->updateStmt->execute();
$this->updated = false;
$this->new = false;
}
private function doDelete() {
$values = array($this->getId());
$this->deleteStmt->execute($values);
}
function store() {
if ($this->delete) {
$this->doDelete();
} elseif ($this->new && $this->updated) {
$this->doInsert();
} elseif ($this->updated) {
$this->doUpdate();
}
}
function getId() {
return $this->id;
}
function setId($id) {
$this->id = $id;
$this->updated = true;
}
function getUserId() {
return $this->userId;
}
function setUserId($userId) {
$this->userId = $userId;
$this->updated = true;
}
function getCode() {
return $this->code;
}
function setCode($code) {
$this->code = $code;
$this->updated = true;
}
function getOrdered() {
return $this->ordered;
}
function setOrdered(DateTime $ordered) {
$this->ordered = $ordered;
$this->updated = true;
}
function getUsed() {
return $this->used;
}
function setUsed(DateTime $used) {
$this->used = $used;
$this->updated = true;
}
}
?>
+219
View File
@@ -0,0 +1,219 @@
<?php
class MembershipCard {
protected static $PDO;
const DATETIME_FORMAT = "Y-m-d H:i:s";
private $id;
private $userId;
private $ordered;
private $produced;
private $delivered;
private $active;
private $new;
private $updated;
private $delete;
function __construct() {
// connect to DB
if (!isset(self::$PDO)) {
$dsn = getDSN("PDO");
if (is_null($dsn)) {
throw new Exception("No DSN");
}
try {
self::$PDO = new PDO($dsn["dsn"], $dsn["username"], $dsn["password"]);
self::$PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (Exception $e) {
throw new Exception("Database connection error: ". getDSN());
}
}
$this->selectStmt = self::$PDO->prepare(
"SELECT * FROM din_membershipcard WHERE id=?");
$this->findByUserIdStmt = self::$PDO->prepare(
"SELECT * FROM din_membershipcard WHERE userId=?");
$this->insertStmt = self::$PDO->prepare(
"INSERT INTO din_membershipcard (userId, ordered, produced, delivered, active) VALUES (?, ?, ?, ?, ?)");
$this->updateStmt = self::$PDO->prepare(
"UPDATE din_membershipcard SET
userId=?,
ordered=?,
produced=?,
delivered=?,
active=?
WHERE id=?");
$this->deleteStmt = self::$PDO->prepare(
"DELETE FROM din_membershipcard WHERE id=?");
$this->active = 0;
$this->new = true;
$this->updated = false;
$this->delete = false;
}
function findByUserId($userId) {
$this->findByUserIdStmt->execute(array($userId));
$array = $this->findByUserIdStmt->fetch();
$this->findByUserIdStmt->closeCursor();
if (!is_array($array)) {
return false;
}
if (!isset($array['id'])) {
return false;
}
$this->setId($array['id']);
$this->setUserId($array['userId']);
if (!is_null($array['ordered'])) {
$this->setOrdered(new DateTime($array['ordered']));
}
if (!is_null($array['produced'])) {
$this->setProduced(new DateTime($array['produced']));
}
if (!is_null($array['delivered'])) {
$this->setDelivered(new DateTime($array['delivered']));
}
$this->setActive($array['active']);
$this->updated = false;
$this->new = false;
return true;
}
private function doInsert() {
$this->insertStmt->bindValue(1, $this->getUserId());
if (!is_null($this->getOrdered())) {
$this->insertStmt->bindValue(2, $this->getOrdered()->format(self::DATETIME_FORMAT));
} else {
$this->insertStmt->bindValue(2, null);
}
if (!is_null($this->getProduced())) {
$this->insertStmt->bindValue(3, $this->getProduced()->format(self::DATETIME_FORMAT));
} else {
$this->insertStmt->bindValue(3, null);
}
if (!is_null($this->getDelivered())) {
$this->insertStmt->bindValue(4, $this->getDelivered()->format(self::DATETIME_FORMAT));
} else {
$this->insertStmt->bindValue(4, null);
}
$this->insertStmt->bindValue(5, $this->getActive());
$this->insertStmt->execute();
$id = self::$PDO->lastInsertId();
$this->setId($id);
$this->updated = false;
$this->new = false;
}
private function doUpdate() {
$this->updateStmt->bindValue(1, $this->getUserId());
if (!is_null($this->getOrdered())) {
$this->updateStmt->bindValue(2, $this->getOrdered()->format(self::DATETIME_FORMAT));
} else {
$this->updateStmt->bindValue(2, null);
}
if (!is_null($this->getProduced())) {
$this->updateStmt->bindValue(3, $this->getProduced()->format(self::DATETIME_FORMAT));
} else {
$this->updateStmt->bindValue(3, null);
}
if (!is_null($this->getDelivered())) {
$this->updateStmt->bindValue(4, $this->getDelivered()->format(self::DATETIME_FORMAT));
} else {
$this->updateStmt->bindValue(4, null);
}
$this->updateStmt->bindValue(5, $this->getActive());
$this->updateStmt->bindValue(6, $this->getId());
$this->updateStmt->execute();
$this->updated = false;
$this->new = false;
}
private function doDelete() {
$values = array($this->getId());
$this->deleteStmt->execute($values);
}
function store() {
if ($this->delete) {
$this->doDelete();
} elseif ($this->new && $this->updated) {
$this->doInsert();
} elseif ($this->updated) {
$this->doUpdate();
}
}
function getId() {
return $this->id;
}
function setId($id) {
$this->id = $id;
$this->updated = true;
}
function getUserId() {
return $this->userId;
}
function setUserId($userId) {
$this->userId = $userId;
$this->updated = true;
}
function getOrdered() {
return $this->ordered;
}
function setOrdered(DateTime $ordered) {
$this->ordered = $ordered;
$this->updated = true;
}
function getProduced() {
return $this->produced;
}
function setProduced(DateTime $produced) {
$this->produced = $produced;
$this->updated = true;
}
function getDelivered() {
return $this->delivered;
}
function setDelivered(DateTime $delivered) {
$this->delivered = $delivered;
$this->updated = true;
}
function getActive() {
return $this->active;
}
function setActive($active) {
$this->active = $active;
$this->updated = true;
}
}
?>
+10 -22
View File
@@ -532,22 +532,6 @@ possibly include it instead? --Thomas Misund, 26. Oct 2009
</div> <!-- #content-wrap -->
<?php
// Print Google Analytics tracking code
?>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-52914-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<?php
$time_end = microtime(true);
$time = round(($time_end - $GLOBALS['time_start']), 4);
@@ -3227,9 +3211,6 @@ Teksten under er hentet fra kunnskapsdatabasen. Du st
while ($row =& $users->users->fetchRow(DB_FETCHMODE_OBJECT)){
$user = new User($row->id);
print "<tr>";
print "<form action=\"" . $action . "\" method=\"post\">";
print "<input type=\"hidden\" name=\"action\" value=\"membership-sale\" />";
print "<input type=\"hidden\" name=\"userid\" value=\"" . $user->getId() . "\" />";
print "<td class=\"number\" id=\"user_" . $user->getId() . "_cardno\">". $user->cardno . "</td>\n";
print "<td><a href=\"index.php?page=display-user&amp;userid=" . $user->id . "\">" . $user->getName() . "</a></td>";
print "<td class=\"is_member\">";
@@ -3250,6 +3231,9 @@ Teksten under er hentet fra kunnskapsdatabasen. Du st
print "<td class=\"is_member\">" . $user->getLastSticker() . "</td>";
print "<td>";
print "<form action=\"" . $action . "\" method=\"post\">";
print "<input type=\"hidden\" name=\"action\" value=\"membership-sale\" />";
print "<input type=\"hidden\" name=\"userid\" value=\"" . $user->getId() . "\" />";
if ($user->hasExpired()) {
if (!$user->getCardProduced()) {
print "forny (produser kort)";
@@ -3280,16 +3264,20 @@ Teksten under er hentet fra kunnskapsdatabasen. Du st
print "-";
}
}
print "</form>";
print "</td>";
print "<td>";
print "<form action=\"" . $action . "\" method=\"post\">";
print "<input type=\"hidden\" name=\"action\" value=\"membership-sale\" />";
print "<input type=\"hidden\" name=\"userid\" value=\"" . $user->getId() . "\" />";
if ($user->getCardDelivered()) {
print "<input type=\"hidden\" name=\"subaction\" value=\"order-new-card\" />";
print "<input type=\"hidden\" name=\"subaction2\" value=\"order-new-card\" />";
print "<input type=\"submit\" name=\"order-new-card\" value=\"bestille nytt kort\" />";
}
print "</form>";
print "</td>";
print "</form>";
print "</tr>";
}
print "</table>";
@@ -3322,4 +3310,4 @@ Teksten under er hentet fra kunnskapsdatabasen. Du st
}
?>
?>
+4 -3
View File
@@ -73,6 +73,7 @@ class Payment {
$description, $returnURL) ) {
$orderRef = $this->payex->getOrderRef(); // get the orderRef
$this->payex->redirect($orderRef); // redirect the user
mysql_query("INSERT INTO `din_transaction_check`(`order_id`,`inserted`,`order_ref`) VALUES('$orderID', NOW(), '$orderRef')");
} else {
echo 'Initialize() failed.<br>';
echo 'Code: '.$this->payex->getcode().' ';
@@ -83,7 +84,7 @@ class Payment {
public function completeTransaction($orderRef, $transaction_id) {
if ( $this->payex->Complete($orderRef) ) {
#file_put_contents('tmp', var_export("\n\n" . time() . "\n\n" . $this->payex->Check($orderRef) . "\n\nTransaction:" . $this->payex->getTransactionStatus() ."\n",true) . "\n\n", FILE_APPEND);
/*
Transaction statuses (defined in payex_defines.php):
0=Sale, 1=Initialize, 2=Credit, 3=Authorize, 4=Cancel, 5=Failure, 6=Capture
@@ -95,7 +96,6 @@ class Payment {
notify("Betalingen er ikke riktig gjennomført. Vennligst ta kontakt med support om du tror dette skyldes en feil.");
return false;
}
$transaction = new Transaction($transaction_id);
$transaction->setStatus("OK");
notify("Betalingen er gjennomført. En kvittering er blitt sendt til din registrerte epostadresse.");
@@ -104,6 +104,7 @@ class Payment {
$this->user_email = $user->email;
}
$this->_sendConfirmationMail($transaction_id);
mysql_query("UPDATE `din_transaction_check` SET `order_ref2` = '$orderRef' WHERE `order_id`='{$transaction->id}' LIMIT 1");
return true;
}else {
notify("Betalingen er ikke riktig gjennomført. Vennligst ta kontakt med support om du tror dette skyldes en feil.");
@@ -135,4 +136,4 @@ class Payment {
}
}
?>
?>
+1549 -1545
View File
File diff suppressed because it is too large. Load diff
+4 -4
View File
@@ -7,10 +7,10 @@ print('<?xml version="1.0" encoding="ISO-8859-1"?'.'>');
$conn = db_connect();
$action = mysql_real_escape_string($_REQUEST['action']);
$action = $_REQUEST['action'];
if ($action == 'checkZip'){
$zip = mysql_real_escape_string($_REQUEST['zip']);
$zip = $_REQUEST['zip'];
if ($zip != "") {
$sql = "SELECT poststed AS postarea
FROM din_postnummer
@@ -72,7 +72,7 @@ if ($action == 'checkZip'){
printRemoveCatXML($type);
}else if ($action == 'checkUsername') {
$username = mysql_real_escape_string($_REQUEST['username']);
$username = $_REQUEST['username'];
$conn = db_connect("forum");
$sql = sprintf("SELECT user_id FROM phpbb_users u "."WHERE username_clean = '%s' ", strtolower($username));
$result = & $conn->query($sql);
@@ -114,4 +114,4 @@ function printRemoveCatXML($type){
<?php
}
?>
?>
+1 -1
View File
@@ -7,7 +7,7 @@ header("Content-type: application/xml");
$conn = db_connect();
$zip = mysql_real_escape_string($_REQUEST['zip']);
$zip = $_REQUEST['zip'];
$sql = "SELECT poststed AS postarea
FROM din_postnummer
+39
View File
@@ -0,0 +1,39 @@
<?php
// Retrieve the data source name for connecting to the MySQL server and
// selecting the sampdb database using our top-secret name and password
// To use the original MySQL module, $driver should be "mysql".
// To use the "MySQL improved" module, $driver should be "mysqli".
// This function is bloated to be able to use the same version on different servers.
function getDSN($host = "default") {
if ($host == "default" || $host == "dns" || $host == "PDO") {
$host_name = "localhost";
$driver = "mysql";
$user_name = "glium337_dbuser";
$password = "sdfXhu4Shgfd";
$db_name = "glium337_dns";
if ($host == "PDO") {
// return PDO compatible DSN
return array(
"dsn" => $driver .":dbname=".$db_name.";host=".$host_name,
"username" => $user_name,
"password" => $password
);
}
} elseif ($host == "forum") {
/*$host_name = "localhost";
$driver = "mysql";
$user_name = "forum2";
$password = "e9bAlSu1oI";
$db_name = "phpbb1";*/
$host_name = "localhost";
$driver = "mysql";
$user_name = "glium337_phpbb";
$password = "n0ffn0ff";
$db_name = "glium337_phpbb";
}
return "$driver://$user_name:$password@$host_name/$db_name";
}
?>
+64
View File
@@ -0,0 +1,64 @@
<?php
/**
* Domain Object parent class
*
* @version 0.1
*/
abstract class domain_DomainObject {
private $id = -1;
function __construct($id = null) {
if (is_null($id)) {
$this->markNew();
} else {
$this->id = $id;
}
}
// Unit of Work pattern - not implemented yet
function markNew() {
domain_ObjectWatcher::addNew($this);
}
function markDeleted() {
domain_ObjectWatcher::addDelete($this);
}
function markDirty() {
domain_ObjectWatcher::addDirty($this);
}
function markClean() {
domain_ObjectWatcher::addClean($this);
}
function setId($id) {
$this->id = $id;
}
function getId() {
return $this->id;
}
function collection() {
return self::getCollection(get_class($this));
}
static function getCollection($type) {
return domain_HelperFactory::getCollection($type);
}
function finder() {
return self::getFinder(get_class($this));
}
static function getFinder($type) {
return domain_HelperFactory::getFinder($type);
}
}
?>
+51
View File
@@ -0,0 +1,51 @@
<?php
/**
* Helper factory for fetching collections from the database mapper
*
* @version 0.1
*/
class domain_HelperFactory {
const MEMBERSHIP = "domain_Membership";
const MEMBERSHIPCARD = "domain_MembershipCard";
const USER = "domain_User";
const USERADDRESS = "domain_UserAddress";
const USERUPDATE = "domain_UserUpdate";
function getCollection($type) {
switch ($type) {
case (self::MEMBERSHIP):
return new mapper_MembershipCollection();
case (self::MEMBERSHIPCARD):
return new mapper_MembershipCardCollection();
case (self::USER):
return new mapper_UserCollection();
case (self::USERADDRESS):
return new mapper_UserAddressCollection();
case (self::USERUPDATE):
return new mapper_UserUpdateCollection();
default:
throw new Exception("Unknown collection type $type");
}
}
function getFinder($type) {
switch ($type) {
case (self::MEMBERSHIP):
return new mapper_MembershipMapper();
case (self::MEMBERSHIPCARD):
return new mapper_MembershipCardMapper();
case (self::USER):
return new mapper_UserMapper();
case (self::USERADDRESS):
return new mapper_UserAddressMapper();
case (self::USERUPDATE):
return new mapper_UserUpdateMapper();
default:
throw new Exception("Unknown finder type $type");
}
}
}
?>
+68
View File
@@ -0,0 +1,68 @@
<?php
/**
* Domain Membership model class
*
* @version 0.1
*/
class domain_Membership extends domain_DomainObject {
private $user;
private $card;
private $created;
private $starts;
private $expires;
function __construct($id = null) {
parent::__construct($id);
}
function setUser(domain_User $user) {
$this->user = $user;
$this->markDirty();
}
function getUser() {
return $this->user;
}
function setCard(domain_MembershipCard $card) {
$this->card = $card;
$this->markDirty();
}
function getCard() {
return $this->card;
}
function setCreated(DateTime $created) {
$this->created = $created;
$this->markDirty();
}
function getCreated() {
return $this->created;
}
function setStarts(DateTime $starts) {
$this->starts = $starts;
$this->markDirty();
}
function getStarts() {
return $this->starts;
}
function setExpires($expires) {
$this->expires = $expires;
$this->markDirty();
}
function getExpires() {
return $this->expires;
}
}
?>
+75
View File
@@ -0,0 +1,75 @@
<?php
/**
* Domain MembershipCard model class
*
* @version 0.1
*/
class domain_MembershipCard extends domain_DomainObject {
private $user;
private $created;
private $produced;
private $lastSticker;
private $stickers;
private $memberships;
function __construct($id = null) {
parent::__construct($id);
}
function setUser(domain_User $user) {
$this->user = $user;
$this->markDirty();
}
function getUser() {
return $this->user;
}
function setCreated(DateTime $created) {
$this->created = $created;
$this->markDirty();
}
function getCreated() {
return $this->created;
}
function setProduced(DateTime $produced) {
$this->produced = $produced;
$this->markDirty();
}
function getProduced() {
return $this->produced;
}
function setLastSticker($laststicker) {
$this->lastSticker = $laststicker;
$this->markDirty();
}
function getLastSticker() {
return $this->lastSticker;
}
function getStickers() {
// if (is_null($this->stickers)) {
// $this->stickers = self::getFinder("domain_MembershipCardSticker")->findByCardId($this->getId());
// }
// return $this->stickers;
return null;
}
function getMemberships() {
if (is_null($this->memberships)) {
$this->memberships = self::getFinder("domain_Membership")->findByCardId($this->getId());
}
return $this->memberships;
}
}
?>
+112
View File
@@ -0,0 +1,112 @@
<?php
/**
* Identity map for ensuring that one object doesnt become two
*
* @version 0.1
*/
class domain_ObjectWatcher {
private $all = array();
private $dirty = array();
private $new = array();
private $delete = array(); // not implemented
private static $instance;
private function __construct() { }
static function instance() {
if (!isset(self::$instance)) {
self::$instance = new domain_ObjectWatcher();
}
return self::$instance;
}
function globalKey(domain_DomainObject $obj) {
$key = get_class($obj) . "." . $obj->getId();
return $key;
}
static function add(domain_DomainObject $obj) {
$inst = self::instance();
$inst->all[$inst->globalKey($obj)] = $obj;
}
static function exists($classname, $id) {
$inst = self::instance();
$key = "$classname.$id";
if (isset($inst->all[$key])) {
return $inst->all[$key];
}
return null;
}
static function addDirty(domain_DomainObject $obj) {
$inst = self::instance();
// verify that the updated object is an object allready in the database
if (!in_array($obj, $inst->new, true)) {
$inst->dirty[$inst->globalKey($obj)] = $obj;
}
}
static function addNew(domain_DomainObject $obj) {
$inst = self::instance();
// we don't yet have an id
$inst->new[] = $obj;
}
/*
* Mark object as clean, changes will not be stored to database
*/
static function addClean(domain_DomainObject $obj) {
$inst = self::instance();
unset($inst->dirty[$inst->globalKey($obj)]);
// check if the object is in the new array, and remove it from it
if (in_array($obj, $inst->new, true)) {
$pruned=array();
foreach ($inst->new as $newobj) {
if (!($newobj === $obj)) {
$pruned[] = $newobj;
}
}
$inst->new = $pruned;
}
}
static function addDelete(domain_DomainObject $obj) {
$inst = self::instance();
unset($inst->dirty[$inst->globalKey($obj)]);
if (in_array($obj, $inst->new, true)) {
$pruned=array();
foreach ($inst->new as $newobj) {
if (!($newobj === $obj)) {
$pruned[] = $newobj;
}
}
$inst->new = $pruned;
}
$inst->delete[] = $obj;
}
function performOperations() {
foreach ($this->dirty as $key=>$obj) {
$obj->finder()->update($obj);
}
foreach ($this->new as $key=>$obj) {
$obj->finder()->insert($obj);
}
foreach ($this->delete as $key=>$obj) {
//$obj->finder()->delete($obj);
}
$this->dirty = array();
$this->new = array();
$this->delete = array();
}
}
?>
+150
View File
@@ -0,0 +1,150 @@
<?php
/**
* Domain User Model class
*
* @version 0.1
*/
class domain_User extends domain_DomainObject {
private $username;
private $firstname;
private $lastname;
private $password;
private $validaddress;
private $email;
private $birthdate;
private $placeOfStudy;
private $passwordreset;
private $divisionIdRequest;
private $updates;
private $memberships;
private $address;
private $cards;
function __construct($id = null) {
parent::__construct($id);
}
function setUsername($username_s) {
$this->username = $username_s;
$this->markDirty();
}
function getUsername() {
return $this->username;
}
function setPassword($password_s) {
$this->password = $password_s;
$this->markDirty();
}
function getPassword() {
return $this->password;
}
function setFirstname($firstname_s) {
$this->firstname = $firstname_s;
$this->markDirty();
}
function getFirstname() {
return $this->firstname;
}
function setLastname($lastname_s) {
$this->lastname = $lastname_s;
$this->markDirty();
}
function getLastname() {
return $this->lastname;
}
function setValidaddress($validaddress_i) {
$this->validaddress = $validaddress_i;
$this->markDirty();
}
function getValidaddress() {
return $this->validaddress;
}
function setEmail($email_s) {
$this->email = $email_s;
$this->markDirty();
}
function getEmail() {
return $this->email;
}
function setBirthdate($birthdate_d) {
$this->birthdate = $birthdate_d;
$this->markDirty();
}
function getBirthdate() {
return $this->birthdate;
}
function setPlaceOfStudy($placeofstudy_i) {
$this->placeOfStudy = $placeofstudy_i;
$this->markDirty();
}
function getPlaceOfStudy() {
return $this->placeOfStudy;
}
function setPasswordreset($passwordreset_i) {
$this->passwordreset = $passwordreset_i;
$this->markDirty();
}
function getPasswordreset() {
return $this->passwordreset;
}
function setDivisionIdRequest($divisionidrequest_i) {
$this->divisionIdRequest = $divisionidrequest_i;
$this->markDirty();
}
function getDivisionIdRequest() {
return $this->divisionIdRequest;
}
function getUpdates() {
if (is_null($this->updates)) {
$this->updates = self::getFinder("domain_UserUpdate")->findByUserId($this->getId());
}
return $this->updates;
}
function getAddress() {
if (is_null($this->address)) {
$this->address = self::getFinder("domain_UserAddress")->findByUserId($this->getId());
}
return $this->address;
}
function getMemberships() {
if (is_null($this->memberships)) {
$this->memberships = self::getFinder("domain_Membership")->findByUserId($this->getId());
}
return $this->memberships;
}
function getCards() {
if (is_null($this->cards)) {
$this->cards = self::getFinder("domain_MembershipCard")->findByUserId($this->getId());
}
return $this->cards;
}
}
?>
+39
View File
@@ -0,0 +1,39 @@
<?php
/**
* Domain UserAddress model class
*
* @version 0.1
*/
class domain_UserAddress extends domain_DomainObject {
private $user;
private $phone;
private $address;
function __construct($id = null) {
parent::__construct($id);
}
function setUser(domain_User $user) {
$this->user = $user;
$this->markDirty();
}
function getUser() {
return $this->user;
}
function setAddress($address) {
$this->phone = $address;
$this->markDirty();
}
function getAddress() {
return $this->address;
}
}
?>
+38
View File
@@ -0,0 +1,38 @@
<?php
/**
* Domain UserPhone model class
*
* @version 0.1
*/
class domain_UserPhone extends domain_DomainObject {
private $user;
private $phone;
function __construct($id = null) {
parent::__construct($id);
}
function setUser(domain_User $user) {
$this->user = $user;
$this->markDirty();
}
function getUser() {
return $this->user;
}
function setPhone($phone) {
$this->phone = $phone;
$this->markDirty();
}
function getPhone() {
return $this->phone;
}
}
?>
+58
View File
@@ -0,0 +1,58 @@
<?php
/**
* Domain UserUpdate model class
*
* @version 0.1
*/
class domain_UserUpdate extends domain_DomainObject {
private $date;
private $message;
private $user;
private $updateBy;
function __construct($id = null) {
parent::__construct($id);
}
function setDate($date_d) {
$this->date = $date_d;
$this->markDirty();
}
function getDate() {
return $this->date;
}
function setMessage($message_s) {
$this->message = $message_s;
$this->markDirty();
}
function getMessage() {
return $this->message;
}
function setUser($user) {
$this->user = $user;
$this->markDirty();
}
function getUser() {
return $this->user;
}
function setUpdatedBy($updatedBy) {
$this->updatedBy = $updatedBy;
$this->markDirty();
}
function getUpdatedBy() {
return $this->updatedBy;
}
}
?>
Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

+1 -1
View File
@@ -10,4 +10,4 @@ $ap->performAction();
$p = new Page();
$p->display();
?>
?>
+85
View File
@@ -0,0 +1,85 @@
<?php
/**
* Collection object for handling multiple rows and creating objects from database results
*
* @version 0.1
*/
abstract class mapper_Collection implements Iterator {
protected $mapper;
protected $total = 0;
protected $raw = array();
private $result;
private $pointer;
private $objects = array();
function __construct(array $raw = null, mapper_Mapper $mapper = null) {
if (!is_null($raw) && !is_null($mapper)) {
$this->rewind();
$this->raw = $raw;
$this->total = count($raw);
}
$this->mapper = $mapper;
}
/**
* Add an object to the collection
**/
function add(domain_DomainObject $object) {
$class = $this->targetClass();
if (!($object instanceof $class)) {
throw new Exception("This is a {$class} collection");
}
$this->notifyAccess();
$this->objects[$this->total] = $object;
$this->total++;
}
abstract function targetClass();
protected function notifyAccess() {
// something is coming here..
}
private function getRow($num) {
$this->notifyAccess();
if ($num >= $this->total || $num < 0) {
return null;
}
if (isset($this->objects[$num])) {
return $this->objects[$num];
}
if (isset($this->raw[$num])) {
// object has not been created yet
$this->objects[$num]=$this->mapper->createObject($this->raw[$num]);
return $this->objects[$num];
}
}
public function rewind() {
$this->pointer = 0;
}
public function current() {
return $this->getRow($this->pointer);
}
public function key() {
return $this->pointer;
}
public function next() {
$row = $this->getRow($this->pointer);
if ($row) {
$this->pointer++;
}
return $row;
}
public function valid() {
return (!is_null($this->current()));
}
}
?>
+94
View File
@@ -0,0 +1,94 @@
<?php
/**
* Abstract mapper class for database mapping from domain
*
* @version 0.1
*/
abstract class mapper_Mapper {
protected static $PDO;
function __construct() {
if (!isset(self::$PDO)) {
$dsn = getDSN("PDO");
if (is_null($dsn)) {
throw new Exception("No DSN");
}
try {
self::$PDO = new PDO($dsn["dsn"], $dsn["username"], $dsn["password"]);
self::$PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (Exception $e) {
throw new Exception("Database connection error: ". getDSN());
}
}
}
function find($id) {
// check if object allready has been fetch from database
$old = $this->getFromMap($id);
if ($old) {
return $old;
}
// get object from database
$this->selectStmt()->execute(array($id));
$array = $this->selectStmt()->fetch();
$this->selectStmt()->closeCursor();
if (!is_array($array)) {
return null;
}
if (!isset($array['id'])) {
return null;
}
$object = $this->createObject($array);
return $object;
}
function findAll() {
$this->selectAllStmt()->execute(array());
return $this->getCollection( $this->selectAllStmt()->fetchAll( PDO::FETCH_ASSOC ) );
}
function createObject($array) {
$old = $this->getFromMap($array['id']);
if ($old) { return $old; }
// construct object
$obj = $this->doCreateObject($array);
// add object to object watcher map
$this->addToMap($obj);
$obj->markClean();
return $obj;
}
function insert(domain_DomainObject $obj) {
$this->doInsert($obj);
$this->addToMap($obj);
}
function delete(domain_DomainObject $obj) {
$this->doDelete($obj);
//$this->removeFromMap($obj);
}
private function getFromMap($id) {
return domain_ObjectWatcher::exists($this->targetClass(), $id);
}
private function addToMap(domain_DomainObject $obj) {
return domain_ObjectWatcher::add($obj);
}
abstract function update(domain_DomainObject $object);
protected abstract function doCreateObject(array $array);
protected abstract function doInsert(domain_DomainObject $object);
protected abstract function doDelete(domain_DomainObject $object);
protected abstract function targetClass();
protected abstract function selectStmt();
protected abstract function selectAllStmt();
protected abstract function deleteStmt();
abstract function getCollection(array $raw);
}
?>
@@ -0,0 +1,14 @@
<?php
/**
* MembershipCard collection - collection of elements in the user database
*
* @version 0.1
*/
class mapper_MembershipCardCollection extends mapper_Collection {
function targetClass() {
return "domain_MembershipCard";
}
}
?>
+86
View File
@@ -0,0 +1,86 @@
<?php
/**
* MembershipCard object mapper to database
*
* @version 0.1
*/
//require_once( "mapper/Mapper.php" );
//require_once( "mapper/UserMapper.php" );
//require_once( "mapper/Collections.php" );
class mapper_MembershipCardMapper extends mapper_Mapper {
function __construct() {
// initialize database connection and common setup
parent::__construct();
// prepare SQL statements
$this->selectStmt = self::$PDO->prepare(
"SELECT c.id as id, u.id as userId, u.hasCard, u.lastSticker, c.date as created FROM din_usedcardno c LEFT JOIN din_user u ON c.id = u.cardno WHERE c.id=?");
$this->selectAllStmt = self::$PDO->prepare(
"SELECT u.id as userId, u.cardno as id, u.hasCard, u.lastSticker, c.date as created FROM din_user u LEFT JOIN din_usedcardno c ON u.cardno = c.id");
$this->findByUserIdStmt = self::$PDO->prepare(
"SELECT c.id as id, u.id as userId, u.hasCard, u.lastSticker, c.date as created FROM din_usedcardno c LEFT JOIN din_user u ON c.id = u.cardno WHERE u.id=?");
// $this->updateStmt = self::$PDO->prepare(
// "UPDATE din_user SET
// cardno=?,
// expires=?,
// WHERE id=?");
// $this->insertStmt = self::$PDO->prepare(
// "INSERT INTO din_user (
// expires
// ) values (?)");
// $this->deleteStmt = self::$PDO->prepare(
// "DELETE FROM din_user WHERE id=?");
}
protected function doCreateObject(array $array) {
$obj = new domain_MembershipCard($array["id"]);
$user_mapper = new mapper_UserMapper();
$obj->setUser($user_mapper->find($array["userId"]));
$obj->setCreated(new DateTime($array["created"]));
if ($array["hasCard"]) $obj->setProduced(new DateTime()); // set produced date to now if card has been produced
$obj->setLastSticker($array["lastSticker"]);
return $obj;
}
protected function doInsert(domain_DomainObject $object) {
}
function update(domain_DomainObject $object) {
}
protected function doDelete(domain_DomainObject $object) {
}
function selectStmt() {
return $this->selectStmt;
}
function selectAllStmt() {
return $this->selectAllStmt;
}
function deleteStmt() {
//return $this->deleteStmt;
}
function findByUserId($userid) {
$this->findByUserIdStmt->execute(array($userid));
return new mapper_MembershipCardCollection($this->findByUserIdStmt->fetchAll(), $this);
}
function getCollection(array $raw) {
return new mapper_MembershipCardCollection($raw, $this);
}
protected function targetClass() {
return "domain_MembershipCard";
}
}
?>
+14
View File
@@ -0,0 +1,14 @@
<?php
/**
* Membership collection - collection of elements in the user database
*
* @version 0.1
*/
class mapper_MembershipCollection extends mapper_Collection {
function targetClass() {
return "domain_Membership";
}
}
?>
+105
View File
@@ -0,0 +1,105 @@
<?php
/**
* Membership object mapper to database
*
* @version 0.1
*/
class mapper_MembershipMapper extends mapper_Mapper {
function __construct() {
// initialize database connection and common setup
parent::__construct();
// prepare SQL statements
$this->selectStmt = self::$PDO->prepare(
"SELECT u.id as userId, u.cardno, u.expires FROM din_user u WHERE u.id=?");
$this->selectAllStmt = self::$PDO->prepare(
"SELECT u.id as userId, u.cardno, u.expires FROM din_user u");
$this->updateStmt = self::$PDO->prepare(
"UPDATE din_user SET
cardno=?,
expires=?,
WHERE id=?");
// $this->insertStmt = self::$PDO->prepare(
// "UPDATE din_user (
// cardno, username, password, firstname, lastname, addresstype, valid_address, email, birthdate, placeOfStudy, passwordReset, division_id_request
// ) values (?)");
$this->deleteStmt = self::$PDO->prepare(
"DELETE FROM din_user WHERE id=?");
$this->findByUserIdStmt = self::$PDO->prepare(
"SELECT u.id as userId, u.cardno, u.expires FROM din_user u WHERE u.id=?");
}
protected function doCreateObject(array $array) {
$obj = new domain_Membership($array["userId"]);
$user_mapper = new mapper_UserMapper();
$obj->setUser($user_mapper->find($array["userId"]));
$card_mapper = new mapper_MembershipCardMapper();
$obj->setCard($card_mapper->find($array["cardno"]));
$obj->setCreated(new DateTime("-9999-12-31"));
$obj->setStarts(new DateTime("-9999-12-31"));
$obj->setExpires(new DateTime($array["expires"]));
return $obj;
}
protected function doInsert(domain_DomainObject $object) {
// $values = array($object->getUsername());
// //$this->insertStmt->execute($values);
// $id = self::$PDO->lastInsertId();
// $object->setId($id);
}
function update(domain_DomainObject $object) {
$values = array(
$object->getCard()->getId(),
$object->getExpires(),
$object->getId()
);
print_r($values);
//$this->updateStmt->execute($values);
}
protected function doDelete(domain_DomainObject $object) {
$values = array($object->getId());
$this->deleteStmt->execute($values);
}
function selectStmt() {
return $this->selectStmt;
}
function selectAllStmt() {
return $this->selectAllStmt;
}
function deleteStmt() {
//return $this->deleteStmt;
}
function findByUserId($userid) {
$this->findByUserIdStmt->execute(array($userid));
return new mapper_MembershipCollection($this->findByUserIdStmt->fetchAll(), $this);
}
function findByCardId($userid) {
//$this->findByCardIdStmt->execute(array($userid));
//return new mapper_UserUpdateCollection($this->findByUserIdStmt->fetchAll(), $this);
$this->selectStmt->execute(array($userid));
return new mapper_MembershipCollection($this->selectStmt->fetchAll(), $this);
}
function getCollection(array $raw) {
return new mapper_MembershipCollection($raw, $this);
}
protected function targetClass() {
return "domain_Membership";
}
}
?>
+14
View File
@@ -0,0 +1,14 @@
<?php
/**
* User address collection - collection of elements in the user address database
*
* @version 0.1
*/
class mapper_UserAddressCollection extends mapper_Collection {
function targetClass() {
return "domain_UserAddress";
}
}
?>
+93
View File
@@ -0,0 +1,93 @@
<?php
/**
* User address object mapper to database
*
* @version 0.1
*/
class mapper_UserAddressMapper extends mapper_Mapper {
function __construct() {
// initialize database connection and common setup
parent::__construct();
// prepare SQL statements
$this->selectStmt = self::$PDO->prepare(
"SELECT user_id, street, zipcode FROM din_useraddressno WHERE user_id=?");
$this->selectAllStmt = self::$PDO->prepare(
"SELECT user_id, street, zipcode FROM din_useraddressno");
$this->updateStmt = self::$PDO->prepare(
"UPDATE din_useraddressno SET
street=?,
zipcode=?,
WHERE user_id=?");
$this->insertStmt = self::$PDO->prepare(
"INSERT INTO din_useraddressno (
user_id, street, zipcode
) values (?, ?, ?)");
$this->deleteStmt = self::$PDO->prepare(
"DELETE FROM din_useraddressno WHERE user_id=?");
$this->findByUserIdStmt = self::$PDO->prepare(
"SELECT user_id, street, zipcode FROM din_useraddressno WHERE user_id=?");
}
protected function doCreateObject(array $array) {
$obj = new domain_Membership($array["user_id"]);
$user_mapper = new mapper_UserMapper();
$obj->setUser($user_mapper->find($array["user_id"]));
$obj->setStreet($array["street"]);
$obj->setZipCode($array["zipcode"]);
return $obj;
}
protected function doInsert(domain_DomainObject $object) {
$values = array($object->getUser()->getId(), $object->getStreet(), $object->getZipCode());
$this->insertStmt->execute($values);
$id = self::$PDO->lastInsertId();
$object->setId($id);
}
function update(domain_DomainObject $object) {
$values = array(
$object->getStreet(),
$object->getZipCode(),
$object->getId()
);
$this->updateStmt->execute($values);
}
protected function doDelete(domain_DomainObject $object) {
$values = array($object->getId());
$this->deleteStmt->execute($values);
}
function selectStmt() {
return $this->selectStmt;
}
function selectAllStmt() {
return $this->selectAllStmt;
}
function deleteStmt() {
return $this->deleteStmt;
}
function findByUserId($userid) {
$this->findByUserIdStmt->execute(array($userid));
return new mapper_UserAddressCollection($this->findByUserIdStmt->fetchAll(), $this);
}
function getCollection(array $raw) {
return new mapper_UserAddressCollection($raw, $this);
}
protected function targetClass() {
return "domain_UserAddress";
}
}
?>
+14
View File
@@ -0,0 +1,14 @@
<?php
/**
* User collection - collection of elements in the user database
*
* @version 0.1
*/
class mapper_UserCollection extends mapper_Collection {
function targetClass() {
return "domain_User";
}
}
?>
+108
View File
@@ -0,0 +1,108 @@
<?php
/**
* User object mapper to database
*
* @version 0.1
*/
class mapper_UserMapper extends mapper_Mapper {
function __construct() {
// initialize database connection and common setup
parent::__construct();
// prepare SQL statements
$this->selectStmt = self::$PDO->prepare(
"SELECT * FROM din_user WHERE id=?");
$this->selectAllStmt = self::$PDO->prepare(
"SELECT * FROM din_user");
$this->updateStmt = self::$PDO->prepare(
"UPDATE din_user SET
username=?,
password=?,
firstname=?,
lastname=?,
addresstype='no',
valid_address=?,
email=?,
birthdate=?,
placeOfStudy=?,
passwordReset=?,
division_id_request=?
WHERE id=?");
$this->insertStmt = self::$PDO->prepare(
"INSERT INTO din_user (
username
) values (?)");
$this->deleteStmt = self::$PDO->prepare(
"DELETE FROM din_user WHERE id=?");
}
protected function doCreateObject(array $array) {
$obj = new domain_User($array["id"]);
$obj->setUsername($array["username"]);
$obj->setPassword($array["password"]);
$obj->setFirstname($array["firstname"]);
$obj->setLastname($array["lastname"]);
$obj->setValidaddress($array["valid_address"]);
$obj->setEmail($array["email"]);
$obj->setBirthdate($array["birthdate"]);
$obj->setPlaceOfStudy($array["placeOfStudy"]);
$obj->setPasswordreset($array["passwordReset"]);
$obj->setDivisionIdRequest($array["division_id_request"]);
return $obj;
}
protected function doInsert(domain_DomainObject $object) {
$values = array($object->getUsername());
//$this->insertStmt->execute($values);
$id = self::$PDO->lastInsertId();
$object->setId($id);
}
function update(domain_DomainObject $object) {
$values = array(
$object->getUsername(),
$object->getPassword(),
$object->getFirstname(),
$object->getLastname(),
$object->getValidAddress(),
$object->getEmail(),
$object->getBirthdate(),
$object->getPlaceOfStudy(),
$object->getPasswordreset(),
$object->getDivisionIdRequest(),
$object->getId()
);
print_r($values);
//$this->updateStmt->execute($values);
}
protected function doDelete(domain_DomainObject $object) {
$values = array($object->getId());
$this->deleteStmt->execute($values);
}
function selectStmt() {
return $this->selectStmt;
}
function selectAllStmt() {
return $this->selectAllStmt;
}
function deleteStmt() {
return $this->deleteStmt;
}
function getCollection(array $raw) {
return new mapper_UserCollection($raw, $this);
}
protected function targetClass() {
return "domain_User";
}
}
?>
+14
View File
@@ -0,0 +1,14 @@
<?php
/**
* User updates collection - collection of elements in the user database
*
* @version 0.1
*/
class mapper_UserUpdateCollection extends mapper_Collection {
function targetClass() {
return "domain_UserUpdate";
}
}
?>
+96
View File
@@ -0,0 +1,96 @@
<?php
/**
* User object mapper to database
*
* @version 0.1
*/
class mapper_UserUpdateMapper extends mapper_Mapper {
function __construct() {
// initialize database connection and common setup
parent::__construct();
// prepare SQL statements
$this->selectStmt = self::$PDO->prepare(
"SELECT * FROM din_userupdate WHERE id=?");
$this->selectAllStmt = self::$PDO->prepare(
"SELECT * FROM din_userupdate");
$this->findByUserIdStmt = self::$PDO->prepare(
"SELECT * FROM din_userupdate WHERE user_id_updated=?");
$this->updateStmt = self::$PDO->prepare(
"UPDATE din_userupdate SET
date=?,
user_id_updated=?,
comment=?,
user_id_updated_by=?
WHERE id=?");
$this->insertStmt = self::$PDO->prepare(
"INSERT INTO din_userupdate (
date, user_id_updated, comment, user_id_updated_by
) values (?,?,?,?)");
$this->deleteStmt = self::$PDO->prepare(
"DELETE FROM din_userupdate WHERE id=?");
}
protected function doCreateObject(array $array) {
$obj = new domain_UserUpdate($array["id"]);
$obj->setDate($array["date"]);
$obj->setUser($array["user_id_updated"]);
$obj->setMessage($array["comment"]);
$obj->setUpdatedBy($array["user_id_updated_By"]);
return $obj;
}
protected function doInsert(domain_DomainObject $object) {
$values = array($object->getUsername());
//$this->insertStmt->execute($values);
$id = self::$PDO->lastInsertId();
$object->setId($id);
}
function update(domain_DomainObject $object) {
$values = array(
$object->getDate(),
$object->getUser(),
$object->getMessage(),
$object->getUpdatedBy(),
$object->getId()
);
print_r($values);
$this->updateStmt->execute($values);
}
protected function doDelete(domain_DomainObject $object) {
$values = array($object->getId());
$this->deleteStmt->execute($values);
}
function selectStmt() {
return $this->selectStmt;
}
function selectAllStmt() {
return $this->selectAllStmt;
}
function deleteStmt() {
return $this->deleteStmt();
}
function findByUserId($userid) {
$this->findByUserIdStmt->execute(array($userid));
return new mapper_UserUpdateCollection($this->findByUserIdStmt->fetchAll(), $this);
}
function getCollection(array $raw) {
return new mapper_UserCollection($raw, $this);
}
protected function targetClass() {
return "domain_UserUpdate";
}
}
?>
+58
View File
@@ -0,0 +1,58 @@
<?php
header("Content-type: Text/plain");
require_once "includes.php";
$conn = & DB :: connect(getDSN());
if (DB :: isError($conn)) {
print ("error: " . $conn->toString());
exit ();
}
$i = 0;
$u = 0;
$sql = "SELECT u.id, u.cardno, u.hasCard, uc.date, u.expires FROM din_user u LEFT JOIN din_usedcardno uc ON u.cardno = uc.id ORDER BY u.cardno";
$result = & $conn->query($sql);
if (DB :: isError($result) != true) {
while($row = & $result->fetchRow(DB_FETCHMODE_ASSOC)) {
if ($row["cardno"] > 0) {
$ins_stmt = "INSERT INTO din_membershipcard (id, userId, ordered, produced, delivered, active) VALUES (";
$ins_stmt .= $row["cardno"] . ", ";
$ins_stmt .= $row["id"] . ", ";
if ($row["date"]) {
$ins_stmt .= "\"" . $row["date"] . "\", ";
} else {
$ins_stmt .= "\"2005-12-28 16:28:31\", ";
}
if ($row["hasCard"] == 1) {
if ($row["date"]) {
$ins_stmt .= "\"" . $row["date"] . "\", ";
} else {
$ins_stmt .= "\"2005-12-28 16:28:31\", ";
}
} else {
$ins_stmt .= "NULL, ";
}
if ($row["hasCard"] == 1) {
if ($row["date"]) {
$ins_stmt .= "\"" . $row["date"] . "\", ";
} else {
$ins_stmt .= "\"2005-12-28 16:28:31\", ";
}
} else {
$ins_stmt .= "NULL, ";
}
$ins_stmt .= $row["hasCard"];
$ins_stmt .= ")";
//print $ins_stmt . "\n";
//$conn->query($ins_stmt);
$i++;
}
}
}
print "\n\nInsert $i rows\nUpdated $u rows";
+101
View File
@@ -0,0 +1,101 @@
<?php
header("Content-type: Text/plain");
require_once "includes.php";
$conn = & DB :: connect(getDSN());
if (DB :: isError($conn)) {
print ("error: " . $conn->toString());
exit ();
}
$i = 0;
$u = 0;
$user = new User(735);
$card = $user->getMembershipCard();
//print_r($card);
if (is_null($card)) {
print "User is missing card!\n\n";
print "Creating card ..\n";
$newcard = new MembershipCard();
$newcard->setOrdered(new DateTime());
$user->setMembershipCard($newcard);
$card = $user->getMembershipCard();
$card->store();
}
print "User " . $user->getName() . " has the following card: \n";
print "Card id " . $card->getId() . "\n";
if (!is_null($card->getOrdered())) {
print "Ordered " . $card->getOrdered()->format(DateTime::RFC1123) . "\n";
}
if (!is_null($card->getProduced())) {
print "Produced " . $card->getProduced()->format(DateTime::RFC1123) . "\n";
}
if (!is_null($card->getDelivered())) {
print "Delivered " . $card->getDelivered()->format(DateTime::RFC1123) . "\n";
}
print "Active " . $card->getActive() . "\n";
$produced = new DateTime();
$produced->modify("+1 month");
$card->setProduced($produced);
print "New time: " . $card->getProduced()->format('U') . "\n";
$card->setActive(false);
$card->store();
print_r($card);
return true;
$sql = "SELECT u.id, u.cardno, u.hasCard, uc.date, u.expires FROM din_user u LEFT JOIN din_usedcardno uc ON u.cardno = uc.id ORDER BY u.cardno";
$result = & $conn->query($sql);
if (DB :: isError($result) != true) {
while($row = & $result->fetchRow(DB_FETCHMODE_ASSOC)) {
if ($row["cardno"] > 0) {
$ins_stmt = "INSERT INTO din_membershipcard (id, userId, ordered, produced, delivered, active) VALUES (";
$ins_stmt .= $row["cardno"] . ", ";
$ins_stmt .= $row["id"] . ", ";
if ($row["date"]) {
$ins_stmt .= "\"" . $row["date"] . "\", ";
} else {
$ins_stmt .= "\"2005-12-28 16:28:31\", ";
}
if ($row["hasCard"] == 1) {
if ($row["date"]) {
$ins_stmt .= "\"" . $row["date"] . "\", ";
} else {
$ins_stmt .= "\"2005-12-28 16:28:31\", ";
}
} else {
$ins_stmt .= "NULL, ";
}
if ($row["hasCard"] == 1) {
if ($row["date"]) {
$ins_stmt .= "\"" . $row["date"] . "\", ";
} else {
$ins_stmt .= "\"2005-12-28 16:28:31\", ";
}
} else {
$ins_stmt .= "NULL, ";
}
$ins_stmt .= $row["hasCard"];
$ins_stmt .= ")";
//print $ins_stmt . "\n";
//$conn->query($ins_stmt);
$i++;
}
}
}
print "\n\nInsert $i rows\nUpdated $u rows";
+1 -1
View File
@@ -8,7 +8,7 @@ header("Content-type: application/xml");
$conn = db_connect();
$posId = mysql_real_escape_string($_REQUEST['positionid']);
$posId = $_REQUEST['positionid'];
$sql = "SELECT name, text
FROM din_position
+700
View File
@@ -0,0 +1,700 @@
/**
* text: #000 (black)
* background: #FFF (white)
* light-fill: #EEE
* conrast-fill: #DDD
* passive-cell: #AAA
* border: #CCC
* link: #00D
*
**/
/* =general
*********************************************************************/
html, body {
margin: 0;
padding: 5px;
font-size: .905em;
line-height: 1.5em;
font-family: arial, sans-serif;
}
img {
border: none;
display: block;
}
td img {
display: inline;
}
.mceEditor img {
display: inline;
}
p {
margin: 0 0 5px 0;
padding: 0;
}
em {
font-style: italic;
}
strong, p.strong {
font-weight: bolder;
}
/* =links
*********************************************************************/
a {
margin: 0;
padding: 0;
text-decoration: none;
color: #00D;
}
a:hover {
text-decoration: underline;
}
a:visited {
color: #00D;
}
th a {
color: #000;
}
th a:visited {
color: #000;
}
.optionsMenu a, a.button, span.button, label.button {
border: 1px solid #CCC;
background: #DDD;
padding: 1px 5px;
margin: 3px 0;
letter-spacing: 1px;
color: #000;
font-weight: bold;
white-space: nowrap;
}
a.read {
font-weight: normal;
}
a.unread {
font-weight: bold;
}
a.skip-nav {
display: none;
}
a.contact {
background: url("graphics/user_go.png") no-repeat right;
padding-right: 20px;
}
/* =lists
*********************************************************************/
ul {
}
li {
}
ul.linker, .linker li {
margin: 0;
padding: 0;
list-style: none;
}
/* =forms
*********************************************************************/
form {
margin: 0;
padding: 0;
}
textarea, input {
font-family: arial, sans-serif;
line-height: 1.2em;
font-size: 1em;
margin: 2px 0;
}
form .title {
font-size: 16px;
font-weight: bold;
}
textarea:focus, input:focus {
background: #FFD;
}
.readonly {
background: inherit;
border: none;
}
fieldset {
width: 90%;
max-width: 600px;
padding: 15px;
border: 3px solid #CCC;
}
fieldset label {
font-weight: bold;
}
legend {
font-weight: bold;
padding: 0 5px;
color: black;
}
fieldset input, fieldset select, fieldset textarea {
margin: 0 15px;
}
input.submit {
margin: 0px;
width: 100px;
}
div.horizontal-form {
padding: 3px;
margin: 5px 0;
background: #EEE;
border: 1px solid #CCC;
font-weight: bold;
}
.delete {
text-align: right;
color: red;
font-weight: bold;
}
.formHelp {
cursor: help;
}
.formHelpMessage {
background: #FFD;
border: 1px solid black;
font-size: 11px;
padding: 3px 3px 3px 20px;
max-width: 300px;
}
.helpMessageClose {
border: 1px solid black;
position: absolute;
top: 2px;
left: 2px;
padding: 0 2px;
line-height: 1em;
cursor: pointer;
background: red;
color: white;
font-weight: bold;
}
/* =tables
*********************************************************************/
table {
margin: 5px 0;
padding: 0;
border: 1px solid #CCC;
}
th {
padding: 0 5px;
text-align: center;
font-weight: bold;
letter-spacing: 2px;
background: #DDD;
}
tr {
padding: 0px;
margin: 0px;
}
td {
vertical-align: top;
padding: 0px 5px;
background: #EEE;
}
td.label {
font-weight: bold;
text-align: right;
}
td.number {
text-align: right;
}
td.phone {
white-space: nowrap;
}
td.date {
white-space: nowrap;
}
td.is_member{
text-align: center;
}
tr.table-footer td {
font-weight: bold;
text-align: center;
}
table.calendar {
width: 98%;
margin: 0 auto;
font-size: .85em;
}
.calendar td {
padding: 0;
margin: 0;
}
td.passive {
background: #AAA;
}
td.weekNumber {
background: #DDD;
text-align: center;
vertical-align: middle;
font-weight: bold;
}
div.calendar-event, label.calendar-event.button {
background: #CCC;
}
div.calendar-concert, label.calendar-concert.button {
background: #DDD;
}
.calendar td div {
padding: 2px 1px;
margin: 1px;
line-height: 1em;
border-bottom: 1px dotted #000;
}
td h4 {
text-align: right;
}
th a {
display: block;
}
table.sortable tr:hover td {
background: #DDD;
}
td.unread {
text-align: center;
font-size: 1.8em;
line-height: 0.1em;
padding: 15px 5px 0px 3px;
}
/* =headings
*********************************************************************/
h1, h2, h3, h4, h5, h6 {
margin: 0;
padding: 0;
line-height: 1.2em;
}
h1 {
font-size: 2em;
}
h2 {
font-size: 1.5em;
text-align: center;
}
h3 {
font-size:1.2em;
}
h4 {
font-size: 1em;
font-weight: bold;
}
/* =header
*********************************************************************/
#header {
background-color: #EEE;
border: 1px solid #CCC;
-moz-border-radius: 8px;
color: #000;
text-align: center;
letter-spacing: 3px;
padding: 5px;
}
#header h1 a {
text-decoration: none;
color: #000;
display: block;
}
/* =navigation
*********************************************************************/
#nav {
float: left;
background-color: #EEE;
border: 1px solid #CCC;
-moz-border-radius: 8px;
color: #000;
width: 170px;
margin: 5px 0 15px 0;
padding: 15px;
}
#navList {
margin: 0px;
padding: 0px;
}
li.menulist {
background: url(graphics/minus.png) no-repeat 3px 0.3em;
line-height: 1.2em;
list-style: none outside;
margin: 0px 0 10px;
padding: 2px 10px;
border: 1px solid black;
}
.jsenabled li.menulist {
background: url(graphics/plus.png) no-repeat 3px 0.3em;
}
.jsenabled .menu, .jsenabled .submenu {
display: none;
}
.menu, .submenu {
margin: 0px;
padding: 0px;
}
.menu li, .submenu li {
background: #EEE;
list-style: none outside;
margin: 3px 5px;
padding: 0px 3px;
border: 1px dotted #CCC;
}
.menu li:hover, .submenu li:hover {
background: #DDD;
}
#nav li a {
color: black;
}
a.switch {
background-color: transparent;
color: #000;
font-size: .9em;
line-height: 1em;
padding-left: 5px;
text-decoration: none;
font-weight: bold;
display: block;
}
a.switch:hover {
text-decoration: underline;
}
.menu li a, .submenu li a {
display: block;
background-color: transparent;
color: #000;
text-decoration: none;
}
.menu li a:hover, submenu li a:hover {
text-decoration: underline;
}
span.key {
text-decoration: underline;
}
#calHeader {
width: 400px;
margin: 0 auto;
}
#previous {
float: left;
margin: 0px;
}
#next {
float: right;
margin: 0px;
}
#previous a, #next a {
border: 1px solid #CCC;
font-weight: bold;
padding: 0 5px;
margin: 0px;
line-height: 1em;
background: #DDD;
color: #000;
}
/* =content
*********************************************************************/
#content {
padding: 0px;
margin: 5px 0 15px 207px;
}
div.text-column {
max-width: 600px;
}
* html div.text-column {
width: 600px;
}
div.article_images {
float: right;
margin: 0px 0px 3px 3px;
width: 200px;
}
div.article_images div {
border: 1px dotted #ccc;
}
/*div.primary_image {
float: right;
margin: 0px 0px 3px 3px;
width: 200px;
border: 1px dotted #ccc;
}
*/
span.caption {
font-size: 11px;
font-style: italic;
}
/*div.extra_image {
float: left;
margin: 0px 3px 3px 0px;
width: 200px;
border: 1px dotted #ccc;
}*/
p.date {
font-style: italic;
}
p.date:first-letter {
text-transform: uppercase;
}
p.subtitle {
font-style: italic;
}
p.intro {
font-weight: bold;
font-style: italic;
}
div.messages, div.errors {
margin: 0 0 5px 0;
padding: 3px;
background: #000;
color: #FFF;
border: 1px solid #CCC;
}
div.messages ul, div.erros ul {
margin: 0 0 0 35px;
padding: 0;
font-weight: bold;
}
div.timeData {
border: 1px solid #CCC;
background: #EEE;
padding: 1px;
}
div.optionsMenu {
margin: 5px 0;
}
div.product {
border: 1px solid black;
margin: 5px;
padding: 5px;
cursor: pointer;
}
div.product_images {
float: right;
}
tr.barshift-full td {
background: #AAA;
font-style: italic;
}
td.worker-status {
text-align: center;
font-weight: bold;
}
div.calendar-barshift {
border: 1px solid #CCC;
}
div.calendar-barshift.full {
border: 1px solid #CCC;
background: #DDD;
}
div.calendar-barshift h4 {
text-align: left;
white-space: nowrap;
}
div.calendar-barshift ul {
margin: 0;
padding: 0;
list-style: none;
}
.calendar-register-me {
border: 1px solid black;
padding: 1px;
width: 50%;
color: black;
margin: 0px;
display: block;
text-align: center;
background: #DDD;
}
div.calendar-barshift li {
white-space: nowrap;
margin: 0;
padding: 0;
}
div.comments {
border-top: 2px solid #CCC;
}
div.comment {
border-top: 2px solid #CCC;
padding: 5px 0;
position: relative;
}
div.comment-meta {
position: absolute;
}
div.comment-main {
margin-left: 150px;
min-height: 60px;
border-left: 2px dotted #CCC;
padding-left: 5px;
}
* html div.comment-main {
height: 60px;
}
.clear-right {
clear: right;
}
/* =footer
*********************************************************************/
#footer {
clear: both;
text-align: center;
background: #EEE;
border: 1px solid #CCC;
-moz-border-radius: 8px;
color: #000;
margin-top: 0px;
}
/* =extras
*********************************************************************/
.domenabled ul#finder, .domenabled ul#finder li, .domenabled ul#finder ul {
list-style-type:none;
margin: 5px 0;
padding:0;
line-height: 1em;
}
.domenabled ul#finder ul.hidden {
display: none;
}
.domenabled ul#finder ul.shown {
margin: 3px 25px;
display: block;
}
.domenabled ul#finder li a {
}
.domenabled #finder a.open {
font-weight: bold;
display: block;
color: black;
}
.domenabled #finder a.parent {
color: black;
}
.domenabled div.disabled {
display: none;
}
+51
View File
@@ -0,0 +1,51 @@
<?php
if (isset($_GET["id"])) $id = $_GET["id"];
else $id = 1;
include("functions.php");
include("domain/DomainObject.php");
include("domain/HelperFactory.php");
include("domain/ObjectWatcher.php");
include("domain/Membership.php");
include("domain/MembershipCard.php");
include("domain/User.php");
include("domain/UserAddress.php");
include("domain/UserUpdate.php");
include("mapper/Collection.php");
include("mapper/Mapper.php");
include("mapper/MembershipCardCollection.php");
include("mapper/MembershipCardMapper.php");
include("mapper/MembershipCollection.php");
include("mapper/MembershipMapper.php");
include("mapper/UserAddressCollection.php");
include("mapper/UserAddressMapper.php");
include("mapper/UserCollection.php");
include("mapper/UserMapper.php");
include("mapper/UserUpdateCollection.php");
include("mapper/UserUpdateMapper.php");
header("Content-type: text/plain");
$user = new domain_User();
$users = $user->collection();
for ($i = 13048; $i <= 13048; $i++) {
if ($user = domain_DomainObject::getFinder("domain_User")->find($i)) {
$users->add($user);
}
}
foreach ($users as $user) {
print_r($user);
$user->getUpdates();;
$user->getMemberships();
$user->getCards();
$user->getAddress();
print_r($user);
//print "\n" . $user->getMemberships()->current()->getStarts()->format("Y-m-d");
}
//$userMapper->update($user);
// perform database modifications
domain_ObjectWatcher::instance()->performOperations();
?>
+406
View File
@@ -0,0 +1,406 @@
1282505719
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>e094adb6c5424befa5252d12c0b7405c</id><date>2010-08-22 19:35:18</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>d3ae9d6518434e00a3c8086a265bab72</transactionRef><transactionNumber>60765680</transactionNumber><orderId>2366</orderId><productId>Handlevogn #2002</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2002</productNumber><clientGsmNumber /><BankHash>f72de24c-a91f-4211-9890-6aecd84c098c</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1282510849
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>5059ac4ca04a4937a8dcbbfee00a2c7f</id><date>2010-08-22 21:00:48</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>32081b3de82f4aaf89acdf35358c7963</transactionRef><transactionNumber>60772833</transactionNumber><orderId>2367</orderId><productId>Handlevogn #2003</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2003</productNumber><clientGsmNumber /><BankHash>6a66af56-1726-4ac3-83fe-d10e7cd68e6c</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1282510871
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>eb391672a83e4deb9d24dc9e730f342e</id><date>2010-08-22 21:01:08</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>32081b3de82f4aaf89acdf35358c7963</transactionRef><transactionNumber>60772833</transactionNumber><orderId>2367</orderId><productId>Handlevogn #2003</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>True</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2003</productNumber><clientGsmNumber /><BankHash>6a66af56-1726-4ac3-83fe-d10e7cd68e6c</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1282550541
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>5e6e90a77b344de499cff2cf158ac923</id><date>2010-08-23 08:02:22</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>d46018b98b8e44acb529d964d692fac0</transactionRef><transactionNumber>60787685</transactionNumber><orderId>2369</orderId><productId>Handlevogn #2005</productId><paymentMethod>VISA</paymentMethod><amount>3500</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2005</productNumber><clientGsmNumber /><BankHash>e2c6be94-b9d6-4eed-b4ba-7a32dc3c6cbd</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1282573529
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>15ea32953976409d8b78d8b6b27eb27e</id><date>2010-08-23 14:25:31</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>ec2df9c96297424d85cd0d47b2f9fcbf</transactionRef><transactionNumber>60819315</transactionNumber><orderId>2370</orderId><productId>Handlevogn #2006</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2006</productNumber><clientGsmNumber /><BankHash>3022deee-1692-456c-9ff3-78fd85716e5b</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1282586080
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>d61d4c5295e64446abf7805e8c91ceed</id><date>2010-08-23 17:54:40</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>7534a641ae95457dbe9a069d1725af50</transactionRef><transactionNumber>60840581</transactionNumber><orderId>2371</orderId><productId>Handlevogn #2007</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2007</productNumber><clientGsmNumber /><BankHash>c2f14ad4-a4e4-43e1-b80d-d62ae09b96df</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1282648956
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>bb5c74d22efc47a79d44bc89895eb9af</id><date>2010-08-24 11:22:36</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>d46f1ca0ab2b4c26a1ddad6882d02305</transactionRef><transactionNumber>60894560</transactionNumber><orderId>2372</orderId><productId>Handlevogn #2008</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2008</productNumber><clientGsmNumber /><BankHash>9c4a0b07-f679-4b8b-8611-0ea840c72f09</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1282685139
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>74cbe5f35ba34bb2815c1a9f8dceddc7</id><date>2010-08-24 21:25:41</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>f7eddf4a4f8b4f7ca079c416a1fbf969</transactionRef><transactionNumber>60947408</transactionNumber><orderId>2373</orderId><productId>Handlevogn #2009</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2009</productNumber><clientGsmNumber /><BankHash>6eeea499-04e6-4954-8c75-12b94dab4b4b</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1282686581
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>a350bc437aaa40ee9ebbe1534a613bdd</id><date>2010-08-24 21:49:43</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>7823b391ec3446fda9338ab72d95a7fb</transactionRef><transactionNumber>60948286</transactionNumber><orderId>2374</orderId><productId>Handlevogn #2010</productId><paymentMethod>VISA</paymentMethod><amount>3500</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2010</productNumber><clientGsmNumber /><BankHash>98520b06-2ab1-4e4f-b36c-fcf426c141d2</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1282723867
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>ac8d5a17f4e842f1859ca72000f8a079</id><date>2010-08-25 08:11:13</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>1499c1b3b24f4a93b1a90c026dcead92</transactionRef><transactionNumber>60964440</transactionNumber><orderId>2375</orderId><productId>Handlevogn #2011</productId><paymentMethod>VISA</paymentMethod><amount>3500</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2011</productNumber><clientGsmNumber /><BankHash>b6c74b29-824c-4c23-9a9c-9579ff8a8a43</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1282727829
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>7de3cea0e77546d7b2db172cd177d27c</id><date>2010-08-25 09:17:18</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>05921260da7d4abfbe17597dc9071de4</transactionRef><transactionNumber>60969140</transactionNumber><orderId>2376</orderId><productId>Handlevogn #2012</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2012</productNumber><clientGsmNumber /><BankHash>eb369acd-4e1f-4754-8102-dd546e6a6feb</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1282738005
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>120f08aca0924528a8b0b0bc5edcbd96</id><date>2010-08-25 12:06:52</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>861db9cc775c45e38c42551663f5d79c</transactionRef><transactionNumber>60984896</transactionNumber><orderId>2377</orderId><productId>Handlevogn #2013</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2013</productNumber><clientGsmNumber /><BankHash>e997ba84-47c3-4859-854a-3c459e29a7da</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1282741121
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>01e6efaf9e71412198f69a8083bcf230</id><date>2010-08-25 12:58:48</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>fe07cfa6713b4f3c90e09b4cdb493131</transactionRef><transactionNumber>60989005</transactionNumber><orderId>2378</orderId><productId>Handlevogn #2014</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2014</productNumber><clientGsmNumber /><BankHash>23dc2914-dfac-465a-ab6e-c696f85f24f4</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1282811261
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>098af6566668442fa046e855b17276c9</id><date>2010-08-26 08:27:47</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>70ffe0dd5a874285a65a8ebf893c358d</transactionRef><transactionNumber>61050450</transactionNumber><orderId>2381</orderId><productId>Handlevogn #2018</productId><paymentMethod>VISA</paymentMethod><amount>3500</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2018</productNumber><clientGsmNumber /><BankHash>a6f06651-0be5-4026-aae0-825bdbb82108</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1282843511
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>2c5567978ed947d8b2f9f6553c6409b1</id><date>2010-08-26 17:25:18</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>7cf90d1bbd87417f8fcedc4a2e184f83</transactionRef><transactionNumber>61092457</transactionNumber><orderId>2382</orderId><productId>Handlevogn #2019</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2019</productNumber><clientGsmNumber /><BankHash>6899f446-ad7a-4402-a2a0-2b09a9c7f395</BankHash><AuthenticatedStatus>None</AuthenticatedStatus><AuthenticatedWith>N</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1282850785
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>653042fdedc14c42b7bd7eabf7dfe01e</id><date>2010-08-26 19:26:30</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>2e07a26fa6f24f7685658c2e43193adc</transactionRef><transactionNumber>61102870</transactionNumber><orderId>2383</orderId><productId>Handlevogn #2020</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2020</productNumber><clientGsmNumber /><BankHash>afef68d3-32fb-4500-ae17-5f1b3edc00ed</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1282853724
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>51ffa9cbafbb4fe98cafb909deece26c</id><date>2010-08-26 20:15:29</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>a772cf01b0d948c4af68b2ec90030381</transactionRef><transactionNumber>61107210</transactionNumber><orderId>2384</orderId><productId>Handlevogn #2021</productId><paymentMethod>VISA</paymentMethod><amount>3500</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2021</productNumber><clientGsmNumber /><BankHash>a9dce6eb-7fa0-4fc8-bb9a-5f67eb6f104e</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1282857116
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>42aeca023601405db1dc54f58cd50e9e</id><date>2010-08-26 21:12:05</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>5</transactionStatus><orderStatus>0</orderStatus><transactionRef>93b181e86a454028b660364a7d4681db</transactionRef><transactionNumber>61111788</transactionNumber><orderId>2385</orderId><productId>Handlevogn #2022</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><errorDetails><transactionErrorCode>OperationCancelledbyCustomer</transactionErrorCode><transactionErrorDescription>Accomplish3rdParty</transactionErrorDescription><transactionThirdPartyError>USER_CANCELED</transactionThirdPartyError></errorDetails><clientAccount>0</clientAccount><productNumber>Handlevogn #2022</productNumber><clientGsmNumber /><transactionFailedReason>CreditCard_Error</transactionFailedReason><BankHash>fdb400b7-ab13-4dbf-922b-cc2e29c34807</BankHash><AuthenticatedWith>N</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1282934047
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>5e6d107f6cb34f6784d94aee2dfcb3df</id><date>2010-08-27 18:34:12</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>55085049016649fbad8b2c9f656b7fe4</transactionRef><transactionNumber>61173917</transactionNumber><orderId>2387</orderId><productId>Handlevogn #2023</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2023</productNumber><clientGsmNumber /><BankHash>9e8db6da-82f6-40d7-a6ea-b4e31923adc4</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1283020700
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>7d005970e5ec4aec958e4ba5a0fc040b</id><date>2010-08-28 18:38:24</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>df0747b89f0e4d5b913e1a7bdb60830a</transactionRef><transactionNumber>61230117</transactionNumber><orderId>2395</orderId><productId>Handlevogn #2022</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2022</productNumber><clientGsmNumber /><BankHash>fdb400b7-ab13-4dbf-922b-cc2e29c34807</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1283025954
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>a1a3c6dec393475eaac30071241158fa</id><date>2010-08-28 20:05:57</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>359191c81f7945509e87b3b7dd3bae1c</transactionRef><transactionNumber>61234078</transactionNumber><orderId>2396</orderId><productId>Handlevogn #2024</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2024</productNumber><clientGsmNumber /><BankHash>bfc2af58-e859-4bf7-83ce-18987986f821</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1283093789
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>e4746b3aba0c4b79b42c831083935616</id><date>2010-08-29 14:56:31</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>5</transactionStatus><orderStatus>0</orderStatus><transactionRef>5a671425a02c4262a9e0205761711c96</transactionRef><transactionNumber>61275180</transactionNumber><orderId>2397</orderId><productId>Handlevogn #2029</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><errorDetails><transactionErrorCode>OperationCancelledbyCustomer</transactionErrorCode><transactionErrorDescription>Accomplish3rdParty</transactionErrorDescription><transactionThirdPartyError>USER_CANCELED</transactionThirdPartyError></errorDetails><clientAccount>0</clientAccount><productNumber>Handlevogn #2029</productNumber><clientGsmNumber /><transactionFailedReason>CreditCard_Error</transactionFailedReason><BankHash>cfab921c-ac1d-4384-b35a-e0f58dfc1b0c</BankHash><AuthenticatedWith>N</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1283094793
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>8695a6799e77436b81c6dbc774331a1c</id><date>2010-08-29 15:13:16</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>110de966de874459bd3009aca71c4c45</transactionRef><transactionNumber>61276520</transactionNumber><orderId>2398</orderId><productId>Handlevogn #2029</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2029</productNumber><clientGsmNumber /><BankHash>cfab921c-ac1d-4384-b35a-e0f58dfc1b0c</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1283117421
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>993852cbe06646e1ba7aa6d65f83edaf</id><date>2010-08-29 21:30:23</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>1bc5196f457749c08f17f3a05e465848</transactionRef><transactionNumber>61309033</transactionNumber><orderId>2399</orderId><productId>Handlevogn #2030</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2030</productNumber><clientGsmNumber /><BankHash>0b203ce0-a937-45f8-ae2b-83e54e193acc</BankHash><AuthenticatedStatus>None</AuthenticatedStatus><AuthenticatedWith>N</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1283153028
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>8442d00e3ad943319741b81938b6fe94</id><date>2010-08-30 07:23:50</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>1c390bdad9754c42ba483f127b5dc4c3</transactionRef><transactionNumber>61321831</transactionNumber><orderId>2400</orderId><productId>Handlevogn #2031</productId><paymentMethod>VISA</paymentMethod><amount>3500</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2031</productNumber><clientGsmNumber /><BankHash>a75352b3-de7c-4c28-ae47-f07d95b9a3a1</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1283167111
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>74571323d258454dac69d37dd475c6d4</id><date>2010-08-30 11:18:33</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>9c20e11f4c554dc9b18cbedacad511d2</transactionRef><transactionNumber>61345231</transactionNumber><orderId>2401</orderId><productId>Handlevogn #2032</productId><paymentMethod>VISA</paymentMethod><amount>3500</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2032</productNumber><clientGsmNumber /><BankHash>36b5e281-5871-48af-93e0-a8a7fd3a6813</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1283203827
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>aca416f295a34a1da3f4520ac2abf18a</id><date>2010-08-30 21:30:27</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>d0e2b3cc44dc4edfbe0f3addc2ace202</transactionRef><transactionNumber>61405709</transactionNumber><orderId>2402</orderId><productId>Handlevogn #2033</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2033</productNumber><clientGsmNumber /><BankHash>94e42dc4-fff7-407d-ae24-3fad8452930a</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1283259775
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>a0039ebc8ae5478d90009856d5ac04a7</id><date>2010-08-31 13:02:56</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>a699c98f29e84864bcdb071bac7f6a66</transactionRef><transactionNumber>61456158</transactionNumber><orderId>2403</orderId><productId>Handlevogn #2035</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2035</productNumber><clientGsmNumber /><BankHash>f8386f65-3ce3-4330-ac6e-2f0b7f387f4d</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1283278469
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>e711fb50999f4899898f6f75f272a835</id><date>2010-08-31 18:14:28</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>a35a9a1024bc4966aa1e24c568bf0000</transactionRef><transactionNumber>61484730</transactionNumber><orderId>2404</orderId><productId>Handlevogn #2036</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2036</productNumber><clientGsmNumber /><BankHash>54c5a40d-a96f-4a52-824b-20ed0cd69a9d</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1283279270
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>100ce69d7fcf41ce8b66e1699102b408</id><date>2010-08-31 18:27:50</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>4d151e1ec8904eb9825079e33f2b7744</transactionRef><transactionNumber>61486047</transactionNumber><orderId>2405</orderId><productId>Handlevogn #2037</productId><paymentMethod>VISA</paymentMethod><amount>3500</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2037</productNumber><clientGsmNumber /><BankHash>bb6affe3-a56c-4158-aeeb-2cdb10267f76</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1283428309
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>a357b465ea754680be4bbce35353839b</id><date>2010-09-02 11:51:53</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>7f040adde7984ddaa0928b6459181f20</transactionRef><transactionNumber>61643552</transactionNumber><orderId>2408</orderId><productId>Handlevogn #2040</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2040</productNumber><clientGsmNumber /><BankHash>83874db6-6775-470f-9333-a4e791dce01a</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1283460713
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>33f73cd7d75f467b8717e31703633b65</id><date>2010-09-02 20:51:58</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>f1b084d30c7f44f296b9447a2fd2c4f9</transactionRef><transactionNumber>61687075</transactionNumber><orderId>2409</orderId><productId>Handlevogn #2042</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2042</productNumber><clientGsmNumber /><BankHash>e9d5c828-7ef8-4182-b6c8-67bbf68d5bb8</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1283609260
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>2b36c602d6bf4127bd7017c7a099d549</id><date>2010-09-04 14:07:44</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>b2c16494d2ea430892e31f434e14ba1c</transactionRef><transactionNumber>61804574</transactionNumber><orderId>2411</orderId><productId>Handlevogn #2044</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2044</productNumber><clientGsmNumber /><BankHash>8fd040fa-def4-489a-875c-6338467b19b4</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1283766055
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>3af5a2d27767442ba33adb8ac1f3c84b</id><date>2010-09-06 09:40:57</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>34a5797f62584eddab3c9ec5a1624e48</transactionRef><transactionNumber>61907498</transactionNumber><orderId>2413</orderId><productId>Handlevogn #2046</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2046</productNumber><clientGsmNumber /><BankHash>041d5df3-a4c5-4a65-905d-5f3c28e17d1b</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1283798299
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>1ec0343876dc458ca1282911faca8389</id><date>2010-09-06 18:38:19</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>fdd1407dbe064a2d8425a2103b247a12</transactionRef><transactionNumber>61960716</transactionNumber><orderId>2414</orderId><productId>Handlevogn #2047</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2047</productNumber><clientGsmNumber /><BankHash>c977e9e0-46c1-4bb6-a99d-d7588d169ab6</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1283809157
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>d2a435fddacb457ca32701a33ce795be</id><date>2010-09-06 21:39:18</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>7a682ca187d8437c88fd3483567d014e</transactionRef><transactionNumber>61975518</transactionNumber><orderId>2415</orderId><productId>Handlevogn #2048</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2048</productNumber><clientGsmNumber /><BankHash>712bc131-5df9-4367-a974-4d7956e893bb</BankHash><AuthenticatedStatus>None</AuthenticatedStatus><AuthenticatedWith>N</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1283876520
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>f9c5be5413c342eca866e225727ca46d</id><date>2010-09-07 16:22:00</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>b232458c8bb849a1879231398ba0d642</transactionRef><transactionNumber>62042444</transactionNumber><orderId>2419</orderId><productId>Handlevogn #2051</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2051</productNumber><clientGsmNumber /><BankHash>3603891b-812e-4dff-95ec-01e86843df9f</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1283946296
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>ff5a4ea5dbef433db472e9f0b903d92f</id><date>2010-09-08 11:45:03</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>c44f0d4906174ee59a8c01024cc93d9e</transactionRef><transactionNumber>62104987</transactionNumber><orderId>2420</orderId><productId>Handlevogn #2052</productId><paymentMethod>VISA</paymentMethod><amount>3500</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2052</productNumber><clientGsmNumber /><BankHash>4fc830ad-8395-42ab-9d0e-d005234d9e4c</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1284033493
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>c24ed26cc7dd4d1db9b3dea3424f259e</id><date>2010-09-09 11:58:18</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>8c2a0c43dbb449298b37ef24d4773744</transactionRef><transactionNumber>62190338</transactionNumber><orderId>2421</orderId><productId>Handlevogn #2053</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2053</productNumber><clientGsmNumber /><BankHash>dbe87dd5-8189-42b7-b317-5aecddd35ff3</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1284033988
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>d100ea7dc3fd498d9fb264382b88f7a4</id><date>2010-09-09 12:06:35</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>8eb9f1f45e914427af632ceb17d87f19</transactionRef><transactionNumber>62190945</transactionNumber><orderId>2422</orderId><productId>Handlevogn #2054</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2054</productNumber><clientGsmNumber /><BankHash>71021cb2-f31c-4cea-952a-895ebe1d412a</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1284054550
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>a20586f809104f1799f3b275501c3b40</id><date>2010-09-09 17:49:19</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>123aa4cddab74a36a601dd8888bb668a</transactionRef><transactionNumber>62219522</transactionNumber><orderId>2423</orderId><productId>Handlevogn #2055</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2055</productNumber><clientGsmNumber /><BankHash>e5088860-1cf8-4a5a-9261-1975d97a4bbb</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1284062934
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>67f80ba8cb154580b4dc395cea66765d</id><date>2010-09-09 20:09:02</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>5</transactionStatus><orderStatus>0</orderStatus><transactionRef>274437709fd7441f8c89ef1a52a8796f</transactionRef><transactionNumber>62230690</transactionNumber><orderId>2424</orderId><productId>Handlevogn #2057</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><errorDetails><transactionErrorCode>PaymentRefusedByFinancialInstitution</transactionErrorCode><transactionErrorDescription>Accomplish3rdParty</transactionErrorDescription><transactionThirdPartyError>REJECTED_BY_ACQUIRER_INSUFFICIENT_FUNDS</transactionThirdPartyError></errorDetails><clientAccount>0</clientAccount><productNumber>Handlevogn #2057</productNumber><clientGsmNumber /><transactionFailedReason>CreditCard_Error</transactionFailedReason><BankHash>736dcb50-c6ed-4375-b18f-6e968991b1e2</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1284118506
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>c5dd9b00c2884a6080733d666263e70c</id><date>2010-09-10 11:35:12</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>2dcd272e05b54b57b236a399bb7521ca</transactionRef><transactionNumber>62269664</transactionNumber><orderId>2425</orderId><productId>Handlevogn #2058</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2058</productNumber><clientGsmNumber /><BankHash>fd21cab2-d40a-4688-a38c-c82e68b49e9e</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1284123934
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>28a7b71a982f444291d3e1b79074f998</id><date>2010-09-10 13:05:39</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>ab508d6f7fc8449daf4ab95eff70bc06</transactionRef><transactionNumber>62279755</transactionNumber><orderId>2426</orderId><productId>Handlevogn #2059</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2059</productNumber><clientGsmNumber /><BankHash>be0c0aa6-5205-44b7-8f2e-c986710e012e</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
1284282203
array (
'CompleteResult' => '<?xml version="1.0" encoding="utf-8" ?><payex><header name="Payex Header v1.0"><id>9d823c70fafa40a98d20003119b5aeff</id><date>2010-09-12 09:03:27</date></header><status><code>OK</code><description>OK</description><errorCode>OK</errorCode><paramName /><thirdPartyError /></status><transactionStatus>0</transactionStatus><orderStatus>0</orderStatus><transactionRef>edc6cb6b514f4c8482de2266ac4f55d7</transactionRef><transactionNumber>62380303</transactionNumber><orderId>2427</orderId><productId>Handlevogn #2061</productId><paymentMethod>VISA</paymentMethod><amount>20000</amount><alreadyCompleted>False</alreadyCompleted><clientAccount>0</clientAccount><productNumber>Handlevogn #2061</productNumber><clientGsmNumber /><BankHash>c3871cdf-4f0a-4b17-9eef-5a84cfd2cb62</BankHash><AuthenticatedStatus>3DSecure</AuthenticatedStatus><AuthenticatedWith>Y</AuthenticatedWith><fraudData>false</fraudData></payex>',
)
tmp
true
+72 -72
View File
@@ -1,73 +1,73 @@
<?php
class App_Base_ApplicationRegistry extends App_Base_Registry {
private static $instance;
//private $freezedir = "data";
private $values = array();
//private $mtimes = array();
private function __construct() {}
static function instance() {
if (!isset(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}
protected function get($key) {
// more get logic here ...
if (isset($this->values[$key])) {
return $this->values[$key];
}
return null;
}
protected function set($key, $val) {
$this->values[$key] = $val;
// storage ...
return $this->values[$key];
}
static function getDSN() {
return self::instance()->get('dsn');
}
static function setDSN( $dsn ) {
return self::instance()->set('dsn', $dsn);
}
static function getControllerMap() {
return self::instance()->get('controllerMap');
}
static function setControllerMap(App_Controller_ControllerMap $map ) {
return self::instance()->set('controllerMap', $map);
}
static function getApplicationController() {
return self::instance()->get('applicationController');
}
static function setApplicationController(App_Controller_AppController $appCtrl) {
return self::instance()->set('applicationController', $appCtrl);
}
static function getAccessManager() {
return self::instance()->get('accessManager');
}
static function setAccessManager(App_Controller_AccessManager $manager) {
return self::instance()->set('accessManager', $manager);
}
static function getPageTitle() {
return self::instance()->get('pagetitle');
}
static function setPageTitle( $pagetitle ) {
return self::instance()->set('pagetitle', $pagetitle);
}
<?php
class App_Base_ApplicationRegistry extends App_Base_Registry {
private static $instance;
//private $freezedir = "data";
private $values = array();
//private $mtimes = array();
private function __construct() {}
static function instance() {
if (!isset(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}
protected function get($key) {
// more get logic here ...
if (isset($this->values[$key])) {
return $this->values[$key];
}
return null;
}
protected function set($key, $val) {
$this->values[$key] = $val;
// storage ...
return $this->values[$key];
}
static function getDSN() {
return self::instance()->get('dsn');
}
static function setDSN( $dsn ) {
return self::instance()->set('dsn', $dsn);
}
static function getControllerMap() {
return self::instance()->get('controllerMap');
}
static function setControllerMap(App_Controller_ControllerMap $map ) {
return self::instance()->set('controllerMap', $map);
}
static function getApplicationController() {
return self::instance()->get('applicationController');
}
static function setApplicationController(App_Controller_AppController $appCtrl) {
return self::instance()->set('applicationController', $appCtrl);
}
static function getAccessManager() {
return self::instance()->get('accessManager');
}
static function setAccessManager(App_Controller_AccessManager $manager) {
return self::instance()->set('accessManager', $manager);
}
static function getPageTitle() {
return self::instance()->get('pagetitle');
}
static function setPageTitle( $pagetitle ) {
return self::instance()->set('pagetitle', $pagetitle);
}
}
+7 -7
View File
@@ -1,8 +1,8 @@
<?php
abstract class App_Base_Registry {
abstract protected function get($key);
abstract protected function set($key, $val);
}
<?php
abstract class App_Base_Registry {
abstract protected function get($key);
abstract protected function set($key, $val);
}
?>
+39 -39
View File
@@ -1,40 +1,40 @@
<?php
/**
* Request registry class
*
*/
class App_Base_RequestRegistry extends App_Base_Registry {
private $values = array();
private static $instance;
private function __construct() {}
static function instance() {
if (!isset(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}
protected function get($key) {
if (isset($this->values[$key])) {
return $this->values[$key];
}
return null;
}
protected function set($key, $value) {
$this->values[$key] = $value;
}
static function getRequest() {
return self::instance()->get('request');
}
static function setRequest(App_Controller_Request $request) {
return self::instance()->set('request', $request);
}
}
<?php
/**
* Request registry class
*
*/
class App_Base_RequestRegistry extends App_Base_Registry {
private $values = array();
private static $instance;
private function __construct() {}
static function instance() {
if (!isset(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}
protected function get($key) {
if (isset($this->values[$key])) {
return $this->values[$key];
}
return null;
}
protected function set($key, $value) {
$this->values[$key] = $value;
}
static function getRequest() {
return self::instance()->get('request');
}
static function setRequest(App_Controller_Request $request) {
return self::instance()->set('request', $request);
}
}
?>
+55 -55
View File
@@ -1,56 +1,56 @@
<?php
/**
* Session registry
*
*/
class App_Base_SessionRegistry extends App_Base_Registry {
private static $instance;
private function __construct() {
session_start();
}
static function instance() {
if (!isset(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}
protected function get($key) {
if (isset($_SESSION[__CLASS__][$key])) {
return $_SESSION[__CLASS__][$key];
}
return null;
}
protected function set($key, $val) {
$_SESSION[__CLASS__][$key] = $val;
}
static function getUserId() {
if (!is_null(self::instance()->get('userid'))) {
//return self::instance()->get('userid');
}
// check session from old inside
if (isset($_SESSION['valid-user'])) {
self::instance()->set('userid', $_SESSION['valid-user']);
}
return self::instance()->get('userid');
}
static function setUserId($userid) {
if (is_null($userid)) {
unset($_SESSION['valid-user']);
self::instance()->set('userid', null);
} else {
// update old inside as well
$_SESSION['valid-user'] = $userid;
self::instance()->set('userid', $userid);
}
}
}
<?php
/**
* Session registry
*
*/
class App_Base_SessionRegistry extends App_Base_Registry {
private static $instance;
private function __construct() {
session_start();
}
static function instance() {
if (!isset(self::$instance)) {
self::$instance = new self();
}
return self::$instance;
}
protected function get($key) {
if (isset($_SESSION[__CLASS__][$key])) {
return $_SESSION[__CLASS__][$key];
}
return null;
}
protected function set($key, $val) {
$_SESSION[__CLASS__][$key] = $val;
}
static function getUserId() {
if (!is_null(self::instance()->get('userid'))) {
//return self::instance()->get('userid');
}
// check session from old inside
if (isset($_SESSION['valid-user'])) {
self::instance()->set('userid', $_SESSION['valid-user']);
}
return self::instance()->get('userid');
}
static function setUserId($userid) {
if (is_null($userid)) {
unset($_SESSION['valid-user']);
self::instance()->set('userid', null);
} else {
// update old inside as well
$_SESSION['valid-user'] = $userid;
self::instance()->set('userid', $userid);
}
}
}
?>
+151
View File
@@ -0,0 +1,151 @@
<?php
/**
* Calendar class
*
* @version 0.1
*/
class App_Calendar_Calendar {
private $date;
private $month;
private $startOfMonth;
private $endOfMonth;
function __construct(DateTime $date) {
$this->fillCalendar($date);
}
function fillCalendar(DateTime $date) {
$this->date = $date;
// set startofmonth to first day of month
$this->startOfMonth = new DateTime("2000-01-01");
$this->startOfMonth->setDate($date->format('Y'), $date->format('m'), 1);
// set endofmonth to last day of month
$this->endOfMonth = new DateTime("2000-01-01");
$this->endOfMonth->setDate($date->format('Y'), $date->format('m'), $date->format('t'));
$this->month = new App_Calendar_Month($this->startOfMonth);
// fill month with weeks
$startofweek = new DateTime("2000-01-01");
$startofweek->setISODate($this->startOfMonth->format('o'), $this->startOfMonth->format('W')); // gets the week number
$startofweek->setTime(0, 0);
while ($startofweek <= $this->endOfMonth) {
$week = new App_Calendar_Week(new DateTime($startofweek->format('Y-m-d')));
for ($i = 1; $i <= 7; $i++) {
$startofday = new DateTime("2000-01-01");
$startofday->setISODate($startofweek->format('o'), $startofweek->format('W'), $i);
$day = new App_Calendar_Day($startofday);
$week->addDay($day);
}
$this->month->addWeek($week);
// add seven days to startofweek
$startofweek->setISODate($startofweek->format('o'), $startofweek->format('W'), 8);
}
}
function getMonth() {
return $this->month;
}
function isInMonth(App_Calendar_Day $day) {
if (($day->getDate() >= $this->startOfMonth) && ($day->getDate() <= $this->endOfMonth)) {
return true;
}
return false;
}
}
/**
* Calendar month class
*
* @version 0.1
*/
class App_Calendar_Month {
private $month;
private $weeks = array();
function __construct(DateTime $month) {
$this->month = $month;
}
function getMonth() {
return $this->month;
}
function setMonthName($name) {
$this->monthName = $name;
}
function getMonthName() {
return $this->monthName;
}
function addWeek(App_Calendar_Week $week) {
$this->weeks[] = $week;
}
function getWeeks() {
return $this->weeks;
}
}
/**
* Calendar week class
*
* @version 0.1
*/
class App_Calendar_Week {
private $week;
private $days = array();
function __construct($week) {
$this->week = $week;
}
function getWeek() {
return $this->week;
}
function addDay(App_Calendar_Day $day) {
$this->days[] = $day;
}
function getDays() {
return $this->days;
}
}
/**
* Calendar day class
*
* @version 0.1
*/
class App_Calendar_Day {
private $date;
private $shifts = array();
function __construct(DateTime $date) {
$this->date = $date;
}
function getDate() {
return $this->date;
}
function addShift(App_Domain_WorkShift $shift) {
$this->shifts[] = $shift;
}
function getShifts() {
return $this->shifts;
}
}
?>
+79 -41
View File
@@ -1,42 +1,80 @@
<?php
/**
* Add shift command class
*/
class App_Command_AddShift extends App_Command_Command {
function doExecute(App_Controller_Request $request) {
$title = $request->getProperty("title");
$starts = $request->getProperty("starts");
$ends = $request->getProperty("ends");
$numworkers = $request->getProperty("numworkers");
$location = $request->getProperty("location");
$group = 97; // CNS bar
$salaryType = 3; // CNS bar
if (empty($title)) {
$request->addFeedback("Tittel må oppgis.");
return self::statuses('CMD_INSUFFICIENT_DATA');
}
if (empty($starts)) {
$request->addFeedback("Starttid må oppgis.");
return self::statuses('CMD_INSUFFICIENT_DATA');
}
if (empty($ends)) {
$request->addFeedback("Sluttid må oppgis.");
return self::statuses('CMD_INSUFFICIENT_DATA');
}
if (empty($numworkers)) {
$request->addFeedback("Antall må oppgis.");
return self::statuses('CMD_INSUFFICIENT_DATA');
}
return self::statuses('CMD_OK');
}
}
<?php
/**
* Add shift command class
*/
class App_Command_AddShift extends App_Command_Command {
function doExecute(App_Controller_Request $request) {
$title = $request->getProperty("title");
$starts = $request->getProperty("starts_date") . " " . $request->getProperty("starts_time");
$ends = $request->getProperty("ends_date") . " " . $request->getProperty("ends_time");
$num_workers = $request->getProperty("num_workers");
$comment = $request->getProperty("comment");
$request->setProperty("location", 4); // glassbaren
$groupid = 97; // CNS bar
$salaryType = 3;
$locations = App_Domain_Location::getFinder("App_Domain_Location")->findAll();
$location = App_Domain_location::getFinder("App_Domain_Location")->find($request->getProperty("location"));
$request->setObject("locations", $locations);
if (is_null($request->getProperty("title"))) {
// no user data given yet, show add shift page
$request->setProperty("starts_date", date("j/n/Y"));
$request->setProperty("starts_time", date("H:i"));
$request->setProperty("ends_date", date("j/n/Y"));
$request->setProperty("ends_time", date("H:i"));
return self::statuses('CMD_DEFAULT');
}
if (empty($title)) {
$request->addFeedback("Tittel må oppgis.");
return self::statuses('CMD_INSUFFICIENT_DATA');
}
if (empty($starts)) {
$request->addFeedback("Starttid må oppgis.");
return self::statuses('CMD_INSUFFICIENT_DATA');
} else {
// change dd/mm/yyyy to dd.mm.yyyy to be on a valid date format
$starts = str_replace("/", ".", $starts);
}
if (empty($ends)) {
$request->addFeedback("Sluttid må oppgis.");
return self::statuses('CMD_INSUFFICIENT_DATA');
} else {
// change dd/mm/yyyy to dd.mm.yyyy to be on a valid date format
$ends = str_replace("/", ".", $ends);
}
if (empty($num_workers)) {
$request->addFeedback("Antall må oppgis.");
return self::statuses('CMD_INSUFFICIENT_DATA');
}
$salary_type_object = App_Domain_DomainObject::getFinder("App_Domain_WorkSalaryType")->find($salaryType);
$group = App_Domain_DomainObject::getFinder("App_Domain_Group")->find($groupid);
$shift = new App_Domain_WorkShift();
$shift->setTitle($title);
$shift->setStarts(new DateTime($starts));
$shift->setEnds(new DateTime($ends));
$shift->setActive(true);
$shift->setComment($comment);
$shift->setLocked(false);
$shift->setAutoAssignWorkers(false);
$shift->setNumWorkers($num_workers);
$shift->setGroup($group);
$shift->setSalaryType($salary_type_object);
$shift->setLocation($location);
return self::statuses('CMD_OK');
}
}
?>
+40 -40
View File
@@ -1,41 +1,41 @@
<?php
abstract class App_Command_Command {
private static $STATUS_STRINGS = array (
'CMD_DEFAULT' => 0,
'CMD_OK' => 1,
'CMD_ERROR' => 2,
'CMD_INSUFFICIENT_DATA' => 3
);
private $status = 0;
//private $currentUser = null;
final function __construct() {}
function execute(App_Controller_Request $request) {
// check if visitor is logged in
//$this->currentUser = App_Base_SessionRegistry::getCurrentUser();
// execute command
$this->status = $this->doExecute($request);
$request->setCommand($this);
}
function getStatus() {
return $this->status;
}
static function statuses ($str = 'CMD_DEFAULT') {
if (empty($str)) $str = 'CMD_DEFAULT';
// convert string into a status number
return self::$STATUS_STRINGS[$str];
}
//abstract protected function validate(App_Controller_Request $request);
abstract function doExecute(App_Controller_Request $request);
}
<?php
abstract class App_Command_Command {
private static $STATUS_STRINGS = array (
'CMD_DEFAULT' => 0,
'CMD_OK' => 1,
'CMD_ERROR' => 2,
'CMD_INSUFFICIENT_DATA' => 3
);
private $status = 0;
//private $currentUser = null;
final function __construct() {}
function execute(App_Controller_Request $request) {
// check if visitor is logged in
//$this->currentUser = App_Base_SessionRegistry::getCurrentUser();
// execute command
$this->status = $this->doExecute($request);
$request->setCommand($this);
}
function getStatus() {
return $this->status;
}
static function statuses ($str = 'CMD_DEFAULT') {
if (empty($str)) $str = 'CMD_DEFAULT';
// convert string into a status number
return self::$STATUS_STRINGS[$str];
}
//abstract protected function validate(App_Controller_Request $request);
abstract function doExecute(App_Controller_Request $request);
}
?>
+12 -12
View File
@@ -1,12 +1,12 @@
<?php
class App_Command_CommandHelper {
static function getCurrentUser() {
if (!is_null(App_Base_SessionRegistry::getUserId())) {
return App_Domain_DomainObject::getFinder("App_Domain_User")->find(App_Base_SessionRegistry::getUserId());
}
return null;
}
}
?>
<?php
class App_Command_CommandHelper {
static function getCurrentUser() {
if (!is_null(App_Base_SessionRegistry::getUserId())) {
return App_Domain_DomainObject::getFinder("App_Domain_User")->find(App_Base_SessionRegistry::getUserId());
}
return null;
}
}
?>
+24 -24
View File
@@ -1,24 +1,24 @@
<?php
/**
* Default command class is used if no command class is found
*/
class App_Command_DefaultCommand extends App_Command_Command {
//protected function validate(App_Controller_Request $request) {
//}
function doExecute(App_Controller_Request $request) {
// check if user is logged in
$user = App_Command_CommandHelper::getCurrentUser();
if (!is_null($user)) {
$request->setObject('currentUser', $user);
return self::statuses('CMD_OK');
}
// if ($request->getProperty("p") == "login") {
// $request->addFeedback( "you are logged in" );
// return self::statuses('CMD_OK');
// }
return self::statuses('CMD_DEFAULT');
}
}
<?php
/**
* Default command class is used if no command class is found
*/
class App_Command_DefaultCommand extends App_Command_Command {
//protected function validate(App_Controller_Request $request) {
//}
function doExecute(App_Controller_Request $request) {
// check if user is logged in
$user = App_Command_CommandHelper::getCurrentUser();
if (!is_null($user)) {
$request->setObject('currentUser', $user);
return self::statuses('CMD_OK');
}
// if ($request->getProperty("p") == "login") {
// $request->addFeedback( "you are logged in" );
// return self::statuses('CMD_OK');
// }
return self::statuses('CMD_DEFAULT');
}
}
+37
View File
@@ -0,0 +1,37 @@
<?php
/**
* Add shift command class
*/
class App_Command_GetShift extends App_Command_Command {
function doExecute(App_Controller_Request $request) {
if (is_null($request->getProperty("shift"))) {
$request->addFeedback("Skift må oppgis");
return self::statuses('CMD_INSUFFICIENT_DATA');
}
$shift = App_Domain_WorkShift::getFinder("App_Domain_WorkShift")->find($request->getProperty("shift"));
if (is_null($shift)) {
$request->addFeedback("Fant ikke skiftet");
return self::statuses('CMD_ERROR');
}
$request->setProperty("starts_date", $shift->getStarts()->format("j/n/Y"));
$request->setProperty("starts_time", $shift->getStarts()->format("H:i"));
$request->setProperty("ends_date", $shift->getEnds()->format("j/n/Y"));
$request->setProperty("ends_time", $shift->getEnds()->format("H:i"));
$request->setProperty("title", $shift->getTitle());
$request->setProperty("num_workers", $shift->getNumWorkers());
$request->setProperty("location", $shift->getLocation()->getId());
$locations = App_Domain_Location::getFinder("App_Domain_Location")->findAll();
$request->setObject("locations", $locations);
return self::statuses('CMD_OK');
}
}
?>
+26 -26
View File
@@ -1,27 +1,27 @@
<?php
/**
* Default command class is used if no command class is found
*/
class App_Command_Login extends App_Command_Command {
function doExecute(App_Controller_Request $request) {
$username = $request->getProperty("username");
$password = $request->getProperty("password");
if (empty($username) || empty($password)) {
$request->addFeedback("Både brukernavn og passord må oppgis.");
return self::statuses('CMD_INSUFFICIENT_DATA');
}
$manager = App_Base_ApplicationRegistry::getAccessManager();
$user = $manager->login($username, $password);
if (is_null($user)) {
$request->addFeedback("Ugyldig brukernavn eller passord.");
return self::statuses('CMD_ERROR');
}
App_Base_SessionRegistry::setUserId($user->getId());
return self::statuses('CMD_OK');
}
}
<?php
/**
* Default command class is used if no command class is found
*/
class App_Command_Login extends App_Command_Command {
function doExecute(App_Controller_Request $request) {
$username = $request->getProperty("username");
$password = $request->getProperty("password");
if (empty($username) || empty($password)) {
$request->addFeedback("Både brukernavn og passord må oppgis.");
return self::statuses('CMD_INSUFFICIENT_DATA');
}
$manager = App_Base_ApplicationRegistry::getAccessManager();
$user = $manager->login($username, $password);
if (is_null($user)) {
$request->addFeedback("Ugyldig brukernavn eller passord.");
return self::statuses('CMD_ERROR');
}
App_Base_SessionRegistry::setUserId($user->getId());
return self::statuses('CMD_OK');
}
}
?>
+14 -14
View File
@@ -1,15 +1,15 @@
<?php
/**
* Default command class is used if no command class is found
*/
class App_Command_Logout extends App_Command_Command {
function doExecute(App_Controller_Request $request) {
$request->addFeedback("Du er logget ut");
App_Base_SessionRegistry::setUserId(null);
return self::statuses('CMD_DEFAULT');
}
}
<?php
/**
* Default command class is used if no command class is found
*/
class App_Command_Logout extends App_Command_Command {
function doExecute(App_Controller_Request $request) {
$request->addFeedback("Du er logget ut");
App_Base_SessionRegistry::setUserId(null);
return self::statuses('CMD_DEFAULT');
}
}
?>
+53
View File
@@ -0,0 +1,53 @@
<?php
/**
* View calendar command class
*/
class App_Command_ViewCalendar extends App_Command_Command {
function doExecute(App_Controller_Request $request) {
if (is_null($request->getProperty("month"))) {
// no month given, show current month
$calendar = new App_Calendar_Calendar(new DateTime());
} else {
$calendar = new App_Calendar_Calendar(new DateTime($request->getProperty("month")."-01"));
}
// Set month name
$calendar->getMonth()->setMonthName($calendar->getMonth()->getMonth()->format("F"));
// Add shifts to calendar
$shifts = App_Domain_Location::getFinder("App_Domain_WorkShift")->findAll();
$shifts->rewind();
// initialization
$shift = $shifts->next();
foreach ($calendar->getMonth()->getWeeks() as $week) {
foreach ($week->getDays() as $day) {
// end of day in PHP 5.2.0
$dayends = clone $day->getDate();
$dayends->modify("+1 day");
while ($shifts->valid() && ($shift->getStarts() < $dayends)) {
//while ($shifts->valid() && ($shift->getStarts() < $day->getDate()->add(new DateInterval('P1D'))) { // Requires PHP >= 5.3.0
// Skip shifts that starts before current day
if ($shift->getStarts() >= $day->getDate()) {
$day->addShift($shift);
}
// go to next shift
$shift = $shifts->next();
}
}
}
$request->setObject('calendar', $calendar);
return self::statuses('CMD_DEFAULT');
}
}
?>
+36 -34
View File
@@ -1,35 +1,37 @@
<?php
/**
* Manage user access to commands and handle login
*/
class App_Controller_AccessManager {
private $error;
function getError() {
return $this->error;
}
function setError($msg) {
$this->error = $msg;
}
function login($username, $password) {
return App_Domain_DomainObject::getFinder(App_Domain_HelperFactory::USER)->findByLogin($username, $password);
}
function logout() {
if (!is_null(App_Base_SessionRegistry::getUserId())) {
// do something, i.e. logging ?
}
return true;
}
function getCommandAccess($cmd) {
if (!is_null(App_Base_SessionRegistry::getUserId())) {
return true;
}
return false;
}
<?php
/**
* Manage user access to commands and handle login
*/
class App_Controller_AccessManager {
private $error;
function getError() {
return $this->error;
}
function setError($msg) {
$this->error = $msg;
}
function login($username, $password) {
return App_Domain_DomainObject::getFinder(App_Domain_HelperFactory::USER)->findByLogin($username, $password);
}
function logout() {
if (!is_null(App_Base_SessionRegistry::getUserId())) {
// do something, i.e. logging ?
}
return true;
}
function getCommandAccess($cmd) {
// Do the user has access to the specified command ?
// Currently not implemented, return true if user is logged in
if (!is_null(App_Base_SessionRegistry::getUserId())) {
return true;
}
return false;
}
}
+115 -115
View File
@@ -1,116 +1,116 @@
<?php
class App_Controller_AppController {
private static $base_cmd;
private static $default_cmd;
private $controllerMap;
private $invoked = array();
function __construct(App_Controller_ControllerMap $map) {
$this->controllerMap = $map;
if (!self::$base_cmd) {
self::$base_cmd = new ReflectionClass("App_Command_Command");
self::$default_cmd = new App_Command_DefaultCommand();
}
}
function getView(App_Controller_Request $request) {
$view = $this->getResource($request, "View");
return $view;
}
function getForward(App_Controller_Request $request) {
$forward = $this->getResource($request, "Forward");
if ($forward) {
$request->setProperty("cmd", $forward);
}
return $forward;
}
private function getResource(App_Controller_Request $request, $res) {
// get the previous command and its execution status
$cmd_str = $request->getProperty("cmd");
$previous = $request->getLastCommand();
$status = $previous->getStatus();
if (!$status) {
$status = 0;
}
$acquire = "get$res";
// find resource for previous command and its status
$resource = $this->controllerMap->$acquire($cmd_str, $status);
// alternatively find resource for command and status 0
if (!$resource) {
$resource = $this->controllerMap->$acquire($cmd_str, 0);
}
// or command 'default' and command status
if (!$resource) {
$resource = $this->controllerMap->$acquire('default', $status);
}
// all else has failed get resource for 'default', status 0
if (!$resource) {
$resource = $this->controllerMap->$acquire('default', 0);
}
return $resource;
}
function getCommand(App_Controller_Request $request) {
$previous = $request->getLastCommand();
if (!$previous) {
// this is first command for this request
$cmd = $request->getProperty("cmd");
if (!$cmd) {
// no command property - using default
$request->setProperty("cmd", "default");
return self::$default_cmd;
}
} else {
// a command has been run already in this request
$cmd = $this->getForward($request);
if (!$cmd) {
return null;
}
}
// we now have a command name in $cmd - turn it into a Command object
$cmd_obj = $this->resolveCommand($cmd);
if (!$cmd_obj) {
throw new Exception("Couldn't resolve '$cmd'");
}
// Count the number of times the class has been accessed and check for circular forwarding
$cmd_class = get_class($cmd_obj);
if (isset($this->invoked[$cmd_class])) {
$this->invoked[$cmd_class]++;
} else {
$this->invoked[$cmd_class] = 1;
}
if ($this->invoked[$cmd_class] > 1) {
throw new Exception("Circular forwarding");
}
// return the Command object
return $cmd_obj;
}
function resolveCommand($cmd) {
$sep = "/";
$cmd = str_replace(array(".", $sep), "", $cmd);
$classroot = $this->controllerMap->getClassroot($cmd);
$filepath = "App{$sep}Command{$sep}{$classroot}.php";
$classname = "App_Command_{$classroot}";
if (file_exists($filepath)) {
@require_once("$filepath");
if (class_exists($classname)) {
$cmd_class = new ReflectionClass($classname);
if ($cmd_class->isSubClassOf( self::$base_cmd )) {
return $cmd_class->newInstance();
}
}
}
return null;
}
}
<?php
class App_Controller_AppController {
private static $base_cmd;
private static $default_cmd;
private $controllerMap;
private $invoked = array();
function __construct(App_Controller_ControllerMap $map) {
$this->controllerMap = $map;
if (!self::$base_cmd) {
self::$base_cmd = new ReflectionClass("App_Command_Command");
self::$default_cmd = new App_Command_DefaultCommand();
}
}
function getView(App_Controller_Request $request) {
$view = $this->getResource($request, "View");
return $view;
}
function getForward(App_Controller_Request $request) {
$forward = $this->getResource($request, "Forward");
if ($forward) {
$request->setProperty("cmd", $forward);
}
return $forward;
}
private function getResource(App_Controller_Request $request, $res) {
// get the previous command and its execution status
$cmd_str = $request->getProperty("cmd");
$previous = $request->getLastCommand();
$status = $previous->getStatus();
if (!$status) {
$status = 0;
}
$acquire = "get$res";
// find resource for previous command and its status
$resource = $this->controllerMap->$acquire($cmd_str, $status);
// alternatively find resource for command and status 0
if (!$resource) {
$resource = $this->controllerMap->$acquire($cmd_str, 0);
}
// or command 'default' and command status
if (!$resource) {
$resource = $this->controllerMap->$acquire('default', $status);
}
// all else has failed get resource for 'default', status 0
if (!$resource) {
$resource = $this->controllerMap->$acquire('default', 0);
}
return $resource;
}
function getCommand(App_Controller_Request $request) {
$previous = $request->getLastCommand();
if (!$previous) {
// this is first command for this request
$cmd = $request->getProperty("cmd");
if (!$cmd) {
// no command property - using default
$request->setProperty("cmd", "default");
return self::$default_cmd;
}
} else {
// a command has been run already in this request
$cmd = $this->getForward($request);
if (!$cmd) {
return null;
}
}
// we now have a command name in $cmd - turn it into a Command object
$cmd_obj = $this->resolveCommand($cmd);
if (!$cmd_obj) {
throw new Exception("Couldn't resolve '$cmd'");
}
// Count the number of times the class has been accessed and check for circular forwarding
$cmd_class = get_class($cmd_obj);
if (isset($this->invoked[$cmd_class])) {
$this->invoked[$cmd_class]++;
} else {
$this->invoked[$cmd_class] = 1;
}
if ($this->invoked[$cmd_class] > 1) {
throw new Exception("Circular forwarding");
}
// return the Command object
return $cmd_obj;
}
function resolveCommand($cmd) {
$sep = "/";
$cmd = str_replace(array(".", $sep), "", $cmd);
$classroot = $this->controllerMap->getClassroot($cmd);
$filepath = "App{$sep}Command{$sep}{$classroot}.php";
$classname = "App_Command_{$classroot}";
if (file_exists($filepath)) {
@require_once("$filepath");
if (class_exists($classname)) {
$cmd_class = new ReflectionClass($classname);
if ($cmd_class->isSubClassOf( self::$base_cmd )) {
return $cmd_class->newInstance();
}
}
}
return null;
}
}
?>
+119 -109
View File
@@ -1,110 +1,120 @@
<?php
class App_Controller_ApplicationHelper {
private static $instance;
//private $config = "options.xml";
private function __construct() {}
static function instance() {
if (!self::$instance) {
self::$instance = new self;
}
return self::$instance;
}
function init() {
$dsn = App_Base_ApplicationRegistry::getDSN();
if (!is_null($dsn)) {
return;
}
$this->getOptions();
App_Base_SessionRegistry::instance();
}
private function getOptions() {
// $this->ensure( file_exists( $this->config ), "Could not find options file" );
// $options = @SimpleXml_load_file( $this->config );
// $this->ensure( $options instanceof SimpleXMLElement, "Could not resolve options file" );
// $dsn = (string)$options->dsn;
include("../inside/credentials.php");
$dsn = getDSN("PDO");
$this->ensure($dsn, "No DSN found");
App_Base_ApplicationRegistry::setDSN($dsn);
$map = new App_Controller_ControllerMap();
//foreach ($options->control->view as $default_view) {
// $stat_str = trim($default_view['status']);
// $status = App_Command_Command::statuses($stat_str);
// $map->addView('default', $status, (string)$default_view);
//}
//foreach ( $options->control->command as $command_view ) {
// $command = trim((string)$command_view['name'] );
// if ( $command_view->classalias ) {
// $classroot = trim((string)$command_view->classalias['name']);
// $map->addClassroot( $command, $classroot );
// }
// if ( $command_view->view ) {
// $view = trim((string)$command_view->view);
// $forward = trim((string)$command_view->forward);
// $map->addView( $command, 0, $view );
// if ( $forward ) {
// $map->addForward( $command, 0, $forward );
// }
// foreach( $command_view->status as $command_view_status ) {
// $view = trim((string)$command_view_status->view);
// $forward = trim((string)$command_view_status->forward);
// $stat_str = trim($command_view_status['value']);
// $status = App_Command_Command::statuses( $stat_str );
// if ( $view ) {
// $map->addView( $command, $status, $view );
// }
// if ( $forward ) {
// $map->addForward( $command, $status, $forward );
// }
// }
// }
//}
// Default view
$status = App_Command_Command::statuses();
$map->addView("default", $status, "login");
$status = App_Command_Command::statuses("CMD_OK");
$map->addView("default", $status, "calendar");
$status = App_Command_Command::statuses("CMD_ERROR");
$map->addView("default", $status, "error");
$map->addClassroot("login", "Login");
$status = App_Command_Command::statuses();
$map->addView("login", $status, "login");
$status = App_Command_Command::statuses("CMD_OK");
$map->addView("login", $status, "calendar");
$map->addClassroot("logout", "Logout");
//$map->addClassroot("logout", "Logout");
App_Base_ApplicationRegistry::setControllerMap($map);
$appCtrl = new App_Controller_AppController(App_Base_ApplicationRegistry::getControllerMap());
App_Base_ApplicationRegistry::setApplicationController($appCtrl);
$manager = new App_Controller_AccessManager();
App_Base_ApplicationRegistry::setAccessManager($manager);
$pageTitle = "Det Norske Studentersamfund - vaktliste";
App_Base_ApplicationRegistry::setPageTitle($pageTitle);
}
private function ensure ($expr, $message) {
if (!$expr) {
throw new Exception($message);
}
}
}
<?php
class App_Controller_ApplicationHelper {
private static $instance;
//private $config = "options.xml";
private function __construct() {}
static function instance() {
if (!self::$instance) {
self::$instance = new self;
}
return self::$instance;
}
function init() {
$dsn = App_Base_ApplicationRegistry::getDSN();
if (!is_null($dsn)) {
return;
}
$this->getOptions();
App_Base_SessionRegistry::instance();
}
private function getOptions() {
// $this->ensure( file_exists( $this->config ), "Could not find options file" );
// $options = @SimpleXml_load_file( $this->config );
// $this->ensure( $options instanceof SimpleXMLElement, "Could not resolve options file" );
// $dsn = (string)$options->dsn;
include("../inside/credentials.php");
$dsn = getDSN("PDO");
$this->ensure($dsn, "No DSN found");
App_Base_ApplicationRegistry::setDSN($dsn);
$map = new App_Controller_ControllerMap();
//foreach ($options->control->view as $default_view) {
// $stat_str = trim($default_view['status']);
// $status = App_Command_Command::statuses($stat_str);
// $map->addView('default', $status, (string)$default_view);
//}
//foreach ( $options->control->command as $command_view ) {
// $command = trim((string)$command_view['name'] );
// if ( $command_view->classalias ) {
// $classroot = trim((string)$command_view->classalias['name']);
// $map->addClassroot( $command, $classroot );
// }
// if ( $command_view->view ) {
// $view = trim((string)$command_view->view);
// $forward = trim((string)$command_view->forward);
// $map->addView( $command, 0, $view );
// if ( $forward ) {
// $map->addForward( $command, 0, $forward );
// }
// foreach( $command_view->status as $command_view_status ) {
// $view = trim((string)$command_view_status->view);
// $forward = trim((string)$command_view_status->forward);
// $stat_str = trim($command_view_status['value']);
// $status = App_Command_Command::statuses( $stat_str );
// if ( $view ) {
// $map->addView( $command, $status, $view );
// }
// if ( $forward ) {
// $map->addForward( $command, $status, $forward );
// }
// }
// }
//}
// Default view
$status = App_Command_Command::statuses();
$map->addView("default", $status, "login");
$status = App_Command_Command::statuses("CMD_OK");
//$map->addView("default", $status, "");
$status = App_Command_Command::statuses("CMD_ERROR");
$map->addView("default", $status, "error");
$map->addClassroot("login", "Login");
$status = App_Command_Command::statuses();
$map->addView("login", $status, "login");
$status = App_Command_Command::statuses("CMD_OK");
$map->addForward("login", $status, "view-calendar");
$map->addClassroot("logout", "Logout");
//$map->addClassroot("logout", "Logout");
$map->addClassroot("add-shift", "AddShift");
$status = App_Command_Command::statuses();
$map->addView("add-shift", $status, "view-shift");
$status = App_Command_Command::statuses("CMD_OK");
$map->addForward("add-shift", $status, "view-calendar");
$map->addClassroot("view-shift", "GetShift");
$map->addView("view-shift", App_Command_Command::statuses(), "view-shift");
$map->addClassroot("view-calendar", "ViewCalendar");
$status = App_Command_Command::statuses();
$map->addView("view-calendar", $status, "calendar");
App_Base_ApplicationRegistry::setControllerMap($map);
$appCtrl = new App_Controller_AppController(App_Base_ApplicationRegistry::getControllerMap());
App_Base_ApplicationRegistry::setApplicationController($appCtrl);
$manager = new App_Controller_AccessManager();
App_Base_ApplicationRegistry::setAccessManager($manager);
$pageTitle = "Det Norske Studentersamfund - vaktliste";
App_Base_ApplicationRegistry::setPageTitle($pageTitle);
}
private function ensure ($expr, $message) {
if (!$expr) {
throw new Exception($message);
}
}
}
?>
+35 -33
View File
@@ -1,34 +1,36 @@
<?php
class App_Controller_Controller {
private $applicationHelper;
private function __construct() {}
public static function run() {
$instance = new self();
$instance->init();
$instance->handleRequest();
}
public function init() {
$this->applicationHelper = App_Controller_ApplicationHelper::instance();
$this->applicationHelper->init();
}
public function handleRequest() {
$request = new App_Controller_Request();
$app_c = App_Base_ApplicationRegistry::getApplicationController();
while ($cmd = $app_c->getCommand($request)) {
$cmd->execute($request);
}
$this->invokeView($app_c->getView($request));
}
function invokeView($target) {
include("App/View/$target.php");
exit;
}
}
<?php
class App_Controller_Controller {
private $applicationHelper;
private function __construct() {}
public static function run() {
$instance = new self();
$instance->init();
$instance->handleRequest();
}
public function init() {
$this->applicationHelper = App_Controller_ApplicationHelper::instance();
$this->applicationHelper->init();
}
public function handleRequest() {
$request = new App_Controller_Request();
$app_c = App_Base_ApplicationRegistry::getApplicationController();
while ($cmd = $app_c->getCommand($request)) {
$cmd->execute($request);
}
// store modifications to database
App_Domain_ObjectWatcher::instance()->performOperations();
$this->invokeView($app_c->getView($request));
}
function invokeView($target) {
include("App/View/$target.php");
exit;
}
}
?>
+41 -41
View File
@@ -1,42 +1,42 @@
<?php
class App_Controller_ControllerMap {
private $viewMap = array();
private $forwardMap = array();
private $classrootMap = array();
function addClassroot ($command, $classroot) {
$this->classrootMap[$command] = $classroot;
}
function getClassroot ($command) {
if (isset ($this->classrootMap[$command])) {
return $this->classrootMap[$command];
}
return $command;
}
function addView ($command = "default", $status = 0, $view) {
$this->viewMap[$command][$status] = $view;
}
function getView ($command, $status) {
if (isset ($this->viewMap[$command][$status])) {
return $this->viewMap[$command][$status];
}
return null;
}
function addForward ($command, $status = 0, $newCommand) {
$this->forwardMap[$command][$status] = $newCommand;
}
function getForward ($command, $status) {
if (isset ($this->forwardMap[$command][$status])) {
return $this->forwardMap[$command][$status];
}
return null;
}
}
<?php
class App_Controller_ControllerMap {
private $viewMap = array();
private $forwardMap = array();
private $classrootMap = array();
function addClassroot ($command, $classroot) {
$this->classrootMap[$command] = $classroot;
}
function getClassroot ($command) {
if (isset ($this->classrootMap[$command])) {
return $this->classrootMap[$command];
}
return $command;
}
function addView ($command = "default", $status = 0, $view) {
$this->viewMap[$command][$status] = $view;
}
function getView ($command, $status) {
if (isset ($this->viewMap[$command][$status])) {
return $this->viewMap[$command][$status];
}
return null;
}
function addForward ($command, $status = 0, $newCommand) {
$this->forwardMap[$command][$status] = $newCommand;
}
function getForward ($command, $status) {
if (isset ($this->forwardMap[$command][$status])) {
return $this->forwardMap[$command][$status];
}
return null;
}
}
?>
+74 -74
View File
@@ -1,75 +1,75 @@
<?php
/**
* Retrieves HTTP requests
*
*/
class App_Controller_Request {
private $properties;
private $feedback = array ();
private $command = null;
function __construct() {
$this->init();
App_Base_RequestRegistry::setRequest($this);
}
function init() {
if (isset($_SERVER['REQUEST_METHOD'])) {
if ($_SERVER['REQUEST_METHOD']) {
$this->properties = $_REQUEST;
return;
}
}
foreach($_SERVER['argv'] as $arg) {
if (strpos($arg, '=')) {
list($key, $val) = explode("=", $arg);
$this->setProperty($key, $val);
}
}
}
function getProperty($key) {
if (isset ($this->properties[$key])) {
return $this->properties[$key];
}
return null;
}
function setProperty($key, $val) {
$this->properties[$key] = $val;
}
function addFeedback($msg) {
array_push($this->feedback, $msg);
}
function getFeedback() {
return $this->feedback;
}
function getFeedbackString ($separator="\n") {
return implode($separator, $this->feedback);
}
function setObject( $name, $object ) {
$this->objects[$name] = $object;
}
function getObject( $name ) {
if ( isset( $this->objects[$name] ) ) {
return $this->objects[$name];
}
return null;
}
function setCommand (App_Command_Command $cmd) {
return $this->command = $cmd;
}
function getLastCommand () {
return $this->command;
}
}
<?php
/**
* Retrieves HTTP requests
*
*/
class App_Controller_Request {
private $properties;
private $feedback = array ();
private $command = null;
function __construct() {
$this->init();
App_Base_RequestRegistry::setRequest($this);
}
function init() {
if (isset($_SERVER['REQUEST_METHOD'])) {
if ($_SERVER['REQUEST_METHOD']) {
$this->properties = $_REQUEST;
return;
}
}
foreach($_SERVER['argv'] as $arg) {
if (strpos($arg, '=')) {
list($key, $val) = explode("=", $arg);
$this->setProperty($key, $val);
}
}
}
function getProperty($key) {
if (isset ($this->properties[$key])) {
return $this->properties[$key];
}
return null;
}
function setProperty($key, $val) {
$this->properties[$key] = $val;
}
function addFeedback($msg) {
array_push($this->feedback, $msg);
}
function getFeedback() {
return $this->feedback;
}
function getFeedbackString($separator="\n") {
return implode($separator, $this->feedback);
}
function setObject($name, $object) {
$this->objects[$name] = $object;
}
function getObject($name) {
if ( isset( $this->objects[$name] ) ) {
return $this->objects[$name];
}
return null;
}
function setCommand (App_Command_Command $cmd) {
return $this->command = $cmd;
}
function getLastCommand () {
return $this->command;
}
}
?>
+47 -47
View File
@@ -1,47 +1,47 @@
<?php
/**
* Domain Division model class
*
* @version 0.1
*/
class App_Domain_Division extends App_Domain_DomainObject {
private $name;
private $nicename;
private $hidden;
function __construct($id = null) {
parent::__construct($id);
}
function setName($name) {
$this->name = $name;
$this->markDirty();
}
function getName() {
return $this->name;
}
function setNiceName($niceName) {
$this->niceName = $niceName;
$this->markDirty();
}
function getNiceName() {
return $this->niceName;
}
function setHidden($hidden) {
$this->hidden = $hidden;
$this->markDirty();
}
function getHidden() {
return $this->hidden;
}
}
?>
<?php
/**
* Domain Division model class
*
* @version 0.1
*/
class App_Domain_Division extends App_Domain_DomainObject {
private $name;
private $nicename;
private $hidden;
function __construct($id = null) {
parent::__construct($id);
}
function setName($name) {
$this->name = $name;
$this->markDirty();
}
function getName() {
return $this->name;
}
function setNiceName($niceName) {
$this->niceName = $niceName;
$this->markDirty();
}
function getNiceName() {
return $this->niceName;
}
function setHidden($hidden) {
$this->hidden = $hidden;
$this->markDirty();
}
function getHidden() {
return $this->hidden;
}
}
?>
+62 -62
View File
@@ -1,63 +1,63 @@
<?php
/**
* Domain Object parent class
*
* @version 0.1
*/
abstract class App_Domain_DomainObject {
private $id = -1;
function __construct($id = null) {
if (is_null($id)) {
$this->markNew();
} else {
$this->id = $id;
}
}
function markNew() {
App_Domain_ObjectWatcher::addNew($this);
}
function markDeleted() {
App_Domain_ObjectWatcher::addDelete($this);
}
function markDirty() {
App_Domain_ObjectWatcher::addDirty($this);
}
function markClean() {
App_Domain_ObjectWatcher::addClean($this);
}
function setId($id) {
$this->id = $id;
}
function getId() {
return $this->id;
}
function collection() {
return self::getCollection(get_class($this));
}
static function getCollection($type) {
return App_Domain_HelperFactory::getCollection($type);
}
function finder() {
return self::getFinder(get_class($this));
}
static function getFinder($type) {
return App_Domain_HelperFactory::getFinder($type);
}
}
<?php
/**
* Domain Object parent class
*
* @version 0.1
*/
abstract class App_Domain_DomainObject {
private $id = -1;
function __construct($id = null) {
if (is_null($id)) {
$this->markNew();
} else {
$this->id = $id;
}
}
function markNew() {
App_Domain_ObjectWatcher::addNew($this);
}
function markDeleted() {
App_Domain_ObjectWatcher::addDelete($this);
}
function markDirty() {
App_Domain_ObjectWatcher::addDirty($this);
}
function markClean() {
App_Domain_ObjectWatcher::addClean($this);
}
function setId($id) {
$this->id = $id;
}
function getId() {
return $this->id;
}
function collection() {
return self::getCollection(get_class($this));
}
static function getCollection($type) {
return App_Domain_HelperFactory::getCollection($type);
}
function finder() {
return self::getFinder(get_class($this));
}
static function getFinder($type) {
return App_Domain_HelperFactory::getFinder($type);
}
}
?>
+73 -67
View File
@@ -1,67 +1,73 @@
<?php
/**
* Domain Group model class
*
* @version 0.1
*/
class App_Domain_Group extends App_Domain_DomainObject {
private $name;
private $text;
private $division;
private $admin;
private $mailinglist;
function __construct($id = null) {
parent::__construct($id);
}
function setName($name) {
$this->name = $name;
$this->markDirty();
}
function getName() {
return $this->name;
}
function setText($text) {
$this->text = $text;
$this->markDirty();
}
function getText() {
return $this->text;
}
function setDivision(App_Domain_Division $division) {
$this->division = $division;
$this->markDirty();
}
function getDivision() {
return $this->division;
}
function setAdmin($admin) {
$this->admin = $admin;
$this->markDirty();
}
function getAdmin() {
return $this->admin;
}
function setMailinglist($mailinglist) {
$this->mailinglist = $mailinglist;
$this->markDirty();
}
function getMailinglist() {
return $this->mailinglist;
}
}
?>
<?php
/**
* Domain Group model class
*
* @version 0.1
*/
class App_Domain_Group extends App_Domain_DomainObject {
private $name;
private $text;
private $division;
private $admin;
private $mailinglist;
function __construct($id = null) {
parent::__construct($id);
}
function setName($name) {
$this->name = $name;
$this->markDirty();
}
function getName() {
return $this->name;
}
function setText($text) {
$this->text = $text;
$this->markDirty();
}
function getText() {
return $this->text;
}
function setDivision($division) {
// check if division is an instance of App_Domain_Division
if (!is_null($division)) {
if (!($division instanceof App_Domain_Division)) {
throw new Exception("Division must be an instance of division class or null");
}
}
$this->division = $division;
$this->markDirty();
}
function getDivision() {
return $this->division;
}
function setAdmin($admin) {
$this->admin = $admin;
$this->markDirty();
}
function getAdmin() {
return $this->admin;
}
function setMailinglist($mailinglist) {
$this->mailinglist = $mailinglist;
$this->markDirty();
}
function getMailinglist() {
return $this->mailinglist;
}
}
?>
+70 -65
View File
@@ -1,66 +1,71 @@
<?php
/**
* Helper factory for fetching collections from the database mapper
*
* @version 0.1
*/
class App_Domain_HelperFactory {
const DIVISION = "App_Domain_Division";
const LOCATION = "App_Domain_Location";
const USER = "App_Domain_User";
const USER_PHONE = "App_Domain_UserPhone";
const WORK_SALARY_TYPE = "App_Domain_WorkSalaryType";
const WORK_SHIFT = "App_Domain_WorkShift";
const WORK_SHIFT_UPDATE = "App_Domain_WorkShiftUpdate";
const WORK_SHIFT_WORKER = "App_Domain_WorkShiftWorker";
function getCollection($type) {
switch ($type) {
case (self::DIVISION):
return new App_Mapper_DivisionCollection();
case (self::LOCATION):
return new App_Mapper_LocationCollection();
case (self::USER):
return new App_Mapper_UserCollection();
case (self::USER_PHONE):
return new App_Mapper_UserPhoneCollection();
case (self::WORK_SALARY_TYPE):
return new App_Mapper_WorkSalaryTypeCollection();
case (self::WORK_SHIFT):
return new App_Mapper_WorkShiftCollection();
case (self::WORK_SHIFT_UPDATE):
return new App_Mapper_WorkShiftUpdateCollection();
case (self::WORK_SHIFT_WORKER):
return new App_Mapper_WorkShiftWorkerCollection();
default:
throw new Exception("Unknown collection type $type");
}
}
function getFinder($type) {
switch ($type) {
case (self::DIVISION):
return new App_Mapper_DivisionMapper();
case (self::LOCATION):
return new App_Mapper_LocationMapper();
case (self::USER):
return new App_Mapper_UserMapper();
case (self::USER_PHONE):
return new App_Mapper_UserPhoneMapper();
case (self::WORK_SALARY_TYPE):
return new App_Mapper_WorkSalaryTypeMapper();
case (self::WORK_SHIFT):
return new App_Mapper_WorkShiftMapper();
case (self::WORK_SHIFT_UPDATE):
return new App_Mapper_WorkShiftUpdateMapper();
case (self::WORK_SHIFT_WORKER):
return new App_Mapper_WorkShiftWorkerMapper();
default:
throw new Exception("Unknown finder type $type");
}
}
}
<?php
/**
* Helper factory for fetching collections from the database mapper
*
* @version 0.1
*/
class App_Domain_HelperFactory {
const DIVISION = "App_Domain_Division";
const GROUP = "App_Domain_Group";
const LOCATION = "App_Domain_Location";
const USER = "App_Domain_User";
const USER_PHONE = "App_Domain_UserPhone";
const WORK_SALARY_TYPE = "App_Domain_WorkSalaryType";
const WORK_SHIFT = "App_Domain_WorkShift";
const WORK_SHIFT_UPDATE = "App_Domain_WorkShiftUpdate";
const WORK_SHIFT_WORKER = "App_Domain_WorkShiftWorker";
function getCollection($type) {
switch ($type) {
case (self::DIVISION):
return new App_Mapper_DivisionCollection();
case (self::GROUP):
return new App_Mapper_GroupCollection();
case (self::LOCATION):
return new App_Mapper_LocationCollection();
case (self::USER):
return new App_Mapper_UserCollection();
case (self::USER_PHONE):
return new App_Mapper_UserPhoneCollection();
case (self::WORK_SALARY_TYPE):
return new App_Mapper_WorkSalaryTypeCollection();
case (self::WORK_SHIFT):
return new App_Mapper_WorkShiftCollection();
case (self::WORK_SHIFT_UPDATE):
return new App_Mapper_WorkShiftUpdateCollection();
case (self::WORK_SHIFT_WORKER):
return new App_Mapper_WorkShiftWorkerCollection();
default:
throw new Exception("Unknown collection type $type");
}
}
function getFinder($type) {
switch ($type) {
case (self::DIVISION):
return new App_Mapper_DivisionMapper();
case (self::GROUP):
return new App_Mapper_GroupMapper();
case (self::LOCATION):
return new App_Mapper_LocationMapper();
case (self::USER):
return new App_Mapper_UserMapper();
case (self::USER_PHONE):
return new App_Mapper_UserPhoneMapper();
case (self::WORK_SALARY_TYPE):
return new App_Mapper_WorkSalaryTypeMapper();
case (self::WORK_SHIFT):
return new App_Mapper_WorkShiftMapper();
case (self::WORK_SHIFT_UPDATE):
return new App_Mapper_WorkShiftUpdateMapper();
case (self::WORK_SHIFT_WORKER):
return new App_Mapper_WorkShiftWorkerMapper();
default:
throw new Exception("Unknown finder type $type");
}
}
}
?>
+27 -27
View File
@@ -1,27 +1,27 @@
<?php
/**
* Domain Location model class
*
* @version 0.1
*/
class App_Domain_Location extends App_Domain_DomainObject {
private $name;
function __construct($id = null) {
parent::__construct($id);
}
function setName($name) {
$this->name = $name;
$this->markDirty();
}
function getName() {
return $this->name;
}
}
?>
<?php
/**
* Domain Location model class
*
* @version 0.1
*/
class App_Domain_Location extends App_Domain_DomainObject {
private $name;
function __construct($id = null) {
parent::__construct($id);
}
function setName($name) {
$this->name = $name;
$this->markDirty();
}
function getName() {
return $this->name;
}
}
?>
+111 -111
View File
@@ -1,112 +1,112 @@
<?php
/**
* Identity map for ensuring that one object doesnt become two
*
* @version 0.1
*/
class App_Domain_ObjectWatcher {
private $all = array();
private $dirty = array();
private $new = array();
private $delete = array(); // not implemented
private static $instance;
private function __construct() { }
static function instance() {
if (!isset(self::$instance)) {
self::$instance = new App_Domain_ObjectWatcher();
}
return self::$instance;
}
function globalKey(App_Domain_DomainObject $obj) {
$key = get_class($obj) . "." . $obj->getId();
return $key;
}
static function add(App_Domain_DomainObject $obj) {
$inst = self::instance();
$inst->all[$inst->globalKey($obj)] = $obj;
}
static function exists($classname, $id) {
$inst = self::instance();
$key = "$classname.$id";
if (isset($inst->all[$key])) {
return $inst->all[$key];
}
return null;
}
static function addDirty(App_Domain_DomainObject $obj) {
$inst = self::instance();
// verify that the updated object is an object allready in the database
if (!in_array($obj, $inst->new, true)) {
$inst->dirty[$inst->globalKey($obj)] = $obj;
}
}
static function addNew(App_Domain_DomainObject $obj) {
$inst = self::instance();
// we don't yet have an id
$inst->new[] = $obj;
}
/*
* Mark object as clean, changes will not be stored to database
*/
static function addClean(App_Domain_DomainObject $obj) {
$inst = self::instance();
unset($inst->dirty[$inst->globalKey($obj)]);
// check if the object is in the new array, and remove it from it
if (in_array($obj, $inst->new, true)) {
$pruned=array();
foreach ($inst->new as $newobj) {
if (!($newobj === $obj)) {
$pruned[] = $newobj;
}
}
$inst->new = $pruned;
}
}
static function addDelete(App_Domain_DomainObject $obj) {
$inst = self::instance();
unset($inst->dirty[$inst->globalKey($obj)]);
if (in_array($obj, $inst->new, true)) {
$pruned=array();
foreach ($inst->new as $newobj) {
if (!($newobj === $obj)) {
$pruned[] = $newobj;
}
}
$inst->new = $pruned;
}
$inst->delete[] = $obj;
}
function performOperations() {
foreach ($this->dirty as $key=>$obj) {
$obj->finder()->update($obj);
}
foreach ($this->new as $key=>$obj) {
$obj->finder()->insert($obj);
}
foreach ($this->delete as $key=>$obj) {
//$obj->finder()->delete($obj);
}
$this->dirty = array();
$this->new = array();
$this->delete = array();
}
}
<?php
/**
* Identity map for ensuring that one object doesnt become two
*
* @version 0.1
*/
class App_Domain_ObjectWatcher {
private $all = array();
private $dirty = array();
private $new = array();
private $delete = array(); // not implemented
private static $instance;
private function __construct() { }
static function instance() {
if (!isset(self::$instance)) {
self::$instance = new App_Domain_ObjectWatcher();
}
return self::$instance;
}
function globalKey(App_Domain_DomainObject $obj) {
$key = get_class($obj) . "." . $obj->getId();
return $key;
}
static function add(App_Domain_DomainObject $obj) {
$inst = self::instance();
$inst->all[$inst->globalKey($obj)] = $obj;
}
static function exists($classname, $id) {
$inst = self::instance();
$key = "$classname.$id";
if (isset($inst->all[$key])) {
return $inst->all[$key];
}
return null;
}
static function addDirty(App_Domain_DomainObject $obj) {
$inst = self::instance();
// verify that the updated object is an object allready in the database
if (!in_array($obj, $inst->new, true)) {
$inst->dirty[$inst->globalKey($obj)] = $obj;
}
}
static function addNew(App_Domain_DomainObject $obj) {
$inst = self::instance();
// we don't yet have an id
$inst->new[] = $obj;
}
/*
* Mark object as clean, changes will not be stored to database
*/
static function addClean(App_Domain_DomainObject $obj) {
$inst = self::instance();
unset($inst->dirty[$inst->globalKey($obj)]);
// check if the object is in the new array, and remove it from it
if (in_array($obj, $inst->new, true)) {
$pruned=array();
foreach ($inst->new as $newobj) {
if (!($newobj === $obj)) {
$pruned[] = $newobj;
}
}
$inst->new = $pruned;
}
}
static function addDelete(App_Domain_DomainObject $obj) {
$inst = self::instance();
unset($inst->dirty[$inst->globalKey($obj)]);
if (in_array($obj, $inst->new, true)) {
$pruned=array();
foreach ($inst->new as $newobj) {
if (!($newobj === $obj)) {
$pruned[] = $newobj;
}
}
$inst->new = $pruned;
}
$inst->delete[] = $obj;
}
function performOperations() {
foreach ($this->dirty as $key=>$obj) {
$obj->finder()->update($obj);
}
foreach ($this->new as $key=>$obj) {
$obj->finder()->insert($obj);
}
foreach ($this->delete as $key=>$obj) {
//$obj->finder()->delete($obj);
}
$this->dirty = array();
$this->new = array();
$this->delete = array();
}
}
?>
+169 -169
View File
@@ -1,170 +1,170 @@
<?php
/**
* Domain User Model class
*
* @version 0.1
*/
class App_Domain_User extends App_Domain_DomainObject {
private $username;
private $firstname;
private $lastname;
private $password;
private $validaddress;
private $email;
private $birthdate;
private $placeOfStudy;
private $passwordreset;
private $divisionIdRequest;
private $updates;
private $memberships;
private $address;
private $cards;
private $workShifts;
private $groups;
function __construct($id = null) {
parent::__construct($id);
}
function setUsername($username_s) {
$this->username = $username_s;
$this->markDirty();
}
function getUsername() {
return $this->username;
}
function setPassword($password_s) {
$this->password = $password_s;
$this->markDirty();
}
function getPassword() {
return $this->password;
}
function setFirstname($firstname_s) {
$this->firstname = $firstname_s;
$this->markDirty();
}
function getFirstname() {
return $this->firstname;
}
function setLastname($lastname_s) {
$this->lastname = $lastname_s;
$this->markDirty();
}
function getLastname() {
return $this->lastname;
}
function getName($separator = " ") {
return $this->getFirstname() . $separator . $this->getLastname();
}
function setValidaddress($validaddress_i) {
$this->validaddress = $validaddress_i;
$this->markDirty();
}
function getValidaddress() {
return $this->validaddress;
}
function setEmail($email_s) {
$this->email = $email_s;
$this->markDirty();
}
function getEmail() {
return $this->email;
}
function setBirthdate($birthdate_d) {
$this->birthdate = $birthdate_d;
$this->markDirty();
}
function getBirthdate() {
return $this->birthdate;
}
function setPlaceOfStudy($placeofstudy_i) {
$this->placeOfStudy = $placeofstudy_i;
$this->markDirty();
}
function getPlaceOfStudy() {
return $this->placeOfStudy;
}
function setPasswordreset($passwordreset_i) {
$this->passwordreset = $passwordreset_i;
$this->markDirty();
}
function getPasswordreset() {
return $this->passwordreset;
}
function setDivisionIdRequest($divisionidrequest_i) {
$this->divisionIdRequest = $divisionidrequest_i;
$this->markDirty();
}
function getDivisionIdRequest() {
return $this->divisionIdRequest;
}
function getUpdates() {
if (is_null($this->updates)) {
$this->updates = self::getFinder("App_Domain_UserUpdate")->findByUserId($this->getId());
}
return $this->updates;
}
function getAddress() {
if (is_null($this->address)) {
$this->address = self::getFinder("App_Domain_UserAddress")->findByUserId($this->getId());
}
return $this->address;
}
function getMemberships() {
if (is_null($this->memberships)) {
$this->memberships = self::getFinder("App_Domain_Membership")->findByUserId($this->getId());
}
return $this->memberships;
}
function getCards() {
if (is_null($this->cards)) {
$this->cards = self::getFinder("App_Domain_MembershipCard")->findByUserId($this->getId());
}
return $this->cards;
}
function getWorkShifts() {
if (is_null($this->workShifts)) {
$this->workShifts = self::getFinder("App_Domain_WorkShiftWorkers")->findByUserId($this->getId());
}
return $this->workShifts;
}
function getGroups() {
if (is_null($this->groups)) {
$this->groups = self::getFinder("App_Domain_Groups")->findByUserId($this->getId());
}
return $this->groups;
}
}
<?php
/**
* Domain User Model class
*
* @version 0.1
*/
class App_Domain_User extends App_Domain_DomainObject {
private $username;
private $firstname;
private $lastname;
private $password;
private $validaddress;
private $email;
private $birthdate;
private $placeOfStudy;
private $passwordreset;
private $divisionIdRequest;
private $updates;
private $memberships;
private $address;
private $cards;
private $workShifts;
private $groups;
function __construct($id = null) {
parent::__construct($id);
}
function setUsername($username_s) {
$this->username = $username_s;
$this->markDirty();
}
function getUsername() {
return $this->username;
}
function setPassword($password_s) {
$this->password = $password_s;
$this->markDirty();
}
function getPassword() {
return $this->password;
}
function setFirstname($firstname_s) {
$this->firstname = $firstname_s;
$this->markDirty();
}
function getFirstname() {
return $this->firstname;
}
function setLastname($lastname_s) {
$this->lastname = $lastname_s;
$this->markDirty();
}
function getLastname() {
return $this->lastname;
}
function getName($separator = " ") {
return $this->getFirstname() . $separator . $this->getLastname();
}
function setValidaddress($validaddress_i) {
$this->validaddress = $validaddress_i;
$this->markDirty();
}
function getValidaddress() {
return $this->validaddress;
}
function setEmail($email_s) {
$this->email = $email_s;
$this->markDirty();
}
function getEmail() {
return $this->email;
}
function setBirthdate($birthdate_d) {
$this->birthdate = $birthdate_d;
$this->markDirty();
}
function getBirthdate() {
return $this->birthdate;
}
function setPlaceOfStudy($placeofstudy_i) {
$this->placeOfStudy = $placeofstudy_i;
$this->markDirty();
}
function getPlaceOfStudy() {
return $this->placeOfStudy;
}
function setPasswordreset($passwordreset_i) {
$this->passwordreset = $passwordreset_i;
$this->markDirty();
}
function getPasswordreset() {
return $this->passwordreset;
}
function setDivisionIdRequest($divisionidrequest_i) {
$this->divisionIdRequest = $divisionidrequest_i;
$this->markDirty();
}
function getDivisionIdRequest() {
return $this->divisionIdRequest;
}
function getUpdates() {
if (is_null($this->updates)) {
$this->updates = self::getFinder("App_Domain_UserUpdate")->findByUserId($this->getId());
}
return $this->updates;
}
function getAddress() {
if (is_null($this->address)) {
$this->address = self::getFinder("App_Domain_UserAddress")->findByUserId($this->getId());
}
return $this->address;
}
function getMemberships() {
if (is_null($this->memberships)) {
$this->memberships = self::getFinder("App_Domain_Membership")->findByUserId($this->getId());
}
return $this->memberships;
}
function getCards() {
if (is_null($this->cards)) {
$this->cards = self::getFinder("App_Domain_MembershipCard")->findByUserId($this->getId());
}
return $this->cards;
}
function getWorkShifts() {
if (is_null($this->workShifts)) {
$this->workShifts = self::getFinder("App_Domain_WorkShiftWorkers")->findByUserId($this->getId());
}
return $this->workShifts;
}
function getGroups() {
if (is_null($this->groups)) {
$this->groups = self::getFinder("App_Domain_Groups")->findByUserId($this->getId());
}
return $this->groups;
}
}
?>
+37 -37
View File
@@ -1,38 +1,38 @@
<?php
/**
* Domain UserPhone model class
*
* @version 0.1
*/
class App_Domain_UserPhone extends App_Domain_DomainObject {
private $user;
private $phone;
function __construct($id = null) {
parent::__construct($id);
}
function setUser(domain_User $user) {
$this->user = $user;
$this->markDirty();
}
function getUser() {
return $this->user;
}
function setPhone($phone) {
$this->phone = $phone;
$this->markDirty();
}
function getPhone() {
return $this->phone;
}
}
<?php
/**
* Domain UserPhone model class
*
* @version 0.1
*/
class App_Domain_UserPhone extends App_Domain_DomainObject {
private $user;
private $phone;
function __construct($id = null) {
parent::__construct($id);
}
function setUser(domain_User $user) {
$this->user = $user;
$this->markDirty();
}
function getUser() {
return $this->user;
}
function setPhone($phone) {
$this->phone = $phone;
$this->markDirty();
}
function getPhone() {
return $this->phone;
}
}
?>
+37 -37
View File
@@ -1,37 +1,37 @@
<?php
/**
* Domain WorkSalaryType model class
*
* @version 0.1
*/
class App_Domain_WorkSalaryType extends App_Domain_DomainObject {
private $title;
private $hourlyRate;
function __construct($id = null) {
parent::__construct($id);
}
function setTitle($title) {
$this->title = $title;
$this->markDirty();
}
function getTitle() {
return $this->title;
}
function setHourlyRate($hourlyRate) {
$this->hourlyRate = $hourlyRate;
$this->markDirty();
}
function getHourlyRate() {
return $this->hourlyRate;
}
}
?>
<?php
/**
* Domain WorkSalaryType model class
*
* @version 0.1
*/
class App_Domain_WorkSalaryType extends App_Domain_DomainObject {
private $title;
private $hourlyRate;
function __construct($id = null) {
parent::__construct($id);
}
function setTitle($title) {
$this->title = $title;
$this->markDirty();
}
function getTitle() {
return $this->title;
}
function setHourlyRate($hourlyRate) {
$this->hourlyRate = $hourlyRate;
$this->markDirty();
}
function getHourlyRate() {
return $this->hourlyRate;
}
}
?>
+141 -141
View File
@@ -1,142 +1,142 @@
<?php
/**
* Domain WorkShift model class
*
* @version 0.1
*/
class App_Domain_WorkShift extends App_Domain_DomainObject {
private $starts;
private $ends;
private $group;
private $location;
private $active;
private $title;
private $comment;
private $numWorkers;
private $locked;
private $autoassignWorkers;
private $salaryType;
private $workers;
private $updates;
function __construct($id = null) {
parent::__construct($id);
}
function setStarts(DateTime $starts) {
$this->starts = $starts;
$this->markDirty();
}
function getStarts() {
return $this->starts;
}
function setEnds(DateTime $ends) {
$this->ends = $ends;
$this->markDirty();
}
function getEnds() {
return $this->ends;
}
function setGroup(App_Domain_Group $group) {
$this->group = $group;
$this->markDirty();
}
function getGroup() {
return $this->group;
}
function setLocation(App_Domain_Location $location) {
$this->location = $location;
$this->markDirty();
}
function getLocation() {
return $this->location;
}
function setActive($active) {
$this->active = $active;
$this->markDirty();
}
function getActive() {
return $this->active;
}
function setTitle($title) {
$this->title = $title;
$this->markDirty();
}
function getTitle() {
return $this->title;
}
function setComment($comment) {
$this->comment = $comment;
$this->markDirty();
}
function getComment() {
return $this->comment;
}
function setNumWorkers($numWorkers) {
$this->numWorkers = $numWorkers;
$this->markDirty();
}
function getNumWorkers() {
return $this->numWorkers;
}
function setLocked($locked) {
$this->locked = $locked;
$this->markDirty();
}
function getLocked() {
return $this->locked;
}
function setAutoassignWorkers($autoassignWorkers) {
$this->autoassignWorkers = $autoassignWorkers;
$this->markDirty();
}
function getAutoassignWorkers() {
return $this->autoassignWorkers;
}
function setSalaryType(App_Domain_WorkSalaryType $salaryType) {
$this->salaryType = $salaryType;
$this->markDirty();
}
function getSalaryType() {
return $this->salaryType;
}
function getWorkers() {
if (is_null($this->workers)) {
$this->workers = self::getFinder("App_Domain_WorkShiftWorkers")->findByShiftId($this->getId());
}
return $this->workers;
}
function getUpdates() {
if (is_null($this->updates)) {
$this->updates = self::getFinder("App_Domain_WorkShiftUpdates")->findByShiftId($this->getId());
}
return $this->updates;
}
<?php
/**
* Domain WorkShift model class
*
* @version 0.1
*/
class App_Domain_WorkShift extends App_Domain_DomainObject {
private $starts;
private $ends;
private $group;
private $location;
private $active;
private $title;
private $comment;
private $numWorkers;
private $locked;
private $autoassignWorkers;
private $salaryType;
private $workers;
private $updates;
function __construct($id = null) {
parent::__construct($id);
}
function setStarts(DateTime $starts) {
$this->starts = $starts;
$this->markDirty();
}
function getStarts() {
return $this->starts;
}
function setEnds(DateTime $ends) {
$this->ends = $ends;
$this->markDirty();
}
function getEnds() {
return $this->ends;
}
function setGroup(App_Domain_Group $group) {
$this->group = $group;
$this->markDirty();
}
function getGroup() {
return $this->group;
}
function setLocation(App_Domain_Location $location) {
$this->location = $location;
$this->markDirty();
}
function getLocation() {
return $this->location;
}
function setActive($active) {
$this->active = $active;
$this->markDirty();
}
function getActive() {
return $this->active;
}
function setTitle($title) {
$this->title = $title;
$this->markDirty();
}
function getTitle() {
return $this->title;
}
function setComment($comment) {
$this->comment = $comment;
$this->markDirty();
}
function getComment() {
return $this->comment;
}
function setNumWorkers($numWorkers) {
$this->numWorkers = $numWorkers;
$this->markDirty();
}
function getNumWorkers() {
return $this->numWorkers;
}
function setLocked($locked) {
$this->locked = $locked;
$this->markDirty();
}
function getLocked() {
return $this->locked;
}
function setAutoassignWorkers($autoassignWorkers) {
$this->autoassignWorkers = $autoassignWorkers;
$this->markDirty();
}
function getAutoassignWorkers() {
return $this->autoassignWorkers;
}
function setSalaryType(App_Domain_WorkSalaryType $salaryType) {
$this->salaryType = $salaryType;
$this->markDirty();
}
function getSalaryType() {
return $this->salaryType;
}
function getWorkers() {
if (is_null($this->workers)) {
$this->workers = self::getFinder("App_Domain_WorkShiftWorkers")->findByShiftId($this->getId());
}
return $this->workers;
}
function getUpdates() {
if (is_null($this->updates)) {
$this->updates = self::getFinder("App_Domain_WorkShiftUpdates")->findByShiftId($this->getId());
}
return $this->updates;
}
}
+57 -57
View File
@@ -1,57 +1,57 @@
<?php
/**
* Domain WorkShiftUpdate model class
*
* @version 0.1
*/
class App_Domain_WorkShiftUpdate extends App_Domain_DomainObject {
private $shift;
private $updateTime;
private $user;
private $updateText;
function __construct($id = null) {
parent::__construct($id);
}
function setShift(App_Domain_WorkShift $shift) {
$this->shift = $shift;
$this->markDirty();
}
function getShift() {
return $this->shift;
}
function setUpdateTime(DateTime $time) {
$this->updateTime = $time;
$this->markDirty();
}
function getUpdateTime() {
return $this->updateTime;
}
function setUser(App_Domain_User $user) {
$this->user = $user;
$this->markDirty();
}
function getUser() {
return $this->user;
}
function setUpdateText($updateText) {
$this->updateText = $updateText;
$this->markDirty();
}
function getUpdateText() {
return $this->updateText;
}
}
?>
<?php
/**
* Domain WorkShiftUpdate model class
*
* @version 0.1
*/
class App_Domain_WorkShiftUpdate extends App_Domain_DomainObject {
private $shift;
private $updateTime;
private $user;
private $updateText;
function __construct($id = null) {
parent::__construct($id);
}
function setShift(App_Domain_WorkShift $shift) {
$this->shift = $shift;
$this->markDirty();
}
function getShift() {
return $this->shift;
}
function setUpdateTime(DateTime $time) {
$this->updateTime = $time;
$this->markDirty();
}
function getUpdateTime() {
return $this->updateTime;
}
function setUser(App_Domain_User $user) {
$this->user = $user;
$this->markDirty();
}
function getUser() {
return $this->user;
}
function setUpdateText($updateText) {
$this->updateText = $updateText;
$this->markDirty();
}
function getUpdateText() {
return $this->updateText;
}
}
?>
+76 -76
View File
@@ -1,76 +1,76 @@
<?php
/**
* Domain WorkShiftWorker model class
*
* @version 0.1
*/
class App_Domain_WorkShiftWorker extends App_Domain_DomainObject {
private $shift;
private $user;
private $assigned;
private $noShow;
private $userComment;
private $employerComment;
function __construct($id = null) {
parent::__construct($id);
}
function setShift(App_Domain_WorkShift $shift) {
$this->shift = $shift;
$this->markDirty();
}
function getShift() {
return $this->shift;
}
function setUser(App_Domain_User $user) {
$this->user = $user;
$this->markDirty();
}
function getUser() {
return $this->user;
}
function setAssigned($assigned) {
$this->assigned = $assigned;
$this->markDirty();
}
function getAssigned () {
return $this->assigned;
}
function setNoShow($noShow) {
$this->noShow = $noShow;
$this->markDirty();
}
function getNoShow() {
return $this->noShow;
}
function setUserComment($comment) {
$this->userComment = $comment;
$this->markDirty();
}
function getUserComment() {
return $this->userComment;
}
function setEmployerComment($comment) {
$this->employerComment = $comment;
$this->markDirty();
}
function getEmployerComment() {
return $this->employerComment;
}
}
?>
<?php
/**
* Domain WorkShiftWorker model class
*
* @version 0.1
*/
class App_Domain_WorkShiftWorker extends App_Domain_DomainObject {
private $shift;
private $user;
private $assigned;
private $noShow;
private $userComment;
private $employerComment;
function __construct($id = null) {
parent::__construct($id);
}
function setShift(App_Domain_WorkShift $shift) {
$this->shift = $shift;
$this->markDirty();
}
function getShift() {
return $this->shift;
}
function setUser(App_Domain_User $user) {
$this->user = $user;
$this->markDirty();
}
function getUser() {
return $this->user;
}
function setAssigned($assigned) {
$this->assigned = $assigned;
$this->markDirty();
}
function getAssigned () {
return $this->assigned;
}
function setNoShow($noShow) {
$this->noShow = $noShow;
$this->markDirty();
}
function getNoShow() {
return $this->noShow;
}
function setUserComment($comment) {
$this->userComment = $comment;
$this->markDirty();
}
function getUserComment() {
return $this->userComment;
}
function setEmployerComment($comment) {
$this->employerComment = $comment;
$this->markDirty();
}
function getEmployerComment() {
return $this->employerComment;
}
}
?>
+86 -86
View File
@@ -1,87 +1,87 @@
<?php
/**
* Collection object for handling multiple rows and creating objects from database results
*
* @version 0.1
*/
abstract class App_Mapper_Collection implements Iterator {
protected $mapper;
protected $total = 0;
protected $raw = array();
private $result;
private $pointer;
private $objects = array();
function __construct(array $raw = null, mapper_Mapper $mapper = null) {
if (!is_null($raw) && !is_null($mapper)) {
$this->rewind();
$this->raw = $raw;
$this->total = count($raw);
}
$this->mapper = $mapper;
}
/**
* Add an object to the collection
**/
function add(App_Domain_DomainObject $object) {
$class = $this->targetClass();
if (!($object instanceof $class)) {
throw new Exception("This is a {$class} collection");
}
$this->notifyAccess();
$this->objects[$this->total] = $object;
$this->total++;
}
abstract function targetClass();
protected function notifyAccess() {
// something is coming here..
}
private function getRow($num) {
$this->notifyAccess();
if ($num >= $this->total || $num < 0) {
return null;
}
if (isset($this->objects[$num])) {
return $this->objects[$num];
}
if (isset($this->raw[$num])) {
// object has not been created yet
$this->objects[$num]=$this->mapper->createObject($this->raw[$num]);
return $this->objects[$num];
}
}
public function rewind() {
$this->pointer = 0;
}
public function current() {
return $this->getRow($this->pointer);
}
public function key() {
return $this->pointer;
}
public function next() {
$row = $this->getRow($this->pointer);
if ($row) {
$this->pointer++;
}
return $row;
}
public function valid() {
return (!is_null($this->current()));
}
}
<?php
/**
* Collection object for handling multiple rows and creating objects from database results
*
* @version 0.1
*/
abstract class App_Mapper_Collection implements Iterator {
protected $mapper;
protected $total = 0;
protected $raw = array();
private $result;
private $pointer;
private $objects = array();
function __construct(array $raw = null, App_Mapper_Mapper $mapper = null) {
if (!is_null($raw) && !is_null($mapper)) {
$this->rewind();
$this->raw = $raw;
$this->total = count($raw);
}
$this->mapper = $mapper;
}
/**
* Add an object to the collection
**/
function add(App_Domain_DomainObject $object) {
$class = $this->targetClass();
if (!($object instanceof $class)) {
throw new Exception("This is a {$class} collection");
}
$this->notifyAccess();
$this->objects[$this->total] = $object;
$this->total++;
}
abstract function targetClass();
protected function notifyAccess() {
// something is coming here..
}
private function getRow($num) {
$this->notifyAccess();
if ($num >= $this->total || $num < 0) {
return null;
}
if (isset($this->objects[$num])) {
return $this->objects[$num];
}
if (isset($this->raw[$num])) {
// object has not been created yet
$this->objects[$num]=$this->mapper->createObject($this->raw[$num]);
return $this->objects[$num];
}
}
public function rewind() {
$this->pointer = 0;
}
public function current() {
return $this->getRow($this->pointer);
}
public function key() {
return $this->pointer;
}
public function next() {
$row = $this->getRow($this->pointer);
if ($row) {
$this->pointer++;
}
return $row;
}
public function valid() {
return (!is_null($this->current()));
}
}
?>
+14 -14
View File
@@ -1,15 +1,15 @@
<?php
/**
* Division collection - collection of elements in the din_division database table
*
* @version 0.1
*/
class App_Mapper_DivisionCollection extends App_Mapper_Collection {
function targetClass() {
return "App_Domain_Division";
}
}
<?php
/**
* Division collection - collection of elements in the din_division database table
*
* @version 0.1
*/
class App_Mapper_DivisionCollection extends App_Mapper_Collection {
function targetClass() {
return "App_Domain_Division";
}
}
?>
+92 -92
View File
@@ -1,93 +1,93 @@
<?php
/**
* Division object mapper to database table
*
* @version 0.1
*/
class App_Mapper_DivisionMapper extends App_Mapper_Mapper {
function __construct() {
// initialize database connection and common setup
parent::__construct();
// prepare SQL statements
$this->selectStmt = self::$PDO->prepare(
"SELECT * FROM din_group WHERE id=?");
$this->findByGroupIdStmt = self::$PDO->prepare(
"SELECT * FROM din_division INNER JOIN din_group ON din_division.id = din_group.division_id WHERE din_group.id=?");
$this->selectAllStmt = self::$PDO->prepare(
"SELECT * FROM din_division");
$this->insertStmt = self::$PDO->prepare(
"INSERT INTO din_division (
name,
nicename,
hidden
) values (?)");
$this->updateStmt = self::$PDO->prepare(
"UPDATE din_division SET
name=?,
nicename=?,
hidden=?
WHERE id=?");
$this->deleteStmt = self::$PDO->prepare(
"DELETE FROM din_division WHERE id=?");
}
protected function doCreateObject(array $array) {
$obj = new App_Domain_Division($array["id"]);
$obj->setName($array["name"]);
$obj->setNiceName($array["nicename"]);
$obj->setHidden($array["hidden"]);
return $obj;
}
protected function doInsert(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getName());
$this->insertStmt->bindValue(2, $object->getNiceName());
$this->insertStmt->bindValue(3, $object->getHidden());
$this->insertStmt->execute();
$id = self::$PDO->lastInsertId();
$this->setId($id);
}
function update(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getName());
$this->insertStmt->bindValue(2, $object->getNiceName());
$this->insertStmt->bindValue(3, $object->getHidden());
$this->updateStmt->bindValue(4, $object->getId());
$this->updateStmt->execute();
}
protected function doDelete(App_Domain_DomainObject $object) {
$values = array($object->getId());
$this->deleteStmt->execute($values);
}
function selectStmt() {
return $this->selectStmt;
}
function selectAllStmt() {
return $this->selectAllStmt;
}
function deleteStmt() {
return $this->deleteStmt;
}
function getCollection(array $raw) {
return new App_Mapper_DivsionCollection($raw, $this);
}
protected function targetClass() {
return "App_Domain_Division";
}
}
<?php
/**
* Division object mapper to database table
*
* @version 0.1
*/
class App_Mapper_DivisionMapper extends App_Mapper_Mapper {
function __construct() {
// initialize database connection and common setup
parent::__construct();
// prepare SQL statements
$this->selectStmt = self::$PDO->prepare(
"SELECT * FROM din_group WHERE id=?");
$this->findByGroupIdStmt = self::$PDO->prepare(
"SELECT * FROM din_division INNER JOIN din_group ON din_division.id = din_group.division_id WHERE din_group.id=?");
$this->selectAllStmt = self::$PDO->prepare(
"SELECT * FROM din_division");
$this->insertStmt = self::$PDO->prepare(
"INSERT INTO din_division (
name,
nicename,
hidden
) values (?)");
$this->updateStmt = self::$PDO->prepare(
"UPDATE din_division SET
name=?,
nicename=?,
hidden=?
WHERE id=?");
$this->deleteStmt = self::$PDO->prepare(
"DELETE FROM din_division WHERE id=?");
}
protected function doCreateObject(array $array) {
$obj = new App_Domain_Division($array["id"]);
$obj->setName($array["name"]);
$obj->setNiceName($array["nicename"]);
$obj->setHidden($array["hidden"]);
return $obj;
}
protected function doInsert(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getName());
$this->insertStmt->bindValue(2, $object->getNiceName());
$this->insertStmt->bindValue(3, $object->getHidden());
$this->insertStmt->execute();
$id = self::$PDO->lastInsertId();
$this->setId($id);
}
function update(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getName());
$this->insertStmt->bindValue(2, $object->getNiceName());
$this->insertStmt->bindValue(3, $object->getHidden());
$this->updateStmt->bindValue(4, $object->getId());
$this->updateStmt->execute();
}
protected function doDelete(App_Domain_DomainObject $object) {
$values = array($object->getId());
$this->deleteStmt->execute($values);
}
function selectStmt() {
return $this->selectStmt;
}
function selectAllStmt() {
return $this->selectAllStmt;
}
function deleteStmt() {
return $this->deleteStmt;
}
function getCollection(array $raw) {
return new App_Mapper_DivsionCollection($raw, $this);
}
protected function targetClass() {
return "App_Domain_Division";
}
}
?>
+6 -6
View File
@@ -1,7 +1,7 @@
<?php
abstract class App_Mapper_DomainObjectFactory {
abstract function createObject(array $array);
}
<?php
abstract class App_Mapper_DomainObjectFactory {
abstract function createObject(array $array);
}
?>
+14 -14
View File
@@ -1,15 +1,15 @@
<?php
/**
* Group collection - collection of elements in the din_group database table
*
* @version 0.1
*/
class App_Mapper_GroupCollection extends App_Mapper_Collection {
function targetClass() {
return "App_Domain_Group";
}
}
<?php
/**
* Group collection - collection of elements in the din_group database table
*
* @version 0.1
*/
class App_Mapper_GroupCollection extends App_Mapper_Collection {
function targetClass() {
return "App_Domain_Group";
}
}
?>
+118 -118
View File
@@ -1,119 +1,119 @@
<?php
/**
* Group object mapper to database table
*
* @version 0.1
*/
class App_Mapper_GroupMapper extends App_Mapper_Mapper {
function __construct() {
// initialize database connection and common setup
parent::__construct();
// prepare SQL statements
$this->selectStmt = self::$PDO->prepare(
"SELECT * FROM din_group WHERE id=?");
$this->findByDivisionIdStmt = self::$PDO->prepare(
"SELECT * FROM din_group WHERE division_id=?");
$this->findByUserIdStmt = self::$PDO->prepare(
"SELECT * FROM din_group INNER JOIN din_usergrouprelationship ON din_group.id = din_usergrouprelationship.group_id WHERE din_usergrouprelationship.user_id=?");
$this->selectAllStmt = self::$PDO->prepare(
"SELECT * FROM din_group");
$this->insertStmt = self::$PDO->prepare(
"INSERT INTO din_group (
name,
text,
division_id,
admin,
mailinglist
) values (?)");
$this->updateStmt = self::$PDO->prepare(
"UPDATE din_group SET
name=?,
text=?,
division_id=?,
admin=?,
mailinglist=?
WHERE id=?");
$this->deleteStmt = self::$PDO->prepare(
"DELETE FROM din_group WHERE id=?");
}
protected function doCreateObject(array $array) {
$obj = new App_Domain_Group($array["id"]);
$obj->setName($array["name"]);
$obj->setText($array["text"]);
$obj->setAdmin($array["admin"]);
$obj->setMailinglist($array["mailinglist"]);
// find division and create division object
$division_mapper = new App_Domain_DivisionMapper();
$division = $division_mapper->find($array["division_id"]);
$obj->setDivision($division);
return $obj;
}
protected function doInsert(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getName());
$this->insertStmt->bindValue(2, $object->getText());
$this->insertStmt->bindValue(3, $object->getDivision()->getId());
$this->insertStmt->bindValue(4, $object->getAdmin());
$this->insertStmt->bindValue(5, $object->getMailinglist());
$this->insertStmt->execute();
$id = self::$PDO->lastInsertId();
$this->setId($id);
}
function update(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getName());
$this->insertStmt->bindValue(2, $object->getText());
$this->insertStmt->bindValue(3, $object->getDivision()->getId());
$this->insertStmt->bindValue(4, $object->getAdmin());
$this->insertStmt->bindValue(5, $object->getMailinglist());
$this->updateStmt->bindValue(6, $object->getId());
$this->updateStmt->execute();
}
protected function doDelete(App_Domain_DomainObject $object) {
$values = array($object->getId());
$this->deleteStmt->execute($values);
}
function selectStmt() {
return $this->selectStmt;
}
function selectAllStmt() {
return $this->selectAllStmt;
}
function deleteStmt() {
return $this->deleteStmt;
}
function findByDivisionId($division_id) {
$this->findByDivisionIdStmt->execute(array($division_id));
return new App_Mapper_WorkShiftCollection($this->findByDivisionIdStmt->fetchAll(), $this);
}
function findByUserId($user_id) {
$this->findByUserIdStmt->execute(array($user_id));
return new App_Mapper_GroupCollection($this->findByUserIdStmt->fetchAll(), $this);
}
function getCollection(array $raw) {
return new App_Mapper_GroupCollection($raw, $this);
}
protected function targetClass() {
return "App_Domain_Group";
}
}
<?php
/**
* Group object mapper to database table
*
* @version 0.1
*/
class App_Mapper_GroupMapper extends App_Mapper_Mapper {
function __construct() {
// initialize database connection and common setup
parent::__construct();
// prepare SQL statements
$this->selectStmt = self::$PDO->prepare(
"SELECT * FROM din_group WHERE id=?");
$this->findByDivisionIdStmt = self::$PDO->prepare(
"SELECT * FROM din_group WHERE division_id=?");
$this->findByUserIdStmt = self::$PDO->prepare(
"SELECT * FROM din_group INNER JOIN din_usergrouprelationship ON din_group.id = din_usergrouprelationship.group_id WHERE din_usergrouprelationship.user_id=?");
$this->selectAllStmt = self::$PDO->prepare(
"SELECT * FROM din_group");
$this->insertStmt = self::$PDO->prepare(
"INSERT INTO din_group (
name,
text,
division_id,
admin,
mailinglist
) values (?)");
$this->updateStmt = self::$PDO->prepare(
"UPDATE din_group SET
name=?,
text=?,
division_id=?,
admin=?,
mailinglist=?
WHERE id=?");
$this->deleteStmt = self::$PDO->prepare(
"DELETE FROM din_group WHERE id=?");
}
protected function doCreateObject(array $array) {
$obj = new App_Domain_Group($array["id"]);
$obj->setName($array["name"]);
$obj->setText($array["text"]);
$obj->setAdmin($array["admin"]);
$obj->setMailinglist($array["mailinglist"]);
// find division and create division object
$division_mapper = new App_Mapper_DivisionMapper();
$division = $division_mapper->find($array["division_id"]);
$obj->setDivision($division);
return $obj;
}
protected function doInsert(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getName());
$this->insertStmt->bindValue(2, $object->getText());
$this->insertStmt->bindValue(3, $object->getDivision()->getId());
$this->insertStmt->bindValue(4, $object->getAdmin());
$this->insertStmt->bindValue(5, $object->getMailinglist());
$this->insertStmt->execute();
$id = self::$PDO->lastInsertId();
$this->setId($id);
}
function update(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getName());
$this->insertStmt->bindValue(2, $object->getText());
$this->insertStmt->bindValue(3, $object->getDivision()->getId());
$this->insertStmt->bindValue(4, $object->getAdmin());
$this->insertStmt->bindValue(5, $object->getMailinglist());
$this->updateStmt->bindValue(6, $object->getId());
$this->updateStmt->execute();
}
protected function doDelete(App_Domain_DomainObject $object) {
$values = array($object->getId());
$this->deleteStmt->execute($values);
}
function selectStmt() {
return $this->selectStmt;
}
function selectAllStmt() {
return $this->selectAllStmt;
}
function deleteStmt() {
return $this->deleteStmt;
}
function findByDivisionId($division_id) {
$this->findByDivisionIdStmt->execute(array($division_id));
return new App_Mapper_WorkShiftCollection($this->findByDivisionIdStmt->fetchAll(), $this);
}
function findByUserId($user_id) {
$this->findByUserIdStmt->execute(array($user_id));
return new App_Mapper_GroupCollection($this->findByUserIdStmt->fetchAll(), $this);
}
function getCollection(array $raw) {
return new App_Mapper_GroupCollection($raw, $this);
}
protected function targetClass() {
return "App_Domain_Group";
}
}
?>
+14 -14
View File
@@ -1,15 +1,15 @@
<?php
/**
* Location collection - collection of elements in the work_salarytype database table
*
* @version 0.1
*/
class App_Mapper_Location extends App_Mapper_Collection {
function targetClass() {
return "App_Domain_Location";
}
}
<?php
/**
* Location collection - collection of elements in the work_salarytype database table
*
* @version 0.1
*/
class App_Mapper_LocationCollection extends App_Mapper_Collection {
function targetClass() {
return "App_Domain_Location";
}
}
?>
+80 -80
View File
@@ -1,81 +1,81 @@
<?php
/**
* Location object mapper to database table
*
* @version 0.1
*/
class App_Mapper_LocationMapper extends App_Mapper_Mapper {
function __construct() {
// initialize database connection and common setup
parent::__construct();
// prepare SQL statements
$this->selectStmt = self::$PDO->prepare(
"SELECT * FROM lokaler WHERE id=?");
$this->selectAllStmt = self::$PDO->prepare(
"SELECT * FROM lokaler");
$this->insertStmt = self::$PDO->prepare(
"INSERT INTO lokaler (
navn
) values (?)");
$this->updateStmt = self::$PDO->prepare(
"UPDATE lokaler SET
navn=?
WHERE id=?");
$this->deleteStmt = self::$PDO->prepare(
"DELETE FROM lokaler WHERE id=?");
}
protected function doCreateObject(array $array) {
$obj = new App_Domain_Location($array["id"]);
$obj->setName($array["navn"]);
return $obj;
}
protected function doInsert(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getName());
$this->insertStmt->execute();
$id = self::$PDO->lastInsertId();
$this->setId($id);
}
function update(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getName());
$this->updateStmt->bindValue(2, $object->getId());
$this->updateStmt->execute();
}
protected function doDelete(App_Domain_DomainObject $object) {
$values = array($object->getId());
$this->deleteStmt->execute($values);
}
function selectStmt() {
return $this->selectStmt;
}
function selectAllStmt() {
return $this->selectAllStmt;
}
function deleteStmt() {
return $this->deleteStmt;
}
function getCollection(array $raw) {
return new App_Mapper_LocationCollection($raw, $this);
}
protected function targetClass() {
return "App_Domain_Location";
}
}
<?php
/**
* Location object mapper to database table
*
* @version 0.1
*/
class App_Mapper_LocationMapper extends App_Mapper_Mapper {
function __construct() {
// initialize database connection and common setup
parent::__construct();
// prepare SQL statements
$this->selectStmt = self::$PDO->prepare(
"SELECT * FROM lokaler WHERE id=?");
$this->selectAllStmt = self::$PDO->prepare(
"SELECT * FROM lokaler");
$this->insertStmt = self::$PDO->prepare(
"INSERT INTO lokaler (
navn
) values (?)");
$this->updateStmt = self::$PDO->prepare(
"UPDATE lokaler SET
navn=?
WHERE id=?");
$this->deleteStmt = self::$PDO->prepare(
"DELETE FROM lokaler WHERE id=?");
}
protected function doCreateObject(array $array) {
$obj = new App_Domain_Location($array["id"]);
$obj->setName($array["navn"]);
return $obj;
}
protected function doInsert(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getName());
$this->insertStmt->execute();
$id = self::$PDO->lastInsertId();
$this->setId($id);
}
function update(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getName());
$this->updateStmt->bindValue(2, $object->getId());
$this->updateStmt->execute();
}
protected function doDelete(App_Domain_DomainObject $object) {
$values = array($object->getId());
$this->deleteStmt->execute($values);
}
function selectStmt() {
return $this->selectStmt;
}
function selectAllStmt() {
return $this->selectAllStmt;
}
function deleteStmt() {
return $this->deleteStmt;
}
function getCollection(array $raw) {
return new App_Mapper_LocationCollection($raw, $this);
}
protected function targetClass() {
return "App_Domain_Location";
}
}
?>
+98 -98
View File
@@ -1,99 +1,99 @@
<?php
/**
* Abstract mapper class for database mapping from domain
*
* @version 0.1
*/
abstract class App_Mapper_Mapper {
protected static $PDO;
const DATETIME_FORMAT = "Y-m-d H:i:s"; // mysql datetime format for DateTime class formatting
function __construct() {
if (!isset(self::$PDO)) {
$dsn = App_Base_ApplicationRegistry::instance()->getDSN("PDO");
if (is_null($dsn)) {
throw new Exception("No DSN");
}
try {
self::$PDO = new PDO($dsn["dsn"], $dsn["username"], $dsn["password"]);
self::$PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (Exception $e) {
throw new Exception("Database connection error: ". getDSN());
}
}
}
private function getFromMap($id) {
return App_Domain_ObjectWatcher::exists($this->targetClass(), $id);
}
private function addToMap(App_Domain_DomainObject $obj) {
return App_Domain_ObjectWatcher::add($obj);
}
function find($id) {
// check if object allready has been fetch from database
$old = $this->getFromMap($id);
if ($old) {
return $old;
}
// get object from database
$this->selectStmt()->execute(array($id));
$array = $this->selectStmt()->fetch();
$this->selectStmt()->closeCursor();
if (!is_array($array)) {
return null;
}
if (!isset($array['id'])) {
return null;
}
$object = $this->createObject($array);
$object->markClean();
return $object;
}
function findAll() {
$this->selectAllStmt()->execute(array());
return $this->getCollection( $this->selectAllStmt()->fetchAll( PDO::FETCH_ASSOC ) );
}
function createObject($array) {
$old = $this->getFromMap($array['id']);
if ($old) { return $old; }
// construct object
$obj = $this->doCreateObject($array);
// add object to object watcher map
$this->addToMap($obj);
$obj->markClean();
return $obj;
}
function insert(App_Domain_DomainObject $obj) {
$this->doInsert($obj);
$this->addToMap($obj);
$obj->markClean();
}
function delete(App_Domain_DomainObject $obj) {
$this->doDelete($obj);
//$this->removeFromMap($obj);
}
abstract function update(App_Domain_DomainObject $object);
protected abstract function doCreateObject(array $array);
protected abstract function doInsert(App_Domain_DomainObject $object);
protected abstract function doDelete(App_Domain_DomainObject $object);
protected abstract function targetClass();
protected abstract function selectStmt();
protected abstract function selectAllStmt();
protected abstract function deleteStmt();
abstract function getCollection(array $raw);
}
<?php
/**
* Abstract mapper class for database mapping from domain
*
* @version 0.1
*/
abstract class App_Mapper_Mapper {
protected static $PDO;
const DATETIME_FORMAT = "Y-m-d H:i:s"; // mysql datetime format for DateTime class formatting
function __construct() {
if (!isset(self::$PDO)) {
$dsn = App_Base_ApplicationRegistry::instance()->getDSN("PDO");
if (is_null($dsn)) {
throw new Exception("No DSN");
}
try {
self::$PDO = new PDO($dsn["dsn"], $dsn["username"], $dsn["password"]);
self::$PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (Exception $e) {
throw new Exception("Database connection error: ". getDSN());
}
}
}
private function getFromMap($id) {
return App_Domain_ObjectWatcher::exists($this->targetClass(), $id);
}
private function addToMap(App_Domain_DomainObject $obj) {
return App_Domain_ObjectWatcher::add($obj);
}
function find($id) {
// check if object allready has been fetch from database
$old = $this->getFromMap($id);
if ($old) {
return $old;
}
// get object from database
$this->selectStmt()->execute(array($id));
$array = $this->selectStmt()->fetch();
$this->selectStmt()->closeCursor();
if (!is_array($array)) {
return null;
}
if (!isset($array['id'])) {
return null;
}
$object = $this->createObject($array);
$object->markClean();
return $object;
}
function findAll() {
$this->selectAllStmt()->execute(array());
return $this->getCollection( $this->selectAllStmt()->fetchAll( PDO::FETCH_ASSOC ) );
}
function createObject($array) {
$old = $this->getFromMap($array['id']);
if ($old) { return $old; }
// construct object
$obj = $this->doCreateObject($array);
// add object to object watcher map
$this->addToMap($obj);
$obj->markClean();
return $obj;
}
function insert(App_Domain_DomainObject $obj) {
$this->doInsert($obj);
$this->addToMap($obj);
$obj->markClean();
}
function delete(App_Domain_DomainObject $obj) {
$this->doDelete($obj);
//$this->removeFromMap($obj);
}
abstract function update(App_Domain_DomainObject $object);
protected abstract function doCreateObject(array $array);
protected abstract function doInsert(App_Domain_DomainObject $object);
protected abstract function doDelete(App_Domain_DomainObject $object);
protected abstract function targetClass();
protected abstract function selectStmt();
protected abstract function selectAllStmt();
protected abstract function deleteStmt();
abstract function getCollection(array $raw);
}
?>
+13 -13
View File
@@ -1,14 +1,14 @@
<?php
/**
* User collection - collection of elements in the user database
*
* @version 0.1
*/
class App_Mapper_UserCollection extends App_Mapper_Collection {
function targetClass() {
return "App_Domain_User";
}
}
<?php
/**
* User collection - collection of elements in the user database
*
* @version 0.1
*/
class App_Mapper_UserCollection extends App_Mapper_Collection {
function targetClass() {
return "App_Domain_User";
}
}
?>
+125 -125
View File
@@ -1,126 +1,126 @@
<?php
/**
* User object mapper to database
*
* @version 0.1
*/
class App_Mapper_UserMapper extends App_Mapper_Mapper {
function __construct() {
// initialize database connection and common setup
parent::__construct();
// prepare SQL statements
$this->selectStmt = self::$PDO->prepare(
"SELECT * FROM din_user WHERE id=?");
$this->selectAllStmt = self::$PDO->prepare(
"SELECT * FROM din_user");
//$this->updateStmt = self::$PDO->prepare(
// "UPDATE din_user SET
// username=?,
// password=?,
// firstname=?,
// lastname=?,
// addresstype='no',
// valid_address=?,
// email=?,
// birthdate=?,
// placeOfStudy=?,
// passwordReset=?,
// division_id_request=?
// WHERE id=?");
//$this->insertStmt = self::$PDO->prepare(
// "INSERT INTO din_user (
// cardno, username, password, firstname, lastname, addresstype, valid_address, email, birthdate, placeOfStudy, passwordReset, division_id_request
// ) values (?)");
//$this->deleteStmt = self::$PDO->prepare(
// "DELETE FROM din_user WHERE id=?");
$this->findByLoginStmt = self::$PDO->prepare(
"SELECT * FROM din_user WHERE username=? AND ( password=PASSWORD(?) or password=OLD_PASSWORD(?) )");
}
protected function doCreateObject(array $array) {
$obj = new App_Domain_User($array["id"]);
$obj->setUsername($array["username"]);
$obj->setPassword($array["password"]);
$obj->setFirstname($array["firstname"]);
$obj->setLastname($array["lastname"]);
$obj->setValidaddress($array["valid_address"]);
$obj->setEmail($array["email"]);
$obj->setBirthdate($array["birthdate"]);
$obj->setPlaceOfStudy($array["placeOfStudy"]);
$obj->setPasswordreset($array["passwordReset"]);
$obj->setDivisionIdRequest($array["division_id_request"]);
return $obj;
}
protected function doInsert(App_Domain_DomainObject $object) {
$values = array($object->getUsername());
throw new Excepetion("UserMapper::doInsert() failure: UserMapper is read only!");
//$this->insertStmt->execute($values);
//$id = self::$PDO->lastInsertId();
//$object->setId($id);
}
function update(App_Domain_DomainObject $object) {
$values = array(
$object->getUsername(),
$object->getPassword(),
$object->getFirstname(),
$object->getLastname(),
$object->getValidAddress(),
$object->getEmail(),
$object->getBirthdate(),
$object->getPlaceOfStudy(),
$object->getPasswordreset(),
$object->getDivisionIdRequest(),
$object->getId()
);
throw new Excepetion("UserMapper:update() failure: UserMapper is read only!");
//$this->updateStmt->execute($values);
}
protected function doDelete(App_Domain_DomainObject $object) {
$values = array($object->getId());
throw new Excepetion("UserMapper::doDelete() failure: UserMapper is read only!");
//$this->deleteStmt->execute($values);
}
function selectStmt() {
return $this->selectStmt;
}
function selectAllStmt() {
return $this->selectAllStmt;
}
function deleteStmt() {
throw new Excepetion("UserMapper::deleteStmt() failure: UserMapper is read only!");
//return $this->deleteStmt;
}
function findByLogin($username, $password) {
$this->findByLoginStmt->execute(array($username, $password, $password));
$array = $this->findByLoginStmt->fetch();
$this->findByLoginStmt->closeCursor();
if (!is_array($array)) {
return null;
}
if (!isset($array['id'])) {
return null;
}
return $this->createObject($array);
}
function getCollection(array $raw) {
return new App_Mapper_UserCollection($raw, $this);
}
protected function targetClass() {
return "App_Domain_User";
}
}
<?php
/**
* User object mapper to database
*
* @version 0.1
*/
class App_Mapper_UserMapper extends App_Mapper_Mapper {
function __construct() {
// initialize database connection and common setup
parent::__construct();
// prepare SQL statements
$this->selectStmt = self::$PDO->prepare(
"SELECT * FROM din_user WHERE id=?");
$this->selectAllStmt = self::$PDO->prepare(
"SELECT * FROM din_user");
//$this->updateStmt = self::$PDO->prepare(
// "UPDATE din_user SET
// username=?,
// password=?,
// firstname=?,
// lastname=?,
// addresstype='no',
// valid_address=?,
// email=?,
// birthdate=?,
// placeOfStudy=?,
// passwordReset=?,
// division_id_request=?
// WHERE id=?");
//$this->insertStmt = self::$PDO->prepare(
// "INSERT INTO din_user (
// cardno, username, password, firstname, lastname, addresstype, valid_address, email, birthdate, placeOfStudy, passwordReset, division_id_request
// ) values (?)");
//$this->deleteStmt = self::$PDO->prepare(
// "DELETE FROM din_user WHERE id=?");
$this->findByLoginStmt = self::$PDO->prepare(
"SELECT * FROM din_user WHERE username=? AND ( password=PASSWORD(?) or password=OLD_PASSWORD(?) )");
}
protected function doCreateObject(array $array) {
$obj = new App_Domain_User($array["id"]);
$obj->setUsername($array["username"]);
$obj->setPassword($array["password"]);
$obj->setFirstname($array["firstname"]);
$obj->setLastname($array["lastname"]);
$obj->setValidaddress($array["valid_address"]);
$obj->setEmail($array["email"]);
$obj->setBirthdate($array["birthdate"]);
$obj->setPlaceOfStudy($array["placeOfStudy"]);
$obj->setPasswordreset($array["passwordReset"]);
$obj->setDivisionIdRequest($array["division_id_request"]);
return $obj;
}
protected function doInsert(App_Domain_DomainObject $object) {
$values = array($object->getUsername());
throw new Excepetion("UserMapper::doInsert() failure: UserMapper is read only!");
//$this->insertStmt->execute($values);
//$id = self::$PDO->lastInsertId();
//$object->setId($id);
}
function update(App_Domain_DomainObject $object) {
$values = array(
$object->getUsername(),
$object->getPassword(),
$object->getFirstname(),
$object->getLastname(),
$object->getValidAddress(),
$object->getEmail(),
$object->getBirthdate(),
$object->getPlaceOfStudy(),
$object->getPasswordreset(),
$object->getDivisionIdRequest(),
$object->getId()
);
throw new Excepetion("UserMapper:update() failure: UserMapper is read only!");
//$this->updateStmt->execute($values);
}
protected function doDelete(App_Domain_DomainObject $object) {
$values = array($object->getId());
throw new Excepetion("UserMapper::doDelete() failure: UserMapper is read only!");
//$this->deleteStmt->execute($values);
}
function selectStmt() {
return $this->selectStmt;
}
function selectAllStmt() {
return $this->selectAllStmt;
}
function deleteStmt() {
throw new Excepetion("UserMapper::deleteStmt() failure: UserMapper is read only!");
//return $this->deleteStmt;
}
function findByLogin($username, $password) {
$this->findByLoginStmt->execute(array($username, $password, $password));
$array = $this->findByLoginStmt->fetch();
$this->findByLoginStmt->closeCursor();
if (!is_array($array)) {
return null;
}
if (!isset($array['id'])) {
return null;
}
return $this->createObject($array);
}
function getCollection(array $raw) {
return new App_Mapper_UserCollection($raw, $this);
}
protected function targetClass() {
return "App_Domain_User";
}
}
?>
@@ -0,0 +1,9 @@
<?php
class App_Mapper_UserObjectFactory extends App_Mapper_DomainObjectFactory {
function createObject ( array $array ) {
$obj = new App_Domain_User($array['id']);
$obj->setname($array['name']);
return $obj;
}
}
@@ -1,15 +1,15 @@
<?php
/**
* Work salary type collection - collection of elements in the work_salarytype database table
*
* @version 0.1
*/
class App_Mapper_WorkSalaryTypeCollection extends App_Mapper_Collection {
function targetClass() {
return "App_Domain_WorkSalaryType";
}
}
<?php
/**
* Work salary type collection - collection of elements in the work_salarytype database table
*
* @version 0.1
*/
class App_Mapper_WorkSalaryTypeCollection extends App_Mapper_Collection {
function targetClass() {
return "App_Domain_WorkSalaryType";
}
}
?>
+84 -84
View File
@@ -1,85 +1,85 @@
<?php
/**
* Work salary type object mapper to database table
*
* @version 0.1
*/
class App_Mapper_WorkSalaryTyperMapper extends App_Mapper_Mapper {
function __construct() {
// initialize database connection and common setup
parent::__construct();
// prepare SQL statements
$this->selectStmt = self::$PDO->prepare(
"SELECT * FROM work_salarytype WHERE id=?");
$this->selectAllStmt = self::$PDO->prepare(
"SELECT * FROM work_salarytype");
$this->insertStmt = self::$PDO->prepare(
"INSERT INTO work_salarytype (
title, hourly_rate
) values (?, ?)");
$this->updateStmt = self::$PDO->prepare(
"UPDATE work_salarytype SET
title=?,
hourly_rate=?
WHERE id=?");
$this->deleteStmt = self::$PDO->prepare(
"DELETE FROM work_salarytype WHERE id=?");
}
protected function doCreateObject(array $array) {
$obj = new App_Domain_WorkSalaryType($array["id"]);
$obj->setTitle($array["title"]);
$obj->setHourlyRate($array["hourly_rate"]);
return $obj;
}
protected function doInsert(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getTitle());
$this->insertStmt->bindValue(2, $object->getHourlyRate());
$this->insertStmt->execute();
$id = self::$PDO->lastInsertId();
$this->setId($id);
}
function update(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getTitle());
$this->insertStmt->bindValue(2, $object->getHourlyRate());
$this->updateStmt->bindValue(3, $object->getId());
$this->updateStmt->execute();
}
protected function doDelete(App_Domain_DomainObject $object) {
$values = array($object->getId());
$this->deleteStmt->execute($values);
}
function selectStmt() {
return $this->selectStmt;
}
function selectAllStmt() {
return $this->selectAllStmt;
}
function deleteStmt() {
return $this->deleteStmt;
}
function getCollection(array $raw) {
return new App_Mapper_WorkSalaryTypeCollection($raw, $this);
}
protected function targetClass() {
return "App_Domain_WorkSalaryType";
}
}
<?php
/**
* Work salary type object mapper to database table
*
* @version 0.1
*/
class App_Mapper_WorkSalaryTypeMapper extends App_Mapper_Mapper {
function __construct() {
// initialize database connection and common setup
parent::__construct();
// prepare SQL statements
$this->selectStmt = self::$PDO->prepare(
"SELECT * FROM work_salarytype WHERE id=?");
$this->selectAllStmt = self::$PDO->prepare(
"SELECT * FROM work_salarytype");
$this->insertStmt = self::$PDO->prepare(
"INSERT INTO work_salarytype (
title, hourly_rate
) values (?, ?)");
$this->updateStmt = self::$PDO->prepare(
"UPDATE work_salarytype SET
title=?,
hourly_rate=?
WHERE id=?");
$this->deleteStmt = self::$PDO->prepare(
"DELETE FROM work_salarytype WHERE id=?");
}
protected function doCreateObject(array $array) {
$obj = new App_Domain_WorkSalaryType($array["id"]);
$obj->setTitle($array["title"]);
$obj->setHourlyRate($array["hourly_rate"]);
return $obj;
}
protected function doInsert(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getTitle());
$this->insertStmt->bindValue(2, $object->getHourlyRate());
$this->insertStmt->execute();
$id = self::$PDO->lastInsertId();
$this->setId($id);
}
function update(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getTitle());
$this->insertStmt->bindValue(2, $object->getHourlyRate());
$this->updateStmt->bindValue(3, $object->getId());
$this->updateStmt->execute();
}
protected function doDelete(App_Domain_DomainObject $object) {
$values = array($object->getId());
$this->deleteStmt->execute($values);
}
function selectStmt() {
return $this->selectStmt;
}
function selectAllStmt() {
return $this->selectAllStmt;
}
function deleteStmt() {
return $this->deleteStmt;
}
function getCollection(array $raw) {
return new App_Mapper_WorkSalaryTypeCollection($raw, $this);
}
protected function targetClass() {
return "App_Domain_WorkSalaryType";
}
}
?>
+14 -14
View File
@@ -1,15 +1,15 @@
<?php
/**
* Work shift collection - collection of elements in the work_shift database table
*
* @version 0.1
*/
class App_Mapper_WorkShiftCollection extends App_Mapper_Collection {
function targetClass() {
return "App_Domain_WorkShift";
}
}
<?php
/**
* Work shift collection - collection of elements in the work_shift database table
*
* @version 0.1
*/
class App_Mapper_WorkShiftCollection extends App_Mapper_Collection {
function targetClass() {
return "App_Domain_WorkShift";
}
}
?>
+139 -139
View File
@@ -1,140 +1,140 @@
<?php
/**
* Work shift object mapper to database table
*
* @version 0.1
*/
class App_Mapper_WorkShiftMapper extends App_Mapper_Mapper {
function __construct() {
// initialize database connection and common setup
parent::__construct();
// prepare SQL statements
$this->selectStmt = self::$PDO->prepare(
"SELECT * FROM work_shift WHERE id=?");
$this->selectAllStmt = self::$PDO->prepare(
"SELECT * FROM work_shift");
$this->findByGroupIdStmt = self::$PDO->prepare(
"SELECT * FROM work_shift WHERE group_id=?");
$this->updateStmt = self::$PDO->prepare(
"UPDATE work_shift SET
starts=?,
ends=?,
group_id=?,
location_id=?,
active=?,
title=?,
comment=?,
num_workers=?,
locked=?,
autoassign_workers=?,
salarytype_id=?
WHERE id=?");
$this->insertStmt = self::$PDO->prepare(
"INSERT INTO work_shift (
starts, ends, group_id, location_id, active, title, comment, num_workers, locked, autoassign_workers, salarytype_id
) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
$this->deleteStmt = self::$PDO->prepare(
"DELETE FROM work_shift WHERE id=?");
}
protected function doCreateObject(array $array) {
$obj = new App_Domain_WorkShift($array["id"]);
$obj->setStarts(new DateTime($array["starts"]));
$obj->setEnds(new DateTime($array["ends"]));
$obj->setActive($array["active"]);
$obj->setTitle($array["title"]);
$obj->setComment($array["comment"]);
$obj->setNumWorkers($array["num_workers"]);
$obj->setLocked($array["locked"]);
$obj->setAutoAssignWorkers($array["autoassign_workers"]);
// find group and create division object
$group_mapper = new App_Domain_GroupMapper();
$group = $group_mapper->find($array["group_id"]);
$obj->setGroup($group);
// find location and create location object
$location_mapper = new App_Domain_LocationMapper();
$location = $location_mapper->find($array["location_id"]);
$obj->setLocation($location);
// find salary type and create salary type object
$salarytype_mapper = new App_Domain_WorkSalaryTypeMapper();
$salarytype = $salarytype_mapper->find($array["slarytype_id"]);
$obj->setSalaryType($salarytype);
return $obj;
}
protected function doInsert(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getStarts()->format(self::DATETIME_FORMAT));
$this->insertStmt->bindValue(2, $object->getEnds()->format(self::DATETIME_FORMAT));
$this->insertStmt->bindValue(3, $object->getGroup()->getId());
$this->insertStmt->bindValue(4, $object->getLocation()->getId());
$this->insertStmt->bindValue(5, $object->getActive());
$this->insertStmt->bindValue(6, $object->getTitle());
$this->insertStmt->bindValue(7, $object->getComment());
$this->insertStmt->bindValue(8, $object->getNumWorkers());
$this->insertStmt->bindValue(9, $object->getLocked());
$this->insertStmt->bindValue(10, $object->getAutoAssignWorkers());
$this->insertStmt->bindValue(11, $object->getSalaryType()->getId());
$this->insertStmt->execute();
$id = self::$PDO->lastInsertId();
$this->setId($id);
}
function update(App_Domain_DomainObject $object) {
$this->updateStmt->bindValue(1, $object->getStarts()->format(self::DATETIME_FORMAT));
$this->updateStmt->bindValue(2, $object->getEnds()->format(self::DATETIME_FORMAT));
$this->updateStmt->bindValue(3, $object->getGroup()->getId());
$this->updateStmt->bindValue(4, $object->getLocation()->getId());
$this->updateStmt->bindValue(5, $object->getActive());
$this->updateStmt->bindValue(6, $object->getTitle());
$this->updateStmt->bindValue(7, $object->getComment());
$this->updateStmt->bindValue(8, $object->getNumWorkers());
$this->updateStmt->bindValue(9, $object->getLocked());
$this->updateStmt->bindValue(10, $object->getAutoAssignWorkers());
$this->updateStmt->bindValue(11, $object->getSalaryType()->getId());
$this->updateStmt->bindValue(12, $object->getId());
$this->updateStmt->execute();
}
protected function doDelete(App_Domain_DomainObject $object) {
$values = array($object->getId());
$this->deleteStmt->execute($values);
}
function selectStmt() {
return $this->selectStmt;
}
function selectAllStmt() {
return $this->selectAllStmt;
}
function deleteStmt() {
return $this->deleteStmt;
}
function findByGroupId($group_id) {
$this->findByGroupIdStmt->execute(array($group_id));
return new App_Mapper_WorkShiftCollection($this->findByGroupIdStmt->fetchAll(), $this);
}
function getCollection(array $raw) {
return new App_Mapper_WorkShiftCollection($raw, $this);
}
protected function targetClass() {
return "App_Domain_WorkShift";
}
}
<?php
/**
* Work shift object mapper to database table
*
* @version 0.1
*/
class App_Mapper_WorkShiftMapper extends App_Mapper_Mapper {
function __construct() {
// initialize database connection and common setup
parent::__construct();
// prepare SQL statements
$this->selectStmt = self::$PDO->prepare(
"SELECT * FROM work_shift WHERE id=?");
$this->selectAllStmt = self::$PDO->prepare(
"SELECT * FROM work_shift ORDER BY starts");
$this->findByGroupIdStmt = self::$PDO->prepare(
"SELECT * FROM work_shift WHERE group_id=?");
$this->updateStmt = self::$PDO->prepare(
"UPDATE work_shift SET
starts=?,
ends=?,
group_id=?,
location_id=?,
active=?,
title=?,
comment=?,
num_workers=?,
locked=?,
autoassign_workers=?,
salarytype_id=?
WHERE id=?");
$this->insertStmt = self::$PDO->prepare(
"INSERT INTO work_shift (
starts, ends, group_id, location_id, active, title, comment, num_workers, locked, autoassign_workers, salarytype_id
) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
$this->deleteStmt = self::$PDO->prepare(
"DELETE FROM work_shift WHERE id=?");
}
protected function doCreateObject(array $array) {
$obj = new App_Domain_WorkShift($array["id"]);
$obj->setStarts(new DateTime($array["starts"]));
$obj->setEnds(new DateTime($array["ends"]));
$obj->setActive($array["active"]);
$obj->setTitle($array["title"]);
$obj->setComment($array["comment"]);
$obj->setNumWorkers($array["num_workers"]);
$obj->setLocked($array["locked"]);
$obj->setAutoAssignWorkers($array["autoassign_workers"]);
// find group and create division object
$group_mapper = new App_Mapper_GroupMapper();
$group = $group_mapper->find($array["group_id"]);
$obj->setGroup($group);
// find location and create location object
$location_mapper = new App_Mapper_LocationMapper();
$location = $location_mapper->find($array["location_id"]);
$obj->setLocation($location);
// find salary type and create salary type object
$salarytype_mapper = new App_Mapper_WorkSalaryTypeMapper();
$salarytype = $salarytype_mapper->find($array["salarytype_id"]);
$obj->setSalaryType($salarytype);
return $obj;
}
protected function doInsert(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getStarts()->format(self::DATETIME_FORMAT));
$this->insertStmt->bindValue(2, $object->getEnds()->format(self::DATETIME_FORMAT));
$this->insertStmt->bindValue(3, $object->getGroup()->getId());
$this->insertStmt->bindValue(4, $object->getLocation()->getId());
$this->insertStmt->bindValue(5, $object->getActive());
$this->insertStmt->bindValue(6, $object->getTitle());
$this->insertStmt->bindValue(7, $object->getComment());
$this->insertStmt->bindValue(8, $object->getNumWorkers());
$this->insertStmt->bindValue(9, $object->getLocked());
$this->insertStmt->bindValue(10, $object->getAutoAssignWorkers());
$this->insertStmt->bindValue(11, $object->getSalaryType()->getId());
$this->insertStmt->execute();
$id = self::$PDO->lastInsertId();
$object->setId($id);
}
function update(App_Domain_DomainObject $object) {
$this->updateStmt->bindValue(1, $object->getStarts()->format(self::DATETIME_FORMAT));
$this->updateStmt->bindValue(2, $object->getEnds()->format(self::DATETIME_FORMAT));
$this->updateStmt->bindValue(3, $object->getGroup()->getId());
$this->updateStmt->bindValue(4, $object->getLocation()->getId());
$this->updateStmt->bindValue(5, $object->getActive());
$this->updateStmt->bindValue(6, $object->getTitle());
$this->updateStmt->bindValue(7, $object->getComment());
$this->updateStmt->bindValue(8, $object->getNumWorkers());
$this->updateStmt->bindValue(9, $object->getLocked());
$this->updateStmt->bindValue(10, $object->getAutoAssignWorkers());
$this->updateStmt->bindValue(11, $object->getSalaryType()->getId());
$this->updateStmt->bindValue(12, $object->getId());
$this->updateStmt->execute();
}
protected function doDelete(App_Domain_DomainObject $object) {
$values = array($object->getId());
$this->deleteStmt->execute($values);
}
function selectStmt() {
return $this->selectStmt;
}
function selectAllStmt() {
return $this->selectAllStmt;
}
function deleteStmt() {
return $this->deleteStmt;
}
function findByGroupId($group_id) {
$this->findByGroupIdStmt->execute(array($group_id));
return new App_Mapper_WorkShiftCollection($this->findByGroupIdStmt->fetchAll(), $this);
}
function getCollection(array $raw) {
return new App_Mapper_WorkShiftCollection($raw, $this);
}
protected function targetClass() {
return "App_Domain_WorkShift";
}
}
?>
@@ -1,14 +1,14 @@
<?php
/**
* Work shift update collection - collection of elements in the work_shiftupdate database table
*
* @version 0.1
*/
class App_Mapper_WorkShiftUpdateCollection extends App_Mapper_Collection {
function targetClass() {
return "App_Domain_WorkShiftUpdate";
}
}
<?php
/**
* Work shift update collection - collection of elements in the work_shiftupdate database table
*
* @version 0.1
*/
class App_Mapper_WorkShiftUpdateCollection extends App_Mapper_Collection {
function targetClass() {
return "App_Domain_WorkShiftUpdate";
}
}
?>
+108 -108
View File
@@ -1,109 +1,109 @@
<?php
/**
* Work shift update object mapper to database table
*
* @version 0.1
*/
class App_Mapper_WorkShiftUpdateMapper extends App_Mapper_Mapper {
function __construct() {
// initialize database connection and common setup
parent::__construct();
// prepare SQL statements
$this->selectStmt = self::$PDO->prepare(
"SELECT * FROM work_shiftupdate WHERE id=?");
$this->selectAllStmt = self::$PDO->prepare(
"SELECT * FROM work_shiftupdate");
$this->findByShiftIdStmt = self::$PDO->prepare(
"SELECT * FROM work_shiftupdate WHERE shift_id=?");
$this->updateStmt = self::$PDO->prepare(
"UPDATE work_shiftupdate SET
shift_id=?,
update_time=?,
user_id=?,
update_text=?
WHERE id=?");
$this->insertStmt = self::$PDO->prepare(
"INSERT INTO work_shiftupdate (
shift_id, update_time, user_id, update_text
) values (?, ?, ?, ?)");
$this->deleteStmt = self::$PDO->prepare(
"DELETE FROM work_shiftupdate WHERE id=?");
}
protected function doCreateObject(array $array) {
$obj = new App_Domain_WorkShiftUpdate($array["id"]);
// find shift and create workshift object
$shift_mapper = new App_Mapper_WorkShiftMapper();
$shift = $shift_mapper->find($array["shift_id"]);
$obj->setShift($shift);
$obj->setUpdateTime(new DateTime($array["update_time"]));
// find user and create user object
$user_mapper = new App_Domain_User();
$user = $user_mapper->find($array["user_id"]);
$obj->setUser($user);
$obj->setUpdateText($array["text"]);
return $obj;
}
protected function doInsert(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getShift()->getId());
$this->insertStmt->bindValue(2, $object->getUpdateTime()->format(self::DATETIME_FORMAT));
$this->insertStmt->bindValue(3, $object->getUser()->getId());
$this->insertStmt->bindValue(4, $object->getUpdateText());
$this->insertStmt->execute();
$id = self::$PDO->lastInsertId();
$this->setId($id);
}
function update(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getShift()->getId());
$this->insertStmt->bindValue(2, $object->getUpdateTime()->format(self::DATETIME_FORMAT));
$this->insertStmt->bindValue(3, $object->getUser()->getId());
$this->insertStmt->bindValue(4, $object->getUpdateText());
$this->updateStmt->bindValue(5, $object->getId());
$this->updateStmt->execute();
}
protected function doDelete(App_Domain_DomainObject $object) {
$values = array($object->getId());
$this->deleteStmt->execute($values);
}
function selectStmt() {
return $this->selectStmt;
}
function selectAllStmt() {
return $this->selectAllStmt;
}
function deleteStmt() {
return $this->deleteStmt;
}
function findByShiftId($shift_id) {
$this->findByShiftIdStmt->execute(array($shift_id));
return new App_Mapper_WorkShiftUpdateCollection($this->findByShiftIdStmt->fetchAll(), $this);
}
function getCollection(array $raw) {
return new App_Mapper_WorkShiftUpdateCollection($raw, $this);
}
protected function targetClass() {
return "App_Domain_WorkShiftUpdate";
}
}
<?php
/**
* Work shift update object mapper to database table
*
* @version 0.1
*/
class App_Mapper_WorkShiftUpdateMapper extends App_Mapper_Mapper {
function __construct() {
// initialize database connection and common setup
parent::__construct();
// prepare SQL statements
$this->selectStmt = self::$PDO->prepare(
"SELECT * FROM work_shiftupdate WHERE id=?");
$this->selectAllStmt = self::$PDO->prepare(
"SELECT * FROM work_shiftupdate");
$this->findByShiftIdStmt = self::$PDO->prepare(
"SELECT * FROM work_shiftupdate WHERE shift_id=?");
$this->updateStmt = self::$PDO->prepare(
"UPDATE work_shiftupdate SET
shift_id=?,
update_time=?,
user_id=?,
update_text=?
WHERE id=?");
$this->insertStmt = self::$PDO->prepare(
"INSERT INTO work_shiftupdate (
shift_id, update_time, user_id, update_text
) values (?, ?, ?, ?)");
$this->deleteStmt = self::$PDO->prepare(
"DELETE FROM work_shiftupdate WHERE id=?");
}
protected function doCreateObject(array $array) {
$obj = new App_Domain_WorkShiftUpdate($array["id"]);
// find shift and create workshift object
$shift_mapper = new App_Mapper_WorkShiftMapper();
$shift = $shift_mapper->find($array["shift_id"]);
$obj->setShift($shift);
$obj->setUpdateTime(new DateTime($array["update_time"]));
// find user and create user object
$user_mapper = new App_Domain_User();
$user = $user_mapper->find($array["user_id"]);
$obj->setUser($user);
$obj->setUpdateText($array["text"]);
return $obj;
}
protected function doInsert(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getShift()->getId());
$this->insertStmt->bindValue(2, $object->getUpdateTime()->format(self::DATETIME_FORMAT));
$this->insertStmt->bindValue(3, $object->getUser()->getId());
$this->insertStmt->bindValue(4, $object->getUpdateText());
$this->insertStmt->execute();
$id = self::$PDO->lastInsertId();
$this->setId($id);
}
function update(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getShift()->getId());
$this->insertStmt->bindValue(2, $object->getUpdateTime()->format(self::DATETIME_FORMAT));
$this->insertStmt->bindValue(3, $object->getUser()->getId());
$this->insertStmt->bindValue(4, $object->getUpdateText());
$this->updateStmt->bindValue(5, $object->getId());
$this->updateStmt->execute();
}
protected function doDelete(App_Domain_DomainObject $object) {
$values = array($object->getId());
$this->deleteStmt->execute($values);
}
function selectStmt() {
return $this->selectStmt;
}
function selectAllStmt() {
return $this->selectAllStmt;
}
function deleteStmt() {
return $this->deleteStmt;
}
function findByShiftId($shift_id) {
$this->findByShiftIdStmt->execute(array($shift_id));
return new App_Mapper_WorkShiftUpdateCollection($this->findByShiftIdStmt->fetchAll(), $this);
}
function getCollection(array $raw) {
return new App_Mapper_WorkShiftUpdateCollection($raw, $this);
}
protected function targetClass() {
return "App_Domain_WorkShiftUpdate";
}
}
?>
@@ -1,15 +1,15 @@
<?php
/**
* Work shift worker collection - collection of elements in the work_shiftworker database table
*
* @version 0.1
*/
class App_Mapper_WorkShiftWorkerCollection extends App_Mapper_Collection {
function targetClass() {
return "App_Domain_WorkShiftWorker";
}
}
<?php
/**
* Work shift worker collection - collection of elements in the work_shiftworker database table
*
* @version 0.1
*/
class App_Mapper_WorkShiftWorkerCollection extends App_Mapper_Collection {
function targetClass() {
return "App_Domain_WorkShiftWorker";
}
}
?>
+122 -122
View File
@@ -1,123 +1,123 @@
<?php
/**
* Work shift worker object mapper to database table
*
* @version 0.1
*/
class App_Mapper_WorkShiftWorkerMapper extends App_Mapper_Mapper {
function __construct() {
// initialize database connection and common setup
parent::__construct();
// prepare SQL statements
$this->selectStmt = self::$PDO->prepare(
"SELECT * FROM work_shiftworker WHERE id=?");
$this->selectAllStmt = self::$PDO->prepare(
"SELECT * FROM work_shiftworker");
$this->findByShiftIdStmt = self::$PDO->prepare(
"SELECT * FROM work_shiftworker WHERE shift_id=?");
$this->findByUserIdStmt = self::$PDO->prepare(
"SELECT * FROM work_shiftworker WHERE user_id=?");
$this->insertStmt = self::$PDO->prepare(
"INSERT INTO work_shiftworker (
shift_id, user_id, assigned, no_show, user_comment, employer_comment
) values (?, ?, ?, ?, ?, ?)");
$this->updateStmt = self::$PDO->prepare(
"UPDATE work_shiftworker SET
shift_id=?,
user_id=?,
assigned=?,
no_show=?,
user_comment=?,
employer_comment=?
WHERE id=?");
$this->deleteStmt = self::$PDO->prepare(
"DELETE FROM work_shiftworker WHERE id=?");
}
protected function doCreateObject(array $array) {
$obj = new App_Domain_WorkShiftWorker($array["id"]);
// find shift and create workshift object
$shift_mapper = new App_Mapper_WorkShiftMapper();
$shift = $shift_mapper->find($array["shift_id"]);
$obj->setShift($shift);
// find user and create user object
$user_mapper = new App_Domain_User();
$user = $user_mapper->find($array["user_id"]);
$obj->setUser($user);
$obj->setAssigned($array["assigned"]);
$obj->setNoShow($array["no_show"]);
$obj->setUserComment($array["user_comment"]);
$obj->setEmployerComment($array["employer_comment"]);
return $obj;
}
protected function doInsert(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getShift()->getId());
$this->insertStmt->bindValue(2, $object->getUser()->getId());
$this->insertStmt->bindValue(3, $object->getAssigned());
$this->insertStmt->bindValue(4, $object->getNoShow());
$this->insertStmt->bindValue(5, $object->getUserComment());
$this->insertStmt->bindValue(6, $object->getEmployerComment());
$this->insertStmt->execute();
$id = self::$PDO->lastInsertId();
$this->setId($id);
}
function update(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getShift()->getId());
$this->insertStmt->bindValue(2, $object->getUser()->getId());
$this->insertStmt->bindValue(3, $object->getAssigned());
$this->insertStmt->bindValue(4, $object->getNoShow());
$this->insertStmt->bindValue(5, $object->getUserComment());
$this->insertStmt->bindValue(6, $object->getEmployerComment());
$this->updateStmt->bindValue(7, $object->getId());
$this->updateStmt->execute();
}
protected function doDelete(App_Domain_DomainObject $object) {
$values = array($object->getId());
$this->deleteStmt->execute($values);
}
function selectStmt() {
return $this->selectStmt;
}
function selectAllStmt() {
return $this->selectAllStmt;
}
function deleteStmt() {
return $this->deleteStmt;
}
function findByShiftId($shift_id) {
$this->findByShiftIdStmt->execute(array($shift_id));
return new App_Mapper_WorkShiftWorkerCollection($this->findByShiftIdStmt->fetchAll(), $this);
}
function findByUserId($user_id) {
$this->findByUserIdStmt->execute(array($user_id));
return new App_Mapper_WorkShiftWorkerCollection($this->findByUserIdStmt->fetchAll(), $this);
}
function getCollection(array $raw) {
return new App_Mapper_WorkShiftWorkerCollection($raw, $this);
}
protected function targetClass() {
return "App_Domain_WorkShiftWorker";
}
}
<?php
/**
* Work shift worker object mapper to database table
*
* @version 0.1
*/
class App_Mapper_WorkShiftWorkerMapper extends App_Mapper_Mapper {
function __construct() {
// initialize database connection and common setup
parent::__construct();
// prepare SQL statements
$this->selectStmt = self::$PDO->prepare(
"SELECT * FROM work_shiftworker WHERE id=?");
$this->selectAllStmt = self::$PDO->prepare(
"SELECT * FROM work_shiftworker");
$this->findByShiftIdStmt = self::$PDO->prepare(
"SELECT * FROM work_shiftworker WHERE shift_id=?");
$this->findByUserIdStmt = self::$PDO->prepare(
"SELECT * FROM work_shiftworker WHERE user_id=?");
$this->insertStmt = self::$PDO->prepare(
"INSERT INTO work_shiftworker (
shift_id, user_id, assigned, no_show, user_comment, employer_comment
) values (?, ?, ?, ?, ?, ?)");
$this->updateStmt = self::$PDO->prepare(
"UPDATE work_shiftworker SET
shift_id=?,
user_id=?,
assigned=?,
no_show=?,
user_comment=?,
employer_comment=?
WHERE id=?");
$this->deleteStmt = self::$PDO->prepare(
"DELETE FROM work_shiftworker WHERE id=?");
}
protected function doCreateObject(array $array) {
$obj = new App_Domain_WorkShiftWorker($array["id"]);
// find shift and create workshift object
$shift_mapper = new App_Mapper_WorkShiftMapper();
$shift = $shift_mapper->find($array["shift_id"]);
$obj->setShift($shift);
// find user and create user object
$user_mapper = new App_Domain_User();
$user = $user_mapper->find($array["user_id"]);
$obj->setUser($user);
$obj->setAssigned($array["assigned"]);
$obj->setNoShow($array["no_show"]);
$obj->setUserComment($array["user_comment"]);
$obj->setEmployerComment($array["employer_comment"]);
return $obj;
}
protected function doInsert(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getShift()->getId());
$this->insertStmt->bindValue(2, $object->getUser()->getId());
$this->insertStmt->bindValue(3, $object->getAssigned());
$this->insertStmt->bindValue(4, $object->getNoShow());
$this->insertStmt->bindValue(5, $object->getUserComment());
$this->insertStmt->bindValue(6, $object->getEmployerComment());
$this->insertStmt->execute();
$id = self::$PDO->lastInsertId();
$this->setId($id);
}
function update(App_Domain_DomainObject $object) {
$this->insertStmt->bindValue(1, $object->getShift()->getId());
$this->insertStmt->bindValue(2, $object->getUser()->getId());
$this->insertStmt->bindValue(3, $object->getAssigned());
$this->insertStmt->bindValue(4, $object->getNoShow());
$this->insertStmt->bindValue(5, $object->getUserComment());
$this->insertStmt->bindValue(6, $object->getEmployerComment());
$this->updateStmt->bindValue(7, $object->getId());
$this->updateStmt->execute();
}
protected function doDelete(App_Domain_DomainObject $object) {
$values = array($object->getId());
$this->deleteStmt->execute($values);
}
function selectStmt() {
return $this->selectStmt;
}
function selectAllStmt() {
return $this->selectAllStmt;
}
function deleteStmt() {
return $this->deleteStmt;
}
function findByShiftId($shift_id) {
$this->findByShiftIdStmt->execute(array($shift_id));
return new App_Mapper_WorkShiftWorkerCollection($this->findByShiftIdStmt->fetchAll(), $this);
}
function findByUserId($user_id) {
$this->findByUserIdStmt->execute(array($user_id));
return new App_Mapper_WorkShiftWorkerCollection($this->findByUserIdStmt->fetchAll(), $this);
}
function getCollection(array $raw) {
return new App_Mapper_WorkShiftWorkerCollection($raw, $this);
}
protected function targetClass() {
return "App_Domain_WorkShiftWorker";
}
}
?>
+6 -6
View File
@@ -1,7 +1,7 @@
</div>
</div> <!-- #content-wrap -->
</div>
</body>
</div>
</div> <!-- #content-wrap -->
</div>
</body>
</html>
+97 -97
View File
@@ -1,98 +1,98 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="no" lang="no">
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />
<link rel="stylesheet" title="default" type="text/css" href="https://www.studentersamfundet.no/inside/screen.css" />
<title><?php print App_Base_ApplicationRegistry::getPageTitle(); ?></title>
</head>
<body class="dns section-inside">
<div id="container">
<div id="header">
<span class="site-title"><a href="http://studentersamfundet.no/"><?php print App_Base_ApplicationRegistry::getPageTitle(); ?></a></span>
<div id="quick-menu">
Om Studentersamfundet | <a href="http://studentersamfundet.no/kart.php">Kart</a> | <a href="http://studentersamfundet.no/kontakt.php">Kontakt</a>
</div>
<div class="aapningstider">
<table>
<tr><td>Mandag-onsdag</td><td>13-01</td></tr>
<tr><td>Torsdag-fredag</td><td>13-03</td></tr>
<tr><td>L&oslash;rdag</td><td>16-03</td></tr>
<tr><td>Kjøkkenet</td><td>Til 19</td></tr>
</table>
</div>
<div id="menu">
<ul>
<li id="forside-meny"><a href="http://studentersamfundet.no/">Forside</a>
<div class="sub-menu">
<ul>
<li><a href="http://studentersamfundet.no/lokaler.php">Lokaler</a></li>
<li><a href="http://studentersamfundet.no/historie.php">Historie</a></li>
<li><a href="http://studentersamfundet.no/billetter.php">Billetter</a></li>
<li><a href="http://studentersamfundet.no/medlemmer.php">Bli medlem</a></li>
<li><a href="http://studentersamfundet.no/medlem/index.php">Registrere medlemskort</a></li>
</ul>
</div>
</li>
<li id="program-meny"><a href="http://studentersamfundet.no/prog.php">Program</a>
<div class="sub-menu">
<ul>
<li><a href="http://studentersamfundet.no/prog.php">Alle</a></li>
<li><a href="http://studentersamfundet.no/prog.php?type=konsert">Konsert</a></li>
<li><a href="http://studentersamfundet.no/prog.php?type=debatt">Debatt</a></li>
<li><a href="http://studentersamfundet.no/prog.php?type=film">Film</a></li>
<li><a href="http://studentersamfundet.no/prog.php?type=fest">Fest</a></li>
<li><a href="http://studentersamfundet.no/prog.php?type=teater">Teater</a></li>
<li><a href="http://studentersamfundet.no/prog.php?type=annet">Annet</a></li>
<li><a href="http://studentersamfundet.no/konsepter.php">Konsepter</a></li>
<li><a href="http://studentersamfundet.no/booking.php">Booking</a></li>
</ul>
</div>
</li>
<li id="foreninger-meny"><a href="http://studentersamfundet.no/foreninger.php">Foreninger</a>
<div class="sub-menu">
<ul>
<li><a href="http://studentersamfundet.no/foreninger.php">Foreninger</a></li>
</ul>
</div>
</li>
<li id="forum-meny"><a href="http://studentersamfundet.no/forum/index.php">Forum</a>
<div class="sub-menu">
<ul>
<li><a href="http://studentersamfundet.no/forum/viewforum.php?f=68">Musikk</a></li>
<li><a href="http://studentersamfundet.no/forum/viewforum.php?f=69">Debatt</a></li>
<li><a href="http://studentersamfundet.no/forum/viewforum.php?f=70">Fritt forum</a></li>
</ul>
</div>
</li>
<li id="inside-meny" class="current"><a href="https://www.studentersamfundet.no/inside">For medlemmer</a>
<div class="sub-menu">
<ul>
<li><a href="https://www.studentersamfundet.no/inside/">Inside</a></li>
<li><a href="http://studentersamfundet.no/viteboka/?page_id=3">Viteboka</a></li>
<li><a href="https://www.studentersamfundet.no/inside/index.php?page=display-barshifts-calendar">Tappet&aring;rnets vaktliste</a>
<li><a href="http://studentersamfundet.no/aktive.php">Andre ressurser</a></li>
</ul>
</div>
</li>
<li id="nyheter-meny"><a href="http://studentersamfundet.no/nyheter.php">Nyheter</a>
<div class="sub-menu">
<ul>
</ul>
</div>
</li>
</ul>
</div> <!-- #menu -->
</div> <!-- #header -->
<div id="content-wrap">
<?php
include("menu.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="no" lang="no">
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />
<link rel="stylesheet" title="default" type="text/css" href="https://www.studentersamfundet.no/inside/screen.css" />
<title><?php print App_Base_ApplicationRegistry::getPageTitle(); ?></title>
</head>
<body class="dns section-inside">
<div id="container">
<div id="header">
<span class="site-title"><a href="http://studentersamfundet.no/"><?php print App_Base_ApplicationRegistry::getPageTitle(); ?></a></span>
<div id="quick-menu">
Om Studentersamfundet | <a href="http://studentersamfundet.no/kart.php">Kart</a> | <a href="http://studentersamfundet.no/kontakt.php">Kontakt</a>
</div>
<div class="aapningstider">
<table>
<tr><td>Mandag-onsdag</td><td>13-01</td></tr>
<tr><td>Torsdag-fredag</td><td>13-03</td></tr>
<tr><td>L&oslash;rdag</td><td>16-03</td></tr>
<tr><td>Kjøkkenet</td><td>Til 19</td></tr>
</table>
</div>
<div id="menu">
<ul>
<li id="forside-meny"><a href="http://studentersamfundet.no/">Forside</a>
<div class="sub-menu">
<ul>
<li><a href="http://studentersamfundet.no/lokaler.php">Lokaler</a></li>
<li><a href="http://studentersamfundet.no/historie.php">Historie</a></li>
<li><a href="http://studentersamfundet.no/billetter.php">Billetter</a></li>
<li><a href="http://studentersamfundet.no/medlemmer.php">Bli medlem</a></li>
<li><a href="http://studentersamfundet.no/medlem/index.php">Registrere medlemskort</a></li>
</ul>
</div>
</li>
<li id="program-meny"><a href="http://studentersamfundet.no/prog.php">Program</a>
<div class="sub-menu">
<ul>
<li><a href="http://studentersamfundet.no/prog.php">Alle</a></li>
<li><a href="http://studentersamfundet.no/prog.php?type=konsert">Konsert</a></li>
<li><a href="http://studentersamfundet.no/prog.php?type=debatt">Debatt</a></li>
<li><a href="http://studentersamfundet.no/prog.php?type=film">Film</a></li>
<li><a href="http://studentersamfundet.no/prog.php?type=fest">Fest</a></li>
<li><a href="http://studentersamfundet.no/prog.php?type=teater">Teater</a></li>
<li><a href="http://studentersamfundet.no/prog.php?type=annet">Annet</a></li>
<li><a href="http://studentersamfundet.no/konsepter.php">Konsepter</a></li>
<li><a href="http://studentersamfundet.no/booking.php">Booking</a></li>
</ul>
</div>
</li>
<li id="foreninger-meny"><a href="http://studentersamfundet.no/foreninger.php">Foreninger</a>
<div class="sub-menu">
<ul>
<li><a href="http://studentersamfundet.no/foreninger.php">Foreninger</a></li>
</ul>
</div>
</li>
<li id="forum-meny"><a href="http://studentersamfundet.no/forum/index.php">Forum</a>
<div class="sub-menu">
<ul>
<li><a href="http://studentersamfundet.no/forum/viewforum.php?f=68">Musikk</a></li>
<li><a href="http://studentersamfundet.no/forum/viewforum.php?f=69">Debatt</a></li>
<li><a href="http://studentersamfundet.no/forum/viewforum.php?f=70">Fritt forum</a></li>
</ul>
</div>
</li>
<li id="inside-meny" class="current"><a href="https://www.studentersamfundet.no/inside">For medlemmer</a>
<div class="sub-menu">
<ul>
<li><a href="https://www.studentersamfundet.no/inside/">Inside</a></li>
<li><a href="http://studentersamfundet.no/viteboka/?page_id=3">Viteboka</a></li>
<li><a href="https://www.studentersamfundet.no/inside/index.php?page=display-barshifts-calendar">Tappet&aring;rnets vaktliste</a>
<li><a href="http://studentersamfundet.no/aktive.php">Andre ressurser</a></li>
</ul>
</div>
</li>
<li id="nyheter-meny"><a href="http://studentersamfundet.no/nyheter.php">Nyheter</a>
<div class="sub-menu">
<ul>
</ul>
</div>
</li>
</ul>
</div> <!-- #menu -->
</div> <!-- #header -->
<div id="content-wrap">
<?php
include("menu.php");
?>
<div id="content" class="clearfix">
+37 -37
View File
@@ -1,38 +1,38 @@
<?php
// get access manager
$manager = App_Base_ApplicationRegistry::getAccessManager();
?>
<div id="nav">
<a class="skip-nav" href="#content">hopp til innhold</a>
<ul id="navList">
<?php
if ($manager->getCommandAccess("view-shifts")) {
?>
<li class="menulist">
<a href="#" id="quickSwitch" class="switch">vaktliste</a>
<ul id="quickMenu" class="menu">
<li><a href="<?=$_SERVER["PHP_SELF"]?>?cmd=view-shifts">vis mine vakter</a></li>
<li><a href="<?=$_SERVER["PHP_SELF"]?>?cmd=view-calendar">vis kalender</a></li>
<?php
if ($manager->getCommandAccess("add-shift")) {
?>
<li><a href="<?=$_SERVER["PHP_SELF"]?>?cmd=add-shift">legg til nye vakter</a></li>
<?php
}
?>
</ul>
</li>
<?php
}
?>
</ul>
<?php
if ($manager->getCommandAccess("logout")) {
?>
<a href="<?=$_SERVER["PHP_SELF"]?>?cmd=logout">logg ut</a>
<?php
}
?>
<?php
// get access manager
$manager = App_Base_ApplicationRegistry::getAccessManager();
?>
<div id="nav">
<a class="skip-nav" href="#content">hopp til innhold</a>
<ul id="navList">
<?php
if ($manager->getCommandAccess("view-shifts")) {
?>
<li class="menulist">
<a href="#" id="quickSwitch" class="switch">vaktliste</a>
<ul id="quickMenu" class="menu">
<li><a href="<?=$_SERVER["PHP_SELF"]?>?cmd=view-shifts">vis mine vakter</a></li>
<li><a href="<?=$_SERVER["PHP_SELF"]?>?cmd=view-calendar">vis kalender</a></li>
<?php
if ($manager->getCommandAccess("add-shift")) {
?>
<li><a href="<?=$_SERVER["PHP_SELF"]?>?cmd=add-shift">legg til nye vakter</a></li>
<?php
}
?>
</ul>
</li>
<?php
}
?>
</ul>
<?php
if ($manager->getCommandAccess("logout")) {
?>
<a href="<?=$_SERVER["PHP_SELF"]?>?cmd=logout">logg ut</a>
<?php
}
?>
</div>
+10 -10
View File
@@ -1,10 +1,10 @@
<?php
//require_once( "App/Base/Registry.php" );
class App_View_ViewHelper {
static function getRequest() {
return App_Base_RequestRegistry::getRequest();
}
}
?>
<?php
//require_once( "App/Base/Registry.php" );
class App_View_ViewHelper {
static function getRequest() {
return App_Base_RequestRegistry::getRequest();
}
}
?>
+100 -37
View File
@@ -1,37 +1,100 @@
<?php
$request = App_View_ViewHelper::getRequest();
$currentUser = $request->getObject('currentUser');
//$venue = $request->getObject('venue');
include_once("Calendar.php");
$calendar = new Calendar("barshifts");
//$month = scriptParam("month");
if (!empty($month)){
$year = substr($month, 0, 4);
$month = substr($month, 4, 2);
}else {
$year = date("Y");
$month = date("m");
}
include("Common/header.php");
?>
<div>
<?php
print "<h1>Vaktliste for " . $month . " " . $year . "</h1>\n";
print $request->getFeedbackString("<br />");
$calendar->display($year, $month);
?>
</div>
<?php
include("Common/footer.php");
?>
<?php
$request = App_View_ViewHelper::getRequest();
$currentUser = $request->getObject('currentUser');
$calendar = $request->getObject('calendar');
//$venue = $request->getObject('venue');
//$month = scriptParam("month");
if (!is_null($request->getProperty("month"))){
$year = substr($request->getProperty("month"), 0, 4);
$month = substr($request->getProperty("month"), 5, 2);
} else {
$year = date("Y");
$month = date("m");
}
// from calendar::display()
$previousYear = ($year - 1) . "-" . $month;
$previousMonth = date("Y-m", strtotime("-1 month", strtotime("$year-$month-01")));
$nextMonth = date("Y-m", strtotime("+1 month", strtotime("$year-$month-01")));
$nextYear = ($year + 1) . "-" . $month;
$fDate = "$year-$month-01";
$dayOfWeek = date("w", strtotime("$year-$month-01"));
if ($dayOfWeek == "0"){
$dayOfWeek = 7;
}
$lastDayOfMonth = date("t", strtotime("$year-$month-01"));
$weekNumber = date("W", strtotime("$year-$month-01"));
include("Common/header.php");
?>
<div>
<h1>Vaktliste for <?=$calendar->getMonth()->getMonthName()?> <?=$year?></h1>
<?php
print $request->getFeedbackString("<br />");
?>
<div id="calHeader">
<div id="previous">
<a href="<?=$_SERVER["PHP_SELF"]?>?cmd=<?=$request->getProperty('cmd')?>&month=<?php print $previousYear; ?>">&lt;&lt;</a>
<a href="<?=$_SERVER["PHP_SELF"]?>?cmd=<?=$request->getProperty('cmd')?>&month=<?php print $previousMonth; ?>">&lt;</a>
</div>
<div id="next">
<a href="<?=$_SERVER["PHP_SELF"]?>?cmd=<?=$request->getProperty('cmd')?>&month=<?php print $nextMonth; ?>">&gt;</a>
<a href="<?=$_SERVER["PHP_SELF"]?>?cmd=<?=$request->getProperty('cmd')?>&month=<?php print $nextYear; ?>">&gt;&gt;</a>
</div>
<h2><?php print(strftime("%B - %Y", strtotime($fDate))); ?></h2>
</div>
<?php //$calendar->_displayCalendarOptions(); ?>
<table class="calendar">
<tr>
<th>Uke</th>
<th>Mandag</th>
<th>Tirsdag</th>
<th>Onsdag</th>
<th>Torsdag</th>
<th>Fredag</th>
<th>Lørdag</th>
<th>Søndag</th>
</tr>
<?php
foreach ($calendar->getMonth()->getWeeks() as $week) {
print "<tr>";
print "<td class=\"weekNumber\">" . $week->getWeek()->format("W") . "</td>";
foreach ($week->getDays() as $day) {
// is the date in current month ?
if ($calendar->isInMonth($day)) {
print "<td class=\"active\">";
} else {
print "<td class=\"passive\">";
}
print $day->getDate()->format("j");
foreach ($day->getShifts() as $shift) {
print "<div>";
print $shift->getStarts()->format("H:i") . " <b>" . $shift->getTitle() . "</b> <a href=\"?work\">work</a>" . " <a href=\"?edit-shift\">edit</a>";
print "<br />";
print $shift->getEnds()->format("H:i") . " <i>" . $shift->getLocation()->getName() . "</i>";
print "</div>";
}
print "</td>";
}
print "</tr>\n";
}
?>
</table>
</div>
<?php
include("Common/footer.php");
?>
+79
View File
@@ -0,0 +1,79 @@
<?php
include("Common/header.php");
?>
<table width="1000" cellpadding="0" cellspacing="0" style="background-color: #616161;">
<tr id="meny-top">
<td><a href="">min side</a></td>
<td>|</td>
<td><a href="">aktiv</a></td>
<td></td>
<td><a href=""></a></td>
<td></td>
<td><a href=""></a></td>
<td></td>
<td><a href=""></a></td>
<td></td>
<td><a href="">logg ut</a></td>
<td>&nbsp;</td>
</tr>
</table>
<div id="wrap" style="width:100%;padding-top: 10px;">
<div id="content">
<div class="text-column">
<h1>Velkommen til Studentersamfundet Inside!</h1>
<p>Her kan du registrere medlemskapet du har kjøpt, kjøpe medlemskap gjennom vår nettbutikk og oppdatere adressen din.
Se også hvilke foreninger som tar inn nye medlemmer, eller hva som skjer på studentersamfundet denne uken!</p>
<div class="contentElem">
<form method="post" action="index.php?action=log-in">
<table>
<tr>
<td class="label"><label for="username">brukernavn</label></td>
<td><input type="text" name="username" id="username" size="12" maxlength="12" /></td>
</tr>
<tr>
<td class="label"><label for="password">passord</label></td>
<td><input type="password" name="password" id="password" size="12" maxlength="50" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="logg inn" class="submit" /></td>
</tr>
</table>
</form>
</div>
<h3>Ny bruker?</h3>
<p><a href="index.php?page=register-user">Registrér deg!</a></p>
<br />
<h3>Mangler du eller har du glemt brukernavn og passord?</h3>
<p>Du kan få tilsendt brukernavn og resatt passordet ditt ved å oppgi medlemskortnummer eller epostadresse:</p>
<fieldset>
<legend>Tast inn epost eller medlemskortnummer for å få tilsendt brukernavn og passord:</legend>
<form method="post" action="index.php?action=order-password">
<input type="text" name="userid" />
<input type="submit" value="send bestilling" />
</form>
</fieldset>
<br />
<h3>Noe som ikke virker?</h3>
<p>Send epost til <a href="mailto:medlemskap@studentersamfundet.no">medlemskap@studentersamfundet.no</a>. Oppgi medlemskortnummer og en kort beskrivelse av hva som ikke virker, så skal vi hjelpe deg så fort vi kan.</p>
</div> <!-- #text-colum -->
</div><!-- #content -->
<div id="left" class="sidebar">
<div class="column-element">
Meny
</div>
<?php
include("Common/footer.php");
?>
+48 -48
View File
@@ -1,49 +1,49 @@
<?php
$request = App_View_ViewHelper::getRequest();
include("Common/header.php");
?>
<div>
<h1>Velkommen til vaktlisten!</h1>
<p>Du må være logget inn for å kunne gjøre noe her.</p>
<?php
if (count($request->getFeedback()) > 0) {
print "<div class=\"messages\">\n";
print " <h3>Beskjeder</h3>\n";
print " <ul>\n";
print " <li>" . $request->getFeedbackString("</li>\n <li>") . "</li>\n";
print " </ul>\n";
print "</div>\n";
}
?>
<div class="contentElem">
<form method="post" action="<?=$_SERVER['PHP_SELF']?>?cmd=login">
<table>
<tr>
<td class="label"><label for="username">brukernavn</label></td>
<td><input type="text" name="username" id="username" size="12" maxlength="12" /></td>
</tr>
<tr>
<td class="label"><label for="password">passord</label></td>
<td><input type="password" name="password" id="password" size="12" maxlength="50" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="logg inn" class="submit" /></td>
</tr>
</table>
</form>
</div>
<p>Mangler du brukernavn eller passord? <a href="https://www.studentersamfundet.no/inside/">Få tilsendt brukernavn og passord hvis du er registrert fra før</a>, eller <a href="https://www.studentersamfundet.no/inside/index.php?page=register-user">registrér deg</a>!</p>
</div>
<?php
include("Common/footer.php");
<?php
$request = App_View_ViewHelper::getRequest();
include("Common/header.php");
?>
<div>
<h1>Velkommen til vaktlisten!</h1>
<p>Du må være logget inn for å kunne gjøre noe her.</p>
<?php
if (count($request->getFeedback()) > 0) {
print "<div class=\"messages\">\n";
print " <h3>Beskjeder</h3>\n";
print " <ul>\n";
print " <li>" . $request->getFeedbackString("</li>\n <li>") . "</li>\n";
print " </ul>\n";
print "</div>\n";
}
?>
<div class="contentElem">
<form method="post" action="<?=$_SERVER['PHP_SELF']?>?cmd=login">
<table>
<tr>
<td class="label"><label for="username">brukernavn</label></td>
<td><input type="text" name="username" id="username" size="12" maxlength="12" /></td>
</tr>
<tr>
<td class="label"><label for="password">passord</label></td>
<td><input type="password" name="password" id="password" size="12" maxlength="50" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="logg inn" class="submit" /></td>
</tr>
</table>
</form>
</div>
<p>Mangler du brukernavn eller passord? <a href="https://www.studentersamfundet.no/inside/">Få tilsendt brukernavn og passord hvis du er registrert fra før</a>, eller <a href="https://www.studentersamfundet.no/inside/index.php?page=register-user">registrér deg</a>!</p>
</div>
<?php
include("Common/footer.php");
?>
+13 -13
View File
@@ -1,14 +1,14 @@
<html>
<head>
<title>Apptest</title>
</head>
<body>
<h1>Welcome</h1>
<?php
foreach (App_Base_RequestRegistry::getRequest()->getFeedback() as $feedback) {
print $feedback . "<br>";
}
?>
</body>
<html>
<head>
<title>Apptest</title>
</head>
<body>
<h1>Welcome</h1>
<?php
foreach (App_Base_RequestRegistry::getRequest()->getFeedback() as $feedback) {
print $feedback . "<br>";
}
?>
</body>
</html>
Loaded 100 of 104 files, more files were not shown because too many files have changed in this diff. Show more