diff options
Diffstat (limited to 'demos/time-tracker/protected/App_Data')
-rw-r--r-- | demos/time-tracker/protected/App_Data/DateTimeTypeHandler.php | 8 | ||||
-rw-r--r-- | demos/time-tracker/protected/App_Data/SQLite/projects.xml | 28 | ||||
-rw-r--r-- | demos/time-tracker/protected/App_Data/SQLite/time-entry.xml | 28 | ||||
-rw-r--r-- | demos/time-tracker/protected/App_Data/SQLite/time-tracker.db | bin | 32768 -> 29696 bytes | |||
-rw-r--r-- | demos/time-tracker/protected/App_Data/SQLite/time-tracker.db.bak | bin | 32768 -> 29696 bytes | |||
-rw-r--r-- | demos/time-tracker/protected/App_Data/SQLite/users.xml | 24 | ||||
-rw-r--r-- | demos/time-tracker/protected/App_Data/TimeTrackerUserTypeHandler.php | 4 | ||||
-rw-r--r-- | demos/time-tracker/protected/App_Data/sqlite-sqlmap.xml | 36 |
8 files changed, 60 insertions, 68 deletions
diff --git a/demos/time-tracker/protected/App_Data/DateTimeTypeHandler.php b/demos/time-tracker/protected/App_Data/DateTimeTypeHandler.php index 17f3e14b..03af3d36 100644 --- a/demos/time-tracker/protected/App_Data/DateTimeTypeHandler.php +++ b/demos/time-tracker/protected/App_Data/DateTimeTypeHandler.php @@ -1,6 +1,6 @@ <?php
-class DateTimeTypeHandler implements ITypeHandlerCallback
+class DateTimeTypeHandler extends TSqlMapTypeHandler
{
/**
* Not implemented.
@@ -15,7 +15,9 @@ class DateTimeTypeHandler implements ITypeHandlerCallback */
public function getResult($string)
{
- return strtotime($string);
+ if(intval($string) > 10000) //strtotime doesn't like unix epoc time.
+ return intval($string);
+ return strtotime($string);
}
/**
@@ -27,7 +29,7 @@ class DateTimeTypeHandler implements ITypeHandlerCallback {
throw new TimeTrackerException('Not implemented');
}
-
+
}
?>
\ No newline at end of file diff --git a/demos/time-tracker/protected/App_Data/SQLite/projects.xml b/demos/time-tracker/protected/App_Data/SQLite/projects.xml index e5f52887..f28f7a47 100644 --- a/demos/time-tracker/protected/App_Data/SQLite/projects.xml +++ b/demos/time-tracker/protected/App_Data/SQLite/projects.xml @@ -21,8 +21,8 @@ INSERT INTO projects
(Name, Description, CreationDate, EstimateDuration, CompletionDate, CreatorID, ManagerID)
VALUES
- (#Name#, #Description#, php('date', 'Y-m-d H:i:s'), #EstimateDuration#,
- #CompletionDate, typeHandler=DateTime#,
+ (#Name#, #Description#, strftime('%s', 'now'), #EstimateDuration#,
+ #CompletionDate, typeHandler=DateTime#,
#CreatorUserName#, #ManagerUserName#)
<selectKey property="ID" type="post" resultClass="int">
select LAST_INSERT_ROWID() as value
@@ -30,7 +30,7 @@ </insert>
<select id="GetProjectByID" parameterClass="integer" resultMap="project-result">
- SELECT
+ SELECT
projects.ProjectID as ProjectID,
projects.Name as Name,
projects.Description as Description,
@@ -43,8 +43,8 @@ FROM projects
LEFT JOIN categories ON projects.ProjectID = categories.ProjectID
LEFT JOIN time_entry ON categories.CategoryID = time_entry.CategoryID
- WHERE
- projects.ProjectID = #value#
+ WHERE
+ projects.ProjectID = #value#
AND Disabled = 0
GROUP BY
projects.ProjectID
@@ -53,7 +53,7 @@ </select>
<select id="GetAllProjects" resultMap="project-result">
- SELECT
+ SELECT
projects.ProjectID as ProjectID,
projects.Name as Name,
projects.Description as Description,
@@ -66,7 +66,7 @@ FROM projects
LEFT JOIN categories ON projects.ProjectID = categories.ProjectID
LEFT JOIN time_entry ON categories.CategoryID = time_entry.CategoryID
- WHERE
+ WHERE
Disabled = 0
GROUP BY
projects.ProjectID
@@ -79,7 +79,7 @@ </select>
<select id="GetProjectsByManagerName" resultMap="project-result">
- SELECT
+ SELECT
projects.ProjectID as ProjectID,
projects.Name as Name,
projects.Description as Description,
@@ -92,8 +92,8 @@ FROM projects
LEFT JOIN categories ON projects.ProjectID = categories.ProjectID
LEFT JOIN time_entry ON categories.CategoryID = time_entry.CategoryID
- WHERE
- Disabled = 0
+ WHERE
+ Disabled = 0
AND projects.ManagerID = #value#
GROUP BY
projects.ProjectID
@@ -102,7 +102,7 @@ </select>
<select id="GetProjectsByUserName" resultMap="project-result">
- SELECT
+ SELECT
projects.ProjectID as ProjectID,
projects.Name as Name,
projects.Description as Description,
@@ -116,7 +116,7 @@ LEFT JOIN categories ON projects.ProjectID = categories.ProjectID
LEFT JOIN time_entry ON categories.CategoryID = time_entry.CategoryID,
project_members
- WHERE
+ WHERE
project_members.ProjectID = projects.ProjectID
AND project_members.UserID = #value#
AND projects.Disabled = 0
@@ -146,13 +146,13 @@ <update id="UpdateProject" parameterClass="ProjectRecord">
UPDATE projects
- SET
+ SET
CompletionDate = #CompletionDate, typeHandler=DateTime#,
Description = #Description#,
EstimateDuration = #EstimateDuration#,
ManagerId =#ManagerUserName#,
Name = #Name#
- WHERE
+ WHERE
ProjectID = #ID#
</update>
diff --git a/demos/time-tracker/protected/App_Data/SQLite/time-entry.xml b/demos/time-tracker/protected/App_Data/SQLite/time-entry.xml index 1d7fec37..bb3c9e69 100644 --- a/demos/time-tracker/protected/App_Data/SQLite/time-entry.xml +++ b/demos/time-tracker/protected/App_Data/SQLite/time-entry.xml @@ -3,21 +3,21 @@ <insert id="AddNewTimeEntry" parameterClass="TimeEntryRecord">
INSERT INTO time_entry(
- EntryCreated,
- Duration,
- Description,
+ EntryCreated,
+ Duration,
+ Description,
CategoryID,
- EntryDate,
- CreatorID,
+ EntryDate,
+ CreatorID,
UserID
)
VALUES(
- php('date', 'Y-m-d H:i:s'),
- #Duration#,
- #Description#,
+ strftime('%s', 'now'),
+ #Duration#,
+ #Description#,
#Category.ID#,
- #ReportDate, typeHandler=DateTime#,
- #CreatorUserName#,
+ #ReportDate, typeHandler=DateTime#,
+ #CreatorUserName#,
#Username#
)
<selectKey property="ID" type="post" resultClass="int">
@@ -53,9 +53,9 @@ </resultMap>
<select id="GetTimeEntryByID" resultMap="time-entry-result">
- SELECT
+ SELECT
*
- FROM
+ FROM
time_entry
WHERE
EntryID = #value#
@@ -66,7 +66,7 @@ </delete>
<select id="GetAllTimeEntriesByProjectIdAndUser" resultMap="time-entry-category-result">
- SELECT
+ SELECT
time_entry.EntryID as EntryID,
time_entry.EntryCreated as EntryCreated,
time_entry.Duration as Duration,
@@ -82,7 +82,7 @@ time_entry.UserID = #username#
AND time_entry.CategoryID = categories.CategoryID
AND categories.ProjectID = #project#
- ORDER BY
+ ORDER BY
EntryID ASC
</select>
diff --git a/demos/time-tracker/protected/App_Data/SQLite/time-tracker.db b/demos/time-tracker/protected/App_Data/SQLite/time-tracker.db Binary files differindex 124bbeba..6cafd20f 100644 --- a/demos/time-tracker/protected/App_Data/SQLite/time-tracker.db +++ b/demos/time-tracker/protected/App_Data/SQLite/time-tracker.db diff --git a/demos/time-tracker/protected/App_Data/SQLite/time-tracker.db.bak b/demos/time-tracker/protected/App_Data/SQLite/time-tracker.db.bak Binary files differindex 124bbeba..206b3e3c 100644 --- a/demos/time-tracker/protected/App_Data/SQLite/time-tracker.db.bak +++ b/demos/time-tracker/protected/App_Data/SQLite/time-tracker.db.bak diff --git a/demos/time-tracker/protected/App_Data/SQLite/users.xml b/demos/time-tracker/protected/App_Data/SQLite/users.xml index 74b33b2c..45e68c01 100644 --- a/demos/time-tracker/protected/App_Data/SQLite/users.xml +++ b/demos/time-tracker/protected/App_Data/SQLite/users.xml @@ -13,7 +13,7 @@ <!--
<select id="GetUserByName" parameterClass="string" resultMap="TimeTrackerUser">
- SELECT
+ SELECT
users.Username as Name,
users.EmailAddress as EmailAddress,
user_roles.RoleType as role
@@ -22,7 +22,7 @@ LEFT JOIN user_roles ON users.Username = user_roles.UserID
WHERE
Username = #value#
- AND
+ AND
Disabled = 0
</select>
-->
@@ -32,7 +32,7 @@ </select>
<select id="GetUserByName" parameterClass="string" resultMap="time-tracker-user">
- SELECT
+ SELECT
users.Username as Name,
users.EmailAddress as EmailAddress,
user_roles.RoleType as role
@@ -41,10 +41,10 @@ LEFT JOIN user_roles ON users.Username = user_roles.UserID
WHERE
Username = #value#
- AND
+ AND
Disabled = 0
</select>
-
+
<select id="GetAllUsers" resultMap="time-tracker-user">
SELECT
users.Username as Name,
@@ -58,7 +58,7 @@ </select>
<select id="ValidateUser" resultClass="boolean">
- SELECT
+ SELECT
count(Username)
FROM
users
@@ -69,7 +69,7 @@ </select>
<insert id="AddNewUser" parameterClass="array">
- INSERT INTO
+ INSERT INTO
users (Username, Password, EmailAddress)
VALUES
(#user.Name#, #password#, #user.EmailAddress#)
@@ -80,10 +80,10 @@ </update>
<insert id="RegisterAutoSignon" parameterClass="array">
- INSERT INTO
+ INSERT INTO
signon (SessionToken, Username, LastSignOnDate)
VALUES
- (#token#, #username#, php('date', 'Y-m-d H:i:s'))
+ (#token#, #username#, strftime('%s', 'now'))
</insert>
<select id="ValidateAutoSignon" resultMap="time-tracker-user">
@@ -101,7 +101,7 @@ </select>
<update id="UpdateSignon">
- UPDATE signon SET LastSignOnDate = php('date', 'Y-m-d H:i:s')
+ UPDATE signon SET LastSignOnDate = strftime('%s', 'now')
WHERE SessionToken = #value#
</update>
@@ -115,13 +115,13 @@ </update>
<update id="UpdateUserDetails" parameterClass="TimeTrackerUser">
- UPDATE users
+ UPDATE users
SET EmailAddress = #EmailAddress#
WHERE Username = #Name#
</update>
<update id="UpdateUserDetailsAndPassword" parameterClass="array">
- UPDATE users
+ UPDATE users
SET EmailAddress = #user.EmailAddress#, Password=#password#
WHERE Username = #user.Name#
</update>
diff --git a/demos/time-tracker/protected/App_Data/TimeTrackerUserTypeHandler.php b/demos/time-tracker/protected/App_Data/TimeTrackerUserTypeHandler.php index c2d5c4d6..54aba438 100644 --- a/demos/time-tracker/protected/App_Data/TimeTrackerUserTypeHandler.php +++ b/demos/time-tracker/protected/App_Data/TimeTrackerUserTypeHandler.php @@ -19,7 +19,7 @@ * @package Demos
* @since 3.1
*/
-class TimeTrackerUserTypeHandler implements ITypeHandlerCallback
+class TimeTrackerUserTypeHandler extends TSqlMapTypeHandler
{
/**
* Not implemented.
@@ -34,7 +34,7 @@ class TimeTrackerUserTypeHandler implements ITypeHandlerCallback */
public function getResult($string)
{
- throw new TimeTrackerException('Not implemented');
+ throw new TimeTrackerException('Not implemented');
}
/**
diff --git a/demos/time-tracker/protected/App_Data/sqlite-sqlmap.xml b/demos/time-tracker/protected/App_Data/sqlite-sqlmap.xml index 9590b506..3cbb846e 100644 --- a/demos/time-tracker/protected/App_Data/sqlite-sqlmap.xml +++ b/demos/time-tracker/protected/App_Data/sqlite-sqlmap.xml @@ -1,26 +1,16 @@ <?xml version="1.0" encoding="UTF-8" ?>
<sqlMapConfig>
-
- <typeHandlers>
- <typeHandler type="TimeTrackerUser"
- callback="TimeTrackerUserTypeHandler"/>
- <typeHandler type="DateTime"
- callback="DateTimeTypeHandler" />
- </typeHandlers>
-
- <provider class="TAdodb">
- <datasource
- driver="sqlite"
- host="Application.App_Data.SQLite"
- database="time-tracker.db" />
- </provider>
-
- <sqlMaps>
- <sqlMap resource="SQLite/users.xml"/>
- <sqlMap resource="SQLite/projects.xml"/>
- <sqlMap resource="SQLite/category.xml" />
- <sqlMap resource="SQLite/time-entry.xml" />
- <sqlMap resource="SQLite/reports.xml" />
- </sqlMaps>
-
+
+ <typeHandler type="TimeTrackerUser" class="TimeTrackerUserTypeHandler"/>
+ <typeHandler type="DateTime" class="DateTimeTypeHandler" />
+
+ <connection class="TDbConnection"
+ ConnectionString="sqlite:protected/App_Data/SQLite/time-tracker.db" />
+
+ <sqlMap resource="SQLite/users.xml"/>
+ <sqlMap resource="SQLite/projects.xml"/>
+ <sqlMap resource="SQLite/category.xml" />
+ <sqlMap resource="SQLite/time-entry.xml" />
+ <sqlMap resource="SQLite/reports.xml" />
+
</sqlMapConfig>
\ No newline at end of file |