public static function GetAssignedCategories($customWritePanelId) { global $wpdb; $sql = $wpdb->prepare("SELECT cat_id FROM " . MF_TABLE_PANEL_CATEGORY . " WHERE panel_id = %d", array($customWritePanelId)); $results = $wpdb->get_results($sql); if (!isset($results)) { $results = array(); } return $results; }
/** * Export a write panel to file * * @param integer $panelID * @param string $exportedFilename the full path of the file to which the panel will be exported */ function Export($panelID) { include_once 'RCCWP_CustomGroup.php'; include_once 'RCCWP_CustomField.php'; $exported_data = array(); $writePanel = RCCWP_CustomWritePanel::Get($panelID); $writePanel->standardFieldsIDs = RCCWP_CustomWritePanel::GetStandardFields($panelID); $writePanel->assignedCategories = array(); $writePanel->theme = RCCWP_CustomWritePanel::GetThemePage($writePanel->name); $writePanel->parent_page = RCCWP_CustomWritePanel::GetParentPage($writePanel->name); $assignedCategories = RCCWP_CustomWritePanel::GetAssignedCategories($panelID); foreach ($assignedCategories as $assignedCategory) { $writePanel->assignedCategories[] = $assignedCategory->cat_id; } $moduleGroups = RCCWP_CustomWritePanel::GetCustomGroups($panelID); foreach ($moduleGroups as $moduleGroup) { $fields = RCCWP_CustomGroup::GetCustomFields($moduleGroup->id); foreach ($fields as $field) { if ($field->type == "Related Type") { $tmp = RCCWP_CustomWritePanel::Get($field->properties["panel_id"]); $field->properties["panel_name"] = $tmp->name; unset($field->properties["panel_id"]); } } $groupFields[$moduleGroup->name]->fields = $fields; $groupFields[$moduleGroup->name]->duplicate = $moduleGroup->duplicate; $groupFields[$moduleGroup->name]->at_right = $moduleGroup->at_right; } $exported_data['panel'] = $writePanel; $exported_data['fields'] = $groupFields; return serialize($exported_data); }