public static function SaveModule($a_data) { //print_r($_POST); self::$m_pageid = Database::Escape($_POST['page_id']); self::$m_moduleid = Database::Escape($_POST['module_id']); // Delete old data Database::Query("DELETE FROM `" . DB_TBL_DATA . "` WHERE `moduleid` = '" . self::$m_moduleid . "'"); self::SaveModuleFragment($a_data, self::$m_moduleid); $module = new Module(self::$m_moduleid); $doc = $module->Build(); // Plugin Hook $data_object = new stdClass(); $data_object->doc = $doc; ObjMgr::GetPluginMgr()->ExecuteHook("On_PrepareTemplate", $data_object); print json_encode(array("moduleid" => self::$m_moduleid, "content" => $doc->getHtml(), "module_data" => self::$m_data['module_data'])); // Page needs recompiling $result = Database::Query("SELECT `pageid` FROM `" . DB_TBL_MODULE . "` WHERE `id` = '" . self::$m_moduleid . "' GROUP BY `pageid`"); if ($result->HasData()) { do { Database::Query("UPDATE `" . DB_TBL_PAGES . "` SET `compiled` = '' WHERE `id` = '" . $result->GetValue('pageid') . "'"); } while ($result->NextRow()); } }