public function beforeGetTaskform($data)
 {
     ${"GLOBALS"}["vxneoo"] = "data";
     list(${${"GLOBALS"}["vxneoo"]}, ${${"GLOBALS"}["wpxxzcxsk"]}) = ${${"GLOBALS"}["dwvbklr"]};
     ${${"GLOBALS"}["usialjh"]} = \Workflow\Attachment::getAvailableOptions($this->parameter["module"]);
     $qdamemwszko = "set";
     ${"GLOBALS"}["amirrqfokpko"] = "attachmentJAVASCRIPT";
     ${${"GLOBALS"}["doonpksxop"]} = array();
     $qdabulodxt = "attachmentHTML";
     ${"GLOBALS"}["sovngiguemy"] = "set";
     ${${"GLOBALS"}["uksddfyfcei"]} = array();
     foreach (${${"GLOBALS"}["usialjh"]} as ${${"GLOBALS"}["pppuywcew"]}) {
         $zewunseuvlo = "item";
         ${"GLOBALS"}["cctklpp"] = "attachmentHTML";
         $fwfcjrxsedlw = "attachmentJAVASCRIPT";
         ${${"GLOBALS"}["cctklpp"]}[] = "<div>" . ${$zewunseuvlo}["html"] . "</div>";
         ${$fwfcjrxsedlw}[] = !empty(${${"GLOBALS"}["pppuywcew"]}["script"]) ? ${${"GLOBALS"}["pppuywcew"]}["script"] : "";
     }
     $viewer->assign("attachmentsField", $this->field);
     $viewer->assign("attachmentsHTML", implode("\n", ${$qdabulodxt}));
     $viewer->assign("attachmentsJAVASCRIPT", ${${"GLOBALS"}["amirrqfokpko"]});
     ${${"GLOBALS"}["sovngiguemy"]} = ${${"GLOBALS"}["dwvbklr"]}[$this->field];
     if (empty(${${"GLOBALS"}["kdspquaodic"]})) {
         ${${"GLOBALS"}["kdspquaodic"]} = json_encode(array());
     }
     $viewer->assign("SetAttachmentList", ${$qdamemwszko});
     $viewer->assign("attachmentsList", $viewer->fetch("modules/Settings/Workflow2/helpers/Attachments.tpl"));
 }
 public function beforeGetTaskform($viewer)
 {
     global $adb;
     $connected = $this->getConnectedObjects("Absender");
     if (count($connected) > 0) {
         $viewer->assign("from", array("from_mail" => $connected[0]->get("email1"), "from_name" => trim($connected[0]->get("first_name") . " " . $connected[0]->get("last_name")), "from_readonly" => true));
     }
     //        $smtpServer = \Workflow\ConnectionProvider::getAvailableConfigurations('smtp');
     //        var_dump($smtpServer);exit();
     $connected = $this->getConnectedObjects("BCC");
     $bccs = $connected->get("email1");
     $viewer->assign("bccs", $bccs);
     $from_email = $this->get("from_mail");
     if ($from_email === -1) {
         global $current_user;
         $from_email = $current_user->column_fields["email1"];
         $from_name = $current_user->column_fields["first_name"] . " " . $current_user->column_fields["last_name"];
         $this->set("from_mail", $from_email);
         $this->set("from_name", $from_name);
     }
     $availableSpecialAttachments = \Workflow\Attachment::getAvailableOptions($this->getModuleName());
     $attachmentHTML = array();
     $attachmentJAVASCRIPT = array();
     foreach ($availableSpecialAttachments as $item) {
         $attachmentHTML[] = '<div>' . $item['html'] . '</div>';
         $attachmentJAVASCRIPT[] = !empty($item['script']) ? $item['script'] : '';
     }
     // implode the array to one string
     $viewer->assign('attachmentsHTML', implode("\n", $attachmentHTML));
     // transmit array to create single script tags
     $viewer->assign('attachmentsJAVASCRIPT', $attachmentJAVASCRIPT);
     if (vtlib_isModuleActive('Emails')) {
         $availableAttachments = \Workflow\InterfaceFiles::getAvailableFiles($this->getModuleName());
     } else {
         throw new \Exception('To use this task, you need to activate the "Emails" module.');
     }
     $jsList = array();
     foreach ($availableAttachments as $title => $group) {
         foreach ($group as $index => $value) {
             $jsList[$index] = $value;
         }
     }
     $viewer->assign("jsAttachmentsList", $jsList);
     $viewer->assign("available_attachments", $availableAttachments);
     if ($this->get("attachments") == -1) {
         $this->set("attachments", '{}');
     }
     if ($this->get("attachments") == "") {
         $this->set("attachments", '{}');
     }
     $sql = "SELECT * FROM vtiger_emailtemplates WHERE deleted = 0";
     $result = $adb->query($sql);
     $mailtemplates = array();
     while ($row = $adb->fetchByAssoc($result)) {
         $mailtemplates['Email Templates'][$row["templateid"]] = $row["templatename"];
     }
     if (vtlib_isModuleActive('EMAILMaker') && class_exists('EMAILMaker_Module_Model')) {
         $emailmaker = new \EMAILMaker_Module_Model();
         if (method_exists($emailmaker, 'GetAvailableTemplates')) {
             $templates = $emailmaker->GetAvailableTemplates($this->getModuleName());
             foreach ($templates as $categoryTitle => $category) {
                 if (!is_array($category)) {
                     $mailtemplates['EMAILMaker']['s#emailmaker#' . $categoryTitle] = $category;
                 } else {
                     foreach ($category as $templateid => $template) {
                         $mailtemplates['EMAILMaker ' . $categoryTitle]['s#emailmaker#' . $templateid] = $template;
                     }
                 }
             }
         }
     }
     $viewer->assign("MAIL_TEMPLATES", $mailtemplates);
     $viewer->assign("fields", \VtUtils::getFieldsWithBlocksForModule($this->getModuleName(), true));
     if (defined("WF_DEMO_MODE") && constant("WF_DEMO_MODE") == true) {
         echo "<p style='text-align:center;margin:0;padding:5px 0;background-color:#fbcb09;font-weight:bold;'>The sendmail Task won't work on demo.stefanwarnat.de</p>";
     }
 }