Пример #1
0
 public function save($isNew = false)
 {
     $idUser = $_POST["idUser"];
     //create a new database object.
     $db = new DB();
     $data = array("title" => $db->stringify($this->title), "description" => $db->stringify($this->description), "pic_url" => $db->stringify($this->pic_url), "date" => $db->stringify($this->date), "start_time" => $db->stringify($this->start_time), "duration" => $this->numeric($this->duration), "resp_name" => $db->stringify($this->resp_name), "resp_contact" => $db->stringify($this->resp_contact), "org_id" => $this->numeric($this->org_id), "proposed_org_id" => $this->numeric($this->proposed_org_id));
     //if object is already registered and we're
     //just updating their info.
     if (!$isNew) {
         //update the row in the database
         $db->update($data, 'sessions', 'id = ' . $this->id);
     } else {
         //if the user is being registered for the first time.
         $this->id = $db->insert($data, 'sessions');
         $mailSession = AuditTrail::createSession('session', $this->id, 'add new', $idUser, false);
     }
     return true;
 }