Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
druid-public
headwork
Commits
37b37074
Commit
37b37074
authored
Aug 03, 2021
by
GROSS-AMBLARD David
Browse files
Removes initializeSession, used only by deprecated isnlp workflow
parent
36bbfaf7
Changes
7
Hide whitespace changes
Inline
Side-by-side
actions.php
deleted
100644 → 0
View file @
36bbfaf7
<?php
/**
* cleanDb
*
* Clean the db if the user was connected as anonymous
*
* @param $conn : A valid database PDO connection
*/
function
cleanDb
(
$conn
)
{
//trace des preferences si besoin
}
/**
* nextTaskFromArtifact
*
* retrieve the next task available for the given artifact and user (i.e. task with the smallest id)
*
* @param $conn: A valid database PDO connection
* @param $user: A user id
* @param $artifact: A valid artifact id
*/
function
nextTaskFromArtifact
(
$conn
,
$user
,
$artifact
){
$stmt
=
$conn
->
prepare
(
"SELECT t.id
FROM Task t, Profile p, Skills s
WHERE s.iduser = :user
AND s.idskill = p.idskill
AND t.id = p.idtask
AND t.artifact = :artifact
ORDER BY t.id asc LIMIT 1"
);
$stmt
->
bindParam
(
':user'
,
$user
,
PDO
::
PARAM_INT
);
$stmt
->
bindParam
(
':artifact'
,
$artifact
,
PDO
::
PARAM_INT
);
$res
=
$stmt
->
execute
();
$nextTaskId
=
$stmt
->
fetchColumn
();
return
$nextTaskId
;
}
// TODO document bots
// TODO document presentation.html
index.php
View file @
37b37074
...
...
@@ -26,7 +26,6 @@ require_once("lib/HTML.php");
require_once
(
"lib/artifacts.php"
);
require_once
(
"pages/skills/skills.php"
);
require_once
(
"tasks.php"
);
require_once
(
"actions.php"
);
require_once
(
"connection.php"
);
require_once
(
"show-pages.php"
);
require_once
(
"pages/workflowdesign/workflowdesign.php"
);
...
...
@@ -75,54 +74,41 @@ debug("mode is : $mode");
switch
(
$mode
)
{
case
"login"
:
loginForm
(
$conn
);
// moved to /pages
break
;
case
"register"
:
register
(
$conn
,
false
);
// moved to /pages
break
;
case
"addUser"
:
// moved to /pages
addUser
(
$conn
);
break
;
case
"logout"
:
// moved to /pages
logout
(
$conn
);
break
;
case
"profile"
:
// moved to /pages
profile
(
$conn
);
break
;
case
"saveProfile"
:
// moved to /pages
saveProfile
(
$conn
);
break
;
case
"skills"
:
// moved into /pages
skills
(
$conn
);
break
;
case
"addSkill"
:
// moved into /pages
addSkill
(
$conn
);
break
;
case
"saveSkill"
:
// moved into /pages
saveSkill
(
$conn
);
break
;
case
"showTasks"
:
// moved into /pages
showTasks
(
$conn
);
break
;
case
"answer"
:
// moved into /pages
answer
(
$conn
,
$_REQUEST
[
'choice'
]);
break
;
case
"insertAnswer"
:
// moved into /pages
insertJsonAnswer
(
$conn
,
$_POST
[
'id'
],
$_SESSION
[
'activity_id'
],
$_POST
[
'answer'
],
@
$_POST
[
'mass'
]);
break
;
case
"restart"
:
// moved into /pages
restart
(
$conn
);
initialize
(
$conn
);
createBots
(
$conn
,
NBBOTS
);
...
...
@@ -130,80 +116,61 @@ switch ($mode) {
break
;
case
"showState"
:
showState
(
$conn
);
// moved to /pages
break
;
case
"showArtifact"
:
// moved to /lib
showArtifact
(
$conn
,
$_GET
[
'artifactid'
]);
break
;
case
"drawArtifact"
:
// moved to /pages
drawArtifact
(
$conn
,
$_GET
[
'artifactid'
]);
break
;
case
"Home"
:
// moved to pages
showTasks
(
$conn
);
break
;
case
"showCredit"
:
// moved to /pages
// prototype of the future $mode call system with pageList security test
$pageList
=
array
(
"showCredit"
);
if
(
in_array
(
$mode
,
$pageList
))
$mode
();
//showCredit();
break
;
case
"maintenance"
:
// moved to pages
maintenance
();
break
;
case
"submitFeedback"
:
// moved to pages
submitFeedback
(
$conn
,
$_POST
[
'page'
],
$_POST
[
'feedbackText'
]);
break
;
case
"showFeedback"
:
// moved to pages
$pageNo
=
isset
(
$_GET
[
'page'
])
?
$_GET
[
'page'
]
:
1
;
showFeedback
(
$conn
,
$pageNo
);
break
;
case
"insertTaskFeedback"
:
// moved to pages
insertTaskFeedback
(
$conn
,
$_POST
[
'id'
],
$_POST
[
'feedback'
],
$_POST
[
'targetTable'
]);
break
;
case
"showForum"
:
// moved to pages
showForum
(
$_GET
);
break
;
case
"insertPostForum"
:
// moved to pages
insertPostForum
(
$_POST
[
'topicId'
],
$_POST
[
'forumPostTextarea'
]);
break
;
case
"showTopicCreation"
:
// moved to pages
showTopicCreation
(
$_GET
);
break
;
case
"insertNewTopic"
:
// moved to pages
insertNewTopic
(
$_POST
[
'topicTitle'
],
$_POST
[
'topicCategory'
],
$_POST
[
'taskSelect'
],
$_POST
[
'topicTextarea'
]);
break
;
case
"searchForum"
:
// moved to pages
searchForum
(
$_GET
);
break
;
case
"startArtifact"
:
// moved to pages
startArtifact
(
$conn
,
$_GET
[
'artifactid'
],
$_SESSION
[
'id'
]);
showTasks
(
$conn
);
break
;
case
"workflowdesign"
:
// moved to /pages
workflowdesign
(
$conn
);
break
;
case
"addArtifact"
:
// moved to /pages
addArtifact
(
$conn
,
$_POST
[
'artifact'
]);
break
;
case
"showTasksViewer"
:
// moved to /pages
showTasksViewer
();
break
;
default
:
...
...
lib/artifacts.php
View file @
37b37074
...
...
@@ -368,4 +368,34 @@ function addArtifact($conn,$json){
$conn
->
query
(
$query
);
}
/**
* nextTaskFromArtifact
*
* retrieve the next task available for the given artifact and user (i.e. task with the smallest id)
*
* @param $conn: A valid database PDO connection
* @param $user: A user id
* @param $artifact: A valid artifact id
*/
function
nextTaskFromArtifact
(
$conn
,
$user
,
$artifact
){
$stmt
=
$conn
->
prepare
(
"SELECT t.id
FROM Task t, Profile p, Skills s
WHERE s.iduser = :user
AND s.idskill = p.idskill
AND t.id = p.idtask
AND t.artifact = :artifact
ORDER BY t.id asc LIMIT 1"
);
$stmt
->
bindParam
(
':user'
,
$user
,
PDO
::
PARAM_INT
);
$stmt
->
bindParam
(
':artifact'
,
$artifact
,
PDO
::
PARAM_INT
);
$res
=
$stmt
->
execute
();
$nextTaskId
=
$stmt
->
fetchColumn
();
return
$nextTaskId
;
}
// TODO document bots
// TODO document presentation.html
?>
pages/logout/logout.php
View file @
37b37074
...
...
@@ -9,9 +9,6 @@
*/
function
logout
(
$conn
)
{
if
(
$_SESSION
[
'username'
]
==
"anonymous"
)
{
cleanDb
(
$conn
);
}
unset
(
$_SESSION
);
session_destroy
();
// Suppressing automatic connection cookies
...
...
pages/maintenance/maintenance.php
View file @
37b37074
...
...
@@ -4,9 +4,6 @@ function maintenance()
{
global
$VIEW
;
if
(
$_SESSION
[
'username'
]
==
"anonymous"
)
{
cleanDb
(
$conn
);
}
unset
(
$_SESSION
);
session_destroy
();
...
...
pages/showTasks/showTasks.php
View file @
37b37074
...
...
@@ -202,8 +202,6 @@ function showTaskList($conn, $title, $query, $displayThanks = false)
function
answer
(
$conn
,
$id
,
$error
=
false
)
{
global
$VIEW
;
debug
(
"task id
$id
"
);
initializeSession
(
$conn
,
$id
);
// TODO what for ?
$stmt
=
$conn
->
prepare
(
"select * from Task where id=:id and artifact=:artifactid"
);
$stmt
->
bindParam
(
':id'
,
$id
,
PDO
::
PARAM_INT
);
...
...
show-pages.php
View file @
37b37074
...
...
@@ -2,27 +2,6 @@
function
initializeSession
(
$conn
,
$id
)
// David: deprecated ?
{
return
;
$_SESSION
[
'task_active'
]
=
$id
;
$stmt_artifact
=
$conn
->
query
(
"select artifact from Task where id="
.
$_SESSION
[
'task_active'
]);
$_SESSION
[
'artifact_active'
]
=
$stmt_artifact
->
fetch
()[
'artifact'
];
$stmt_artifactclass
=
$conn
->
query
(
"select classid from Artifact where id="
.
$_SESSION
[
'artifact_active'
]);
$_SESSION
[
'artifactclass_active'
]
=
$stmt_artifactclass
->
fetch
()[
'classid'
];
$stmt_project
=
$conn
->
query
(
"select project from ArtifactClass where id="
.
$_SESSION
[
'artifactclass_active'
]);
$_SESSION
[
'project'
]
=
$stmt_project
->
fetch
()[
'project'
];
$stmt_tablename
=
$conn
->
query
(
"select tablename from ArtifactClass where id="
.
$_SESSION
[
'artifactclass_active'
]);
$_SESSION
[
'tablename'
]
=
$stmt_tablename
->
fetch
()[
'tablename'
];
}
/*
* showAwaitingActivities
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment