diff --git a/dev/skeletons/build_class_from_table.php b/dev/skeletons/build_class_from_table.php index 33c83bcc356..65b6c023b89 100755 --- a/dev/skeletons/build_class_from_table.php +++ b/dev/skeletons/build_class_from_table.php @@ -561,7 +561,7 @@ foreach ($skeletonfiles as $skeletonfile => $outfile) { if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime']) { - $varprop.="if (\$search_".$prop['field']." != '') \$params.= '&search_".$prop['field']."='.urlencode(\$search_".$prop['field']."\n);"; + $varprop.="if (\$search_".$prop['field']." != '') \$params.= '&search_".$prop['field']."='.urlencode(\$search_".$prop['field'].");\n"; } } $targetcontent=preg_replace('/'.preg_quote("if (\$search_field1 != '') \$params.= '&search_field1='.urlencode(\$search_field1);",'/').'/', $varprop, $targetcontent); @@ -619,6 +619,32 @@ foreach ($skeletonfiles as $skeletonfile => $outfile) $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field1']['checked'])) print ''.\$obj->field1.'';",'/').'/', $varprop, $targetcontent); $targetcontent=preg_replace('/'.preg_quote("if (! empty(\$arrayfields['t.field2']['checked'])) print ''.\$obj->field2.'';",'/').'/', '', $targetcontent); + // LIST_OF_TD_LABEL_FIELDS_CREATE and EDIT - List of td for card view + $varprop="\n"; + $cleanparam=''; + foreach($property as $key => $prop) + { + if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime']) + { + $varprop.="print ''.\$langs->trans(\"Field".$prop['field']."\").'';\n"; + } + } + $targetcontent=preg_replace('/LIST_OF_TD_LABEL_FIELDS_CREATE/', $varprop, $targetcontent); + $targetcontent=preg_replace('/LIST_OF_TD_LABEL_FIELDS_EDIT/', $varprop, $targetcontent); + + // LIST_OF_TD_LABEL_FIELDS_VIEW - List of td for card view + $varprop="\n"; + $cleanparam=''; + foreach($property as $key => $prop) + { + if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime']) + { + $varprop.="print ''.\$langs->trans(\"Field".$prop['field']."\").'".$prop['field']."';\n"; + } + } + $targetcontent=preg_replace('/LIST_OF_TD_LABEL_FIELDS_VIEW/', $varprop, $targetcontent); + + // Build file $fp=fopen($outfile,"w"); if ($fp) diff --git a/dev/skeletons/skeleton_card.php b/dev/skeletons/skeleton_card.php index 8b643ff3f6c..9cf6f26440c 100644 --- a/dev/skeletons/skeleton_card.php +++ b/dev/skeletons/skeleton_card.php @@ -230,7 +230,7 @@ jQuery(document).ready(function() { // Part to create if ($action == 'create') { - print load_fiche_titre($langs->trans("NewSkeleton")); + print load_fiche_titre($langs->trans("NewMyModule")); print '
'; print ''; @@ -239,10 +239,8 @@ if ($action == 'create') dol_fiche_head(); print ''."\n"; - print ''; - + // print ''; + // LIST_OF_TD_LABEL_FIELDS_CREATE print '
'.$langs->trans("Label").''; - print ''; - print '
'.$langs->trans("Label").'
'."\n"; dol_fiche_end(); @@ -258,16 +256,20 @@ if ($action == 'create') if (($id || $ref) && $action == 'edit') { print ''; - - dol_fiche_head(); - print ''; print ''; print ''; + + dol_fiche_head(); + print ''."\n"; + // print ''; + // LIST_OF_TD_LABEL_FIELDS_EDIT + print ''; + dol_fiche_end(); - print '
'; + print '
'; print ''; } @@ -279,8 +281,11 @@ if ($id && (empty($action) || $action == 'view')) { dol_fiche_head(); - - + print '
'.$langs->trans("Label").'
'."\n"; + // print ''; + // LIST_OF_TD_LABEL_FIELDS_VIEW + print ''; + dol_fiche_end(); diff --git a/dev/skeletons/skeleton_class.class.php b/dev/skeletons/skeleton_class.class.php index 2d4aea97a5f..f9ef2d39f58 100644 --- a/dev/skeletons/skeleton_class.class.php +++ b/dev/skeletons/skeleton_class.class.php @@ -426,6 +426,63 @@ class Skeleton_Class extends CommonObject } } + + /** + * Retourne le libelle du status d'un user (actif, inactif) + * + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status + */ + function getLibStatut($mode=0) + { + return $this->LibStatut($this->status,$mode); + } + + /** + * Renvoi le libelle d'un status donne + * + * @param int $status Id status + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status + */ + function LibStatut($status,$mode=0) + { + global $langs; + + if ($mode == 0) + { + $prefix=''; + if ($status == 1) return $langs->trans('Enabled'); + if ($status == 0) return $langs->trans('Disabled'); + } + if ($mode == 1) + { + if ($status == 1) return $langs->trans('Enabled'); + if ($status == 0) return $langs->trans('Disabled'); + } + if ($mode == 2) + { + if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + } + if ($mode == 3) + { + if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); + if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); + } + if ($mode == 4) + { + if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + } + if ($mode == 5) + { + if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); + if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); + } + } + + /** * Initialise object with example values * Id must be 0 if object instance is a specimen diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index e2452324d99..3018a23fdea 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -157,7 +157,7 @@ llxHeader('','MyPageName',''); $form=new Form($db); // Put here content of your page -print load_fiche_titre('PageTitle'); +$title = $langs->trans('MyModuleListTitle'); // Example : Adding jquery code print '
'.$langs->trans("Label").'