<?php
/***************************************************************************
- * Copyright (C) 2003-2008 Polytechnique.org *
+ * Copyright (C) 2003-2011 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
// }}}
// {{{ constructor
- public function __construct($_title, $_description, $_end, $_mode, $_promos, $_questions, $_uid)
+ public function __construct($_title, $_description, $_end, $_mode, $_promos, $_questions, User $_user)
{
- parent::__construct($_uid, false, 'surveys');
+ parent::__construct($_user, false, 'surveys');
$this->title = $_title;
$this->description = $_description;
$this->end = $_end;
protected function _mail_body($isok)
{
+ $you_have = ($this->formal ? 'vous aviez' : 'tu avais');
if ($isok) {
- return " Le sondage que tu avais proposé vient d'être validé.";
+ return " Le sondage que $you_have proposé vient d'être validé.";
} else {
- return " Le sondage que tu avais proposé a été refusé.";
+ return " Le sondage que $you_have proposé a été refusé.";
}
}
public function commit()
{
- $sql = 'INSERT INTO survey_surveys
- SET questions={?},
- title={?},
- description={?},
- author_id={?},
- end={?},
- mode={?},
- promos={?}';
- return XDB::execute($sql, serialize($this->questions), $this->title, $this->description, $this->uid, $this->end, $this->mode, $this->promos);
+ $sql = 'INSERT INTO surveys
+ SET questions = {?}, title = {?}, description = {?},
+ uid = {?}, end = {?},mode = {?}, promos = {?}';
+ return XDB::execute($sql, serialize($this->questions), $this->title, $this->description, $this->user->id(), $this->end, $this->mode, $this->promos);
}
// }}}