Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

PHP8 after rector #398

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions app/code/community/Aoe/Scheduler/Block/Adminhtml/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,15 @@ protected function _prepareLayout()
$this->removeButton('add');
$this->_addButton(
'add_new_job',
array(
'label' => $this->__('Create new job'),
'onclick' => "setLocation('{$this->getUrl('*/*/new')}')",
'class' => 'add'
)
['label' => $this->__('Create new job'), 'onclick' => "setLocation('{$this->getUrl('*/*/new')}')", 'class' => 'add']
);
$this->_addButton(
'add_new',
array(
'label' => $this->__('Generate Schedule'),
'onclick' => "setLocation('{$this->getUrl('*/*/generateSchedule')}')",
)
['label' => $this->__('Generate Schedule'), 'onclick' => "setLocation('{$this->getUrl('*/*/generateSchedule')}')"]
);
$this->_addButton(
'configure',
array(
'label' => $this->__('Cron Configuration'),
'onclick' => "setLocation('{$this->getUrl('adminhtml/system_config/edit', array('section' => 'system'))}#system_cron')",
)
['label' => $this->__('Cron Configuration'), 'onclick' => "setLocation('{$this->getUrl('adminhtml/system_config/edit', ['section' => 'system'])}#system_cron')"]
);
return parent::_prepareLayout();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ public function getHeaderText()
*/
public function getSaveUrl()
{
return $this->getUrl('*/*/save', array('_current'=>true, 'back'=>null));
return $this->getUrl('*/*/save', ['_current'=>true, 'back'=>null]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ class Aoe_Scheduler_Block_Adminhtml_Job_Edit_Form extends Mage_Adminhtml_Block_W
*/
protected function _prepareForm()
{
$form = new Varien_Data_Form(array(
'id' => 'edit_form',
'action' => $this->getData('action'),
'method' => 'post'
));
$form = new Varien_Data_Form(['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post']);
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
Expand Down
126 changes: 19 additions & 107 deletions app/code/community/Aoe/Scheduler/Block/Adminhtml/Job/Edit/Tab/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,175 +78,87 @@ protected function _prepareForm()
{
$job = $this->getJob();
$form = new Varien_Data_Form(
array(
'id' => 'edit_form',
'action' => $this->getData('action'),
'method' => 'post'
)
['id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post']
);

$fieldset = $form->addFieldset('base_fieldset', array('legend' => $this->__('General')));
$fieldset = $form->addFieldset('base_fieldset', ['legend' => $this->__('General')]);
$this->_addElementTypes($fieldset);

$fieldset->addField(
'job_code',
'text',
array(
'name' => 'job_code',
'label' => $this->__('Job code'),
'title' => $this->__('Job code'),
'class' => '',
'required' => true,
'disabled' => $job->getJobCode() ? true : false,
)
['name' => 'job_code', 'label' => $this->__('Job code'), 'title' => $this->__('Job code'), 'class' => '', 'required' => true, 'disabled' => $job->getJobCode() ? true : false]
);

$fieldset->addField(
'name',
'text',
array(
'name' => 'name',
'label' => $this->__('Name'),
'title' => $this->__('Name'),
'class' => '',
'required' => false,
'after_element_html' => $this->getOriginalValueSnippet($job, 'name'),
)
['name' => 'name', 'label' => $this->__('Name'), 'title' => $this->__('Name'), 'class' => '', 'required' => false, 'after_element_html' => $this->getOriginalValueSnippet($job, 'name')]
);

$fieldset->addField(
'short_description',
'textarea',
array(
'name' => 'short_description',
'label' => $this->__('Short description'),
'title' => $this->__('Short description'),
'class' => '',
'required' => false,
'after_element_html' => $this->getOriginalValueSnippet($job, 'short_description'),
)
['name' => 'short_description', 'label' => $this->__('Short description'), 'title' => $this->__('Short description'), 'class' => '', 'required' => false, 'after_element_html' => $this->getOriginalValueSnippet($job, 'short_description')]
);

$fieldset->addField(
'description',
'textarea',
array(
'name' => 'description',
'label' => $this->__('Description'),
'title' => $this->__('Description'),
'class' => '',
'required' => false,
'after_element_html' => $this->getOriginalValueSnippet($job, 'description'),
)
['name' => 'description', 'label' => $this->__('Description'), 'title' => $this->__('Description'), 'class' => '', 'required' => false, 'after_element_html' => $this->getOriginalValueSnippet($job, 'description')]
);

$fieldset->addField(
'run_model',
'text',
array(
'name' => 'run_model',
'label' => $this->__('Run model'),
'title' => $this->__('Run model'),
'class' => '',
'required' => true,
'note' => $this->__('e.g. "aoe_scheduler/task_heartbeat::run"'),
'after_element_html' => $this->getOriginalValueSnippet($job, 'run/model'),
)
['name' => 'run_model', 'label' => $this->__('Run model'), 'title' => $this->__('Run model'), 'class' => '', 'required' => true, 'note' => $this->__('e.g. "aoe_scheduler/task_heartbeat::run"'), 'after_element_html' => $this->getOriginalValueSnippet($job, 'run/model')]
);

$fieldset->addField(
'is_active',
'select',
array(
'name' => 'is_active',
'label' => $this->__('Status'),
'title' => $this->__('Status'),
'required' => true,
'options' => array(
0 => $this->__('Disabled'),
1 => $this->__('Enabled')
),
'after_element_html' => $this->getOriginalValueSnippetFlag($job, 'is_active', 'Enabled', 'Disabled'),
)
['name' => 'is_active', 'label' => $this->__('Status'), 'title' => $this->__('Status'), 'required' => true, 'options' => [0 => $this->__('Disabled'), 1 => $this->__('Enabled')], 'after_element_html' => $this->getOriginalValueSnippetFlag($job, 'is_active', 'Enabled', 'Disabled')]
);

$fieldset = $form->addFieldset('cron_fieldset', array('legend' => $this->__('Scheduling')));
$fieldset = $form->addFieldset('cron_fieldset', ['legend' => $this->__('Scheduling')]);
$this->_addElementTypes($fieldset);

$fieldset->addField(
'schedule_config_path',
'text',
array(
'name' => 'schedule_config_path',
'label' => $this->__('Cron configuration path'),
'title' => $this->__('Cron configuration path'),
'class' => '',
'required' => false,
'note' => $this->__(
'Path to system configuration containing the cron configuration for this job. (e.g. system/cron/scheduler_cron_expr_heartbeat) This configuration - if set - has a higher priority over the cron expression configured with the job directly.'
),
'after_element_html' => $this->getOriginalValueSnippet($job, 'schedule/config_path'),
)
['name' => 'schedule_config_path', 'label' => $this->__('Cron configuration path'), 'title' => $this->__('Cron configuration path'), 'class' => '', 'required' => false, 'note' => $this->__(
'Path to system configuration containing the cron configuration for this job. (e.g. system/cron/scheduler_cron_expr_heartbeat) This configuration - if set - has a higher priority over the cron expression configured with the job directly.'
), 'after_element_html' => $this->getOriginalValueSnippet($job, 'schedule/config_path')]
);

$fieldset->addField(
'schedule_cron_expr',
'text',
array(
'name' => 'schedule_cron_expr',
'label' => $this->__('Cron expression'),
'title' => $this->__('Cron expression'),
'required' => false,
'note' => $this->__('e.g "*/5 * * * *" or "always"'),
'after_element_html' => $this->getOriginalValueSnippet($job, 'schedule/cron_expr'),
)
['name' => 'schedule_cron_expr', 'label' => $this->__('Cron expression'), 'title' => $this->__('Cron expression'), 'required' => false, 'note' => $this->__('e.g "*/5 * * * *" or "always"'), 'after_element_html' => $this->getOriginalValueSnippet($job, 'schedule/cron_expr')]
);

$fieldset = $form->addFieldset('parameter_fieldset', array('legend' => $this->__('Extras')));
$fieldset = $form->addFieldset('parameter_fieldset', ['legend' => $this->__('Extras')]);
$this->_addElementTypes($fieldset);

$fieldset->addField(
'parameters',
'textarea',
array(
'name' => 'parameters',
'label' => $this->__('Parameters'),
'title' => $this->__('Parameters'),
'class' => 'textarea',
'required' => false,
'note' => $this->__('These parameters will be passed to the model. It is up to the model to specify the format of these parameters (e.g. json/xml/...'),
'after_element_html' => $this->getOriginalValueSnippet($job, 'parameters'),
)
['name' => 'parameters', 'label' => $this->__('Parameters'), 'title' => $this->__('Parameters'), 'class' => 'textarea', 'required' => false, 'note' => $this->__('These parameters will be passed to the model. It is up to the model to specify the format of these parameters (e.g. json/xml/...'), 'after_element_html' => $this->getOriginalValueSnippet($job, 'parameters')]
);

$fieldset->addField(
'groups',
'textarea',
array(
'name' => 'groups',
'label' => $this->__('Groups'),
'title' => $this->__('Groups'),
'class' => 'textarea',
'required' => false,
'note' => $this->__('Comma-separated list of groups (tags) that can be used with the include/exclude command line options of scheduler.php'),
'after_element_html' => $this->getOriginalValueSnippet($job, 'groups'),
)
['name' => 'groups', 'label' => $this->__('Groups'), 'title' => $this->__('Groups'), 'class' => 'textarea', 'required' => false, 'note' => $this->__('Comma-separated list of groups (tags) that can be used with the include/exclude command line options of scheduler.php'), 'after_element_html' => $this->getOriginalValueSnippet($job, 'groups')]
);

$fieldset = $form->addFieldset('dependency_fieldset', array('legend' => $this->__('Dependencies')));
$fieldset = $form->addFieldset('dependency_fieldset', ['legend' => $this->__('Dependencies')]);
$this->_addElementTypes($fieldset);

$fieldset->addField(
'on_success',
'textarea',
array(
'name' => 'on_success',
'label' => $this->__('Run jobs on success'),
'title' => $this->__('Run jobs on success'),
'class' => 'textarea',
'required' => false,
'note' => $this->__('Comma-separated list of job codes that will be scheduled after the current cron job has completed successfully.')
)
['name' => 'on_success', 'label' => $this->__('Run jobs on success'), 'title' => $this->__('Run jobs on success'), 'class' => 'textarea', 'required' => false, 'note' => $this->__('Comma-separated list of job codes that will be scheduled after the current cron job has completed successfully.')]
);

$this->setForm($form);
Expand Down Expand Up @@ -284,7 +196,7 @@ protected function getOriginalValueSnippetFlag(Aoe_Scheduler_Model_Job $job, $ke
return '';
}

$value = $this->__(!in_array($xmlJobData[$key], array(false, 'false', 0, '0'), true) ? $trueLabel : $falseLabel);
$value = $this->__(!in_array($xmlJobData[$key], [false, 'false', 0, '0'], true) ? $trueLabel : $falseLabel);

return '<p class="original" style="background-color: white"><strong>Original:</strong> ' . $value . '</p>';
}
Expand Down
Loading