Beispiel #1
0
 private function getForm()
 {
     $request = $this->getRequest();
     $id = $request->getQuery('id');
     if ($id) {
         $info = Model_Badges::getBadge($id);
     }
     if (!in_array($request->getQuery('type'), array('system', 'other', 'buyers', 'authors', 'referrals'))) {
         $this->redirect($request->getBaseUrl() . $request->getModule() . '/badges/?type=system');
     }
     $this->view->type = $this->getRequest()->getQuery('type');
     if ($request->getPost('name')) {
         $this->view->name = $request->getPost('name');
     } elseif (isset($info)) {
         $this->view->name = $info['name'];
     } else {
         $this->view->name = '';
     }
     if ($request->getPost('sys_key')) {
         $this->view->sys_key = $request->getPost('sys_key');
     } elseif (isset($info)) {
         $this->view->sys_key = $info['sys_key'];
     } else {
         $this->view->sys_key = '';
     }
     if ($request->getPost('from')) {
         $this->view->from = $request->getPost('from');
     } elseif (isset($info)) {
         $this->view->from = $info['from'];
     } else {
         $this->view->from = '';
     }
     if ($request->getPost('to')) {
         $this->view->to = $request->getPost('to');
     } elseif (isset($info)) {
         $this->view->to = $info['to'];
     } else {
         $this->view->to = '';
     }
     if ($request->getPost('visible')) {
         $this->view->visible = $request->getPost('visible');
     } elseif (isset($info)) {
         $this->view->visible = $info['visible'];
     } else {
         $this->view->visible = 'true';
     }
     if (isset($info)) {
         $this->view->photo = $info['photo'];
     } else {
         $this->view->photo = '';
     }
     $this->view->badges_system = array('location_global_community' => $this->translate('Location. We\'re a Global Community!'), 'has_free_file_month' => $this->translate('Has contributed a Free File of the Month'), 'has_been_featured' => $this->translate('Has been featured'), 'has_had_item_featured' => $this->translate('Has had an item featured'), 'is_exclusive_author' => $this->translate('Is an exclusive author'));
 }
