当前位置: 首页>>代码示例>>PHP>>正文


PHP User::fetchAll方法代码示例

本文整理汇总了PHP中User::fetchAll方法的典型用法代码示例。如果您正苦于以下问题:PHP User::fetchAll方法的具体用法?PHP User::fetchAll怎么用?PHP User::fetchAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在User的用法示例。


在下文中一共展示了User::fetchAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: exists

 public static function exists($username)
 {
     Zend_Registry::get('logger')->debug('Find matching line item');
     $users = new User();
     $where = $users->_db->quoteInto('username = ?', $username);
     $result = $users->fetchAll($where);
     return $result->exists();
 }
开发者ID:josephholsten,项目名称:swaplady,代码行数:8,代码来源:User.php

示例2: showList

 function showList()
 {
     //Списък потребители
     $user_model = new User($this->dbconn);
     $users = $user_model->fetchAll(array('filter' => ' ORDER BY id desc  ', 'values' => array()));
     $this->smarty->Assign('users', $users);
     $this->display('User/list.tpl');
 }
开发者ID:arimano,项目名称:plyloedit,代码行数:8,代码来源:UserController.php

示例3: _show_users

function _show_users()
{
    isUserLoggedIn();
    $user = new User(getdbh());
    $user_details = $user->fetchAll();
    $result['user'] = $user_details;
    $data['msg'][] = View::do_fetch(VIEW_PATH . 'afisare_user.tpl.php', $result);
    View::do_dump(VIEW_PATH . 'layout.php', $data);
}
开发者ID:laiello,项目名称:ebs-academy-at-ulbs-2014,代码行数:9,代码来源:show_users.php

示例4: _addGrupaUsers

function _addGrupaUsers($id = 0)
{
    isUserLoggedIn();
    $user = new User(getdbh());
    $getUsers = $user->fetchAll();
    $result['user'] = $getUsers;
    $result['grupaID'] = $id;
    $data['msg'][] = View::do_fetch(VIEW_PATH . 'addUserGrupa.tpl.php', $result);
    View::do_dump(VIEW_PATH . 'layout.php', $data);
}
开发者ID:laiello,项目名称:ebs-academy-at-ulbs-2014,代码行数:10,代码来源:addGrupaUsers.php

示例5: index

 function index($varnish_cashe = NULL)
 {
     //Последно регистрирани
     $user_model = new User($this->dbconn);
     $users = $user_model->fetchAll(array('filter' => ' ORDER BY id desc LIMIT 10 ', 'values' => array()));
     $this->smarty->Assign('users', $users);
     //Последно създадени дървета
     $tree_model = new Tree($this->dbconn);
     $trees = $tree_model->fetchAll(array('filter' => ' ORDER BY id desc LIMIT 10 ', 'values' => array()), 'all');
     $this->smarty->Assign('trees', $trees);
     $this->display('Main/main.tpl');
 }
开发者ID:arimano,项目名称:plyloedit,代码行数:12,代码来源:MainController.php

示例6: buildSQl

 protected function buildSQl()
 {
     $select = $this->dbModelTable->select();
     $user = new User();
     if (isset($this->filterdata['deleg_no']) and !empty($this->filterdata['deleg_no'])) {
         $select->where('deleg_no = ?', $this->filterdata['deleg_no']);
     }
     if (isset($this->filterdata['employee']) and !empty($this->filterdata['employee'])) {
         $tetaId = $user->findOne($this->filterdata['employee'])->teta_id;
         $select->where('teta_id = ?', $tetaId);
     } else {
         if (isset($this->filterdata['branch']) and !empty($this->filterdata['branch'])) {
             $userRowset = $user->fetchAll('id_branch = ' . $this->filterdata['branch']);
             $inStmt = array();
             foreach ($userRowset as $row) {
                 $inStmt[] = $row->teta_id;
             }
             $select->where('teta_id IN (?)', $inStmt);
         }
     }
     return $select->__toString();
 }
开发者ID:knatorski,项目名称:SMS,代码行数:22,代码来源:Searcher.php

