本文整理汇总了PHP中Model\User::update方法的典型用法代码示例。如果您正苦于以下问题:PHP User::update方法的具体用法?PHP User::update怎么用?PHP User::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model\User
的用法示例。
在下文中一共展示了User::update方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action
public function action()
{
$this->db()->transaction();
$updateResult = \Model\User::update();
if ($updateResult['status'] == false) {
$this->db()->rollBack();
$this->error($updateResult['mes']);
}
$this->db()->commit();
$this->success($GLOBALS['_LANG']['USER']['UPDATE_USER_SUCCESS'], $this->url('Team-User-index'));
}
示例2: testUpdate
public function testUpdate()
{
$u = new User($this->container);
$this->assertNotFalse($u->create(array('username' => 'toto', 'password' => '123456', 'name' => 'Toto')));
$this->assertTrue($u->update(array('id' => 2, 'username' => 'biloute')));
$user = $u->getById(2);
$this->assertNotFalse($user);
$this->assertTrue(is_array($user));
$this->assertEquals('biloute', $user['username']);
$this->assertEquals('Toto', $user['name']);
$this->assertEquals(0, $user['is_admin']);
$this->assertEquals(0, $user['is_ldap_user']);
}
示例3: testSendWithEmailAddress
public function testSendWithEmailAddress()
{
$en = new EmailNotification($this->container);
$p = new Project($this->container);
$tf = new TaskFinder($this->container);
$tc = new TaskCreation($this->container);
$u = new User($this->container);
$this->assertEquals(1, $p->create(array('name' => 'test')));
$this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
$this->assertTrue($u->update(array('id' => 1, 'email' => 'test@localhost')));
$this->container['emailClient'] = $this->getMockBuilder('\\Core\\EmailClient')->setConstructorArgs(array($this->container))->setMethods(array('send'))->getMock();
$this->container['emailClient']->expects($this->once())->method('send')->with($this->equalTo('test@localhost'), $this->equalTo('admin'), $this->equalTo('[test][New task] test (#1)'), $this->stringContains('test'));
$en->send($u->getById(1), Task::EVENT_CREATE, array('task' => $tf->getDetails(1)));
}
示例4: testTaskClose
public function testTaskClose()
{
$action = new Action\TaskEmail($this->container, 1, Task::EVENT_CLOSE);
$action->setParam('column_id', 2);
$action->setParam('user_id', 1);
$action->setParam('subject', 'My email subject');
// We create a task in the first column
$tc = new TaskCreation($this->container);
$tf = new TaskFinder($this->container);
$p = new Project($this->container);
$u = new User($this->container);
$this->assertEquals(1, $p->create(array('name' => 'test')));
$this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 1)));
$this->assertTrue($u->update(array('id' => 1, 'email' => 'admin@localhost')));
// We create an event
$event = array('project_id' => 1, 'task_id' => 1, 'column_id' => 2);
// Email should be sent
$this->container['emailClient']->expects($this->once())->method('send')->with($this->equalTo('admin@localhost'), $this->equalTo('admin'), $this->equalTo('My email subject'), $this->stringContains('test'));
// Our event should be executed
$this->assertTrue($action->execute(new GenericEvent($event)));
}
示例5: testIcalEventsWithAssigneeAndDueDate
public function testIcalEventsWithAssigneeAndDueDate()
{
$dp = new DateParser($this->container);
$p = new Project($this->container);
$tc = new TaskCreation($this->container);
$tf = new TaskFilterICalendarFormatter($this->container);
$u = new User($this->container);
$c = new Config($this->container);
$this->assertNotFalse($c->save(array('application_url' => 'http://kb/')));
$this->assertEquals('http://kb/', $c->get('application_url'));
$this->assertNotFalse($u->update(array('id' => 1, 'email' => 'bob@localhost')));
$this->assertEquals(1, $p->create(array('name' => 'test')));
$this->assertNotFalse($tc->create(array('project_id' => 1, 'title' => 'task1', 'owner_id' => 1, 'date_due' => $dp->getTimestampFromIsoFormat('+5 days'))));
$ics = $tf->create()->filterByDueDateRange(strtotime('-1 month'), strtotime('+1 month'))->setFullDay()->setCalendar(new Calendar('Kanboard'))->setColumns('date_due')->addFullDayEvents()->format();
$this->assertContains('UID:task-#1-date_due', $ics);
$this->assertContains('DTSTART;TZID=UTC;VALUE=DATE:' . date('Ymd', strtotime('+5 days')), $ics);
$this->assertContains('DTEND;TZID=UTC;VALUE=DATE:' . date('Ymd', strtotime('+5 days')), $ics);
$this->assertContains('URL:http://kb/?controller=task&action=show&task_id=1&project_id=1', $ics);
$this->assertContains('SUMMARY:#1 task1', $ics);
$this->assertContains('ORGANIZER;CN=admin:MAILTO:bob@localhost', $ics);
$this->assertContains('X-MICROSOFT-CDO-ALLDAYEVENT:TRUE', $ics);
}
示例6: updateUser
/**
* Update the user table based on the Google profile information
*
* @access public
* @param integer $user_id User id
* @param array $profile Google profile
* @return boolean
*/
public function updateUser($user_id, array $profile)
{
$userModel = new User($this->db, $this->event);
return $userModel->update(array('id' => $user_id, 'google_id' => $profile['id'], 'email' => $profile['email'], 'name' => $profile['name']));
}
示例7: function
/**
* User procedures
*/
$server->register('createUser', function (array $values) use($user) {
list($valid, ) = $user->validateCreation($values);
return $valid && $user->create($values);
});
$server->register('getUser', function ($user_id) use($user) {
return $user->getById($user_id);
});
$server->register('getAllUsers', function () use($user) {
return $user->getAll();
});
$server->register('updateUser', function ($values) use($user) {
list($valid, ) = $user->validateModification($values);
return $valid && $user->update($values);
});
$server->register('removeUser', function ($user_id) use($user) {
return $user->remove($user_id);
});
/**
* Category procedures
*/
$server->register('createCategory', function ($project_id, $name) use($category) {
$values = array('project_id' => $project_id, 'name' => $name);
list($valid, ) = $category->validateCreation($values);
return $valid && $category->create($values);
});
$server->register('getCategory', function ($category_id) use($category) {
return $category->getById($category_id);
});
示例8: unset
//密码为空,那么不对该数据进行编辑
if ($data['user_pass'] == '') {
unset($data['user_pass']);
}
//去除未更新数据.
foreach ($data as $k => $v) {
if ($user[$k] == $v) {
unset($data[$k]);
}
}
unset($user);
//没有需要进行更新的数据
if (count($data) < 1) {
Response::json(array('msg' => '数据未更改,不需要进行更新'), 1);
}
User::update($data, $eid);
} else {
User::insert($data);
}
Response::json(array('msg' => '操作成功'), 0);
}
$formData = array();
if ($eid != '') {
$formData = User::getUserDataById($eid);
$formData['user_age'] = $formData['user_age'] == 0 ? '' : $formData['user_age'];
$formData['user_qq'] = $formData['user_qq'] == 0 ? '' : $formData['user_qq'];
$formData['user_phone'] = $formData['user_phone'] == 0 ? '' : $formData['user_phone'];
$formData['user_mobile'] = $formData['user_mobile'] == 0 ? '' : $formData['user_mobile'];
} else {
$formData = User::getTableAttribute();
}
示例9: testSendNotifications
public function testSendNotifications()
{
$u = new User($this->container);
$n = new Notification($this->container);
$p = new Project($this->container);
$tc = new TaskCreation($this->container);
$tf = new TaskFinder($this->container);
$pp = new ProjectPermission($this->container);
$this->assertEquals(1, $p->create(array('name' => 'UnitTest1', 'is_everybody_allowed' => 1)));
$this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
$this->assertTrue($u->update(array('id' => 1, 'email' => 'test@localhost')));
$this->assertTrue($pp->isEverybodyAllowed(1));
$n->saveSettings(1, array('notifications_enabled' => 1, 'notifications_filter' => NotificationFilter::FILTER_NONE, 'notification_types' => array(NotificationType::TYPE_WEB => 1, NotificationType::TYPE_EMAIL => 1)));
$this->container['emailNotification'] = $this->getMockBuilder('\\Model\\EmailNotification')->setConstructorArgs(array($this->container))->setMethods(array('send'))->getMock();
$this->container['webNotification'] = $this->getMockBuilder('\\Model\\WebNotification')->setConstructorArgs(array($this->container))->setMethods(array('send'))->getMock();
$this->container['emailNotification']->expects($this->once())->method('send');
$this->container['webNotification']->expects($this->once())->method('send');
$n->sendNotifications(Task::EVENT_CREATE, array('task' => $tf->getDetails(1)));
}