Beispiel #1
0
 /**
  * Returns a single message object for the specified id or FALSE if not found.
  *
  * @param int The MessageID to filter to.
  */
 public function GetID($MessageID)
 {
     if (Gdn::Cache()->ActiveEnabled()) {
         return self::Messages($MessageID);
     } else {
         return parent::GetID($MessageID);
     }
 }
 /**
  * Get a particular activity record.
  *
  * @since 2.0.0
  * @access public
  * @param int $ActivityID Unique ID of activity item.
  * @return array|object A single SQL result.
  */
 public function GetID($ActivityID, $DataType = FALSE)
 {
     $Activity = parent::GetID($ActivityID, $DataType);
     if ($Activity) {
         $this->CalculateRow($Activity);
         $Activities = array($Activity);
         self::JoinUsers($Activities);
         $Activity = array_pop($Activities);
     }
     return $Activity;
 }
 public function GetID($ID, $DatasetType = DATASET_TYPE_OBJECT)
 {
     if (!$ID) {
         return FALSE;
     }
     // Check page cache, then memcached
     $User = $this->GetUserFromCache($ID, 'userid');
     // If not, query DB
     if ($User === Gdn_Cache::CACHEOP_FAILURE) {
         $User = parent::GetID($ID, DATASET_TYPE_ARRAY);
         if ($User) {
             // If success, build more data, then cache user
             $this->SetCalculatedFields($User);
             $this->UserCache($User);
         }
     }
     // Allow FALSE returns
     if ($User === FALSE || is_null($User)) {
         return FALSE;
     }
     if (is_array($User) && $DatasetType == DATASET_TYPE_OBJECT) {
         $User = (object) $User;
     }
     if (is_object($User) && $DatasetType == DATASET_TYPE_ARRAY) {
         $User = (array) $User;
     }
     $this->EventArguments['LoadedUser'] =& $User;
     $this->FireEvent('AfterGetID');
     return $User;
 }
   public function GetID($ID, $DatasetType = FALSE) {
      $User = parent::GetID($ID, $DatasetType);

      if ($User)
         $this->SetCalculatedFields($User);
      return $User;
   }
 public function GetID($ID, $DatasetType = DATASET_TYPE_OBJECT)
 {
     if (!$ID) {
         return FALSE;
     }
     // Check page cache, then memcached
     $User = $this->GetUserFromCache($ID, 'userid');
     // If not, query DB
     if ($User === Gdn_Cache::CACHEOP_FAILURE) {
         $User = parent::GetID($ID, DATASET_TYPE_ARRAY);
         // We want to cache a non-existant user no-matter what.
         if (!$User) {
             $User = NULL;
         }
         $this->UserCache($User, $ID);
     } elseif (!$User) {
         return FALSE;
     }
     // Apply calculated fields
     $this->SetCalculatedFields($User);
     // Allow FALSE returns
     if ($User === FALSE || is_null($User)) {
         return FALSE;
     }
     if (is_array($User) && $DatasetType == DATASET_TYPE_OBJECT) {
         $User = (object) $User;
     }
     if (is_object($User) && $DatasetType == DATASET_TYPE_ARRAY) {
         $User = (array) $User;
     }
     $this->EventArguments['LoadedUser'] =& $User;
     $this->FireEvent('AfterGetID');
     return $User;
 }
 /**
  * {@inheritDoc}
  * in addition; We CalculateRow on the record found (Add Attachments)
  * @see Gdn_Model::GetID
  */
 public function GetID($ID, $DatasetType = DATASET_TYPE_ARRAY, $Options = array())
 {
     $DatasetType = DATASET_TYPE_ARRAY;
     $Row = (array) parent::GetID($ID, $DatasetType, $Options);
     $this->CalculateRow($Row);
     return $Row;
 }