mirror of
https://github.com/e107inc/e107.git
synced 2025-05-01 17:57:56 +02:00
Cron (Schedule Tasks) admin work.
This commit is contained in:
parent
d14b929f57
commit
a993bcc056
@ -385,11 +385,44 @@ class cron_admin_ui extends e_admin_ui
|
||||
class cron_admin_form_ui extends e_admin_form_ui
|
||||
{
|
||||
|
||||
var $min_options = array(
|
||||
"*" => LAN_CRON_11,
|
||||
"0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58" => LAN_CRON_12,
|
||||
"0,5,10,15,20,25,30,35,40,45,50,55" => LAN_CRON_13,
|
||||
"0,10,20,30,40,50" => LAN_CRON_14,
|
||||
"0,15,30,45" => LAN_CRON_10,
|
||||
"0,30" => LAN_CRON_15
|
||||
);
|
||||
|
||||
var $hour_options = array(
|
||||
"*" => LAN_CRON_16,
|
||||
"0,2,4,6,8,10,12,14,16,18,20,22" => LAN_CRON_17,
|
||||
"0,3,6,9,12,15,18,21" => LAN_CRON_18,
|
||||
"0,6,12,18" => LAN_CRON_19
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Render cron_tab field
|
||||
*/
|
||||
function cron_tab($curVal,$mode)
|
||||
{
|
||||
if($mode == 'read')
|
||||
{
|
||||
return $curVal; // TODO - Convert to more readable form.
|
||||
$sep = array();
|
||||
list($min, $hour, $day, $month, $weekday) = explode(" ", $curVal);
|
||||
$text = (isset($this->min_options[$min])) ? $this->min_options[$min] : LAN_CRON_3.$min;
|
||||
$text .= "<br />";
|
||||
$text .= (isset($this->hour_options[$hour])) ? $this->hour_options[$hour] : LAN_CRON_4.$hour;
|
||||
$text .= "<br />";
|
||||
$text .= ($day != '*') ? LAN_CRON_5.$day : LAN_CRON_20;
|
||||
$text .= "<br />";
|
||||
$text .= ($month != '*') ? strftime("%B", mktime(00, 00, 00, $month, 1, 2000)) : LAN_CRON_21;
|
||||
$text .= "<br />";
|
||||
$text .= ($weekday != '*') ? strftime("%A", mktime(00, 00, 00, 5, $weekday, 2000)) : LAN_CRON_22;
|
||||
return $text;
|
||||
}
|
||||
|
||||
if($mode == 'write')
|
||||
@ -398,17 +431,13 @@ class cron_admin_form_ui extends e_admin_form_ui
|
||||
}
|
||||
|
||||
if($mode == 'filter') // Custom Filter List
|
||||
{
|
||||
$list = array();
|
||||
return $list;
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if($mode == 'batch')
|
||||
{
|
||||
$types = array();
|
||||
asort($types);
|
||||
|
||||
return $types;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -444,27 +473,13 @@ class cron_admin_form_ui extends e_admin_form_ui
|
||||
$month = explode(",", $sep['month']);
|
||||
$weekday = explode(",", $sep['weekday']);
|
||||
|
||||
$min_options = array(
|
||||
"*" => LAN_CRON_11,
|
||||
"0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58" => LAN_CRON_12,
|
||||
"0,5,10,15,20,25,30,35,40,45,50,55" => LAN_CRON_13,
|
||||
"0,10,20,30,40,50" => LAN_CRON_14,
|
||||
"0,15,30,45" => LAN_CRON_10,
|
||||
"0,30" => LAN_CRON_15
|
||||
);
|
||||
|
||||
$hour_options = array(
|
||||
"*" => LAN_CRON_16,
|
||||
"0,2,4,6,8,10,12,14,16,18,20,22" => LAN_CRON_17,
|
||||
"0,3,6,9,12,15,18,21" => LAN_CRON_18,
|
||||
"0,6,12,18"=> LAN_CRON_19
|
||||
);
|
||||
|
||||
|
||||
$text = "
|
||||
<select class='tbox' style='height:90px' multiple='multiple' name='tab[minute]'>
|
||||
\n";
|
||||
|
||||
foreach ($min_options as $key => $val)
|
||||
foreach ($this->min_options as $key => $val)
|
||||
{
|
||||
if ($sep['minute'] == $key)
|
||||
{
|
||||
@ -492,7 +507,7 @@ class cron_admin_form_ui extends e_admin_form_ui
|
||||
<select class='tbox' style='height:90px' multiple='multiple' name='tab[hour]'>
|
||||
\n";
|
||||
|
||||
foreach ($hour_options as $key => $val)
|
||||
foreach ($this->hour_options as $key => $val)
|
||||
{
|
||||
if ($sep['hour'] == $key)
|
||||
{
|
||||
@ -543,12 +558,12 @@ class cron_admin_form_ui extends e_admin_form_ui
|
||||
|
||||
$sel_weekday = ($weekday[0] == "*") ? "selected='selected'" : "";
|
||||
$text .= "<option value='*' $sel_weekday>".LAN_CRON_22."</option>\n"; // Every Week Day.
|
||||
$days = array(LAN_SUN, LAN_MON, LAN_TUE, LAN_WED, LAN_THU, LAN_FRI, LAN_SAT);
|
||||
|
||||
|
||||
for ($i = 0; $i <= 6; $i++)
|
||||
{
|
||||
$sel = (in_array(strval($i), $weekday)) ? "selected='selected'" : "";
|
||||
$text .= "<option value='$i' $sel>".$days[$i]."</option>\n";
|
||||
$text .= "<option value='$i' $sel>".strftime("%A", mktime(00, 00, 00, 5, $i, 2000))."</option>\n";
|
||||
}
|
||||
$text .= "</select>
|
||||
";
|
||||
|
@ -1164,10 +1164,21 @@ class e_form
|
||||
{
|
||||
$data['readParms']['__idval'] = $fieldvalues[$data['readParms']['idField']];
|
||||
}
|
||||
elseif(isset($fieldvalues['user_id'])) // Default
|
||||
{
|
||||
$data['readParms']['__idval'] = $fieldvalues['user_id'];
|
||||
}
|
||||
|
||||
if(isset($data['readParms']['nameField']))
|
||||
{
|
||||
$data['readParms']['__nameval'] = $fieldvalues[$data['readParms']['nameField']];
|
||||
}
|
||||
elseif(isset($fieldvalues['user_name'])) // Default
|
||||
{
|
||||
$data['readParms']['__nameval'] = $fieldvalues['user_name'];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
$value = $this->renderValue($field, varset($fieldvalues[$field]), $data, varset($fieldvalues[$pid]));
|
||||
|
||||
@ -1474,22 +1485,25 @@ class e_form
|
||||
// Dirty, but the only way for now
|
||||
$id = 0;
|
||||
$ttl = '';
|
||||
if(vartrue($parms['link']))
|
||||
|
||||
//Defaults to user_id and user_name (when present) and when idField and nameField are not present.
|
||||
|
||||
|
||||
// previously set - real parameters are idField && nameField
|
||||
$id = vartrue($parms['__idval']);
|
||||
if($value && !is_numeric($value))
|
||||
{
|
||||
// previously set - real parameters are idField && nameField
|
||||
$id = vartrue($parms['__idval']);
|
||||
if($value && !is_numeric($value))
|
||||
{
|
||||
$id = vartrue($parms['__idval']);
|
||||
$ttl = $value;
|
||||
}
|
||||
elseif($value && is_numeric($value))
|
||||
{
|
||||
$id = $value;
|
||||
$ttl = vartrue($parms['__nameval']);
|
||||
}
|
||||
$ttl = $value;
|
||||
}
|
||||
if($id && $ttl && is_numeric($id))
|
||||
elseif($value && is_numeric($value))
|
||||
{
|
||||
$id = $value;
|
||||
$ttl = vartrue($parms['__nameval']);
|
||||
}
|
||||
|
||||
|
||||
if(vartrue($parms['link']) && $id && $ttl && is_numeric($id))
|
||||
{
|
||||
$value = '<a href="'.e107::getUrl()->createCoreUser('func=profile&id='.intval($id)).'" title="Go to user profile">'.$ttl.'</a>';
|
||||
}
|
||||
|
@ -9,15 +9,15 @@
|
||||
| $Author$
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
if (!defined("PAGE_NAME")) { define("PAGE_NAME", "Schedule Maintenance"); }
|
||||
if (!defined("PAGE_NAME")) { define("PAGE_NAME", "Schedule Tasks"); }
|
||||
|
||||
define("LAN_CRON_1", "Name");
|
||||
define("LAN_CRON_2", "Description");
|
||||
define("LAN_CRON_3", "Minute(s)");
|
||||
define("LAN_CRON_4", "Hour(s)");
|
||||
define("LAN_CRON_5", "Day(s)");
|
||||
define("LAN_CRON_6", "Month(s)");
|
||||
define("LAN_CRON_7", "Weekday(s)");
|
||||
define("LAN_CRON_3", "Minute(s):");
|
||||
define("LAN_CRON_4", "Hour(s):");
|
||||
define("LAN_CRON_5", "Day(s):");
|
||||
define("LAN_CRON_6", "Month(s):");
|
||||
define("LAN_CRON_7", "Weekday(s):");
|
||||
define("LAN_CRON_8", "Active");
|
||||
// define("LAN_CRON_9", "Description");
|
||||
define("LAN_CRON_10", "Every 15 minutes");
|
||||
@ -37,14 +37,5 @@ define("LAN_CRON_20", "Every Day");
|
||||
define("LAN_CRON_21", "Every Month");
|
||||
define("LAN_CRON_22", "Every Week Day");
|
||||
|
||||
define("LAN_SUN", "Sunday");
|
||||
define("LAN_MON", "Monday");
|
||||
define("LAN_TUE","Tuesday");
|
||||
define("LAN_WED","Wednesday");
|
||||
define("LAN_THU","Thursday");
|
||||
define("LAN_FRI","Friday");
|
||||
define("LAN_SAT","Saturday");
|
||||
|
||||
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user