예제 #1
0
 public static function loadObjectForUser(DatabaseObject $object, $user_id, $object_id, $databaseColumn, $options = array())
 {
     $userId = (int) $user_id;
     $productId = (int) $object_id;
     if ($options['status'] = 'ALL') {
         $statusQuery = '';
     } else {
         $statusQuery = ' and status="L" ';
     }
     if ($userId <= 0 || $productId <= 0) {
         return;
     }
     if ($databaseColumn == 'individual_dues_key') {
         $userIdColumn = 'clubAdmin_id';
     } else {
         $userIdColumn = 'user_id';
     }
     $query = sprintf('select %s from %s where ' . $userIdColumn . ' = %d and %s = %d' . $statusQuery . ' ', join(', ', $object->getSelectFields()), $object->_table, $userId, $databaseColumn, $productId);
     echo "<br/>query is: " . $query;
     return $object->_load($query);
 }