Example #1
0
 public function load($id = '')
 {
     $db = Database::get_instance();
     if ($id == '') {
         $id = $this->id;
     }
     $query = $db->prepare("SELECT * FROM aspect_groups WHERE id=?");
     $data = array($id);
     if ($query->execute($data)) {
         extract($query->fetch());
         $this->id = $id;
         $this->group_name = $group_name;
         $this->create_date = $create_date;
         $this->update_date = $update_date;
         $query2 = $db->prepare("SELECT * FROM aspect_types_aspect_groups WHERE aspect_group =?");
         $data2 = array($this->id);
         if ($query2->execute($data2)) {
             while ($row = $query2->fetch()) {
                 $at = new AspectType();
                 $at->load($row['aspect_type']);
                 $this->aspects[] = $at;
             }
         }
         return true;
     } else {
         return false;
     }
 }
Example #2
0
 public function load($id = '')
 {
     $db = Database::get_instance();
     if ($id == '') {
         $id = $this->id;
     }
     $query = $db->prepare("SELECT * FROM aspects WHERE id=?");
     $data = array($id);
     if ($query->execute($data)) {
         extract($query->fetch());
         $this->id = $id;
         $this->aspect_type = $aspect_type;
         $this->aspect_data = $aspect_data;
         $this->aspect_binary = $aspect_binary;
         $this->predicted_accuracy = $predicted_accuracy;
         $this->create_date = $create_date;
         $this->update_date = $update_date;
         $this->aspect_notes = $aspect_notes;
         $this->aspect_source = $aspect_source;
         $this->is_hidden = $hidden;
         $this->hash = $hash;
         $this->last_parsed = $last_parsed;
         // see if the aspect type is viewable and update here.
         $viewable_type = new AspectType();
         $viewable_type->load($this->aspect_type);
         if ($viewable_type->is_viewable) {
             $this->is_hidden = false;
         } else {
             $this->is_hidden = true;
         }
         if ((int) $viewable_type->markdown == 1) {
             $this->markdown = true;
         } else {
             $this->markdown = false;
         }
         return true;
     } else {
         return false;
     }
 }