Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchCourrier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchCourrier
Commits
efe861ee
Verified
Commit
efe861ee
authored
7 years ago
by
Alex ORLUC
Browse files
Options
Downloads
Patches
Plain Diff
FEAT #6912 merge from 17_06_project_develop
parent
caa4cad9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/class/LinkController.php
+174
-199
174 additions, 199 deletions
core/class/LinkController.php
with
174 additions
and
199 deletions
core/class/LinkController.php
+
174
−
199
View file @
efe861ee
<?php
<?php
/*
* Copyright 2008-2015 Maarch
*
* This file is part of Maarch Framework.
*
* Maarch Framework is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Maarch Framework is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>.
*/
/**
/**
* @brief Contains the LinkController Class
* Copyright Maarch since 2008 under licence GPLv3.
* See LICENCE.txt file at the root folder for more details.
* This file is part of Maarch software.
*
*
* @brief LinkController
*
*
* @file
* @author dev <dev@maarch.org>
* @author Arnaud Veber
* @date $date$
* @version $Revision$
* @ingroup core
* @ingroup core
*/
*/
//Loads the require class
//Loads the require class
try
{
require_once
'core/class/class_history.php'
;
require_once
(
'core/class/class_history.php'
);
include
'apps'
.
DIRECTORY_SEPARATOR
.
$_SESSION
[
'config'
][
'app_id'
]
.
DIRECTORY_SEPARATOR
.
'definition_mail_categories.php'
;
}
catch
(
Exception
$e
)
{
functions
::
xecho
(
$e
->
getMessage
())
.
' // '
;
}
class
LinkController
class
LinkController
{
{
...
@@ -43,124 +22,145 @@ class LinkController
...
@@ -43,124 +22,145 @@ class LinkController
public
function
formatMap
(
$arrayToFormat
,
$sens
)
public
function
formatMap
(
$arrayToFormat
,
$sens
)
{
{
$
this
->
level
++
;
$
db
=
new
Database
()
;
$core
=
new
core_tools
();
$core
=
new
core_tools
();
$core
->
test_user
();
$core
->
test_user
();
$return
=
''
;
$return
=
''
;
++
$this
->
level
;
foreach
(
$arrayToFormat
as
$key
=>
$value
)
{
foreach
(
$arrayToFormat
as
$key
=>
$value
)
{
$infos
=
$this
->
getDocInfos
(
$key
,
$_SESSION
[
'current_basket'
][
'coll_id'
]);
//GET RES INFOS
$infos
[
'subject'
]
=
preg_replace
(
"/
\r\n
|
\r
|
\n
/"
,
'<br/>'
,
$infos
[
'subject'
]);
$infos
=
get_general_data
(
$_SESSION
[
'current_basket'
][
'coll_id'
],
$key
,
'full'
);
$stmt
=
$db
->
query
(
'SELECT dest_user, status FROM res_letterbox WHERE res_id = ?'
,
array
(
$key
));
$otherInfos
=
$stmt
->
fetchObject
();
$chronoNumber
=
$this
->
getAltIdentifier
(
$key
);
if
(
!
empty
(
$infos
[
'exp_contact_id'
][
'show_value'
]))
{
$contact
=
$infos
[
'exp_contact_id'
][
'show_value'
];
}
elseif
(
!
empty
(
$infos
[
'dest_contact_id'
][
'show_value'
]))
{
$contact
=
$infos
[
'dest_contact_id'
][
'show_value'
];
}
elseif
(
!
empty
(
$infos
[
'exp_user_id'
][
'show_value'
]))
{
$contact
=
$infos
[
'exp_user_id'
][
'show_value'
];
}
elseif
(
!
empty
(
$infos
[
'dest_user_id'
][
'show_value'
]))
{
$contact
=
$infos
[
'dest_user_id'
][
'show_value'
];
}
else
{
$contact
=
_MULTI_CONTACT
;
}
$infos
[
'subject'
]
=
preg_replace
(
"/
\r\n
|
\r
|
\n
/"
,
'<br/>'
,
$infos
[
'subject'
]);
$return
.
=
'<div id="ged_'
.
$key
.
$sens
.
'" class="linkDiv">'
;
$return
.
=
'<div id="ged_'
.
$key
.
$sens
.
'" class="linkDiv">'
;
$return
.
=
'<table style="width:100%;text-align:left;font-size:15px;cursor:pointer;" title="accéder à la fiche détaillée">'
;
$return
.
=
'<table style="width:100%;text-align:left;font-size:15px;cursor:pointer;" title="'
.
_ACCESS_TO_DETAILS
.
'">'
;
$return
.
=
'<tr>'
;
$return
.
=
'<tr>'
;
$status
=
$this
->
getStatus
(
$infos
[
'status'
]);
$status
=
$this
->
getStatus
(
$otherInfos
->
status
);
$img_class
=
substr
(
$status
[
'img_filename'
],
0
,
2
);
$img_class
=
substr
(
$status
[
'img_filename'
],
0
,
2
);
$return
.
=
'<td style="width:14%;text-align:center;" title="'
.
$status
[
'label_status'
]
.
'" onclick="window.top.location.href=\'index.php?page=details&dir=indexing_searching&id='
.
$key
.
'\'">'
;
$return
.
=
'<td style="width:14%;text-align:center;" title="'
.
$status
[
'label_status'
]
.
'" onclick="window.top.location.href=\'index.php?page=details&dir=indexing_searching&id='
.
$key
.
'\'">'
;
$return
.
=
'<i class="'
.
$img_class
.
' '
.
$status
[
'img_filename'
]
.
' '
.
$img_class
.
'-2x" ></i> '
;
$return
.
=
'<i class="'
.
$img_class
.
' '
.
$status
[
'img_filename'
]
.
' '
.
$img_class
.
'-2x" ></i> '
;
$return
.
=
'</td>'
;
$return
.
=
'</td>'
;
$return
.
=
'<td colspan="2" onclick="window.top.location.href=\'index.php?page=details&dir=indexing_searching&id='
.
$key
.
'\'">'
;
$return
.
=
'<td colspan="2" onclick="window.top.location.href=\'index.php?page=details&dir=indexing_searching&id='
.
$key
.
'\'">'
;
$return
.
=
'<b>'
.
$infos
[
'subject'
]
.
'</b>'
;
$return
.
=
'<b>'
.
$infos
[
'subject'
][
'show_value'
]
.
'</b>'
;
$return
.
=
'</td>'
;
$return
.
=
'</td>'
;
$return
.
=
'</tr>'
;
$return
.
=
'<td colspan="2" onclick="window.top.location.href=\'index.php?page=details&dir=indexing_searching&id='
.
$key
.
'\'">'
;
$return
.
=
'<tr>'
;
$return
.
=
'</td>'
;
$return
.
=
'<td style="width:14%;text-align:center;" onclick="window.top.location.href=\'index.php?page=details&dir=indexing_searching&id='
.
$key
.
'\'">'
;
$return
.
=
'<td colspan="3" style="font-size:12px;" align="right" title="'
.
_CONTACT
.
'" onclick="window.top.location.href=\'index.php?page=details&dir=indexing_searching&id='
.
$key
.
'\'">'
;
$return
.
=
(
_ID_TO_DISPLAY
==
'res_id'
?
$infos
[
'res_id'
]
:
$infos
[
'alt_identifier'
]);
$return
.
=
'<i class="fa fa-user fa-2x" style="font-size:10px;"></i> '
;
$return
.
=
'</td>'
;
$return
.
=
$contact
;
$return
.
=
'<td style="font-size:12px;width:16%;" onclick="window.top.location.href=\'index.php?page=details&dir=indexing_searching&id='
.
$key
.
'\'">'
;
$return
.
=
'</td>'
;
if
(
$_SESSION
[
'current_basket'
][
'coll_id'
]
==
'letterbox_coll'
)
{
$return
.
=
'</tr>'
;
$return
.
=
$_SESSION
[
'coll_categories'
][
'letterbox_coll'
][
$infos
[
'category_id'
]];
$return
.
=
'<tr>'
;
}
elseif
(
$_SESSION
[
'current_basket'
][
'coll_id'
]
==
'business_coll'
)
{
$return
.
=
'<td style="width:14%;text-align:center;" onclick="window.top.location.href=\'index.php?page=details&dir=indexing_searching&id='
.
$key
.
'\'">'
;
$return
.
=
$_SESSION
[
'coll_categories'
][
'business_coll'
][
$infos
[
'category_id'
]];
$return
.
=
(
_ID_TO_DISPLAY
==
'res_id'
?
$key
:
$chronoNumber
);
}
$return
.
=
'</td>'
;
$return
.
=
'</td>'
;
$return
.
=
'<td style="font-size:12px;width:16%;" onclick="window.top.location.href=\'index.php?page=details&dir=indexing_searching&id='
.
$key
.
'\'">'
;
$return
.
=
'<td style="font-size:12px;width:14%" title="'
.
_DOC_DATE
.
'" onclick="window.top.location.href=\'index.php?page=details&dir=indexing_searching&id='
.
$key
.
'\'">'
;
$return
.
=
$infos
[
'category_id'
][
'show_value'
];
$return
.
=
'<i class="fa fa-calendar-o fa-2x" style="font-size:10px;"></i> '
;
$return
.
=
'</td>'
;
$date
=
explode
(
'-'
,
substr
(
$infos
[
'doc_date'
],
0
,
10
));
$return
.
=
'<td style="font-size:12px;width:14%" title="'
.
_DOC_DATE
.
'" onclick="window.top.location.href=\'index.php?page=details&dir=indexing_searching&id='
.
$key
.
'\'">'
;
$return
.
=
$date
[
2
]
.
' '
.
$date
[
1
]
.
' '
.
$date
[
0
];
$return
.
=
'<i class="fa fa-calendar-o fa-2x" style="font-size:10px;"></i> '
;
$return
.
=
'</td>'
;
$date
=
explode
(
'-'
,
substr
(
$infos
[
'doc_date'
][
'show_value'
],
0
,
10
));
$return
.
=
'<td style="font-size:12px;width:14%" title="'
.
_DEST_USER
.
'" onclick="window.top.location.href=\'index.php?page=details&dir=indexing_searching&id='
.
$key
.
'\'">'
;
$return
.
=
$date
[
2
]
.
' '
.
$date
[
1
]
.
' '
.
$date
[
0
];
$return
.
=
'<i class="fa fa-user fa-2x" style="font-size:10px;"></i> '
;
$return
.
=
'</td>'
;
$return
.
=
$infos
[
'dest_user'
];
$return
.
=
'<td style="font-size:12px;width:14%" title="'
.
_DEST_USER
.
'" onclick="window.top.location.href=\'index.php?page=details&dir=indexing_searching&id='
.
$key
.
'\'">'
;
$return
.
=
'</td>'
;
$return
.
=
'<i class="fa fa-share-alt fa-2x" style="font-size:10px;"></i> '
;
$return
.
=
'<td style="font-size:12px;width:24%" title="'
.
_DESTINATION
.
'" onclick="window.top.location.href=\'index.php?page=details&dir=indexing_searching&id='
.
$key
.
'\'">'
;
$return
.
=
$otherInfos
->
dest_user
;
$return
.
=
'<i class="fa fa-sitemap fa-2x" style="font-size:10px;"></i> '
;
$return
.
=
'</td>'
;
$return
.
=
$infos
[
'entity_label'
];
$return
.
=
'<td style="font-size:12px;width:24%" title="'
.
_DEPARTMENT_DEST
.
'" onclick="window.top.location.href=\'index.php?page=details&dir=indexing_searching&id='
.
$key
.
'\'">'
;
$return
.
=
'</td>'
;
$return
.
=
'<i class="fa fa-sitemap fa-2x" style="font-size:10px;"></i> '
;
if
(
$core
->
is_module_loaded
(
'visa'
))
{
$return
.
=
$infos
[
'destination'
][
'show_value'
];
require_once
"modules"
.
DIRECTORY_SEPARATOR
.
"visa"
.
DIRECTORY_SEPARATOR
$return
.
=
'</td>'
;
.
"class"
.
DIRECTORY_SEPARATOR
if
(
$core
->
is_module_loaded
(
'visa'
))
{
.
"class_modules_tools.php"
;
require_once
'modules'
.
DIRECTORY_SEPARATOR
.
'visa'
.
DIRECTORY_SEPARATOR
$return
.
=
'<td style="font-size:12px;width:16%" title="'
.
_VISA_USERS
.
'">'
;
.
'class'
.
DIRECTORY_SEPARATOR
.
'class_modules_tools.php'
;
$visa
=
new
visa
();
$return
.
=
'<td style="font-size:12px;width:16%" title="'
.
_VISA_USERS
.
'">'
;
$users_visa_list
=
$visa
->
getUsersCurrentVis
(
$infos
[
'res_id'
]);
$visa
=
new
visa
();
if
(
!
empty
(
$users_visa_list
)){
$users_visa_list
=
implode
(
', '
,
$users_visa_list
);
$users_visa_list
=
$visa
->
getUsersCurrentVis
(
$key
);
$return
.
=
'<i class="fa fa-certificate fa-2x" style="font-size:10px;"></i> '
;
if
(
!
empty
(
$users_visa_list
))
{
$return
.
=
$users_visa_list
;
$users_visa_list
=
implode
(
', '
,
$users_visa_list
);
}
$return
.
=
'<i class="fa fa-list-ol fa-2x" style="font-size:10px;"></i> '
;
$return
.
=
'</td>'
;
$return
.
=
$users_visa_list
;
}
}
$return
.
=
'</td>'
;
if
(
$core
->
test_service
(
'add_links'
,
'apps'
,
false
)
&&
$this
->
level
<=
1
)
{
}
if
(
$sens
==
'asc'
)
{
$delParent
=
$key
;
if
(
$core
->
test_service
(
'add_links'
,
'apps'
,
false
)
&&
$this
->
level
<=
1
)
{
$delChild
=
$_SESSION
[
'doc_id'
];
if
(
$sens
==
'asc'
)
{
}
else
{
$delParent
=
$key
;
$delParent
=
$_SESSION
[
'doc_id'
];
$delChild
=
$_SESSION
[
'doc_id'
];
$delChild
=
$key
;
}
else
{
}
$delParent
=
$_SESSION
[
'doc_id'
];
$return
.
=
'<td align="right">'
;
$delChild
=
$key
;
if
(
$core
->
is_module_loaded
(
'thumbnails'
)
===
true
){
require_once
"modules"
.
DIRECTORY_SEPARATOR
.
"thumbnails"
.
DIRECTORY_SEPARATOR
.
"class"
.
DIRECTORY_SEPARATOR
.
"class_modules_tools.php"
;
$tnl
=
new
thumbnails
();
$path
=
$tnl
->
getPathTnl
(
$key
,
'letterbox_coll'
);
if
(
is_file
(
$path
))
{
$return
.
=
'<div align="center" class="iconDoc"><a href="index.php?display=true&dir=indexing_searching&page=view_resource_controler&id='
.
$infos
[
'res_id'
]
.
'" target="_blank" title="'
.
_VIEW_DOC
.
'"><i class="fa fa-download fa-2x" title="'
.
_VIEW_DOC
.
'"></i><span><img src="index.php?page=doc_thumb&module=thumbnails&res_id='
.
$key
.
'&coll_id=letterbox_coll&display=true"></span></a></div>'
;
}
else
{
$return
.
=
'<div align="center" class="iconDoc"><a href="index.php?display=true&dir=indexing_searching&page=view_resource_controler&id='
.
$infos
[
'res_id'
]
.
'" target="_blank" title="'
.
_VIEW_DOC
.
'"><i class="fa fa-download fa-2x" title="'
.
_VIEW_DOC
.
'"></i><span id="no_doc"></span></a></div>'
;
}
}
$return
.
=
'</td>'
;
$return
.
=
'<td align="right">'
;
$return
.
=
'<span onclick="'
;
$return
.
=
'if(confirm(\'Voulez-vous supprimer la liaison ?\')){'
;
$return
.
=
'addLinks('
;
$return
.
=
'\''
.
$_SESSION
[
'config'
][
'businessappurl'
]
.
'index.php?page=add_links&display=true\', '
;
$return
.
=
'\''
.
$delChild
.
'\' ,'
;
$return
.
=
'\''
.
$delParent
.
'\' ,'
;
$return
.
=
'\'del\','
;
if
(
$_SESSION
[
'current_basket'
][
'coll_id'
]
==
'letterbox_coll'
)
{
$return
.
=
'\'res_view_letterbox\''
;
}
elseif
(
$_SESSION
[
'current_basket'
][
'coll_id'
]
==
'business_coll'
)
{
$return
.
=
'\'res_view_business\''
;
}
else
{
$return
.
=
'\'\''
;
}
$return
.
=
');}'
;
$return
.
=
'">'
;
$return
.
=
'<i class="fa fa-unlink fa-2x" title="supprimer la liaison" style="cursor:pointer;"></i>'
;
$return
.
=
'</span>'
;
$return
.
=
'</td>'
;
}
$return
.
=
'</tr>'
;
$return
.
=
'</table>'
;
if
(
is_array
(
$value
))
{
$return
.
=
$this
->
formatMap
(
$value
,
$sens
);
}
}
$return
.
=
'<td align="right">'
;
if
(
$core
->
is_module_loaded
(
'thumbnails'
)
===
true
)
{
require_once
'modules'
.
DIRECTORY_SEPARATOR
.
'thumbnails'
.
DIRECTORY_SEPARATOR
.
'class'
.
DIRECTORY_SEPARATOR
.
'class_modules_tools.php'
;
$tnl
=
new
thumbnails
();
$path
=
$tnl
->
getPathTnl
(
$key
,
'letterbox_coll'
);
if
(
is_file
(
$path
))
{
$return
.
=
'<div align="center" class="iconDoc"><a href="index.php?display=true&dir=indexing_searching&page=view_resource_controler&id='
.
$infos
[
'res_id'
]
.
'" target="_blank" title="'
.
_VIEW_DOC
.
'"><i class="fa fa-download fa-2x" title="'
.
_VIEW_DOC
.
'"></i><span><img src="index.php?page=doc_thumb&module=thumbnails&res_id='
.
$key
.
'&coll_id=letterbox_coll&display=true"></span></a></div>'
;
}
else
{
$return
.
=
'<div align="center" class="iconDoc"><a href="index.php?display=true&dir=indexing_searching&page=view_resource_controler&id='
.
$infos
[
'res_id'
]
.
'" target="_blank" title="'
.
_VIEW_DOC
.
'"><i class="fa fa-download fa-2x" title="'
.
_VIEW_DOC
.
'"></i><span id="no_doc"></span></a></div>'
;
}
}
$return
.
=
'</td>'
;
$return
.
=
'<td align="right">'
;
$return
.
=
'<span onclick="'
;
$return
.
=
'if(confirm(\'Voulez-vous supprimer la liaison ?\')){'
;
$return
.
=
'addLinks('
;
$return
.
=
'\''
.
$_SESSION
[
'config'
][
'businessappurl'
]
.
'index.php?page=add_links&display=true\', '
;
$return
.
=
'\''
.
$delChild
.
'\' ,'
;
$return
.
=
'\''
.
$delParent
.
'\' ,'
;
$return
.
=
'\'del\','
;
if
(
$_SESSION
[
'current_basket'
][
'coll_id'
]
==
'letterbox_coll'
)
{
$return
.
=
'\'res_view_letterbox\''
;
}
elseif
(
$_SESSION
[
'current_basket'
][
'coll_id'
]
==
'business_coll'
)
{
$return
.
=
'\'res_view_business\''
;
}
else
{
$return
.
=
'\'\''
;
}
$return
.
=
');}'
;
$return
.
=
'">'
;
$return
.
=
'<i class="fa fa-unlink fa-2x" title="'
.
_DEL_LINK
.
'" style="cursor:pointer;"></i>'
;
$return
.
=
'</span>'
;
$return
.
=
'</td>'
;
}
$return
.
=
'</tr>'
;
$return
.
=
'</table>'
;
if
(
is_array
(
$value
))
{
$return
.
=
$this
->
formatMap
(
$value
,
$sens
);
}
$return
.
=
'</div>'
;
$return
.
=
'</div>'
;
}
}
$this
->
level
--
;
--
$this
->
level
;
return
$return
;
return
$return
;
}
}
...
@@ -174,10 +174,10 @@ class LinkController
...
@@ -174,10 +174,10 @@ class LinkController
}
}
$linksArray
=
explode
(
'||'
,
$links
);
$linksArray
=
explode
(
'||'
,
$links
);
for
(
$i
=
0
;
$i
<
count
(
$linksArray
);
$i
++
)
{
for
(
$i
=
0
;
$i
<
count
(
$linksArray
);
++
$i
)
{
if
(
$linksArray
[
$i
]
!=
''
)
{
if
(
$linksArray
[
$i
]
!=
''
)
{
if
(
!
preg_match
(
"/"
.
' '
.
$linksArray
[
$i
]
.
' '
.
"/"
,
$this
->
previousId
))
{
if
(
!
preg_match
(
'/'
.
' '
.
$linksArray
[
$i
]
.
' '
.
'/'
,
$this
->
previousId
))
{
$this
->
previousId
.
=
$parentId
.
' '
;
$this
->
previousId
.
=
$parentId
.
' '
;
$return
[
$linksArray
[
$i
]]
=
$this
->
getMap
(
$linksArray
[
$i
],
$collection
,
$sens
);
$return
[
$linksArray
[
$i
]]
=
$this
->
getMap
(
$linksArray
[
$i
],
$collection
,
$sens
);
}
}
}
else
{
}
else
{
...
@@ -185,20 +185,22 @@ class LinkController
...
@@ -185,20 +185,22 @@ class LinkController
}
}
}
}
}
}
return
$return
;
return
$return
;
}
}
private
function
getLinksDesc
(
$parentId
,
$collection
)
private
function
getLinksDesc
(
$parentId
,
$collection
)
{
{
$db
=
new
Database
;
$db
=
new
Database
();
$query
=
"SELECT res_child FROM res_linked WHERE coll_id=? AND res_parent=?"
;
$query
=
'SELECT res_child FROM res_linked WHERE coll_id=? AND res_parent=?'
;
$stmt
=
$db
->
query
(
$query
,
array
(
$collection
,
$parentId
));
$stmt
=
$db
->
query
(
$query
,
array
(
$collection
,
$parentId
));
if
(
$stmt
)
{
if
(
$stmt
)
{
$i
=
0
;
$i
=
0
;
$links
=
''
;
$links
=
''
;
while
(
$row
=
$stmt
->
fetchObject
())
{
while
(
$row
=
$stmt
->
fetchObject
())
{
$links
.
=
$row
->
res_child
.
'||'
;
$links
.
=
$row
->
res_child
.
'||'
;
$i
++
;
++
$i
;
}
}
if
(
$i
>
0
)
{
if
(
$i
>
0
)
{
$return
=
substr
(
$links
,
0
,
-
2
);
$return
=
substr
(
$links
,
0
,
-
2
);
...
@@ -212,15 +214,16 @@ class LinkController
...
@@ -212,15 +214,16 @@ class LinkController
private
function
getLinksAsc
(
$parentId
,
$collection
)
private
function
getLinksAsc
(
$parentId
,
$collection
)
{
{
$db
=
new
Database
;
$db
=
new
Database
();
$query
=
"SELECT res_parent FROM res_linked WHERE coll_id=? AND res_child=?"
;
$query
=
'SELECT res_parent FROM res_linked WHERE coll_id=? AND res_child=?'
;
$stmt
=
$db
->
query
(
$query
,
array
(
$collection
,
$parentId
));
$stmt
=
$db
->
query
(
$query
,
array
(
$collection
,
$parentId
));
if
(
$stmt
)
{
if
(
$stmt
)
{
$i
=
0
;
$i
=
0
;
$links
=
''
;
$links
=
''
;
while
(
$row
=
$stmt
->
fetchObject
())
{
while
(
$row
=
$stmt
->
fetchObject
())
{
$links
.
=
$row
->
res_parent
.
'||'
;
$links
.
=
$row
->
res_parent
.
'||'
;
$i
++
;
++
$i
;
}
}
if
(
$i
>
0
)
{
if
(
$i
>
0
)
{
$return
=
substr
(
$links
,
0
,
-
2
);
$return
=
substr
(
$links
,
0
,
-
2
);
...
@@ -232,44 +235,17 @@ class LinkController
...
@@ -232,44 +235,17 @@ class LinkController
return
$return
;
return
$return
;
}
}
private
function
getDocInfos
(
$id
,
$collection
)
{
if
(
$collection
==
'letterbox_coll'
)
{
$view
=
'res_view_letterbox'
;
}
elseif
(
$collection
==
'business_coll'
)
{
$view
=
'res_view_business'
;
}
else
{
$view
=
''
;
}
if
(
$view
<>
''
)
{
$db
=
new
Database
;
$query
=
"SELECT * FROM "
.
$view
.
" WHERE res_id = ?"
;
$stmt
=
$db
->
query
(
$query
,
array
(
$id
));
if
(
$stmt
)
{
$i
=
0
;
while
(
$row
=
$stmt
->
fetch
(
PDO
::
FETCH_ASSOC
))
{
$return
=
$row
;
$i
++
;
}
}
}
else
{
$return
=
false
;
}
return
$return
;
}
public
function
getStatus
(
$status
)
public
function
getStatus
(
$status
)
{
{
//$return->label_status = 'BAD';
//$return->img_filename = '';
$db
=
new
Database
();
$db
=
new
Database
();
$query
=
"SELECT label_status, img_filename FROM status WHERE id = ?"
;
$stmt
=
$db
->
query
(
$query
,
array
(
$status
));
$query
=
'SELECT label_status, img_filename FROM status WHERE id = ?'
;
$stmt
=
$db
->
query
(
$query
,
array
(
$status
));
if
(
$stmt
)
{
if
(
$stmt
)
{
$i
=
0
;
$i
=
0
;
while
(
$row
=
$stmt
->
fetch
(
PDO
::
FETCH_ASSOC
))
{
while
(
$row
=
$stmt
->
fetch
(
PDO
::
FETCH_ASSOC
))
{
$return
=
$row
;
$return
=
$row
;
$i
++
;
++
$i
;
}
}
}
}
...
@@ -278,23 +254,24 @@ class LinkController
...
@@ -278,23 +254,24 @@ class LinkController
public
function
nbDirectLink
(
$id
,
$collection
,
$sens
)
public
function
nbDirectLink
(
$id
,
$collection
,
$sens
)
{
{
$i
=
0
;
$db
=
new
Database
();
$db
=
new
Database
();
$i
=
0
;
if
(
$sens
==
'desc'
||
$sens
==
'all'
)
{
if
(
$sens
==
'desc'
||
$sens
==
'all'
)
{
$query
=
"
SELECT res_child FROM res_linked WHERE coll_id=? AND res_parent=?
"
;
$query
=
'
SELECT res_child FROM res_linked WHERE coll_id=? AND res_parent=?
'
;
$stmt
=
$db
->
query
(
$query
,
array
(
$collection
,
$id
));
$stmt
=
$db
->
query
(
$query
,
array
(
$collection
,
$id
));
if
(
$stmt
)
{
if
(
$stmt
)
{
while
(
$row
=
$stmt
->
fetch
(
PDO
::
FETCH_ASSOC
))
{
while
(
$row
=
$stmt
->
fetch
(
PDO
::
FETCH_ASSOC
))
{
$i
++
;
++
$i
;
}
}
}
}
}
}
if
(
$sens
==
'asc'
||
$sens
==
'all'
)
{
if
(
$sens
==
'asc'
||
$sens
==
'all'
)
{
$query
=
"
SELECT res_parent FROM res_linked WHERE coll_id=? AND res_child=?
"
;
$query
=
'
SELECT res_parent FROM res_linked WHERE coll_id=? AND res_child=?
'
;
$stmt
=
$db
->
query
(
$query
,
array
(
$collection
,
$id
));
$stmt
=
$db
->
query
(
$query
,
array
(
$collection
,
$id
));
if
(
$stmt
)
{
if
(
$stmt
)
{
while
(
$row
=
$stmt
->
fetch
(
PDO
::
FETCH_ASSOC
))
{
while
(
$row
=
$stmt
->
fetch
(
PDO
::
FETCH_ASSOC
))
{
$i
++
;
++
$i
;
}
}
}
}
}
}
...
@@ -304,26 +281,24 @@ class LinkController
...
@@ -304,26 +281,24 @@ class LinkController
public
function
getAltIdentifier
(
$resId
)
public
function
getAltIdentifier
(
$resId
)
{
{
$db
=
new
Database
();
$db
=
new
Database
;
$altIdentifierRequest
=
'SELECT alt_identifier FROM mlb_coll_ext where res_id = ?'
;
$altIdentifierRequest
=
"SELECT alt_identifier FROM mlb_coll_ext where res_id = ?"
;
$stmt
=
$db
->
query
(
$altIdentifierRequest
,
array
(
$resId
));
$stmt
=
$db
->
query
(
$altIdentifierRequest
,
array
(
$resId
));
while
(
$altIdentifierResult
=
$stmt
->
fetchObject
())
{
while
(
$altIdentifierResult
=
$stmt
->
fetchObject
())
{
$altIdentifier
=
$altIdentifierResult
->
alt_identifier
;
$altIdentifier
=
$altIdentifierResult
->
alt_identifier
;
}
}
return
$altIdentifier
;
return
$altIdentifier
;
}
}
public
function
getAltIdentifierConcatened
(
$array
)
public
function
getAltIdentifierConcatened
(
$array
)
{
{
$_SESSION
[
'chronoNumber'
]
=
''
;
$_SESSION
[
'chronoNumber'
]
=
''
;
for
(
$j
=
0
;
$j
<
count
(
$array
);
$j
++
){
for
(
$j
=
0
;
$j
<
count
(
$array
);
++
$j
)
{
$_SESSION
[
'chronoNumber'
]
.
=
$this
->
getAltIdentifier
(
$array
[
$j
])
.
', '
;
$_SESSION
[
'chronoNumber'
]
.
=
$this
->
getAltIdentifier
(
$array
[
$j
])
.
', '
;
}
}
return
substr
(
$_SESSION
[
'chronoNumber'
],
0
,
-
2
);
return
substr
(
$_SESSION
[
'chronoNumber'
],
0
,
-
2
);
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment