PHP Method User::findAll, codiad Code Examples

This page contains top rated real world PHP examples of method User::findAll from package codiad extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: IndexAction.php Project: jerrylsxu/yiifcms
0
 public function run()
 {
     $model = new User();
     //审核状态
     $user_status = array('all' => '所有', User::STATUS_AUDIT => '待审核', User::STATUS_DISABLE => '禁用', User::STATUS_NORMAL => '正常');
     //条件
     $criteria = new CDbCriteria();
     $groupid = intval(Yii::app()->request->getParam('groupid'));
     $username = trim(Yii::app()->request->getParam('username'));
     $status = Yii::app()->request->getParam('status', 'all');
     $groupid > 0 && $criteria->addColumnCondition(array('groupid' => $groupid));
     if ($status != 'all') {
         $criteria->addSearchCondition('status', $status);
     }
     $criteria->addSearchCondition('username', $username);
     $criteria->order = 'uid ASC';
     $count = $model->count($criteria);
     //分页
     $pages = new CPagination($count);
     $pages->pageSize = 10;
     $pages->applyLimit($criteria);
     //查询
     $result = $model->findAll($criteria);
     $this->controller->render('index', array('datalist' => $result, 'pagebar' => $pages, 'status' => $status, 'user_status' => $user_status));
 }
Example #2
Show file File: MainController.php Project: crashkita/dept
0
 /**
  * Create response for fio autocomplite
  */
 public function actionSearch()
 {
     $term = $_REQUEST['term'];
     $users = User::findAll($term);
     $result = array();
     foreach ($users as $user) {
         $result[] = array('label' => $user['fio'], 'value' => $user['id']);
     }
     $this->showResponse($result);
 }
Example #3
Show file File: user_controller.php Project: pinjaliina/aanestys
0
 public static function index()
 {
     self::check_logged_in();
     $user = self::get_user_logged_in();
     if ($user->admin) {
         $users = User::findAll();
         View::make('user/index.html', array('users' => $users));
     } else {
         Redirect::to('/user/' . $user->id, array('warning' => 'Pääsy kielletty ilman ylläpito-oikeutta!'));
     }
 }
Example #4
Show file File: DbController.php Project: jellycheng/speed
0
 function actionExecute()
 {
     $user = new User();
     $username = "whoami";
     // 准备SQL,要删除username是“whoami”的家伙
     $sql = "DELETE FROM test_user WHERE username = :username";
     // 同query,execute第一个参数是SQL语句,第二个参数是绑定参数的列表
     $this->result = $user->execute($sql, array(":username" => $username));
     // execute返回参数和create等相同,即是影响行数,为0则证明没有做任何的修改
     $this->findall = $user->findAll();
     $this->display("db/execute.html");
 }
Example #5
Show file File: UserController.php Project: ReekenX/wolfcms
0
 public function index()
 {
     if (!AuthUser::hasPermission('user_view')) {
         Flash::set('error', __('You do not have permission to access the requested page!'));
         if (Setting::get('default_tab') === 'user') {
             redirect(get_url('page'));
         } else {
             redirect(get_url());
         }
     }
     $this->display('user/index', array('users' => User::findAll()));
 }
Example #6
Show file File: Top.php Project: brussens/cogear2
0
 /**
  * Render
  */
 public function render()
 {
     $users = new User();
     $users->order('Рейтинг', 'desc');
     $users->limit($this->options->limit);
     if ($result = $users->findAll()) {
         $tpl = new Template('User/templates/widgets/top');
         $tpl->users = $result;
         $this->code = $tpl->render();
     }
     return parent::render();
 }
Example #7
Show file File: MemberController.php Project: zywh/maplecity
0
 /**
  * 首页
  *
  */
 public function actionIndex()
 {
     parent::_acl();
     $model = new User();
     $criteria = new CDbCriteria();
     $criteria->order = 'id DESC';
     $count = $model->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 10;
     $criteria->limit = $pages->pageSize;
     $criteria->offset = $pages->currentPage * $pages->pageSize;
     $result = $model->findAll($criteria);
     $this->render('index', array('datalist' => $result, 'pagebar' => $pages));
 }
Example #8
Show file File: UserController.php Project: github-zjh/task
0
 /**
  * 
  * 管理员列表
  */
 public function actionAdmin()
 {
     $model = new User();
     $criteria = new CDbCriteria();
     $username = trim($this->_request->getParam('username'));
     $username && ($condition .= ' AND username LIKE \'%' . $username . '%\'');
     $criteria->condition = "status=1 AND groupid=" . $this->_adminGroupID . $condition;
     $criteria->order = 'id DESC';
     $count = $model->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 13;
     $criteria->limit = $pages->pageSize;
     $criteria->offset = $pages->currentPage * $pages->pageSize;
     $result = $model->findAll($criteria);
     $this->render('user_index', array('adminPage' => 1, 'datalist' => $result, 'pagebar' => $pages));
 }
Example #9
Show file File: message.php Project: BGCX262/ztrackerengine-svn-to-git
0
 function sendMassMessage($message, $group = 3)
 {
     if (empty($message)) {
         return false;
     }
     App::import('Model', 'User');
     $User = new User();
     $targets = $User->findAll("group_id > {$group}");
     if (!empty($targets)) {
         $message['added'] = date('Y-m-d H:i:s');
         $message['unread'] = 'yes';
         foreach ($targets as $target) {
             $message['poster'] = $target['User']['id'];
             $this->sendMessage($message, false);
         }
     }
 }
