|
noalyss
Version-6.7.2
|
class for the table document_type < dt_id pk document_type < dt_value value More...
Public Member Functions | |
| document_type ($p_cn, $p_id=-1) | |
| document_type | |
| get () | |
| Get all the data for this dt_id. | |
| insert ($p_value, $p_prefix) | |
| set_number ($p_int) | |
| update () | |
| Update. | |
Static Public Member Functions | |
| static | get_list ($p_cn) |
| get a list $p_cn database connection | |
class for the table document_type < dt_id pk document_type < dt_value value
Definition at line 30 of file class_document_type.php.
| Document_type::document_type | ( | $ | p_cn, |
| $ | p_id = -1 |
||
| ) |
document_type
constructor
| $p_cn | database connx |
Definition at line 37 of file class_document_type.php.
References db.
{
$this->db = $p_cn;
$this->dt_id = $p_id;
}
Get all the data for this dt_id.
Definition at line 47 of file class_document_type.php.
References $r, $sql, db, and Database\fetch_array().
| static Document_type::get_list | ( | $ | p_cn | ) | [static] |
get a list $p_cn database connection
Definition at line 64 of file class_document_type.php.
References $array, $r, $sql, $tmp, and id.
{
$sql = "select * from document_type order by dt_value";
$r = $p_cn->get_array($sql);
$array = array();
for ($i = 0; $i < count($r); $i++)
{
$tmp['dt_value'] = $r[$i]['dt_value'];
$tmp['dt_prefix'] = $r[$i]['dt_prefix'];
$bt = new IButton('X' . $r[$i]['dt_id']);
$bt->label = _('Modifier');
$bt->javascript = "cat_doc_change('" . $r[$i]['dt_id'] . "','" . Dossier::id() . "');";
$tmp['js_mod'] = $bt->input();
$tmp['dt_id'] = $r[$i]['dt_id'];
$bt = new IButton('X' . $r[$i]['dt_id']);
$bt->label = _('Effacer');
$bt->javascript = "if (confirm('" . _('Vous confirmez') . "')==true) {";
$bt->javascript.="cat_doc_remove('" . $r[$i]['dt_id'] . "','" . Dossier::id() . "');";
$bt->javascript.='}';
$tmp['js_remove'] = $bt->input();
$array[$i] = $tmp;
}
return $array;
}
| Document_type::insert | ( | $ | p_value, |
| $ | p_prefix | ||
| ) |
Definition at line 95 of file class_document_type.php.
References $e, $sql, alert(), db, j(), and trim().
{
$sql = "insert into document_type(dt_value,dt_prefix) values ($1,$2)";
try
{
if ($this->db->count_sql('select * from document_type where upper(dt_value)=upper(trim($1))', array($p_value)) > 0)
throw new Exception('Nom en double');
if (strlen(trim($p_value)) > 0)
$this->db->exec_sql($sql, array($p_value, $p_prefix));
}
catch (Exception $e)
{
alert(j(_("Impossible d'ajouter [$p_value] ") . $e->getMessage()));
}
}
| Document_type::set_number | ( | $ | p_int | ) |
Update.
Definition at line 114 of file class_document_type.php.