<?php
/*
 * @author     M2E Pro Developers Team
 * @copyright  M2E LTD
 * @license    Commercial use is forbidden
 */

// @codingStandardsIgnoreFile

/** @var $this Ess_M2ePro_Block_Adminhtml_ControlPanel_Tabs_Cron */

?>

<div class="entry-edit group_container_summary">

    <div class="control_panel_head_container">
        <h4><?php echo Mage::helper('M2ePro')->__('Run Task'); ?></h4>
    </div>

    <div class="fieldset">
        <div class="hor-scroll">

            <table class="form-list" cellspacing="0" cellpadding="0">

                <tr>
                    <td class="label">
                        <label><?php echo Mage::helper('M2ePro')->__('Task Name'); ?>: </label>
                    </td>

                    <td class="value">
                        <select id="task_code" name="task_code" style="width: 400px;">
                            <option value=""><?php echo Mage::helper('M2ePro')->__('-- run all --'); ?></option>
                            <?php foreach ($this->tasks as $optgroup => $tasks) : ?>
                                <optgroup label="<?php echo $optgroup; ?>">
                                    <?php foreach ($tasks as $taskCode => $taskTitle) : ?>
                                        <option value="<?php echo rawurlencode($taskCode); ?>"><?php echo $taskTitle; ?></option>
                                    <?php endforeach; ?>
                                </optgroup>
                            <?php endforeach; ?>
                        </select>
                    </td>

                    <td class="value">
                        <a class="button-link" onclick="window.open('<?php echo $this->getUrl('*/adminhtml_controlPanel_cron/run', array('_query' => array('task_code' => 'task-plx'))); ?>'.replace('task-plx', $('task_code').value));" href="javascript:void(0);" style="display: inline !important;"><?php echo Mage::helper('M2ePro')->__('Run') ?></a>
                    </td>
                </tr>

            </table>

        </div>
    </div>

</div>
