本文整理汇总了PHP中Default_Model_Users::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Default_Model_Users::find方法的具体用法?PHP Default_Model_Users::find怎么用?PHP Default_Model_Users::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Default_Model_Users
的用法示例。
在下文中一共展示了Default_Model_Users::find方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editPasswordAction
public function editPasswordAction()
{
$account = new Default_Model_Users();
$account->find(Zend_Registry::get('user')->getId());
$form = new Default_Form_EditPassword();
$form->editPassword();
$form->setDecorators(array('ViewScript', array('ViewScript', array('viewScript' => 'forms/users/edit-password.phtml'))));
$this->view->form = $form;
if ($this->getRequest()->isPost()) {
if ($form->isValid($this->getRequest()->getPost())) {
$post = $this->getRequest()->getPost();
if (md5($post['oldPassword']) == $account->getPassword()) {
$account->setPassword(md5($post['password']));
if ($account->save()) {
$this->_flashMessenger->addMessage("<div class='success canhide'><p>" . Zend_Registry::get('translate')->_('password_change_success_message') . "</p><a href='javascript:;'></a></div>");
} else {
$this->_flashMessenger->addMessage("<div class='failure canhide'><p>" . Zend_Registry::get('translate')->_('administrators_edit_password_error_message') . "</p><a href='javascript:;'></a></div>");
}
} else {
$this->_flashMessenger->addMessage("<div class='failure canhide'><p>" . Zend_Registry::get('translate')->_('administrators_invalid_old_password') . "</p><a href='javascript:;'></a></div>");
}
$this->_redirect(WEBROOT . 'settings/edit-password');
}
}
}
示例2: loginAction
public function loginAction()
{
$form = new Default_Form_Login();
$form->setDecorators(array('ViewScript', array('ViewScript', array('viewScript' => 'forms/login.phtml'))));
$this->view->form = $form;
if ($this->getRequest()->isPost()) {
if ($form->isValid($this->getRequest()->getPost())) {
$dbAdapter = new Zend_Auth_Adapter_DbTable($this->db, 'users', 'email', 'password', 'MD5(?) AND deleted = "0"');
$dbAdapter->setIdentity($this->getRequest()->getPost('tbUser'))->setCredential($this->getRequest()->getPost('tbPass'));
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($dbAdapter);
if (!$result->isValid()) {
switch ($result->getCode()) {
case Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND:
case Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID:
$this->_flashMessenger->addMessage("<div class='error canhide'><p>Incorrect email or password!<a href='javascript:;'>Close</a><p>/div>");
break;
default:
/** do stuff for other failure **/
$this->_flashMessenger->addMessage("<div class='error canhide'><p>Incorrect email or password!<a href='javascript:;'>Close</a></p>/div>");
break;
}
} else {
$adminUserId = $dbAdapter->getResultRowObject();
$adminUser = new Default_Model_Users();
$adminUser->find($adminUserId->id);
if ($adminUser->getStatus() == 0) {
$this->_flashMessenger->addMessage("<div class='error canhide'><p>Your account was not confirmed! Please check your email for the confirmation email!<a href='javascript:;'>Close</a></p></div>");
$auth->clearIdentity();
} else {
$storage = $auth->getStorage();
$adminUser->saveLastlogin();
$storage->write($adminUser);
}
}
$this->_redirect('/auth/login/');
}
}
}
示例3: delete
public function delete(Default_Model_Role $value)
{
$auth = Zend_Auth::getInstance();
$authAccount = $auth->getStorage()->read();
if (null != $authAccount) {
if (null != $authAccount->getId()) {
$user = new Default_Model_Users();
$user->find($authAccount->getId());
$id = $value->getId();
$data = array('deleted' => '1');
$this->getDbTable()->update($data, array('id = ?' => $id));
return $id;
}
}
}
示例4: setIdUserTo
public function setIdUserTo($value)
{
$model = new Default_Model_Users();
$model->find($value);
if ($model->getId() != NULL) {
$this->setUserTo($model);
}
$this->_idUserTo = !empty($value) ? (int) $value : '0';
return $this;
}
示例5: editPasswordAction
public function editPasswordAction()
{
$accountId = new Default_Model_Users();
$accountId->find(Zend_Registry::get('user')->getId());
$form = new Default_Form_EditPassword();
$form->editUserPassword();
$form->setDecorators(array('ViewScript', array('ViewScript', array('viewScript' => 'forms/users/edit-password.phtml'))));
$this->view->form = $form;
if ($this->getRequest()->isPost()) {
if ($form->isValid($this->getRequest()->getPost())) {
$post = $this->getRequest()->getPost();
if ($accountId->getPassword()) {
$accountId->setPassword(md5($post['password']));
if ($accountId->save()) {
$this->_flashMessenger->addMessage("<div class='success canhide'><p>Password successfully changed!<a href='javascript:;'>Close</a></p></div>");
} else {
$this->_flashMessenger->addMessage("<div class='failure canhide'><p>Password was not changed!<a href='javascript:;'>Close</a></p></div>");
}
} else {
$this->_flashMessenger->addMessage("<div class='failure canhide'><p>Invalid old password!<a href='javascript:;'>Close</a></p></div>");
}
$this->_redirect('users');
}
}
}
示例6: editAction
public function editAction()
{
$auth = Zend_Auth::getInstance();
$authAccount = $auth->getStorage()->read();
if (null != $authAccount) {
if (null != $authAccount->getId()) {
$user = new Default_Model_Users();
$user->find($authAccount->getId());
}
}
$id = $this->getRequest()->getParam('id');
/*$hasAccess = Needs_Roles::hasAccess(Zend_Registry::get('user')->getIdRole(),'adaugare_proiect');
if(!$hasAccess)
{
$this->_redirect(WEBROOT.'products');
}*/
$model = new Default_Model_RecurrentExpenses();
if ($model->find($id)) {
$form = new Default_Form_RecurrentExpenses();
$form->edit($model);
$form->setDecorators(array('ViewScript', array('ViewScript', array('viewScript' => 'forms/recurrent-expenses/edit-expense.phtml'))));
$this->view->form = $form;
if ($this->getRequest()->isPost()) {
if ($this->getRequest()->getPost('submit')) {
if ($form->isValid($this->getRequest()->getPost())) {
$oldDate = $model->getDate();
$post = $this->getRequest()->getPost();
$model->setOptions($form->getValues());
$model->setDate(date("Y-m-d", strtotime($post["date"])));
if ($oldDate != date("Y-m-d", strtotime($post["date"]))) {
$model->setDatePaid();
}
$model->setType('0');
if ($expenseId = $model->save()) {
if (!empty($post['galleryFiles']) && is_array($post['galleryFiles'])) {
foreach ($post['galleryFiles'] as $valuesGallery) {
$tmpFiles = new Default_Model_TempFiles();
if ($tmpFiles->find($valuesGallery)) {
$post = $this->getRequest()->getPost();
$gallery = new Default_Model_FileManager();
$gallery->setOptions($form->getValues());
$gallery->setType($tmpFiles->getFileType());
$gallery->setSize($tmpFiles->getFileSize());
$gallery->setModule('sharedfiles');
$gallery->setIdMessage($expenseId);
$gallery->setIdUser(1);
$gallery->setName($tmpFiles->getFileName());
$savedId = $gallery->save();
if ($savedId) {
$shared = new Default_Model_SharedList();
$shared->setIdUser(Zend_Registry::get('user')->getId());
$shared->setIdFile($savedId);
$shared->save();
}
//copy picture and crop
$tempFile = APPLICATION_PUBLIC_PATH . '/media/temps/' . $tmpFiles->getFileName();
$targetFile = APPLICATION_PUBLIC_PATH . '/media/files/' . $tmpFiles->getFileName();
@copy($tempFile, $targetFile);
@unlink($tempFile);
$tmpFiles->delete();
}
}
//END:SAVE ATTACHMENTS
}
Needs_Tools::DeleteLegaturi($expenseId, '1');
$idGroup = $this->getRequest()->getParam('idGroup');
$modelGroup = new Default_Model_ProductGroups();
$modelGroup->setIdProduct($expenseId);
$modelGroup->setIdGroup($idGroup);
$modelGroup->setRepeated(1);
$modelGroup->save();
$post = $this->getRequest()->getPost();
//mesaj de succes
$this->_flashMessenger->addMessage("<div class='success canhide'><p>Recurrent expense was modified successfully<a href='javascript:;'></a></p></div>");
} else {
$this->_flashMessenger->addMessage("<div class='failure canhide'><p>Recurrent expense was not modified<a href='javascript:;'></a></p></div>");
}
$this->_redirect(WEBROOT . 'recurrent-expenses');
}
}
}
}
}
示例7: editAction
public function editAction()
{
$auth = Zend_Auth::getInstance();
$authAccount = $auth->getStorage()->read();
if (null != $authAccount) {
if (null != $authAccount->getId()) {
$user = new Default_Model_Users();
$user->find($authAccount->getId());
}
}
$id = $this->getRequest()->getParam('id');
/* $hasAccess = Needs_Roles::hasAccess(Zend_Registry::get('user')->getIdRole(),'adaugare_group');
if(!$hasAccess)
{
$this->_redirect(WEBROOT.'groups');
} */
$model = new Default_Model_Groups();
if ($model->find($id)) {
$form = new Default_Form_Groups();
$form->edit($model);
$form->setDecorators(array('ViewScript', array('ViewScript', array('viewScript' => 'forms/groups/edit-group.phtml'))));
$this->view->form = $form;
$this->view->color = $model->getColor();
if ($this->getRequest()->isPost()) {
if ($this->getRequest()->getPost('submit')) {
if ($form->isValid($this->getRequest()->getPost())) {
$model->setOptions($form->getValues());
if ($groupId = $model->save()) {
//$post = $this->getRequest()->getPost('selectedProducts');
// if ($post!=''){
// $posts=explode(",",$post);
// $arrayAll=array();
// //Needs_Tools::DeleteLegaturibyGroup( $groupId );
//
// $modelGroupAll=new Default_Model_ProductGroups();
// $selectAll = $modelGroupAll->getMapper()->getDbTable()->select()
// ->where('idGroup = ?',
// $groupId);
// $resultsAll=$modelGroupAll->fetchAll($selectAll);
// foreach ($resultsAll as $value){
// $arrayAll[]=$value->getIdProduct();//all the products that are currently in the table
// }
// $resultDiff = array_diff($arrayAll, $posts);
// foreach ($resultDiff as $deleteProd){
// Needs_Tools::DeleteLegaturi( $deleteProd );//here we delete the prods that were before in the table, but are not anymore in the new list of prods
// }
// foreach ($posts as $key=>$idProductGroups){//all products that need to be in the table
// $modelGroup=new Default_Model_ProductGroups();
// $modelGroup->setIdProduct($idProductGroups);
// $modelGroup->setIdGroup($groupId);
//
// $modelGroupFind=new Default_Model_ProductGroups();
// $selectFind = $modelGroupFind->getMapper()->getDbTable()->select()
// ->where('idProduct = ?',
// $idProductGroups)
// ->where('idGroup = ?',
// $groupId);
// $modelGroupFind->fetchRow($selectFind);
// if ($modelGroupFind->getId() == NULL) //existing product added in the database
// {
// $modelGroup->setOrder($key);
// $modelGroup->save();
// }
// }
// }
//mesaj de succes
$this->_flashMessenger->addMessage("<div class='success canhide'><p>Group was modified successfully<a href='javascript:;'></a></p></div>");
} else {
$this->_flashMessenger->addMessage("<div class='failure canhide'><p>Group was not modified<a href='javascript:;'></a></p></div>");
}
$this->_redirect(WEBROOT . 'groups');
}
}
}
}
}
示例8: getUserById
public static function getUserById($id)
{
$model = new Default_Model_Users();
$model->find($id);
return $model->getName();
}
示例9: save
public function save(Default_Model_Comments $value)
{
$auth = Zend_Auth::getInstance();
$authAccount = $auth->getStorage()->read();
if (null != $authAccount) {
if (null != $authAccount->getId()) {
$user = new Default_Model_Users();
$user->find($authAccount->getId());
$data = array('id' => $value->getId(), 'idProject' => $value->getIdProject(), 'idParent' => $value->getIdParent(), 'idShop' => '3', 'idUserFrom' => $user->id, 'idUserTo' => $value->getIdUserTo(), 'description' => $value->getDescription(), 'deleted' => '0');
$action_done = '';
if (null === ($id = $value->getId())) {
$data['created'] = new Zend_Db_Expr('NOW()');
$id = $this->getDbTable()->insert($data);
//logs action done
$user_name = $user->name . ' ' . $user->surname;
$project_name = $value->getProjectName()->getName();
$action_done = ' ' . $user_name . ' a adaugat un comentariu la proiectul ' . $project_name . ' ';
//end logs action done
}
Needs_Logs::DbLogTracking($user->id, $value->getIdProject(), 'comments', 'adaugare', $action_done);
return $id;
}
}
}
示例10: delete
public function delete(Default_Model_Users $value)
{
$auth = Zend_Auth::getInstance();
$authAccount = $auth->getStorage()->read();
if (null != $authAccount) {
if (null != $authAccount->getId()) {
$user = new Default_Model_Users();
$user->find($authAccount->getId());
$id = $value->getId();
$data = array('deleted' => '1');
$this->getDbTable()->update($data, array('id = ?' => $id));
//logs action done
$user_name = $user->name;
$action_done = ' ' . $user_name . ' a sters membrul ' . $value->getName() . ' ';
Needs_Logs::DbLogTracking($user->id, $id, 'users', 'stergere', $action_done);
//end logs action done
return $id;
}
}
}
示例11: delete
public function delete(Default_Model_Shops $value)
{
$auth = Zend_Auth::getInstance();
$authAccount = $auth->getStorage()->read();
if (null != $authAccount) {
if (null != $authAccount->getId()) {
$user = new Default_Model_Users();
$user->find($authAccount->getId());
$id = $value->getId();
$data = array('deleted' => '1');
$this->getDbTable()->update($data, array('id = ?' => $id));
//logs action done
// $user_name = $user->name;
// $shop_name = $value->getName();
// $action_done = ' '.$user_name.' a sters shop-ul '.$shop_name.' ';
//end logs action done
return $id;
}
}
}