} $oForm = new UI_Table_Form("properties"); $oForm->setVar("frame", $frame); $oForm->setVar("area", $area); $oForm->setVar("action", "recipients_save"); $oForm->setVar("idrecipient", $recipient->get("idnewsrcp")); $oForm->addHeader(i18n("Edit recipient", $plugin_name)); $oTxtName = new cHTMLTextbox("name", $recipient->get("name"), 40); $oTxtEMail = new cHTMLTextbox("email", $recipient->get("email"), 40); $oCkbConfirmed = new cHTMLCheckbox("confirmed", "1"); $oCkbConfirmed->setChecked($recipient->get("confirmed")); $oCkbDeactivated = new cHTMLCheckbox("deactivated", "1"); $oCkbDeactivated->setChecked($recipient->get("deactivated")); $oSelNewsType = new cHTMLSelectElement("newstype"); $oOption = new cHTMLOptionElement(i18n("Text only", $plugin_name), "0"); $oSelNewsType->addOptionElement(0, $oOption); $oOption = new cHTMLOptionElement(i18n("HTML and text", $plugin_name), "1"); $oSelNewsType->addOptionElement(1, $oOption); $oSelNewsType->setDefault($recipient->get("news_type")); $oForm->add(i18n("Name", $plugin_name), $oTxtName->render()); $oForm->add(i18n("E-Mail", $plugin_name), $oTxtEMail->render()); $oForm->add(i18n("Confirmed", $plugin_name), $oCkbConfirmed->toHTML(false) . " (" . $recipient->get("confirmeddate") . ")"); $oForm->add(i18n("Deactivated", $plugin_name), $oCkbDeactivated->toHTML(false)); $oForm->add(i18n("Message type", $plugin_name), $oSelNewsType->render()); $aPluginOrder = trim_array(explode(",", getSystemProperty("plugin", "recipients-pluginorder"))); // Check out if there are any plugins if (is_array($aPluginOrder)) { foreach ($aPluginOrder as $sPlugin) { if (function_exists("recipients_" . $sPlugin . "_getTitle") && function_exists("recipients_" . $sPlugin . "_display")) { $aPluginTitle = call_user_func("recipients_" . $sPlugin . "_getTitle"); $aPluginDisplay = call_user_func("recipients_" . $sPlugin . "_display", $recipient);
$oFrmOptions->setVar("contenido", $sess->id); $oFrmOptions->setVar("area", $area); $oFrmOptions->setVar("action", $action); $oFrmOptions->setVar("frame", $frame); $oFrmOptions->setVar("sortmode", $_REQUEST["sortmode"]); $oFrmOptions->setVar("sortby", $_REQUEST["sortby"]); $oFrmOptions->setVar("idnewsjob", $_REQUEST["idnewsjob"]); //$oFrmOptions->setVar("startpage", $startpage); //$oFrmOptions->setVar("appendparameters", $appendparameters); $oFrmOptions->addHeader(i18n("List options", $plugin_name)); $oSelElements = new cHTMLSelectElement("elemperpage"); $oSelElements->setEvent("onchange", "document.forms.frmOptions.submit();"); $aData = array("0" => i18n("-All-", $plugin_name), "50" => "50", "100" => "100", "250" => "250", "500" => "500"); foreach ($aData as $sKey => $sValue) { $oOption = new cHTMLOptionElement($sValue, $sKey); $oSelElements->addOptionElement($sKey, $oOption); } $oSelElements->setDefault($_REQUEST["elemperpage"]); //$oSelElements->setStyle('border:1px;border-style:solid;border-color:black;'); $oFrmOptions->add(i18n("Items per page:", $plugin_name), $oSelElements->render()); // Ouput data $oList = new cScrollList(true, "news_job_details"); $oList->setCustom("idnewsjob", $_REQUEST["idnewsjob"]); $oList->setCustom("nextpage", $iNextPage); $oList->setCustom("elemperpage", $_REQUEST["elemperpage"]); $aCols = array("rcpname", "rcpemail", "", "status", "sent"); $oList->setHeader(i18n("Recipient", $plugin_name), i18n("E-Mail", $plugin_name), i18n("Type", $plugin_name), i18n("Status", $plugin_name), i18n("Sent", $plugin_name), i18n("Actions", $plugin_name)); $oList->setSortable(0, true); $oList->setSortable(1, true); $oList->setSortable(2, false); $oList->setSortable(3, true);
$oSelItemsPerPage->setDefault($iItemsPerPage); $oSelSortBy = new cHTMLSelectElement("sortby"); foreach ($aFields as $sKey => $aData) { if (strpos($aData["type"], "sort") !== false) { $oOption = new cHTMLOptionElement($aData["caption"], $aData["field"]); $oSelSortBy->addOptionElement($aData["field"], $oOption); } } $oSelSortBy->setDefault("name"); $oSelSortOrder = new cHTMLSelectElement("sortorder"); $oSelSortOrder->autoFill(array("ASC" => i18n("Ascending", $plugin_name), "DESC" => i18n("Descending", $plugin_name))); $oSelSortOrder->setDefault("ASC"); $oTxtFilter = new cHTMLTextbox("filter", "", 16); $oSelSearchIn = new cHTMLSelectElement("searchin"); $oOption = new cHTMLOptionElement(i18n("-- All fields --", $plugin_name), "--all--"); $oSelSearchIn->addOptionElement("all", $oOption); foreach ($aFields as $sKey => $aData) { if (strpos($aData["type"], "search") !== false) { $oOption = new cHTMLOptionElement($aData["caption"], $aData["field"]); $oSelSearchIn->addOptionElement($aData["field"], $oOption); } } $oSelSearchIn->setDefault("--all--"); $oBtnApply = new cHTMLButton("submit", i18n("Apply", $plugin_name)); $sContent = '<div style="border-bottom: 0px solid #B3B3B3; padding-left: 17px; background: ' . $cfg['color']['table_dark'] . ';">' . "\n"; $sContent .= '<form target="left_bottom" onsubmit="reloadLeftBottomAndTransportFormVars(this);" id="groups_listoptionsform" name="groups_listoptionsform" method="get" action="">' . "\n"; $sContent .= ' <input type="hidden" name="area" value="recipientgroups">' . "\n"; $sContent .= ' <input type="hidden" name="frame" value="2">' . "\n"; $sContent .= ' <input type="hidden" name="contenido" value="' . $sess->id . '">' . "\n"; $sContent .= ' <table>' . "\n"; $sContent .= ' <tr>' . "\n";
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")); }