本文整理汇总了PHP中Model_Users::getSubUserType方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Users::getSubUserType方法的具体用法?PHP Model_Users::getSubUserType怎么用?PHP Model_Users::getSubUserType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_Users
的用法示例。
在下文中一共展示了Model_Users::getSubUserType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: usertypesAction
public function usertypesAction()
{
//echo"entrando";
$this->noViewRenderer(true);
$request = $this->getRequest();
$response = $this->getResponse();
$page = (int) $request->getRequest('page');
if ($page < 1) {
$page = 1;
}
$callback = $request->getRequest('callback');
if (!preg_match('/^([a-z0-9_.]{1,})$/', $callback)) {
$callback = false;
}
$return = array();
//////////// User Type ////////////
$user_tipos = array();
$user_types = Model_Users::getUserType(array('filter_status' => 1));
foreach ($user_types as $user_type) {
$user_type['subuser_types'] = Model_Users::getSubUserType($user_type['user_type_id']);
$user_tipos[] = $user_type;
}
$return = array($user_tipos);
if ($callback) {
$return = $callback . '(' . JO_Json::encode($return) . ')';
} else {
$response->addHeader('Cache-Control: no-cache, must-revalidate');
$response->addHeader('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
$response->addHeader('Content-type: application/json; charset=utf-8');
$return = JO_Json::encode($return);
}
$response->appendBody($return);
}
示例2: indexAction
public function indexAction()
{
$request = $this->getRequest();
//////////// Categories ////////////
$this->view->categories = array();
$categories = Model_Categories::getCategories(array('filter_status' => 1));
foreach ($categories as $category) {
$category['subcategories'] = Model_Categories::getSubcategories($category['category_id']);
$this->view->categories[] = $category;
}
//////////// User Type ////////////
$this->view->user_types = array();
$user_types = Model_Users::getUserType(array('filter_status' => 1));
foreach ($user_types as $user_type) {
$user_type['subuser_types'] = Model_Users::getSubUserType($user_type['user_type_id']);
$this->view->user_types[] = $user_type;
}
/////////// activate //////////
$_SESSION["activate_url"] = WM_Router::create($request->getBaseUrl() . '?controller=settings');
$this->view->popup_activate = WM_Router::create($request->getBaseUrl() . '?controller=users&action=activate');
$_SESSION["deportes_url"] = WM_Router::create($request->getBaseUrl() . '?controller=settings');
$this->view->deportes = WM_Router::create($request->getBaseUrl() . '?controller=users&action=deportes');
$this->view->user_sports = array();
$users_sports = Model_Users::getUserSports(JO_Session::get('user[user_id]'));
$i = 0;
foreach ($users_sports as $user_sports) {
if ($user_sports['sport_category'] != 1) {
if (!Model_Boards::isCategoryParent($user_sports['sport_category'])) {
$this->view->user_sports[] = Model_Boards::getCategoryTitle($user_sports['sport_category']);
$i++;
}
}
}
$this->view->sportcounter = $i;
$user_data = Model_Users::getUser(JO_Session::get('user[user_id]'));
$upload = new JO_Upload_SessionStore();
$upload->setName('upload_avatar');
$info = $upload->getFileInfo();
if (JO_Session::get('successfu_edite')) {
$this->view->successfu_edite = true;
JO_Session::clear('successfu_edite');
}
if ($request->isPost()) {
$validate = new Helper_Validate();
$validate->_set_rules($request->getPost('username'), $this->translate('Username'), 'not_empty;min_length[3];max_length[100];username');
$validate->_set_rules($request->getPost('firstname'), $this->translate('First name'), 'not_empty;min_length[3];max_length[100]');
//$validate->_set_rules($request->getPost('lastname'), $this->translate('Last name'), 'not_empty;min_length[3];max_length[100]');
$validate->_set_rules($request->getPost('email'), $this->translate('Email'), 'not_empty;min_length[5];max_length[100];email');
if ($request->issetPost('type_user')) {
if ($request->getPost('type_user') != 1 && $request->getPost('type_user') != 5 && $request->getPost('type_user') != 12) {
$validate->_set_rules($request->getPost('location'), $this->translate('Location'), 'not_empty;min_length[3];max_length[100]');
}
}
$validate->_set_rules($request->getPost('sports'), $this->translate('Category_id1'), 'not_empty;min_length[3];max_length[100]');
//is_nan() sino
/*
if($request->getPost('sport_category_1') == "" && $request->getPost('sport_category_2') == "" && $request->getPost('sport_category_3') == "") {
$validate->_set_rules($request->getPost('sport_category'), $this->translate('Category_id'), 'not_empty;min_length[3];max_length[100]');
}
* */
//$validate->_set_rules($request->getPost('sport_category_1'), $this->translate('Category_id1'), 'not_empty;min_length[3];max_length[100]');
//$validate->_set_rules($request->getPost('sport_category_2'), $this->translate('Category_id2'), 'not_empty;min_length[3];max_length[100]');
//$validate->_set_rules($request->getPost('sport_category_3'), $this->translate('Category_id3'), 'not_empty;min_length[3];max_length[100]');
$validate->_set_rules($request->getPost('type_user'), $this->translate('User_type_id'), 'not_empty;min_length[1];max_length[100]');
$data = $request->getPost();
if ($validate->_valid_form()) {
if (Model_Users::isExistEmail($request->getPost('email'), JO_Session::get('user[email]'))) {
$validate->_set_form_errors($this->translate('This e-mail address is already used'));
$validate->_set_valid_form(false);
}
if (Model_Users::isExistUsername($request->getPost('username'), JO_Session::get('user[username]'))) {
$validate->_set_form_errors($this->translate('This username is already used'));
$validate->_set_valid_form(false);
}
}
if ($validate->_valid_form()) {
$data['dont_search_index'] = (int) $request->issetPost('dont_search_index');
$data['facebook_timeline'] = (int) $request->issetPost('facebook_timeline');
if ($info) {
if (!@file_exists(BASE_PATH . '/cache/avatar/') || !is_dir(BASE_PATH . '/cache/avatar/')) {
mkdir(BASE_PATH . '/cache/avatar/');
}
$filename = BASE_PATH . '/cache/avatar/' . md5(mt_rand() . time()) . $upload->get_extension($info['name']);
if (file_put_contents($filename, $info['data'])) {
$data['avatar'] = $filename;
}
}
$new_email_key = md5(JO_Session::get('user[email]') . mt_rand() . time());
if (JO_Session::get('user[email]') != $request->getPost('email')) {
$data['new_email_key'] = $new_email_key;
} else {
$data['new_email_key'] = '';
}
$data['new_email'] = $data['email'];
unset($data['email']);
/*
$lat = $data['lat'];
$len = $data['len'];
//.........这里部分代码省略.........
示例3: registerAction
public function registerAction()
{
$request = $this->getRequest();
$_SESSION["deportes_url"] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=register');
$this->view->deportes = WM_Router::create($request->getBaseUrl() . '?controller=users&action=deportes');
//////////// Categories ////////////
$this->view->categories = array();
$categories = Model_Categories::getCategories(array('filter_status' => 1));
foreach ($categories as $category) {
$category['subcategories'] = Model_Categories::getSubcategories($category['category_id']);
$this->view->categories[] = $category;
}
//////////// User Type ////////////
$this->view->user_types = array();
$user_types = Model_Users::getUserType(array('filter_status' => 1));
foreach ($user_types as $user_type) {
$user_type['subuser_types'] = Model_Users::getSubUserType($user_type['user_type_id']);
$this->view->user_types[] = $user_type;
}
$this->view->user_sports = array();
$users_sports = Model_Users::getUserSports(0);
$i = 0;
foreach ($users_sports as $user_sports) {
if ($user_sports['sport_category'] != 1) {
if (!Model_Boards::isCategoryParent($user_sports['sport_category'])) {
$this->view->user_sports[] = Model_Boards::getCategoryTitle($user_sports['sport_category']);
$i++;
}
}
}
//$this->view->sportcounter = $i;
if (JO_Session::get('user[user_id]')) {
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]')));
}
$shared_content = Model_Users::checkSharedContent($request->getParam('key'), $request->getParam('user_id'));
if (!JO_Registry::get('enable_free_registration')) {
if (!$shared_content) {
$this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=landing'));
}
} else {
$this->view->fb_register = null;
$fb_ses = JO_Registry::get('facebookapi');
$session = $fb_ses->getUser();
if (JO_Registry::get('oauth_fb_key') && JO_Registry::get('oauth_fb_secret')) {
$this->view->fb_register = $this->facebook->getLoginUrl(array('redirect_uri' => WM_Router::create($request->getBaseUrl() . '?controller=facebook&action=login'), 'req_perms' => 'email,user_birthday,status_update,user_videos,user_status,user_photos,offline_access,read_friendlists'));
}
}
if (JO_Registry::get('oauth_in_key')) {
$this->view->instagram_register = WM_Router::create($this->getRequest()->getBaseUrl() . '?controller=instagram&action=register&next=' . urlencode(WM_Router::create($request->getBaseUrl() . '?controller=instagram&action=register')));
}
$this->view->error = false;
if ($request->isPost()) {
$validate = new Helper_Validate();
$validate->_set_rules($request->getPost('username'), $this->translate('Username'), 'not_empty;min_length[3];max_length[100];username');
$validate->_set_rules($request->getPost('firstname'), $this->translate('First name'), 'not_empty;min_length[3];max_length[100]');
//$validate->_set_rules($request->getPost('lastname'), $this->translate('Last name'), 'not_empty;min_length[3];max_length[100]');
$validate->_set_rules($request->getPost('email'), $this->translate('Email'), 'not_empty;min_length[5];max_length[100];email');
$validate->_set_rules($request->getPost('password'), $this->translate('Password'), 'not_empty;min_length[4];max_length[30]');
$validate->_set_rules($request->getPost('password2'), $this->translate('Confirm password'), 'not_empty;min_length[4];max_length[30]');
if (!isset($_SESSION['token'])) {
if ($request->issetPost('type_user')) {
if ($request->getPost('type_user') != 1 && $request->getPost('type_user') != 5 && $request->getPost('type_user') != 12) {
$validate->_set_rules($request->getPost('location'), $this->translate('Location'), 'not_empty;min_length[3];max_length[100]');
}
}
//is_nan() sino
/* if($request->getPost('sport_category_1') == "" && $request->getPost('sport_category_2') == "" && $request->getPost('sport_category_3') == "") {
$validate->_set_rules($request->getPost('sport_category'), $this->translate('Category_id'), 'not_empty;min_length[3];max_length[100]');
} */
$validate->_set_rules($request->getPost('sports'), $this->translate('Category_id1'), 'not_empty;min_length[3];max_length[100]');
//$validate->_set_rules($request->getPost('sport_category_2'), $this->translate('Category_id2'), 'not_empty;min_length[3];max_length[100]');
//$validate->_set_rules($request->getPost('sport_category_3'), $this->translate('Category_id3'), 'not_empty;min_length[3];max_length[100]');
$validate->_set_rules($request->getPost('type_user'), $this->translate('User_type_id'), 'not_empty;min_length[1];max_length[100]');
}
if ($validate->_valid_form()) {
if (md5($request->getPost('password')) != md5($request->getPost('password2'))) {
$validate->_set_form_errors($this->translate('Password and Confirm Password should be the same'));
$validate->_set_valid_form(false);
}
if (Model_Users::isExistEmail($request->getPost('email'))) {
$validate->_set_form_errors($this->translate('This e-mail address is already used'));
$validate->_set_valid_form(false);
}
if (Model_Users::isExistUsername($request->getPost('username'))) {
$validate->_set_form_errors($this->translate('This username is already used'));
$validate->_set_valid_form(false);
}
}
if ($validate->_valid_form()) {
$reg_key = sha1($request->getPost('email') . $request->getPost('username'));
$lat = $request->getPost('lat');
$len = $request->getPost('len');
/*
while (Model_Users::getUsersLatLen($lat, $len))
{
$posLat = strpos($lat, ".");
$longLat = strlen(substr((string) $lat, $posLat));
$cantLat = 0;
//.........这里部分代码省略.........