Exemplo n.º 1
0
}
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() . '" />
	<input type="hidden" name="field" value="' . $field->getID() . '" />
	<tr>
 /**
  * is this object a secondary resource ?
  * Note : even if this object is declared as a secondary resource, object must be directly attached to a primary resource,
  * else it is not a secondary resource
  *
  * @param boolean $dontCheckForPrimaryResourceAttachment : do not check for a primary resource attachement, consider it is already checked somewhere else.
  * @return boolean
  * @access public
  */
 function isSecondaryResource($dontCheckForPrimaryResourceAttachment = false)
 {
     if ($dontCheckForPrimaryResourceAttachment) {
         return $this->getValue("resourceUsage") == 2 ? true : false;
     }
     if ($this->getValue("resourceUsage") != 2) {
         return false;
     } else {
         //check for objects which use this one to see if one of them is a primary resource
         $objectsWhichUseObject = CMS_poly_object_catalog::getObjectUsage($this->getID(), true);
         if (!$objectsWhichUseObject) {
             return false;
         }
         foreach ($objectsWhichUseObject as $anObjectWhichUseObject) {
             if ($anObjectWhichUseObject->isPrimaryResource()) {
                 return true;
             }
         }
     }
     return false;
 }