Exemplo n.º 1
0
 public static function GetByAssoc($values)
 {
     $item = new DashboardPost();
     $item->ID = $values["post_ID"];
     $item->TargetUser = User::GetByID($values["post_TargetUserID"]);
     $item->Title = $values["post_Title"];
     $item->Content = $values["post_Content"];
     $item->Type = PostType::GetByID($values["post_PostTypeID"]);
     $item->CreationUser = User::GetByID($values["post_CreationUserID"]);
     $item->CreationTimestamp = $values["post_CreationTimestamp"];
     $item->AllowLike = $values["post_AllowLike"] == 1;
     $item->AllowComment = $values["post_AllowComment"] == 1;
     $item->AllowShare = $values["post_AllowShare"] == 1;
     return $item;
 }
Exemplo n.º 2
0
 public static function GetByID($id)
 {
     if (!is_numeric($id)) {
         return null;
     }
     global $MySQL;
     $query = "SELECT * FROM " . System::$Configuration["Database.TablePrefix"] . "PostTypes WHERE posttype_ID = " . $id;
     $retval = array();
     $result = $MySQL->query($query);
     if ($result === false) {
         return $retval;
     }
     $count = $result->num_rows;
     if ($count < 1) {
         return null;
     }
     $values = $result->fetch_assoc();
     return PostType::GetByAssoc($values);
 }