Projet

Général

Profil

Révision 59ae487e

Ajouté par Assos Assos il y a presque 7 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/ldap/ldap_views/plugins/ldap_views_plugin_query_ldap.inc
238 238
 */
239 239
    if ($result !== FALSE) { // not an error
240 240
        $entries = array_merge($entries, $result);
241
        $num_entries += array_shift($result);
241
        $num_entries += $result['count'];
242
        unset($result['count']);
242 243
      }
243 244
    }
244 245
    if (property_exists($view->query, 'limit')) {
245 246
      $limit     = $view->query->limit;
246 247
    }
247
    $offset      = $view->query->offset;
248
    $offset = property_exists($view->query, 'offset')? $view->query->offset : 0;
248 249
    $result      = array();
249 250
    $sort_fields = array();
250 251
    if (!empty($this->orderby)) {
......
269 270
            switch ($field->options['multivalue']) {
270 271
              case 'v-all':
271 272
                // remove 'count' index
272
                array_shift($entry[$alias]);
273
                unset($entry[$alias]['count']);
273 274
                $entry[$alias] = implode($field->options['value_separator'], $entry[$alias]);
274 275
                break;
275 276
              case 'v-count':
......
283 284
            }
284 285
          }
285 286
          // order criteria
287
          //If the field with alias $alias has a corresponding entry in $sort_fields, copy its value into the data key of $sort_fields for later sorting.
286 288
          if (array_key_exists($alias, $sort_fields)) {
287 289
            $sort_fields[$alias]['data'][$key] = $entry[$alias];
288 290
          }
......
305 307
      }
306 308
      $params[] = &$entries;
307 309

  
308
      // Some LDAP setups output a 'count' variable first in the array, which changes the array size;
310
      // Some LDAP setups output a 'count' variable in the array, which changes the array size;
309 311
      // temporarily remove it, sort the arrays, and then put it back.
310 312
      if (array_key_exists('count', $entries)) {
311
        $countValue = array_shift($entries); // remove the count variable
313
        $countValue = $entries['count']; // remove the count variable
314
        unset($entries['count']);
312 315
        $params[] = &$entries;
313 316
        call_user_func_array('array_multisort', $params);
314
        array_unshift($params, $countValue);
317
        $params['count'] = $countValue;
315 318
      }
316 319
      else {
317 320
        $params[] = &$entries;

Formats disponibles : Unified diff