示例7: indexAction

 /**
  * The default action - show the home page
  */
 public function indexAction()
 {
     $method = $this->getRequest()->getMethod();
     $view = $this->initView();
     $callback = $this->getRequest()->getParam('callback');
     $id = $this->getRequest()->getParam('id');
     $date = $this->getRequest()->getParam('date');
     if ($method == 'GET') {
         $user = new User();
         if ($id) {
             $s = 'id';
             if (!is_numeric($id)) {
                 $s = 'login';
             }
             $row = $user->fetchRow($user->select()->where($s . ' = ?', $id));
             if (is_null($row)) {
                 /* 404 Not Found */
                 $this->getResponse()->setHttpResponseCode(404);
             } else {
                 $response = Zend_Json_Encoder::encode($row->toArray());
             }
         } else {
             $rows = $user->fetchAll();
             $users = $rows->toArray();
             if ($users == 0) {
                 /* 404 Not Found */
                 $this->getResponse()->setHttpResponseCode(404);
             } else {
                 /*foreach ($users as &$u) {
                 			$u['teste'] = $id.' - '.$date;
                 		}*/
                 $response = Zend_Json_Encoder::encode($users);
             }
         }
         if ($callback) {
             $response = $callback . "(" . $response . ")";
         }
         $view->json = $response;
         $this->render('json');
     } elseif ($method == 'POST') {
         //$user = Zend_Json_Decoder::decode($this->getRequest()->getParam('user'));
         $t = $this->getRequest()->getRawBody();
         $temp = Zend_Json_Decoder::decode($t, Zend_Json::TYPE_ARRAY);
         $user = new User();
         try {
             $l = Zend_Json_Decoder::decode($t, Zend_Json::TYPE_OBJECT)->login;
             $verified = $user->fetchRow($user->select()->where('login = ?', $l));
             if ($verified->id == 0) {
                 $inserted = $user->insert($temp);
                 $response = $inserted;
                 //$user['name'];
             } else {
                 /* 409 Conflict */
                 $this->getResponse()->setHttpResponseCode(409);
             }
         } catch (Exception $e) {
             $response = $e->getMessage();
         }
         if ($callback) {
             $response = $callback . "(" . $response . ")";
         }
         $view->json = $response;
         $this->render('json');
     } elseif ($method == 'DELETE') {
     } elseif ($method == 'PUT') {
     } else {
         /* 405 Method Not Allowed */
         $this->getResponse()->setHttpResponseCode(405);
     }
 }
开发者ID:laiello,项目名称:workout,代码行数:73,代码来源:WorkoutController.php

