/**
  * Gets all objects
  *
  * @param CMS_poly_object_field $field, the reference field which will be used by those objects
  * @param boolean $sort, sort objects list (alphabetically by name). Use global $cms_language. Default false (unsorted).
  * @return array(string "CMS_object_{type}" => object CMS_object_{type})
  * @access public
  * @static
  */
 function getObjects(&$field, $sort = false)
 {
     $objectsNames = CMS_object_catalog::getObjectsNames();
     $return = array();
     foreach ($objectsNames as $anObjectName) {
         $return[$anObjectName] = new $anObjectName(array(), $field);
     }
     if ($sort) {
         global $cms_language;
         if (is_object($cms_language)) {
             $labels = array();
             foreach ($return as $key => $object) {
                 $labels[$key] = $object->getObjectLabel($cms_language);
             }
             //natural sort of objects
             natcasesort($labels);
             $returnSorted = array();
             foreach ($labels as $key => $label) {
                 $returnSorted[$key] = $return[$key];
             }
             $return = $returnSorted;
         }
     }
     return $return;
 }
if ($cms_message) {
    $dialog->setActionMessage($cms_message);
}
if ($moduleCodename) {
    $polymod = CMS_modulesCatalog::getByCodename($moduleCodename);
}
$required = $field->getValue("required") ? ' checked="checked"' : '';
$indexable = $field->getValue("indexable") ? ' checked="checked"' : '';
$searchlist = $field->getValue("searchlist") ? ' checked="checked"' : '';
$searchable = $field->getValue("searchable") ? ' checked="checked"' : '';
$polyModules = CMS_modulesCatalog::getAll("label", true);
$poly_types = array();
foreach ($polyModules as $aModule) {
    $poly_types = array_merge($poly_types, CMS_poly_object_catalog::getObjectsForModule($aModule->getCodename()));
}
$object_types = CMS_object_catalog::getObjects($field, true);
$typeObject = $field->getTypeObject(true);
$objectUseage = CMS_poly_object_catalog::getObjectUsage($object->getID());
if (is_object($typeObject) && $typeObject->hasParameters()) {
    if (is_a($typeObject, 'CMS_poly_object_definition')) {
        //need to load parameters first
        $typeObject->loadParameters($field);
    }
    $parametersHTML = $typeObject->getHTMLSubFieldsParameters($cms_language, 'type');
}
$content = '
	<table width="80%" border="0" cellpadding="3" cellspacing="2">
	<form name="frm" action="' . $_SERVER["SCRIPT_NAME"] . '" method="post">
	<input type="hidden" id="cms_action" name="cms_action" value="validate" />
	<input type="hidden" name="moduleCodename" value="' . $moduleCodename . '" />
	<input type="hidden" name="object" value="' . $object->getID() . '" />