GetAssignedCategories() public static méthode

Get a list of categories assigned to a write panel
public static GetAssignedCategories ( integer $customWritePanelId ) : array
$customWritePanelId integer write panel id
Résultat array of objects, each object contains cat_id and cat_name
 /**
  * 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);
 }
 function GetAssignedCategoriesString($customWritePanel)
 {
     $results = RCCWP_CustomWritePanel::GetAssignedCategories($customWritePanel);
     $str = '';
     foreach ($results as $r) {
         $str .= $r->cat_name . ', ';
     }
     $str = substr($str, 0, strlen($str) - 2);
     // deletes last comma and whitespace
     return $str;
 }
 /**
  * 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, $exportedFilename)
 {
     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_name;
     }
     $moduleGroups = RCCWP_CustomWritePanel::GetCustomGroups($panelID);
     foreach ($moduleGroups as $moduleGroup) {
         $groupFields[$moduleGroup->name]->fields = RCCWP_CustomGroup::GetCustomFields($moduleGroup->id);
         $groupFields[$moduleGroup->name]->duplicate = $moduleGroup->duplicate;
         $groupFields[$moduleGroup->name]->at_right = $moduleGroup->at_right;
     }
     $exported_data['panel'] = $writePanel;
     $exported_data['fields'] = $groupFields;
     $handle = fopen($exportedFilename, "w");
     $result = fwrite($handle, serialize($exported_data));
     @fclose($handle);
 }