function add($data) { if (!isset($data['course_id']) || !isset($data['user_id']) || !isset($data['request_id']) && !isset($data['plan_id'])) { throw new Exception("No data", self::NO_DATA); } $data['created'] = date('Y-m-d H:i:s', time()); return parent::add($data); }
function add($data) { if (!isset($data['question_id']) || !isset($data['training_id'])) { throw new Exception("No data", self::NO_DATA); } $db = new DB(); $db->select("SELECT * FROM {$this->tablename} WHERE question_id=\$1 AND training_id=\$2", array($data['question_id'], $data['training_id'])); if ($db->valid()) { throw new Exception("Exam exists", self::EXISTS); } return parent::add($data); }
function add($data) { if (!isset($data['name']) || !isset($data['email'])) { throw new Exception("No data", self::NO_DATA); } $db = new DB(); $db->select("SELECT * FROM {$this->tablename} WHERE name=\$1", array($data['name'])); if ($db->valid()) { throw new Exception("Trainer exists", self::EXISTS); } return parent::add($data); }
function add($data) { if (!isset($data['course_id']) || !isset($data['type_id']) || !isset($data['data']) || !isset($data['answer'])) { throw new Exception("No data", self::NO_DATA); } $db = new DB(); $db->select("SELECT * FROM {$this->tablename} WHERE data=\$1 AND type_id=\$2", array($data['data'], $data['type_id'])); if ($db->valid() && 0) { throw new Exception("Question exists", self::EXISTS); } $data['created'] = date('Y-m-d H:i:s', time()); return parent::add($data); }
function add($data) { if (!isset($data['name']) || !isset($data['category_id']) || !isset($data['format_id']) || !isset($data['language']) || !isset($data['describe'])) { throw new Exception("No data", self::NO_DATA); } $db = new DB(); $db->select("SELECT * FROM {$this->tablename} WHERE name=\$1 AND category_id=\$2 AND language=\$3", array($data['name'], $data['category_id'], $data['language'])); if ($db->valid()) { throw new Exception("Course exists", self::EXISTS); } $data['created'] = date('Y-m-d H:i:s', time()); $data['author_id'] = $_SESSION['user_id']; $data['category_name'] = $this->getCategoryName($data['category_id']); return parent::add($data); }
function add($data) { if (!isset($data['first_name']) || !isset($data['last_name']) || !isset($data['email']) || !isset($data['password']) || !isset($data['company']) || !isset($data['position']) || !isset($data['country']) || !isset($data['city']) || !isset($data['phone'])) { throw new Exception("No data", self::NO_DATA); } if (sizeof($data['password']) < 6 && $data['password'] != $data['password_confirmation']) { throw new Exception('Bad password', self::BAD_PASSWORD); } $db = new DB(); $db->select("SELECT * FROM {$this->tablename} WHERE email=\$1", array($data['email'])); if ($db->valid()) { throw new Exception("User exists", self::EXISTS); } $data['name'] = $data['last_name'] . ' ' . $data['first_name']; $data['created'] = date('Y-m-d H:i:s', time()); $data['active'] = 'true'; if (auto_user_approve == 'y') { $data['role_id'] = self::USER; } return parent::add($data); }