Beispiel #2
0
 private function getForm()
 {
     $request = $this->getRequest();
     $user_id = $request->getQuery('id');
     $url = '';
     if ($request->getQuery('sort')) {
         $url .= '&sort=' . $request->getQuery('sort');
     }
     if ($request->getQuery('order')) {
         $url .= '&order=' . $request->getQuery('order');
     }
     if ($request->getQuery('page')) {
         $url .= '&page=' . $request->getQuery('page');
     }
     if ($request->getQuery('filter_id')) {
         $url .= '&filter_id=' . $request->getQuery('filter_id');
     }
     if ($request->getQuery('filter_username')) {
         $url .= '&filter_username='******'filter_username');
     }
     if ($request->getQuery('filter_total')) {
         $url .= '&filter_total=' . $request->getQuery('filter_total');
     }
     if ($request->getQuery('filter_sales')) {
         $url .= '&filter_sales=' . $request->getQuery('filter_sales');
     }
     if ($request->getQuery('filter_sold')) {
         $url .= '&filter_sold=' . $request->getQuery('filter_sold');
     }
     if ($request->getQuery('filter_web_profit2')) {
         $url .= '&filter_web_profit2=' . $request->getQuery('filter_web_profit2');
     }
     if ($request->getQuery('filter_commission')) {
         $url .= '&filter_commission=' . $request->getQuery('filter_commission');
     }
     if ($request->getQuery('filter_items')) {
         $url .= '&filter_items=' . $request->getQuery('filter_items');
     }
     if ($request->getQuery('filter_referals')) {
         $url .= '&filter_referals=' . $request->getQuery('filter_referals');
     }
     if ($request->getQuery('filter_referal_money')) {
         $url .= '&filter_referal_money=' . $request->getQuery('filter_referal_money');
     }
     if ($request->getQuery('filter_featured_author')) {
         $url .= '&filter_featured_author=' . $request->getQuery('filter_featured_author');
     }
     $this->view->cancel_href = $this->getRequest()->getBaseUrl() . $this->getRequest()->getModule() . '/users/?' . $url;
     $model_users = new Model_Users();
     if ($user_id) {
         $user_info = $model_users->getUser($user_id);
     }
     if (isset($user_info)) {
         $this->view->user_id = $user_id;
         $this->view->username = $user_info['username'];
         $this->view->names = $user_info['firstname'] . ' ' . $user_info['lastname'];
         $this->view->email = $user_info['email'];
         $this->view->exclusive_author = $user_info['exclusive_author'];
         $model_images = new Model_Images();
         $this->view->avatar = $model_images->resize($user_info['avatar'], 80, 80, true);
         $this->view->profile_title = $user_info['profile_title'];
         $this->view->profile_desc = $user_info['profile_desc'];
         $this->view->country_id = $user_info['country_id'];
         $this->view->author_status = $user_info['author_status'];
         $this->view->author_status_description = $user_info['author_status_description'];
         $country_info = Model_Countries::getCountry($user_info['country_id']);
         if ($country_info) {
             $this->view->country = $country_info['name'];
         }
         $this->view->live_city = $user_info['live_city'];
         $register_datetime = new JO_Date($user_info['register_datetime'], 'dd MM yy');
         $this->view->register_datetime = $register_datetime->toString();
         $last_login_datetime = new JO_Date($user_info['last_login_datetime'], 'dd MM yy');
         $this->view->last_login_datetime = $last_login_datetime->toString();
         $other = Model_Users::getStatistic($user_id);
         $this->view->deposit = WM_Currency::format($other['deposit']);
         $this->view->total = WM_Currency::format($other['total']);
         $this->view->items = array();
         foreach ($other['items'] as $item) {
             $datetime = new JO_Date($item['datetime'], 'dd MM yy');
             $this->view->items[] = array('id' => $item['item_id'], 'item_name' => $item['item_name'], 'price' => WM_Currency::format($item['price']), 'href' => WM_Router::create($request->getBaseUrl() . '?module=' . $item['module'] . '&controller=items&item_id=' . $item['item_id']), 'datetime' => $datetime->toString());
         }
     }
     if ($request->getPost('commission_percent')) {
         $this->view->commission_percent = $request->getPost('commission_percent');
     } elseif (isset($user_info)) {
         $this->view->commission_percent = $user_info['commission_percent'];
     }
     if ($request->getPost('featured_author')) {
         $this->view->featured_author = $request->getPost('featured_author');
     } elseif (isset($user_info)) {
         $this->view->featured_author = $user_info['featured_author'];
     }
     if ($request->getPost('status')) {
         $this->view->status = $request->getPost('status');
     } elseif (isset($user_info)) {
         $this->view->status = $user_info['status'];
     }
     if ($request->getPost('groups')) {
         $this->view->groups = $request->getPost('groups');
     } elseif (isset($user_info)) {
         $this->view->groups = (array) unserialize($user_info['groups']);
     } else {
         $this->view->groups = array();
     }
     if ($request->getPost('badges')) {
         $this->view->badges = $request->getPost('badges');
     } elseif (isset($user_info)) {
         $this->view->badges = explode(',', $user_info['badges']);
     } else {
         $this->view->badges = array();
     }
     $this->view->groups_list = Model_Usergroups::getGroups();
     $this->view->badges_list = Model_Badges::getBadges(array('filter_type' => 'other'));
 }
