Пример #1
0
Файл: Model.php Проект: n8b/VMN
 /**
  * Tokeninput callback
  *
  * @param string $term Query string
  * @return array
  */
 public function searchRecipients($term)
 {
     $term = sanitize_string($term);
     // replace mysql vars with escaped strings
     $q = str_replace(array('_', '%'), array('\\_', '\\%'), $term);
     $message_type = get_input('message_type', Message::TYPE_PRIVATE);
     $options = $this->getUserQueryOptions($message_type);
     $list = new ElggList($options);
     $list->setSearchQuery(array('user' => $q));
     $batch = $list->getItems();
     /* @var \ElggBatch $batch */
     $results = array();
     foreach ($batch as $b) {
         $results[] = $b;
     }
     return $results;
 }
Пример #2
0
<?php

namespace hypeJunction\Embed;

use hypeJunction\Lists\ElggList;
$options = elgg_extract('options', $vars);
$list = new ElggList($options);
$count = $list->getCount();
if (!$count) {
    echo elgg_autop(elgg_echo('embed:tab:content_items:empty'));
    return;
}
$options['count'] = false;
$files = $list->getItems();
echo elgg_view('embed/list', array('items' => $files, 'count' => $count, 'limit' => $limit, 'offset' => $offset));
Пример #3
0
 /**
  * Tokeninput callback
  *
  * @param string $term Query string
  * @return array
  */
 public function searchRecipients($term)
 {
     $term = sanitize_string($term);
     // replace mysql vars with escaped strings
     $q = str_replace(array('_', '%'), array('\\_', '\\%'), $term);
     $message_type = get_input('message_type', Message::TYPE_PRIVATE);
     $options = $this->getUserQueryOptions($message_type);
     if (Integration::isElggVersionAbove('2.1')) {
         $options['query'] = $q;
         $search_results = (array) elgg_trigger_plugin_hook('search', 'user', $options, []);
         $results = elgg_extract('entities', $search_results, []);
     } else {
         $list = new ElggList($options);
         $list->setSearchQuery(array('user' => $q));
         $batch = $list->getItems();
         /* @var \\ElggBatch $batch */
         $results = array();
         foreach ($batch as $b) {
             $results[] = $b;
         }
     }
     return $results;
 }
Пример #4
0
 /**
  * Construct a new list
  * @param array $options	Options to pass to the getter function
  */
 function __construct($options = array(), $getter = 'elgg_get_entities')
 {
     parent::__construct($options, $getter);
     $this->setLocation();
 }