Пример #1
0
function ioTask_UITaskRun(&$module, $action)
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    $connMgr =& $module->get_connMgr();
    $lang =& $module->get_lang();
    $out =& $module->get_out();
    $form = new Form();
    $dimport = new DoceboImport();
    $params = $connMgr->get_task_byname(key($action));
    $task_name = $params[CONNMGR_TASK_NAME];
    $out->setWorkingZone('content');
    $out->add(getTitleArea($lang->def('_TASKS'), 'iotask'));
    $out->add('<div class="std_block">');
    $out->add($form->getFormHeader($lang->def('_TASK_RUNNED')));
    $out->add($form->openForm('task_delete', 'index.php?modname=iotask&op=display&gotab=tasks'));
    $out->add($form->openElementSpace());
    $out->add($form->getHidden('task_name', 'task_name', $task_name));
    $report = $dimport->execute_task($task_name);
    if (!is_array($report)) {
        $out->add($report);
    } else {
        $out->add($form->getLineBox($lang->def('_TASK_INSERTED'), $report[0]['inserted']));
        $out->add($form->getLineBox($lang->def('_OPERATION_SUCCESSFUL'), $report[0]['removed']));
        $out->add($form->getLineBox($lang->def('_OPERATION_FAILURE'), count($report) - 1));
        foreach ($report as $index => $elem_report) {
            if ($index !== 0) {
                $out->add($index . ' - ' . '(' . implode(', ', $report[$index][0]) . ')' . ' - ' . $report[$index][1]);
            }
        }
    }
    $out->add($form->closeElementSpace());
    $out->add($form->openButtonSpace());
    $out->add($form->getButton('close', 'close', $lang->def('_CLOSE')));
    $out->add($form->closeButtonSpace());
    $out->add($form->closeForm());
    $out->add('</div>');
}
Пример #2
0
 function doTasks()
 {
     $out = '';
     $connMgr =& $this->get_connMgr();
     $taskParams =& $connMgr->get_first_task();
     $dimport = new DoceboImport();
     while ($taskParams !== FALSE) {
         if ($connMgr->is_task_todo($taskParams)) {
             $report = $dimport->execute_task($taskParams[CONNMGR_TASK_NAME]);
             if (!is_array($report)) {
                 $out .= '<iotask name="' . $taskParams[CONNMGR_TASK_NAME] . '" inserted="0" removed="0" >';
                 $out .= '<result>' . $report . '</result>';
             } else {
                 $out .= '<iotask name="' . $taskParams[CONNMGR_TASK_NAME] . '"' . ' inserted="' . $report[0]['inserted'] . '"' . ' removed="' . $report[0]['removed'] . '" >';
                 foreach ($report as $index => $elem_report) {
                     if ($index !== 0) {
                         $out .= '<row index="' . $index . '">';
                         $out .= '<pk>' . implode(', ', $report[$index][0]) . '</pk>';
                         $out .= '<error>' . $report[$index][1] . '</error>';
                         $out .= '</row>';
                     }
                 }
             }
             $out .= '</iotask>';
         }
         $taskParams =& $connMgr->get_next_task();
     }
     return $out;
 }