本文整理汇总了PHP中UserData类的典型用法代码示例。如果您正苦于以下问题:PHP UserData类的具体用法?PHP UserData怎么用?PHP UserData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateUserData
public static function updateUserData()
{
$userDataArray = UserDataDB::getUserDataBy('userDataId', $_SESSION['arguments']);
if (empty($userDataArray)) {
HomeView::show();
header('Location: /' . $_SESSION['base']);
} elseif ($_SERVER["REQUEST_METHOD"] == "GET") {
$_SESSION['userData'] = $userDataArray[0];
UserDataView::showUpdate();
} else {
$userData = $userDataArray[0];
$parms = $userData->getParameters();
$parms['userId'] = array_key_exists('userId', $_POST) ? $_POST['userId'] : $userData->getUserId();
$parms['user_name'] = array_key_exists('user_name', $_POST) ? $_POST['user_name'] : "";
$parms['skill_level'] = array_key_exists('skill_level', $_POST) ? $_POST['skill_level'] : "";
$parms['skill_areas'] = array_key_exists('skill_areas', $_POST) ? $_POST['skill_areas'] : array();
$parms['profile_pic'] = array_key_exists('profile_pic', $_POST) ? $_POST['profile_pic'] : "";
$parms['started_hobby'] = array_key_exists('started_hobby', $_POST) ? $_POST['started_hobby'] : "";
$parms['fav_color'] = array_key_exists('fav_color', $_POST) ? $_POST['fav_color'] : "";
$parms['url'] = array_key_exists('url', $_POST) ? $_POST['url'] : "";
$parms['phone'] = array_key_exists('phone', $_POST) ? $_POST['phone'] : "";
$newUserData = new UserData($parms);
$newUserData->setUserDataId($userData->getUserDataId());
$userDataEntry = UserDataDB::updateUserData($newUserData);
if ($userDataEntry->getErrorCount() != 0) {
$_SESSION['userData'] = array($newUserData);
//return;
UserDataView::showUpdate();
} else {
HomeView::show();
header('Location: /' . $_SESSION['base']);
}
}
}
示例2: testGetCallsFileGetContentsWithUserId
public function testGetCallsFileGetContentsWithUserId()
{
$fileGetContents = \idfly\Moka::spy('"USER"');
$userData = new UserData($fileGetContents);
$userData->get(1000);
$this->assertEquals(['/data/1000.json'], $fileGetContents->report()[0]);
}
示例3: fetchInfo
public function fetchInfo()
{
global $srkEnv;
$code = $_GET['code'];
$data = (object) array('client_id' => $srkEnv->thirdPartyLogin['github']->clientId, 'client_secret' => $srkEnv->thirdPartyLogin['github']->clientSecret, 'code' => $code, 'accept' => 'json');
$postRes = decipherGetStr(webPostData('https://github.com/login/oauth/access_token', $data));
if (isset($postRes['access_token'])) {
$accessToken = $postRes['access_token'];
$dataStr = webGetData('https://api.github.com/user?access_token=' . $accessToken);
$userInfo = json_decode($dataStr);
if (!$userInfo) {
return 'Data fetching error';
}
$userData = (object) array('userId' => 'github_' . $userInfo->login, 'email' => $userInfo->email, 'nickname' => $userInfo->name, 'accessToken' => $accessToken, 'avatarURL' => $userInfo->avatar_url, 'source' => 'github');
$user = new UserData();
$user->registerThirdParty($userData);
$writeRes = $user->writeUser();
if (!$writeRes) {
$_SESSION['userId'] = $userData->userId;
}
return $writeRes;
} else {
return 'Access code error';
}
}
示例4: amp_badge_related_form
function amp_badge_related_form($data)
{
$data = array_merge($data, $_GET);
foreach ($data as $key => $value) {
if (is_array($value) && count($value) == 1) {
$quick_val = array_values($value);
$data[$key] = $quick_val[0];
}
}
$modin = isset($data['modin']) && $data['modin'] ? $data['modin'] : false;
$related_index = isset($data['related_index']) && $data['related_index'] ? $data['related_index'] : false;
if (!$modin) {
return false;
}
if (!AMP_authenticate('admin')) {
$live_forms = AMP_lookup('formsPublic');
if (!isset($live_forms[$modin])) {
return 'Please publish the related form';
}
}
require_once 'AMP/UserData.php';
$udm = new UserData(AMP_Registry::getDbcon(), $modin);
$udm->registerPlugin('Output', 'Text');
$udm->setData($data);
$renderer = AMP_get_renderer();
# $delete_button = $renderer->form(
$delete_button = $renderer->link('#', $renderer->image(AMP_SYSTEM_ICON_DELETE, array('class' => 'icon', 'style' => 'border: 0;')), array('alt' => AMP_TEXT_DELETE_ITEM, 'title' => AMP_TEXT_DELETE_ITEM, 'onClick' => "\$('form_related_item_{$related_index}').remove( ); \$('form_{$modin}_related_custom_fields_{$related_index}').remove(); return false;"));
$content = $delete_button . $renderer->tag('pre', $udm->doPlugin('Output', 'Text'));
$result = $renderer->div($content, array('class' => 'form_related_item', 'id' => 'form_related_item_' . $related_index));
return $result;
}
示例5: getUserData
/**
* ユーザーデータ取得
* @param int (user_id)
* @return array (user data)
*/
public function getUserData()
{
$user_id = $this->input->get_post('id', TRUE);
$user_data = new UserData();
$data = $user_data->getUser($user_id);
$this->output->set_output(json_encode($data));
$this->output->_display();
exit;
}
示例6: user
/**
* userデータの取得
* @param user_id
*/
function user()
{
$user_id = $_REQUEST['user_id'];
$user_id = 1;
$userData = new UserData();
$data = $userData->get_user($user_id);
$this->output->set_output(json_encode($data));
$this->output->_display();
exit;
}
示例7: questGo
/**
* 出発させる
* @params
* @return
*/
public function questGo()
{
$data = array();
$user_id = $this->input->get_post('user_id', TRUE);
$quest_data = $this->input->get_post('quest_select', TRUE);
$userData = new UserData();
$userData->userQuestGo($user_id, $quest_data);
// 更新したデータを返す
$data = $userData->getUser($user_id);
$this->output->set_output(json_encode($data));
$this->output->_display();
exit;
}
示例8: run
public static function run()
{
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$userdata = new UserData($_POST);
if ($userdata->getErrorCount() == 0) {
ProfileView::show($userdata);
} else {
SignupView::show($userdata);
}
} else {
// Initial link
SignupView::show(null);
}
}
示例9: run
public static function run()
{
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$user = new User($_POST);
$userData = new UserData($_POST);
if ($user->getErrorCount() == 0 && $userData->getErrorCount() == 0) {
HomeView::show();
} else {
SignupView::show($user, $userData);
}
} else {
SignupView::show(null, null);
}
}
示例10: refreshCurrentUser
/**
* 重新获取当前登录用户信息
*/
protected function refreshCurrentUser()
{
$currUser = $this->getCurrentUser();
$currUser = UserData::getById($currUser['id']);
$_SESSION['user'] = array('id' => $currUser['id'], 'mobile' => $currUser['mobile'], 'email' => $currUser['email'], 'passwd' => $currUser['passwd'], 'name' => $currUser['name']);
return $currUser;
}
示例11: instance
/**
* This class implements the Singleton pattern. There is only ever
* one instance of the this class and it is accessed only via the
* ClassName::instance() method.
*
* @return object
* @access public
* @since 5/26/05
* @static
*/
public static function instance()
{
if (!isset(self::$instance)) {
self::$instance = new UserData();
}
return self::$instance;
}
示例12: tryConnect
public function tryConnect(SSH2DAO $ssh2dao)
{
UserData::$SSH2Data = $ssh2dao;
$host = trim($ssh2dao->host);
$port = $ssh2dao->port;
$timeout = $ssh2dao->timeout;
UserData::$SSH2Conn = new Net_SSH2($host, $port, $timeout);
}
示例13: run
public static function run()
{
if ($_SERVER["REQUEST_METHOD"] == "POST") {
//simpleEcho.php;
$user = new User($_POST);
$userData = new UserData($_POST);
//print_r($_FILES); echo '<br>';
if ($user->getErrorCount() == 0 && $userData->getErrorCount() == 0) {
ProfileView::show($userData);
} else {
SignupView::show($user, $userData);
}
} else {
// Initial link
SignupView::show(null, null);
}
}
示例14: getUnreadCount
private function getUnreadCount()
{
$unreadCount = UserData::model()->getUnreadCount(Ibos::app()->user->uid);
$sidebarUnreadMap["mention"] = $unreadCount["unread_atme"];
$sidebarUnreadMap["comment"] = $unreadCount["unread_comment"];
$sidebarUnreadMap["notify"] = $unreadCount["unread_notify"];
$sidebarUnreadMap["pm"] = $unreadCount["unread_message"];
return $sidebarUnreadMap;
}
示例15: run
public static function run()
{
$user = null;
$userData = null;
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$user = new User($_POST);
//$dbUser = UsersDB::addUser($user);
$userData = new UserData($_POST);
//$_POST["userId"] = $user->getUserId();
if ($user->getErrorCount() == 0 && $userData->getErrorCount() == 0) {
$dbUserData = UsersDB::addUser($user, $userData);
ProfileView::show($user, $userData);
} else {
SignupView::show($user, $userData);
}
} else {
SignupView::show(null, null);
}
}