Beispiel #3
0
 public static function userBadges($user)
 {
     $user_badges = array();
     if (!$user) {
         return $user_badges;
     }
     $badges_data = Model_Badges::getAllFront();
     $other_badges = isset($user['badges']) ? array_map('trim', explode(',', $user['badges'])) : array();
     if (isset($user['exclusive_author']) && $user['exclusive_author'] == 'true' && isset($badges_data['system']['is_exclusive_author'])) {
         if ($badges_data['system']['is_exclusive_author']['photo'] && file_exists("uploads/badges/" . $badges_data['system']['is_exclusive_author']['photo'])) {
             $user_badges[] = array('name' => $badges_data['system']['is_exclusive_author']['name'], 'photo' => 'uploads/badges/' . $badges_data['system']['is_exclusive_author']['photo']);
         }
     }
     if (isset($user['featured_author']) && $user['featured_author'] == 'true' && isset($badges_data['system']['has_been_featured'])) {
         if ($badges_data['system']['has_been_featured']['photo'] && file_exists("uploads/badges/" . $badges_data['system']['has_been_featured']['photo'])) {
             $user_badges[] = array('name' => $badges_data['system']['has_been_featured']['name'], 'photo' => 'uploads/badges/' . $badges_data['system']['has_been_featured']['photo']);
         }
     }
     if (isset($user['statuses']['freefile']) && $user['statuses']['freefile'] && isset($badges_data['system']['has_free_file_month'])) {
         if ($badges_data['system']['has_free_file_month']['photo'] && file_exists("uploads/badges/" . $badges_data['system']['has_free_file_month']['photo'])) {
             $user_badges[] = array('name' => $badges_data['system']['has_free_file_month']['name'], 'photo' => 'uploads/badges/' . $badges_data['system']['has_free_file_month']['photo']);
         }
     }
     if (isset($user['statuses']['featured']) && $user['statuses']['featured'] && isset($badges_data['system']['has_had_item_featured'])) {
         if ($badges_data['system']['has_free_file_month']['photo'] && file_exists("uploads/badges/" . $badges_data['system']['has_had_item_featured']['photo'])) {
             $user_badges[] = array('name' => $badges_data['system']['has_had_item_featured']['name'], 'photo' => 'uploads/badges/' . $badges_data['system']['has_had_item_featured']['photo']);
         }
     }
     if (isset($user['buy']) && $user['buy'] && isset($badges_data['buyers']) && is_array($badges_data['buyers'])) {
         foreach ($badges_data['buyers'] as $k => $v) {
             list($from, $to) = explode('-', $k);
             if ($from <= $user['buy'] && $to >= $user['buy']) {
                 if ($v['photo'] && file_exists("uploads/badges/" . $v['photo'])) {
                     $user_badges[] = array('name' => $v['name'], 'photo' => 'uploads/badges/' . $v['photo']);
                 }
                 break;
             }
         }
     }
     if (isset($user['sold']) && $user['sold'] && isset($badges_data['authors']) && is_array($badges_data['authors'])) {
         foreach ($badges_data['authors'] as $k => $v) {
             list($from, $to) = explode('-', $k);
             if ($from <= $user['sold'] && $to >= $user['sold']) {
                 if ($v['photo'] && file_exists("uploads/badges/" . $v['photo'])) {
                     $user_badges[] = array('name' => $v['name'], 'photo' => 'uploads/badges/' . $v['photo']);
                 }
                 break;
             }
         }
     }
     if (isset($user['referals']) && $user['referals'] && isset($badges_data['referrals']) && is_array($badges_data['referrals'])) {
         foreach ($badges_data['referrals'] as $k => $v) {
             list($from, $to) = explode('-', $k);
             if ($from <= $user['referals'] && $to >= $user['referals']) {
                 if ($v['photo'] && file_exists("uploads/badges/" . $v['photo'])) {
                     $user_badges[] = array('name' => $v['name'], 'photo' => 'uploads/badges/' . $v['photo']);
                 }
                 break;
             }
         }
     }
     if (isset($badges_data['other']) && is_array($badges_data['other'])) {
         foreach ($badges_data['other'] as $k => $b) {
             if (in_array($k, $other_badges) && $b['photo'] && file_exists("uploads/badges/" . $b['photo'])) {
                 $user_badges[] = array('name' => $b['name'], 'photo' => 'uploads/badges/' . $b['photo']);
             }
         }
     }
     if (isset($user['country_id']) && $user['country_id']) {
         $country = Model_Countries::get($user['country_id']);
         if ($country) {
             $user['country'] = $country;
         }
     }
     if (isset($user['country']['photo']) && $user['country']['photo'] && file_exists("uploads/countries/" . $user['country']['photo'])) {
         $user_badges[] = array('name' => $user['country']['name'], 'photo' => 'uploads/countries/' . $user['country']['photo']);
     } elseif (isset($badges_data['system']['location_global_community']) && $badges_data['system']['location_global_community']['photo'] && file_exists("uploads/badges/" . $badges_data['system']['location_global_community']['photo'])) {
         $user_badges[] = array('name' => $badges_data['system']['location_global_community']['name'], 'photo' => 'uploads/badges/' . $badges_data['system']['location_global_community']['photo']);
     }
     return $user_badges;
 }