本文整理汇总了PHP中UserModel::findAll方法的典型用法代码示例。如果您正苦于以下问题:PHP UserModel::findAll方法的具体用法?PHP UserModel::findAll怎么用?PHP UserModel::findAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserModel
的用法示例。
在下文中一共展示了UserModel::findAll方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
function show()
{
$userModel = new UserModel();
$goods_info = $userModel->findAll();
$test = 'Hello World';
$this->display('test.tpl', array("test" => $test, 'goods_info' => $goods_info));
}
示例2: indexAction
public function indexAction()
{
CApp::setTitle(CApp::getAppName() . " | " . CApp::getTranslate('allUsers'));
if ($_SESSION["userRole"] == CApp::settings("USER_ROLES")->ADMIN) {
$model = new UserModel();
$arrResult = $model->findAll();
$this->render("viewList", "user", $arrResult);
} else {
CApp::redirect("/");
}
}
示例3: findAllUsers
/**
* Get all users.
*
* @return \UserModel[]
*/
public function findAllUsers()
{
$collection = \UserModel::findAll(array('order' => 'name'));
if (!$collection) {
return array();
}
$users = array();
foreach ($collection as $user) {
$users[] = $user;
}
return $users;
}
示例4: execute
/**
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @return int|void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->detectContao($output, true);
if ($this->initContao()) {
$userList = \UserModel::findAll();
$table = array();
foreach ($userList as $user) {
$table[] = array($user->id, $user->username, $user->email, $user->locked == 0 ? 'open' : date('Y-m-d H:i:s', $user->locked));
}
$this->getHelper('table')->setHeaders(array('id', 'username', 'email', 'locked'))->renderByFormat($output, $table, $input->getOption('format'));
}
}