Esempio n. 1
0
 /**
  * overloads RoxEntityBase::insert
  *
  * @access public
  * @return int
  */
 public function insert()
 {
     $status = parent::insert();
     if ($status) {
         if (count($this->organizers) > 0) {
             // add organizers to activitiesattendees table
             foreach ($this->organizers as $organizer) {
                 $query = "INSERT INTO activitiesattendees SET activityId = " . $this->id;
                 $query .= ", attendeeId=" . $organizer['attendeeId'];
                 $query .= ", organizer=1, status=1";
                 $this->dao->query($query);
             }
         }
     }
     return $status;
 }
Esempio n. 2
0
 /**
  * overloads RoxEntityBase::insert
  *
  * @access public
  * @return int
  */
 public function insert()
 {
     $this->blog_id = $this->dao->nextId('blog');
     if ($status = parent::insert()) {
         $data = array();
         foreach ($this->blog_data_columns as $column) {
             if ($this->{$column}) {
                 $data[$column] = $this->dao->escape($this->{$column});
             }
         }
         if (!empty($data)) {
             $columns = implode(', ', array_keys($data));
             $column_data = "'" . implode("', '", $data) . "'";
             $query = "INSERT INTO blog_data (blog_id, edited, {$columns}) VALUES ({$this->getPKValue()}, NOW(), {$column_data})";
             $status = !!$this->dao->query($query);
         }
     }
     return $status;
 }