示例8: attendeesAction

 function attendeesAction()
 {
     $userTbl = new User();
     // Put the session in the view
     $this->session->putInView($this->view);
     // Check whther an export is required
     if (isset($_REQUEST['export_action'])) {
         $exportRequired = true;
         $exportType = $_REQUEST['export_action'];
     } else {
         $exportRequired = false;
     }
     // load the template
     if (!$exportRequired) {
         $this->view->set_file("content", "attendees.xml");
     } else {
         if ($exportType == Config::EXPORT_EXCEL) {
             $this->view->setFile("content", "attendees_xls.xml");
             $mimeType = "text/xls";
             $exportName = "attendees.xls";
         } else {
             // Default: HTML
             $this->view->setFile("content", "attendees_html.xml");
             $mimeType = "text/plain";
             $exportName = "attendees.html";
         }
     }
     /* Select all the users and list them.
        First extract the 'block' describing a line from the template */
     $this->view->set_block("content", "ATTENDEE", "ATTENDEES");
     $this->view->set_block("content", "GROUPS_LINKS", "LINKS");
     if (isset($_REQUEST['remove'])) {
         $idUser = $this->getRequest()->getParam('id_user');
         // instantiate a PaperRow object. Ok, not elegant, but easier
         $user = $userTbl->find($idUser)->current();
         $user->delete();
     }
     if (isset($_REQUEST['confirm_payment'])) {
         $idUser = $this->getRequest()->getParam('id_user');
         // instantiate a PaperRow object. Ok, not elegant, but easier
         $user = $userTbl->find($idUser)->current();
         $user->payment_received = 'Y';
         $user->save();
     }
     $nbAttendees = 0;
     // Initialize the current interval
     if (!isset($_REQUEST['iMin'])) {
         $iMinCur = 1;
         $iMaxCur = self::SIZE_ATTENDEES_GROUP;
     } else {
         $iMinCur = $_REQUEST['iMin'];
         $iMaxCur = $_REQUEST['iMax'];
     }
     // Export? No group.
     if ($exportRequired) {
         $iMinCur = 0;
         $iMaxCur = 999999999;
     }
     // Get all the attendees, ordered by last name
     $userTbl = new User();
     $users = $userTbl->fetchAll(" roles LIKE '%P%'", "last_name");
     $this->view->mailType = Mail::SOME_USER;
     $i = 0;
     foreach ($users as $user) {
         $i++;
         if ($i >= $iMinCur and $i <= $iMaxCur) {
             // Choose the CSS class
             $this->view->css_class = Config::CssCLass($i);
             $user->putInView($this->view);
             $this->view->choices = "";
             // Get the answer to open questions
             $rAnswers = $this->zmax_context->db->query("SELECT * FROM RegAnswer a, RegQuestion q, " . " RegChoice c WHERE a.id_question = q.id and a.id_user='{$user->id}' " . " AND a.id_answer=c.id_choice AND c.id_question=q.id");
             while ($answer = $rAnswers->fetch(Zend_Db::FETCH_OBJ)) {
                 $this->view->choices .= "{$answer->question_code}: {$answer->choice}; ";
             }
             $this->view->append("ATTENDEES", "ATTENDEE");
         }
     }
     // Export if required
     if ($exportRequired) {
         $this->view->assign("export", "content");
         $this->exportFile($exportName, $mimeType, $this->view->export);
         return;
     }
     // Create the groups
     $nbAttendees = $i;
     $nb_groups = $nbAttendees / self::SIZE_ATTENDEES_GROUP + 1;
     for ($i = 1; $i <= $nb_groups; $i++) {
         $iMin = ($i - 1) * self::SIZE_ATTENDEES_GROUP + 1;
         if ($iMin >= $iMinCur and $iMin <= $iMaxCur) {
             $link = "<font color=red>{$i}</font>";
         } else {
             $link = $i;
         }
         $this->view->set_var("LINK", $link);
         $this->view->set_var("IMIN_VALUE", $iMin);
         $this->view->set_var("IMAX_VALUE", $iMin + self::SIZE_ATTENDEES_GROUP - 1);
         $this->view->append("LINKS", "GROUPS_LINKS");
     }
     $this->view->nb_attendees = $nbAttendees;
//.........这里部分代码省略.........
开发者ID:camilorivera,项目名称:INNOVARE,代码行数:101,代码来源:ProgramController.php

示例9: User

} else {
    echo "\n\nParametr app_env jest wymagany!";
    echo "\n\n" . $opts->getUsageMessage() . "\n\n";
    exit;
}
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
Base_Controller_Action_Helper_Currentip::$_unitTestEnabled = true;
$application->bootstrap();
$application->getBootstrap()->runForCmd();
Zend_Controller_Front::getInstance()->setParam('bootstrap', $application->getBootstrap());
Zend_registry::set('config', $application->getOptions());
$user = $application->getOption('bin');
$u = new User();
$u_data = $u->fetchAll("login = '" . $user['user'] . "'", "id DESC", 1);
if (null == $u_data) {
    throw new Exception('Brak użytkownika o podanym ID');
}
$u_data = $u_data->toArray();
$storageRow = new stdClass();
foreach ($u_data[0] as $key => $value) {
    $storageRow->{$key} = $value;
}
$auth = Zend_Auth::getInstance();
$storage = $auth->getStorage();
$o = new Branch();
$data = $o->fetchAll("branch_name = '" . $user['branch'] . "'", "id DESC", 1)->toArray();
$storageRow->jednostka = $data[0];
$storage->write($storageRow);
开发者ID:knatorski,项目名称:SMS,代码行数:31,代码来源:init.php

示例10: getACLs

 /**
  * Called by ITechController
  * To view ACLs in an action function use Zend_Auth::getInstance()->getIdentity()->acls; or ITechController::_getACLs();
  */
 public static function getACLs($user_id)
 {
     $rtn = array();
     if ($user_id) {
         $userTable = new User();
         $select = $userTable->select()->setIntegrityCheck(false);
         $select->join(array('uacl' => 'user_to_acl'), 'uacl.user_id = user.id', 'uacl.acl_id');
         $select->where('uacl.user_id = ?', $user_id);
         $rowset = $userTable->fetchAll($select);
         foreach ($rowset as $row) {
             $rtn[] = $row->acl_id;
         }
     }
     return $rtn;
 }
开发者ID:falafflepotatoe,项目名称:trainsmart-code,代码行数:19,代码来源:User.php

示例11: deleter

 /**
  * Metoda dla crona do stosowania zaplanowanych blokad użytkowników
  * @return array
  */
 public function deleter()
 {
     $userModel = new User();
     $exceptions = array();
     try {
         $select = $userModel->select()->where('timelock_start IS NOT NULL')->where('timelock_start <= ?', new Zend_Db_Expr('NOW()'))->where('ghost = ?', 'f');
         $users = $userModel->fetchAll($select);
         foreach ($users as $user) {
             $user->ghost = true;
             $user->is_locked = true;
             $user->save();
         }
     } catch (Exception $e) {
         $exceptions[] = $e;
     }
     return $exceptions;
 }
开发者ID:knatorski,项目名称:SMS,代码行数:21,代码来源:User.php

