177 |
*/ |
*/ |
178 |
function dolibarr_fiche_head($links, $active=0, $title='') |
function dolibarr_fiche_head($links, $active=0, $title='') |
179 |
{ |
{ |
180 |
print "<!-- fiche --><div class=\"tabs\">\n"; |
print "<!-- fiche --><div class=\"tabs\">\n"; |
181 |
|
|
182 |
if (strlen($title)) |
if (strlen($title)) |
183 |
{ |
{ |
184 |
$limittitle=30; |
$limittitle=30; |
185 |
if (strlen($title) > $limittitle) print '<a class="tabTitle">'.substr($title,0,$limittitle).'...</a>'; |
if (strlen($title) > $limittitle) print '<a class="tabTitle">'.substr($title,0,$limittitle).'...</a>'; |
186 |
else print '<a class="tabTitle">'.$title.'</a>'; |
else print '<a class="tabTitle">'.$title.'</a>'; |
187 |
} |
} |
188 |
|
|
189 |
for ($i = 0 ; $i < sizeof($links) ; $i++) |
for ($i = 0 ; $i < sizeof($links) ; $i++) |
190 |
{ |
{ |
191 |
if ($links[$i][2] == 'image') |
if ($links[$i][2] == 'image') |
192 |
{ |
{ |
193 |
print '<a class="tabimage" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; |
print '<a class="tabimage" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; |
194 |
} |
} |
195 |
else |
else |
196 |
{ |
{ |
197 |
if ($i == $active) |
if ($i == $active) |
198 |
{ |
{ |
199 |
print '<a id="active" class="tab" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; |
print '<a id="active" class="tab" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; |
200 |
} |
} |
201 |
else |
else |
202 |
{ |
{ |
203 |
print '<a class="tab" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; |
print '<a class="tab" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; |
204 |
} |
} |
205 |
} |
} |
206 |
} |
} |
207 |
|
|
208 |
print "</div>\n"; |
print "</div>\n"; |
209 |
print "<div class=\"tabBar\">\n<br>\n"; |
print "<div class=\"tabBar\">\n<br>\n"; |
210 |
} |
} |
211 |
|
|
212 |
/** |
/** |
218 |
*/ |
*/ |
219 |
function dolibarr_get_const($db, $name) |
function dolibarr_get_const($db, $name) |
220 |
{ |
{ |
221 |
$value=''; |
$value=''; |
222 |
|
|
223 |
$sql ="SELECT value"; |
$sql ="SELECT value"; |
224 |
$sql.=" FROM llx_const"; |
$sql.=" FROM llx_const"; |
225 |
$sql.=" WHERE name = '$name';"; |
$sql.=" WHERE name = '$name';"; |
226 |
$resql=$db->query($sql); |
$resql=$db->query($sql); |
227 |
if ($resql) |
if ($resql) |
228 |
{ |
{ |
229 |
$obj=$db->fetch_object($resql); |
$obj=$db->fetch_object($resql); |
230 |
$value=stripslashes($obj->value); |
$value=stripslashes($obj->value); |
231 |
} |
} |
232 |
return $value; |
return $value; |
233 |
} |
} |
234 |
|
|
235 |
|
|
274 |
*/ |
*/ |
275 |
function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='') |
function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='') |
276 |
{ |
{ |
277 |
global $conf; |
global $conf; |
278 |
|
|
279 |
$db->begin(); |
$db->begin(); |
280 |
|
|
281 |
//dolibarr_syslog("dolibarr_set_const name=$name, value=$value"); |
//dolibarr_syslog("dolibarr_set_const name=$name, value=$value"); |
282 |
$sql = "DELETE FROM llx_const WHERE name = '$name';"; |
$sql = "DELETE FROM llx_const WHERE name = '$name';"; |
283 |
$resql=$db->query($sql); |
$resql=$db->query($sql); |
284 |
|
|
285 |
$sql = "INSERT INTO llx_const(name,value,type,visible,note)"; |
$sql = "INSERT INTO llx_const(name,value,type,visible,note)"; |
286 |
$sql.= " VALUES ('$name','".addslashes($value)."','$type',$visible,'".addslashes($note)."');"; |
$sql.= " VALUES ('$name','".addslashes($value)."','$type',$visible,'".addslashes($note)."');"; |
287 |
$resql=$db->query($sql); |
$resql=$db->query($sql); |
288 |
|
|
289 |
if ($resql) |
if ($resql) |
290 |
{ |
{ |
291 |
$db->commit(); |
$db->commit(); |
292 |
$conf->global->$name=$value; |
$conf->global->$name=$value; |
293 |
return 1; |
return 1; |
294 |
} |
} |
295 |
else |
else |
296 |
{ |
{ |
297 |
$db->rollback(); |
$db->rollback(); |
298 |
return -1; |
return -1; |
299 |
} |
} |
300 |
} |
} |
301 |
|
|
302 |
/** |
/** |
303 |
\brief Effacement d'une constante dans la base de données |
\brief Effacement d'une constante dans la base de données |
304 |
\see dolibarr_get_const, dolibarr_sel_const |
\see dolibarr_get_const, dolibarr_sel_const |
305 |
\param db handler d'accès base |
\param db Handler d'accès base |
306 |
\param name nom ou rowid de la constante |
\param name Nom ou rowid de la constante |
307 |
\return int 0 si KO, 1 si OK |
\return int <0 si ko, >0 si ok |
308 |
*/ |
*/ |
309 |
function dolibarr_del_const($db, $name) |
function dolibarr_del_const($db, $name) |
310 |
{ |
{ |
317 |
} |
} |
318 |
else |
else |
319 |
{ |
{ |
320 |
return 0; |
return -1; |
321 |
} |
} |
322 |
} |
} |
323 |
|
|