Petit nouveau ! |
7 Messages
18 juil. 2005, 17:07
oui je comprends le problème c'est que je prends la suite de qq'un et le code php est rédigé comme des classes Java avec des fonctions et des constructeurs et je n'ai pas l'habitude de travailler comme ça.
voici ma fonction :
/*********************************************************
* Class: frm_affect_to_another_reporter
* Description: allow to re-affect bugs to another reporter
* @date: 12/07/2005
*********************************************************/
class frm_affect_to_another_reporter extends tpl_form {
// Nom de la classe
var $classname = "frm_affect_to_another_reporter";
// Type de l'action
var $type_action = "new";
// cible du script
var $script_target = "";
// ID de l'utilisateur
var $user_id = 0;
// Titre du formulaire
var $form_title = "";
// Tableau de valeurs
var $myvalues = array();
// Constructor
function frm_affect_to_another_reporter ($type_action, $auth) {
GLOBAL $PHP_SELF;
$this->type_action = $type_action;
$this->user_id = $auth->auth["uid"];
// If new, affect bugs to another reporter
if ($type_action == "new") {
$this->script_target = sprintf("$PHP_SELF?datatype=affect_to_another_reporter&action=update");
$this->form_title = "Re affect bugs to another reporter";
}
// If update, update the new registration/reporter as current reporter
if ($type_action == "update") {
$this->script_target =sprintf("PHP_SELF?datatype=affect_to_another_reporter&action=update");
$this->form_title = "Update new reporter";
// ici mon probleme
//connexion to the data base
$mydb = new DB_nextbug;
$query = sprintf("UPDATE bug
SET bug_reporter = %d
WHERE bug_reporter = ",$this->bug_reporter);
$mydb->query($query);
printf("<span class=txbbleu>New reporter %s updated</SPAN><BR><HR>");
}
}// end constructor
// Preparation des champs ==> construit les objets du formulaire
// Pas de parametre
function setup_fields() {
$DB_lst = new DB_nextbug;
// Construction de la boite de selection
$lst = $DB_lst->get_user_list();
$title = sprintf("Select the current reporter" );
$this->form_data->add_element(array(
"type" =>"select",
"name" =>"user_name",
"options" =>$lst,
"size" =>1 ));
$this->form_data->add_element(array(
"name" => "submit",
"type" => "image",
"src" => "image/submit.gif" ));
}//end of setup_fields
}// end class frm_affect_to_another_reporter