public function mysql_save_from_post($post) { $lid = parent::mysql_save_from_post($post); $obj = static::from_mysql_id($lid); if ($obj != null) { $xml_hash = $obj->calculate_xml_hash(); $obj->xml_hash = $xml_hash; $obj->mysql_save(); $tt = TestTemplate::from_property(array("Template_id" => $lid)); foreach ($tt as $elem) { $ts = TestSection::from_mysql_id($elem->TestSection_id); $vals = $ts->get_values(); $html = Template::output_html($obj->HTML, $vals, $obj->get_outputs(), $obj->get_inserts()); $elem->HTML = $html; $elem->mysql_save(); } } return $lid; }
public function delete_templates() { $templates = TestTemplate::from_property(array("Test_id" => $this->id)); foreach ($templates as $template) { $template->mysql_delete(); } }