Example #10
Show file File: UserController.php Project: edderrd/Aerocal
0
 /**
  * Users list
  */
 public function listAction()
 {
     $this->_addHeadTitle("User list");
     $this->view->users = User::findAll();
 }
Example #11
Show file File: login.php Project: googlecode-mirror/timovy2007
0
 /**
  * Vrati zoznam vsetkych pouzivatel v systeme
  *
  * @param string $username
  * @return array of string array(array('userid'=>'username'), ...)
  */
 public function users()
 {
     $User = new User();
     // unbind all models
     $User->recursive = -1;
     // najdem vsetkych uzivatelov [toto moze byt dost dlhy zoznam!]
     $users = $User->findAll(null, array('id', 'username'), array('User.username ASC'));
     // prevediem na pozadovany vystupny tvar
     $output = array();
     foreach ($users as $u) {
         $output[$u['User']['id']] = $u['User']['username'];
     }
     return $output;
 }
Example #12
Show file File: AdduserdataController.php Project: svanlaere/adduserdata
0
 public function __construct()
 {
     $this->setLayout('backend');
     $this->assignToLayout('sidebar', new View('../../plugins/skeleton/views/sidebar'));
     $this->userfindAll = User::findAll();
 }
Example #13
Show file File: AdminUserController.class.php Project: chaobj001/tt
0
 public function indexAction()
 {
     $result = User::findAll();
 }
Example #14
Show file File: UserController.php Project: kimniyom/shopping_cart
0
 public function actionUserall()
 {
     $use = new User();
     $data['user'] = $use->findAll();
     $this->render("//backend/user/userall", $data);
 }
Example #15
Show file File: index.php Project: Alexandr1987/PDO
0
<?php

require_once __DIR__ . '/autoload.php';
try {
    $data = User::findAll();
    $n = new User();
    $n->DeleteById(62);
    $n->Update('5555', '63');
    //$data = User::findOne();
    //Подстановка
    //$sth= $dbh->prepare('SELECT * FROM new_news WHERE id=:id');
    //$sth->execute([':id' => 2]);
    //$sth= $dbh->prepare('SELECT count(*) FROM new_news ');
    //$sth->execute();
    //$res = $sth->fetchOne();
    //$res = $sth->fetchAll(PDO::FETCH_OBJ);
    //var_dump($res['0']['title']);
    //$res = $sth->fetchALL(PDO::FETCH_CLASS, User::class);
    //var_dump($data);
} catch (PDOException $e) {
    echo $e->getMessage();
}
echo $data['0']->avtor;
Example #16
Show file File: user.php Project: nleskiw/Graphite-Tattle
0
        try {
            $user->populate();
        } catch (fExpectedException $e) {
            fMessaging::create('error', fURL::get(), $e - getMessage());
        }
    }
    include VIEW_PATH . '/add_edit_user_settings.php';
} elseif ('delete' == $action) {
    try {
        $user = new User($user_id);
        if (fRequest::isPost()) {
            fRequest::validateCSRFToken(fRequest::get('token'));
            $user->delete();
            fMessaging::create('success', User::makeUrl('edit', $user), 'The user ' . $user->getName() . ' was successfully deleted');
            fURL::redirect(User::makeUrl('edit', $user));
        }
    } catch (fNotFoundException $e) {
        fMessaging::create('error', User::makeUrl('edit', $user), 'The line requested could not be found');
        fURL::redirect(User::makeUrl('edit', $user));
    } catch (fExpectedException $e) {
        fMessaging::create('error', fURL::get(), $e->getMessage());
    }
    include VIEW_PATH . '/delete.php';
} else {
    if (!fAuthorization::checkAuthLevel('admin')) {
        fURL::redirect(User::makeURL('edit', fSession::get('user_id')));
    } else {
        $users = User::findAll();
        include VIEW_PATH . '/list_users.php';
    }
}
Example #17
Show file File: index.php Project: crud-solutions/crud-php
0
include_once 'partials/edit.php';
?>
			<?php 
echo $messageDelete;
?>
			<table class="table table-hover">				
				<thead>
					<tr>
						<th>#</th>
						<th>Nome:</th>
						<th>E-mail:</th>
						<th>Ações:</th>
					</tr>
				</thead>				
				<?php 
foreach ($user->findAll() as $key => $value) {
    ?>
					<tbody>
						<tr>
							<td><?php 
    echo $value->id;
    ?>
</td>
							<td><?php 
    echo $value->name;
    ?>
</td>
							<td><?php 
    echo $value->email;
    ?>
</td>
Example #18
Show file File: Gear.php Project: brussens/cogear2
0
 /**
  * Autocompleter
  */
 public function autocomplete_action()
 {
     if ($query = $this->input->get('query')) {
         $user = new User();
         $this->db->like('login', $query);
         if ($users = $user->findAll()) {
             $data = array('query' => $query, 'suggestions' => array());
             foreach ($users as $user) {
                 array_push($data['suggestions'], $user->login);
             }
             die(json_encode($data));
         }
     }
 }
Example #19
Show file File: Posts.php Project: bolivarez9193/Brandons_Repo
0
<?php

require_once "models/User.php";
require_once "models/DB.php";
require_once "models/Post.php";
session_start();
if (!isset($_SESSION["user"])) {
    $user = new User();
    $user->username = "Guest";
} else {
    $user = $_SESSION["user"];
}
$posts = Post::sortByTime($dbh);
$users = User::findAll($dbh);
include_once "views/posts.php";