| 426 |
$types_in = "'". implode("', '", casetracker_services_case_types()) ."'"; |
$types_in = "'". implode("', '", casetracker_services_case_types()) ."'"; |
| 427 |
|
|
| 428 |
// Restrict returned cases to those opened by the project author? |
// Restrict returned cases to those opened by the project author? |
| 429 |
if (variable_get('casetracker_services_only_authored', false)) { |
$key_exclusions = variable_get('casetracker_services_no_restrict_keys', array()); |
| 430 |
$authors_in = casetracker_services_where_projects_authors_in(); |
$only_authored = (variable_get('casetracker_services_only_authored', false)); |
| 431 |
} |
|
| 432 |
else { |
// Start narrow |
| 433 |
$authors_in = false; |
$authors_in = casetracker_services_where_projects_authors_in(); |
| 434 |
|
if (!$only_authored || in_array(casetracker_services_get_key(), $key_exclusions)) { |
| 435 |
|
$authors_in = false; // Don't restrict |
| 436 |
} |
} |
| 437 |
|
|
| 438 |
// Would be nice to be able to get the result set from casetracker_cases_overview(), |
// Would be nice to be able to get the result set from casetracker_cases_overview(), |
| 439 |
// instead we completely ignore that monster and just use some similar SQL. |
// instead we completely ignore that monster and just use some similar SQL. |
| 440 |
$query = " |
$query = " |
| 457 |
ORDER BY ncs.last_comment_timestamp DESC |
ORDER BY ncs.last_comment_timestamp DESC |
| 458 |
"; |
"; |
| 459 |
|
|
| 460 |
|
// watchdog('ct', casetracker_services_get_key() .' '.$query); |
| 461 |
|
|
| 462 |
$result = pager_query($query, 100, 0); |
$result = pager_query($query, 100, 0); |
| 463 |
|
$rows = array(); |
| 464 |
while ($row = db_fetch_array($result)) { |
while ($row = db_fetch_array($result)) { |
| 465 |
$rows[] = $row; |
$rows[] = $row; |
| 466 |
} |
} |
| 490 |
function casetracker_services_where_projects_authors_in() { |
function casetracker_services_where_projects_authors_in() { |
| 491 |
$projects_in = casetracker_services_where_projects_in(); |
$projects_in = casetracker_services_where_projects_in(); |
| 492 |
$results = db_query('SELECT DISTINCT uid FROM {node} WHERE nid IN ('. $projects_in .')'); |
$results = db_query('SELECT DISTINCT uid FROM {node} WHERE nid IN ('. $projects_in .')'); |
| 493 |
|
$authors = array(); |
| 494 |
while ($row = db_fetch_array($results)) { |
while ($row = db_fetch_array($results)) { |
| 495 |
$authors[] = $row['uid']; |
$authors[] = $row['uid']; |
| 496 |
} |
} |