Backend\Modules\Users\Engine\Model::getUsers PHP Метод

getUsers() публичный статический Метод

Get all users
public static getUsers ( ) : array
Результат array
    public static function getUsers()
    {
        // fetch users
        $users = (array) BackendModel::getContainer()->get('database')->getPairs('SELECT i.id, s.value
             FROM users AS i
             INNER JOIN users_settings AS s ON i.id = s.user_id AND s.name = ?
             WHERE i.active = ? AND i.deleted = ?', array('nickname', 'Y', 'N'));
        // loop users & unserialize
        foreach ($users as &$value) {
            $value = unserialize($value);
        }
        // return
        return $users;
    }

Usage Example

Пример #1
0
 /**
  * Load the form
  */
 private function loadForm()
 {
     $this->imageIsAllowed = $this->get('fork.settings')->get($this->URL->getModule(), 'show_image_form', true);
     $this->frm = new BackendForm('add');
     // set hidden values
     $rbtHiddenValues[] = array('label' => BL::lbl('Hidden', $this->URL->getModule()), 'value' => 'Y');
     $rbtHiddenValues[] = array('label' => BL::lbl('Published'), 'value' => 'N');
     // get categories
     $categories = BackendBlogModel::getCategories();
     $categories['new_category'] = \SpoonFilter::ucfirst(BL::getLabel('AddCategory'));
     // create elements
     $this->frm->addText('title', null, null, 'inputText title', 'inputTextError title');
     $this->frm->addEditor('text');
     $this->frm->addEditor('introduction');
     $this->frm->addRadiobutton('hidden', $rbtHiddenValues, 'N');
     $this->frm->addCheckbox('allow_comments', $this->get('fork.settings')->get($this->getModule(), 'allow_comments', false));
     $this->frm->addDropdown('category_id', $categories, \SpoonFilter::getGetValue('category', null, null, 'int'));
     if (count($categories) != 2) {
         $this->frm->getField('category_id')->setDefaultElement('');
     }
     $this->frm->addDropdown('user_id', BackendUsersModel::getUsers(), BackendAuthentication::getUser()->getUserId());
     $this->frm->addText('tags', null, null, 'inputText tagBox', 'inputTextError tagBox');
     $this->frm->addDate('publish_on_date');
     $this->frm->addTime('publish_on_time');
     if ($this->imageIsAllowed) {
         $this->frm->addImage('image');
     }
     // meta
     $this->meta = new BackendMeta($this->frm, null, 'title', true);
 }
All Usage Examples Of Backend\Modules\Users\Engine\Model::getUsers