30 const NAME =
"ajax_admin_scheduler";
34 function __construct()
36 parent::__construct(self::NAME, array(
37 self::TITLE => _(
"URL"),
48 protected function handle(Request $request)
51 $operation = $request->get(
'operation');
53 $vars[
'operation'] = $operation;
55 $content = $this->renderer->loadTemplate(
'ajax-admin-scheduler.html.twig')->render($vars);
57 if (
'pause' == $operation ||
'restart' == $operation ||
58 'status' == $operation ||
'priority' == $operation) {
60 }
else if (
'verbose' == $operation) {
62 $text2 = _(
"Select a verbosity level");
64 "<br>$text2: <select name='level_list' id='level_list'>$verbose_list_option</select>";
65 }
else if (
'agents' == $operation) {
67 $dbManager = $this->
getObject(
'db.manager');
68 $dbManager->prepare($stmt = __METHOD__ .
'.getAgents',
69 'SELECT MAX(agent_pk) agent_id, agent_name FROM agent WHERE agent_enabled GROUP BY agent_name');
70 $res = $dbManager->execute($stmt);
72 while ($row = $dbManager->fetchArray($res)) {
73 $V .=
"<li>$row[agent_name]</li>";
76 $dbManager->freeResult($res);
78 return new Response($V, Response::HTTP_OK, array(
'content-type'=>
'text/htm'));
93 if (
'status' == $type ||
'verbose' == $type ||
'priority' == $type) {
95 if (
'priority' != $type) {
96 $job_array[0] =
"scheduler";
99 if (
'pause' == $type) {
102 if (
'restart' == $type) {
114 $verbose_list_option =
"";
117 for ($i = $min; $i <= $max; $i++) {
118 $bitmask= (1<<$i) - 1;
119 $verbose_list_option .=
"<option value='$bitmask'>$i</option>";
121 return $verbose_list_option;
132 $priority_list = array();
133 for ($i = $min; $i <= $max; $i++) {
134 $priority_list[$i]=$i;
136 return $priority_list;
GetRunnableJobList()
Get runnable job list, the process is below:
verboseListOption()
get the verbose list: if the value of verbose is 1, set verbose as 1
GetJobList($status)
Gets the list of jobqueue records with the requested $status.
jobListOption($type)
get the job list for the specified operation
fo_dbManager * dbManager
fo_dbManager object
priorityListOption()
get the priority list for setting, -20..20