57 function __construct($uploadTreeTableName)
60 $this->dataTablesUtility = $container->get(
'utils.data_tables_utility');
61 $this->uploadDao = $container->get(
'dao.upload');
62 $this->
dbManager = $container->get(
'db.manager');
63 $this->copyrightDao = $container->get(
'dao.copyright');
77 public function doGetData($type, $upload, $activated =
true)
83 list ($aaData, $iTotalRecords, $iTotalDisplayRecords) = $this->
getTableData(
84 $upload, $item, $type, $listPage, $filter, $activated);
85 return new JsonResponse(
87 'sEcho' => intval($_GET[
'sEcho']),
89 'iTotalRecords' => $iTotalRecords,
90 'iTotalDisplayRecords' => $iTotalDisplayRecords
105 private function getTableData($upload, $item, $type, $listPage, $filter,
108 list ($rows, $iTotalDisplayRecords, $iTotalRecords) = $this->
getTextFindings(
111 if (! empty($rows)) {
113 foreach ($rows as $row) {
114 $aaData[] = $this->
fillTableRow($row, $upload, $item, $type, $listPage,
122 $iTotalDisplayRecords
137 $uploadTreeTableName, $filter, $activated =
true)
145 list ($left, $right) = $this->uploadDao->getLeftAndRight($item,
146 $uploadTreeTableName);
153 if (
'uploadtree_a' == $uploadTreeTableName) {
154 $sql_upload =
" AND UT.upload_fk = $upload_pk ";
159 if ($filter ==
"nolic") {
160 $noLicStr =
"No_license_found";
161 $voidLicStr =
"Void";
162 $join =
" INNER JOIN license_file AS LF on cp.pfile_fk = LF.pfile_fk ";
163 $filterQuery =
" AND LF.rf_fk IN (" .
"SELECT rf_pk FROM license_ref " .
164 "WHERE rf_shortname IN ('$noLicStr','$voidLicStr')) ";
172 $filterParms = $params;
174 $unorderedQuery =
"FROM $tableName AS cp " .
175 "INNER JOIN $uploadTreeTableName AS UT ON cp.pfile_fk = UT.pfile_fk " .
176 $join .
"WHERE cp.textfinding != '' " .
177 "AND ( UT.lft BETWEEN $1 AND $2 ) " .
"AND cp.is_enabled = " .
178 ($activated ?
'true' :
'false') . $sql_upload;
179 $totalFilter = $filterQuery .
" " . $searchFilter;
181 $grouping =
" GROUP BY hash ";
183 $countQuery =
"SELECT count(*) FROM (SELECT hash $unorderedQuery $totalFilter $grouping) as K";
184 $iTotalDisplayRecordsRow = $this->
dbManager->getSingleRow($countQuery,
186 __METHOD__ . $tableName .
".count" . ($activated ?
'' :
'_deactivated'));
187 $iTotalDisplayRecords = $iTotalDisplayRecordsRow[
'count'];
189 $countAllQuery =
"SELECT count(*) FROM (SELECT hash $unorderedQuery$grouping) as K";
190 $iTotalRecordsRow = $this->
dbManager->getSingleRow($countAllQuery, $params,
191 __METHOD__, $tableName .
"count.all" . ($activated ?
'' :
'_deactivated'));
192 $iTotalRecords = $iTotalRecordsRow[
'count'];
195 $filterParms[] = $offset;
196 $range .=
' OFFSET $' . count($filterParms);
197 $filterParms[] = $limit;
198 $range .=
' LIMIT $' . count($filterParms);
200 $sql =
"SELECT textfinding, hash, count(*) as textfinding_count " .
201 $unorderedQuery . $totalFilter .
202 " GROUP BY textfinding, hash " . $orderString .
204 $statement = __METHOD__ . $filter . $tableName . $uploadTreeTableName .
205 ($activated ?
'' :
'_deactivated');
206 $this->
dbManager->prepare($statement, $sql);
207 $result = $this->
dbManager->execute($statement, $filterParms);
208 $rows = $this->
dbManager->fetchAll($result);
213 $iTotalDisplayRecords,
224 $columnNamesInDatabase = array(
231 return $this->dataTablesUtility->getSortingString($_GET,
232 $columnNamesInDatabase, $defaultOrder);
243 if (empty($searchPattern)) {
246 $filterParams[] =
"%$searchPattern%";
247 return ' AND CP.content ilike $' . count($filterParams) .
' ';
266 $act .=
" hidden='true'";
268 $act .=
" id='deleteHashDecision$ajaxType$hash' " .
269 "onClick='event.preventDefault();deleteHashDecision(\"$hash\",$upload,\"" .
270 $ajaxType .
"\");' class=\"delete\" src=\"images/space_16.png\">";
273 $act .=
" hidden='true'";
275 $act .=
" id='undoDeleteHashDecision$ajaxType$hash'> " .
276 "deactivated [<a href=\"#\" class='undo$type' " .
277 "onClick='event.preventDefault();undoHashDecision(\"$hash\",$upload,\"" .
278 $ajaxType .
"\");return false;'>Undo</a>]</span>";
282 return "deactivated";
299 $activated =
true, $rw =
true)
301 $hash = $row[
'hash'];
302 $sql =
"SELECT pfile_fk FROM " . $this->
getTableName($type) .
304 $statement = __METHOD__ .
".getPfiles";
305 $decisions = $this->
dbManager->getRows($sql, [$hash], $statement);
307 foreach ($decisions as $decision) {
308 $pfileIds[] = $decision[
'pfile_fk'];
316 $link .=
"?mod=$listPage&agent=-1&item=$item" .
317 "&hash=$hash&type=$type&filter=all";
318 $link .=
"'>". intval($row[
'textfinding_count']) .
"</a>";
319 $output[
'0'] = $link;
323 if ($rw && $activated) {
324 $output[
'3'] =
"<input type='checkbox' class='deleteBySelect$type' " .
325 "id='deleteBySelectfinding$hash' value='$hash,$upload," .
344 $tableName =
"copyright_decision";
347 $tableName =
"copyright_decision";
363 $typeName =
"copyright";
366 $typeName =
"copyright";
382 $viewName =
"copyright-list";
385 $viewName =
"copyright-list";
Traceback_uri()
Get the URI without query to this location.
getTableName($type)
Get table name based on decision type.
Namespace for Copyright agent's UI components.
getOrderString()
Create sorting string for database query.
fillTableRow($row, $upload, $item, $type, $listPage, $activated=true, $rw=true)
Fill table content for JSON response.
getTableData($upload, $item, $type, $listPage, $filter, $activated=true)
Get the text finding data and fill in expected format.
addSearchFilter(&$filterParams)
Add filter on content.
Handles Ajax requests for text findings.
doGetData($type, $upload, $activated=true)
Handles GET request and create a JSON response.
GetParm($parameterName, $parameterType)
This function will retrieve the variables and check data types.
getTextFindings($upload_pk, $item, $type, $uploadTreeTableName, $filter, $activated=true)
Get results from database and format for JSON.
char * uploadtree_tablename
upload.uploadtree_tablename
fo_dbManager * dbManager
fo_dbManager object
getTableRowAction($hash, $upload, $type, $activated=true, $rw=true)
Helper to create action column for results.
static getGroupId()
Get the current user's group id.
getViewName($type)
Get name of view for links.
if(!defined('ENT_SUBSTITUTE')) convertToUTF8($content, $toHTML=true)
returnSortOrder()
Get sorting orders.
getDecisionTypeName($type)
Get type name for ajax calls based.