X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-list_task.php;h=c8c6b831aefefec154c2e0c05fb4d425915772e4;hb=c5173c4d66be7ec72fbf8051a2097cbb377e87a0;hp=d51f0d6ab6b7123d3efd2d827adf407539729408;hpb=fe8e4c180ec67e320be98e1e8dc1f9ea612c3636;p=mailer.git diff --git a/inc/modules/admin/what-list_task.php b/inc/modules/admin/what-list_task.php index d51f0d6ab6..c8c6b831ae 100644 --- a/inc/modules/admin/what-list_task.php +++ b/inc/modules/admin/what-list_task.php @@ -14,10 +14,9 @@ * $Date:: $ * * $Tag:: 0.2.1-FINAL $ * * $Author:: $ * - * Needs to be in all Files and every File needs "svn propset * - * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * + * Copyright (c) 2009, 2010 by Mailer Developer Team * * For more information visit: http://www.mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -42,7 +41,7 @@ if ((!defined('__SECURITY')) || (!isAdmin())) { } // END - if // Add description as navigation point -addMenuDescription('admin', __FILE__); +addYouAreHereLink('admin', __FILE__); if (!isExtensionActive('task')) { loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('task')); @@ -50,11 +49,11 @@ if (!isExtensionActive('task')) { } // END - if $whereStatement = ''; -if (!isGetRequestElementSet(('type'))) setRequestGetElement('type', 'your'); +if (!isGetRequestParameterSet('type')) setGetRequestParameter('type', 'your'); -switch (getRequestElement('type')) { +switch (getRequestParameter('type')) { case 'your': // List only your own open (new) tasks - $whereStatement = "`assigned_admin`='".getCurrentAdminId()."' AND `status`='NEW' AND `task_type` != 'EXTENSION_UPDATE'"; + $whereStatement = "`assigned_admin`=".getCurrentAdminId()." AND `status`='NEW' AND `task_type` != 'EXTENSION_UPDATE'"; break; case 'updates': // List only updates assigned to you @@ -78,15 +77,15 @@ switch (getRequestElement('type')) { break; default: // Unknown type - logDebugMessage(__FILE__, __LINE__, sprintf("Unknown task type %s detected.", getRequestElement('type'))); - loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_TASK_UNKNOWN_MODE'), getRequestElement('type'))); + logDebugMessage(__FILE__, __LINE__, sprintf("Unknown task type %s detected.", getRequestParameter('type'))); + loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_TASK_UNKNOWN_MODE', getRequestParameter('type'))); break; -} +} // END - switch if (!empty($whereStatement)) { - if ((isPostRequestElementSet('assign')) && (countPostSelection() > 0)) { + if ((isPostRequestParameterSet('assign')) && (ifPostContainsSelections())) { // Assign / do tasks - loadIncludeOnce("inc/modules/admin/overview-inc.php"); + loadIncludeOnce('inc/modules/admin/overview-inc.php'); if (empty($dmy)) $dmy = ''; outputSeletectedTasks(postRequestArray(), $dmy); } else { @@ -103,18 +102,18 @@ ORDER BY `subject` ASC, `task_created` DESC', __FILE__, __LINE__); - if ((countPostSelection() > 0) && (!isDemoModeActive())) { + if ((ifPostContainsSelections()) && (!isDemoModeActive())) { // Only unassign / delete tasks when there are selected tasks posted - if (isPostRequestElementSet('unassign')) { + if (isPostRequestParameterSet('unassign')) { // Unassign from tasks - foreach (postRequestElement('sel') as $id => $sel) { + foreach (postRequestParameter('sel') 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')) { + } // END - foreach + } elseif (isFormSent('delete')) { // Delete tasks - foreach (postRequestElement('sel') as $id => $sel) { - if (getRequestElement('type') == 'deleted') { + foreach (postRequestParameter('sel') as $id => $sel) { + if (getRequestParameter('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__); @@ -122,10 +121,10 @@ ORDER BY // Mark task as to be deleted (purged by autopurge extension) adminDeleteTask($id); } - } + } // END - foreach } else { // Unknown action performed - debug_report_bug(sprintf("Unknown task action performed. data=
%s", print_r(postRequestArray(), true))); + debug_report_bug(__FILE__, __LINE__, sprintf("Unknown task action performed. data=
%s", print_r(postRequestArray(), true))); } // Update query @@ -141,22 +140,13 @@ ORDER BY } // 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; + $OUT = ''; while ($content = SQL_FETCHARRAY($result_tasks)) { // Init infos - $content['infos'] = '---'; - - // Generate link - $content['assigned_admin'] = generateAdminLink($content['assigned_admin']); + $content['infos'] = ''; // Get admin task - $content['task_type_msg'] = getMessage('ADMIN_TASK_IS_'.strtoupper($content['task_type']).''); + $content['task_type_msg'] = '{--ADMIN_TASK_IS_' . strtoupper($content['task_type']) . '--}'; // Generate infos switch ($content['task_type']) { @@ -167,7 +157,7 @@ ORDER BY } // END - switch // Member assigned with task? - if ($content['userid'] > 0) { + if (isValidUserId($content['userid'])) { // Member found otherwise it's a system task $content['userid'] = generateUserProfileLink($content['userid']); } else { @@ -176,43 +166,43 @@ ORDER BY } // 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) + 'assign_admin' => $content['assigned_admin'], + 'userid' => $content['userid'], + 'task_type_msg' => $content['task_type_msg'], + 'task_created' => generateDateTime($content['task_created'], 2) )); // Do we have an extension task? - if (($content['task_type'] == 'EXTENSION') && (isExtensionNameValid($content['infos'])) && (!isExtensionInstalled($content['infos']))) { + if (isExtensionTask($content)) { // Load extension row template - // @TODO Rewrite this to $OUT .= ..., true, ... - loadTemplate('admin_list_task_ext_rows', false, $content); + $OUT .= loadTemplate('admin_list_task_ext_rows', true, $content); } else { // Load default row template - // @TODO Rewrite this to $OUT .= ..., true, ... - loadTemplate('admin_list_task_rows', false, $content); + $OUT .= loadTemplate('admin_list_task_rows', true, $content); } - - // Switch colors - $SW = 3 - $SW; - } + } // END - while // Free memory SQL_FREERESULT($result_tasks); + // Prepare content + $content = array( + 'message' => '{--ADMIN_OVERVIEW_TASK_' . strtoupper(getRequestParameter('type')) . '_TYPE--}', + 'type' => getRequestParameter('type'), + 'rows' => $OUT + ); + // Load footer template - if (getRequestElement('type') == 'deleted') { + if (getRequestParameter('type') == 'deleted') { // Delete now button - loadTemplate('admin_overview_footer_task'); + loadTemplate('admin_list_task_delete', false, $content); } else { // Normal footer - loadTemplate('admin_overview_footer'); + loadTemplate('admin_list_task', false, $content); } } -} +} // END - if // [EOF] ?>