<?php
/***************************************************************************
- * Copyright (C) 2003-2007 Polytechnique.org *
+ * Copyright (C) 2003-2010 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;
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);
}
// }}}