0)) { // Assign / do tasks loadIncludeOnce("inc/modules/admin/overview-inc.php"); if (empty($dmy)) $dmy = ''; outputSeletectedTasks(postRequestArray(), $dmy); } else { // Start listing tasks matching selected filter $result_tasks = SQL_QUERY('SELECT `id`, `assigned_admin`, `userid`, `task_type`, `subject`, `text`, `task_created` FROM `{?_MYSQL_PREFIX?}_task_system` WHERE '.$whereStatement.' ORDER BY `userid` DESC, `task_type` DESC, `subject` ASC, `task_created` DESC', __FILE__, __LINE__); if ((countPostSelection() > 0) && (!isDemoModeActive())) { // Only unassign / delete tasks when there are selected tasks posted if (isPostRequestElementSet('unassign')) { // Unassign from tasks foreach (postRequestElement('task') as $id => $sel) { SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_task_system` SET `assigned_admin`=0 WHERE `id`=%s AND `assigned_admin`=%s LIMIT 1", array(bigintval($id), getCurrentAdminId()), __FILE__, __LINE__); } } elseif (isPostRequestElementSet('del')) { // Delete tasks foreach (postRequestElement('task') as $id => $sel) { if (getRequestElement('type') == 'deleted') { // Delete task immediately SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `id`=%s LIMIT 1", array(bigintval($id)),__FILE__, __LINE__); } else { // Mark task as to be deleted (purged by autopurge extension) adminDeleteTask($id); } } } else { // Unknown action performed debug_report_bug(sprintf("Unknown task action performed. data=
%s
", print_r(postRequestArray(), true))); } // Update query $result_tasks = SQL_QUERY('SELECT `id`, `assigned_admin`, `userid`, `task_type`, `subject`, `text`, `task_created` FROM `{?_MYSQL_PREFIX?}_task_system` WHERE '.$whereStatement.' ORDER BY `subject` ASC, `task_created` DESC', __FILE__, __LINE__); } // There are uncompleted jobs! $type = getMessage('ADMIN_OVERVIEW_TASK_'.strtoupper(getRequestElement('type')).'_TYPE'); // @TODO Rewrite these templates to one and add $OUT loadTemplate('admin_overview_header_task', false, array( 'message' => $type, 'type' => getRequestElement('type') )); $OUT = ''; $SW = 2; while ($content = SQL_FETCHARRAY($result_tasks)) { // Init infos $content['infos'] = '---'; // Generate link $content['assigned_admin'] = generateAdminLink($content['assigned_admin']); // Get admin task $content['task_type_msg'] = getMessage('ADMIN_TASK_IS_'.strtoupper($content['task_type']).''); // Generate infos switch ($content['task_type']) { case 'EXTENSION': case 'EXTENSION_UPDATE': $content['infos'] = substr($content['subject'], 1, strpos($content['subject'], ':') - 1); break; } // END - switch // Member assigned with task? if ($content['userid'] > 0) { // Member found otherwise it's a system task $content['userid'] = generateUserProfileLink($content['userid']); } else { // Is a system task! $content['userid'] = '{--ADMIN_IS_SYSTEM_TASK--}'; } // Prepare content // @TODO Rewritings: admin->assigned_admin,userid->userid,type->task_type_msg in template $content = merge_array($content, array( 'sw' => $SW, 'admin' => $content['assigned_admin'], 'userid' => $content['userid'], 'type' => $content['task_type_msg'], 'created' => generateDateTime($content['task_created'], 2) )); // Do we have an extension task? if (($content['task_type'] == 'EXTENSION') && (isExtensionNameValid($content['infos'])) && (!isExtensionInstalled($content['infos']))) { // Load extension row template // @TODO Rewrite this to $OUT .= ..., true, ... loadTemplate('admin_list_task_ext_rows', false, $content); } else { // Load default row template // @TODO Rewrite this to $OUT .= ..., true, ... loadTemplate('admin_list_task_rows', false, $content); } // Switch colors $SW = 3 - $SW; } // Free memory SQL_FREERESULT($result_tasks); // Load footer template if (getRequestElement('type') == 'deleted') { // Delete now button loadTemplate('admin_overview_footer_task'); } else { // Normal footer loadTemplate('admin_overview_footer'); } } } // [EOF] ?>