/** * GetJobStatus * Returns 'human readable' job status language variable based on the status passed in. * If the status is invalid, then this returns false. * Otherwise, it returns the defined language variable. * Valid status variables are: * 'c' for complete * 'i' for in progress * 'p' for paused * 'w' for waiting to send * 'r' for job resend (used by scheduled sending). * * Addons could have their own "status" so get a response from the addons to see if they have a non-default status code. * * @param Char $status The status to get in human readable format. * * @return False|String Returns false if the status is invalid, otherwise a string with the real status description. * * @uses EventData_IEM_JOBSAPI_GETJOBSTATUS */ function GetJobStatus($status='c') { /** * Trigger event */ $tempEventData = new EventData_IEM_JOBSAPI_GETJOBSTATUS(); $tempEventData->jobstatus = &$status; $tempEventData->statusmessage = ''; if (!$tempEventData->trigger()) { return $tempEventData->statusmessage; } unset($tempEventData); /** * ----- */ $return = false; switch (strtolower($status)) { case 'c': $return = GetLang('Job_Complete'); break; case 'i': $return = GetLang('Job_InProgress'); break; case 'p': $return = GetLang('Job_Paused'); break; case 'w': $return = GetLang('Job_Waiting'); break; case 'r': $return = GetLang('Job_Resend'); break; } return $return; }
/** * GetJobStatus * Returns a "job status" message explaining what the job status means. * It looks for specific status codes only this addon uses. * * @param EventData_IEM_JOBSAPI_GETJOBSTATUS $data The current data which contains the 'jobstatus' code and a message placeholder. * * @uses jobstatuscodes * * @return Void The data is passed in by reference, so this just modifies the statusmessage in the data->data array. * * @uses EventData_IEM_JOBSAPI_GETJOBSTATUS */ static function GetJobStatus(EventData_IEM_JOBSAPI_GETJOBSTATUS $data) { /** * If it's a status code used by this addon, * set the message, stop the event propogation in the calling code and return. * * If it's not a status code used by this addon, do nothing. */ if (in_array($data->jobstatus, self::$jobstatuscodes)) { $data->preventDefault(); $rand_tipid = rand(1, 100000); $heading = GetLang('Addon_splittest_Schedule_JobStatus_Timeout'); $message = GetLang('Addon_splittest_Schedule_JobStatus_Timeout_TipDetails'); $tip_message = '<span class="HelpText" onMouseOut="HideHelp(\'splitDisplayTimeout' . $rand_tipid . '\');" onMouseOver="ShowQuickHelp(\'splitDisplayTimeout' . $rand_tipid . '\', \'' . $heading . '\', \'' . $message . '\');">' . $heading . '</span><div id="splitDisplayTimeout' . $rand_tipid . '" style="display: none;"></div>'; $data->statusmessage = $tip_message; } }