function Delete_category_and_move_content($id_category, $new_id_cat_content) { global $Sql; if (!array_key_exists($id_category, $this->cache_var)) { parent::_add_error(NEW_PARENT_CATEGORY_DOES_NOT_EXIST); return false; } parent::delete($id_category); foreach ($this->cache_var as $id_cat => $properties) { if ($id_cat != 0 && $properties['id_parent'] == $id_category) { parent::move_into_another($id_cat, $new_id_cat_content); } } $Sql->query_inject("UPDATE " . PREFIX . "media SET idcat = '" . $new_id_cat_content . "' WHERE idcat = '" . $id_category . "'", __LINE__, __FILE__); $this->recount_media_per_cat(); return true; }
function delete_category_and_move_content($id_category, $new_id_cat_content) { global $Sql; if (!array_key_exists($id_category, $this->cache_var)) { parent::_add_error(NEW_PARENT_CATEGORY_DOES_NOT_EXIST); return false; } parent::delete($id_category); foreach ($this->cache_var as $id_cat => $properties) { if ($id_cat != 0 && $properties['id_parent'] == $id_category) { parent::move_into_another($id_cat, $new_id_cat_content); } } $max_q_order = $Sql->query("SELECT MAX(q_order) FROM " . PREFIX . "faq WHERE idcat = '" . $new_id_cat_content . "'", __LINE__, __FILE__); $max_q_order = $max_q_order > 0 ? $max_q_order : 1; $Sql->query_inject("UPDATE " . PREFIX . "faq SET idcat = '" . $new_id_cat_content . "', q_order = q_order + " . $max_q_order . " WHERE idcat = '" . $id_category . "'", __LINE__, __FILE__); $this->recount_subquestions(); return true; }