function smarty_function_reportToShowCheckBox($params, &$smarty) { /* create and return html code for checkboxes used in report forms, to tell which attribute should be shown in retport param name(string,required): name of checkbox that will be set param output(string,required): string that will be shown aside of checkbox param default_checked(string,optional): default to false, see function.checkBoxValue param always_in_request(string,optional): see function.checkBoxValue param value(string,optional): optionally set value of check box param container_name(string,optional): optionally add this check box to javascript container param form_name(string,optional): used with container_name to add this checkbox in javascript container */ require_once $smarty->_get_plugin_filepath('function', 'checkBoxValue'); require_once $smarty->_get_plugin_filepath('block', 'multiTableTD'); $checked = smarty_function_checkBoxValue($params, $smarty); if (isset($params["container_name"]) and isset($params["form_name"])) { $javascript = <<<END \t <script> \t\t{$params["container_name"]}.addByName('{$params["form_name"]}','{$params["name"]}'); \t </script> END; } else { $javascript = ""; } $value = isset($params["value"]) ? $params["value"] : ""; $ret = smarty_block_multiTableTD(array("type" => "left"), "<input type=checkbox name={$params["name"]} {$checked} value='{$value}'>", $smarty); $ret .= smarty_block_multiTableTD(array("type" => "right"), "{$params["output"]}", $smarty); return $ret .= $javascript; }
function smarty_function_multiTablePad($params, &$smarty) { /* enter arbitary amount of multiTableTDs, until index%go_until==0 parameter last_index(integer,required): last index of multiTableTDs parameter go_until(integer,required): go until last_index is dividable by this parameter width(string,optional): optionally set width of right td */ require_once $smarty->_get_plugin_filepath('block', 'multiTableTD'); $ret = ""; while ($params["last_index"] % $params["go_until"] != $params["go_until"] - 1) { $td_params = array("type" => "left"); $ret .= smarty_block_multiTableTD($td_params, " ", $smarty); $td_params["type"] = "right"; if (isset($params["width"])) { $td_params["width"] = $params["width"]; } $ret .= smarty_block_multiTableTD($td_params, " ", $smarty); $params["last_index"]++; } return $ret; }
function createRasTable(&$smarty, $prefix) { $req = new GetActiveRasIPs(); $resp = $req->sendAndRecv(); if ($resp->isSuccessful()) { $content = ""; $i = 0; foreach ($resp->getResult() as $ras_ip) { if ($i % 4 == 0) { $content .= smarty_function_multiTableTR(array(), $smarty); } $checked = checkBoxValue("{$prefix}_{$i}"); $content .= smarty_block_multiTableTD(array("type" => "left", "width" => "25%"), "<input type=checkbox name='{$prefix}_{$i}' value='{$ras_ip}' {$checked}>", $smarty); $content .= smarty_block_multiTableTD(array("type" => "right", "width" => "25%"), "{$ras_ip}", $smarty); $i++; } $content .= smarty_function_multiTablePad(array("last_index" => $i - 1, "go_until" => 4, "width" => "25%"), $smarty); $content = smarty_block_multiTable(array(), $content, $smarty); } else { $err = $resp->getError(); $content = $err->getErrorMsg(); } return $content; }