示例12: die

 * @property int     $age
 *
 * @method static User[] fetchAll(array $cond = null, array $sort = null, $count = null, $offset = null, $hint = NULL)
 * @method static User|null fetchOne(array $cond = null, array $sort = null)
 * @method static User fetchObject(array $cond = null, array $sort = null)
 */
class User extends Mongostar_Model
{
}
$newUser = User::fetchObject(array('id' => null));
echo $newUser->name . "<br>";
die("lsjdlksj");
if (rand(0, 1)) {
    // User::remove();
}
$user = User::fetchOne(array('id' => '54de8e1e9cd81ebf330041bc'));
echo $user->name . "<br>";
$user->name = "User_name - " . rand(1000, 9999);
$user->save();
$user = User::fetchOne(array('id' => '54de8e1e9cd81ebf330041bc'));
echo $user->name . "<br>";
die;
$user->name = "Name: " . rand(1000, 9999);
$user->save();
echo "last name: " . $user->name . "<br/>";
$user->name = "Name-edited";
$user->save();
foreach (User::fetchAll() as $user) {
    echo $user->id . ' - ' . $user->name . "<br>";
}
echo "count: " . User::getCount() . "<br>";
开发者ID:execrot,项目名称:mongostar,代码行数:31,代码来源:index.php

示例13: myresetpasswordAction

 public function myresetpasswordAction()
 {
     //check GUID param with database
     //remove all elements, only password and repeat stays
     $this->form = new User_Form_Edit();
     $elems = $this->form->getElements();
     foreach ($elems as $elem) {
         if (!($elem->getName() == User::COL_PASSWORD || $elem->getName() == User_Form_Edit::PASSWORD_CLONE || $elem->getName() == 'submit' || $elem->getName() == User::COL_GUID)) {
             $this->form->removeElement($elem->getName());
         }
     }
     if ($this->getRequest()->isPost()) {
         if ($this->form->isValid($this->getRequest()->getParams())) {
             //update password
             $pass = $this->form->getValue(User::COL_PASSWORD);
             if ($pass != $this->getRequest()->getParam(User_Form_Edit::PASSWORD_CLONE)) {
                 $element = $this->form->getElement(User_Form_Edit::PASSWORD_CLONE);
                 $element->addError("Error: Your password and the repeating don't match.");
                 $this->form->markAsError();
                 return $this->render('form');
             }
             /*
             credit: http://www.geekzilla.co.uk/view8AD536EF-BC0D-427F-9F15-3A1BC663848E.htm
             Author  	: Paul Hayman
             Published 	: 14 June 2006
             */
             $regexStringGuid = "^(\\{{0,1}([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}\\}{0,1})\$^";
             $vali = new Zend_Validate_Regex($regexStringGuid);
             $userGuid = $this->getRequest()->getParam(User::COL_GUID);
             if ($vali->isValid($userGuid)) {
                 $user = new User();
                 $select = $user->select();
                 $where = $user->getAdapter()->quoteInto(User::COL_GUID . ' = ?', $userGuid, 'string');
                 $select->where($where);
                 $rowset = $user->fetchAll($select);
                 if ($rowset->count() == 1) {
                     $data = array(User::COL_PASSWORD => "{SHA}" . base64_encode(pack("H*", sha1($pass))), User::COL_GUID => null);
                     try {
                         $user->update($data, $where);
                     } catch (Exception $e) {
                         throw new Exception('Error: Password was not changed' . $e->getMessage());
                     }
                 } else {
                     //no or too much users with this GUID!
                     //TODO log in IDS?
                 }
             } else {
                 //param != GUID
                 //TODO log in IDS?
             }
             $this->view->message = 'password was changed';
             $this->render('message');
         } else {
             //not valid
             $this->render('form');
         }
     } else {
         //not post
         $userGuid = $this->getRequest()->getParam(User::COL_GUID);
         $this->form->setValues(array(User::COL_GUID => $userGuid));
         $this->view->form = $this->form;
         $this->render('form');
     }
 }
开发者ID:blackskaarj,项目名称:webgr,代码行数:64,代码来源:ForgotpasswordController.php

示例14: User

<?php

