コード例 #1
0
ファイル: element_resource.php プロジェクト: Albertopf/prueba
         // Alias name (commercial, trademark or alias name)
         print '<tr><td class="titelfield">' . $langs->trans('AliasNames') . '</td><td colspan="3">';
         print $socstatic->name_alias;
         print "</td></tr>";
         print '</table>';
         print '</div>';
         dol_fiche_end();
         $object = $savobject;
     }
 }
 //print load_fiche_titre($langs->trans('ResourcesLinkedToElement'),'','');
 foreach ($object->available_resources as $modresources => $resources) {
     $resources = (array) $resources;
     // To be sure $resources is an array
     foreach ($resources as $resource_obj) {
         $element_prop = getElementProperties($resource_obj);
         //print '/'.$modresources.'/class/'.$resource_obj.'.class.php<br />';
         $path = '';
         if (strpos($resource_obj, '@')) {
             $path .= '/' . $element_prop['module'];
         }
         $linked_resources = $object->getElementResources($element, $element_id, $resource_obj);
         // If we have a specific template we use it
         if (file_exists(dol_buildpath($path . '/core/tpl/resource_' . $element_prop['element'] . '_add.tpl.php'))) {
             $res = (include dol_buildpath($path . '/core/tpl/resource_' . $element_prop['element'] . '_add.tpl.php'));
         } else {
             $res = (include DOL_DOCUMENT_ROOT . '/core/tpl/resource_add.tpl.php');
         }
         //var_dump($element_id);
         if ($mode != 'add' || $resource_obj != $resource_type) {
             //print load_fiche_titre($langs->trans(ucfirst($element_prop['element']).'Singular'));
コード例 #2
0
ファイル: functions2.lib.php プロジェクト: Albertopf/prueba
/**
 * Fetch an object from its id and element_type
 * Inclusion classes is automatic
 *
 * @param	int     	$element_id 	Element id
 * @param	string  	$element_type 	Element type
 * @return 	int|object 					object || 0 || -1 if error
 */
function fetchObjectByElement($element_id, $element_type)
{
    global $conf;
    global $db, $conf;
    $element_prop = getElementProperties($element_type);
    if (is_array($element_prop) && $conf->{$element_prop['module']}->enabled) {
        dol_include_once('/' . $element_prop['classpath'] . '/' . $element_prop['classfile'] . '.class.php');
        $objectstat = new $element_prop['classname']($db);
        $ret = $objectstat->fetch($element_id);
        if ($ret >= 0) {
            return $objectstat;
        }
    }
    return 0;
}