setSystemProperty("newsletter", "newsletter-recipients-plugin", "false"); // -> Property available in system settings } $sTagInfoText .= "</div>"; $sTagInfoHTML .= "</div>"; $iTplIDArt = 0; // Used later for on change event if ($oNewsletter->get("type") == "html") { $iTplIDArt = $oNewsletter->get("template_idart"); $oSelTemplate = new cHTMLSelectElement("selTemplate"); $oSelTemplate->setEvent("change", "askSubmitOnTplChange(this);"); $aOptions = array("idcat" => $oClientLang->getProperty("newsletter", "html_template_idcat"), "start" => true, "offline" => true, "order" => "title"); $oTemplateArticles = new ArticleCollection($aOptions); $aItems = array(); $aItems[] = array(0, i18n("-- none --", $plugin_name)); while ($oArticle = $oTemplateArticles->nextArticle()) { $aItems[] = array($oArticle->get("idart"), $oArticle->get("title")); } $oSelTemplate->autoFill($aItems); $oSelTemplate->setDefault($iTplIDArt); unset($aItems); unset($oArticles); unset($oTemplateArticles); $oForm->add(i18n("HTML Template", $plugin_name), $oSelTemplate->render() . " " . i18n("Note, that changing the template discards the current html message content", $plugin_name)); if ($iTplIDArt != 0) { $sFrameSrc = $cfgClient[$client]["path"]["htmlpath"] . "front_content.php?changeview=edit&action=con_editart&idart=" . $oNewsletter->get("idart") . "&idcat=" . $oClientLang->getProperty("newsletter", "html_newsletter_idcat") . "&lang=" . $lang . "&contenido=" . $sess->id; $oForm->add(i18n("HTML Message", $plugin_name), '<iframe width="100%" height="600" src="' . $sFrameSrc . '"></iframe><br />' . $sTagInfoHTML); } else { // Add a real note, that a template has to be specified $notis .= $notification->returnNotification("warning", i18n("Newsletter type has been set to HTML/text, please remember to select an html template", $plugin_name)) . "<br />"; $oForm->add(i18n("HTML Message", $plugin_name), i18n("Please choose a template first", $plugin_name));
function prepareWorkflowItems() { global $action, $lang, $modidcat, $workflowSelectBox, $workflowworkflows, $client, $tpl, $cfg; $workflowworkflows = new Workflows(); if ($action === 'workflow_inherit_down') { $tmp = strDeeperCategoriesArray($modidcat); $asworkflow = getWorkflowForCat($modidcat); $wfa = new WorkflowAllocations(); foreach ($tmp as $tmp_cat) { $idcatlang = getCatLang($tmp_cat, $lang); if ($asworkflow == 0) { $wfa->select("idcatlang = '{$idcatlang}'"); if ($item = $wfa->next()) { $wfa->delete($item->get("idallocation")); # delete user sequences for listing in tasklist for each included article $oArticles = new ArticleCollection(array('idcat' => $idcatlang, 'start' => true, 'offline' => true)); while ($oArticle = $oArticles->nextArticle()) { setUserSequence($oArticle->getField('idartlang'), -1); } } } else { $wfa->select("idcatlang = '{$idcatlang}'"); if ($item = $wfa->next()) { $item->setWorkflow($asworkflow); $item->store(); } else { $wfa->create($asworkflow, $idcatlang); # generate user sequences for listing in tasklist for each included article $oArticles = new ArticleCollection(array('idcat' => $tmp_cat, 'start' => true, 'offline' => true)); while ($oArticle = $oArticles->nextArticle()) { setUserSequence($oArticle->getField('idartlang'), $asworkflow); } } } } } if ($action == "workflow_cat_assign") { $seltpl = "wfselect" . $modidcat; $wfa = new WorkflowAllocations(); $idcatlang = getCatLang($modidcat, $lang); #associate workflow with category if ($GLOBALS[$seltpl] != 0) { $wfa->select("idcatlang = '{$idcatlang}'"); if ($item = $wfa->next()) { $item->setWorkflow($GLOBALS[$seltpl]); $item->store(); } else { $wfa->create($GLOBALS[$seltpl], $idcatlang); } # generate user sequences for listing in tasklist for each included article $oArticles = new ArticleCollection(array('idcat' => $modidcat, 'start' => true, 'offline' => true)); while ($oArticle = $oArticles->nextArticle()) { setUserSequence($oArticle->getField('idartlang'), $GLOBALS[$seltpl]); } #unlink workflow with category } else { $wfa->select("idcatlang = '{$idcatlang}'"); if ($item = $wfa->next()) { $alloc = $item->get("idallocation"); } $wfa->delete($alloc); # delete user sequences for listing in tasklist for each included article $oArticles = new ArticleCollection(array('idcat' => $modidcat, 'start' => true, 'offline' => true)); while ($oArticle = $oArticles->nextArticle()) { setUserSequence($oArticle->getField('idartlang'), -1); } } } $workflowSelectBox = new cHTMLSelectElement("foo"); $workflowSelectBox->setClass("text_medium"); $workflowworkflows->select("idclient = '{$client}' AND idlang = '" . Contenido_Security::escapeDB($lang, null) . "'"); $workflowOption = new cHTMLOptionElement("--- " . i18n("None", "workflow") . " ---", 0); $workflowSelectBox->addOptionElement(0, $workflowOption); while ($workflow = $workflowworkflows->next()) { $workflowOption = new cHTMLOptionElement($workflow->get("name"), $workflow->get("idworkflow")); $workflowSelectBox->addOptionElement($workflow->get("idworkflow"), $workflowOption); } $workflowSelectBox->updateAttributes(array("id" => "wfselect{IDCAT}")); $workflowSelectBox->updateAttributes(array("name" => "wfselect{IDCAT}")); $tpl->set('s', 'PLUGIN_WORKFLOW', $workflowSelectBox->render() . '<a href="javascript:setWorkflow({IDCAT}, \\\'wfselect{IDCAT}\\\')"><img src="' . $cfg["path"]["images"] . 'submit.gif" class="spaced"></a>'); $tpl->set('s', 'PLUGIN_WORKFLOW_TRANSLATION', i18n("Inherit workflow down", "workflow")); }