session_start();
require_once "../lib/config.inc.php";
require_once "../lib/classes/Admin.php";
require_once "../lib/classes/User.php";
require_once "../lib/functions.inc.php";
require_once "../lib/pagingClass.php";
$UserObj = new User();
$adminObj = new Admin();
$adminObj->validateAdmin();
$UserList = $UserObj->fetchAll($_GET);
$pagingObj = new PagingClass2($obj->NumRows($UserObj->fetchAllUsers()), 10);
// user want to change status as Active or Inactive
if (isset($_GET['uid']) && $_GET['uid'] != null && (isset($_GET['q']) && $_GET['q'] == 'trash')) {
    $UserObj->statusRemove(intval($_GET['uid']));
}
// when user want to remove and transfer in trash
if (isset($_POST['uid']) && $_POST['uid'] != null && (isset($_POST['action']) && $_POST['action'] != null)) {
    $result = $UserObj->modifyStatus($_POST);
    echo $result;
    die;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//Dtd XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/Dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico"><link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico"><link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php 
开发者ID:Aksaxena,项目名称:mlm,代码行数:31,代码来源:user.php

示例15: usersAction


//.........这里部分代码省略.........
         } else {
             // Default: HTML
             $this->view->setFile("content", "members_html.xml");
             $mimeType = "text/plain";
             $exportName = "members.html";
         }
     }
     // After submission, insert
     if (isset($_REQUEST['id_user'])) {
         $idUser = $request->getParam("id_user");
         if (!isset($_POST['form_mode'])) {
             // The user exists. It must be modified or removed
             $instr = $request->getParam("instr");
             $userRow = $user->find($idUser)->current();
             if ($instr == "modify") {
                 // Just show the form with default values
                 $this->view->pcmember_message = "Modify user infos";
                 $this->view->form_action = $texts->form->update;
                 $this->view->form_mode = "update";
                 $userRow->putInView($this->view);
             } else {
                 if ($instr == "remove") {
                     $this->view->pcmember_message = "User {$email} has been removed";
                     $this->view->form_action = $texts->form->insert;
                     $this->view->form_mode = "insert";
                     $userRow->delete();
                     // Create a new user for insertion
                     $userRow = $user->createRow();
                     $userRow->roles = User::REVIEWER_ROLE;
                     $userRow->putInView($this->view);
                 }
             }
         } else {
             // Data comes from the form
             $form_mode = $request->getParam("form_mode");
             if ($form_mode == "insert") {
                 $userRow = $user->createRow();
             } else {
                 $userRow = $user->find($idUser)->current();
             }
             $this->view->form_action = $texts->form->update;
             $userRow->email = $_POST['email'];
             $userRow->first_name = $_POST['first_name'];
             $userRow->last_name = $_POST['last_name'];
             if (isset($_POST['topics'])) {
                 $userRow->setTopicsFromArray($_POST['topics']);
             }
             if (isset($_POST['roles'])) {
                 $userRow->setRolesFromArray($_POST['roles']);
             }
             $messages = $userRow->checkValues($this->zmax_context->texts, array("affiliation", "address", "city", "zip_code"));
             // Any error ?
             if (count($messages) > 0) {
                 $this->view->setFile("error", "error.xml");
                 $this->view->setBlock("error", "ERROR", "ERRORS");
                 foreach ($messages as $message) {
                     $this->view->message = $message;
                     $this->view->append("ERRORS", "ERROR");
                 }
                 $this->view->assign("pcmember_message", "ERRORS");
                 $this->view->form_mode = $form_mode;
             } else {
                 /* Everything is OK. Save and display the form with the user */
                 $userRow->save();
                 $this->view->assign("pcmember_message", "post_message");
             }
             // Always put the current data in the view
             $userRow->putInView($this->view);
         }
     } else {
         /* Display the form with an empty user*/
         $this->view->pcmember_message = "";
         $this->view->form_action = $texts->form->insert;
         $this->view->form_mode = "insert";
         $userRow = $user->createRow();
         $userRow->roles = User::REVIEWER_ROLE;
         $userRow->putInView($this->view);
     }
     // We are ready to instantiate the form
     $this->view->form_reviewer = $userRow->form($this->view, "form_reviewer.xml");
     $this->view->someUser = Mail::SOME_USER;
     /* Select all the members and list them.
     		 First extract the 'block' describing a line from the template */
     $this->view->setBlock("content", "MEMBER", "MEMBERS");
     $pcmembers = $user->fetchAll("{$mailCriteria} AND {$nameCriteria} AND ({$filterRolesList})", 'last_name');
     $i = 0;
     foreach ($pcmembers as $member) {
         $member->putInView($this->view);
         // Choose the CSS class
         $this->view->css_class = Config::CssCLass($i++);
         $this->view->append("MEMBERS", "MEMBER");
     }
     if ($exportRequired) {
         $this->view->assign("export", "content");
         $this->exportFile($exportName, $mimeType, $this->view->export);
         return;
     }
     // Show the view
     echo $this->view->render("layout");
 }
开发者ID:camilorivera,项目名称:INNOVARE,代码行数:101,代码来源:ConfigController.php


注:本文中的User::fetchAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。