Exemplo n.º 1
0
 /**
  * Returns the study area with the specified ID.
  */
 static function find($id)
 {
     $result = NULL;
     if ($id === self::ROOT) {
         $result = self::getRootArea();
     } else {
         $result = parent::find($id);
     }
     return $result;
 }
 public static function find($user_id)
 {
     $user = parent::find(__CLASS__, $user_id);
     if (class_exists($user['contact_type'])) {
         $new_user = new $user['contact_type']();
         $new_user->setData($user->getData());
         return $new_user;
     } else {
         return $user;
     }
 }
Exemplo n.º 3
0
 /**
  * Finds a user by it's ID, but returns a class BlubberExternalContact or
  * an object of the class contact_type. If such a class exists, this means
  * that another plugin wants to handle the contact.
  * @param string $user_id
  * @return BlubberContact-object
  */
 public static function find($user_id)
 {
     $user = parent::find($user_id);
     if (class_exists($user['contact_type'])) {
         $new_user = new $user['contact_type']();
         $new_user->setData($user->toArray());
         $new_user->setNew(false);
         return $new_user;
     } else {
         return $user;
     }
 }
Exemplo n.º 4
0
 /**
  * Find a User_Visibility_Setting by an id or an identifier and a user
  * 
  * @param type $id
  */
 public static function find($id = null, $userid = null)
 {
     // If we have no id or we have a real int id use standard construction
     if (!$id || is_int($id)) {
         parent::find($id);
     } else {
         // Rewrite user if nessecary
         $userid = $userid ?: $GLOBALS['user']->id;
         // Return the first (and only) matching visibility setting
         return self::findOneBySQL('user_id = ? AND identifier = ? LIMIT 1', array($userid, $id));
     }
 }