コード例 #1
0
ファイル: UserControl.php プロジェクト: ShuiMuQinHua/YmPHP
 function show()
 {
     $userModel = new UserModel();
     $goods_info = $userModel->findAll();
     $test = 'Hello World';
     $this->display('test.tpl', array("test" => $test, 'goods_info' => $goods_info));
 }
コード例 #2
0
ファイル: UserController.php プロジェクト: ennjamusic/study
 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
0
 /**
  * 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
0
 /**
  * @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'));
     }
 }