本文整理汇总了PHP中MemberModel类的典型用法代码示例。如果您正苦于以下问题:PHP MemberModel类的具体用法?PHP MemberModel怎么用?PHP MemberModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MemberModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listAction
public function listAction()
{
$p = $_REQUEST;
$tMO = new MemberModel();
$tDatas = $tMO->field('id mid,name,idcard,phone')->where('uid = ' . $this->tUid)->fList();
Tool_Fnc::ajaxMsg('', 1, $tDatas);
}
示例2: memberListAction
/**
* 获取会员列表
*/
public function memberListAction()
{
$m = new MemberModel();
$page = safe::filterGet('page', 'int');
$pageData = $m->getList($page);
$this->getView()->assign('member', $pageData['data']);
$this->getView()->assign('bar', $pageData['bar']);
}
示例3: index
public function index()
{
$op = ggp('op');
if ($op == 'do') {
$this->isLogin();
list($address, $realname) = explode('@', $this->my['device_token']);
$this->my['decive_token'] = unserialize($this->my['device_token']);
if (!$address || !$this->my['mobile'] || !$realname) {
$this->myError('请完善您的收货信息', U('member/address'));
}
$jf_goods_id = ggp('jf_goods_id:i');
$jfitem = M('jf_goods')->where('state=1')->find($jf_goods_id);
empty($jfitem) && $this->myError('没有该商品');
$jfitem['jf_goods_jf'] > $this->my['jifen'] && $this->myError('您的积分不足');
MemberModel::I()->decJf($this->my['uid'], $jfitem['jf_goods_jf']);
M('jf_log')->add(array('uid' => $this->my['uid'], 'uname' => $this->my['uname'], 'order_id' => $jfitem['jf_goods_id'], 'state' => 0, 'jf_goods_jf' => -$jfitem['jf_goods_jf'], 'ctime' => TIME, 'beizhu' => serialize(array('jf_goods_name' => $jfitem['jf_goods_name'], 'address' => $address, 'realname' => $realname, 'mobile' => $this->my['mobile']))));
if ($jfitem['jf_goods_num'] > 0) {
if (intval($jfitem['jf_goods_num']) === 1) {
M('jf_goods')->where("jf_goods_id='{$jfitem['jf_goods_id']}'")->save(array('state' => 0));
}
M('jf_goods')->where("jf_goods_id='{$jfitem['jf_goods_id']}'")->setDec('jf_goods_num');
}
$this->mySuccess('兑换成功');
}
$hot_goods = M('goods')->where("state=1")->order('`order` DESC,hits DESC,goods_id DESC')->limit(8)->select();
$this->assign('hot_goods', $hot_goods);
$list = M('jf_goods')->where("state=1")->order('`order` desc,jf_goods_id desc')->select();
$this->a('$list', $list);
$this->d();
}
示例4: getMember
/**
* Get the member avatar
* @param integer
* @param integer
* @param integer
* @return string
*/
public static function getMember($intId, $intWidth = null, $intHeight = null)
{
$objMember = \MemberModel::findByPk($intId);
// Use the default size
if (!$intWidth || !$intHeight) {
list($intWidth, $intHeight) = static::getMemberSize();
}
// Use the Gravatar
if ($objMember->avatar_gravatar) {
return static::getGravatar($objMember->email, $intWidth);
}
$strFile = static::find($intId, static::getMemberPath());
// Use placeholder member has no avatar
if ($strFile == '') {
if (\Config::get('avatar_member_placeholder') == '') {
return '';
}
$objFile = \FilesModel::findByUuid(\Config::get('avatar_member_placeholder'));
if ($objFile === null || !is_file(TL_ROOT . '/' . $objFile->path)) {
return '';
}
$strFile = $objFile->path;
}
return \Image::get($strFile, $intWidth, $intHeight);
}
示例5: sendPasswordLink
/**
* Send a lost password e-mail
* @param object
*/
protected function sendPasswordLink($objMember)
{
$objNotification = \NotificationCenter\Model\Notification::findByPk($this->nc_notification);
if ($objNotification === null) {
$this->log('The notification was not found ID ' . $this->nc_notification, __METHOD__, TL_ERROR);
return;
}
$confirmationId = md5(uniqid(mt_rand(), true));
// Store the confirmation ID
$objMember = \MemberModel::findByPk($objMember->id);
$objMember->activation = $confirmationId;
$objMember->save();
$arrTokens = array();
// Add member tokens
foreach ($objMember->row() as $k => $v) {
$arrTokens['member_' . $k] = $v;
}
$arrTokens['recipient_email'] = $objMember->email;
$arrTokens['domain'] = \Idna::decode(\Environment::get('host'));
$arrTokens['link'] = \Idna::decode(\Environment::get('base')) . \Environment::get('request') . ($GLOBALS['TL_CONFIG']['disableAlias'] || strpos(\Environment::get('request'), '?') !== false ? '&' : '?') . 'token=' . $confirmationId;
$objNotification->send($arrTokens);
$this->log('A new password has been requested for user ID ' . $objMember->id . ' (' . $objMember->email . ')', __METHOD__, TL_ACCESS);
// Check whether there is a jumpTo page
if (($objJumpTo = $this->objModel->getRelated('jumpTo')) !== null) {
$this->jumpToOrReload($objJumpTo->row());
}
$this->reload();
}
示例6: run
/**
* Run the controller and parse the template
*/
public function run()
{
/** @var \BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_preview');
$objTemplate->base = \Environment::get('base');
$objTemplate->language = $GLOBALS['TL_LANGUAGE'];
$objTemplate->title = specialchars($GLOBALS['TL_LANG']['MSC']['fePreview']);
$objTemplate->charset = \Config::get('characterSet');
$objTemplate->site = \Input::get('site', true);
if (\Input::get('url')) {
$objTemplate->url = \Environment::get('base') . \Input::get('url');
} elseif (\Input::get('page')) {
$objTemplate->url = $this->redirectToFrontendPage(\Input::get('page'), \Input::get('article'), true);
} else {
$objTemplate->url = \Environment::get('base');
}
// Switch to a particular member (see #6546)
if (\Input::get('user') && $this->User->isAdmin) {
$objUser = \MemberModel::findByUsername(\Input::get('user'));
if ($objUser !== null) {
$strHash = sha1(session_id() . (!\Config::get('disableIpCheck') ? \Environment::get('ip') : '') . 'FE_USER_AUTH');
// Remove old sessions
$this->Database->prepare("DELETE FROM tl_session WHERE tstamp<? OR hash=?")->execute(time() - \Config::get('sessionTimeout'), $strHash);
// Insert the new session
$this->Database->prepare("INSERT INTO tl_session (pid, tstamp, name, sessionID, ip, hash) VALUES (?, ?, ?, ?, ?, ?)")->execute($objUser->id, time(), 'FE_USER_AUTH', session_id(), \Environment::get('ip'), $strHash);
// Set the cookie
$this->setCookie('FE_USER_AUTH', $strHash, time() + \Config::get('sessionTimeout'), null, null, false, true);
$objTemplate->user = \Input::post('user');
}
}
\Config::set('debugMode', false);
$objTemplate->output();
}
示例7: cleanMembers
public static function cleanMembers(\DataContainer $objDc)
{
$intPid = \Input::get('id');
$blnIntroPrinted = false;
if ($intPid && ($objArchive = SubmissionArchiveModel::findByPk($intPid)) !== null && $objArchive->memberGroups) {
$arrArchiveGroups = deserialize($objArchive->memberGroups, true);
if (!empty($arrArchiveGroups)) {
if (($objMembers = \MemberModel::findAll()) !== null) {
while ($objMembers->next()) {
$arrGroups = deserialize($objMembers->groups, true);
if (count(array_intersect($arrGroups, $arrArchiveGroups)) > 0) {
// check for existing submissions
if (SubmissionModel::findBy('mid', $objMembers->id) === null) {
if (!$blnIntroPrinted) {
echo $GLOBALS['TL_LANG']['tl_competition_submission']['cleanMembersIntro'] . '<br>';
$blnIntroPrinted = true;
}
echo $objMembers->id . '<br>';
$objMembers->groups = serialize(array_diff($arrGroups, $arrArchiveGroups));
$objMembers->save();
}
}
}
}
}
}
die;
}
示例8: onSubmitCallback
protected function onSubmitCallback(\DataContainer $dc)
{
// HOOK: send insert ID and user data
if (isset($GLOBALS['TL_HOOKS']['preRegistration']) && is_array($GLOBALS['TL_HOOKS']['preRegistration'])) {
foreach ($GLOBALS['TL_HOOKS']['preRegistration'] as $callback) {
$this->import($callback[0]);
$this->{$callback}[0]->{$callback}[1]($dc->activeRecord->id, $dc->activeRecord, $this->objModule);
}
}
$objMember = \MemberModel::findByPk($dc->activeRecord->id);
$objMember->login = $this->objModule->reg_allowLogin;
$objMember->activation = md5(uniqid(mt_rand(), true));
$objMember->dateAdded = $dc->activeRecord->tstamp;
// Set default groups
if (empty($objMember->groups)) {
$objMember->groups = $this->objModule->reg_groups;
}
// Disable account
$objMember->disable = 1;
$objMember->save();
if ($this->objModule->reg_activate_plus) {
$this->formHybridSendConfirmationViaEmail = true;
}
// HOOK: send insert ID and user data
if (isset($GLOBALS['TL_HOOKS']['createNewUser']) && is_array($GLOBALS['TL_HOOKS']['createNewUser'])) {
foreach ($GLOBALS['TL_HOOKS']['createNewUser'] as $callback) {
$this->import($callback[0]);
$this->{$callback}[0]->{$callback}[1]($objMember->id, $objMember->row(), $this->objModule);
}
}
// $this->setReset(false); // debug - stay on current page
}
示例9: saveDefaultUserName
public function saveDefaultUserName($varValue, DataContainer $dc)
{
$member = \MemberModel::findById($dc->id);
$member->username = $varValue;
$member->save();
return $varValue;
}
示例10: compile
/**
* Generate the module
*/
protected function compile()
{
$this->import('FrontendUser', 'User');
// Initialize the password widget
$arrField = array('name' => 'password', 'inputType' => 'text', 'label' => $GLOBALS['TL_LANG']['MSC']['password'][0], 'eval' => array('hideInput' => true, 'mandatory' => true, 'required' => true, 'tableless' => $this->tableless));
$objWidget = new \FormTextField(\FormTextField::getAttributesFromDca($arrField, $arrField['name']));
$objWidget->rowClass = 'row_0 row_first even';
// Validate widget
if (\Input::post('FORM_SUBMIT') == 'tl_close_account') {
$objWidget->validate();
// Validate the password
if (!$objWidget->hasErrors()) {
// The password has been generated with crypt()
if (\Encryption::test($this->User->password)) {
$blnAuthenticated = \Encryption::verify($objWidget->value, $this->User->password);
} else {
list($strPassword, $strSalt) = explode(':', $this->User->password);
$blnAuthenticated = $strSalt == '' ? $strPassword === sha1($objWidget->value) : $strPassword === sha1($strSalt . $objWidget->value);
}
if (!$blnAuthenticated) {
$objWidget->value = '';
$objWidget->addError($GLOBALS['TL_LANG']['ERR']['invalidPass']);
}
}
// Close account
if (!$objWidget->hasErrors()) {
// HOOK: send account ID
if (isset($GLOBALS['TL_HOOKS']['closeAccount']) && is_array($GLOBALS['TL_HOOKS']['closeAccount'])) {
foreach ($GLOBALS['TL_HOOKS']['closeAccount'] as $callback) {
$this->import($callback[0]);
$this->{$callback}[0]->{$callback}[1]($this->User->id, $this->reg_close, $this);
}
}
$objMember = \MemberModel::findByPk($this->User->id);
// Remove the account
if ($this->reg_close == 'close_delete') {
$objMember->delete();
$this->log('User account ID ' . $this->User->id . ' (' . $this->User->email . ') has been deleted', __METHOD__, TL_ACCESS);
} else {
$objMember->disable = 1;
$objMember->tstamp = time();
$objMember->save();
$this->log('User account ID ' . $this->User->id . ' (' . $this->User->email . ') has been deactivated', __METHOD__, TL_ACCESS);
}
$this->User->logout();
// Check whether there is a jumpTo page
if (($objJumpTo = $this->objModel->getRelated('jumpTo')) !== null) {
$this->jumpToOrReload($objJumpTo->row());
}
$this->reload();
}
}
$this->Template->fields = $objWidget->parse();
$this->Template->formId = 'tl_close_account';
$this->Template->action = \Environment::get('indexFreeRequest');
$this->Template->slabel = specialchars($GLOBALS['TL_LANG']['MSC']['closeAccount']);
$this->Template->rowLast = 'row_1 row_last odd';
$this->Template->tableless = $this->tableless;
}
示例11: compile
/**
* Generate the module
*/
protected function compile()
{
// add miscellaneous vars to the template
$this->addTemplateVars();
// get href for the detail-page
$objDetailPage = \PageModel::findWithDetails($this->detailPage);
if ($objDetailPage === NULL) {
$href = NULL;
} else {
$href = $this->generateFrontendUrl($objDetailPage->row(), \Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/%s' : '/member/%s', $objDetailPage->language);
}
$objMember = $this->Database->prepare('SELECT * FROM tl_member WHERE disable = ?')->execute(0);
$arrRows = array();
while ($row = $objMember->fetchAssoc()) {
foreach ($row as $k => $v) {
if ($k == 'id' || $k == 'tstamp' || $k == 'password' || $k == 'avatar') {
continue;
}
$row[$k] = $v;
}
// score and grade
$row['score'] = $this->getScore($row['id']);
$row['averageRating'] = $this->getAverageRating($row['id']);
$row['ratingEnities'] = $this->getRatingEnities($row['id']);
$row['gradeLabel'] = $this->getGrade($row['id'], 'label');
$row['gradeIcon'] = $this->getGrade($row['id'], 'label');
// link to detail page
$row['hrefDetailPage'] = $href ? sprintf($href, $row['id']) : false;
// get avatar of member
$arrSize = deserialize($this->avatarSizeListing);
$title = $row['firstname'] . ' ' . $row['lastname'];
$row['avatar'] = $this->getAvatar($objMember->id, $arrSize, 'avatar', $title, 'avatar_thumb', $this);
// Show only Members from a selected group
if ($this->limitUsers) {
$arrGroups = deserialize($this->listedGroups);
$oMember = \MemberModel::findByPk($objMember->id);
if ($oMember !== null) {
if (count(array_intersect(deserialize($oMember->groups), $arrGroups)) < 1) {
continue;
}
}
}
$arrRows[] = $row;
}
// Sorting
$arrSorting = array();
if (!empty($this->sortingField1) && !empty($this->sortingDirection1)) {
$arrSorting[$this->sortingField1] = constant($this->sortingDirection1);
}
if (!empty($this->sortingField2) && !empty($this->sortingDirection2)) {
$arrSorting[$this->sortingField2] = constant($this->sortingDirection2);
}
if (!empty($this->sortingField3) && !empty($this->sortingDirection3)) {
$arrSorting[$this->sortingField3] = constant($this->sortingDirection3);
}
$arrRows = sortArrayByFields($arrRows, $arrSorting);
$this->Template->rows = count($arrRows) ? $arrRows : false;
}
示例12: getCompanyMembers
public static function getCompanyMembers()
{
$arrOptions = array();
if (($objMembers = \MemberModel::findByType('company')) !== null) {
$arrOptions = array_combine($objMembers->fetchEach('id'), $objMembers->fetchEach('company'));
}
asort($arrOptions);
return $arrOptions;
}
示例13: getMemberContentLink
public static function getMemberContentLink($intId)
{
if (($objMemberContentArchive = MemberContentArchiveModel::findByPk($intId)) !== null) {
if (($objTag = MemberContentArchiveTagModel::findByPk($objMemberContentArchive->tag)) !== null && $objTag->jumpTo) {
if (($objMember = \MemberModel::findByPk($objMemberContentArchive->mid)) !== null) {
return Url::generateFrontendUrl($objTag->jumpTo) . '/' . General::getAliasIfAvailable($objMember);
}
}
}
}
示例14: checkCredentialsHook
/**
* Check Credentials, ldap password != contao password
* @param String - Input Username $username
* @param String - Input Password $password
* @param unknown $objMember
*/
public function checkCredentialsHook($strUsername, $strPassword, $objMember)
{
// store randomized password, so contao will always trigger the checkCredentials HOOK
$objMember1 = \MemberModel::findByPk($objMember->id);
LdapMember::resetPassword($objMember1, $strUsername);
if (LdapMember::authenticateLdapMember($strUsername, $strPassword)) {
LdapMember::doUpdateMember($objMember1, $objMember1->ldapUid, $objMember1->email, $objMember1->firstname, $objMember1->lastname, deserialize($GLOBALS['TL_CONFIG']['ldap_groups'], true));
return true;
} else {
return false;
}
}
示例15: trackGATransaction
/**
* Actually execute the GoogleAnalytics tracking
* @param Database_Result
* @param IsotopeProductCollection $objOrder
*/
protected function trackGATransaction($objConfig, $objOrder)
{
// Initilize GA Tracker
$tracker = new \UnitedPrototype\GoogleAnalytics\Tracker($objConfig->ga_account, \Environment::get('base'));
// Assemble Visitor information
// (could also get unserialized from database)
$visitor = new \UnitedPrototype\GoogleAnalytics\Visitor();
$visitor->setIpAddress(\Environment::get('ip'));
$visitor->setUserAgent(\Environment::get('httpUserAgent'));
$transaction = new \UnitedPrototype\GoogleAnalytics\Transaction();
$transaction->setOrderId($objOrder->document_number);
$transaction->setAffiliation($objConfig->name);
$transaction->setTotal($objOrder->getTotal());
$transaction->setTax($objOrder->getTotal() - $objOrder->getTaxFreeTotal());
// $transaction->setShipping($objOrder->shippingTotal);
$objAddress = $objOrder->getBillingAddress();
$transaction->setCity($objAddress->city);
if ($objAddress->subdivision) {
$arrSub = explode("-", $objAddress->subdivision, 2);
$transaction->setRegion($arrSub[1]);
}
$transaction->setCountry($objAddress->country);
/** @var \Isotope\Model\ProductCollectionItem $objItem */
foreach ($objOrder->getItems() as $objItem) {
$item = new \UnitedPrototype\GoogleAnalytics\Item();
if ($objItem->getSku()) {
$item->setSku($objItem->getSku());
} else {
$item->setSku('product' . $objItem->product_id);
}
$item->setName($objItem->getName());
$item->setPrice($objItem->getPrice());
$item->setQuantity($objItem->quantity);
$arrOptionValues = array();
foreach ($objItem->getConfiguration() as $option) {
$arrOptionValues[] = (string) $option;
}
if (!empty($arrOptionValues)) {
$item->setVariation(implode(', ', $arrOptionValues));
}
$transaction->addItem($item);
}
// Track logged-in member as custom variable
if ($objConfig->ga_member != '' && $objOrder->member > 0 && ($objMember = \MemberModel::findByPk($objOrder->member)) !== null) {
$customVar = new \UnitedPrototype\GoogleAnalytics\CustomVariable(1, 'Member', $this->parseSimpleTokens($objConfig->ga_member, $objMember->row()), \UnitedPrototype\GoogleAnalytics\CustomVariable::SCOPE_VISITOR);
$tracker->addCustomVariable($customVar);
}
// Assemble Session information
// (could also get unserialized from PHP session)
$session = new \UnitedPrototype\GoogleAnalytics\Session();
$tracker->trackTransaction($transaction, $session, $visitor);
}