function show_commentTemplate($template_name) { global $TPL; // Run query and loop through the records $db = new db_alloc(); $query = "SELECT * FROM commentTemplate ORDER BY commentTemplateType, commentTemplateName"; $db->query($query); while ($db->next_record()) { $commentTemplate = new commentTemplate(); $commentTemplate->read_db_record($db); $commentTemplate->set_values(); $TPL["odd_even"] = $TPL["odd_even"] == "even" ? "odd" : "even"; include_template($template_name); } }
// Create an object to hold a commentTemplate $commentTemplate = new commentTemplate(); // Load the commentTemplate from the database $commentTemplateID = $_POST["commentTemplateID"] or $commentTemplateID = $_GET["commentTemplateID"]; if ($commentTemplateID) { $commentTemplate->set_id($commentTemplateID); $commentTemplate->select(); } // Process submission of the form using the save button if ($_POST["save"]) { $commentTemplate->read_globals(); $commentTemplate->save(); alloc_redirect($TPL["url_alloc_commentTemplateList"]); // Process submission of the form using the delete button } else { if ($_POST["delete"]) { $commentTemplate->delete(); alloc_redirect($TPL["url_alloc_commentTemplateList"]); exit; } } // Load data for display in the template $commentTemplate->set_values(); $ops = array("" => "Comment Template Type", "task" => "Task", "timeSheet" => "Time Sheet", "project" => "Project", "client" => "Client", "invoice" => "Invoice", "productSale" => "Sale"); $TPL["commentTemplateTypeOptions"] = page::select_options($ops, $commentTemplate->get_value("commentTemplateType")); $TPL["main_alloc_title"] = "Edit Comment Template - " . APPLICATION_NAME; // Invoke the page's main template include_template("templates/commentTemplateM.tpl"); ?>